From 5be5da0a68687bb04055882494b48b703fab0c52 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Tue, 18 Jul 2023 15:57:30 +0300 Subject: [PATCH 001/165] chore(gclient): improve `get_state` test (#2955) --- gclient/tests/state.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/gclient/tests/state.rs b/gclient/tests/state.rs index d3740f15930..eed29c931f7 100644 --- a/gclient/tests/state.rs +++ b/gclient/tests/state.rs @@ -20,10 +20,6 @@ use demo_meta_io::Wallet; use gclient::{EventProcessor, GearApi}; use gmeta::MetadataRepr; use parity_scale_codec::Decode; -use tokio::fs; - -// TODO: remove in order to directly import metadata (issue #2945). -const META_PATH: &str = "../examples/new-meta/demo_new_meta.meta.txt"; #[tokio::test] async fn get_state() -> anyhow::Result<()> { @@ -56,9 +52,8 @@ async fn get_state() -> anyhow::Result<()> { // Read and check `metahash` let actual_metahash = api.read_metahash(program_id).await?.0; - let meta = fs::read_to_string(META_PATH).await?; - let expected_metahash = MetadataRepr::from_hex(meta) - .expect("Failed to read meta from hex") + let expected_metahash = MetadataRepr::from_bytes(demo_new_meta::WASM_METADATA) + .expect("Failed to read meta from bytes") .hash(); assert_eq!(actual_metahash, expected_metahash); From 96b0558a6f7240b9e5e43a714e3aded3548d2847 Mon Sep 17 00:00:00 2001 From: Georgy Shepelev Date: Wed, 19 Jul 2023 09:13:24 +0400 Subject: [PATCH 002/165] refactor(sandbox-host): Remove unnecessary 'host-sandbox' feature (#2954) --- core-backend/sandbox/Cargo.toml | 2 +- lazy-pages/Cargo.toml | 2 +- runtime-interface/Cargo.toml | 1 - runtime-interface/src/gear_sandbox/detail.rs | 2 +- sandbox/host/Cargo.toml | 8 +--- sandbox/host/src/sandbox.rs | 50 +++++--------------- sandbox/sandbox/Cargo.toml | 1 - sandbox/sandbox/src/lib.rs | 4 +- 8 files changed, 19 insertions(+), 51 deletions(-) diff --git a/core-backend/sandbox/Cargo.toml b/core-backend/sandbox/Cargo.toml index 796413827ec..4d9b264c6d3 100644 --- a/core-backend/sandbox/Cargo.toml +++ b/core-backend/sandbox/Cargo.toml @@ -12,7 +12,7 @@ gear-backend-common.workspace = true gsys ={ workspace = true } gear-wasm-instrument.workspace = true -gear-sandbox = { workspace = true, features = ["host-sandbox"] } +gear-sandbox.workspace = true # Use max_level_debug feature to remove tracing in sys-calls by default. log.workspace = true derive_more.workspace = true diff --git a/lazy-pages/Cargo.toml b/lazy-pages/Cargo.toml index ce90b741a49..a088e0b9a48 100644 --- a/lazy-pages/Cargo.toml +++ b/lazy-pages/Cargo.toml @@ -20,7 +20,7 @@ derive_more.workspace = true static_assertions.workspace = true once_cell.workspace = true -gear-sandbox-host = { workspace = true, features = ["host-sandbox"] } +gear-sandbox-host.workspace = true gear-core.workspace = true gear-backend-common.workspace = true diff --git a/runtime-interface/Cargo.toml b/runtime-interface/Cargo.toml index 861e339545b..5bdad24e5a5 100644 --- a/runtime-interface/Cargo.toml +++ b/runtime-interface/Cargo.toml @@ -40,4 +40,3 @@ std = [ "region", "gear-sandbox-host", ] -host-sandbox = ["gear-sandbox-host?/host-sandbox"] diff --git a/runtime-interface/src/gear_sandbox/detail.rs b/runtime-interface/src/gear_sandbox/detail.rs index a0e1d47c22b..33cd6697b87 100644 --- a/runtime-interface/src/gear_sandbox/detail.rs +++ b/runtime-interface/src/gear_sandbox/detail.rs @@ -35,7 +35,7 @@ impl Store { pub fn new() -> Self { Self { store_data_key: 0, - store: sandbox_env::Store::new(sandbox_env::SandboxBackend::TryWasmer), + store: sandbox_env::Store::new(sandbox_env::SandboxBackend::Wasmer), } } diff --git a/sandbox/host/Cargo.toml b/sandbox/host/Cargo.toml index 4d5ecdf98cb..854f36e26a0 100644 --- a/sandbox/host/Cargo.toml +++ b/sandbox/host/Cargo.toml @@ -17,7 +17,7 @@ codec = { workspace = true, features = ["std"] } environmental = "1.1.3" thiserror.workspace = true log = { workspace = true, features = ["std"] } -wasmer = { version = "2.2", features = ["singlepass"], optional = true } +wasmer = { version = "2.2", features = ["singlepass"] } wasmi = { git = "https://github.com/gear-tech/wasmi", branch = "v0.13.2-sign-ext", features = ["virtual_memory"] } sp-allocator = { workspace = true, features = ["std"] } sp-wasm-interface = { workspace = true, features = ["std"] } @@ -27,8 +27,4 @@ once_cell = "1.17.1" tempfile = "3.5.0" [features] -default = ["host-sandbox"] -host-sandbox = [ - "wasmer", - "wasmer-cache", -] +default = ["wasmer-cache"] diff --git a/sandbox/host/src/sandbox.rs b/sandbox/host/src/sandbox.rs index 5b0dae9f3fc..4cafa6502a6 100644 --- a/sandbox/host/src/sandbox.rs +++ b/sandbox/host/src/sandbox.rs @@ -20,7 +20,6 @@ //! //! Sandboxing is backed by wasmi and wasmer, depending on the configuration. -#[cfg(feature = "host-sandbox")] mod wasmer_backend; mod wasmi_backend; @@ -35,16 +34,17 @@ use crate::{ util, }; -#[cfg(feature = "host-sandbox")] -use self::wasmer_backend::{ - get_global as wasmer_get_global, instantiate as wasmer_instantiate, invoke as wasmer_invoke, - new_memory as wasmer_new_memory, set_global as wasmer_set_global, Backend as WasmerBackend, - MemoryWrapper as WasmerMemoryWrapper, -}; -use self::wasmi_backend::{ - get_global as wasmi_get_global, instantiate as wasmi_instantiate, invoke as wasmi_invoke, - new_memory as wasmi_new_memory, set_global as wasmi_set_global, - MemoryWrapper as WasmiMemoryWrapper, +use self::{ + wasmer_backend::{ + get_global as wasmer_get_global, instantiate as wasmer_instantiate, + invoke as wasmer_invoke, new_memory as wasmer_new_memory, set_global as wasmer_set_global, + Backend as WasmerBackend, MemoryWrapper as WasmerMemoryWrapper, + }, + wasmi_backend::{ + get_global as wasmi_get_global, instantiate as wasmi_instantiate, invoke as wasmi_invoke, + new_memory as wasmi_new_memory, set_global as wasmi_set_global, + MemoryWrapper as WasmiMemoryWrapper, + }, }; pub use gear_sandbox_env as env; @@ -186,7 +186,6 @@ enum BackendInstance { Wasmi(wasmi::ModuleRef), /// Wasmer module instance - #[cfg(feature = "host-sandbox")] Wasmer(wasmer::Instance), } @@ -225,7 +224,6 @@ impl SandboxInstance { wasmi_invoke(self, wasmi_instance, export_name, args, sandbox_context) } - #[cfg(feature = "host-sandbox")] BackendInstance::Wasmer(wasmer_instance) => { wasmer_invoke(wasmer_instance, export_name, args, sandbox_context) } @@ -239,7 +237,6 @@ impl SandboxInstance { match &self.backend_instance { BackendInstance::Wasmi(wasmi_instance) => wasmi_get_global(wasmi_instance, name), - #[cfg(feature = "host-sandbox")] BackendInstance::Wasmer(wasmer_instance) => wasmer_get_global(wasmer_instance, name), } } @@ -255,7 +252,6 @@ impl SandboxInstance { match &self.backend_instance { BackendInstance::Wasmi(wasmi_instance) => wasmi_set_global(wasmi_instance, name, value), - #[cfg(feature = "host-sandbox")] BackendInstance::Wasmer(wasmer_instance) => { wasmer_set_global(wasmer_instance, name, value) } @@ -369,11 +365,7 @@ pub enum SandboxBackend { Wasmi, /// Wasmer environment - #[cfg(feature = "host-sandbox")] Wasmer, - - /// Use wasmer backend if available. Fall back to wasmi otherwise. - TryWasmer, } /// Memory reference in terms of a selected backend @@ -383,7 +375,6 @@ pub enum Memory { Wasmi(WasmiMemoryWrapper), /// Wasmer memory refernce - #[cfg(feature = "host-sandbox")] Wasmer(WasmerMemoryWrapper), } @@ -393,13 +384,11 @@ impl Memory { match self { Memory::Wasmi(memory) => Some(memory.clone()), - #[cfg(feature = "host-sandbox")] Memory::Wasmer(_) => None, } } /// View as wasmer memory - #[cfg(feature = "host-sandbox")] pub fn as_wasmer(&self) -> Option { match self { Memory::Wasmer(memory) => Some(memory.clone()), @@ -413,7 +402,6 @@ impl util::MemoryTransfer for Memory { match self { Memory::Wasmi(sandboxed_memory) => sandboxed_memory.read(source_addr, size), - #[cfg(feature = "host-sandbox")] Memory::Wasmer(sandboxed_memory) => sandboxed_memory.read(source_addr, size), } } @@ -422,7 +410,6 @@ impl util::MemoryTransfer for Memory { match self { Memory::Wasmi(sandboxed_memory) => sandboxed_memory.read_into(source_addr, destination), - #[cfg(feature = "host-sandbox")] Memory::Wasmer(sandboxed_memory) => { sandboxed_memory.read_into(source_addr, destination) } @@ -433,7 +420,6 @@ impl util::MemoryTransfer for Memory { match self { Memory::Wasmi(sandboxed_memory) => sandboxed_memory.write_from(dest_addr, source), - #[cfg(feature = "host-sandbox")] Memory::Wasmer(sandboxed_memory) => sandboxed_memory.write_from(dest_addr, source), } } @@ -442,7 +428,6 @@ impl util::MemoryTransfer for Memory { match self { Memory::Wasmi(sandboxed_memory) => sandboxed_memory.memory_grow(pages), - #[cfg(feature = "host-sandbox")] Memory::Wasmer(sandboxed_memory) => sandboxed_memory.memory_grow(pages), } } @@ -451,7 +436,6 @@ impl util::MemoryTransfer for Memory { match self { Memory::Wasmi(sandboxed_memory) => sandboxed_memory.memory_size(), - #[cfg(feature = "host-sandbox")] Memory::Wasmer(sandboxed_memory) => sandboxed_memory.memory_size(), } } @@ -460,7 +444,6 @@ impl util::MemoryTransfer for Memory { match self { Memory::Wasmi(sandboxed_memory) => sandboxed_memory.get_buff(), - #[cfg(feature = "host-sandbox")] Memory::Wasmer(sandboxed_memory) => sandboxed_memory.get_buff(), } } @@ -472,7 +455,6 @@ enum BackendContext { Wasmi, /// Wasmer specific context - #[cfg(feature = "host-sandbox")] Wasmer(WasmerBackend), } @@ -481,13 +463,7 @@ impl BackendContext { match backend { SandboxBackend::Wasmi => BackendContext::Wasmi, - #[cfg(not(feature = "host-sandbox"))] - SandboxBackend::TryWasmer => BackendContext::Wasmi, - - #[cfg(feature = "host-sandbox")] - SandboxBackend::Wasmer | SandboxBackend::TryWasmer => { - BackendContext::Wasmer(WasmerBackend::new()) - } + SandboxBackend::Wasmer => BackendContext::Wasmer(WasmerBackend::new()), } } } @@ -554,7 +530,6 @@ impl Store
{ let memory = match &backend_context { BackendContext::Wasmi => wasmi_new_memory(initial, maximum)?, - #[cfg(feature = "host-sandbox")] BackendContext::Wasmer(context) => wasmer_new_memory(context, initial, maximum)?, }; @@ -661,7 +636,6 @@ impl Store
{ let sandbox_instance = match self.backend_context { BackendContext::Wasmi => wasmi_instantiate(wasm, guest_env, sandbox_context)?, - #[cfg(feature = "host-sandbox")] BackendContext::Wasmer(ref context) => { wasmer_instantiate(context, wasm, guest_env, sandbox_context)? } diff --git a/sandbox/sandbox/Cargo.toml b/sandbox/sandbox/Cargo.toml index 36dbf5ddaed..9332dfdeefd 100644 --- a/sandbox/sandbox/Cargo.toml +++ b/sandbox/sandbox/Cargo.toml @@ -40,4 +40,3 @@ std = [ "wasmi/virtual_memory", ] strict = [] -host-sandbox = ["gear-runtime-interface/host-sandbox"] diff --git a/sandbox/sandbox/src/lib.rs b/sandbox/sandbox/src/lib.rs index 7e9fda46ad3..ccbf1be9969 100644 --- a/sandbox/sandbox/src/lib.rs +++ b/sandbox/sandbox/src/lib.rs @@ -52,10 +52,10 @@ use sp_std::prelude::*; use sp_wasm_interface::HostPointer; pub use sp_wasm_interface::{ReturnValue, Value}; -#[cfg(not(all(feature = "host-sandbox", not(feature = "std"))))] +#[cfg(feature = "std")] pub use self::embedded_executor as default_executor; pub use self::env::HostError; -#[cfg(all(feature = "host-sandbox", not(feature = "std")))] +#[cfg(not(feature = "std"))] pub use self::host_executor as default_executor; /// The target used for logging. From e1059c0b20cc18fa718a0cdfaae9ba71ea789329 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Sat, 22 Jul 2023 12:06:20 +0300 Subject: [PATCH 003/165] feat(wasm-builder): Set optimisation params (#2973) --- examples/fungible-token/src/contract.rs | 33 +++++++++++++------------ utils/wasm-builder/src/optimize.rs | 1 + utils/wasm-builder/src/wasm_project.rs | 11 ++++++--- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/examples/fungible-token/src/contract.rs b/examples/fungible-token/src/contract.rs index b5cd0a39309..6980162b974 100644 --- a/examples/fungible-token/src/contract.rs +++ b/examples/fungible-token/src/contract.rs @@ -54,34 +54,36 @@ impl FungibleToken { } fn mint(&mut self, amount: u128) { + let source = msg::source(); self.balances - .entry(msg::source()) + .entry(source) .and_modify(|balance| *balance += amount) .or_insert(amount); self.total_supply += amount; msg::reply( FTEvent::Transfer { from: ZERO_ID, - to: msg::source(), + to: source, amount, }, 0, ) .unwrap(); } - + /// Executed on receiving `fungible-token-messages::BurnInput`. fn burn(&mut self, amount: u128) { - if self.balances.get(&msg::source()).unwrap_or(&0) < &amount { + let source = msg::source(); + if self.balances.get(&source).unwrap_or(&0) < &amount { panic!("Amount exceeds account balance"); } self.balances - .entry(msg::source()) + .entry(source) .and_modify(|balance| *balance -= amount); self.total_supply -= amount; msg::reply( FTEvent::Transfer { - from: msg::source(), + from: source, to: ZERO_ID, amount, }, @@ -89,7 +91,7 @@ impl FungibleToken { ) .unwrap(); } - + /// Executed on receiving `fungible-token-messages::TransferInput` or `fungible-token-messages::TransferFromInput`. /// Transfers `amount` tokens from `sender` account to `recipient` account. fn transfer(&mut self, from: &ActorId, to: &ActorId, amount: u128) { if from == &ZERO_ID || to == &ZERO_ID { @@ -119,17 +121,19 @@ impl FungibleToken { .unwrap(); } + /// Executed on receiving `fungible-token-messages::ApproveInput`. fn approve(&mut self, to: &ActorId, amount: u128) { if to == &ZERO_ID { panic!("Approve to zero address"); } + let source = msg::source(); self.allowances - .entry(msg::source()) + .entry(source) .or_default() .insert(*to, amount); msg::reply( FTEvent::Approve { - from: msg::source(), + from: source, to: *to, amount, }, @@ -139,17 +143,14 @@ impl FungibleToken { } fn can_transfer(&mut self, from: &ActorId, amount: u128) -> bool { - if from == &msg::source() || self.balances.get(&msg::source()).unwrap_or(&0) >= &amount { + let source = msg::source(); + if from == &source || self.balances.get(&source).unwrap_or(&0) >= &amount { return true; } - if let Some(allowed_amount) = self - .allowances - .get(from) - .and_then(|m| m.get(&msg::source())) - { + if let Some(allowed_amount) = self.allowances.get(from).and_then(|m| m.get(&source)) { if allowed_amount >= &amount { self.allowances.entry(*from).and_modify(|m| { - m.entry(msg::source()).and_modify(|a| *a -= amount); + m.entry(source).and_modify(|a| *a -= amount); }); return true; } diff --git a/utils/wasm-builder/src/optimize.rs b/utils/wasm-builder/src/optimize.rs index 88c3aed181f..0ad73346ecf 100644 --- a/utils/wasm-builder/src/optimize.rs +++ b/utils/wasm-builder/src/optimize.rs @@ -277,6 +277,7 @@ pub fn do_optimization( "z" => OptimizationOptions::new_optimize_for_size_aggressively(), _ => panic!("Invalid optimization level {}", optimization_level), } + .shrink_level(wasm_opt::ShrinkLevel::Level2) .add_pass(Pass::Dae) .add_pass(Pass::Vacuum) // the memory in our module is imported, `wasm-opt` needs to be told that diff --git a/utils/wasm-builder/src/wasm_project.rs b/utils/wasm-builder/src/wasm_project.rs index e1fdf957f05..579ad88445d 100644 --- a/utils/wasm-builder/src/wasm_project.rs +++ b/utils/wasm-builder/src/wasm_project.rs @@ -31,6 +31,8 @@ use std::{ }; use toml::value::Table; +const OPT_LEVEL: &str = "z"; + /// Enum defining type of binary compiling: production program or metawasm. pub enum ProjectType { Program(Option), @@ -158,11 +160,12 @@ impl WasmProject { lib.insert("crate-type".into(), vec!["cdylib".to_string()].into()); let mut dev_profile = Table::new(); - dev_profile.insert("opt-level".into(), "s".into()); + dev_profile.insert("opt-level".into(), OPT_LEVEL.into()); let mut release_profile = Table::new(); - release_profile.insert("lto".into(), true.into()); - release_profile.insert("opt-level".into(), "s".into()); + release_profile.insert("lto".into(), "fat".into()); + release_profile.insert("opt-level".into(), OPT_LEVEL.into()); + release_profile.insert("codegen-units".into(), 1.into()); let mut production_profile = Table::new(); production_profile.insert("inherits".into(), "release".into()); @@ -316,7 +319,7 @@ extern "C" fn metahash() {{ let path = optimize::optimize_wasm( original_copy_wasm_path.clone(), opt_wasm_path.clone(), - "s", + "4", true, ) .map(|res| { From f4e642cd83c04b72cfd0e265e21bf5c0d5dde8a0 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Sat, 22 Jul 2023 22:14:37 +0800 Subject: [PATCH 004/165] refactor(common): move LockId to gear-core (#2966) --- Cargo.lock | 2 +- common/src/gas_provider/lockable.rs | 11 +---------- core/Cargo.toml | 1 + core/src/gas.rs | 15 +++++++++++++++ gclient/Cargo.toml | 1 - gclient/src/api/calls.rs | 2 +- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1205f903867..5e24a8a7878 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3642,7 +3642,6 @@ dependencies = [ "env_logger", "futures", "futures-timer", - "gear-common", "gear-core", "gear-core-errors", "gear-utils", @@ -3870,6 +3869,7 @@ version = "0.1.0" dependencies = [ "blake2-rfc", "derive_more", + "enum-iterator 1.4.1", "env_logger", "gear-core-errors", "gear-wasm-instrument", diff --git a/common/src/gas_provider/lockable.rs b/common/src/gas_provider/lockable.rs index c4cb36376e5..8e48be65743 100644 --- a/common/src/gas_provider/lockable.rs +++ b/common/src/gas_provider/lockable.rs @@ -17,16 +17,7 @@ // along with this program. If not, see . use super::{scheduler::StorageType, *}; -use enum_iterator::Sequence; - -#[derive(Debug, Clone, Copy, PartialEq, Eq, Sequence)] -#[repr(u8)] -pub enum LockId { - Mailbox, - Waitlist, - Reservation, - DispatchStash, -} +pub use gear_core::gas::LockId; /// An error indicating there is no corresponding enum variant to the one provided #[derive(Debug)] diff --git a/core/Cargo.toml b/core/Cargo.toml index 7c23048e3b5..e430f73d697 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -18,6 +18,7 @@ hex = { workspace = true, features = ["alloc"] } hashbrown.workspace = true static_assertions.workspace = true paste = { workspace = true } +enum-iterator.workspace = true [dev-dependencies] wabt.workspace = true diff --git a/core/src/gas.rs b/core/src/gas.rs index d4f3a9cd1b9..9cedb49b3a4 100644 --- a/core/src/gas.rs +++ b/core/src/gas.rs @@ -19,8 +19,23 @@ //! Gas module. use crate::costs::RuntimeCosts; +use enum_iterator::Sequence; use scale_info::scale::{Decode, Encode}; +/// The id of the gas lock. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Sequence)] +#[repr(u8)] +pub enum LockId { + /// The gas lock is provided by the mailbox. + Mailbox, + /// The gas lock is provided by the waitlist. + Waitlist, + /// The gas lock is provided by reservation. + Reservation, + /// The gas lock is provided by dispatch stash. + DispatchStash, +} + /// This trait represents a token that can be used for charging `GasCounter`. /// /// Implementing type is expected to be super lightweight hence `Copy` (`Clone` is added diff --git a/gclient/Cargo.toml b/gclient/Cargo.toml index fead831b437..10d3f74388b 100644 --- a/gclient/Cargo.toml +++ b/gclient/Cargo.toml @@ -10,7 +10,6 @@ gear-utils.workspace = true gsdk = { workspace = true, features = ["testing"] } gear-core.workspace = true gear-core-errors.workspace = true -gear-common = { workspace = true, features = ["std"] } futures.workspace = true anyhow.workspace = true diff --git a/gclient/src/api/calls.rs b/gclient/src/api/calls.rs index 37dc0121008..f8b95e77360 100644 --- a/gclient/src/api/calls.rs +++ b/gclient/src/api/calls.rs @@ -18,8 +18,8 @@ use super::{GearApi, Result}; use crate::{api::storage::account_id::IntoAccountId32, utils, Error}; -use gear_common::LockId; use gear_core::{ + gas::LockId, ids::*, memory::PageBuf, pages::{GearPage, PageNumber, PageU32Size, GEAR_PAGE_SIZE, WASM_PAGE_SIZE}, From 45418525a417e6f204a9d76d1e5709029270eab7 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Sat, 22 Jul 2023 23:44:28 +0800 Subject: [PATCH 005/165] feat(gsdk): allow transaction retracted (#2963) --- gsdk/src/signer/calls.rs | 12 ++++++------ gsdk/src/signer/mod.rs | 15 +++++++-------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/gsdk/src/signer/calls.rs b/gsdk/src/signer/calls.rs index 5f832e3dbef..901a41a928e 100644 --- a/gsdk/src/signer/calls.rs +++ b/gsdk/src/signer/calls.rs @@ -343,16 +343,16 @@ impl Signer { b.block_hash(), b.extrinsic_hash() ), - TxStatus::Retracted(h) => log::info!(" Status: Retracted( {h} )"), - TxStatus::FinalityTimeout(h) => log::info!(" Status: FinalityTimeout( {h} )"), + TxStatus::Retracted(h) => log::warn!(" Status: Retracted( {h} )"), + TxStatus::FinalityTimeout(h) => log::error!(" Status: FinalityTimeout( {h} )"), TxStatus::Finalized(b) => log::info!( " Status: Finalized( block hash: {}, extrinsic hash: {} )", b.block_hash(), b.extrinsic_hash() ), - TxStatus::Usurped(h) => log::info!(" Status: Usurped( {h} )"), - TxStatus::Dropped => log::info!(" Status: Dropped"), - TxStatus::Invalid => log::info!(" Status: Invalid"), + TxStatus::Usurped(h) => log::error!(" Status: Usurped( {h} )"), + TxStatus::Dropped => log::error!(" Status: Dropped"), + TxStatus::Invalid => log::error!(" Status: Invalid"), } } @@ -389,7 +389,7 @@ impl Signer { let status = status?; self.log_status(&status); match status { - Future | Ready | Broadcast(_) | InBlock(_) => (), + Future | Ready | Broadcast(_) | InBlock(_) | Retracted(_) => (), Finalized(b) => { log::info!( "Successfully submitted call {}::{} {} at {}!", diff --git a/gsdk/src/signer/mod.rs b/gsdk/src/signer/mod.rs index f0de6c90a76..c421673bc69 100644 --- a/gsdk/src/signer/mod.rs +++ b/gsdk/src/signer/mod.rs @@ -52,16 +52,15 @@ impl Signer { } /// Change inner signer. - pub fn change(self, suri: &str, passwd: Option<&str>) -> Result { - Ok(Self { - api: self.api, - signer: PairSigner::new( - Pair::from_string(suri, passwd).map_err(|_| Error::InvalidSecret)?, - ), - nonce: None, - }) + pub fn change(mut self, suri: &str, passwd: Option<&str>) -> Result { + let signer = + PairSigner::new(Pair::from_string(suri, passwd).map_err(|_| Error::InvalidSecret)?); + self.signer = signer; + + Ok(self) } + /// Set nonce of the signer pub fn set_nonce(&mut self, nonce: u32) { self.nonce = Some(nonce) } From 6e3ad0607102654368db45bea7d2caf491cc581d Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Sat, 22 Jul 2023 19:12:49 +0300 Subject: [PATCH 006/165] chore(ft-benchmarks): fix wrong path and set PRNG seed (#2964) --- examples/fungible-token/tests/benchmarks.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/fungible-token/tests/benchmarks.rs b/examples/fungible-token/tests/benchmarks.rs index 10a255d8f30..63596aabce8 100644 --- a/examples/fungible-token/tests/benchmarks.rs +++ b/examples/fungible-token/tests/benchmarks.rs @@ -23,11 +23,11 @@ use ft_io::*; use gclient::{EventProcessor, GearApi, Result}; use gear_core::ids::{MessageId, ProgramId}; use gstd::{vec, ActorId, Encode, Vec}; -use rand::Rng; +use rand::{rngs::StdRng, Rng, SeedableRng}; use statrs::statistics::Statistics; /// Path to the gear node binary. -const GEAR_PATH: &str = "../../../target/release/gear"; +const GEAR_PATH: &str = "../../target/release/gear"; /// This constant defines the number of messages in the batch. /// It is calculated empirically, and 25 is considered the optimal value for @@ -206,7 +206,7 @@ async fn stress_test() -> Result<()> { #[ignore] #[tokio::test] async fn stress_transfer() -> Result<()> { - let mut rng = rand::thread_rng(); + let mut rng = StdRng::seed_from_u64(42); let api = GearApi::dev_from_path(GEAR_PATH).await?; // Use this code in comment for custom node run: From 86295f60ec851255ef423f37768779d524507f9b Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Sun, 23 Jul 2023 12:05:15 +0300 Subject: [PATCH 007/165] chore(deps): bump parity-scale-codec to 3.6.4 (#2961) --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e24a8a7878..2591c1a9022 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7941,9 +7941,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.3" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "756d439303e94fae44f288ba881ad29670c65b0c4b0e05674ca81061bb65f2c5" +checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" dependencies = [ "arrayvec 0.7.4", "bitvec", @@ -7956,9 +7956,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.3" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d884d78fcf214d70b1e239fcd1c6e5e95aa3be1881918da2e488cc946c7a476" +checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" dependencies = [ "proc-macro-crate 1.1.3", "proc-macro2", @@ -8394,9 +8394,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -8621,9 +8621,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.29" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" dependencies = [ "proc-macro2", ] diff --git a/Cargo.toml b/Cargo.toml index f176f24afb2..fa84c9587a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -115,7 +115,7 @@ base64 = "0.21.0" blake2-rfc = { version = "0.2.18", default-features = false } bs58 = { version = "0.4.0", default-features = false } clap = { version = "4.2.1" } -codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false } +codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false } color-eyre = "0.6.2" colored = "2.0.0" const-str = "0.5" @@ -136,7 +136,7 @@ lazy_static = "1.4.0" libc = { version = "0.2", default-features = false } log = { version = "0.4.17", default-features = false } once_cell = "1.17.1" -parity-scale-codec = { version = "3.6.1", default-features = false } +parity-scale-codec = { version = "3.6.4", default-features = false } parity-wasm = "0.45.0" parking_lot = "0.12.1" path-clean = "1.0.1" From dd05e9e12e3b36e727a8c619e859e755b6ad91cf Mon Sep 17 00:00:00 2001 From: mqxf Date: Mon, 24 Jul 2023 20:36:21 +0200 Subject: [PATCH 008/165] test(core-processor): Add tests for send message limit (#2919) --- core-processor/src/ext.rs | 391 +++++++++++++++++++++++++++++++++++++- 1 file changed, 386 insertions(+), 5 deletions(-) diff --git a/core-processor/src/ext.rs b/core-processor/src/ext.rs index 052bfaeb61e..5f788daaf86 100644 --- a/core-processor/src/ext.rs +++ b/core-processor/src/ext.rs @@ -1041,11 +1041,58 @@ impl Ext { #[cfg(test)] mod tests { use super::*; + use alloc::vec; use gear_core::{ - message::{ContextSettings, IncomingDispatch}, + message::{ContextSettings, IncomingDispatch, Payload, MAX_PAYLOAD_SIZE}, pages::PageNumber, }; + struct MessageContextBuilder { + incoming_dispatch: IncomingDispatch, + program_id: ProgramId, + sending_fee: u64, + scheduled_sending_fee: u64, + waiting_fee: u64, + waking_fee: u64, + reservation_fee: u64, + outgoing_limit: u32, + } + + impl MessageContextBuilder { + fn new() -> Self { + Self { + incoming_dispatch: Default::default(), + program_id: Default::default(), + sending_fee: 0, + scheduled_sending_fee: 0, + waiting_fee: 0, + waking_fee: 0, + reservation_fee: 0, + outgoing_limit: 0, + } + } + + fn build(self) -> MessageContext { + MessageContext::new( + self.incoming_dispatch, + self.program_id, + ContextSettings::new( + self.sending_fee, + self.scheduled_sending_fee, + self.waiting_fee, + self.waking_fee, + self.reservation_fee, + self.outgoing_limit, + ), + ) + } + + fn with_outgoing_limit(mut self, outgoing_limit: u32) -> Self { + self.outgoing_limit = outgoing_limit; + self + } + } + struct ProcessorContextBuilder(ProcessorContext); impl ProcessorContextBuilder { @@ -1091,6 +1138,16 @@ mod tests { Self(default_pc) } + fn build(self) -> ProcessorContext { + self.0 + } + + fn with_message_context(mut self, context: MessageContext) -> Self { + self.0.message_context = context; + + self + } + fn with_gas(mut self, gas_counter: GasCounter) -> Self { self.0.gas_counter = gas_counter; @@ -1114,10 +1171,6 @@ mod tests { self } - - fn build(self) -> ProcessorContext { - self.0 - } } // Invariant: Refund never occurs in `free` call. @@ -1218,6 +1271,334 @@ mod tests { assert_eq!(0, allowance); } + #[test] + // This function tests: + // + // - `send_commit` on valid handle + // - `send_commit` on invalid handle + // - `send_commit` on used handle + // - `send_init` after limit is exceeded + fn test_send_commit() { + let mut ext = Ext::new( + ProcessorContextBuilder::new() + .with_message_context(MessageContextBuilder::new().with_outgoing_limit(1).build()) + .build(), + ); + + let data = HandlePacket::default(); + + let fake_handle = 0; + + let msg = ext.send_commit(fake_handle, data.clone(), 0); + assert_eq!( + msg.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message(MessageError::OutOfBounds)) + ); + + let handle = ext.send_init().expect("Outgoing limit is 1"); + + let msg = ext.send_commit(handle, data.clone(), 0); + assert!(msg.is_ok()); + + let msg = ext.send_commit(handle, data, 0); + assert_eq!( + msg.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message(MessageError::LateAccess)) + ); + + let handle = ext.send_init(); + assert_eq!( + handle.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message( + MessageError::OutgoingMessagesAmountLimitExceeded + )) + ); + } + + #[test] + // This function tests: + // + // - `send_push` on non-existent handle + // - `send_push` on valid handle + // - `send_push` on used handle + // - `send_push` with too large payload + // - `send_push` data is added to buffer + fn test_send_push() { + let mut ext = Ext::new( + ProcessorContextBuilder::new() + .with_message_context( + MessageContextBuilder::new() + .with_outgoing_limit(u32::MAX) + .build(), + ) + .build(), + ); + + let data = HandlePacket::default(); + + let fake_handle = 0; + + let res = ext.send_push(fake_handle, &[0, 0, 0]); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message(MessageError::OutOfBounds)) + ); + + let handle = ext.send_init().expect("Outgoing limit is u32::MAX"); + + let res = ext.send_push(handle, &[1, 2, 3]); + assert!(res.is_ok()); + + let res = ext.send_push(handle, &[4, 5, 6]); + assert!(res.is_ok()); + + let large_payload = vec![0u8; MAX_PAYLOAD_SIZE + 1]; + + let res = ext.send_push(handle, &large_payload); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message( + MessageError::MaxMessageSizeExceed + )) + ); + + let msg = ext.send_commit(handle, data, 0); + assert!(msg.is_ok()); + + let res = ext.send_push(handle, &[7, 8, 9]); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message(MessageError::LateAccess)) + ); + + let (outcome, _) = ext.context.message_context.drain(); + let ContextOutcomeDrain { + mut outgoing_dispatches, + .. + } = outcome.drain(); + let dispatch = outgoing_dispatches + .pop() + .map(|(dispatch, _, _)| dispatch) + .expect("Send commit was ok"); + + assert_eq!(dispatch.message().payload_bytes(), &[1, 2, 3, 4, 5, 6]); + } + + #[test] + // This function tests: + // + // - `send_push_input` on non-existent handle + // - `send_push_input` on valid handle + // - `send_push_input` on used handle + // - `send_push_input` data is added to buffer + fn test_send_push_input() { + let mut ext = Ext::new( + ProcessorContextBuilder::new() + .with_message_context( + MessageContextBuilder::new() + .with_outgoing_limit(u32::MAX) + .build(), + ) + .build(), + ); + + let data = HandlePacket::default(); + + let fake_handle = 0; + + let res = ext.send_push_input(fake_handle, 0, 1); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message(MessageError::OutOfBounds)) + ); + + let handle = ext.send_init().expect("Outgoing limit is u32::MAX"); + + let res = ext + .context + .message_context + .payload_mut() + .try_extend_from_slice(&[1, 2, 3, 4, 5, 6]); + assert!(res.is_ok()); + + let res = ext.send_push_input(handle, 2, 3); + assert!(res.is_ok()); + + let res = ext.send_push_input(handle, 8, 10); + assert!(res.is_ok()); + + let msg = ext.send_commit(handle, data, 0); + assert!(msg.is_ok()); + + let res = ext.send_push_input(handle, 0, 1); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message(MessageError::LateAccess)) + ); + + let (outcome, _) = ext.context.message_context.drain(); + let ContextOutcomeDrain { + mut outgoing_dispatches, + .. + } = outcome.drain(); + let dispatch = outgoing_dispatches + .pop() + .map(|(dispatch, _, _)| dispatch) + .expect("Send commit was ok"); + + assert_eq!(dispatch.message().payload_bytes(), &[3, 4, 5]); + } + + #[test] + // This function requires `reply_push` to work to add extra data. + // This function tests: + // + // - `reply_commit` with too much data + // - `reply_commit` with valid data + // - `reply_commit` duplicate reply + fn test_reply_commit() { + let mut ext = Ext::new( + ProcessorContextBuilder::new() + .with_gas(GasCounter::new(u64::MAX)) + .with_message_context( + MessageContextBuilder::new() + .with_outgoing_limit(u32::MAX) + .build(), + ) + .build(), + ); + + let res = ext.reply_push(&[0]); + assert!(res.is_ok()); + + let res = ext.reply_commit(ReplyPacket::new(Payload::filled_with(0), 0)); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message( + MessageError::MaxMessageSizeExceed + )) + ); + + let res = ext.reply_commit(ReplyPacket::auto()); + assert!(res.is_ok()); + + let res = ext.reply_commit(ReplyPacket::auto()); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message(MessageError::DuplicateReply)) + ); + } + + #[test] + // This function requires `reply_push` to work to add extra data. + // This function tests: + // + // - `reply_push` with valid data + // - `reply_push` with too much data + // - `reply_push` after `reply_commit` + // - `reply_push` data is added to buffer + fn test_reply_push() { + let mut ext = Ext::new( + ProcessorContextBuilder::new() + .with_gas(GasCounter::new(u64::MAX)) + .with_message_context( + MessageContextBuilder::new() + .with_outgoing_limit(u32::MAX) + .build(), + ) + .build(), + ); + + let res = ext.reply_push(&[1, 2, 3]); + assert!(res.is_ok()); + + let res = ext.reply_push(&[4, 5, 6]); + assert!(res.is_ok()); + + let large_payload = vec![0u8; MAX_PAYLOAD_SIZE + 1]; + + let res = ext.reply_push(&large_payload); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message( + MessageError::MaxMessageSizeExceed + )) + ); + + let res = ext.reply_commit(ReplyPacket::auto()); + assert!(res.is_ok()); + + let res = ext.reply_push(&[7, 8, 9]); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message(MessageError::LateAccess)) + ); + + let (outcome, _) = ext.context.message_context.drain(); + let ContextOutcomeDrain { + mut outgoing_dispatches, + .. + } = outcome.drain(); + let dispatch = outgoing_dispatches + .pop() + .map(|(dispatch, _, _)| dispatch) + .expect("Send commit was ok"); + + assert_eq!(dispatch.message().payload_bytes(), &[1, 2, 3, 4, 5, 6]); + } + + #[test] + // This function tests: + // + // - `reply_push_input` with valid data + // - `reply_push_input` after `reply_commit` + // - `reply_push_input` data is added to buffer + fn test_reply_push_input() { + let mut ext = Ext::new( + ProcessorContextBuilder::new() + .with_message_context( + MessageContextBuilder::new() + .with_outgoing_limit(u32::MAX) + .build(), + ) + .build(), + ); + + let res = ext + .context + .message_context + .payload_mut() + .try_extend_from_slice(&[1, 2, 3, 4, 5, 6]); + assert!(res.is_ok()); + + let res = ext.reply_push_input(2, 3); + assert!(res.is_ok()); + + let res = ext.reply_push_input(8, 10); + assert!(res.is_ok()); + + let msg = ext.reply_commit(ReplyPacket::auto()); + assert!(msg.is_ok()); + + let res = ext.reply_push_input(0, 1); + assert_eq!( + res.unwrap_err(), + FallibleExtError::Core(FallibleExtErrorCore::Message(MessageError::LateAccess)) + ); + + let (outcome, _) = ext.context.message_context.drain(); + let ContextOutcomeDrain { + mut outgoing_dispatches, + .. + } = outcome.drain(); + let dispatch = outgoing_dispatches + .pop() + .map(|(dispatch, _, _)| dispatch) + .expect("Send commit was ok"); + + assert_eq!(dispatch.message().payload_bytes(), &[3, 4, 5]); + } + mod property_tests { use super::*; use gear_core::{ From 3eeea2438fc79db95c34325853e9406e44d9832e Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Tue, 25 Jul 2023 11:18:16 +0300 Subject: [PATCH 009/165] feat(wasm-builder,wasm-opt): use only mvp features, enable sign-ext (#2976) --- utils/wasm-builder/src/optimize.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utils/wasm-builder/src/optimize.rs b/utils/wasm-builder/src/optimize.rs index 0ad73346ecf..0702aa49ea6 100644 --- a/utils/wasm-builder/src/optimize.rs +++ b/utils/wasm-builder/src/optimize.rs @@ -225,6 +225,8 @@ pub fn do_optimization( .arg(format!("-O{optimization_level}")) .arg("-o") .arg(dest_optimized) + .arg("-mvp") + .arg("--enable-sign-ext") // the memory in our module is imported, `wasm-opt` needs to be told that // the memory is initialized to zeroes, otherwise it won't run the // memory-packing pre-pass. @@ -277,6 +279,8 @@ pub fn do_optimization( "z" => OptimizationOptions::new_optimize_for_size_aggressively(), _ => panic!("Invalid optimization level {}", optimization_level), } + .mvp_features_only() + .enable_feature(wasm_opt::Feature::SignExt) .shrink_level(wasm_opt::ShrinkLevel::Level2) .add_pass(Pass::Dae) .add_pass(Pass::Vacuum) From 3ae048dba34b6b5804093bb757cd619158639c09 Mon Sep 17 00:00:00 2001 From: Fluid <90795031+fluiderson@users.noreply.github.com> Date: Wed, 26 Jul 2023 08:35:17 +0300 Subject: [PATCH 010/165] refactor(gear-wasm-builder): put `*.meta.txt`s along with other WASM binaries Co-authored-by: Shamil <66209982+shamilsan@users.noreply.github.com> --- gcli/tests/cmd/program.rs | 4 ++-- gcli/tests/common/env.rs | 5 ----- gcli/tests/gear.rs | 2 +- utils/wasm-builder/src/wasm_project.rs | 5 +++-- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/gcli/tests/cmd/program.rs b/gcli/tests/cmd/program.rs index 94255e1def6..7464aa13153 100644 --- a/gcli/tests/cmd/program.rs +++ b/gcli/tests/cmd/program.rs @@ -94,7 +94,7 @@ Metadata { #[test] fn test_command_program_metadata_works() -> Result<()> { - let meta = env::example_path("new-meta/demo_new_meta.meta.txt"); + let meta = env::wasm_bin("demo_new_meta.meta.txt"); let args = Args::new("program").action("meta").meta(meta); let result = common::gcli(Vec::::from(args)).expect("run gcli failed"); @@ -109,7 +109,7 @@ fn test_command_program_metadata_works() -> Result<()> { #[test] fn test_command_program_metadata_derive_works() -> Result<()> { - let meta = env::example_path("new-meta/demo_new_meta.meta.txt"); + let meta = env::wasm_bin("demo_new_meta.meta.txt"); let args = Args::new("program") .action("meta") .meta(meta) diff --git a/gcli/tests/common/env.rs b/gcli/tests/common/env.rs index e5e7375cbb0..745287a80ee 100644 --- a/gcli/tests/common/env.rs +++ b/gcli/tests/common/env.rs @@ -53,8 +53,3 @@ pub fn bin(name: &str) -> String { pub fn wasm_bin(name: &str) -> String { bin_path(name, true) } - -/// path of `example/binaries` folders -pub fn example_path(name: &str) -> String { - ROOT.clone() + "/examples/" + name -} diff --git a/gcli/tests/gear.rs b/gcli/tests/gear.rs index 53d134d313a..e1915f81e3f 100644 --- a/gcli/tests/gear.rs +++ b/gcli/tests/gear.rs @@ -37,7 +37,7 @@ fn paths() { env::bin("gear"), env::bin("gcli"), env::wasm_bin("demo_new_meta.opt.wasm"), - env::example_path("new-meta/demo_new_meta.meta.txt"), + env::wasm_bin("demo_new_meta.meta.txt"), ] .into_iter() .for_each(|path| { diff --git a/utils/wasm-builder/src/wasm_project.rs b/utils/wasm-builder/src/wasm_project.rs index 579ad88445d..da77a64b9e0 100644 --- a/utils/wasm-builder/src/wasm_project.rs +++ b/utils/wasm-builder/src/wasm_project.rs @@ -214,6 +214,8 @@ impl WasmProject { let mut source_code = "#![no_std] pub use orig_project::*;\n".to_owned(); + fs::create_dir_all(&self.wasm_target_dir)?; + // Write metadata if let Some(metadata) = &self.project_type.metadata() { let file_base_name = self @@ -222,7 +224,7 @@ impl WasmProject { .expect("Run `WasmProject::create_project()` first"); let wasm_meta_path = self - .original_dir + .wasm_target_dir .join([file_base_name, ".meta.txt"].concat()); smart_fs::write_metadata(wasm_meta_path, metadata) @@ -397,7 +399,6 @@ extern "C" fn metahash() {{ .join(format!("{}.wasm", &file_base_name)); fs::create_dir_all(&self.target_dir)?; - fs::create_dir_all(&self.wasm_target_dir)?; if self.project_type.is_metawasm() { self.postprocess_meta(&original_wasm_path, file_base_name)?; From c28aa50c22b151894c0dd21a93729507af821d4f Mon Sep 17 00:00:00 2001 From: Dennis Diatlov Date: Wed, 26 Jul 2023 18:27:22 +0100 Subject: [PATCH 011/165] ci(win-native): Remove cachepot as rustc_wrapper for build-win-native (#2985) --- .github/workflows/CI.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 54fd8d02ece..4d1a1a9a4d3 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -159,7 +159,7 @@ jobs: - name: "ACTIONS: Setup environment variable" if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') run: echo "RUSTFLAGS=-Cinstrument-coverage" >> $GITHUB_ENV - + - name: "Buid: Init" run: ./scripts/gear.sh init cargo @@ -295,7 +295,6 @@ jobs: run: shell: msys2 {0} env: - RUSTC_WRAPPER: "cachepot" CARGO_INCREMENTAL: 0 steps: - name: Cancel Previous Runs From f2c7aa6bd6db9032d6cb4543db7ee414702d9145 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Fri, 28 Jul 2023 12:23:46 +0300 Subject: [PATCH 012/165] refactor(pallet-airdrop): Add tests and benchmarks (#2981) --- pallets/airdrop/Cargo.toml | 2 +- pallets/airdrop/src/benchmarking.rs | 26 +++++- pallets/airdrop/src/lib.rs | 4 +- pallets/airdrop/src/mock.rs | 2 + pallets/airdrop/src/tests.rs | 14 +++- pallets/airdrop/src/weights.rs | 92 +++++++++++++-------- runtime/vara/src/lib.rs | 3 +- runtime/vara/src/weights/mod.rs | 1 + runtime/vara/src/weights/pallet_airdrop.rs | 95 ++++++++++++++++++++++ 9 files changed, 200 insertions(+), 39 deletions(-) create mode 100644 runtime/vara/src/weights/pallet_airdrop.rs diff --git a/pallets/airdrop/Cargo.toml b/pallets/airdrop/Cargo.toml index 524b19ddb48..56bcc784523 100644 --- a/pallets/airdrop/Cargo.toml +++ b/pallets/airdrop/Cargo.toml @@ -45,7 +45,7 @@ pallet-gear-gas = { workspace = true, features = ["std"] } frame-support-test = { workspace = true, features = ["std"] } [features] -default = ['std'] +default = ["std"] std = [ "common/std", "parity-scale-codec/std", diff --git a/pallets/airdrop/src/benchmarking.rs b/pallets/airdrop/src/benchmarking.rs index d7dd33c01a4..e93b2e13738 100644 --- a/pallets/airdrop/src/benchmarking.rs +++ b/pallets/airdrop/src/benchmarking.rs @@ -23,7 +23,8 @@ use common::{benchmarking, Origin}; use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; use frame_support::traits::Currency; use frame_system::RawOrigin; -use sp_runtime::traits::UniqueSaturatedInto; +use pallet_vesting::VestingInfo; +use sp_runtime::traits::{StaticLookup, UniqueSaturatedInto}; benchmarks! { where_clause { where @@ -37,12 +38,33 @@ benchmarks! { ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); let recipient: T::AccountId = benchmarking::account("recipient", 0, 0); // Keeping in mind the existential deposit - let amount = 100_000_u128.saturating_add(10_u128.saturating_mul(q.into())); + let amount = 10_000_000_000_000_u128.saturating_add(10_u128.saturating_mul(q.into())); }: _(RawOrigin::Root, source, recipient.clone(), amount.unique_saturated_into()) verify { assert_eq!(pallet_balances::Pallet::::total_balance(&recipient), amount.unique_saturated_into()); } + + transfer_vested { + let q in 1 .. 256; + + let source: T::AccountId = benchmarking::account("source", 0, 0); + let source_lookup = T::Lookup::unlookup(source.clone()); + ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); + let recipient: T::AccountId = benchmarking::account("recipient", 0, 0); + let amount = ::MinVestedTransfer::get().saturating_mul(q.into()); + + // create vesting schedule amount * 2 + let vested_amount = amount.saturating_mul(2u128.unique_saturated_into()); + let vesting_schedule = VestingInfo::new(vested_amount.unique_saturated_into(), 10u128.unique_saturated_into(), 1000u32.into()); + pallet_vesting::Pallet::::vested_transfer(RawOrigin::Signed(source.clone()).into(), source_lookup, vesting_schedule)?; + + }: _(RawOrigin::Root, source.clone(), recipient.clone(), 0, Some(amount)) + verify { + // check that the total vested amount is halved between the source and the recipient + assert_eq!(pallet_vesting::Pallet::::vesting_balance(&source), Some(amount)); + assert_eq!(::Currency::free_balance(&recipient), amount); + } } impl_benchmark_test_suite!(Airdrop, crate::mock::new_test_ext(), crate::mock::Test,); diff --git a/pallets/airdrop/src/lib.rs b/pallets/airdrop/src/lib.rs index 48fa3fd7cd6..613686b1c98 100644 --- a/pallets/airdrop/src/lib.rs +++ b/pallets/airdrop/src/lib.rs @@ -109,7 +109,7 @@ pub mod pallet { /// Emits the following events: /// - `TokensDeposited{ dest, amount }` #[pallet::call_index(0)] - #[pallet::weight(::WeightInfo::transfer())] + #[pallet::weight(::WeightInfo::transfer(1))] pub fn transfer( origin: OriginFor, source: T::AccountId, @@ -146,7 +146,7 @@ pub mod pallet { /// Emits the following events: /// - `VestingScheduleRemoved{ who, schedule_index }` #[pallet::call_index(1)] - #[pallet::weight(::WeightInfo::transfer())] + #[pallet::weight(::WeightInfo::transfer_vested(1))] pub fn transfer_vested( origin: OriginFor, source: T::AccountId, diff --git a/pallets/airdrop/src/mock.rs b/pallets/airdrop/src/mock.rs index 86eb8ab7bac..c4ec16432f8 100644 --- a/pallets/airdrop/src/mock.rs +++ b/pallets/airdrop/src/mock.rs @@ -203,6 +203,8 @@ impl pallet_vesting::Config for Test { const MAX_VESTING_SCHEDULES: u32 = 28; } +pub type VestingError = pallet_vesting::Error; + impl pallet_airdrop::Config for Test { type RuntimeEvent = RuntimeEvent; type WeightInfo = (); diff --git a/pallets/airdrop/src/tests.rs b/pallets/airdrop/src/tests.rs index b02874f9d81..3e57371758c 100644 --- a/pallets/airdrop/src/tests.rs +++ b/pallets/airdrop/src/tests.rs @@ -19,7 +19,7 @@ use super::*; use crate::mock::{ new_test_ext, Airdrop, AirdropCall, AirdropError, Balances, RuntimeCall, RuntimeOrigin, Sudo, - Test, Vesting, ALICE, BOB, ROOT, + Test, Vesting, VestingError, ALICE, BOB, ROOT, }; use frame_support::{assert_err, assert_noop, assert_ok}; use frame_system::Config; @@ -77,6 +77,18 @@ fn vesting_transfer_works() { assert_eq!(Balances::total_balance(&ROOT), 100_000_000); assert_eq!(Balances::total_issuance(), 200_000_000); + // Vesting must exist on the source account + assert_err!( + Airdrop::transfer_vested(RuntimeOrigin::root(), ALICE, BOB, 1, Some(200_000_000)), + VestingError::NotVesting + ); + + // Schedule must exist on the source account + assert_err!( + Airdrop::transfer_vested(RuntimeOrigin::root(), BOB, ALICE, 1, Some(200_000_000)), + VestingError::ScheduleIndexOutOfBounds + ); + // Amount can't be bigger than locked funds assert_err!( Airdrop::transfer_vested(RuntimeOrigin::root(), BOB, ALICE, 0, Some(200_000_000)), diff --git a/pallets/airdrop/src/weights.rs b/pallets/airdrop/src/weights.rs index 50614d97c6f..ddaa539a3d9 100644 --- a/pallets/airdrop/src/weights.rs +++ b/pallets/airdrop/src/weights.rs @@ -1,7 +1,6 @@ - // This file is part of Gear. -// Copyright (C) 2021-2023 Gear Technologies Inc. +// Copyright (C) 2022-2023 Gear Technologies Inc. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -17,51 +16,80 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -//! Autogenerated weights for pallet_gear +//! Autogenerated weights for pallet_airdrop //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-08-25, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("local"), DB CACHE: 128 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 // Executed Command: -// ./target/release/gear-node -// benchmark -// pallet -// --pallet -// pallet_airdrop -// --extrinsic=transfer -// --steps -// 50 -// --repeat -// 20 -// --chain=vara-dev -// --output -// . +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_airdrop --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallet_airdrop.rs --template=.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(clippy::unnecessary_cast)] -use frame_support::{traits::Get, weights::{constants::RocksDbWeight, Weight}}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; -/// Weight functions for pallet_airdrop. +/// Weight functions needed for pallet_airdrop. pub trait WeightInfo { - fn transfer() -> Weight; + fn transfer(q: u32, ) -> Weight; + fn transfer_vested(q: u32, ) -> Weight; } -/// Weight functions for `pallet_airdrop`. -pub struct AirdropWeight(PhantomData); -impl WeightInfo for AirdropWeight { - fn transfer() -> Weight { - (Weight::from_parts(18_000_000, 0)) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } +/// Weights for pallet_airdrop using the Gear node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + /// The range of component `q` is `[1, 256]`. + fn transfer(_q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `6196` + // Minimum execution time: 25_027_000 picoseconds. + Weight::from_parts(25_985_030, 6196) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// The range of component `q` is `[1, 256]`. + fn transfer_vested(q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `550` + // Estimated: `15482` + // Minimum execution time: 65_271_000 picoseconds. + Weight::from_parts(67_109_074, 15482) + // Standard Error: 328 + .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } } +// For backwards compatibility and tests impl WeightInfo for () { - fn transfer() -> Weight { - Weight::zero().saturating_add(RocksDbWeight::get().writes(1_u64)) + /// The range of component `q` is `[1, 256]`. + fn transfer(_q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `6196` + // Minimum execution time: 25_027_000 picoseconds. + Weight::from_parts(25_985_030, 6196) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// The range of component `q` is `[1, 256]`. + fn transfer_vested(q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `550` + // Estimated: `15482` + // Minimum execution time: 65_271_000 picoseconds. + Weight::from_parts(67_109_074, 15482) + // Standard Error: 328 + .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) } } diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 0aa07ce2256..0f160e0438b 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -816,7 +816,7 @@ impl pallet_gear_messenger::Config for Runtime { impl pallet_airdrop::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_airdrop::weights::AirdropWeight; + type WeightInfo = weights::pallet_airdrop::SubstrateWeight; type VestingSchedule = Vesting; } @@ -1070,6 +1070,7 @@ mod benches { [pallet_timestamp, Timestamp] [pallet_utility, Utility] // Gear pallets + [pallet_airdrop, Airdrop] [pallet_gear, Gear] [pallet_gear_voucher, GearVoucher] ); diff --git a/runtime/vara/src/weights/mod.rs b/runtime/vara/src/weights/mod.rs index b4eebedfe52..170d6f59e22 100644 --- a/runtime/vara/src/weights/mod.rs +++ b/runtime/vara/src/weights/mod.rs @@ -19,6 +19,7 @@ //! A list of the different weight modules for our runtime. pub mod frame_system; +pub mod pallet_airdrop; pub mod pallet_balances; pub mod pallet_gear; pub mod pallet_gear_voucher; diff --git a/runtime/vara/src/weights/pallet_airdrop.rs b/runtime/vara/src/weights/pallet_airdrop.rs new file mode 100644 index 00000000000..62ae1a74e8d --- /dev/null +++ b/runtime/vara/src/weights/pallet_airdrop.rs @@ -0,0 +1,95 @@ +// This file is part of Gear. + +// Copyright (C) 2022-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Autogenerated weights for pallet_airdrop +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-07-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 + +// Executed Command: +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_airdrop --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallet_airdrop.rs --template=.maintain/frame-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(clippy::unnecessary_cast)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_airdrop. +pub trait WeightInfo { + fn transfer(q: u32, ) -> Weight; + fn transfer_vested(q: u32, ) -> Weight; +} + +/// Weights for pallet_airdrop using the Gear node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl pallet_airdrop::WeightInfo for SubstrateWeight { + /// The range of component `q` is `[1, 256]`. + fn transfer(_q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `6196` + // Minimum execution time: 25_027_000 picoseconds. + Weight::from_parts(25_985_030, 6196) + .saturating_add(T::DbWeight::get().reads(2_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + /// The range of component `q` is `[1, 256]`. + fn transfer_vested(q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `550` + // Estimated: `15482` + // Minimum execution time: 65_271_000 picoseconds. + Weight::from_parts(67_109_074, 15482) + // Standard Error: 328 + .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().writes(4_u64)) + } +} + +// For backwards compatibility and tests +impl WeightInfo for () { + /// The range of component `q` is `[1, 256]`. + fn transfer(_q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `103` + // Estimated: `6196` + // Minimum execution time: 25_027_000 picoseconds. + Weight::from_parts(25_985_030, 6196) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + /// The range of component `q` is `[1, 256]`. + fn transfer_vested(q: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `550` + // Estimated: `15482` + // Minimum execution time: 65_271_000 picoseconds. + Weight::from_parts(67_109_074, 15482) + // Standard Error: 328 + .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().writes(4_u64)) + } +} From 51d77aa7d587e493eb1335846b07e854cb40b30b Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Fri, 28 Jul 2023 14:20:26 +0300 Subject: [PATCH 013/165] feat(weights-diff): Add memory weights (#2995) --- scripts/weight-diff.sh | 1 + utils/weight-diff/src/main.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/scripts/weight-diff.sh b/scripts/weight-diff.sh index 161c9941b8e..ae52c2c55c3 100755 --- a/scripts/weight-diff.sh +++ b/scripts/weight-diff.sh @@ -53,3 +53,4 @@ git checkout "$current_branch" cargo run --package gear-weight-diff --release -- diff "$dump_path1" "$dump_path2" "$runtime" "instruction" $flag cargo run --package gear-weight-diff --release -- diff "$dump_path1" "$dump_path2" "$runtime" "host-fn" $flag +cargo run --package gear-weight-diff --release -- diff "$dump_path1" "$dump_path2" "$runtime" "memory" $flag diff --git a/utils/weight-diff/src/main.rs b/utils/weight-diff/src/main.rs index 22dcdda5abf..f99233311d9 100644 --- a/utils/weight-diff/src/main.rs +++ b/utils/weight-diff/src/main.rs @@ -76,6 +76,7 @@ enum Runtime { enum WeightsKind { Instruction, HostFn, + Memory, } #[derive(Debug, Serialize)] @@ -97,6 +98,7 @@ struct DeserializableDump { struct DeserializableSchedule { instruction_weights: IndexMap, host_fn_weights: IndexMap, + memory_weights: IndexMap, } impl DeserializableSchedule { @@ -127,6 +129,18 @@ impl DeserializableSchedule { map } + + fn memory_weights(&self) -> IndexMap { + let mut map = IndexMap::new(); + + for (k, v) in self.memory_weights.clone() { + if let Ok(v) = serde_json::from_value::(v) { + map.insert(k, v.ref_time()); + } + } + + map + } } fn format_weight(weight: u64) -> String { @@ -214,6 +228,7 @@ fn main() { schedule2.instruction_weights(), ), WeightsKind::HostFn => (schedule1.host_fn_weights(), schedule2.host_fn_weights()), + WeightsKind::Memory => (schedule1.memory_weights(), schedule2.memory_weights()), }; let mut result_map = IndexMap::new(); From 4ef056c34a42e55b951c7ea7c202758751b45867 Mon Sep 17 00:00:00 2001 From: Krinitsyn Vladislav Date: Fri, 28 Jul 2023 14:04:22 +0200 Subject: [PATCH 014/165] update CI (#3001) Co-authored-by: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> --- .github/workflows/CI.yaml | 170 +++++++++----------------------------- 1 file changed, 41 insertions(+), 129 deletions(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 4d1a1a9a4d3..42fd6e27675 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -11,6 +11,10 @@ on: workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: CARGO_INCREMENTAL: 0 CARGO_TERM_COLOR: always @@ -21,14 +25,8 @@ env: jobs: # TODO: add to specific branches. # spec_version: - # runs-on: [self-hosted, epyc] + # runs-on: [kuberunner] # steps: - # - name: Cancel Previous Runs - # if: ${{ github.event_name == 'pull_request' }} - # uses: styfle/cancel-workflow-action@0.11.0 - # with: - # access_token: ${{ github.token }} - # - name: "ACTIONS: Checkout" # uses: actions/checkout@v3 @@ -39,19 +37,29 @@ jobs: # if: ${{ ! contains(github.event.pull_request.labels.*.name, 'A4-insubstantial') }} # run: ./scripts/check-spec.sh + prepair: + runs-on: ubuntu-latest + outputs: + sccache_path: ${{ steps.sccache.outputs.sccache_path }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: "CACHE: Set sccache path" + id: sccache + run: | + sccache_path="/mnt/sccache/$(echo ${GITHUB_REF#refs/heads/} | tr / _)" + echo "sccache_path=$sccache_path" >> $GITHUB_OUTPUT + check: # needs: spec_version - needs: check-commit-message - runs-on: [self-hosted, epyc-4, k8s-runner] + needs: [prepair, check-commit-message] + runs-on: [kuberunner, github-runner-01] env: RUSTUP_HOME: /tmp/rustup_home + RUSTC_WRAPPER: sccache + SCCACHE_DIR: ${{ needs.prepair.outputs.sccache_path }} steps: - - name: Cancel Previous Runs - if: ${{ github.event_name == 'pull_request' }} - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - - name: "ACTIONS: Checkout" uses: actions/checkout@v3 @@ -61,19 +69,6 @@ jobs: - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 - - name: "Install: Build deps" - run: | - sudo apt update - sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake protobuf-compiler wget bzip2 - sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/binaryen-$BINARYEN_VERSION-x86_64-linux.tar.gz -O - | sudo tar -xz -C . - sudo cp binaryen-$BINARYEN_VERSION/bin/wasm-opt /usr/bin/ - - - name: "Cache: Unpack" - if: ${{ github.event_name == 'pull_request' && !contains(needs.check-commit-message.outputs.commit-message, '[skip-cache]') }} - continue-on-error: true - run: | - tar -xf /cache/check_cargo_registry_${{ github.base_ref }}.tar -C / - - name: "Check formatting: Gear" run: ./scripts/gear.sh format gear --check @@ -99,27 +94,18 @@ jobs: exit 1 fi - - name: "Cache: Pack" - if: ${{ github.event_name == 'push' }} - continue-on-error: true - run: | - tar -cf /tmp/check_cargo_registry_${{ github.ref_name }}.tar /tmp/cargo/bin /tmp/cargo/registry/cache /tmp/cargo/registry/index /tmp/cargo/git - mv /tmp/*.tar /cache/ + - run: sccache --show-stats build: # needs: spec_version - needs: [check-commit-message, check-labels] - runs-on: [self-hosted, epyc-4, k8s-runner] + needs: [prepair, check-commit-message, check-labels] + runs-on: [kuberunner, github-runner-02] env: LLVM_PROFILE_FILE: "gear-%p-%m.profraw" RUSTUP_HOME: /tmp/rustup_home + RUSTC_WRAPPER: sccache + SCCACHE_DIR: ${{ needs.prepair.outputs.sccache_path }} steps: - - name: Cancel Previous Runs - if: ${{ github.event_name == 'pull_request' }} - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - - name: "ACTIONS: Checkout" uses: actions/checkout@v3 @@ -132,13 +118,6 @@ jobs: - name: "Show: Versioning" run: ./scripts/gear.sh show - - name: "Install: Build deps" - run: | - sudo apt update - sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake wabt protobuf-compiler wget bzip2 - sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/binaryen-$BINARYEN_VERSION-x86_64-linux.tar.gz -O - | sudo tar -xz -C . - sudo cp binaryen-$BINARYEN_VERSION/bin/wasm-opt /usr/bin/ - - name: "Install: grcov" run: | curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-musl.tar.bz2 | tar jxf - @@ -150,12 +129,6 @@ jobs: mv rust-covfix-linux-x86_64/rust-covfix ./ ./rust-covfix --version - - name: "Cache: Unpack" - if: ${{ github.event_name == 'pull_request' && !contains(needs.check-commit-message.outputs.commit-message, '[skip-cache]') }} - continue-on-error: true - run: | - tar -xf /cache/build_cargo_registry_${{ github.base_ref }}.tar -C / - - name: "ACTIONS: Setup environment variable" if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') run: echo "RUSTFLAGS=-Cinstrument-coverage" >> $GITHUB_ENV @@ -256,13 +229,6 @@ jobs: if: github.event_name == 'push' run: cargo build -p gear-cli -F cli --profile production - - name: "Cache: Pack" - if: ${{ github.event_name == 'push' }} - continue-on-error: true - run: | - tar -cf /tmp/build_cargo_registry_${{ github.ref_name }}.tar /tmp/cargo/bin /tmp/cargo/registry/cache /tmp/cargo/registry/index /tmp/cargo/git - mv /tmp/*.tar /cache/ - - name: Prepare artifacts if: github.event_name == 'push' run: | @@ -287,6 +253,8 @@ jobs: with: path: artifact + - run: sccache --show-stats + build-win-native: if: ${{ github.ref == 'refs/heads/master' }} needs: build @@ -295,14 +263,9 @@ jobs: run: shell: msys2 {0} env: + RUSTC_WRAPPER: cachepot CARGO_INCREMENTAL: 0 steps: - - name: Cancel Previous Runs - if: ${{ github.event_name == 'pull_request' }} - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - - name: "ACTIONS: Checkout" uses: actions/checkout@v3 @@ -376,21 +339,13 @@ jobs: --release build-win-cross: - needs: [check-commit-message, check-labels] - runs-on: [self-hosted, epyc-4, k8s-runner] + needs: [prepair, check-commit-message, check-labels] + runs-on: [kuberunner, github-runner-03] env: XWIN_ARCH: x86_64 RUSTUP_HOME: /tmp/rustup_home WINEDEBUG: fixme-all - CARGO_INCREMENTAL: 0 - CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse steps: - - name: Cancel Previous Runs - if: ${{ github.event_name == 'pull_request' }} - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - - name: "ACTIONS: Checkout" uses: actions/checkout@v3 @@ -409,25 +364,13 @@ jobs: - name: "Show: Versioning" run: ./scripts/gear.sh show - - name: "Install: Build deps" - run: | - sudo apt update - sudo apt install -y git curl libssl-dev libudev-dev cmake wabt protobuf-compiler wget bzip2 ninja-build - - name: "Install: Wine" run: | - sudo dpkg --add-architecture i386 - sudo mkdir -pm755 /etc/apt/keyrings - sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key - sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/focal/winehq-focal.sources - sudo apt update - sudo apt install --install-recommends -y winehq-stable winetricks wineboot winetricks win10 - name: "Install: LLVM" run: | - sudo apt install -y clang-12 clang-tools-12 llvm-12 sudo ./.github/build-win-cross/update-alternatives-clang.sh 12 100 - name: "Install: binaryen" @@ -440,12 +383,6 @@ jobs: curl -L https://github.com/rust-cross/cargo-xwin/releases/download/v0.14.0/cargo-xwin-v0.14.0.x86_64-unknown-linux-musl.tar.gz | tar zxf - mv ./cargo-xwin ${CARGO_HOME:-~/.cargo}/bin/ - - name: "Cache: Unpack" - if: ${{ github.event_name == 'pull_request' && !contains(needs.check-commit-message.outputs.commit-message, '[skip-cache]') }} - continue-on-error: true - run: | - tar -xf /cache/build_win_cross_cargo_registry_${{ github.base_ref }}.tar -C / - - name: "Build: Node" run: ./scripts/gear.sh build node --release --locked env: @@ -471,12 +408,7 @@ jobs: env: CARGO_BUILD_TARGET: x86_64-pc-windows-msvc - - name: "Cache: Pack" - if: ${{ github.event_name == 'push' }} - continue-on-error: true - run: | - tar -cf /tmp/build_win_cross_cargo_registry_${{ github.ref_name }}.tar /tmp/cargo/bin /tmp/cargo/registry/cache /tmp/cargo/registry/index /tmp/cargo/git - mv /tmp/*.tar /cache/ + - run: sccache --show-stats build-macos-x86: if: ${{ always() && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E2-forcemacos')) }} @@ -485,12 +417,6 @@ jobs: env: RUSTUP_HOME: /tmp/rustup_home steps: - - name: Cancel Previous Runs - if: ${{ github.event_name == 'pull_request' }} - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - - name: "ACTIONS: Checkout" uses: actions/checkout@v3 @@ -531,15 +457,9 @@ jobs: upload: if: github.event_name == 'push' && github.ref_name == 'master' - runs-on: self-hosted + runs-on: ubuntu-latest needs: build steps: - - name: Cancel Previous Runs - if: ${{ github.event_name == 'pull_request' }} - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - - name: Download artifacts uses: actions/download-artifact@v3 @@ -565,16 +485,13 @@ jobs: files: artifact/* check-fuzzer: - runs-on: [self-hosted, epyc-4, k8s-runner] + needs: [prepair] + runs-on: [kuberunner, github-runner-01] env: RUSTUP_HOME: /tmp/rustup_home + RUSTC_WRAPPER: sccache + SCCACHE_DIR: ${{ needs.prepair.outputs.sccache_path }} steps: - - name: Cancel Previous Runs - if: ${{ github.event_name == 'pull_request' }} - uses: styfle/cancel-workflow-action@0.11.0 - with: - access_token: ${{ github.token }} - - name: "ACTIONS: Checkout" uses: actions/checkout@v3 @@ -584,19 +501,14 @@ jobs: - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 - - name: "Install: Build deps" - run: | - sudo apt update - sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake wabt protobuf-compiler wget bzip2 jq - sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/binaryen-$BINARYEN_VERSION-x86_64-linux.tar.gz -O - | sudo tar -xz -C . - sudo cp binaryen-$BINARYEN_VERSION/bin/wasm-opt /usr/bin/ - - name: Install cargo-fuzz run: cargo install cargo-fuzz - name: "Check fuzzer with mutation test" run: ./scripts/check-fuzzer.sh + - run: sccache --show-stats + check-commit-message: runs-on: ubuntu-latest outputs: From d82d85a0df066cf5feee8e94122b430ea2429654 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Fri, 28 Jul 2023 18:10:11 +0300 Subject: [PATCH 015/165] fix(ci): Disable cachepot in win build (#3003) --- .github/workflows/CI.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 42fd6e27675..45c0fe3cfa7 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -263,7 +263,6 @@ jobs: run: shell: msys2 {0} env: - RUSTC_WRAPPER: cachepot CARGO_INCREMENTAL: 0 steps: - name: "ACTIONS: Checkout" From 1d1dc91b8b507b14a064e78c1ab6d4394bfa83ba Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Wed, 2 Aug 2023 13:18:44 +0300 Subject: [PATCH 016/165] Test sending message to terminated program from program (#3009) --- examples/constructor/src/builder.rs | 2 +- pallets/gear/src/queue.rs | 4 +- pallets/gear/src/tests.rs | 74 +++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 2 deletions(-) diff --git a/examples/constructor/src/builder.rs b/examples/constructor/src/builder.rs index 6ab1fcaa4e3..d8316b39b86 100644 --- a/examples/constructor/src/builder.rs +++ b/examples/constructor/src/builder.rs @@ -77,7 +77,7 @@ impl Calls { } pub fn reply_code(self, key: impl AsRef) -> Self { - self.add_call(Call::ReplyCode).store(key) + self.add_call(Call::ReplyCode).store_vec(key) } pub fn value(self, key: impl AsRef) -> Self { diff --git a/pallets/gear/src/queue.rs b/pallets/gear/src/queue.rs index f886bf9439e..e5dd03f760a 100644 --- a/pallets/gear/src/queue.rs +++ b/pallets/gear/src/queue.rs @@ -292,7 +292,9 @@ where _ => { // Reaching this branch is possible when init message was processed with failure, // while other kind of messages were already in the queue/were added to the queue - // (for example. moved from wait list in case of async init) + // (for example. moved from wait list in case of async init). + // Also this branch is reachable when progam sends a message to a terminated + // program. log::debug!("Program '{program_id:?}' is not active"); return ActorResult::Data(None); } diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 0aa83f43bac..5c247de1674 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -13170,6 +13170,80 @@ fn test_gas_allowance_exceed_with_context() { }) } +/// Test that if a message is addressed to a terminated program (sent from program), +/// then no panic occurs and the message is not executed. +#[test] +fn test_send_to_terminated_from_program() { + use demo_constructor::{Calls, Scheme}; + + init_logger(); + new_test_ext().execute_with(|| { + let user_1_bytes = ProgramId::from_origin(USER_1.into_origin()).into_bytes(); + + // Dies in init + let init = Calls::builder().panic("Die in init"); + // "Bomb" in case after refactoring runtime we accidentally allow terminated programs to be executed. + let handle = Calls::builder().send(user_1_bytes, b"REPLY_FROM_DEAD".to_vec()); + let (_, pid_terminated) = utils::submit_constructor_with_args( + // Using `USER_2` not to pollute `USER_1` mailbox to make test easier. + USER_2, + b"salt1", + Scheme::predefined(init, handle, Calls::default()), + 0, + ); + + // Check `pid_terminated` exists as an active program. + assert!(Gear::is_active(pid_terminated)); + + // Sends in handle message to the dead program + let handle = Calls::builder().send(pid_terminated.into_bytes(), []); + // Sends to USER_1 the error reply from the dead program + let handle_reply = Calls::builder() + .reply_code("err_reply") + .send(user_1_bytes, "err_reply"); + let (_, proxy_pid) = utils::submit_constructor_with_args( + // Using `USER_2` not to pollute `USER_1` mailbox to make test easier. + USER_2, + b"salt2", + Scheme::predefined(Calls::default(), handle, handle_reply), + 0, + ); + + run_to_next_block(None); + + assert!(Gear::is_terminated(pid_terminated)); + + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + proxy_pid, + EMPTY_PAYLOAD.to_vec(), + BlockGasLimitOf::::get(), + 0, + )); + + run_to_next_block(None); + + // No panic occurred. + // Need to check, that user has message in the mailbox with error reply (`InactiveProgram`). + // Also check that user hasn't received anything from the dead program. + let mut mails_from_proxy_iter = MailboxOf::::iter_key(USER_1) + .filter_map(|(msg, _)| (msg.source() == proxy_pid).then_some(msg)); + let mail_from_proxy = mails_from_proxy_iter + .next() + .expect("internal error: no message from proxy"); + assert_eq!( + mail_from_proxy.payload_bytes().to_vec(), + ReplyCode::Error(ErrorReplyReason::InactiveProgram).encode() + ); + assert_eq!(mails_from_proxy_iter.next(), None); + + let mails_from_terminated_count = MailboxOf::::iter_key(USER_1) + .filter(|(msg, _)| msg.source() == pid_terminated) + .count(); + assert_eq!(mails_from_terminated_count, 0); + }) +} + mod utils { #![allow(unused)] From 00e10473d18f539971e9161ee74cec43c48e8f83 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Wed, 2 Aug 2023 17:55:22 +0300 Subject: [PATCH 017/165] refactoring(wasm-gen): refactor wasm-gen configs (#2980) --- Cargo.lock | 3 + gsys/src/lib.rs | 2 +- utils/call-gen/src/lib.rs | 6 +- utils/node-loader/Cargo.toml | 1 + .../src/batch_pool/generators/batch.rs | 12 +- utils/node-loader/src/utils.rs | 22 +- utils/runtime-fuzzer/Cargo.toml | 1 + utils/runtime-fuzzer/src/lib.rs | 33 +- utils/wasm-gen/Cargo.toml | 1 + utils/wasm-gen/src/config.rs | 91 ++++ utils/wasm-gen/src/config/generator.rs | 177 +++++++ utils/wasm-gen/src/config/module.rs | 364 +++++++++++++++ utils/wasm-gen/src/config/syscalls.rs | 180 ++++++++ utils/wasm-gen/src/config/syscalls/amount.rs | 77 ++++ utils/wasm-gen/src/config/syscalls/param.rs | 165 +++++++ utils/wasm-gen/src/lib.rs | 433 ++++-------------- utils/wasm-gen/src/syscalls.rs | 162 +------ utils/wasm-gen/src/tests.rs | 34 +- utils/wasm-gen/src/wasm.rs | 6 - utils/wasm-instrument/src/syscalls.rs | 154 ++++--- utils/wasm-instrument/src/tests.rs | 24 +- 21 files changed, 1364 insertions(+), 584 deletions(-) create mode 100644 utils/wasm-gen/src/config.rs create mode 100644 utils/wasm-gen/src/config/generator.rs create mode 100644 utils/wasm-gen/src/config/module.rs create mode 100644 utils/wasm-gen/src/config/syscalls.rs create mode 100644 utils/wasm-gen/src/config/syscalls/amount.rs create mode 100644 utils/wasm-gen/src/config/syscalls/param.rs diff --git a/Cargo.lock b/Cargo.lock index 2591c1a9022..526a71d8482 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3964,6 +3964,7 @@ dependencies = [ "gear-core", "gear-core-errors", "gear-utils", + "gear-wasm-gen", "gsdk", "hex", "names 0.14.0", @@ -4340,6 +4341,7 @@ name = "gear-wasm-gen" version = "0.1.0" dependencies = [ "arbitrary", + "gear-utils", "gear-wasm-instrument", "gsys", "indicatif", @@ -9128,6 +9130,7 @@ dependencies = [ "gear-runtime", "gear-runtime-primitives", "gear-utils", + "gear-wasm-gen", "hex", "log", "once_cell", diff --git a/gsys/src/lib.rs b/gsys/src/lib.rs index 6b17df1c868..46c21e6b971 100644 --- a/gsys/src/lib.rs +++ b/gsys/src/lib.rs @@ -74,7 +74,7 @@ impl BlockNumberWithHash { /// Represents type defining concatenated hash with value. 48 bytes. #[repr(C, packed)] -#[derive(Default, Debug)] +#[derive(Default, Debug, Clone)] pub struct HashWithValue { pub hash: Hash, pub value: Value, diff --git a/utils/call-gen/src/lib.rs b/utils/call-gen/src/lib.rs index 9f7a34ba83f..f57897ec4ee 100644 --- a/utils/call-gen/src/lib.rs +++ b/utils/call-gen/src/lib.rs @@ -40,7 +40,7 @@ pub use upload_program::UploadProgramArgs; pub struct GearCallConversionError(pub &'static str); pub type Seed = u64; -pub type GearProgGenConfig = gear_wasm_gen::GearConfig; +pub type GearProgGenConfig = gear_wasm_gen::ConfigsBundle; /// This trait must be implemented for all argument types /// that are defined in [`GearCall`] variants. @@ -149,7 +149,7 @@ macro_rules! impl_named_call_args { /// can be used for send-calls. pub fn generate_gear_program( seed: Seed, - mut config: GearProgGenConfig, + config: GearProgGenConfig, programs: Vec, ) -> Vec { use arbitrary::Unstructured; @@ -162,8 +162,6 @@ pub fn generate_gear_program( let mut u = Unstructured::new(&buf); - config.print_test_info = Some(format!("Gear program seed = '{seed}'")); - let addresses = programs .iter() .map(|pid| gsys::HashWithValue { diff --git a/utils/node-loader/Cargo.toml b/utils/node-loader/Cargo.toml index 89fad3f1cd4..f003cc59e97 100644 --- a/utils/node-loader/Cargo.toml +++ b/utils/node-loader/Cargo.toml @@ -16,6 +16,7 @@ gear-core.workspace = true gear-core-errors.workspace = true gear-utils.workspace = true gsdk.workspace = true +gear-wasm-gen.workspace = true # external dependencies anyhow.workspace = true diff --git a/utils/node-loader/src/batch_pool/generators/batch.rs b/utils/node-loader/src/batch_pool/generators/batch.rs index 43e027d9123..2a57dacebfa 100644 --- a/utils/node-loader/src/batch_pool/generators/batch.rs +++ b/utils/node-loader/src/batch_pool/generators/batch.rs @@ -2,14 +2,16 @@ use super::seed; use crate::{ args::SeedVariant, batch_pool::{api::GearApiFacade, context::Context, Seed}, + utils, }; use anyhow::Result; use futures::FutureExt; use gear_call_gen::{ - CallArgs, CallGenRng, CallGenRngCore, ClaimValueArgs, CreateProgramArgs, GearProgGenConfig, - SendMessageArgs, SendReplyArgs, UploadCodeArgs, UploadProgramArgs, + CallArgs, CallGenRng, CallGenRngCore, ClaimValueArgs, CreateProgramArgs, SendMessageArgs, + SendReplyArgs, UploadCodeArgs, UploadProgramArgs, }; use gear_utils::NonEmpty; +use gear_wasm_gen::ConfigsBundle; use std::iter; use tracing::instrument; @@ -31,7 +33,7 @@ impl RuntimeSettings { pub struct BatchGenerator { pub batch_gen_rng: Rng, pub batch_size: usize, - prog_gen_config: GearProgGenConfig, + prog_gen_config: ConfigsBundle, code_seed_gen: Box, rt_settings: RuntimeSettings, } @@ -116,12 +118,10 @@ impl BatchGenerator { tracing::info!("Code generator starts with seed: {code_seed_type:?}"); - let prog_gen_config = GearProgGenConfig::new_normal(); - Self { batch_gen_rng, batch_size, - prog_gen_config, + prog_gen_config: utils::get_config_with_seed_log(seed), code_seed_gen: seed::some_generator::(code_seed_type), rt_settings, } diff --git a/utils/node-loader/src/utils.rs b/utils/node-loader/src/utils.rs index 9caff288c7d..046b815644f 100644 --- a/utils/node-loader/src/utils.rs +++ b/utils/node-loader/src/utils.rs @@ -2,9 +2,12 @@ use anyhow::{anyhow, Result}; use futures::Future; use futures_timer::Delay; use gclient::{Event, GearApi, GearEvent, WSAddress}; -use gear_call_gen::GearProgGenConfig; +use gear_call_gen::Seed; use gear_core::ids::{MessageId, ProgramId}; use gear_core_errors::ReplyCode; +use gear_wasm_gen::{ + ConfigsBundle, EntryPointsSet, GearWasmGeneratorConfigBuilder, SysCallsConfigBuilder, +}; use gsdk::metadata::runtime_types::{ gear_common::event::DispatchStatus as GenDispatchStatus, gear_core::{ @@ -35,7 +38,7 @@ pub const WAITING_TX_FINALIZED_TIMEOUT_ERR_STR: &str = pub fn dump_with_seed(seed: u64) -> Result<()> { let code = gear_call_gen::generate_gear_program::( seed, - GearProgGenConfig::new_normal(), + ConfigsBundle::default(), Default::default(), ); @@ -202,3 +205,18 @@ pub fn err_waited_or_succeed_batch( .flatten() .collect() } + +/// Returns configs bundle with a gear wasm generator config, which logs `seed`. +pub fn get_config_with_seed_log(seed: Seed) -> ConfigsBundle { + ConfigsBundle { + gear_wasm_generator_config: GearWasmGeneratorConfigBuilder::new() + .with_entry_points_config(EntryPointsSet::InitHandleHandleReply) + .with_sys_calls_config( + SysCallsConfigBuilder::new(Default::default()) + .with_log_info(format!("Gear program seed = '{seed}'")) + .build(), + ) + .build(), + ..Default::default() + } +} diff --git a/utils/runtime-fuzzer/Cargo.toml b/utils/runtime-fuzzer/Cargo.toml index 046b3cf06af..6962de72089 100644 --- a/utils/runtime-fuzzer/Cargo.toml +++ b/utils/runtime-fuzzer/Cargo.toml @@ -18,6 +18,7 @@ rand = { workspace = true, features = ["small_rng"] } clap = { workspace = true, features = ["derive"] } gear-call-gen.workspace = true +gear-wasm-gen.workspace = true runtime-primitives.workspace = true gear-common.workspace = true gear-core.workspace = true diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index 9aa308a1c9b..44a69862ddd 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -20,13 +20,16 @@ mod runtime; use frame_support::pallet_prelude::DispatchResultWithPostInfo; use gear_call_gen::{ - CallGenRng, GearCall, GearProgGenConfig, GeneratableCallArgs, SendMessageArgs, - UploadProgramArgs, + CallGenRng, GearCall, GeneratableCallArgs, SendMessageArgs, UploadProgramArgs, }; use gear_common::event::ProgramChangeKind; use gear_core::ids::ProgramId; use gear_runtime::{AccountId, Gear, Runtime, RuntimeEvent, RuntimeOrigin, System}; use gear_utils::NonEmpty; +use gear_wasm_gen::{ + ConfigsBundle, EntryPointsSet, GearWasmGeneratorConfigBuilder, SelectableParams, + SysCallsConfigBuilder, +}; use once_cell::sync::OnceCell; use pallet_balances::Pallet as BalancesPallet; use pallet_gear::Event; @@ -87,7 +90,7 @@ pub fn run(seed: u64) { } fn generate_gear_call(seed: u64, context: &ContextMutex) -> GearCall { - let config = fuzzer_config(); + let config = fuzzer_config(seed); let mut rand = Rng::seed_from_u64(seed); let programs = context.lock().programs.clone(); @@ -116,12 +119,24 @@ fn generate_gear_call(seed: u64, context: &ContextMutex) -> Gea } } -fn fuzzer_config() -> GearProgGenConfig { - let mut config = GearProgGenConfig::new_normal(); - config.remove_recursion = (1, 1).into(); - config.call_indirect_enabled = false; // TODO #2187, note on call_indirect disabling, (test performance) - - config +fn fuzzer_config(seed: u64) -> ConfigsBundle { + let generator_config = GearWasmGeneratorConfigBuilder::new() + .with_entry_points_config(EntryPointsSet::InitHandleHandleReply) + .with_sys_calls_config( + SysCallsConfigBuilder::new(Default::default()) + .with_log_info(format!("Gear program seed = '{seed}'")) + .build(), + ) + .with_recursions_removed(true) + .build(); + let selectables_config = SelectableParams { + call_indirect_enabled: false, + }; + + ConfigsBundle { + gear_wasm_generator_config: generator_config, + module_selectables_config: selectables_config, + } } fn execute_gear_call(sender: AccountId, call: GearCall) -> DispatchResultWithPostInfo { diff --git a/utils/wasm-gen/Cargo.toml b/utils/wasm-gen/Cargo.toml index 026f1295339..e0365b4c6dd 100644 --- a/utils/wasm-gen/Cargo.toml +++ b/utils/wasm-gen/Cargo.toml @@ -11,6 +11,7 @@ arbitrary = { workspace = true, features = ["derive"] } gear-wasm-instrument.workspace = true wasmprinter.workspace = true gsys.workspace = true +gear-utils.workspace = true [dev-dependencies] rand = { workspace = true, features = ["small_rng"] } diff --git a/utils/wasm-gen/src/config.rs b/utils/wasm-gen/src/config.rs new file mode 100644 index 00000000000..936e7abf070 --- /dev/null +++ b/utils/wasm-gen/src/config.rs @@ -0,0 +1,91 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Configs used to generate main entities of the crate. +//! +//! Configs, possibly, can be instantiated 3 different ways: +//! 1. From scratch by settings fields to corresponding values sometimes using +//! related to these fields builders. For example, wasm module configs: +//! ```rust +//! use gear_wasm_gen::*; +//! use arbitrary::{Arbitrary, Result, Unstructured}; +//! +//! fn my_config<'a>(u: &'a mut Unstructured<'a>) -> Result { +//! let selectable_params = SelectableParams { call_indirect_enabled: false }; +//! let arbitrary = ArbitraryParams::arbitrary(u)?; +//! Ok((selectable_params, arbitrary).into()) +//! } +//! ``` +//! Or, for example, gear wasm generators config: +//! ```rust +//! use gear_wasm_gen::*; +//! let memory_pages_config = MemoryPagesConfig { +//! initial_size: 128, +//! upper_limit: None, +//! stack_end: Some(64), +//! }; +//! let entry_points_set = EntryPointsSet::InitHandle; +//! let sys_calls_config = SysCallsConfigBuilder::new(SysCallsInjectionAmounts::all_once()) +//! .with_unchecked_memory_access(true) +//! .with_source_msg_dest() +//! .with_log_info("I'm from wasm-gen".into()) +//! .build(); +//! +//! let wasm_gen_config = GearWasmGeneratorConfig { +//! memory_config: memory_pages_config, +//! entry_points_config: entry_points_set, +//! remove_recursions: true, +//! sys_calls_config, +//! }; +//! ``` +//! +//! 2. By using `Default` trait. +//! For example: +//! ```rust +//! use gear_wasm_gen::*; +//! let wasm_gen_config = GearWasmGeneratorConfig::default(); +//! ``` +//! +//! 3. With `arbitrary::Unstructured`. For example: +//! ```rust +//! use gear_wasm_gen::*; +//! use arbitrary::{Result, Arbitrary, Unstructured}; +//! +//! fn my_config<'a>(u: &'a mut Unstructured<'a>) -> Result { +//! WasmModuleConfig::arbitrary(u) +//! } +//! ``` + +pub mod generator; +pub mod module; +pub mod syscalls; + +pub use generator::*; +pub use module::*; +pub use syscalls::*; + +/// United config for using the crate. +/// +/// Uses [`SelectableParams`] instead of the [`WasmModuleConfig`], because +/// the former one provides all required from the crate user configurations +/// and all the other configurations are generated internally. +#[derive(Debug, Clone, Default)] +pub struct ConfigsBundle { + pub gear_wasm_generator_config: GearWasmGeneratorConfig, + pub module_selectables_config: SelectableParams, +} diff --git a/utils/wasm-gen/src/config/generator.rs b/utils/wasm-gen/src/config/generator.rs new file mode 100644 index 00000000000..675a1607cd6 --- /dev/null +++ b/utils/wasm-gen/src/config/generator.rs @@ -0,0 +1,177 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Configs related to instantiation of gear wasm module generators. + +use crate::SysCallsConfig; + +/// Builder for [`GearWasmGeneratorConfig`]. +pub struct GearWasmGeneratorConfigBuilder(GearWasmGeneratorConfig); + +impl GearWasmGeneratorConfigBuilder { + #[allow(clippy::new_without_default)] + /// Create a new builder. + pub fn new() -> Self { + Self(GearWasmGeneratorConfig::default()) + } + + /// Defines memory pages confir for the gear wasm generator. + pub fn with_memory_config(mut self, mem_config: MemoryPagesConfig) -> Self { + self.0.memory_config = mem_config; + + self + } + + /// Defines entry points (gear exports) config for the gear wasm generator. + pub fn with_entry_points_config(mut self, ep_config: EntryPointsSet) -> Self { + self.0.entry_points_config = ep_config; + + self + } + + /// Defines sys-calls config for the gear wasm generator. + pub fn with_sys_calls_config(mut self, sys_calls_config: SysCallsConfig) -> Self { + self.0.sys_calls_config = sys_calls_config; + + self + } + + /// Defines whether recursions must be removed from the resulting gear wasm. + pub fn with_recursions_removed(mut self, remove_recursions: bool) -> Self { + self.0.remove_recursions = remove_recursions; + + self + } + + /// Build the gear wasm generator. + pub fn build(self) -> GearWasmGeneratorConfig { + self.0 + } +} + +/// Gear wasm generator config. +/// +/// This is a carrier for other configs, that can be used separately +/// in corresponding generators. +#[derive(Debug, Clone, Default)] +pub struct GearWasmGeneratorConfig { + /// Memory pages config. + pub memory_config: MemoryPagesConfig, + /// Entry points config. + pub entry_points_config: EntryPointsSet, + /// Sys-calls generator module config. + pub sys_calls_config: SysCallsConfig, + /// Flag, signalizing whether recursions + /// should be removed from resulting module. + pub remove_recursions: bool, +} + +/// Memory pages config used by [`crate::MemoryGenerator`]. +#[derive(Debug, Clone, Copy)] +pub struct MemoryPagesConfig { + /// Initial memory size. + pub initial_size: u32, + /// Optional memory maximum. + pub upper_limit: Option, + /// Optional stack end. + pub stack_end: Option, +} + +impl Default for MemoryPagesConfig { + fn default() -> Self { + Self { + initial_size: Self::MAX_VALUE / 2 + 1, + upper_limit: Some(Self::MAX_VALUE), + stack_end: None, + } + } +} + +impl MemoryPagesConfig { + /// Default maximum memory pages. + pub const MAX_VALUE: u32 = 512; +} + +/// Possible for current crate gear entry points +/// to be generated. +#[derive(Debug, Clone, Copy)] +pub enum EntryPointName { + Init, + Handle, + HandleReply, +} + +impl EntryPointName { + /// Convert current entry point to str. + pub fn to_str(&self) -> &'static str { + match self { + EntryPointName::Init => "init", + EntryPointName::Handle => "handle", + EntryPointName::HandleReply => "handle_reply", + } + } +} + +/// Entry points config used by [`crate::EntryPointsGenerator`]. +/// +/// It's literally all possible combinations of gear entry points +/// to be generated in the wasm by [`crate::EntryPointsGenerator`]. +#[derive(Debug, Clone, Copy, Default)] +pub enum EntryPointsSet { + #[default] + Init, + InitHandle, + InitHandleReply, + InitHandleHandleReply, + Handle, + HandleHandleReply, +} + +impl EntryPointsSet { + /// Checks whether the set has ***init*** entry point. + pub fn has_init(&self) -> bool { + matches!( + self, + EntryPointsSet::Init + | EntryPointsSet::InitHandle + | EntryPointsSet::InitHandleReply + | EntryPointsSet::InitHandleHandleReply + ) + } + + /// Checks whether the set has ***handle*** entry point. + pub fn has_handle(&self) -> bool { + matches!( + self, + EntryPointsSet::InitHandle + | EntryPointsSet::InitHandleHandleReply + | EntryPointsSet::Handle + | EntryPointsSet::HandleHandleReply + ) + } + + /// Checks whether the set has ***handle_reply*** entry point. + pub fn has_handle_reply(&self) -> bool { + matches!( + self, + EntryPointsSet::InitHandleReply + | EntryPointsSet::InitHandleHandleReply + | EntryPointsSet::HandleHandleReply + ) + } +} diff --git a/utils/wasm-gen/src/config/module.rs b/utils/wasm-gen/src/config/module.rs new file mode 100644 index 00000000000..a077a7eabee --- /dev/null +++ b/utils/wasm-gen/src/config/module.rs @@ -0,0 +1,364 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Config entities related to generating plain wasm module using `wasm-smith`. +//! +//! We don't give access to wasm_smith::`SwarmConfig` direct;y, but with several adaptors, +//! because valid wasm module is not always valid gear module. So, some configurational variables +//! can be arbitrary, but some must be constantly set. That's implemented with [`ArbitraryParams`] +//! and [`ConstantParams`]. + +use arbitrary::{Arbitrary, Result, Unstructured}; +use wasm_smith::{InstructionKind::*, InstructionKinds, SwarmConfig}; + +/// Wasm module generation config. +/// +/// This config wraps the `wasm_smith::SwarmConfig`. That's to make it +/// easy creating a configuration, which is custom, from one side, and, +/// from another side, results in generating valid gear wasm modules. +#[derive(Debug, Clone)] +pub struct WasmModuleConfig(SwarmConfig); + +impl WasmModuleConfig { + /// Unwrap the inner `wasm-smith` config. + pub fn into_inner(self) -> SwarmConfig { + self.0 + } +} + +impl Arbitrary<'_> for WasmModuleConfig { + fn arbitrary(u: &mut Unstructured<'_>) -> Result { + let selectable_params = SelectableParams::default(); + let arbitrary_params = u.arbitrary::()?; + + Ok((selectable_params, arbitrary_params).into()) + } +} + +impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { + fn from((selectable_params, arbitrary_params): (SelectableParams, ArbitraryParams)) -> Self { + let ConstantParams { + allow_start_export, + bulk_memory_enabled, + exceptions_enabled, + max_exports, + max_imports, + max_instructions, + max_memories, + min_memories, + max_tables, + memory64_enabled, + min_exports, + max_funcs, + min_imports, + multi_value_enabled, + reference_types_enabled, + relaxed_simd_enabled, + saturating_float_to_int_enabled, + sign_extension_enabled, + simd_enabled, + float_enabled, + allowed_instructions, + memory_grow_enabled, + min_funcs, + } = ConstantParams::default(); + + let SelectableParams { + call_indirect_enabled, + } = selectable_params; + + let ArbitraryParams { + available_imports, + canonicalize_nans, + export_everything, + max_aliases, + max_components, + max_data_segments, + max_element_segments, + max_elements, + max_globals, + max_instances, + max_modules, + max_nesting_depth, + max_tags, + max_type_size, + max_types, + max_values, + memory_max_size_required, + memory_offset_choices, + min_data_segments, + min_element_segments, + min_elements, + min_globals, + min_tables, + min_tags, + min_types, + min_uleb_size, + threads_enabled, + max_table_elements, + table_max_size_required, + max_memory_pages, + } = arbitrary_params; + + Self(SwarmConfig { + allow_start_export, + available_imports, + bulk_memory_enabled, + canonicalize_nans, + exceptions_enabled, + export_everything, + max_aliases, + max_components, + max_data_segments, + max_element_segments, + max_elements, + max_exports, + max_funcs, + max_globals, + max_imports, + max_instances, + max_instructions, + max_memories, + max_memory_pages, + max_modules, + max_nesting_depth, + max_tables, + max_tags, + max_type_size, + max_types, + max_values, + memory64_enabled, + memory_max_size_required, + memory_offset_choices, + min_data_segments, + min_element_segments, + min_elements, + min_exports, + min_funcs, + min_globals, + min_imports, + min_memories, + min_tables, + min_tags, + min_types, + min_uleb_size, + multi_value_enabled, + reference_types_enabled, + relaxed_simd_enabled, + saturating_float_to_int_enabled, + sign_extension_enabled, + simd_enabled, + float_enabled, + threads_enabled, + allowed_instructions, + max_table_elements, + table_max_size_required, + memory_grow_enabled, + call_indirect_enabled, + }) + } +} + +/// Arbitrary wasm module generation params. +/// +/// These are params that are allowed to be randomly set. +/// All of them are later used to instantiate `wasm_smith::SwarmConfig`. +#[derive(Debug, Clone)] +pub struct ArbitraryParams { + available_imports: Option>, + canonicalize_nans: bool, + export_everything: bool, + max_aliases: usize, + max_components: usize, + max_data_segments: usize, + max_element_segments: usize, + max_elements: usize, + max_globals: usize, + max_instances: usize, + max_modules: usize, + max_nesting_depth: usize, + max_tags: usize, + max_type_size: u32, + max_types: usize, + max_values: usize, + memory_max_size_required: bool, + memory_offset_choices: (u32, u32, u32), + min_data_segments: usize, + min_element_segments: usize, + min_elements: usize, + min_globals: usize, + min_tables: u32, + min_tags: usize, + min_types: usize, + min_uleb_size: u8, + threads_enabled: bool, + max_table_elements: u32, + table_max_size_required: bool, + max_memory_pages: u64, +} + +impl Arbitrary<'_> for ArbitraryParams { + fn arbitrary(u: &mut Unstructured<'_>) -> Result { + let random_swarm = u.arbitrary()?; + let SwarmConfig { + available_imports, + canonicalize_nans, + export_everything, + max_aliases, + max_components, + max_data_segments, + max_element_segments, + max_elements, + max_globals, + max_instances, + max_modules, + max_nesting_depth, + max_tags, + max_type_size, + max_types, + max_values, + memory_max_size_required, + memory_offset_choices, + min_data_segments, + min_element_segments, + min_elements, + min_globals, + min_tables, + min_tags, + min_types, + min_uleb_size, + threads_enabled, + max_table_elements, + table_max_size_required, + max_memory_pages, + .. + } = random_swarm; + + Ok(ArbitraryParams { + available_imports, + canonicalize_nans, + export_everything, + max_aliases, + max_components, + max_data_segments, + max_element_segments, + max_elements, + max_globals, + max_instances, + max_modules, + max_nesting_depth, + max_tags, + max_type_size, + max_types, + max_values, + memory_max_size_required, + memory_offset_choices, + min_data_segments, + min_element_segments, + min_elements, + min_globals, + min_tables, + min_tags, + min_types, + min_uleb_size, + threads_enabled, + max_table_elements, + table_max_size_required, + max_memory_pages, + }) + } +} + +/// Constant wasm module generation params. +/// +/// Wraps params, which are used to create `wasm_smith::SwarmConfig`, but they +/// must have pre-defined values to make `wasm-smith` generate valid gear modules. +pub struct ConstantParams { + allow_start_export: bool, + bulk_memory_enabled: bool, + exceptions_enabled: bool, + max_exports: usize, + max_imports: usize, + max_instructions: usize, + max_memories: usize, + min_memories: u32, + max_tables: usize, + memory64_enabled: bool, + min_exports: usize, + max_funcs: usize, + min_imports: usize, + multi_value_enabled: bool, + reference_types_enabled: bool, + relaxed_simd_enabled: bool, + saturating_float_to_int_enabled: bool, + sign_extension_enabled: bool, + simd_enabled: bool, + float_enabled: bool, + allowed_instructions: InstructionKinds, + memory_grow_enabled: bool, + min_funcs: usize, +} + +impl Default for ConstantParams { + fn default() -> Self { + ConstantParams { + allowed_instructions: InstructionKinds::new(&[ + Numeric, Reference, Parametric, Variable, Table, Memory, Control, + ]), + bulk_memory_enabled: false, + sign_extension_enabled: false, + saturating_float_to_int_enabled: false, + reference_types_enabled: false, + // This is related to reference_types_enabled. + max_tables: 1, + simd_enabled: false, + float_enabled: false, + relaxed_simd_enabled: false, + exceptions_enabled: false, + memory64_enabled: false, + allow_start_export: false, + multi_value_enabled: false, + memory_grow_enabled: false, + min_memories: 0, + max_memories: 1, + min_exports: 0, + max_exports: 0, + min_imports: 0, + max_imports: 0, + max_instructions: 100_000, + min_funcs: 15, + max_funcs: 100, + } + } +} + +/// Selectable wasm module generation params. +#[derive(Debug, Clone)] +pub struct SelectableParams { + /// Flag signalizing whether `call_indirect` instruction + /// must be used or not. + pub call_indirect_enabled: bool, +} + +impl Default for SelectableParams { + fn default() -> Self { + Self { + call_indirect_enabled: true, + } + } +} diff --git a/utils/wasm-gen/src/config/syscalls.rs b/utils/wasm-gen/src/config/syscalls.rs new file mode 100644 index 00000000000..87ba58c7612 --- /dev/null +++ b/utils/wasm-gen/src/config/syscalls.rs @@ -0,0 +1,180 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Configuration for the sys-calls imports generator, additional data injector +//! and sys-calls invocations generator. + +mod amount; +mod param; + +use gear_utils::NonEmpty; +use gear_wasm_instrument::syscalls::SysCallName; +use gsys::HashWithValue; +use std::ops::RangeInclusive; + +pub use amount::*; +pub use param::*; + +/// Builder for [`SysCallsConfig`]. +pub struct SysCallsConfigBuilder(SysCallsConfig); + +impl SysCallsConfigBuilder { + /// Create a new builder with defined injection amounts for all sys-calls. + pub fn new(injection_amounts: SysCallsInjectionAmounts) -> Self { + Self(SysCallsConfig { + injection_amounts, + random_mem_access: false, + params_config: SysCallsParamsConfig::default(), + sending_message_destination: MessageDestination::default(), + log_info: None, + }) + } + + /// Define whether memory access is performed to random pointers. + /// + /// # Note: + /// To be removed in next refactoring iterations. + pub fn with_unchecked_memory_access(mut self, flag: bool) -> Self { + self.0.random_mem_access = flag; + + self + } + + /// Set config for sys-calls params. + pub fn with_params_config(mut self, params_config: SysCallsParamsConfig) -> Self { + self.0.params_config = params_config; + + self + } + + /// Set whether `gr_send*` sys-calls must use `gr_source` result for message destination. + pub fn with_source_msg_dest(mut self) -> Self { + self.0.sending_message_destination = MessageDestination::Source; + self.enable_sys_call(SysCallName::Source); + + self + } + + /// Set whether `gr_send*` sys-calls must use some address from `addresses` collection + /// as a message destination. + pub fn with_data_offset_msg_dest(mut self, addresses: NonEmpty) -> Self { + self.0.sending_message_destination = MessageDestination::ExistingAddresses(addresses); + + self + } + + /// Set whether some externalities must be logged in the gear export (entry point) + /// function. + /// + /// Choosing gear export to log data is done from best `init` to worse `handle`. + pub fn with_log_info(mut self, log: String) -> Self { + self.0.log_info = Some(log); + self.enable_sys_call(SysCallName::Debug); + + self + } + + fn enable_sys_call(&mut self, name: SysCallName) { + let range = self.0.injection_amounts.get(name); + + let range_start = *range.start(); + if range_start == 0 { + let max = *range.end().max(&1); + self.0.injection_amounts.set(name, 1, max); + } + } + + /// Build the [`SysCallsConfig`]. + pub fn build(self) -> SysCallsConfig { + self.0 + } +} + +/// United config for all entities in sys-calls generator module. +#[derive(Debug, Clone, Default)] +pub struct SysCallsConfig { + // # Note: + // To be removed in next refactoring iterations + random_mem_access: bool, + injection_amounts: SysCallsInjectionAmounts, + params_config: SysCallsParamsConfig, + sending_message_destination: MessageDestination, + log_info: Option, +} + +impl SysCallsConfig { + /// Get flag whether memory access should be to same random pointer or with random value. + pub fn random_mem_access(&self) -> bool { + self.random_mem_access + } + + /// Get possible number of times (range) the sys-call can be injected in the wasm. + pub fn injection_amounts(&self, name: SysCallName) -> RangeInclusive { + self.injection_amounts.get(name) + } + + /// Get defined message destination for `gr_send*` sys-calls. + /// + /// For more info, read [`MessageDestination`]. + pub fn sending_message_destination(&self) -> &MessageDestination { + &self.sending_message_destination + } + + /// Get defined log info. + /// + /// For more info, read [`SysCallsConfigBuilder::with_log_info`]. + pub fn log_info(&self) -> Option<&String> { + self.log_info.as_ref() + } + + /// Gen sys-calls params config. + pub fn params_config(&self) -> &SysCallsParamsConfig { + &self.params_config + } +} + +/// Message destination choice. +/// +/// `gr_send*` sys-calls generated from this crate can send messages +/// to different destination in accordance to the config. +/// It's either to the message source, to some existing known address, +/// or to some random, most probably non-existing, address. +#[derive(Debug, Clone, Default)] +pub enum MessageDestination { + Source, + ExistingAddresses(NonEmpty), + #[default] + Random, +} + +impl MessageDestination { + /// Check whether message destination is a result of `gr_source`. + pub fn is_source(&self) -> bool { + matches!(&self, MessageDestination::Source) + } + + /// Check whether message destination is defined randomly. + pub fn is_random(&self) -> bool { + matches!(&self, MessageDestination::Random) + } + + /// Check whether message destination is defined from a collection of existing addresses. + pub fn is_existing_addresses(&self) -> bool { + matches!(&self, MessageDestination::ExistingAddresses(_)) + } +} diff --git a/utils/wasm-gen/src/config/syscalls/amount.rs b/utils/wasm-gen/src/config/syscalls/amount.rs new file mode 100644 index 00000000000..10653a8ab74 --- /dev/null +++ b/utils/wasm-gen/src/config/syscalls/amount.rs @@ -0,0 +1,77 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Entities describing possible amount for each sys-call to be injected into wasm module. +//! +//! Types here are used to create [`crate::SysCallsConfig`]. + +use gear_wasm_instrument::syscalls::SysCallName; +use std::{collections::HashMap, ops::RangeInclusive}; + +/// Possible injection amount ranges for each sys-call. +#[derive(Debug, Clone)] +pub struct SysCallsInjectionAmounts(HashMap>); + +impl SysCallsInjectionAmounts { + /// Instantiate a sys-calls amounts ranges map, where each gear sys-call is injected into wasm-module only once. + pub fn all_once() -> Self { + Self( + SysCallName::instrumentable() + .into_iter() + .map(|name| (name, (1..=1))) + .collect(), + ) + } + + /// Instantiate a sys-calls amounts ranges map, where no gear sys-call is ever injected into wasm-module. + pub fn all_never() -> Self { + Self( + SysCallName::instrumentable() + .into_iter() + .map(|name| (name, (0..=0))) + .collect(), + ) + } + + /// Get amount possible sys-call amount range. + pub fn get(&self, name: SysCallName) -> RangeInclusive { + self.0 + .get(&name) + .cloned() + .expect("instantiated with all sys-calls set") + } + + /// Sets possible amount range for the the sys-call. + pub fn set(&mut self, name: SysCallName, min: u32, max: u32) { + self.0.insert(name, min..=max); + } + + /// Same as [`SysCallsAmountRanges::set`], but sets amount ranges for multiple sys-calls. + pub fn set_multiple( + &mut self, + sys_calls_freqs: impl Iterator)>, + ) { + self.0.extend(sys_calls_freqs) + } +} + +impl Default for SysCallsInjectionAmounts { + fn default() -> Self { + Self::all_once() + } +} diff --git a/utils/wasm-gen/src/config/syscalls/param.rs b/utils/wasm-gen/src/config/syscalls/param.rs new file mode 100644 index 00000000000..b20c78721af --- /dev/null +++ b/utils/wasm-gen/src/config/syscalls/param.rs @@ -0,0 +1,165 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Entities describing sys-call param, more precisely, it's allowed values. +//! +//! Types here are used to create [`crate::SysCallsConfig`]. + +use arbitrary::{Result, Unstructured}; +use gear_wasm_instrument::{parity_wasm::elements::ValueType, syscalls::ParamType}; +use std::{collections::HashMap, ops::RangeInclusive}; + +#[derive(Debug)] +pub(crate) enum ProcessedSysCallParams { + Alloc, + Value { + value_type: ValueType, + allowed_values: Option, + }, + MemoryArray, + MemoryPtrValue, +} + +pub(crate) fn process_sys_call_params( + params: &[ParamType], + params_config: &SysCallsParamsConfig, +) -> Vec { + let mut res = Vec::with_capacity(params.len()); + let mut skip_next_param = false; + for ¶m in params { + if skip_next_param { + skip_next_param = false; + continue; + } + let processed_param = match param { + ParamType::Alloc => ProcessedSysCallParams::Alloc, + ParamType::Ptr(maybe_idx) => maybe_idx + .map(|_| { + // skipping next as we don't need the following `Size` param, + // because it will be chosen in accordance to the wasm module + // memory pages config. + skip_next_param = true; + ProcessedSysCallParams::MemoryArray + }) + .unwrap_or(ProcessedSysCallParams::MemoryPtrValue), + _ => ProcessedSysCallParams::Value { + value_type: param.into(), + allowed_values: params_config.get_rule(¶m), + }, + }; + + res.push(processed_param); + } + + res +} + +/// Sys-calls params config. +/// +/// This is basically a map, which creates a relationship between each kind of +/// param, that a sys-call can have, and allowed values ("rules") for each of +/// the params. +#[derive(Debug, Clone)] +pub struct SysCallsParamsConfig(HashMap); + +impl SysCallsParamsConfig { + /// Get allowed values for the `param`. + pub fn get_rule(&self, param: &ParamType) -> Option { + self.0.get(param).cloned() + } + + /// Set allowed values for the `param`. + pub fn add_rule(&mut self, param: ParamType, allowed_values: SysCallParamAllowedValues) { + self.0.insert(param, allowed_values); + } +} + +impl Default for SysCallsParamsConfig { + fn default() -> Self { + Self( + [ + (ParamType::Size, (0..=0x10000).into()), + // There are no rules for memory arrays as they are chose in accordance + // to memory pages config. + (ParamType::Ptr(None), (0..=513 * 0x10000 - 1).into()), + (ParamType::Gas, (0..=250_000_000_000).into()), + (ParamType::MessagePosition, (0..=10).into()), + (ParamType::Duration, (0..=100).into()), + (ParamType::Delay, (0..=100).into()), + (ParamType::Handler, (0..=100).into()), + (ParamType::Alloc, (0..=512).into()), + (ParamType::Free, (0..=512).into()), + ] + .iter() + .cloned() + .collect(), + ) + } +} + +/// Range of allowed values for the sys-call param. +#[derive(Debug, Clone)] +pub struct SysCallParamAllowedValues(RangeInclusive); + +impl From> for SysCallParamAllowedValues { + fn from(range: RangeInclusive) -> Self { + Self(range) + } +} + +impl SysCallParamAllowedValues { + /// Zero param value. + /// + /// That means that for particular param `0` will be always + /// it's value. + pub fn zero() -> Self { + Self(0..=0) + } +} + +impl Default for SysCallParamAllowedValues { + fn default() -> Self { + Self::zero() + } +} + +impl SysCallParamAllowedValues { + /// Get i32 value for the param from it's allowed range. + pub fn get_i32(&self, unstructured: &mut Unstructured) -> Result { + let current_range_start = *self.0.start(); + let current_range_end = *self.0.end(); + + let start = if current_range_start < i32::MIN as i64 { + i32::MIN + } else { + current_range_start as i32 + }; + let end = if current_range_end > i32::MAX as i64 { + i32::MAX + } else { + current_range_end as i32 + }; + + unstructured.int_in_range(start..=end) + } + + /// Get i64 value for the param from it's allowed range. + pub fn get_i64(&self, unstructured: &mut Unstructured) -> Result { + unstructured.int_in_range(self.0.clone()) + } +} diff --git a/utils/wasm-gen/src/lib.rs b/utils/wasm-gen/src/lib.rs index a0c314c6092..3907ce63eca 100644 --- a/utils/wasm-gen/src/lib.rs +++ b/utils/wasm-gen/src/lib.rs @@ -22,7 +22,6 @@ use std::{ collections::{BTreeMap, HashSet}, iter::Cycle, mem::size_of, - ops::RangeInclusive, }; use arbitrary::Unstructured; @@ -39,17 +38,19 @@ use gear_wasm_instrument::{ }; pub use gsys; use gsys::{ErrorWithHash, HashWithValue, Length}; -use wasm_smith::{InstructionKind::*, InstructionKinds, Module as ModuleSmith, SwarmConfig}; +use wasm_smith::{Module as ModuleSmith, SwarmConfig}; +mod config; mod syscalls; -use syscalls::{sys_calls_table, CallInfo, Parameter, SyscallsConfig}; +pub use config::*; +use syscalls::{sys_calls_table, CallInfo, CallSignature}; #[cfg(test)] mod tests; pub mod utils; pub mod wasm; -use wasm::{PageCount as WasmPageCount, PAGE_SIZE as WASM_PAGE_SIZE}; +use wasm::PageCount as WasmPageCount; pub mod memory; use memory::ModuleBuilderWithData; @@ -88,143 +89,6 @@ impl Ratio { } } -#[derive(Debug, Clone)] -pub struct ParamRule { - pub allowed_values: RangeInclusive, - pub unrestricted_ratio: Ratio, -} - -impl Default for ParamRule { - fn default() -> Self { - Self { - allowed_values: 0..=0, - unrestricted_ratio: (100, 100).into(), - } - } -} - -impl ParamRule { - pub fn get_i32(&self, u: &mut Unstructured) -> i32 { - if self.unrestricted_ratio.get(u) { - u.arbitrary().unwrap() - } else { - let start = if *self.allowed_values.start() < i32::MIN as i64 { - i32::MIN - } else { - *self.allowed_values.start() as i32 - }; - let end = if *self.allowed_values.end() > i32::MAX as i64 { - i32::MAX - } else { - *self.allowed_values.end() as i32 - }; - u.int_in_range(start..=end).unwrap() - } - } - pub fn get_i64(&self, u: &mut Unstructured) -> i64 { - if self.unrestricted_ratio.get(u) { - u.arbitrary().unwrap() - } else { - u.int_in_range(self.allowed_values.clone()).unwrap() - } - } -} - -#[derive(Clone)] -pub struct GearConfig { - pub process_when_no_funcs: Ratio, - pub skip_init: Ratio, - pub skip_handle: Ratio, - pub skip_handle_reply: Ratio, - pub skip_init_when_no_funcs: Ratio, - pub remove_recursion: Ratio, - pub init_export_is_any_func: Ratio, - pub max_mem_size: u32, - pub max_mem_delta: u32, - pub has_mem_upper_bound: Ratio, - pub upper_bound_can_be_less_then: Ratio, - pub sys_call_freq: Ratio, - pub sys_calls: SyscallsConfig, - pub print_test_info: Option, - pub max_percentage_seed: u32, - pub unchecked_memory_access: Ratio, - pub use_message_source: Ratio, - pub call_indirect_enabled: bool, -} - -impl GearConfig { - pub fn new_normal() -> Self { - let prob = (1, 100).into(); - Self { - process_when_no_funcs: prob, - skip_init: (1, 1000).into(), - skip_handle: prob, - skip_handle_reply: prob, - skip_init_when_no_funcs: prob, - remove_recursion: (80, 100).into(), - init_export_is_any_func: prob, - max_mem_size: 1024, - max_mem_delta: 1024, - has_mem_upper_bound: prob, - upper_bound_can_be_less_then: prob, - sys_call_freq: (1, 1000).into(), - sys_calls: Default::default(), - print_test_info: None, - max_percentage_seed: 100, - unchecked_memory_access: prob, - use_message_source: (50, 100).into(), - call_indirect_enabled: true, - } - } - pub fn new_for_rare_cases() -> Self { - let prob = (50, 100).into(); - Self { - skip_init: prob, - skip_handle: prob, - skip_handle_reply: prob, - skip_init_when_no_funcs: prob, - remove_recursion: prob, - process_when_no_funcs: prob, - init_export_is_any_func: prob, - max_mem_size: 1024, - max_mem_delta: 1024, - has_mem_upper_bound: prob, - upper_bound_can_be_less_then: prob, - sys_call_freq: (1, 1000).into(), - sys_calls: Default::default(), - print_test_info: None, - max_percentage_seed: 5, - unchecked_memory_access: prob, - use_message_source: prob, - call_indirect_enabled: true, - } - } - pub fn new_valid() -> Self { - let prob = (1, 100).into(); - let zero_prob = (0, 100).into(); - Self { - process_when_no_funcs: prob, - skip_init: zero_prob, - skip_handle: zero_prob, - skip_handle_reply: zero_prob, - skip_init_when_no_funcs: zero_prob, - remove_recursion: zero_prob, - init_export_is_any_func: zero_prob, - max_mem_size: 512, - max_mem_delta: 256, - has_mem_upper_bound: prob, - upper_bound_can_be_less_then: zero_prob, - sys_call_freq: (1, 1000).into(), - sys_calls: Default::default(), - print_test_info: None, - max_percentage_seed: 100, - unchecked_memory_access: zero_prob, - use_message_source: zero_prob, - call_indirect_enabled: true, - } - } -} - // Module and an optional index of gr_debug syscall. struct ModuleWithDebug { module: Module, @@ -253,45 +117,12 @@ impl From<(Module, Option, u32)> for ModuleWithDebug { } } -pub fn default_swarm_config(u: &mut Unstructured, gear_config: &GearConfig) -> SwarmConfig { - let mut cfg: SwarmConfig = u.arbitrary().unwrap(); - - cfg.allowed_instructions = InstructionKinds::new(&[ - Numeric, Control, Parametric, Variable, Reference, Table, Memory, - ]); - - cfg.sign_extension_enabled = false; - cfg.saturating_float_to_int_enabled = false; - cfg.reference_types_enabled = false; - cfg.bulk_memory_enabled = false; - cfg.simd_enabled = false; - cfg.float_enabled = false; - cfg.relaxed_simd_enabled = false; - cfg.exceptions_enabled = false; - cfg.memory64_enabled = false; - cfg.allow_start_export = false; - cfg.multi_value_enabled = false; - cfg.memory_grow_enabled = false; - cfg.call_indirect_enabled = gear_config.call_indirect_enabled; - - cfg.max_memories = 1; - cfg.max_tables = 1; - - cfg.min_exports = 0; - cfg.max_exports = 0; - - cfg.max_imports = 0; - cfg.min_imports = 0; - - cfg.max_instructions = 100000; - cfg.max_memory_pages = gear_config.max_mem_size as u64; - cfg.max_funcs = 100; - cfg.min_funcs = u.int_in_range(0..=30).unwrap(); - - cfg +pub fn default_swarm_config(selectables: SelectableParams, u: &mut Unstructured) -> SwarmConfig { + let arbitrary_params = u.arbitrary().unwrap(); + WasmModuleConfig::from((selectables, arbitrary_params)).into_inner() } -pub fn gen_wasm_smith_module(u: &mut Unstructured, config: &SwarmConfig) -> ModuleSmith { +pub fn gen_wasm_smith_module(u: &mut Unstructured, config: SwarmConfig) -> ModuleSmith { loop { if let Ok(module) = ModuleSmith::new(config.clone(), u) { return module; @@ -302,27 +133,40 @@ pub fn gen_wasm_smith_module(u: &mut Unstructured, config: &SwarmConfig) -> Modu fn build_checked_call( u: &mut Unstructured, results: &[ValueType], - params_rules: &[Parameter], + params_rules: &[ProcessedSysCallParams], func_no: u32, memory_pages: WasmPageCount, - unchecked_memory: Ratio, + unchecked_memory: bool, ) -> Vec { - let unchecked = unchecked_memory.get(u); - let mut code = Vec::with_capacity(params_rules.len() * 2 + 1 + results.len()); for parameter in params_rules { match parameter { - Parameter::Value { value_type, rule } => { - let instr = match value_type { - ValueType::I32 => Instruction::I32Const(rule.get_i32(u)), - ValueType::I64 => Instruction::I64Const(rule.get_i64(u)), - _ => panic!("Cannot handle f32/f64"), + ProcessedSysCallParams::Value { + value_type, + allowed_values, + } => { + let is_i32 = match value_type { + ValueType::I32 => true, + ValueType::I64 => false, + ValueType::F32 | ValueType::F64 => { + panic!("gear wasm must not have any floating nums") + } + }; + let instr = if let Some(allowed_values) = allowed_values { + if is_i32 { + Instruction::I32Const(allowed_values.get_i32(u).unwrap()) + } else { + Instruction::I64Const(allowed_values.get_i64(u).unwrap()) + } + } else if is_i32 { + Instruction::I32Const(u.arbitrary().unwrap()) + } else { + Instruction::I64Const(u.arbitrary().unwrap()) }; code.push(instr); } - - Parameter::MemoryArray => { - if unchecked { + ProcessedSysCallParams::MemoryArray => { + if unchecked_memory { code.push(Instruction::I32Const( u.arbitrary() .expect("Unstructured::arbitrary failed for MemoryArray"), @@ -346,9 +190,8 @@ fn build_checked_call( code.push(Instruction::I32Const((pointer_beyond - offset) as i32)); } } - - Parameter::MemoryValue => { - if unchecked { + ProcessedSysCallParams::MemoryPtrValue => { + if unchecked_memory { code.push(Instruction::I32Const( u.arbitrary() .expect("Unstructured::arbitrary failed for MemoryValue"), @@ -364,9 +207,8 @@ fn build_checked_call( code.push(Instruction::I32Const(offset as i32)); } } - - Parameter::Alloc => { - if unchecked { + ProcessedSysCallParams::Alloc => { + if unchecked_memory { code.push(Instruction::I32Const( u.arbitrary() .expect("Unstructured::arbitrary failed for Alloc"), @@ -444,7 +286,7 @@ fn get_func_type(module: &Module, func_idx: FuncIdx) -> FunctionType { struct WasmGen<'a> { u: &'a mut Unstructured<'a>, - config: GearConfig, + config: GearWasmGeneratorConfig, calls_indexes: Vec, } @@ -493,7 +335,11 @@ impl<'a> WasmGen<'a> { calls_indexes } - pub fn new(module: &Module, u: &'a mut Unstructured<'a>, config: GearConfig) -> Self { + pub fn new( + module: &Module, + u: &'a mut Unstructured<'a>, + config: GearWasmGeneratorConfig, + ) -> Self { let calls_indexes = Self::initial_calls_indexes(module); Self { u, @@ -502,45 +348,6 @@ impl<'a> WasmGen<'a> { } } - // ~1% of cases with invalid stack size not a multiple of the page size - // ~1% of cases with invalid stack size that is bigger than import memory - // ~1% of cases stack size is not generated at all - // all other cases should be valid - fn get_gear_stack_end_seed(&mut self, min_memory_size_pages: u32) -> GearStackEndExportSeed { - const NOT_GENERATE_SEED: u32 = 0; - const NOT_WASM_PAGE_SEED: u32 = 1; - const BIGGER_THAN_MEMORY_SEED: u32 = 2; - - let seed = self - .u - .int_in_range(0..=self.config.max_percentage_seed) - .unwrap(); - match seed { - NOT_GENERATE_SEED => GearStackEndExportSeed::NotGenerate, - NOT_WASM_PAGE_SEED => { - let max_size = min_memory_size_pages * WASM_PAGE_SIZE; - // More likely value is not multiple of WASM_PAGE_SIZE_BYTES - let value = self.u.int_in_range(0..=max_size).unwrap(); - GearStackEndExportSeed::GenerateValue(value) - } - BIGGER_THAN_MEMORY_SEED => { - let value_pages = self - .u - .int_in_range(min_memory_size_pages..=10 * min_memory_size_pages) - .unwrap(); - // Make value a multiple of WASM_PAGE_SIZE_BYTES but bigger than min_memory_size - let value_bytes = (value_pages + 1) * WASM_PAGE_SIZE; - GearStackEndExportSeed::GenerateValue(value_bytes) - } - _ => { - let correct_value_pages = self.u.int_in_range(0..=min_memory_size_pages).unwrap(); - // Make value a multiple of WASM_PAGE_SIZE_BYTES but less than min_memory_size - let correct_value_bytes = correct_value_pages * WASM_PAGE_SIZE; - GearStackEndExportSeed::GenerateValue(correct_value_bytes) - } - } - } - pub fn gen_mem_export(&mut self, mut module: Module) -> (Module, WasmPageCount) { let mut mem_section_idx = None; for (idx, section) in module.sections().iter().enumerate() { @@ -551,21 +358,8 @@ impl<'a> WasmGen<'a> { } mem_section_idx.map(|index| module.sections_mut().remove(index)); - let mem_size = self.u.int_in_range(0..=self.config.max_mem_size).unwrap(); - let mem_size_upper_bound = if self.config.has_mem_upper_bound.get(self.u) { - Some(if self.config.upper_bound_can_be_less_then.get(self.u) { - self.u - .int_in_range(0..=mem_size + self.config.max_mem_delta) - .unwrap() - } else { - self.u - .int_in_range(mem_size..=mem_size + self.config.max_mem_delta) - .unwrap() - }) - } else { - None - }; - + let mem_size = self.config.memory_config.initial_size; + let mem_size_upper_bound = self.config.memory_config.upper_limit; let module = builder::from_module(module) .import() .module("env") @@ -575,7 +369,13 @@ impl<'a> WasmGen<'a> { .build() .build(); - let gear_stack_end_seed = self.get_gear_stack_end_seed(mem_size); + let gear_stack_end_seed = self + .config + .memory_config + .stack_end + .map_or(GearStackEndExportSeed::NotGenerate, |stack_end| { + GearStackEndExportSeed::GenerateValue(stack_end) + }); if let GearStackEndExportSeed::GenerateValue(gear_stack_val) = gear_stack_end_seed { let mut module = builder::from_module(module) .global() @@ -632,7 +432,8 @@ impl<'a> WasmGen<'a> { ) -> Module { let funcs_len = module .function_section() - .map_or(0, |funcs| funcs.entries().len() as u32); + .map(|funcs| funcs.entries().len() as u32) + .expect("unreachable until functions section is not empty"); let func_type = get_func_type(&module, FuncIdx::Func(func_no)); let mut instructions = @@ -661,17 +462,14 @@ impl<'a> WasmGen<'a> { } pub fn gen_handle(&mut self, module: Module) -> (Module, bool) { - if self.config.skip_handle.get(self.u) { + if !self.config.entry_points_config.has_handle() { return (module, false); } let funcs_len = module .function_section() - .map_or(0, |funcs| funcs.entries().len() as u32); - - if funcs_len == 0 { - return (module, false); - } + .map(|funcs| funcs.entries().len() as u32) + .expect("unreachable until functions section is not empty"); let func_no = self.u.int_in_range(0..=funcs_len - 1).unwrap(); ( @@ -681,17 +479,14 @@ impl<'a> WasmGen<'a> { } pub fn gen_handle_reply(&mut self, module: Module) -> (Module, bool) { - if self.config.skip_handle_reply.get(self.u) { + if !self.config.entry_points_config.has_handle_reply() { return (module, false); } let funcs_len = module .function_section() - .map_or(0, |funcs| funcs.entries().len() as u32); - - if funcs_len == 0 { - return (module, false); - } + .map(|funcs| funcs.entries().len() as u32) + .expect("unreachable until functions section is not empty"); let func_no = self.u.int_in_range(0..=funcs_len - 1).unwrap(); ( @@ -701,51 +496,16 @@ impl<'a> WasmGen<'a> { } pub fn gen_init(&mut self, module: Module) -> (Module, bool) { - if self.config.skip_init.get(self.u) { + if !self.config.entry_points_config.has_init() { return (module, false); } let funcs_len = module .function_section() - .map_or(0, |funcs| funcs.entries().len() as u32); - - if funcs_len == 0 && self.config.skip_init_when_no_funcs.get(self.u) { - return (module, false); - } - - if funcs_len == 0 { - self.calls_indexes.push(FuncIdx::Func(funcs_len)); - return ( - builder::from_module(module) - .function() - .signature() - .build() - .build() - .export() - .field("init") - .internal() - .func(funcs_len) - .build() - .build(), - true, - ); - } + .map(|funcs| funcs.entries().len() as u32) + .expect("unreachable until functions section is not empty"); let func_no = self.u.int_in_range(0..=funcs_len - 1).unwrap(); - - if self.config.init_export_is_any_func.get(self.u) { - return ( - builder::from_module(module) - .export() - .field("init") - .internal() - .func(func_no) - .build() - .build(), - true, - ); - } - ( self.gen_export_func_which_call_func_no(module, "init", func_no), true, @@ -816,19 +576,13 @@ impl<'a> WasmGen<'a> { } let import_count = module.import_count(ImportCountType::Function); let mut module_builder = builder::from_module(module); - let sys_calls_table = sys_calls_table(&self.config); + let sys_calls_table = sys_calls_table(self.config.sys_calls_config.params_config()); for (i, (name, info, sys_call_amount)) in sys_calls_table .into_iter() .filter_map(|(name, info)| { - let sys_call_max_amount = info.frequency.mult(code_size); - let sys_call_amount = self.u.int_in_range(0..=sys_call_max_amount).unwrap(); - if sys_call_amount == 0 - && !(name == SysCallName::Debug && self.config.print_test_info.is_some()) - { - None - } else { - Some((name, info, sys_call_amount)) - } + let frequency = self.config.sys_calls_config.injection_amounts(name); + let sys_call_amount = self.u.int_in_range(frequency).unwrap() as usize; + (sys_call_amount != 0).then_some((name, info, sys_call_amount)) }) .enumerate() { @@ -888,20 +642,18 @@ impl<'a> WasmGen<'a> { }; let send_from_reservation_signature = SysCallSignature { params: vec![ - ParamType::Ptr, // Address of recipient and value (HashWithValue struct) - ParamType::Ptr, // Pointer to payload - ParamType::Size, // Size of the payload - ParamType::Delay, // Number of blocks to delay the sending for - ParamType::Gas, // Amount of gas to reserve - ParamType::Duration, // Duration of the reservation + ParamType::Ptr(None), // Address of recipient and value (HashWithValue struct) + ParamType::Ptr(Some(1)), // Pointer to payload + ParamType::Size, // Size of the payload + ParamType::Delay, // Number of blocks to delay the sending for + ParamType::Gas, // Amount of gas to reserve + ParamType::Duration, // Duration of the reservation ], results: Default::default(), }; let send_from_reservation_call_info = CallInfo::new( - &self.config, - send_from_reservation_signature, - self.config.sys_call_freq, - false, + CallSignature::Custom(send_from_reservation_signature), + self.config.sys_calls_config.params_config(), ); let func_type = send_from_reservation_call_info.func_type(); @@ -1013,7 +765,7 @@ impl<'a> WasmGen<'a> { &info.parameter_rules, data.call_index, memory_pages, - self.config.unchecked_memory_access, + self.config.sys_calls_config.random_mem_access(), ); } @@ -1023,11 +775,16 @@ impl<'a> WasmGen<'a> { &info.parameter_rules[1..], data.call_index, memory_pages, - self.config.unchecked_memory_access, + self.config.sys_calls_config.random_mem_access(), ); if let Some(source_call_index) = source_call_index { - if self.config.use_message_source.get(self.u) { + if self + .config + .sys_calls_config + .sending_message_destination() + .is_source() + { let mut instructions = Vec::with_capacity(3 + remaining_instructions.len()); let memory_size = memory_pages.memory_size(); @@ -1061,7 +818,7 @@ impl<'a> WasmGen<'a> { } pub fn make_print_test_info(&mut self, result: ModuleWithDebug) -> Module { - let Some(text) = &self.config.print_test_info else { + let Some(text) = self.config.sys_calls_config.log_info() else { return result.module; }; @@ -1131,8 +888,8 @@ impl<'a> WasmGen<'a> { let Self { calls_indexes, - u, config, + .. } = self; let import_funcs_num = module @@ -1179,7 +936,7 @@ impl<'a> WasmGen<'a> { } } - match config.remove_recursion.get(u) { + match config.remove_recursions { true => utils::remove_recursion(module), false => module, } @@ -1188,21 +945,25 @@ impl<'a> WasmGen<'a> { pub fn gen_gear_program_module<'a>( u: &'a mut Unstructured<'a>, - config: GearConfig, + config: ConfigsBundle, addresses: &[HashWithValue], ) -> Module { - let swarm_config = default_swarm_config(u, &config); + let ConfigsBundle { + gear_wasm_generator_config: generator_config, + module_selectables_config: selectables_config, + } = config; + let swarm_config = default_swarm_config(selectables_config, u); let module = loop { - let module = gen_wasm_smith_module(u, &swarm_config); + let module = gen_wasm_smith_module(u, swarm_config.clone()); let wasm_bytes = module.to_bytes(); let module: Module = parity_wasm::deserialize_buffer(&wasm_bytes).unwrap(); - if module.function_section().is_some() || config.process_when_no_funcs.get(u) { + if module.function_section().is_some() { break module; } }; - let mut gen = WasmGen::new(&module, u, config); + let mut gen = WasmGen::new(&module, u, generator_config); let (module, memory_pages) = gen.gen_mem_export(module); let (module, has_init) = gen.gen_init(module); @@ -1238,7 +999,7 @@ pub fn gen_gear_program_module<'a>( pub fn gen_gear_program_code<'a>( u: &'a mut Unstructured<'a>, - config: GearConfig, + config: ConfigsBundle, addresses: &[HashWithValue], ) -> Vec { let module = gen_gear_program_module(u, config, addresses); diff --git a/utils/wasm-gen/src/syscalls.rs b/utils/wasm-gen/src/syscalls.rs index 678f1eff0da..b19a087d675 100644 --- a/utils/wasm-gen/src/syscalls.rs +++ b/utils/wasm-gen/src/syscalls.rs @@ -20,24 +20,10 @@ use std::collections::BTreeMap; use gear_wasm_instrument::{ parity_wasm::elements::{FunctionType, ValueType}, - syscalls::{ParamType, SysCallName, SysCallSignature}, + syscalls::{SysCallName, SysCallSignature}, }; -use crate::{GearConfig, ParamRule, Ratio}; - -pub fn param_to_rule(param: ParamType, config: &GearConfig) -> ParamRule { - match param { - ParamType::Size => config.sys_calls.memory_size_rule.clone(), - ParamType::Ptr => config.sys_calls.ptr_rule.clone(), - ParamType::Gas => config.sys_calls.gas_rule.clone(), - ParamType::MessagePosition => config.sys_calls.message_position.clone(), - ParamType::Duration => config.sys_calls.duration_in_blocks.clone(), - ParamType::Delay => config.sys_calls.duration_in_blocks.clone(), - ParamType::Handler => config.sys_calls.handler.clone(), - ParamType::Alloc => config.sys_calls.alloc_param_rule.clone(), - ParamType::Free => config.sys_calls.free_param_rule.clone(), - } -} +use crate::config::{process_sys_call_params, ProcessedSysCallParams, SysCallsParamsConfig}; /// Syscall function info and config. #[derive(Debug)] @@ -46,159 +32,51 @@ pub struct CallInfo { pub params: Vec, /// Syscall signature results. pub results: Vec, - /// Syscall frequency in generated code. - pub frequency: Ratio, /// Syscall allowed input values. - pub parameter_rules: Vec, + pub(crate) parameter_rules: Vec, } impl CallInfo { - pub fn new( - config: &GearConfig, - signature: SysCallSignature, - frequency: Ratio, - skip_memory_array: bool, - ) -> Self { + pub fn new(call_signature: CallSignature, params_config: &SysCallsParamsConfig) -> Self { + let signature = call_signature.signature(); Self { params: signature.params.iter().copied().map(Into::into).collect(), results: signature.results.to_vec(), - frequency, - parameter_rules: Self::into_parameter_rules( - config, - signature.params, - skip_memory_array, - ), + parameter_rules: process_sys_call_params(&signature.params, params_config), } } pub fn func_type(&self) -> FunctionType { FunctionType::new(self.params.clone(), self.results.clone()) } - - fn into_parameter_rules( - config: &GearConfig, - parameters: Vec, - skip_memory_array: bool, - ) -> Vec { - let mut rules = Vec::with_capacity(parameters.len()); - for parameter in parameters.into_iter() { - match parameter { - ParamType::Size => match rules.last_mut() { - None => rules.push((parameter, false)), - Some((first, memory_array)) => match (first, *memory_array) { - (ParamType::Ptr, false) if !skip_memory_array => *memory_array = true, - _ => rules.push((parameter, false)), - }, - }, - - _ => rules.push((parameter, false)), - } - } - - rules - .into_iter() - .map(|(arg_type, memory_array)| match memory_array { - true => Parameter::MemoryArray, - false => match arg_type { - ParamType::Ptr => Parameter::MemoryValue, - ParamType::Alloc => Parameter::Alloc, - _ => Parameter::Value { - value_type: arg_type.into(), - rule: param_to_rule(arg_type, config), - }, - }, - }) - .collect() - } -} - -/// Newtype for additional validation of calls arguments. -/// -/// Parameters describing memory access should have correct values -/// if required. For example, offset + length < memory_size for arrays. -#[derive(Debug)] -pub enum Parameter { - /// Some value with its type and generating rule. - Value { - value_type: ValueType, - rule: ParamRule, - }, - /// Offset and length in memory for an array. Both have type i32. - MemoryArray, - /// Pointer in memory for some primitive type value. - MemoryValue, - /// Argument to `alloc` syscall. - Alloc, } -/// Syscalls config. -#[derive(Debug, Clone)] -pub struct SyscallsConfig { - pub alloc_param_rule: ParamRule, - pub free_param_rule: ParamRule, - pub ptr_rule: ParamRule, - pub memory_size_rule: ParamRule, - pub no_rule: ParamRule, - pub gas_rule: ParamRule, - pub message_position: ParamRule, - pub duration_in_blocks: ParamRule, - pub handler: ParamRule, +pub enum CallSignature { + // Derivable signature from `SysCallName` type. + Standard(SysCallName), + // Custom sys-call signature. + Custom(SysCallSignature), } -impl Default for SyscallsConfig { - fn default() -> Self { - let unrestricted_ratio = (1, 100).into(); - Self { - alloc_param_rule: ParamRule { - allowed_values: 0..=512, - unrestricted_ratio, - }, - free_param_rule: ParamRule { - allowed_values: 0..=512, - unrestricted_ratio, - }, - ptr_rule: ParamRule { - allowed_values: 0..=513 * 0x10000 - 1, - unrestricted_ratio, - }, - memory_size_rule: ParamRule { - allowed_values: 0..=0x10000, - unrestricted_ratio: (10, 100).into(), - }, - no_rule: ParamRule { - allowed_values: 0..=0, - unrestricted_ratio: (100, 100).into(), - }, - gas_rule: ParamRule { - allowed_values: 0..=250_000_000_000, - unrestricted_ratio, - }, - message_position: ParamRule { - allowed_values: 0..=10, - unrestricted_ratio, - }, - duration_in_blocks: ParamRule { - allowed_values: 0..=10000, - unrestricted_ratio, - }, - handler: ParamRule { - allowed_values: 0..=100, - unrestricted_ratio, - }, +impl CallSignature { + fn signature(&self) -> SysCallSignature { + match self { + CallSignature::Standard(name) => name.signature(), + CallSignature::Custom(signature) => signature.clone(), } } } /// Make syscalls table for given config. -pub(crate) fn sys_calls_table(config: &GearConfig) -> BTreeMap { +pub(crate) fn sys_calls_table( + params_config: &SysCallsParamsConfig, +) -> BTreeMap { SysCallName::instrumentable() .into_iter() .map(|name| { ( name, - CallInfo::new(config, name.signature(), config.sys_call_freq, { - name == SysCallName::SendInput || name == SysCallName::SendInputWGas - }), + CallInfo::new(CallSignature::Standard(name), params_config), ) }) .collect() diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index 3d1fd8585a2..850891f27df 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -19,7 +19,8 @@ use std::mem; use crate::{ - gen_gear_program_code, memory::ModuleBuilderWithData, utils, GearConfig, ModuleWithDebug, + gen_gear_program_code, memory::ModuleBuilderWithData, utils, ConfigsBundle, + GearWasmGeneratorConfigBuilder, ModuleWithDebug, SysCallsConfigBuilder, }; use arbitrary::Unstructured; use gear_wasm_instrument::parity_wasm::{ @@ -42,19 +43,7 @@ fn gen_wasm_normal() { let mut buf = vec![0; UNSTRUCTURED_SIZE]; rng.fill_bytes(&mut buf); let mut u = Unstructured::new(&buf); - let code = gen_gear_program_code(&mut u, GearConfig::new_normal(), &[]); - let _wat = wasmprinter::print_bytes(code).unwrap(); - } -} - -#[test] -fn gen_wasm_rare() { - let mut rng = SmallRng::seed_from_u64(12345); - for _ in 0..MODULES_AMOUNT { - let mut buf = vec![0; UNSTRUCTURED_SIZE]; - rng.fill_bytes(&mut buf); - let mut u = Unstructured::new(&buf); - let code = gen_gear_program_code(&mut u, GearConfig::new_for_rare_cases(), &[]); + let code = gen_gear_program_code(&mut u, ConfigsBundle::default(), &[]); let _wat = wasmprinter::print_bytes(code).unwrap(); } } @@ -62,8 +51,17 @@ fn gen_wasm_rare() { #[test] fn gen_wasm_valid() { let mut rng = SmallRng::seed_from_u64(33333); - let mut config = GearConfig::new_valid(); - config.print_test_info = Some("HEY GEAR".to_owned()); + let gear_wasm_generator_config = GearWasmGeneratorConfigBuilder::new() + .with_sys_calls_config( + SysCallsConfigBuilder::new(Default::default()) + .with_log_info("HEY GEAR".into()) + .build(), + ) + .build(); + let config = ConfigsBundle { + gear_wasm_generator_config, + ..Default::default() + }; for _ in 0..MODULES_AMOUNT { let mut buf = vec![0; UNSTRUCTURED_SIZE]; rng.fill_bytes(&mut buf); @@ -134,7 +132,7 @@ proptest! { let mut u = Unstructured::new(&buf); let mut u2 = Unstructured::new(&buf); - let gear_config = GearConfig::new_normal(); + let gear_config = ConfigsBundle::default(); let first = gen_gear_program_code(&mut u, gear_config.clone(), &[]); let second = gen_gear_program_code(&mut u2, gear_config, &[]); @@ -152,7 +150,7 @@ fn injecting_addresses_works() { let mut buf = vec![0; UNSTRUCTURED_SIZE]; rng.fill_bytes(&mut buf); let mut u = Unstructured::new(&buf); - let code = gen_gear_program_code(&mut u, GearConfig::new_normal(), &[]); + let code = gen_gear_program_code(&mut u, ConfigsBundle::default(), &[]); let module: elements::Module = parity_wasm::deserialize_buffer(&code).unwrap(); let memory_pages = module diff --git a/utils/wasm-gen/src/wasm.rs b/utils/wasm-gen/src/wasm.rs index c1d160b25f4..39951f02db6 100644 --- a/utils/wasm-gen/src/wasm.rs +++ b/utils/wasm-gen/src/wasm.rs @@ -39,12 +39,6 @@ impl From for PageCount { } } -impl From for PageCount { - fn from(value: Page) -> Self { - Self(u32::from(value.0) + 1) - } -} - impl PageCount { /// Calculate WASM memory size for this pages count. pub fn memory_size(&self) -> u32 { diff --git a/utils/wasm-instrument/src/syscalls.rs b/utils/wasm-instrument/src/syscalls.rs index 074d99d8484..1bc1e91382e 100644 --- a/utils/wasm-instrument/src/syscalls.rs +++ b/utils/wasm-instrument/src/syscalls.rs @@ -26,7 +26,7 @@ use enum_iterator::{self, Sequence}; /// /// The type is mainly used to prevent from skipping sys-call integration test for /// a newly introduced sys-call or from typo in sys-call name. -#[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, Sequence)] +#[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, Sequence, Hash)] pub enum SysCallName { // Message sending related // -- @@ -242,60 +242,89 @@ impl SysCallName { match self { Self::Alloc => SysCallSignature::system([Alloc], [I32]), Self::Free => SysCallSignature::system([Free], [I32]), - Self::Debug => SysCallSignature::gr([Ptr, Size]), - Self::Panic => SysCallSignature::gr([Ptr, Size]), + Self::Debug => SysCallSignature::gr([Ptr(Some(1)), Size]), + Self::Panic => SysCallSignature::gr([Ptr(Some(1)), Size]), Self::OomPanic => SysCallSignature::gr([]), - Self::BlockHeight => SysCallSignature::gr([Ptr]), - Self::BlockTimestamp => SysCallSignature::gr([Ptr]), - Self::Exit => SysCallSignature::gr([Ptr]), - Self::GasAvailable => SysCallSignature::gr([Ptr]), - Self::PayProgramRent => SysCallSignature::gr([Ptr, Ptr]), - Self::ProgramId => SysCallSignature::gr([Ptr]), + Self::BlockHeight => SysCallSignature::gr([Ptr(None)]), + Self::BlockTimestamp => SysCallSignature::gr([Ptr(None)]), + Self::Exit => SysCallSignature::gr([Ptr(None)]), + Self::GasAvailable => SysCallSignature::gr([Ptr(None)]), + Self::PayProgramRent => SysCallSignature::gr([Ptr(None), Ptr(None)]), + Self::ProgramId => SysCallSignature::gr([Ptr(None)]), Self::Leave => SysCallSignature::gr([]), - Self::ValueAvailable => SysCallSignature::gr([Ptr]), + Self::ValueAvailable => SysCallSignature::gr([Ptr(None)]), Self::Wait => SysCallSignature::gr([]), Self::WaitUpTo => SysCallSignature::gr([Duration]), Self::WaitFor => SysCallSignature::gr([Duration]), - Self::Wake => SysCallSignature::gr([Ptr, Delay, Ptr]), - Self::ReplyCode => SysCallSignature::gr([Ptr]), - Self::SignalCode => SysCallSignature::gr([Ptr]), - Self::MessageId => SysCallSignature::gr([Ptr]), - Self::Read => SysCallSignature::gr([MessagePosition, Size, Ptr, Ptr]), - Self::Reply => SysCallSignature::gr([Ptr, Size, Ptr, Ptr]), - Self::ReplyInput => SysCallSignature::gr([Size, Size, Ptr, Ptr]), - Self::ReplyWGas => SysCallSignature::gr([Ptr, Size, Gas, Ptr, Ptr]), - Self::ReplyInputWGas => SysCallSignature::gr([Size, Size, Gas, Ptr, Ptr]), - Self::ReplyCommit => SysCallSignature::gr([Ptr, Ptr]), - Self::ReplyCommitWGas => SysCallSignature::gr([Gas, Ptr, Ptr]), - Self::ReservationReply => SysCallSignature::gr([Ptr, Ptr, Size, Ptr]), - Self::ReservationReplyCommit => SysCallSignature::gr([Ptr, Ptr]), - Self::ReplyPush => SysCallSignature::gr([Ptr, Size, Ptr]), - Self::ReplyPushInput => SysCallSignature::gr([Size, Size, Ptr]), - Self::ReplyTo => SysCallSignature::gr([Ptr]), - Self::SignalFrom => SysCallSignature::gr([Ptr]), - Self::Send => SysCallSignature::gr([Ptr, Ptr, Size, Delay, Ptr]), - Self::SendInput => SysCallSignature::gr([Ptr, Size, Size, Delay, Ptr]), - Self::SendWGas => SysCallSignature::gr([Ptr, Ptr, Size, Gas, Delay, Ptr]), - Self::SendInputWGas => SysCallSignature::gr([Ptr, Size, Size, Gas, Delay, Ptr]), - Self::SendCommit => SysCallSignature::gr([Handler, Ptr, Delay, Ptr]), - Self::SendCommitWGas => SysCallSignature::gr([Handler, Ptr, Gas, Delay, Ptr]), - Self::SendInit => SysCallSignature::gr([Ptr]), - Self::SendPush => SysCallSignature::gr([Handler, Ptr, Size, Ptr]), - Self::SendPushInput => SysCallSignature::gr([Handler, Size, Size, Ptr]), - Self::ReservationSend => SysCallSignature::gr([Ptr, Ptr, Size, Delay, Ptr]), - Self::ReservationSendCommit => SysCallSignature::gr([Handler, Ptr, Delay, Ptr]), - Self::Size => SysCallSignature::gr([Ptr]), - Self::Source => SysCallSignature::gr([Ptr]), - Self::Value => SysCallSignature::gr([Ptr]), - Self::CreateProgram => SysCallSignature::gr([Ptr, Ptr, Size, Ptr, Size, Delay, Ptr]), - Self::CreateProgramWGas => { - SysCallSignature::gr([Ptr, Ptr, Size, Ptr, Size, Gas, Delay, Ptr]) + Self::Wake => SysCallSignature::gr([Ptr(None), Delay, Ptr(None)]), + Self::ReplyCode => SysCallSignature::gr([Ptr(None)]), + Self::SignalCode => SysCallSignature::gr([Ptr(None)]), + Self::MessageId => SysCallSignature::gr([Ptr(None)]), + Self::Read => SysCallSignature::gr([MessagePosition, Size, Ptr(None), Ptr(None)]), + Self::Reply => SysCallSignature::gr([Ptr(Some(1)), Size, Ptr(None), Ptr(None)]), + Self::ReplyInput => SysCallSignature::gr([Size, Size, Ptr(None), Ptr(None)]), + Self::ReplyWGas => { + SysCallSignature::gr([Ptr(Some(1)), Size, Gas, Ptr(None), Ptr(None)]) } - Self::ReplyDeposit => SysCallSignature::gr([Ptr, Gas, Ptr]), - Self::ReserveGas => SysCallSignature::gr([Gas, Duration, Ptr]), - Self::UnreserveGas => SysCallSignature::gr([Ptr, Ptr]), - Self::SystemReserveGas => SysCallSignature::gr([Gas, Ptr]), - Self::Random => SysCallSignature::gr([Ptr, Ptr]), + Self::ReplyInputWGas => SysCallSignature::gr([Size, Size, Gas, Ptr(None), Ptr(None)]), + Self::ReplyCommit => SysCallSignature::gr([Ptr(None), Ptr(None)]), + Self::ReplyCommitWGas => SysCallSignature::gr([Gas, Ptr(None), Ptr(None)]), + Self::ReservationReply => { + SysCallSignature::gr([Ptr(None), Ptr(Some(2)), Size, Ptr(None)]) + } + Self::ReservationReplyCommit => SysCallSignature::gr([Ptr(None), Ptr(None)]), + Self::ReplyPush => SysCallSignature::gr([Ptr(Some(1)), Size, Ptr(None)]), + Self::ReplyPushInput => SysCallSignature::gr([Size, Size, Ptr(None)]), + Self::ReplyTo => SysCallSignature::gr([Ptr(None)]), + Self::SignalFrom => SysCallSignature::gr([Ptr(None)]), + Self::Send => SysCallSignature::gr([Ptr(None), Ptr(Some(2)), Size, Delay, Ptr(None)]), + Self::SendInput => SysCallSignature::gr([Ptr(None), Size, Size, Delay, Ptr(None)]), + Self::SendWGas => { + SysCallSignature::gr([Ptr(None), Ptr(Some(2)), Size, Gas, Delay, Ptr(None)]) + } + Self::SendInputWGas => { + SysCallSignature::gr([Ptr(None), Size, Size, Gas, Delay, Ptr(None)]) + } + Self::SendCommit => SysCallSignature::gr([Handler, Ptr(None), Delay, Ptr(None)]), + Self::SendCommitWGas => { + SysCallSignature::gr([Handler, Ptr(None), Gas, Delay, Ptr(None)]) + } + Self::SendInit => SysCallSignature::gr([Ptr(None)]), + Self::SendPush => SysCallSignature::gr([Handler, Ptr(Some(2)), Size, Ptr(None)]), + Self::SendPushInput => SysCallSignature::gr([Handler, Size, Size, Ptr(None)]), + Self::ReservationSend => { + SysCallSignature::gr([Ptr(None), Ptr(Some(2)), Size, Delay, Ptr(None)]) + } + Self::ReservationSendCommit => { + SysCallSignature::gr([Handler, Ptr(None), Delay, Ptr(None)]) + } + Self::Size => SysCallSignature::gr([Ptr(None)]), + Self::Source => SysCallSignature::gr([Ptr(None)]), + Self::Value => SysCallSignature::gr([Ptr(None)]), + Self::CreateProgram => SysCallSignature::gr([ + Ptr(None), + Ptr(Some(2)), + Size, + Ptr(Some(4)), + Size, + Delay, + Ptr(None), + ]), + Self::CreateProgramWGas => SysCallSignature::gr([ + Ptr(None), + Ptr(Some(2)), + Size, + Ptr(Some(4)), + Size, + Gas, + Delay, + Ptr(None), + ]), + Self::ReplyDeposit => SysCallSignature::gr([Ptr(None), Gas, Ptr(None)]), + Self::ReserveGas => SysCallSignature::gr([Gas, Duration, Ptr(None)]), + Self::UnreserveGas => SysCallSignature::gr([Ptr(None), Ptr(None)]), + Self::SystemReserveGas => SysCallSignature::gr([Gas, Ptr(None)]), + Self::Random => SysCallSignature::gr([Ptr(None), Ptr(None)]), other => panic!("Unknown syscall: '{:?}'", other), } } @@ -315,17 +344,24 @@ impl SysCallName { } /// Syscall param type. -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +/// +/// `Ptr` is usually used to point to the beginning of the array in memory. +/// In order to distiguish between pointer to the memory array and pointer +/// to some value, `Ptr` was defined as a tuple-like struct that owns an +/// optional index of the memory array size parameter. So if current sys-call +/// doesn't accept any memory array as an argument, then pointer parameter will +/// be `Ptr(None)`. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ParamType { - Size, // i32 buffers size in memory - Ptr, // i32 pointer - Gas, // i64 gas amount - MessagePosition, // i32 message position - Duration, // i32 duration in blocks - Delay, // i32 delay in blocks - Handler, // i32 handler number - Alloc, // i32 alloc pages - Free, // i32 free page + Size, // i32 buffers size in memory + Ptr(Option), // i32 pointer + Gas, // i64 gas amount + MessagePosition, // i32 message position + Duration, // i32 duration in blocks + Delay, // i32 delay in blocks + Handler, // i32 handler number + Alloc, // i32 alloc pages + Free, // i32 free page } impl From for ValueType { diff --git a/utils/wasm-instrument/src/tests.rs b/utils/wasm-instrument/src/tests.rs index 466fcbc880c..6cbbcd31f03 100644 --- a/utils/wasm-instrument/src/tests.rs +++ b/utils/wasm-instrument/src/tests.rs @@ -17,7 +17,10 @@ // along with this program. If not, see . use super::*; -use crate::{rules::CustomConstantCostRules, syscalls::SysCallName}; +use crate::{ + rules::CustomConstantCostRules, + syscalls::{ParamType, SysCallName}, +}; use elements::Instruction::*; use gas_metering::ConstantCostRules; use parity_wasm::serialize; @@ -665,3 +668,22 @@ fn test_sys_calls_table() { assert_eq!(termination_reason, ActorTerminationReason::Success.into()); } + +#[test] +fn check_memory_array_pointers_definition_correctness() { + let sys_calls = SysCallName::instrumentable(); + for sys_call in sys_calls { + let signature = sys_call.signature(); + let size_param_indexes = signature + .params + .iter() + .filter_map(|param_ty| match param_ty { + ParamType::Ptr(maybe_size_idx) if maybe_size_idx.is_some() => *maybe_size_idx, + _ => None, + }); + + for idx in size_param_indexes { + assert_eq!(signature.params.get(idx), Some(&ParamType::Size)); + } + } +} From 0afbadd16bd63da1c3d691007a0a091a873f8a08 Mon Sep 17 00:00:00 2001 From: Shamil <66209982+shamilsan@users.noreply.github.com> Date: Wed, 2 Aug 2023 20:58:30 +0300 Subject: [PATCH 018/165] feat(gtest): add support of reply code to `Log` (#2897) --- gtest/src/log.rs | 32 +++++++++++++++++++++++++++++++- gtest/src/mailbox.rs | 1 + gtest/src/manager.rs | 18 ++++++++++++++++++ gtest/src/program.rs | 9 +++++++++ gtest/src/system.rs | 2 ++ 5 files changed, 61 insertions(+), 1 deletion(-) diff --git a/gtest/src/log.rs b/gtest/src/log.rs index 28aaed74281..e5f91babf86 100644 --- a/gtest/src/log.rs +++ b/gtest/src/log.rs @@ -22,7 +22,7 @@ use gear_core::{ ids::{MessageId, ProgramId}, message::{Payload, StoredMessage}, }; -use gear_core_errors::{ErrorReplyReason, ReplyCode}; +use gear_core_errors::{ErrorReplyReason, ReplyCode, SuccessReplyReason}; use std::{convert::TryInto, fmt::Debug}; #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] @@ -144,20 +144,34 @@ impl Log { log } + /// Create a `Log` with a reply code of `SuccessReplyReason::Auto`. + pub fn auto_reply_builder() -> Self { + Self { + reply_code: Some(ReplyCode::Success(SuccessReplyReason::Auto)), + ..Default::default() + } + } + pub fn payload(self, payload: impl Encode) -> Self { self.payload_bytes(payload.encode()) } + #[track_caller] pub fn payload_bytes(mut self, payload: impl AsRef<[u8]>) -> Self { if self.payload.is_some() { panic!("Payload was already set for this log"); } + if let Some(ReplyCode::Success(SuccessReplyReason::Auto)) = self.reply_code { + panic!("Cannot set payload for auto reply"); + } + self.payload = Some(payload.as_ref().to_vec().try_into().unwrap()); self } + #[track_caller] pub fn source(mut self, source: impl Into) -> Self { if self.source.is_some() { panic!("Source was already set for this log"); @@ -168,6 +182,7 @@ impl Log { self } + #[track_caller] pub fn dest(mut self, dest: impl Into) -> Self { if self.destination.is_some() { panic!("Destination was already set for this log"); @@ -176,6 +191,21 @@ impl Log { self } + + /// Set the reply code for this log. + #[track_caller] + pub fn reply_code(mut self, reply_code: ReplyCode) -> Self { + if self.reply_code.is_some() { + panic!("Reply code was already set for this log"); + } + if self.payload.is_some() && reply_code == ReplyCode::Success(SuccessReplyReason::Auto) { + panic!("Cannot set auto reply for log with payload"); + } + + self.reply_code = Some(reply_code); + + self + } } impl PartialEq for Log { diff --git a/gtest/src/mailbox.rs b/gtest/src/mailbox.rs index 083f93adf52..376a41dd64b 100644 --- a/gtest/src/mailbox.rs +++ b/gtest/src/mailbox.rs @@ -69,6 +69,7 @@ impl<'a> Mailbox<'a> { ); } + #[track_caller] fn remove_message>(&self, log: T) -> StoredMessage { let log = log.into(); let mut manager = self.manager.borrow_mut(); diff --git a/gtest/src/manager.rs b/gtest/src/manager.rs index d295112fc53..7abd98d65cf 100644 --- a/gtest/src/manager.rs +++ b/gtest/src/manager.rs @@ -71,6 +71,7 @@ impl TestActor { // # Panics // If actor is initialized or dormant + #[track_caller] fn set_initialized(&mut self) { assert!( self.is_uninitialized(), @@ -229,6 +230,7 @@ pub(crate) struct ExtManager { } impl ExtManager { + #[track_caller] pub(crate) fn new() -> Self { Self { msg_nonce: 1, @@ -323,6 +325,7 @@ impl ExtManager { } } + #[track_caller] fn validate_dispatch(&mut self, dispatch: &Dispatch) { if 0 < dispatch.value() && dispatch.value() < crate::EXISTENTIAL_DEPOSIT { panic!( @@ -362,6 +365,7 @@ impl ExtManager { self.run_dispatch(dispatch) } + #[track_caller] pub(crate) fn run_dispatch(&mut self, dispatch: Dispatch) -> RunResult { self.prepare_for(&dispatch); @@ -530,6 +534,7 @@ impl ExtManager { } } + #[track_caller] pub(crate) fn override_balance(&mut self, id: &ProgramId, balance: Balance) { if self.is_user(id) && balance < crate::EXISTENTIAL_DEPOSIT { panic!( @@ -543,6 +548,7 @@ impl ExtManager { *actor_balance = balance; } + #[track_caller] pub(crate) fn read_memory_pages(&self, program_id: &ProgramId) -> &BTreeMap { let program = &self .actors @@ -562,6 +568,7 @@ impl ExtManager { } } + #[track_caller] pub(crate) fn override_memory_pages( &mut self, program_id: &ProgramId, @@ -585,6 +592,7 @@ impl ExtManager { } } + #[track_caller] fn prepare_for(&mut self, dispatch: &Dispatch) { self.msg_id = dispatch.id(); self.origin = dispatch.source(); @@ -608,6 +616,7 @@ impl ExtManager { } } + #[track_caller] fn init_success(&mut self, message_id: MessageId, program_id: ProgramId) { let (actor, _) = self .actors @@ -619,6 +628,7 @@ impl ExtManager { self.move_waiting_msgs_to_queue(message_id, program_id); } + #[track_caller] fn init_failure(&mut self, message_id: MessageId, program_id: ProgramId) { let (actor, _) = self .actors @@ -640,6 +650,7 @@ impl ExtManager { } // When called for the `dispatch`, it must be in queue. + #[track_caller] fn check_is_for_wait_list(&self, dispatch: &StoredDispatch) -> bool { let (actor, _) = self .actors @@ -769,6 +780,7 @@ impl ExtManager { self.process_dispatch(balance, None, Default::default(), dispatch); } + #[track_caller] fn process_dispatch( &mut self, balance: u128, @@ -971,6 +983,7 @@ impl JournalHandler for ExtManager { } } + #[track_caller] fn update_pages_data( &mut self, program_id: ProgramId, @@ -988,6 +1001,7 @@ impl JournalHandler for ExtManager { } } + #[track_caller] fn update_allocations(&mut self, program_id: ProgramId, allocations: BTreeSet) { let (actor, _) = self .actors @@ -1021,6 +1035,7 @@ impl JournalHandler for ExtManager { } } + #[track_caller] fn send_value(&mut self, from: ProgramId, to: Option, value: Balance) { if value == 0 { // Nothing to do @@ -1047,6 +1062,7 @@ impl JournalHandler for ExtManager { } } + #[track_caller] fn store_new_programs(&mut self, code_id: CodeId, candidates: Vec<(MessageId, ProgramId)>) { if let Some(code) = self.opt_binaries.get(&code_id).cloned() { for (init_message_id, candidate_id) in candidates { @@ -1081,6 +1097,7 @@ impl JournalHandler for ExtManager { } } + #[track_caller] fn stop_processing(&mut self, _dispatch: StoredDispatch, _gas_burned: u64) { panic!("Processing stopped. Used for on-chain logic only.") } @@ -1103,6 +1120,7 @@ impl JournalHandler for ExtManager { ) { } + #[track_caller] fn update_gas_reservation(&mut self, program_id: ProgramId, reserver: GasReserver) { let block_height = self.block_info.height; let (actor, _) = self diff --git a/gtest/src/program.rs b/gtest/src/program.rs index 6f9e6fb7e9d..8d62e4772e0 100644 --- a/gtest/src/program.rs +++ b/gtest/src/program.rs @@ -127,6 +127,7 @@ impl From<[u8; 32]> for ProgramIdWrapper { } impl From<&[u8]> for ProgramIdWrapper { + #[track_caller] fn from(other: &[u8]) -> Self { if other.len() != 32 { panic!("Invalid identifier: {:?}", other) @@ -158,6 +159,7 @@ impl From for ProgramIdWrapper { } impl From<&str> for ProgramIdWrapper { + #[track_caller] fn from(other: &str) -> Self { let id = other.strip_prefix("0x").unwrap_or(other); @@ -248,6 +250,7 @@ impl<'a> Program<'a> { Self::from_file_with_id(system, nonce, path) } + #[track_caller] pub fn from_file_with_id, I: Into + Clone + Debug>( system: &'a System, id: I, @@ -294,6 +297,7 @@ impl<'a> Program<'a> { Self::from_opt_and_meta_code_with_id(system, id, opt_code, Some(meta_code)) } + #[track_caller] pub fn from_opt_and_meta_code_with_id + Clone + Debug>( system: &'a System, id: I, @@ -345,6 +349,7 @@ impl<'a> Program<'a> { self.send_bytes_with_value(from, payload, 0) } + #[track_caller] pub fn send_bytes_with_value, T: AsRef<[u8]>>( &self, from: ID, @@ -381,6 +386,7 @@ impl<'a> Program<'a> { system.validate_and_run_dispatch(Dispatch::new(kind, message)) } + #[track_caller] pub fn send_signal>(&self, from: ID, code: SignalCode) -> RunResult { let mut system = self.manager.borrow_mut(); @@ -454,6 +460,7 @@ impl<'a> Program<'a> { self.manager.borrow().balance_of(&self.id()) } + #[track_caller] fn wasm_path(extension: &str) -> PathBuf { let current_dir = env::current_dir().expect("Unable to get current dir"); let path_file = current_dir.join(".binpath"); @@ -504,6 +511,7 @@ impl<'a> Program<'a> { } } +#[track_caller] fn read_file>(path: P, extension: &str) -> Vec { let path = env::current_dir() .expect("Unable to get root directory of the project") @@ -697,6 +705,7 @@ mod tests { } impl Drop for CleanupFolderOnDrop { + #[track_caller] fn drop(&mut self) { std::fs::remove_dir_all(&self.path).expect("Failed to cleanup after test") } diff --git a/gtest/src/system.rs b/gtest/src/system.rs index bd7b0fb2603..76d53f2d276 100644 --- a/gtest/src/system.rs +++ b/gtest/src/system.rs @@ -133,6 +133,7 @@ impl System { /// provide to the function "child's" code hash. Code for that code hash /// must be in storage at the time of the function call. So this method /// stores the code in storage. + #[track_caller] pub fn submit_code>(&self, code_path: P) -> CodeId { let path = env::current_dir() .expect("Unable to get root directory of the project") @@ -143,6 +144,7 @@ impl System { self.0.borrow_mut().store_new_code(&code) } + #[track_caller] pub fn get_mailbox>(&self, id: ID) -> Mailbox { let program_id = id.into().0; if !self.0.borrow().is_user(&program_id) { From 59671216a1083d19d7503525bb0bcae3f3413cb8 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Wed, 2 Aug 2023 21:05:41 +0300 Subject: [PATCH 019/165] refactoring(wasm-gen): Introduce general generator and memory generator. (#2982) --- utils/wasm-gen/src/generator.rs | 118 +++++++++++++++++ utils/wasm-gen/src/generator/memory.rs | 177 +++++++++++++++++++++++++ utils/wasm-gen/src/lib.rs | 112 +++++----------- utils/wasm-gen/src/memory.rs | 8 +- utils/wasm-gen/src/wasm.rs | 131 +++++++++++++++++- 5 files changed, 456 insertions(+), 90 deletions(-) create mode 100644 utils/wasm-gen/src/generator.rs create mode 100644 utils/wasm-gen/src/generator/memory.rs diff --git a/utils/wasm-gen/src/generator.rs b/utils/wasm-gen/src/generator.rs new file mode 100644 index 00000000000..a3dcda93c1a --- /dev/null +++ b/utils/wasm-gen/src/generator.rs @@ -0,0 +1,118 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Generators entities used to generate a valid gear wasm module. + +use crate::{GearWasmGeneratorConfig, WasmModule}; +use arbitrary::{Result, Unstructured}; +use gear_wasm_instrument::parity_wasm::elements::Module; + +mod memory; + +pub use memory::*; + +/// General gear wasm generator, which works as a mediator +/// controlling relations between various available in the +/// crate generators. +pub struct GearWasmGenerator<'a> { + unstructured: &'a mut Unstructured<'a>, + module: WasmModule, + config: GearWasmGeneratorConfig, +} + +impl<'a> GearWasmGenerator<'a> { + /// Create a new generator with a default config.. + pub fn new(module: WasmModule, unstructured: &'a mut Unstructured<'a>) -> Self { + Self::new_with_config(module, unstructured, GearWasmGeneratorConfig::default()) + } + + /// Create a new generator with a defined config. + pub fn new_with_config( + module: WasmModule, + unstructured: &'a mut Unstructured<'a>, + config: GearWasmGeneratorConfig, + ) -> Self { + Self { + unstructured, + module, + config, + } + } + + /// Run all generators, while mediating between them. + pub fn generate(self) -> Result { + let (disabled_mem_gen, frozen_gear_wasm_gen, _mem_imports_gen_proof) = + self.generate_memory_export(); + + Ok(Self::from((disabled_mem_gen, frozen_gear_wasm_gen)) + .module + .into_inner()) + } + + /// Generate memory export using memory generator. + pub fn generate_memory_export( + self, + ) -> ( + DisabledMemoryGenerator, + FrozenGearWasmGenerator<'a>, + MemoryImportGenerationProof, + ) { + let (mem_gen, frozen_gear_wasm_gen): (MemoryGenerator, FrozenGearWasmGenerator) = + self.into(); + let (disabled_mem_gen, mem_import_gen_proof) = mem_gen.generate_memory(); + + (disabled_mem_gen, frozen_gear_wasm_gen, mem_import_gen_proof) + } + + /// Disable current generator. + pub fn disable(self) -> DisabledGearWasmGenerator { + DisabledGearWasmGenerator(self.module) + } +} + +/// Frozen gear wasm generator. +/// +/// Instantce of this generator signals, that some gear wasm generator +/// instance was converted to some other generator available in this crate. +/// This type serves as an access/ticket for converting some generator back +/// to the gear wasm generator. So it mainly controls state machine flow. +pub struct FrozenGearWasmGenerator<'a> { + config: GearWasmGeneratorConfig, + unstructured: Option<&'a mut Unstructured<'a>>, +} + +impl<'a> FrozenGearWasmGenerator<'a> { + /// Destroy the frozen generator and retrieve it's + /// beneficial data. + pub fn melt(self) -> GearWasmGeneratorConfig { + self.config + } +} + +/// Disabled gear wasm generator. +/// +/// Similar to [`FrozenGearWasmGenerator`], but this one signals that state +/// machine transitions are ended. +pub struct DisabledGearWasmGenerator(WasmModule); + +impl DisabledGearWasmGenerator { + /// Converts into inner wasm module. + pub fn into_wasm_module(self) -> WasmModule { + self.0 + } +} diff --git a/utils/wasm-gen/src/generator/memory.rs b/utils/wasm-gen/src/generator/memory.rs new file mode 100644 index 00000000000..0fa241406f0 --- /dev/null +++ b/utils/wasm-gen/src/generator/memory.rs @@ -0,0 +1,177 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Memory import generator module. + +use crate::{ + generator::{FrozenGearWasmGenerator, GearWasmGenerator}, + MemoryPagesConfig, WasmModule, +}; +use gear_wasm_instrument::{ + parity_wasm::{ + builder, + elements::{Instruction, Section}, + }, + STACK_END_EXPORT_NAME, +}; + +/// Memory import generator. +/// +/// The generator is used to insert into wasm module new +/// valid (from gear runtime perspective) memory import definition +/// from the provided config. +pub struct MemoryGenerator { + config: MemoryPagesConfig, + module: WasmModule, +} + +impl<'a> From> for (MemoryGenerator, FrozenGearWasmGenerator<'a>) { + fn from(generator: GearWasmGenerator<'a>) -> Self { + let mem_generator = MemoryGenerator { + config: generator.config.memory_config, + module: generator.module, + }; + let frozen = FrozenGearWasmGenerator { + config: generator.config, + unstructured: Some(generator.unstructured), + }; + + (mem_generator, frozen) + } +} + +impl MemoryGenerator { + pub(crate) const MEMORY_FIELD_NAME: &str = "memory"; + + /// Instantiate the memory generator from wasm module and memory pages config. + pub fn new(module: WasmModule, config: MemoryPagesConfig) -> Self { + Self { config, module } + } + + /// Disable current generator. + pub fn disable(self) -> DisabledMemoryGenerator { + DisabledMemoryGenerator(self.module) + } + + /// Generate a new memory section from the config, used to instantiate the generator. + /// + /// Returns disabled memory generation and a proof that memory imports generation has happened. + pub fn generate_memory(mut self) -> (DisabledMemoryGenerator, MemoryImportGenerationProof) { + self.remove_mem_section(); + + let MemoryGenerator { + mut module, + config: + MemoryPagesConfig { + initial_size, + upper_limit, + stack_end, + }, + } = self; + + // Define memory import in the module + module.with(|module| { + let mut module = builder::from_module(module) + .import() + .module("env") + .field(Self::MEMORY_FIELD_NAME) + .external() + .memory(initial_size, upper_limit) + .build() + .build(); + + // Define optional stack-end + if let Some(stack_end) = stack_end { + module = builder::from_module(module) + .global() + .value_type() + .i32() + .init_expr(Instruction::I32Const(stack_end as i32)) + .build() + .build(); + + let stack_end_index = module + .global_section() + .expect("has at least stack end global") + .entries() + .len() + - 1; + + module = builder::from_module(module) + .export() + .field(STACK_END_EXPORT_NAME) + .internal() + .global(stack_end_index as u32) + .build() + .build(); + } + + (module, ()) + }); + + ( + DisabledMemoryGenerator(module), + MemoryImportGenerationProof(()), + ) + } + + // Remove current memory section. + fn remove_mem_section(&mut self) { + self.module.with(|mut module| { + // Find memory section index. + let mem_section_idx = module + .sections() + .iter() + .enumerate() + .find_map(|(idx, section)| matches!(section, Section::Memory(_)).then_some(idx)); + + // Remove it. + if let Some(mem_section_idx) = mem_section_idx { + module.sections_mut().remove(mem_section_idx); + } + + (module, ()) + }); + } +} + +/// Proof that there was an instance of memory generator and `MemoryGenerator::generate_memory` was called. +pub struct MemoryImportGenerationProof(()); + +/// Disabled wasm memory generator. +/// +/// Instance of this types signals that there was once active memory generator, +/// but it ended up it's work. +pub struct DisabledMemoryGenerator(pub WasmModule); + +impl<'a> From<(DisabledMemoryGenerator, FrozenGearWasmGenerator<'a>)> for GearWasmGenerator<'a> { + fn from( + (disabled_mem_gen, frozen_gear_wasm_gen): ( + DisabledMemoryGenerator, + FrozenGearWasmGenerator<'a>, + ), + ) -> Self { + GearWasmGenerator { + module: disabled_mem_gen.0, + config: frozen_gear_wasm_gen.config, + unstructured: frozen_gear_wasm_gen + .unstructured + .expect("internal error: counterfeit frozen gear wasm gen is used"), + } + } +} diff --git a/utils/wasm-gen/src/lib.rs b/utils/wasm-gen/src/lib.rs index 3907ce63eca..51dcedfb77a 100644 --- a/utils/wasm-gen/src/lib.rs +++ b/utils/wasm-gen/src/lib.rs @@ -30,19 +30,21 @@ use gear_wasm_instrument::{ self, builder, elements::{ BlockType, External, FunctionType, ImportCountType, Instruction, Instructions, - Internal, Module, Section, Type, ValueType, + Internal, Module, Type, ValueType, }, }, syscalls::{ParamType, SysCallName, SysCallSignature}, - STACK_END_EXPORT_NAME, }; pub use gsys; use gsys::{ErrorWithHash, HashWithValue, Length}; use wasm_smith::{Module as ModuleSmith, SwarmConfig}; mod config; -mod syscalls; pub use config::*; +mod generator; +pub use generator::*; + +mod syscalls; use syscalls::{sys_calls_table, CallInfo, CallSignature}; #[cfg(test)] @@ -51,9 +53,10 @@ mod tests; pub mod utils; pub mod wasm; use wasm::PageCount as WasmPageCount; +pub use wasm::*; pub mod memory; -use memory::ModuleBuilderWithData; +pub use memory::*; const MEMORY_VALUE_SIZE: u32 = 100; const MEMORY_FIELD_NAME: &str = "memory"; @@ -117,11 +120,6 @@ impl From<(Module, Option, u32)> for ModuleWithDebug { } } -pub fn default_swarm_config(selectables: SelectableParams, u: &mut Unstructured) -> SwarmConfig { - let arbitrary_params = u.arbitrary().unwrap(); - WasmModuleConfig::from((selectables, arbitrary_params)).into_inner() -} - pub fn gen_wasm_smith_module(u: &mut Unstructured, config: SwarmConfig) -> ModuleSmith { loop { if let Ok(module) = ModuleSmith::new(config.clone(), u) { @@ -290,11 +288,6 @@ struct WasmGen<'a> { calls_indexes: Vec, } -enum GearStackEndExportSeed { - NotGenerate, - GenerateValue(u32), -} - #[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] enum CallName { System(SysCallName), @@ -348,60 +341,6 @@ impl<'a> WasmGen<'a> { } } - pub fn gen_mem_export(&mut self, mut module: Module) -> (Module, WasmPageCount) { - let mut mem_section_idx = None; - for (idx, section) in module.sections().iter().enumerate() { - if let Section::Memory(_) = section { - mem_section_idx = Some(idx); - break; - } - } - mem_section_idx.map(|index| module.sections_mut().remove(index)); - - let mem_size = self.config.memory_config.initial_size; - let mem_size_upper_bound = self.config.memory_config.upper_limit; - let module = builder::from_module(module) - .import() - .module("env") - .field(MEMORY_FIELD_NAME) - .external() - .memory(mem_size, mem_size_upper_bound) - .build() - .build(); - - let gear_stack_end_seed = self - .config - .memory_config - .stack_end - .map_or(GearStackEndExportSeed::NotGenerate, |stack_end| { - GearStackEndExportSeed::GenerateValue(stack_end) - }); - if let GearStackEndExportSeed::GenerateValue(gear_stack_val) = gear_stack_end_seed { - let mut module = builder::from_module(module) - .global() - .value_type() - .i32() - .init_expr(Instruction::I32Const(gear_stack_val as i32)) - .build() - .build(); - - let last_element_num = module.global_section_mut().unwrap().entries_mut().len() - 1; - - return ( - builder::from_module(module) - .export() - .field(STACK_END_EXPORT_NAME) - .internal() - .global(last_element_num.try_into().unwrap()) - .build() - .build(), - mem_size.into(), - ); - } - - (module, mem_size.into()) - } - /// Inserts `instructions` into funcs satisfying the `insert_into_func_filter` /// predicate which takes function body index in the `module` code section. fn insert_instructions_into_functions( @@ -949,23 +888,32 @@ pub fn gen_gear_program_module<'a>( addresses: &[HashWithValue], ) -> Module { let ConfigsBundle { - gear_wasm_generator_config: generator_config, - module_selectables_config: selectables_config, + gear_wasm_generator_config, + module_selectables_config, } = config; - let swarm_config = default_swarm_config(selectables_config, u); - - let module = loop { - let module = gen_wasm_smith_module(u, swarm_config.clone()); - let wasm_bytes = module.to_bytes(); - let module: Module = parity_wasm::deserialize_buffer(&wasm_bytes).unwrap(); - if module.function_section().is_some() { - break module; - } - }; - let mut gen = WasmGen::new(&module, u, generator_config); + let (module, memory_pages) = { + // Create wasm module config. + let arbitrary_params = u.arbitrary::().unwrap(); + let wasm_module = WasmModule::generate_with_config( + (module_selectables_config, arbitrary_params).into(), + u, + ) + .unwrap(); + + // Instantiate memory generator and generate memory import + let mem_config = gear_wasm_generator_config.memory_config; + let (DisabledMemoryGenerator(wasm_module), _mem_import_gen_proof) = + MemoryGenerator::new(wasm_module, mem_config).generate_memory(); + + let memory_pages = wasm_module + .initial_mem_size() + .expect("proof of import memory generation exists") + .into(); + (wasm_module.into_inner(), memory_pages) + }; - let (module, memory_pages) = gen.gen_mem_export(module); + let mut gen = WasmGen::new(&module, u, gear_wasm_generator_config); let (module, has_init) = gen.gen_init(module); if !has_init { return gen.resolves_calls_indexes(module); diff --git a/utils/wasm-gen/src/memory.rs b/utils/wasm-gen/src/memory.rs index e3ee620f594..b5c14e464ca 100644 --- a/utils/wasm-gen/src/memory.rs +++ b/utils/wasm-gen/src/memory.rs @@ -16,11 +16,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{mem, slice}; - use super::*; -use gear_wasm_instrument::parity_wasm::builder::ModuleBuilder; +use gear_wasm_instrument::parity_wasm::{ + builder::{self, ModuleBuilder}, + elements::Instruction, +}; use gsys::HashWithValue; +use std::{mem, slice}; pub struct ModuleBuilderWithData { pub module_builder: ModuleBuilder, diff --git a/utils/wasm-gen/src/wasm.rs b/utils/wasm-gen/src/wasm.rs index 39951f02db6..e5dd420a033 100644 --- a/utils/wasm-gen/src/wasm.rs +++ b/utils/wasm-gen/src/wasm.rs @@ -16,12 +16,133 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use crate::{config::WasmModuleConfig, EntryPointName}; +use arbitrary::{Arbitrary, Result, Unstructured}; +use core::mem; +use gear_wasm_instrument::parity_wasm::{ + self, + elements::{External, Internal, Module}, +}; +use wasm_smith::Module as WasmSmithModule; + +/// Wasm module. +/// +/// Actually that's a wrapper over `parity-wasm::elements::Module`, +/// that functions as an adaptor for it by exposing a higher level API +/// of a wasm module. +pub struct WasmModule(Module); + +impl WasmModule { + /// Same as [`WasmModule::generate_with_config`], but generates an arbitrary config + /// instead of using the external one. + pub fn generate(u: &mut Unstructured<'_>) -> Result { + let config = WasmModuleConfig::arbitrary(u)?; + + Self::generate_with_config(config, u) + } + + /// Generate a random wasm module from `Unstructured`. + /// + /// Under the hood it uses the `wasm-smith` wasm generator to generate a new valid wasm + /// out of random bytes provider. + /// + /// If generated module hasn't got functions section, i.e. no internal functions were generated, + /// than this function will return an error. + pub fn generate_with_config( + config: WasmModuleConfig, + u: &mut Unstructured<'_>, + ) -> Result { + let mut pw_module = Self::generate_wasm_smith_module(config.clone(), u)?; + while pw_module.function_section().is_none() { + pw_module = Self::generate_wasm_smith_module(config.clone(), u)?; + } + + Ok(Self(pw_module)) + } + + /// Counts functions in import section. + pub fn count_import_funcs(&self) -> usize { + self.0.import_section().map_or(0, |isec| isec.functions()) + } + + /// Counts functions in function section. + pub fn count_code_funcs(&self) -> usize { + self.0 + .function_section() + .map(|fsec| fsec.entries().len()) + .expect("minimal possible is 1 by config") + } + + /// Returns an option with a value of initial memory size, + /// defined in the import section. + /// + /// This is also referred sometime as "min" memory limit. + pub fn initial_mem_size(&self) -> Option { + self.0.import_section().and_then(|import_entry| { + import_entry + .entries() + .iter() + .find_map(|entry| match entry.external() { + External::Memory(mem_ty) => Some(mem_ty.limits().initial()), + _ => None, + }) + }) + } + + /// Gets the export function index of the gear entry point. + pub fn gear_entry_point(&self, ep: EntryPointName) -> Option { + self.0.export_section().and_then(|export_section| { + for export in export_section.entries().iter() { + if export.field() == ep.to_str() { + let &Internal::Function(init_idx) = export.internal() else { + panic!("init export is not a func"); + }; + return Some(init_idx); + } + } + + None + }) + } + + /// Executes some job `f` on the underlying module. + /// + /// This method is used as a guard access to the underlying module. + /// + /// There's a contract, that the `f` must return the same module, which, + /// possibly, could have been changed, as a first element of the tuple. + /// The second element of the tuple, `T`, is the type returned to the caller. + pub fn with(&mut self, f: impl FnOnce(Module) -> (Module, T)) -> T { + let taken_module = mem::take(&mut self.0); + let (mut res_module, res) = f(taken_module); + mem::swap(&mut self.0, &mut res_module); + + res + } + + /// Unwraps the underlying wasm module. + pub fn into_inner(self) -> Module { + self.0 + } + + fn generate_wasm_smith_module( + config: WasmModuleConfig, + u: &mut Unstructured<'_>, + ) -> Result { + let wasm_smith_module = WasmSmithModule::new(config.into_inner(), u)?; + Ok( + parity_wasm::deserialize_buffer(wasm_smith_module.to_bytes().as_ref()) + .expect("internal error: wasm smith generated non-deserializable module"), + ) + } +} + /// WASM page has size of 64KiBs (65_536 bytes) -pub const PAGE_SIZE: u32 = 0x10000; +pub(crate) const PAGE_SIZE: u32 = 0x10000; /// Struct for indexing WASM memory page. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] -pub struct Page(u16); +pub(crate) struct Page(u16); impl From for Page { fn from(value: u16) -> Self { @@ -29,7 +150,7 @@ impl From for Page { } } -/// Newtype to represent WASM memory pages count. +/// New-type to represent WASM memory pages count. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub struct PageCount(u32); @@ -41,12 +162,12 @@ impl From for PageCount { impl PageCount { /// Calculate WASM memory size for this pages count. - pub fn memory_size(&self) -> u32 { + pub(crate) fn memory_size(&self) -> u32 { self.0 * PAGE_SIZE } /// Get WASM memory pages count as a number. - pub fn raw(&self) -> u32 { + pub(crate) fn raw(&self) -> u32 { self.0 } } From 84d8395bc78e4307e286c6e94d1f400f221551a1 Mon Sep 17 00:00:00 2001 From: Gregory Sobol Date: Wed, 2 Aug 2023 22:56:28 +0300 Subject: [PATCH 020/165] fix std feature in gear-wasm-instrument (#3013) --- utils/wasm-instrument/Cargo.toml | 2 +- utils/wasm-instrument/src/tests.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/wasm-instrument/Cargo.toml b/utils/wasm-instrument/Cargo.toml index 22ea87c8e90..a66f280081a 100644 --- a/utils/wasm-instrument/Cargo.toml +++ b/utils/wasm-instrument/Cargo.toml @@ -20,5 +20,5 @@ gear-core.workspace = true default = ["std"] std = [ "wasm-instrument/std", - "wasm-instrument/sign_ext", + "gear-backend-wasmi/std", ] diff --git a/utils/wasm-instrument/src/tests.rs b/utils/wasm-instrument/src/tests.rs index 6cbbcd31f03..4ed5a386d92 100644 --- a/utils/wasm-instrument/src/tests.rs +++ b/utils/wasm-instrument/src/tests.rs @@ -21,6 +21,7 @@ use crate::{ rules::CustomConstantCostRules, syscalls::{ParamType, SysCallName}, }; +use alloc::format; use elements::Instruction::*; use gas_metering::ConstantCostRules; use parity_wasm::serialize; From 1f267890b0ad3b3538ec81cdb2ea8104326e424a Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Thu, 3 Aug 2023 11:47:35 +0300 Subject: [PATCH 021/165] feat(ci): run time consuming tests using github action (#3004) --- .github/workflows/time-consuming-tests.yml | 34 ++++++++++++++++++++++ scripts/gear.sh | 4 +++ scripts/src/test.sh | 6 +++- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/time-consuming-tests.yml diff --git a/.github/workflows/time-consuming-tests.yml b/.github/workflows/time-consuming-tests.yml new file mode 100644 index 00000000000..584697b69d2 --- /dev/null +++ b/.github/workflows/time-consuming-tests.yml @@ -0,0 +1,34 @@ +name: Time consuming tests + +on: + schedule: + - cron: "0 0 * * MON" + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + TERM: xterm-256color + +jobs: + time-consuming-tests: + runs-on: [kuberunner] + env: + RUSTUP_HOME: /tmp/rustup_home + steps: + - name: "ACTIONS: Checkout" + uses: actions/checkout@v3 + + - name: "Install: Set cargo path" + run: echo "/tmp/cargo/bin" >> $GITHUB_PATH + + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: "Buid: Init" + run: ./scripts/gear.sh init cargo + + - name: "Build: Node" + run: ./scripts/gear.sh build node --release --locked + + - name: "Test: Time consuming tests" + run: ./scripts/gear.sh test time-consuming --release diff --git a/scripts/gear.sh b/scripts/gear.sh index 70321267740..2a09978c2af 100755 --- a/scripts/gear.sh +++ b/scripts/gear.sh @@ -305,6 +305,10 @@ case "$COMMAND" in header "Testing examples in docs" doc_test "$ROOT_DIR/Cargo.toml" "$@"; ;; + time-consuming) + header "Running time consuming tests" + time_consuming_tests "$@"; ;; + *) header "Unknown option: '$SUBCOMMAND'" test_usage diff --git a/scripts/src/test.sh b/scripts/src/test.sh index 3e927f40324..7118f8467c4 100755 --- a/scripts/src/test.sh +++ b/scripts/src/test.sh @@ -24,7 +24,7 @@ test_usage() { syscalls run syscalls integrity test in benchmarking module of pallet-gear docs run doc tests validators run validator checks - + time-consuming run time consuming tests EOF } @@ -100,3 +100,7 @@ doc_test() { __GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 SKIP_GEAR_RUNTIME_WASM_BUILD=1 SKIP_VARA_RUNTIME_WASM_BUILD=1 $CARGO test --doc --workspace --exclude runtime-fuzzer --exclude runtime-fuzzer-fuzz --manifest-path="$MANIFEST" --no-fail-fast "$@" } + +time_consuming_tests() { + $CARGO test -p demo-fungible-token --no-fail-fast "$@" -- --nocapture --ignored +} From 3aaaf7dbe9105b3be2173c93e6d79d8f9f333c36 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Thu, 3 Aug 2023 13:18:53 +0300 Subject: [PATCH 022/165] test(wasm-gen): Comment `test_gen_reproduction` until upcoming fix (#3016) --- utils/wasm-gen/src/tests.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index 850891f27df..8f5862463d1 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -27,7 +27,6 @@ use gear_wasm_instrument::parity_wasm::{ self, elements::{self, External}, }; -use proptest::prelude::{proptest, ProptestConfig}; use rand::{rngs::SmallRng, RngCore, SeedableRng}; #[allow(unused)] @@ -121,25 +120,26 @@ fn remove_trivial_recursions() { println!("wat = {wat}"); } -proptest! { - #![proptest_config(ProptestConfig::with_cases(100))] - #[test] - fn test_gen_reproduction(seed in 0..u64::MAX) { - let mut rng = SmallRng::seed_from_u64(seed); - let mut buf = vec![0; 100_000]; - rng.fill_bytes(&mut buf); +// TODO issue #3015 +// proptest! { +// #![proptest_config(ProptestConfig::with_cases(100))] +// #[test] +// fn test_gen_reproduction(seed in 0..u64::MAX) { +// let mut rng = SmallRng::seed_from_u64(seed); +// let mut buf = vec![0; 100_000]; +// rng.fill_bytes(&mut buf); - let mut u = Unstructured::new(&buf); - let mut u2 = Unstructured::new(&buf); +// let mut u = Unstructured::new(&buf); +// let mut u2 = Unstructured::new(&buf); - let gear_config = ConfigsBundle::default(); +// let gear_config = ConfigsBundle::default(); - let first = gen_gear_program_code(&mut u, gear_config.clone(), &[]); - let second = gen_gear_program_code(&mut u2, gear_config, &[]); +// let first = gen_gear_program_code(&mut u, gear_config.clone(), &[]); +// let second = gen_gear_program_code(&mut u2, gear_config, &[]); - assert!(first == second); - } -} +// assert!(first == second); +// } +// } #[test] fn injecting_addresses_works() { From a1d7c699404055be9175dd859b79985e3a367b81 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Thu, 3 Aug 2023 14:50:30 +0300 Subject: [PATCH 023/165] test(pallet-gear): Test pause program task removed for terminated program (#3020) --- pallets/gear/src/tests.rs | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 5c247de1674..8ed9ae258d4 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -5610,16 +5610,11 @@ fn terminated_locking_funds() { } #[test] -fn exit_init() { - use demo_constructor::{demo_exit_init, WASM_BINARY}; +fn pause_terminated_exited_program() { + use demo_constructor::{demo_exit_init, Calls, Scheme, WASM_BINARY}; - init_logger(); - new_test_ext().execute_with(|| { + let test = |program_id| { let code_id = CodeId::generate(WASM_BINARY); - - let (_init_mid, program_id) = - submit_constructor_with_args(USER_1, DEFAULT_SALT, demo_exit_init::scheme(false), 0); - let program = ProgramStorageOf::::get_program(program_id) .and_then(|p| ActiveProgram::try_from(p).ok()) .expect("program should exist"); @@ -5651,7 +5646,28 @@ fn exit_init() { ), Error::::ProgramAlreadyExists, ); - }) + }; + + new_test_ext().execute_with(|| { + // exit init + let (_, exited_pid) = + submit_constructor_with_args(USER_1, DEFAULT_SALT, demo_exit_init::scheme(false), 0); + + test(exited_pid); + }); + + new_test_ext().execute_with(|| { + // failed in init + let init = Calls::builder().panic("panicked in init"); + let (_, terminated_pid) = submit_constructor_with_args( + USER_1, + DEFAULT_SALT, + Scheme::predefined(init, Default::default(), Default::default()), + 0, + ); + + test(terminated_pid); + }); } #[test] From df6a1c134afa92e91513e4bbeafa77233ab5187b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:20:33 +0300 Subject: [PATCH 024/165] deps: combine dependabot's PRs (#3002) --- Cargo.lock | 87 ++++++++++++++++++------------------ Cargo.toml | 6 +-- utils/weight-diff/Cargo.toml | 2 +- 3 files changed, 48 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 526a71d8482..d06559d6fb8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1062,20 +1062,20 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.11" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" +checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" dependencies = [ "clap_builder", - "clap_derive 4.3.2", + "clap_derive 4.3.12", "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.11" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" +checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" dependencies = [ "anstream", "anstyle", @@ -1098,9 +1098,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck", "proc-macro2", @@ -3128,7 +3128,7 @@ dependencies = [ "Inflector", "array-bytes", "chrono", - "clap 4.3.11", + "clap 4.3.19", "comfy-table", "frame-benchmarking", "frame-support", @@ -3583,7 +3583,7 @@ version = "0.2.2" dependencies = [ "anyhow", "base64 0.21.2", - "clap 4.3.11", + "clap 4.3.19", "color-eyre", "demo-messager", "demo-new-meta", @@ -3773,7 +3773,7 @@ dependencies = [ name = "gear-bags-thresholds" version = "1.0.0" dependencies = [ - "clap 4.3.11", + "clap 4.3.19", "generate-bags", "vara-runtime", ] @@ -3797,7 +3797,7 @@ dependencies = [ name = "gear-cli" version = "0.2.2" dependencies = [ - "clap 4.3.11", + "clap 4.3.19", "frame-benchmarking", "frame-benchmarking-cli", "frame-system", @@ -3955,7 +3955,7 @@ version = "0.2.2" dependencies = [ "anyhow", "arbitrary", - "clap 4.3.11", + "clap 4.3.19", "dyn-clonable", "futures", "futures-timer", @@ -4024,7 +4024,7 @@ dependencies = [ name = "gear-replay-cli" version = "1.0.0" dependencies = [ - "clap 4.3.11", + "clap 4.3.19", "frame-remote-externalities", "frame-system", "gear-runtime", @@ -4298,7 +4298,7 @@ dependencies = [ name = "gear-validator-checks" version = "0.1.0" dependencies = [ - "clap 4.3.11", + "clap 4.3.19", "env_logger", "futures-util", "gsdk", @@ -4370,10 +4370,10 @@ dependencies = [ name = "gear-weight-diff" version = "1.0.0" dependencies = [ - "clap 4.3.11", + "clap 4.3.19", "frame-support", "gear-runtime", - "indexmap 1.9.3", + "indexmap 2.0.0", "pallet-gear", "serde", "serde_json", @@ -5104,6 +5104,7 @@ checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ "equivalent", "hashbrown 0.14.0", + "serde", ] [[package]] @@ -8041,9 +8042,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "path-clean" @@ -8920,7 +8921,7 @@ dependencies = [ name = "regression-analysis" version = "0.1.0" dependencies = [ - "clap 4.3.11", + "clap 4.3.19", "frame-support", "gear-runtime", "junit-common", @@ -9121,7 +9122,7 @@ version = "0.1.0" dependencies = [ "anyhow", "arbitrary", - "clap 4.3.11", + "clap 4.3.19", "frame-support", "frame-system", "gear-call-gen", @@ -9439,7 +9440,7 @@ source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0 dependencies = [ "array-bytes", "chrono", - "clap 4.3.11", + "clap 4.3.19", "fdlimit", "futures", "libp2p", @@ -10217,7 +10218,7 @@ name = "sc-storage-monitor" version = "0.1.0" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" dependencies = [ - "clap 4.3.11", + "clap 4.3.19", "fs4", "futures", "log", @@ -10700,9 +10701,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.171" +version = "1.0.179" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "0a5bf42b8d227d4abf38a1ddb08602e229108a517cd4e5bb28f9c7eaafdce5c0" dependencies = [ "serde_derive", ] @@ -10718,9 +10719,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.179" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "741e124f5485c7e60c03b043f79f320bff3527f4bbf12cf3831750dc46a0ec2c" dependencies = [ "proc-macro2", "quote", @@ -10729,9 +10730,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.102" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5062a995d481b2308b6064e9af76011f2921c35f97b0468811ed9f6cd91dfed" +checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" dependencies = [ "itoa", "ryu", @@ -13020,7 +13021,7 @@ version = "0.10.0-dev" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" dependencies = [ "async-trait", - "clap 4.3.11", + "clap 4.3.19", "frame-remote-externalities", "frame-try-runtime", "hex", @@ -13497,9 +13498,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.30.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2f8e9778e04cbf44f58acc301372577375a666b966c50b03ef46144f80436a8" +checksum = "41763f20eafed1399fff1afb466496d3a959f58241436cfdc17e3f5ca954de16" dependencies = [ "leb128", ] @@ -13508,7 +13509,7 @@ dependencies = [ name = "wasm-info" version = "0.1.0" dependencies = [ - "clap 4.3.11", + "clap 4.3.19", "hex", "parity-wasm 0.45.0", ] @@ -13574,7 +13575,7 @@ dependencies = [ name = "wasm-proc" version = "0.1.0" dependencies = [ - "clap 4.3.11", + "clap 4.3.19", "env_logger", "gear-wasm-builder", "log", @@ -13955,9 +13956,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.108.0" +version = "0.110.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76c956109dcb41436a39391139d9b6e2d0a5e0b158e1293ef352ec977e5e36c5" +checksum = "1dfcdb72d96f01e6c85b6bf20102e7423bdbaad5c337301bab2bbf253d26413c" dependencies = [ "indexmap 2.0.0", "semver 1.0.17", @@ -13980,12 +13981,12 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.2.60" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b76cb909fe3d9b0de58cee1f4072247e680ff5cc1558ccad2790a9de14a23993" +checksum = "42cd12ed4d96a984e4b598a17457f1126d01640cc7461afbb319642111ff9e7f" dependencies = [ "anyhow", - "wasmparser 0.108.0", + "wasmparser 0.110.0", ] [[package]] @@ -14169,21 +14170,21 @@ dependencies = [ [[package]] name = "wast" -version = "61.0.0" +version = "62.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6b347851b52fd500657d301155c79e8c67595501d179cef87b6f04ebd25ac4" +checksum = "b8ae06f09dbe377b889fbd620ff8fa21e1d49d1d9d364983c0cdbf9870cb9f1f" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.30.0", + "wasm-encoder 0.31.1", ] [[package]] name = "wat" -version = "1.0.67" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459e764d27c3ab7beba1ebd617cc025c7e76dea6e7c5ce3189989a970aea3491" +checksum = "842e15861d203fb4a96d314b0751cdeaf0f6f8b35e8d81d2953af2af5e44e637" dependencies = [ "wast", ] diff --git a/Cargo.toml b/Cargo.toml index fa84c9587a1..c25e81c4dd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -114,7 +114,7 @@ async-trait = "0.1.68" base64 = "0.21.0" blake2-rfc = { version = "0.2.18", default-features = false } bs58 = { version = "0.4.0", default-features = false } -clap = { version = "4.2.1" } +clap = { version = "4.3.19" } codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false } color-eyre = "0.6.2" colored = "2.0.0" @@ -175,7 +175,7 @@ syn = "2.0.15" thiserror = "1.0.40" tokio = { version = "1.27.0" } url = "2.3.1" -wat = "1.0.61" +wat = "1.0.69" wabt = "0.10.0" wasmi = { version = "0.14.0", default-features = false } wasmparser = { package = "wasmparser-nostd", version = "0.100.1", default-features = false } @@ -419,7 +419,7 @@ cfg-if = "1.0.0" # gear cargo_metadata = "=0.15.3" # utils/wasm-builder errno = "0.3" # gear-lazy-pages impl-trait-for-tuples = "0.2.2" # pallets/staking-rewards -indexmap = "1.9.3" # utils/weight-diff +indexmap = "2.0.0" # utils/weight-diff indicatif = "*" # utils/wasm-gen keyring = "1.2.1" # gcli libp2p = "=0.50.1" # gcli (same version as sc-consensus) diff --git a/utils/weight-diff/Cargo.toml b/utils/weight-diff/Cargo.toml index ed5f7b0d380..32dbd38e848 100644 --- a/utils/weight-diff/Cargo.toml +++ b/utils/weight-diff/Cargo.toml @@ -7,7 +7,7 @@ license.workspace = true [dependencies] clap = { workspace = true, features = ["derive"] } -indexmap.workspace = true +indexmap = { workspace = true, features = ["serde"] } serde = { workspace = true, features = ["derive"] } serde_json.workspace = true tabled.workspace = true From e643dc1476229d46c366d034ce3584a8c39e473f Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Sat, 5 Aug 2023 11:33:51 +0300 Subject: [PATCH 025/165] feat(node): don't set logger hook if custom log is present (#3032) --- node/cli/src/command.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index 6bdc060d9e3..767f5dc6046 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -352,7 +352,7 @@ pub fn run() -> sc_cli::Result<()> { Ok(()) } None => { - let runner = if cli.run.base.validator { + let runner = if cli.run.base.validator && cli.run.base.shared_params.log.is_empty() { cli.create_runner_with_logger_hook(&cli.run.base, |logger, _| { logger.with_detailed_output(false); logger.with_max_level(log::LevelFilter::Info); From a3241f7bcb9003ce99ec6585ee8695074c9e664d Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Sun, 6 Aug 2023 13:45:03 +0300 Subject: [PATCH 026/165] perf(gas)!: Merge two globals into one (#2948) --- Cargo.lock | 4 +- common/lazy-pages/src/lib.rs | 20 +- core-backend/common/src/funcs.rs | 26 +- core-backend/common/src/lazy_pages.rs | 9 + core-backend/common/src/lib.rs | 59 +- core-backend/common/src/memory.rs | 51 +- core-backend/common/src/mock.rs | 23 +- core-backend/common/src/runtime.rs | 6 +- core-backend/common/src/tests.rs | 105 +- core-backend/sandbox/src/env.rs | 25 +- core-backend/sandbox/src/runtime.rs | 49 +- core-backend/wasmi/src/env.rs | 29 +- core-backend/wasmi/src/funcs_tree.rs | 1 - core-backend/wasmi/src/runtime.rs | 71 +- core-backend/wasmi/src/state.rs | 8 +- core-processor/src/common.rs | 2 +- core-processor/src/executor.rs | 17 +- core-processor/src/ext.rs | 111 +- core/src/gas.rs | 62 +- lazy-pages/src/common.rs | 24 +- lazy-pages/src/globals.rs | 28 +- lazy-pages/src/lib.rs | 25 +- lazy-pages/src/signal.rs | 56 +- lazy-pages/src/tests.rs | 8 +- .../gear/src/benchmarking/tests/lazy_pages.rs | 4 +- .../benchmarking/tests/syscalls_integrity.rs | 2 +- pallets/gear/src/ext.rs | 18 +- pallets/gear/src/schedule.rs | 2 +- pallets/gear/src/weights.rs | 2890 ++++++++--------- runtime-interface/src/lib.rs | 16 +- runtime/gear/src/tests.rs | 2 +- runtime/gear/src/weights/frame_system.rs | 78 +- runtime/gear/src/weights/pallet_balances.rs | 58 +- runtime/gear/src/weights/pallet_gear.rs | 2890 ++++++++--------- .../gear/src/weights/pallet_gear_voucher.rs | 10 +- runtime/gear/src/weights/pallet_timestamp.rs | 18 +- runtime/gear/src/weights/pallet_utility.rs | 66 +- runtime/vara/src/tests.rs | 2 +- runtime/vara/src/weights/frame_system.rs | 78 +- runtime/vara/src/weights/pallet_balances.rs | 58 +- runtime/vara/src/weights/pallet_gear.rs | 2886 ++++++++-------- .../vara/src/weights/pallet_gear_voucher.rs | 10 +- runtime/vara/src/weights/pallet_timestamp.rs | 18 +- runtime/vara/src/weights/pallet_utility.rs | 66 +- utils/wasm-instrument/Cargo.toml | 1 + utils/wasm-instrument/src/lib.rs | 120 +- utils/wasm-instrument/src/syscalls.rs | 2 - utils/wasm-instrument/src/tests.rs | 68 +- utils/wasm-proc/src/main.rs | 3 +- 49 files changed, 5107 insertions(+), 5078 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d06559d6fb8..0223a2ecb38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8624,9 +8624,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.31" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] diff --git a/common/lazy-pages/src/lib.rs b/common/lazy-pages/src/lib.rs index a32871de3e7..3186e8bffde 100644 --- a/common/lazy-pages/src/lib.rs +++ b/common/lazy-pages/src/lib.rs @@ -36,7 +36,7 @@ use gear_core::{ pages::{GearPage, PageNumber, PageU32Size, WasmPage}, }; use gear_runtime_interface::{gear_ri, LazyPagesProgramContext, LazyPagesRuntimeContext}; -use gear_wasm_instrument::{GLOBAL_NAME_ALLOWANCE, GLOBAL_NAME_GAS}; +use gear_wasm_instrument::GLOBAL_NAME_GAS; use sp_std::{vec, vec::Vec}; fn mprotect_lazy_pages(mem: &mut impl Memory, protect: bool) { @@ -50,14 +50,9 @@ fn mprotect_lazy_pages(mem: &mut impl Memory, protect: bool) { /// Try to enable and initialize lazy pages env pub fn try_to_enable_lazy_pages(prefix: [u8; 32]) -> bool { - const GLOBAL_NAMES: &[LimitedStr<'static>] = &[ - LimitedStr::from_small_str(GLOBAL_NAME_GAS), - LimitedStr::from_small_str(GLOBAL_NAME_ALLOWANCE), - ]; - let ctx = LazyPagesRuntimeContext { page_sizes: vec![WasmPage::size(), GearPage::size()], - global_names: GLOBAL_NAMES.to_vec(), + global_names: vec![LimitedStr::from_small_str(GLOBAL_NAME_GAS)], pages_storage_prefix: prefix.to_vec(), }; @@ -164,9 +159,14 @@ pub fn get_status() -> Status { pub fn pre_process_memory_accesses( reads: &[MemoryInterval], writes: &[MemoryInterval], - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result<(), ProcessAccessError> { - let (gas_left_new, res) = gear_ri::pre_process_memory_accesses(reads, writes, (*gas_left,)); - *gas_left = gas_left_new; + let gas_left = GasLeft { + gas: *gas_counter, + allowance: *gas_counter, + }; + let (GasLeft { gas, allowance }, res) = + gear_ri::pre_process_memory_accesses(reads, writes, (gas_left,)); + *gas_counter = gas.min(allowance); res } diff --git a/core-backend/common/src/funcs.rs b/core-backend/common/src/funcs.rs index 40030fe5728..25958775ea4 100644 --- a/core-backend/common/src/funcs.rs +++ b/core-backend/common/src/funcs.rs @@ -22,7 +22,7 @@ use crate::{ memory::{MemoryAccessError, WasmMemoryRead}, runtime::{RunFallibleError, Runtime}, syscall_trace, ActorTerminationReason, BackendAllocSyscallError, BackendExternalities, - BackendSyscallError, MessageWaitedType, TerminationReason, TrapExplanation, + BackendSyscallError, MessageWaitedType, TrapExplanation, UndefinedTerminationReason, UnrecoverableExecutionError, UnrecoverableMemoryError, PTR_SPECIAL, }; use alloc::string::{String, ToString}; @@ -33,6 +33,7 @@ use gear_core::{ buffer::{RuntimeBuffer, RuntimeBufferSizeError}, costs::RuntimeCosts, env::{DropPayloadLockBound, Externalities}, + gas::CounterType, message::{HandlePacket, InitPacket, Payload, PayloadSizeError, ReplyPacket}, pages::{PageNumber, PageU32Size, WasmPage}, }; @@ -253,7 +254,9 @@ where #[host(cost = RuntimeCosts::Free)] pub fn free(ctx: &mut R, page_no: u32) -> Result { let page = WasmPage::new(page_no).map_err(|_| { - TerminationReason::Actor(ActorTerminationReason::Trap(TrapExplanation::Unknown)) + UndefinedTerminationReason::Actor(ActorTerminationReason::Trap( + TrapExplanation::Unknown, + )) })?; let res = ctx.ext_mut().free(page); @@ -646,18 +649,19 @@ where pub fn out_of_gas(ctx: &mut R) -> Result<(), R::Error> { syscall_trace!("out_of_gas"); - ctx.set_termination_reason( - ActorTerminationReason::Trap(TrapExplanation::GasLimitExceeded).into(), - ); + let ext = ctx.ext_mut(); + let current_counter = ext.current_counter_type(); + log::trace!(target: "syscalls", "[out_of_gas] Current counter in global represents {current_counter:?}"); - Err(R::unreachable_error()) - } - - pub fn out_of_allowance(ctx: &mut R) -> Result<(), R::Error> { - syscall_trace!("out_of_allowance"); + if current_counter == CounterType::GasAllowance { + // We manually decrease it to 0 because global won't be affected + // since it didn't pass comparison to argument of `gas_charge()` + ext.decrease_current_counter_to(0); + } - ctx.set_termination_reason(ActorTerminationReason::GasAllowanceExceeded.into()); + let termination_reason: ActorTerminationReason = current_counter.into(); + ctx.set_termination_reason(termination_reason.into()); Err(R::unreachable_error()) } } diff --git a/core-backend/common/src/lazy_pages.rs b/core-backend/common/src/lazy_pages.rs index 9146be2b789..b318de1d1e0 100644 --- a/core-backend/common/src/lazy_pages.rs +++ b/core-backend/common/src/lazy_pages.rs @@ -100,6 +100,8 @@ pub trait GlobalsAccessor { #[derive(Debug, Clone, Copy, Encode, Decode, PartialEq, Eq)] #[codec(crate = scale)] #[repr(i64)] +// TODO: consider removal of two exceed options in favor of one global (issue #3018). +// Will require bump of many RI func's versions. pub enum Status { /// Lazy-pages works in normal mode. Normal = 0_i64, @@ -108,3 +110,10 @@ pub enum Status { /// Skips signals processing until the end of execution, set termination reason as `gas allowance exceeded`. GasAllowanceExceeded, } + +impl Status { + /// Returns bool defining if status is `Normal`. + pub fn is_normal(&self) -> bool { + *self == Self::Normal + } +} diff --git a/core-backend/common/src/lib.rs b/core-backend/common/src/lib.rs index 8326edda995..87909095626 100644 --- a/core-backend/common/src/lib.rs +++ b/core-backend/common/src/lib.rs @@ -44,7 +44,7 @@ use core::{ }; use gear_core::{ env::Externalities, - gas::{ChargeError, CountersOwner, GasAmount, GasLeft}, + gas::{ChargeError, CounterType, CountersOwner, GasAmount}, ids::{CodeId, MessageId, ProgramId, ReservationId}, memory::{Memory, MemoryInterval, PageBuf}, message::{ @@ -70,7 +70,27 @@ pub enum TerminationReason { System(SystemTerminationReason), } -impl From for TerminationReason { +#[derive(Debug, Clone, Eq, PartialEq, derive_more::From)] +pub enum UndefinedTerminationReason { + Actor(ActorTerminationReason), + System(SystemTerminationReason), + /// Undefined reason because we need access to counters owner trait for RI. + ProcessAccessErrorResourcesExceed, +} + +impl UndefinedTerminationReason { + pub fn define(self, current_counter: CounterType) -> TerminationReason { + match self { + Self::Actor(r) => r.into(), + Self::System(r) => r.into(), + Self::ProcessAccessErrorResourcesExceed => { + ActorTerminationReason::from(current_counter).into() + } + } + } +} + +impl From for UndefinedTerminationReason { fn from(err: ChargeError) -> Self { match err { ChargeError::GasLimitExceeded => { @@ -83,13 +103,13 @@ impl From for TerminationReason { } } -impl From for TerminationReason { +impl From for UndefinedTerminationReason { fn from(trap: TrapExplanation) -> Self { ActorTerminationReason::Trap(trap).into() } } -impl From for TerminationReason { +impl From for UndefinedTerminationReason { fn from(err: E) -> Self { err.into_termination_reason() } @@ -107,6 +127,15 @@ pub enum ActorTerminationReason { Trap(TrapExplanation), } +impl From for ActorTerminationReason { + fn from(counter_type: CounterType) -> Self { + match counter_type { + CounterType::GasLimit => Self::Trap(TrapExplanation::GasLimitExceeded), + CounterType::GasAllowance => Self::GasAllowanceExceeded, + } + } +} + /// Non-actor related termination reason. /// /// ### NOTICE: @@ -285,14 +314,14 @@ pub trait BackendExternalities: Externalities + CountersOwner { fn pre_process_memory_accesses( reads: &[MemoryInterval], writes: &[MemoryInterval], - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result<(), ProcessAccessError>; } /// A trait for conversion of the externalities API error -/// to `TerminationReason` and `RunFallibleError`. +/// to `UndefinedTerminationReason` and `RunFallibleError`. pub trait BackendSyscallError: Sized { - fn into_termination_reason(self) -> TerminationReason; + fn into_termination_reason(self) -> UndefinedTerminationReason; fn into_run_fallible_error(self) -> RunFallibleError; } @@ -389,20 +418,20 @@ where pub trait BackendState { /// Set termination reason - fn set_termination_reason(&mut self, reason: TerminationReason); + fn set_termination_reason(&mut self, reason: UndefinedTerminationReason); /// Process fallible syscall function result fn process_fallible_func_result( &mut self, res: Result, - ) -> Result, TerminationReason> { + ) -> Result, UndefinedTerminationReason> { match res { Err(RunFallibleError::FallibleExt(ext_err)) => { let code = ext_err.to_u32(); log::trace!(target: "syscalls", "fallible syscall error: {ext_err}"); Ok(Err(code)) } - Err(RunFallibleError::TerminationReason(reason)) => Err(reason), + Err(RunFallibleError::UndefinedTerminationReason(reason)) => Err(reason), Ok(res) => Ok(Ok(res)), } } @@ -411,7 +440,7 @@ pub trait BackendState { fn process_alloc_func_result( &mut self, res: Result, - ) -> Result, TerminationReason> { + ) -> Result, UndefinedTerminationReason> { match res { Ok(t) => Ok(Ok(t)), Err(err) => match err.into_backend_error() { @@ -430,7 +459,7 @@ pub trait BackendState { pub trait BackendTermination: Sized { /// Transforms [`Self`] into tuple of externalities, memory and /// termination reason returned after the execution. - fn into_parts(self) -> (Ext, EnvMem, TerminationReason); + fn into_parts(self) -> (Ext, EnvMem, UndefinedTerminationReason); /// Terminates backend work after execution. /// @@ -450,14 +479,14 @@ pub trait BackendTermination: Sized { fn terminate( self, res: Result, - gas: i64, - allowance: i64, + gas: u64, ) -> (Ext, EnvMem, TerminationReason) { log::trace!("Execution result = {res:?}"); let (mut ext, memory, termination_reason) = self.into_parts(); + let termination_reason = termination_reason.define(ext.current_counter_type()); - ext.set_gas_left((gas, allowance).into()); + ext.decrease_current_counter_to(gas); let termination_reason = if res.is_err() { if matches!( diff --git a/core-backend/common/src/memory.rs b/core-backend/common/src/memory.rs index 5406361de10..5246691992e 100644 --- a/core-backend/common/src/memory.rs +++ b/core-backend/common/src/memory.rs @@ -19,8 +19,8 @@ //! Work with WASM program memory in backends. use crate::{ - runtime::RunFallibleError, ActorTerminationReason, BackendExternalities, BackendSyscallError, - TerminationReason, TrapExplanation, UnrecoverableMemoryError, + runtime::RunFallibleError, BackendExternalities, BackendSyscallError, TrapExplanation, + UndefinedTerminationReason, UnrecoverableMemoryError, }; use alloc::vec::Vec; use core::{ @@ -33,7 +33,6 @@ use core::{ }; use gear_core::{ buffer::{RuntimeBuffer, RuntimeBufferSizeError}, - gas::GasLeft, memory::{Memory, MemoryError, MemoryInterval}, }; use gear_core_errors::MemoryError as FallibleMemoryError; @@ -58,7 +57,7 @@ pub enum MemoryAccessError { } impl BackendSyscallError for MemoryAccessError { - fn into_termination_reason(self) -> TerminationReason { + fn into_termination_reason(self) -> UndefinedTerminationReason { match self { MemoryAccessError::ProcessAccess(ProcessAccessError::OutOfBounds) | MemoryAccessError::Memory(MemoryError::AccessOutOfBounds) => { @@ -73,15 +72,15 @@ impl BackendSyscallError for MemoryAccessError { ) .into() } - MemoryAccessError::ProcessAccess(ProcessAccessError::GasLimitExceeded) => { - TrapExplanation::GasLimitExceeded.into() - } - MemoryAccessError::ProcessAccess(ProcessAccessError::GasAllowanceExceeded) => { - ActorTerminationReason::GasAllowanceExceeded - } + // TODO: In facts thats legacy from lazy pages V1 implementation, + // previously it was able to figure out that gas ended up in + // pre-process charges: now we need actual counter type, so + // it will be parsed and handled further (issue #3018). + MemoryAccessError::ProcessAccess( + ProcessAccessError::GasLimitExceeded | ProcessAccessError::GasAllowanceExceeded, + ) => UndefinedTerminationReason::ProcessAccessErrorResourcesExceed, MemoryAccessError::Decode => unreachable!(), } - .into() } fn into_run_fallible_error(self) -> RunFallibleError { @@ -93,7 +92,7 @@ impl BackendSyscallError for MemoryAccessError { MemoryAccessError::RuntimeBuffer(RuntimeBufferSizeError) => { RunFallibleError::FallibleExt(FallibleMemoryError::RuntimeAllocOutOfBounds.into()) } - e => RunFallibleError::TerminationReason(e.into_termination_reason()), + e => RunFallibleError::UndefinedTerminationReason(e.into_termination_reason()), } } } @@ -233,13 +232,13 @@ impl MemoryAccessManager { /// Call pre-processing of registered memory accesses. Clear `self.reads` and `self.writes`. pub(crate) fn pre_process_memory_accesses( &mut self, - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result<(), MemoryAccessError> { if self.reads.is_empty() && self.writes.is_empty() { return Ok(()); } - let res = Ext::pre_process_memory_accesses(&self.reads, &self.writes, gas_left); + let res = Ext::pre_process_memory_accesses(&self.reads, &self.writes, gas_counter); self.reads.clear(); self.writes.clear(); @@ -253,9 +252,9 @@ impl MemoryAccessManager { memory: &M, ptr: u32, buff: &mut [u8], - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result<(), MemoryAccessError> { - self.pre_process_memory_accesses(gas_left)?; + self.pre_process_memory_accesses(gas_counter)?; memory.read(ptr, buff).map_err(Into::into) } @@ -264,13 +263,13 @@ impl MemoryAccessManager { &mut self, memory: &M, read: WasmMemoryRead, - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result, MemoryAccessError> { let buff = if read.size == 0 { Vec::new() } else { let mut buff = RuntimeBuffer::try_new_default(read.size as usize)?.into_vec(); - self.read_into_buf(memory, read.ptr, &mut buff, gas_left)?; + self.read_into_buf(memory, read.ptr, &mut buff, gas_counter)?; buff }; Ok(buff) @@ -281,14 +280,14 @@ impl MemoryAccessManager { &mut self, memory: &M, read: WasmMemoryReadDecoded, - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result { let size = T::max_encoded_len(); let buff = if size == 0 { Vec::new() } else { let mut buff = RuntimeBuffer::try_new_default(size)?.into_vec(); - self.read_into_buf(memory, read.ptr, &mut buff, gas_left)?; + self.read_into_buf(memory, read.ptr, &mut buff, gas_counter)?; buff }; let decoded = T::decode_all(&mut &buff[..]).map_err(|_| MemoryAccessError::Decode)?; @@ -300,9 +299,9 @@ impl MemoryAccessManager { &mut self, memory: &M, read: WasmMemoryReadAs, - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result { - self.pre_process_memory_accesses(gas_left)?; + self.pre_process_memory_accesses(gas_counter)?; read_memory_as(memory, read.ptr).map_err(Into::into) } @@ -312,7 +311,7 @@ impl MemoryAccessManager { memory: &mut M, write: WasmMemoryWrite, buff: &[u8], - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result<(), MemoryAccessError> { if buff.len() != write.size as usize { unreachable!("Backend bug error: buffer size is not equal to registered buffer size"); @@ -320,7 +319,7 @@ impl MemoryAccessManager { if write.size == 0 { Ok(()) } else { - self.pre_process_memory_accesses(gas_left)?; + self.pre_process_memory_accesses(gas_counter)?; memory.write(write.ptr, buff).map_err(Into::into) } } @@ -331,9 +330,9 @@ impl MemoryAccessManager { memory: &mut M, write: WasmMemoryWriteAs, obj: T, - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result<(), MemoryAccessError> { - self.pre_process_memory_accesses(gas_left)?; + self.pre_process_memory_accesses(gas_counter)?; write_memory_as(memory, write.ptr, obj).map_err(Into::into) } } diff --git a/core-backend/common/src/mock.rs b/core-backend/common/src/mock.rs index e3dd9337c21..9efb5f4dc21 100644 --- a/core-backend/common/src/mock.rs +++ b/core-backend/common/src/mock.rs @@ -19,14 +19,14 @@ use crate::{ memory::ProcessAccessError, runtime::RunFallibleError, BackendAllocSyscallError, BackendExternalities, BackendSyscallError, ExtInfo, SystemReservationContext, - TerminationReason, + UndefinedTerminationReason, }; use alloc::{collections::BTreeSet, vec, vec::Vec}; use core::{cell::Cell, fmt, fmt::Debug}; use gear_core::{ costs::RuntimeCosts, env::{Externalities, PayloadSliceLock, UnlockPayloadBound}, - gas::{ChargeError, CountersOwner, GasAmount, GasCounter, GasLeft}, + gas::{ChargeError, CounterType, CountersOwner, GasAmount, GasCounter, GasLeft}, ids::{MessageId, ProgramId, ReservationId}, memory::{Memory, MemoryError, MemoryInterval}, message::{HandlePacket, IncomingDispatch, InitPacket, ReplyPacket}, @@ -49,7 +49,7 @@ impl fmt::Display for Error { } impl BackendSyscallError for Error { - fn into_termination_reason(self) -> TerminationReason { + fn into_termination_reason(self) -> UndefinedTerminationReason { unimplemented!() } @@ -84,13 +84,18 @@ impl CountersOwner for MockExt { } fn gas_left(&self) -> GasLeft { - GasLeft { - gas: 0, - allowance: 0, - } + (0u64, 0u64).into() + } + + fn current_counter_type(&self) -> CounterType { + CounterType::GasLimit } - fn set_gas_left(&mut self, _gas_left: GasLeft) {} + fn decrease_current_counter_to(&mut self, _amount: u64) {} + + fn define_current_counter(&mut self) -> u64 { + 0 + } } impl Externalities for MockExt { @@ -299,7 +304,7 @@ impl BackendExternalities for MockExt { fn pre_process_memory_accesses( _reads: &[MemoryInterval], _writes: &[MemoryInterval], - _gas_left: &mut GasLeft, + _gas_counter: &mut u64, ) -> Result<(), ProcessAccessError> { Ok(()) } diff --git a/core-backend/common/src/runtime.rs b/core-backend/common/src/runtime.rs index 0a6ab0e33d7..64f59471aa4 100644 --- a/core-backend/common/src/runtime.rs +++ b/core-backend/common/src/runtime.rs @@ -20,7 +20,7 @@ use crate::{ memory::{MemoryAccessRecorder, MemoryOwner}, - BackendExternalities, BackendState, BackendSyscallError, TerminationReason, + BackendExternalities, BackendState, BackendSyscallError, UndefinedTerminationReason, }; use gear_core::{costs::RuntimeCosts, pages::WasmPage}; use gear_core_errors::ExtError as FallibleExtError; @@ -28,7 +28,7 @@ use gear_core_errors::ExtError as FallibleExtError; /// Error returned from closure argument in [`Runtime::run_fallible`]. #[derive(Debug, Clone)] pub enum RunFallibleError { - TerminationReason(TerminationReason), + UndefinedTerminationReason(UndefinedTerminationReason), FallibleExt(FallibleExtError), } @@ -52,7 +52,7 @@ pub trait Runtime: fn run_any(&mut self, cost: RuntimeCosts, f: F) -> Result where - F: FnOnce(&mut Self) -> Result; + F: FnOnce(&mut Self) -> Result; fn run_fallible( &mut self, diff --git a/core-backend/common/src/tests.rs b/core-backend/common/src/tests.rs index 3bb0fb17cd6..b067de28eb0 100644 --- a/core-backend/common/src/tests.rs +++ b/core-backend/common/src/tests.rs @@ -5,34 +5,31 @@ use crate::{ }; use core::{fmt::Debug, marker::PhantomData}; -use gear_core::{gas::GasLeft, memory::Memory, pages::WASM_PAGE_SIZE}; +use gear_core::{memory::Memory, pages::WASM_PAGE_SIZE}; use scale_info::scale::{self, Decode, Encode, MaxEncodedLen}; -const GAS_LEFT: GasLeft = GasLeft { - gas: core::u64::MAX, - allowance: core::u64::MAX, -}; +const GAS_COUNTER: u64 = u64::MAX; #[derive(Encode, Decode, MaxEncodedLen)] struct ZeroSizeStruct; #[test] fn test_pre_process_memory_accesses_with_no_accesses() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); - let result = memory_access_manager.pre_process_memory_accesses(&mut gas_left); + let result = memory_access_manager.pre_process_memory_accesses(&mut gas_counter); assert!(result.is_ok()); } #[test] fn test_pre_process_memory_accesses_with_only_reads() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_read(0, 10); - let result = memory_access_manager.pre_process_memory_accesses(&mut gas_left); + let result = memory_access_manager.pre_process_memory_accesses(&mut gas_counter); assert!(result.is_ok()); assert!(memory_access_manager.reads.is_empty()); @@ -40,11 +37,11 @@ fn test_pre_process_memory_accesses_with_only_reads() { #[test] fn test_pre_process_memory_accesses_with_only_writes() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_write(0, 10); - let result = memory_access_manager.pre_process_memory_accesses(&mut gas_left); + let result = memory_access_manager.pre_process_memory_accesses(&mut gas_counter); assert!(result.is_ok()); assert!(memory_access_manager.writes.is_empty()); @@ -52,12 +49,12 @@ fn test_pre_process_memory_accesses_with_only_writes() { #[test] fn test_pre_process_memory_accesses_with_reads_and_writes() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_read(0, 10); memory_access_manager.register_write(10, 20); - let result = memory_access_manager.pre_process_memory_accesses(&mut gas_left); + let result = memory_access_manager.pre_process_memory_accesses(&mut gas_counter); assert!(result.is_ok()); assert!(memory_access_manager.reads.is_empty()); @@ -66,12 +63,12 @@ fn test_pre_process_memory_accesses_with_reads_and_writes() { #[test] fn test_read_of_zero_size_buf() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); let memory = MockMemory::new(0); let read = memory_access_manager.register_read(0, 0); - let result = memory_access_manager.read(&memory, read, &mut gas_left); + let result = memory_access_manager.read(&memory, read, &mut gas_counter); assert!(result.is_ok()); assert_eq!(memory.read_attempt_count(), 0); @@ -79,12 +76,12 @@ fn test_read_of_zero_size_buf() { #[test] fn test_read_of_zero_size_struct() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); let memory = MockMemory::new(0); let read = memory_access_manager.register_read_as::(0); - let result = memory_access_manager.read_as(&memory, read, &mut gas_left); + let result = memory_access_manager.read_as(&memory, read, &mut gas_counter); assert!(result.is_ok()); assert_eq!(memory.read_attempt_count(), 0); @@ -92,12 +89,12 @@ fn test_read_of_zero_size_struct() { #[test] fn test_read_of_zero_size_encoded_value() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); let memory = MockMemory::new(0); let read = memory_access_manager.register_read_decoded::(0); - let result = memory_access_manager.read_decoded(&memory, read, &mut gas_left); + let result = memory_access_manager.read_decoded(&memory, read, &mut gas_counter); assert!(result.is_ok()); assert_eq!(memory.read_attempt_count(), 0); @@ -105,12 +102,12 @@ fn test_read_of_zero_size_encoded_value() { #[test] fn test_read_of_some_size_buf() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); let memory = MockMemory::new(1); let read = memory_access_manager.register_read(0, 10); - let result = memory_access_manager.read(&memory, read, &mut gas_left); + let result = memory_access_manager.read(&memory, read, &mut gas_counter); assert!(result.is_ok()); assert_eq!(memory.read_attempt_count(), 1); @@ -118,15 +115,18 @@ fn test_read_of_some_size_buf() { #[test] fn test_read_with_valid_memory_access() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_read(0, 10); let memory = &mut MockMemory::new(1); memory.write(0, &[5u8; 10]).unwrap(); - let result = - memory_access_manager.read(memory, WasmMemoryRead { ptr: 0, size: 10 }, &mut gas_left); + let result = memory_access_manager.read( + memory, + WasmMemoryRead { ptr: 0, size: 10 }, + &mut gas_counter, + ); assert!(result.is_ok()); assert_eq!(result.unwrap(), &[5u8; 10]); @@ -134,13 +134,13 @@ fn test_read_with_valid_memory_access() { #[test] fn test_read_with_empty_memory_access() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); let result = memory_access_manager.read( &MockMemory::new(10), WasmMemoryRead { ptr: 0, size: 0 }, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_ok()); @@ -155,7 +155,7 @@ fn test_read_decoded_with_valid_encoded_data() { data: u64, } - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_read_decoded::(0); @@ -169,7 +169,7 @@ fn test_read_decoded_with_valid_encoded_data() { ptr: 0, _phantom: PhantomData, }, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_ok()); @@ -197,7 +197,7 @@ fn test_read_decoded_with_invalid_encoded_data() { } } - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_read_decoded::(0); @@ -211,7 +211,7 @@ fn test_read_decoded_with_invalid_encoded_data() { ptr: 0, _phantom: PhantomData, }, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_err()); @@ -219,7 +219,7 @@ fn test_read_decoded_with_invalid_encoded_data() { #[test] fn test_read_decoded_reading_error() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_read_decoded::(0); @@ -229,7 +229,7 @@ fn test_read_decoded_reading_error() { ptr: u32::MAX, _phantom: PhantomData, }, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_err()); @@ -237,7 +237,7 @@ fn test_read_decoded_reading_error() { #[test] fn test_read_as_with_valid_data() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_read_as::(0); @@ -251,7 +251,7 @@ fn test_read_as_with_valid_data() { ptr: 0, _phantom: PhantomData, }, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_ok()); @@ -260,7 +260,7 @@ fn test_read_as_with_valid_data() { #[test] fn test_read_as_with_invalid_pointer() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let memory = &mut MockMemory::new(1); let mut memory_access_manager = MemoryAccessManager::::default(); @@ -272,7 +272,7 @@ fn test_read_as_with_invalid_pointer() { ptr: u32::MAX, _phantom: PhantomData, }, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_err()); @@ -280,12 +280,12 @@ fn test_read_as_with_invalid_pointer() { #[test] fn test_write_of_zero_size_buf() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); let mut memory = MockMemory::new(0); let write = memory_access_manager.register_write(0, 0); - let result = memory_access_manager.write(&mut memory, write, &[], &mut gas_left); + let result = memory_access_manager.write(&mut memory, write, &[], &mut gas_counter); assert!(result.is_ok()); assert_eq!(memory.write_attempt_count(), 0); @@ -293,12 +293,13 @@ fn test_write_of_zero_size_buf() { #[test] fn test_write_of_zero_size_struct() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); let mut memory = MockMemory::new(0); let write = memory_access_manager.register_write_as::(0); - let result = memory_access_manager.write_as(&mut memory, write, ZeroSizeStruct, &mut gas_left); + let result = + memory_access_manager.write_as(&mut memory, write, ZeroSizeStruct, &mut gas_counter); assert!(result.is_ok()); assert_eq!(memory.write_attempt_count(), 0); @@ -307,7 +308,7 @@ fn test_write_of_zero_size_struct() { #[test] #[should_panic(expected = "buffer size is not equal to registered buffer size")] fn test_write_with_zero_buffer_size() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_write(0, 10); @@ -315,13 +316,13 @@ fn test_write_with_zero_buffer_size() { &mut MockMemory::new(1), WasmMemoryWrite { ptr: 0, size: 10 }, &[], - &mut gas_left, + &mut gas_counter, ); } #[test] fn test_write_of_some_size_buf() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); let mut memory = MockMemory::new(1); memory_access_manager.register_write(0, 10); @@ -331,7 +332,7 @@ fn test_write_of_some_size_buf() { &mut memory, WasmMemoryWrite { ptr: 0, size: 10 }, &buffer, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_ok()); @@ -343,7 +344,7 @@ fn test_write_with_larger_buffer_size() { extern crate std; let result = std::panic::catch_unwind(|| { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_write(0, 10); let buffer = [0u8; 20]; @@ -352,7 +353,7 @@ fn test_write_with_larger_buffer_size() { &mut MockMemory::new(1), WasmMemoryWrite { ptr: 0, size: 10 }, &buffer, - &mut gas_left, + &mut gas_counter, ) }); @@ -361,7 +362,7 @@ fn test_write_with_larger_buffer_size() { #[test] fn test_write_as_with_zero_size_object() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_write_as::(0); @@ -372,7 +373,7 @@ fn test_write_as_with_zero_size_object() { _phantom: PhantomData, }, 0, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_ok()); @@ -380,7 +381,7 @@ fn test_write_as_with_zero_size_object() { #[test] fn test_write_as_with_same_object_size() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_write_as::(0); @@ -391,7 +392,7 @@ fn test_write_as_with_same_object_size() { _phantom: PhantomData, }, 1u8, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_ok()); @@ -399,7 +400,7 @@ fn test_write_as_with_same_object_size() { #[test] fn test_write_as_with_larger_object_size() { - let mut gas_left = GAS_LEFT; + let mut gas_counter = GAS_COUNTER; let mut memory_access_manager = MemoryAccessManager::::default(); memory_access_manager.register_write_as::(0); @@ -410,7 +411,7 @@ fn test_write_as_with_larger_object_size() { _phantom: PhantomData, }, 7u8, - &mut gas_left, + &mut gas_counter, ); assert!(result.is_err()); diff --git a/core-backend/sandbox/src/env.rs b/core-backend/sandbox/src/env.rs index f724cea41bb..42375e9f5f8 100644 --- a/core-backend/sandbox/src/env.rs +++ b/core-backend/sandbox/src/env.rs @@ -33,7 +33,6 @@ use gear_backend_common::{ EnvironmentExecutionResult, }; use gear_core::{ - gas::GasLeft, message::{DispatchKind, WasmEntryPoint}, pages::{PageNumber, WasmPage}, }; @@ -44,7 +43,7 @@ use gear_sandbox::{ }; use gear_wasm_instrument::{ syscalls::SysCallName::{self, *}, - GLOBAL_NAME_ALLOWANCE, GLOBAL_NAME_GAS, STACK_END_EXPORT_NAME, + GLOBAL_NAME_GAS, STACK_END_EXPORT_NAME, }; #[derive(Clone, Copy)] @@ -138,8 +137,6 @@ pub enum SandboxEnvironmentError { GlobalsNotSupported, #[display(fmt = "Gas counter not found or has wrong type")] WrongInjectedGas, - #[display(fmt = "Allowance counter not found or has wrong type")] - WrongInjectedAllowance, } /// Environment to run one module at a time providing Ext. @@ -259,7 +256,6 @@ where builder.add_func(ReservationSend, wrap_common_func!(FuncsHandler::reservation_send, (5) -> ())); builder.add_func(ReservationSendCommit, wrap_common_func!(FuncsHandler::reservation_send_commit, (4) -> ())); builder.add_func(OutOfGas, wrap_common_func!(FuncsHandler::out_of_gas, () -> ())); - builder.add_func(OutOfAllowance, wrap_common_func!(FuncsHandler::out_of_allowance, () -> ())); builder.add_func(Alloc, wrap_common_func!(FuncsHandler::alloc, (1) -> (1))); builder.add_func(Free, wrap_common_func!(FuncsHandler::free, (1) -> (1))); @@ -375,18 +371,14 @@ where .instance_globals() .ok_or(System(GlobalsNotSupported))?; - let GasLeft { gas, allowance } = runtime.ext.gas_left(); + let gas = runtime.ext.define_current_counter(); + // Setting initial value of global. runtime .globals .set_global_val(GLOBAL_NAME_GAS, Value::I64(gas as i64)) .map_err(|_| System(WrongInjectedGas))?; - runtime - .globals - .set_global_val(GLOBAL_NAME_ALLOWANCE, Value::I64(allowance as i64)) - .map_err(|_| System(WrongInjectedAllowance))?; - let globals_config = if cfg!(not(feature = "std")) { GlobalsAccessConfig { access_ptr: instance.get_instance_ptr(), @@ -412,19 +404,14 @@ where .then(|| instance.invoke(entry_point.as_entry(), &[], &mut runtime)) .unwrap_or(Ok(ReturnValue::Unit)); + // Fetching global value. let gas = runtime .globals .get_global_val(GLOBAL_NAME_GAS) - .and_then(runtime::as_i64) + .and_then(runtime::as_u64) .ok_or(System(WrongInjectedGas))?; - let allowance = runtime - .globals - .get_global_val(GLOBAL_NAME_ALLOWANCE) - .and_then(runtime::as_i64) - .ok_or(System(WrongInjectedAllowance))?; - - let (ext, memory_wrap, termination_reason) = runtime.terminate(res, gas, allowance); + let (ext, memory_wrap, termination_reason) = runtime.terminate(res, gas); Ok(BackendReport { termination_reason, diff --git a/core-backend/sandbox/src/runtime.rs b/core-backend/sandbox/src/runtime.rs index 73f963ef5f6..62d5bbcf91f 100644 --- a/core-backend/sandbox/src/runtime.rs +++ b/core-backend/sandbox/src/runtime.rs @@ -27,11 +27,11 @@ use gear_backend_common::{ WasmMemoryReadAs, WasmMemoryReadDecoded, WasmMemoryWrite, WasmMemoryWriteAs, }, runtime::{RunFallibleError, Runtime as CommonRuntime}, - BackendExternalities, BackendState, BackendTermination, TerminationReason, + BackendExternalities, BackendState, BackendTermination, UndefinedTerminationReason, }; -use gear_core::{costs::RuntimeCosts, gas::GasLeft, pages::WasmPage}; +use gear_core::{costs::RuntimeCosts, pages::WasmPage}; use gear_sandbox::{HostError, InstanceGlobals, Value}; -use gear_wasm_instrument::{GLOBAL_NAME_ALLOWANCE, GLOBAL_NAME_GAS}; +use gear_wasm_instrument::GLOBAL_NAME_GAS; pub(crate) fn as_i64(v: Value) -> Option { match v { @@ -40,10 +40,14 @@ pub(crate) fn as_i64(v: Value) -> Option { } } +pub(crate) fn as_u64(v: Value) -> Option { + as_i64(v).map(|v| v as u64) +} + pub(crate) struct Runtime { pub ext: Ext, pub memory: MemoryWrap, - pub termination_reason: TerminationReason, + pub termination_reason: UndefinedTerminationReason, pub globals: gear_sandbox::default_executor::InstanceGlobals, // TODO: make wrapper around runtime and move memory_manager there (issue #2067) pub memory_manager: MemoryAccessManager, @@ -62,7 +66,7 @@ impl CommonRuntime for Runtime { fn run_any(&mut self, cost: RuntimeCosts, f: F) -> Result where - F: FnOnce(&mut Self) -> Result, + F: FnOnce(&mut Self) -> Result, { self.with_globals_update(|ctx| { ctx.prepare_run(); @@ -106,38 +110,26 @@ impl Runtime { let gas = self .globals .get_global_val(GLOBAL_NAME_GAS) - .and_then(as_i64) - .unwrap_or_else(|| unreachable!("Globals must be checked during env creation")); - - let allowance = self - .globals - .get_global_val(GLOBAL_NAME_ALLOWANCE) - .and_then(as_i64) + .and_then(as_u64) .unwrap_or_else(|| unreachable!("Globals must be checked during env creation")); - self.ext.set_gas_left((gas, allowance).into()); + self.ext.decrease_current_counter_to(gas); } // Updates globals after execution. fn update_globals(&mut self) { - let GasLeft { gas, allowance } = self.ext.gas_left(); + let gas = self.ext.define_current_counter(); self.globals .set_global_val(GLOBAL_NAME_GAS, Value::I64(gas as i64)) .unwrap_or_else(|e| { unreachable!("Globals must be checked during env creation: {:?}", e) }); - - self.globals - .set_global_val(GLOBAL_NAME_ALLOWANCE, Value::I64(allowance as i64)) - .unwrap_or_else(|e| { - unreachable!("Globals must be checked during env creation: {:?}", e) - }); } fn with_globals_update(&mut self, f: F) -> Result where - F: FnOnce(&mut Self) -> Result, + F: FnOnce(&mut Self) -> Result, { let result = f(self).map_err(|err| { self.set_termination_reason(err); @@ -154,12 +146,15 @@ impl Runtime { F: FnOnce( &mut MemoryAccessManager, &mut MemoryWrap, - &mut GasLeft, + &mut u64, ) -> Result, { - let mut gas_left = self.ext.gas_left(); - let res = f(&mut self.memory_manager, &mut self.memory, &mut gas_left); - self.ext.set_gas_left(gas_left); + let mut gas_counter = self.ext.define_current_counter(); + + // With memory ops do similar subtractions for both counters. + let res = f(&mut self.memory_manager, &mut self.memory, &mut gas_counter); + + self.ext.decrease_current_counter_to(gas_counter); res } } @@ -225,13 +220,13 @@ impl MemoryOwner for Runtime { } impl BackendState for Runtime { - fn set_termination_reason(&mut self, reason: TerminationReason) { + fn set_termination_reason(&mut self, reason: UndefinedTerminationReason) { self.termination_reason = reason; } } impl BackendTermination for Runtime { - fn into_parts(self) -> (Ext, MemoryWrap, TerminationReason) { + fn into_parts(self) -> (Ext, MemoryWrap, UndefinedTerminationReason) { let Self { ext, memory, diff --git a/core-backend/wasmi/src/env.rs b/core-backend/wasmi/src/env.rs index 034181b277d..44bc50edb78 100644 --- a/core-backend/wasmi/src/env.rs +++ b/core-backend/wasmi/src/env.rs @@ -34,12 +34,11 @@ use gear_backend_common::{ }; use gear_core::{ env::Externalities, - gas::GasLeft, memory::HostPointer, message::{DispatchKind, WasmEntryPoint}, pages::{PageNumber, WasmPage}, }; -use gear_wasm_instrument::{GLOBAL_NAME_ALLOWANCE, GLOBAL_NAME_GAS, STACK_END_EXPORT_NAME}; +use gear_wasm_instrument::{GLOBAL_NAME_GAS, STACK_END_EXPORT_NAME}; use wasmi::{ core::Value, Engine, Extern, Global, Instance, Linker, Memory, MemoryType, Module, Store, }; @@ -54,8 +53,6 @@ pub enum WasmiEnvironmentError { Linking(wasmi::errors::LinkerError), #[display(fmt = "Gas counter not found or has wrong type")] WrongInjectedGas, - #[display(fmt = "Allowance counter not found or has wrong type")] - WrongInjectedAllowance, } macro_rules! gas_amount { @@ -233,12 +230,12 @@ where .and_then(Extern::into_global) .and_then(|g| g.get(&store).try_into::()); - let GasLeft { gas, allowance } = store - .state() - .as_ref() + let gas = store + .state_mut() + .as_mut() .unwrap_or_else(|| unreachable!("State must be set in `WasmiEnvironment::new`")) .ext - .gas_left(); + .define_current_counter(); let gear_gas = instance .get_export(&store, GLOBAL_NAME_GAS) @@ -246,16 +243,6 @@ where .and_then(|g| g.set(&mut store, Value::I64(gas as i64)).map(|_| g).ok()) .ok_or(System(WrongInjectedGas))?; - let gear_allowance = instance - .get_export(&store, GLOBAL_NAME_ALLOWANCE) - .and_then(Extern::into_global) - .and_then(|g| { - g.set(&mut store, Value::I64(allowance as i64)) - .map(|_| g) - .ok() - }) - .ok_or(System(WrongInjectedAllowance))?; - let mut globals_provider = GlobalsAccessProvider { instance, store: None, @@ -328,17 +315,13 @@ where .get(&store) .try_into::() .ok_or(System(WrongInjectedGas))?; - let allowance = gear_allowance - .get(&store) - .try_into::() - .ok_or(System(WrongInjectedAllowance))?; let state = store .state_mut() .take() .unwrap_or_else(|| unreachable!("State must be set in `WasmiEnvironment::new`; qed")); - let (ext, _, termination_reason) = state.terminate(res, gas, allowance); + let (ext, _, termination_reason) = state.terminate(res, gas as u64); Ok(BackendReport { termination_reason, diff --git a/core-backend/wasmi/src/funcs_tree.rs b/core-backend/wasmi/src/funcs_tree.rs index bb3f020afc7..ac0d6d2e9f9 100644 --- a/core-backend/wasmi/src/funcs_tree.rs +++ b/core-backend/wasmi/src/funcs_tree.rs @@ -158,7 +158,6 @@ where f.build(ReplyDeposit, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_deposit, (3) -> ())(store, forbidden, memory)), f.build(UnreserveGas, |forbidden| wrap_common_func!(CommonFuncsHandler::unreserve_gas, (2) -> ())(store, forbidden, memory)), f.build(OutOfGas, |_| wrap_common_func!(CommonFuncsHandler::out_of_gas, () -> ())(store, false, memory)), - f.build(OutOfAllowance, |_| wrap_common_func!(CommonFuncsHandler::out_of_allowance, () -> ())(store, false, memory)), f.build(SystemReserveGas, |forbidden| wrap_common_func!(CommonFuncsHandler::system_reserve_gas, (2) -> ())(store, forbidden, memory)), ] .into(); diff --git a/core-backend/wasmi/src/runtime.rs b/core-backend/wasmi/src/runtime.rs index e76a8c896d2..2c702561542 100644 --- a/core-backend/wasmi/src/runtime.rs +++ b/core-backend/wasmi/src/runtime.rs @@ -27,10 +27,11 @@ use gear_backend_common::{ WasmMemoryReadAs, WasmMemoryReadDecoded, WasmMemoryWrite, WasmMemoryWriteAs, }, runtime::{RunFallibleError, Runtime}, - ActorTerminationReason, BackendExternalities, BackendState, TerminationReason, TrapExplanation, + ActorTerminationReason, BackendExternalities, BackendState, TrapExplanation, + UndefinedTerminationReason, }; -use gear_core::{costs::RuntimeCosts, gas::GasLeft, pages::WasmPage}; -use gear_wasm_instrument::{GLOBAL_NAME_ALLOWANCE, GLOBAL_NAME_GAS}; +use gear_core::{costs::RuntimeCosts, pages::WasmPage}; +use gear_wasm_instrument::GLOBAL_NAME_GAS; use wasmi::{ core::{Trap, TrapCode, Value}, AsContextMut, Caller, Memory as WasmiMemory, @@ -81,7 +82,7 @@ impl<'a, Ext: BackendExternalities + 'static> Runtime for CallerWrap<'a, Ex #[track_caller] fn run_any(&mut self, cost: RuntimeCosts, f: F) -> Result where - F: FnOnce(&mut Self) -> Result, + F: FnOnce(&mut Self) -> Result, { self.with_globals_update(|ctx| { ctx.host_state_mut().ext.charge_gas_runtime(cost)?; @@ -100,15 +101,18 @@ impl<'a, Ext: BackendExternalities + 'static> Runtime for CallerWrap<'a, Ex F: FnOnce(&mut Self) -> Result, R: From> + Sized, { - self.run_any(cost, |ctx: &mut Self| -> Result<_, TerminationReason> { - let res = f(ctx); - let res = ctx.host_state_mut().process_fallible_func_result(res)?; - - // TODO: move above or make normal process memory access. - let write_res = ctx.register_write_as::(res_ptr); - - ctx.write_as(write_res, R::from(res)).map_err(Into::into) - }) + self.run_any( + cost, + |ctx: &mut Self| -> Result<_, UndefinedTerminationReason> { + let res = f(ctx); + let res = ctx.host_state_mut().process_fallible_func_result(res)?; + + // TODO: move above or make normal process memory access. + let write_res = ctx.register_write_as::(res_ptr); + + ctx.write_as(write_res, R::from(res)).map_err(Into::into) + }, + ) } fn alloc(&mut self, pages: u32) -> Result::AllocError> { @@ -143,21 +147,17 @@ impl<'a, Ext: BackendExternalities + 'static> CallerWrap<'a, Ext> { let f = || { let gas_global = wrapper.caller.get_export(GLOBAL_NAME_GAS)?.into_global()?; - let gas = gas_global.get(&wrapper.caller).try_into::()?; - let allowance_global = wrapper - .caller - .get_export(GLOBAL_NAME_ALLOWANCE)? - .into_global()?; - let allowance = allowance_global.get(&wrapper.caller).try_into::()?; - - Some((gas, allowance).into()) + Some(gas_global.get(&wrapper.caller).try_into::()? as u64) }; let gas_left = f().unwrap_or_else(|| unreachable!("Globals must be checked during env creation")); - wrapper.host_state_mut().ext.set_gas_left(gas_left); + wrapper + .host_state_mut() + .ext + .decrease_current_counter_to(gas_left); Ok(wrapper) } @@ -179,22 +179,13 @@ impl<'a, Ext: BackendExternalities + 'static> CallerWrap<'a, Ext> { } fn update_globals(&mut self) { - let GasLeft { gas, allowance } = self.host_state_mut().ext.gas_left(); + let gas = self.host_state_mut().ext.define_current_counter(); let mut f = || { let gas_global = self.caller.get_export(GLOBAL_NAME_GAS)?.into_global()?; gas_global .set(&mut self.caller, Value::I64(gas as i64)) .ok()?; - - let allowance_global = self - .caller - .get_export(GLOBAL_NAME_ALLOWANCE)? - .into_global()?; - allowance_global - .set(&mut self.caller, Value::I64(allowance as i64)) - .ok()?; - Some(()) }; @@ -206,23 +197,25 @@ impl<'a, Ext: BackendExternalities + 'static> CallerWrap<'a, Ext> { F: FnOnce( &mut MemoryAccessManager, &mut MemoryWrapRef, - &mut GasLeft, + &mut u64, ) -> Result, { - let mut gas_left = self.host_state_mut().ext.gas_left(); + let mut gas_counter = self.host_state_mut().ext.define_current_counter(); let mut memory = Self::memory(&mut self.caller, self.memory); - let res = f(&mut self.manager, &mut memory, &mut gas_left); - - self.host_state_mut().ext.set_gas_left(gas_left); + // With memory ops do similar subtractions for both counters. + let res = f(&mut self.manager, &mut memory, &mut gas_counter); + self.host_state_mut() + .ext + .decrease_current_counter_to(gas_counter); res } fn with_globals_update(&mut self, f: F) -> Result where - F: FnOnce(&mut Self) -> Result, + F: FnOnce(&mut Self) -> Result, { let result = f(self).map_err(|err| { self.host_state_mut().set_termination_reason(err); @@ -261,7 +254,7 @@ impl<'a, Ext> MemoryAccessRecorder for CallerWrap<'a, Ext> { } impl BackendState for CallerWrap<'_, Ext> { - fn set_termination_reason(&mut self, reason: TerminationReason) { + fn set_termination_reason(&mut self, reason: UndefinedTerminationReason) { caller_host_state_mut(&mut self.caller).set_termination_reason(reason); } } diff --git a/core-backend/wasmi/src/state.rs b/core-backend/wasmi/src/state.rs index 009e54a1755..0a307a284f1 100644 --- a/core-backend/wasmi/src/state.rs +++ b/core-backend/wasmi/src/state.rs @@ -17,7 +17,7 @@ // along with this program. If not, see . use gear_backend_common::{ - BackendExternalities, BackendState, BackendTermination, TerminationReason, + BackendExternalities, BackendState, BackendTermination, UndefinedTerminationReason, }; pub(crate) type HostState = Option>; @@ -25,11 +25,11 @@ pub(crate) type HostState = Option>; /// It's supposed that `E` implements [BackendExt] pub(crate) struct State { pub ext: Ext, - pub termination_reason: TerminationReason, + pub termination_reason: UndefinedTerminationReason, } impl BackendTermination for State { - fn into_parts(self) -> (Ext, (), TerminationReason) { + fn into_parts(self) -> (Ext, (), UndefinedTerminationReason) { let State { ext, termination_reason, @@ -40,7 +40,7 @@ impl BackendTermination for State { } impl BackendState for State { - fn set_termination_reason(&mut self, reason: TerminationReason) { + fn set_termination_reason(&mut self, reason: UndefinedTerminationReason) { self.termination_reason = reason; } } diff --git a/core-processor/src/common.rs b/core-processor/src/common.rs index 07172bc2a7e..e524b1e65ad 100644 --- a/core-processor/src/common.rs +++ b/core-processor/src/common.rs @@ -505,7 +505,7 @@ pub enum SystemExecutionError { /// Termination reason #[from] #[display(fmt = "Syscall function error: {_0}")] - TerminationReason(SystemTerminationReason), + UndefinedTerminationReason(SystemTerminationReason), /// Error during `into_ext_info()` call #[display(fmt = "`into_ext_info()` error: {_0}")] IntoExtInfo(MemoryError), diff --git a/core-processor/src/executor.rs b/core-processor/src/executor.rs index fdcfcb09ec3..eb9547f7c0c 100644 --- a/core-processor/src/executor.rs +++ b/core-processor/src/executor.rs @@ -31,14 +31,14 @@ use alloc::{ vec::Vec, }; use gear_backend_common::{ - lazy_pages::{GlobalsAccessConfig, LazyPagesWeights, Status}, + lazy_pages::{GlobalsAccessConfig, LazyPagesWeights}, ActorTerminationReason, BackendExternalities, BackendReport, BackendSyscallError, Environment, - EnvironmentError, TerminationReason, TrapExplanation, + EnvironmentError, TerminationReason, }; use gear_core::{ code::InstrumentedCode, env::Externalities, - gas::{GasAllowanceCounter, GasCounter, ValueCounter}, + gas::{CountersOwner, GasAllowanceCounter, GasCounter, ValueCounter}, ids::ProgramId, memory::{AllocationsContext, Memory, MemoryError, PageBuf}, message::{ @@ -369,15 +369,8 @@ where if E::Ext::LAZY_PAGES_ENABLED { E::Ext::lazy_pages_post_execution_actions(&mut memory); - match E::Ext::lazy_pages_status() { - Status::Normal => (), - Status::GasLimitExceeded => { - termination = - ActorTerminationReason::Trap(TrapExplanation::GasLimitExceeded); - } - Status::GasAllowanceExceeded => { - termination = ActorTerminationReason::GasAllowanceExceeded; - } + if !E::Ext::lazy_pages_status().is_normal() { + termination = ext.current_counter_type().into() } } diff --git a/core-processor/src/ext.rs b/core-processor/src/ext.rs index 5f788daaf86..be889902d78 100644 --- a/core-processor/src/ext.rs +++ b/core-processor/src/ext.rs @@ -26,7 +26,7 @@ use gear_backend_common::{ memory::ProcessAccessError, runtime::RunFallibleError, ActorTerminationReason, BackendAllocSyscallError, BackendExternalities, BackendSyscallError, - ExtInfo, SystemReservationContext, TerminationReason, TrapExplanation, + ExtInfo, SystemReservationContext, TrapExplanation, UndefinedTerminationReason, UnrecoverableExecutionError, UnrecoverableExtError as UnrecoverableExtErrorCore, UnrecoverableWaitError, }; @@ -34,8 +34,8 @@ use gear_core::{ costs::{HostFnWeights, RuntimeCosts}, env::{Externalities, PayloadSliceLock, UnlockPayloadBound}, gas::{ - ChargeError, ChargeResult, CountersOwner, GasAllowanceCounter, GasAmount, GasCounter, - GasLeft, Token, ValueCounter, + ChargeError, ChargeResult, CounterType, CountersOwner, GasAllowanceCounter, GasAmount, + GasCounter, GasLeft, Token, ValueCounter, }, ids::{CodeId, MessageId, ProgramId, ReservationId}, memory::{ @@ -153,7 +153,7 @@ impl From for UnrecoverableExtError { } impl BackendSyscallError for UnrecoverableExtError { - fn into_termination_reason(self) -> TerminationReason { + fn into_termination_reason(self) -> UndefinedTerminationReason { match self { UnrecoverableExtError::Core(err) => { ActorTerminationReason::Trap(TrapExplanation::UnrecoverableExt(err)).into() @@ -163,7 +163,7 @@ impl BackendSyscallError for UnrecoverableExtError { } fn into_run_fallible_error(self) -> RunFallibleError { - RunFallibleError::TerminationReason(self.into_termination_reason()) + RunFallibleError::UndefinedTerminationReason(self.into_termination_reason()) } } @@ -207,12 +207,12 @@ impl From for RunFallibleError { match err { FallibleExtError::Core(err) => RunFallibleError::FallibleExt(err), FallibleExtError::ForbiddenFunction => { - RunFallibleError::TerminationReason(TerminationReason::Actor( + RunFallibleError::UndefinedTerminationReason(UndefinedTerminationReason::Actor( ActorTerminationReason::Trap(TrapExplanation::ForbiddenFunction), )) } FallibleExtError::Charge(err) => { - RunFallibleError::TerminationReason(TerminationReason::from(err)) + RunFallibleError::UndefinedTerminationReason(UndefinedTerminationReason::from(err)) } } } @@ -244,6 +244,8 @@ impl BackendAllocSyscallError for AllocExtError { pub struct Ext { /// Processor context. pub context: ProcessorContext, + /// Actual gas counter type within wasm module's global. + pub current_counter: CounterType, // Counter of outgoing gasless messages. // // It's temporary field, used to solve `core-audit/issue#22`. @@ -255,8 +257,16 @@ impl ProcessorExternalities for Ext { const LAZY_PAGES_ENABLED: bool = false; fn new(context: ProcessorContext) -> Self { + let current_counter = if context.gas_counter.left() <= context.gas_allowance_counter.left() + { + CounterType::GasLimit + } else { + CounterType::GasAllowance + }; + Self { context, + current_counter, outgoing_gasless: 0, } } @@ -301,7 +311,7 @@ impl BackendExternalities for Ext { fn pre_process_memory_accesses( _reads: &[MemoryInterval], _writes: &[MemoryInterval], - _gas_left: &mut GasLeft, + _gas_counter: &mut u64, ) -> Result<(), ProcessAccessError> { Ok(()) } @@ -433,10 +443,9 @@ impl Ext { return Err(ChargeError::GasLimitExceeded); } if gas_allowance_counter.charge_if_enough(amount) != ChargeResult::Enough { - if gas_counter.refund(amount) != ChargeResult::Enough { - // We have just charged `amount` from `self.gas_counter`, so this must be correct. - unreachable!("Cannot refund {amount} for `gas_counter`"); - } + // Here might be refunds for gas counter, but it's meaningless since + // on gas allowance exceed we totally roll up the message and give + // it another try in next block with the same initial resources. return Err(ChargeError::GasAllowanceExceeded); } Ok(()) @@ -471,40 +480,57 @@ impl CountersOwner for Ext { } fn gas_left(&self) -> GasLeft { - GasLeft { - gas: self.context.gas_counter.left(), - allowance: self.context.gas_allowance_counter.left(), - } + ( + self.context.gas_counter.left(), + self.context.gas_allowance_counter.left(), + ) + .into() } - fn set_gas_left(&mut self, gas_left: GasLeft) { - let GasLeft { gas, allowance } = gas_left; + fn current_counter_type(&self) -> CounterType { + self.current_counter + } - let gas_left = self.context.gas_counter.left(); - if gas_left > gas { - if self.context.gas_counter.charge_if_enough(gas_left - gas) != ChargeResult::Enough { - // We checked above that `gas_left` is bigger than `gas` - unreachable!("Cannot charge {gas} from `gas_counter`"); - } - } else { - self.context.gas_counter.refund(gas - gas_left); + fn decrease_current_counter_to(&mut self, amount: u64) { + // For possible cases of non-atomic charges on backend side when global + // value is less than appropriate at the backend. + // + // Example: + // * While executing program calls some syscall. + // * Syscall ends up with unrecoverable error - gas limit exceeded. + // * We have to charge it so we leave backend and whole execution with 0 inner counter. + // * Meanwhile global is not zero, so for this case we have to skip decreasing. + if self.current_counter_value() <= amount { + log::trace!("Skipped decrease to global value"); + return; } - let allowance_left = self.context.gas_allowance_counter.left(); - if allowance_left > allowance { - if self - .context - .gas_allowance_counter - .charge_if_enough(allowance_left - allowance) - != ChargeResult::Enough - { - // We checked above that `allowance_left` is bigger than `allowance` - unreachable!("Cannot charge {allowance} from `gas_allowance_counter`"); - } + let GasLeft { gas, allowance } = self.gas_left(); + + let diff = match self.current_counter_type() { + CounterType::GasLimit => gas.checked_sub(amount), + CounterType::GasAllowance => allowance.checked_sub(amount), + } + .unwrap_or_else(|| unreachable!("Checked above")); + + if self.context.gas_counter.charge(diff) == ChargeResult::NotEnough { + unreachable!("Tried to set gas limit left bigger than before") + } + + if self.context.gas_allowance_counter.charge(diff) == ChargeResult::NotEnough { + unreachable!("Tried to set gas allowance left bigger than before") + } + } + + fn define_current_counter(&mut self) -> u64 { + let GasLeft { gas, allowance } = self.gas_left(); + + if gas <= allowance { + self.current_counter = CounterType::GasLimit; + gas } else { - self.context - .gas_allowance_counter - .refund(allowance - allowance_left); + self.current_counter = CounterType::GasAllowance; + allowance } } } @@ -1180,10 +1206,7 @@ mod tests { let initial_gas = 100; let initial_allowance = 10000; - let gas_left = GasLeft { - gas: initial_gas, - allowance: initial_allowance, - }; + let gas_left = (initial_gas, initial_allowance).into(); let existing_page = 99.into(); let non_existing_page = 100.into(); diff --git a/core/src/gas.rs b/core/src/gas.rs index 9cedb49b3a4..8cfe903e66b 100644 --- a/core/src/gas.rs +++ b/core/src/gas.rs @@ -147,22 +147,6 @@ impl GasCounter { } } - /// Refund `amount` of gas. - pub fn refund(&mut self, amount: u64) -> ChargeResult { - if amount > self.burned { - return ChargeResult::NotEnough; - } - match self.left.checked_add(amount) { - None => ChargeResult::NotEnough, - Some(new_left) => { - self.left = new_left; - self.burned -= amount; - - ChargeResult::Enough - } - } - } - /// Report how much gas is left. pub fn left(&self) -> u64 { self.left @@ -276,13 +260,6 @@ impl GasAllowanceCounter { ChargeResult::NotEnough } } - - /// Refund `amount` of gas. - pub fn refund(&mut self, amount: u64) { - let new_value = self.0.checked_add(amount as u128); - - self.0 = new_value.unwrap_or(u128::MAX); - } } /// Charging error @@ -306,12 +283,33 @@ pub trait CountersOwner { fn charge_gas_if_enough(&mut self, amount: u64) -> Result<(), ChargeError>; /// Returns gas limit and gas allowance left. fn gas_left(&self) -> GasLeft; - /// Set gas limit and gas allowance left. - fn set_gas_left(&mut self, gas_left: GasLeft); + /// Currently set gas counter type. + fn current_counter_type(&self) -> CounterType; + /// Decreases gas left by fetched single numeric of actual counter. + fn decrease_current_counter_to(&mut self, amount: u64); + /// Returns minimal amount of gas counters and set the type of current counter. + fn define_current_counter(&mut self) -> u64; + /// Returns value of gas counter currently set. + fn current_counter_value(&self) -> u64 { + let GasLeft { gas, allowance } = self.gas_left(); + match self.current_counter_type() { + CounterType::GasLimit => gas, + CounterType::GasAllowance => allowance, + } + } +} + +/// Enum representing current type of gas counter. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)] +pub enum CounterType { + /// Gas limit counter. + GasLimit, + /// Gas allowance counter. + GasAllowance, } /// Gas limit and gas allowance left. -#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Encode, Decode)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Encode, Decode)] pub struct GasLeft { /// Left gas from gas counter. pub gas: u64, @@ -327,10 +325,7 @@ impl From<(u64, u64)> for GasLeft { impl From<(i64, i64)> for GasLeft { fn from((gas, allowance): (i64, i64)) -> Self { - Self { - gas: gas as u64, - allowance: allowance as u64, - } + (gas as u64, allowance as u64).into() } } @@ -377,13 +372,6 @@ mod tests { assert_eq!(counter.charge(token), ChargeResult::NotEnough); } - #[test] - fn refund_fails() { - let mut counter = GasCounter::new(200); - assert_eq!(counter.charge_if_enough(100u64), ChargeResult::Enough); - assert_eq!(counter.refund(500), ChargeResult::NotEnough); - } - #[test] fn charge_allowance_token_fails() { let token = RuntimeCosts::Alloc(0).token(&HostFnWeights { diff --git a/lazy-pages/src/common.rs b/lazy-pages/src/common.rs index 2e305e4e651..35f19696f9b 100644 --- a/lazy-pages/src/common.rs +++ b/lazy-pages/src/common.rs @@ -26,10 +26,7 @@ use gear_backend_common::{ }; use gear_core::gas::GasLeft; -use crate::{ - globals::{GlobalNo, GlobalsContext}, - mprotect::MprotectError, -}; +use crate::{globals::GlobalsContext, mprotect::MprotectError}; use gear_core::pages::{GearPage, PageDynSize, PageSizeNo, SizeManager, WasmPage}; // TODO: investigate error allocations #2441 @@ -109,10 +106,11 @@ impl LazyPagesContext { pub(crate) type Weights = [u64; WeightNo::Amount as usize]; pub(crate) type PageSizes = [NonZeroU32; PageSizeNo::Amount as usize]; -pub(crate) type GlobalNames = [LimitedStr<'static>; GlobalNo::Amount as usize]; +pub(crate) type GlobalNames = Vec>; #[derive(Debug)] pub(crate) struct LazyPagesRuntimeContext { + pub version: LazyPagesVersion, pub page_sizes: PageSizes, pub global_names: GlobalNames, pub pages_storage_prefix: Vec, @@ -120,6 +118,9 @@ pub(crate) struct LazyPagesRuntimeContext { #[derive(Debug)] pub(crate) struct LazyPagesExecutionContext { + /// Lazy-pages impl version. + pub version: LazyPagesVersion, + /// Lazy-pages page size. pub page_sizes: PageSizes, /// Lazy-pages accesses weights. pub weights: Weights, @@ -146,9 +147,20 @@ pub(crate) struct LazyPagesExecutionContext { pub status: Status, } -#[derive(Clone, Copy, Debug)] +/// Lazy-pages version. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum LazyPagesVersion { Version1, + Version2, +} + +impl LazyPagesVersion { + pub const fn globals_count(&self) -> usize { + match self { + Self::Version1 => 2, + Self::Version2 => 1, + } + } } impl SizeManager for LazyPagesExecutionContext { diff --git a/lazy-pages/src/globals.rs b/lazy-pages/src/globals.rs index 37eed1cf348..54b0481edfa 100644 --- a/lazy-pages/src/globals.rs +++ b/lazy-pages/src/globals.rs @@ -18,7 +18,10 @@ //! `GlobalsAccessor` realizations for native and wasm runtimes. -use crate::common::{Error, GlobalNames}; +use crate::{ + common::{Error, GlobalNames}, + LazyPagesVersion, +}; use core::any::Any; use gear_backend_common::{ lazy_pages::{GlobalsAccessError, GlobalsAccessMod, GlobalsAccessor}, @@ -30,9 +33,23 @@ use sp_wasm_interface::Value; #[derive(Debug, Clone, Copy)] pub(crate) enum GlobalNo { - GasLimit = 0, - AllowanceLimit = 1, - Amount = 2, + Gas, + GasAllowance, +} + +impl GlobalNo { + pub(crate) fn into_idx(self, version: LazyPagesVersion) -> usize { + match self { + GlobalNo::Gas => 0, + GlobalNo::GasAllowance => { + if version == LazyPagesVersion::Version1 { + 1 + } else { + unreachable!("GasAllowance global is deprecated since lazy-pages v2") + } + } + } + } } #[derive(Debug)] @@ -109,11 +126,12 @@ fn apply_for_global_internal( } pub(crate) unsafe fn apply_for_global( + version: LazyPagesVersion, globals_ctx: &GlobalsContext, global_no: GlobalNo, f: impl FnMut(u64) -> Result, Error>, ) -> Result { - let name = globals_ctx.names[global_no as usize].as_str(); + let name = globals_ctx.names[global_no.into_idx(version)].as_str(); match globals_ctx.access_mod { GlobalsAccessMod::WasmRuntime => { let instance = (globals_ctx.access_ptr as *mut SandboxInstance) diff --git a/lazy-pages/src/lib.rs b/lazy-pages/src/lib.rs index 0e6c64038f2..eb4c0ca1e02 100644 --- a/lazy-pages/src/lib.rs +++ b/lazy-pages/src/lib.rs @@ -48,10 +48,8 @@ mod sys; mod utils; use crate::{ - common::{ - ContextError, GlobalNames, LazyPagesContext, PagePrefix, PageSizes, WeightNo, Weights, - }, - globals::{GlobalNo, GlobalsContext}, + common::{ContextError, LazyPagesContext, PagePrefix, PageSizes, WeightNo, Weights}, + globals::GlobalsContext, init_flag::InitializationFlag, }; @@ -154,6 +152,7 @@ pub fn initialize_for_program( })?; let execution_ctx = LazyPagesExecutionContext { + version: runtime_ctx.version, page_sizes: runtime_ctx.page_sizes, weights, wasm_mem_addr, @@ -386,7 +385,7 @@ pub(crate) fn reset_init_flag() { /// Initialize lazy-pages for current thread. fn init_with_handler( - _version: LazyPagesVersion, + version: LazyPagesVersion, page_sizes: Vec, global_names: Vec>, pages_storage_prefix: Vec, @@ -418,20 +417,18 @@ fn init_with_handler( return Err(NotSuitablePageSizes); } - let global_names: GlobalNames = match global_names.try_into() { - Ok(names) => names, - Err(names) => { - return Err(WrongGlobalNamesAmount( - names.len(), - GlobalNo::Amount as usize, - )) - } - }; + if global_names.len() != version.globals_count() { + return Err(WrongGlobalNamesAmount( + global_names.len(), + version.globals_count(), + )); + } // Set version even if it has been already set, because it can be changed after runtime upgrade. LAZY_PAGES_CONTEXT.with(|ctx| { ctx.borrow_mut() .set_runtime_context(LazyPagesRuntimeContext { + version, page_sizes, global_names, pages_storage_prefix, diff --git a/lazy-pages/src/signal.rs b/lazy-pages/src/signal.rs index c9688e27b62..a2aab12e2ad 100644 --- a/lazy-pages/src/signal.rs +++ b/lazy-pages/src/signal.rs @@ -22,7 +22,7 @@ use crate::{ common::{Error, GasLeftCharger, LazyPagesExecutionContext, WeightNo}, globals::{self, GlobalNo}, process::{self, AccessHandler}, - LAZY_PAGES_CONTEXT, + LazyPagesVersion, LAZY_PAGES_CONTEXT, }; use gear_backend_common::lazy_pages::Status; use gear_core::{ @@ -80,16 +80,38 @@ unsafe fn user_signal_handler_internal( let page = GearPage::from_offset(ctx, offset); let gas_ctx = if let Some(globals_config) = ctx.globals_context.as_ref() { - let gas = globals::apply_for_global(globals_config, GlobalNo::GasLimit, |_| Ok(None))?; - let allowance = - globals::apply_for_global(globals_config, GlobalNo::AllowanceLimit, |_| Ok(None))?; let gas_left_charger = GasLeftCharger { read_cost: ctx.weight(WeightNo::SignalRead), write_cost: ctx.weight(WeightNo::SignalWrite), write_after_read_cost: ctx.weight(WeightNo::SignalWriteAfterRead), load_data_cost: ctx.weight(WeightNo::LoadPageDataFromStorage), }; - Some((GasLeft { gas, allowance }, gas_left_charger)) + + let gas_left = match ctx.version { + LazyPagesVersion::Version1 => { + let gas = + globals::apply_for_global(ctx.version, globals_config, GlobalNo::Gas, |_| { + Ok(None) + })?; + let allowance = globals::apply_for_global( + ctx.version, + globals_config, + GlobalNo::GasAllowance, + |_| Ok(None), + )?; + + (gas, allowance).into() + } + LazyPagesVersion::Version2 => { + let gas = + globals::apply_for_global(ctx.version, globals_config, GlobalNo::Gas, |_| { + Ok(None) + })?; + (gas, gas).into() + } + }; + + Some((gas_left, gas_left_charger)) } else { None }; @@ -179,13 +201,23 @@ impl AccessHandler for SignalAccessHandler { if let (Some((gas_left, _)), Some(globals_config)) = (self.gas_ctx, ctx.globals_context.as_ref()) { - unsafe { - globals::apply_for_global(globals_config, GlobalNo::GasLimit, |_| { - Ok(Some(gas_left.gas)) - })?; - globals::apply_for_global(globals_config, GlobalNo::AllowanceLimit, |_| { - Ok(Some(gas_left.allowance)) - })?; + match ctx.version { + LazyPagesVersion::Version1 => unsafe { + globals::apply_for_global(ctx.version, globals_config, GlobalNo::Gas, |_| { + Ok(Some(gas_left.gas)) + })?; + globals::apply_for_global( + ctx.version, + globals_config, + GlobalNo::GasAllowance, + |_| Ok(Some(gas_left.allowance)), + )?; + }, + LazyPagesVersion::Version2 => unsafe { + globals::apply_for_global(ctx.version, globals_config, GlobalNo::Gas, |_| { + Ok(Some(gas_left.gas.min(gas_left.allowance))) + })?; + }, } } Ok(()) diff --git a/lazy-pages/src/tests.rs b/lazy-pages/src/tests.rs index 83f4b5eee60..9ffe3d6170a 100644 --- a/lazy-pages/src/tests.rs +++ b/lazy-pages/src/tests.rs @@ -76,12 +76,12 @@ fn read_write_flag_works() { } init_with_handler::( - LazyPagesVersion::Version1, + LazyPagesVersion::Version2, vec![ ::size(), ::size(), ], - vec![LimitedStr::from_small_str(""); 2], + vec![LimitedStr::from_small_str("")], Default::default(), ) .unwrap(); @@ -134,12 +134,12 @@ fn test_mprotect_pages() { env_logger::init(); init_with_handler::( - LazyPagesVersion::Version1, + LazyPagesVersion::Version2, vec![ ::size(), ::size(), ], - vec![LimitedStr::from_small_str(""); 2], + vec![LimitedStr::from_small_str("")], Default::default(), ) .unwrap(); diff --git a/pallets/gear/src/benchmarking/tests/lazy_pages.rs b/pallets/gear/src/benchmarking/tests/lazy_pages.rs index e40975f4034..10e3513d270 100644 --- a/pallets/gear/src/benchmarking/tests/lazy_pages.rs +++ b/pallets/gear/src/benchmarking/tests/lazy_pages.rs @@ -605,7 +605,7 @@ where } } - assert_eq!(lazy_pages::get_status(), Status::GasLimitExceeded); + assert_ne!(lazy_pages::get_status(), Status::Normal); }; // Check gas allowance exceeded. @@ -643,6 +643,6 @@ where } } - assert_eq!(lazy_pages::get_status(), Status::GasAllowanceExceeded); + assert_ne!(lazy_pages::get_status(), Status::Normal); }; } diff --git a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs index 46d7bd4f122..28b949bbff4 100644 --- a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs +++ b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs @@ -91,7 +91,7 @@ where | SysCallName::OomPanic => {/* tests here aren't required, read module docs for more info */}, SysCallName::Alloc => check_mem::(false), SysCallName::Free => check_mem::(true), - SysCallName::OutOfGas | SysCallName::OutOfAllowance => { /*no need for tests */} + SysCallName::OutOfGas => { /*no need for tests */} SysCallName::Random => check_gr_random::(), SysCallName::ReserveGas => check_gr_reserve_gas::(), SysCallName::UnreserveGas => check_gr_unreserve_gas::(), diff --git a/pallets/gear/src/ext.rs b/pallets/gear/src/ext.rs index 9cdba6331ac..a278c23b06e 100644 --- a/pallets/gear/src/ext.rs +++ b/pallets/gear/src/ext.rs @@ -29,7 +29,7 @@ use gear_backend_common::{ use gear_core::{ costs::RuntimeCosts, env::{Externalities, PayloadSliceLock, UnlockPayloadBound}, - gas::{ChargeError, CountersOwner, GasAmount, GasLeft}, + gas::{ChargeError, CounterType, CountersOwner, GasAmount, GasLeft}, ids::{MessageId, ProgramId, ReservationId}, memory::{GrowHandler, Memory, MemoryError, MemoryInterval}, message::{HandlePacket, InitPacket, ReplyPacket}, @@ -67,9 +67,9 @@ impl BackendExternalities for LazyPagesExt { fn pre_process_memory_accesses( reads: &[MemoryInterval], writes: &[MemoryInterval], - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result<(), ProcessAccessError> { - lazy_pages::pre_process_memory_accesses(reads, writes, gas_left) + lazy_pages::pre_process_memory_accesses(reads, writes, gas_counter) } } @@ -151,8 +151,16 @@ impl CountersOwner for LazyPagesExt { self.inner.gas_left() } - fn set_gas_left(&mut self, gas_left: GasLeft) { - self.inner.set_gas_left(gas_left) + fn current_counter_type(&self) -> CounterType { + self.inner.current_counter_type() + } + + fn decrease_current_counter_to(&mut self, amount: u64) { + self.inner.decrease_current_counter_to(amount) + } + + fn define_current_counter(&mut self) -> u64 { + self.inner.define_current_counter() } } diff --git a/pallets/gear/src/schedule.rs b/pallets/gear/src/schedule.rs index 10835dea10c..fb1a42cb04f 100644 --- a/pallets/gear/src/schedule.rs +++ b/pallets/gear/src/schedule.rs @@ -745,7 +745,7 @@ impl Default for Limits { impl Default for InstructionWeights { fn default() -> Self { Self { - version: 8, + version: 9, i64const: cost_instr!(instr_i64const, 1), i64load: cost_instr!(instr_i64load, 0), i32load: cost_instr!(instr_i32load, 0), diff --git a/pallets/gear/src/weights.rs b/pallets/gear/src/weights.rs index cc0c7cbde21..7a7a7a774c7 100644 --- a/pallets/gear/src/weights.rs +++ b/pallets/gear/src/weights.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -246,10 +246,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 990_000 picoseconds. - Weight::from_parts(1_049_000, 0) - // Standard Error: 686 - .saturating_add(Weight::from_parts(242_487, 0).saturating_mul(c.into())) + // Minimum execution time: 965_000 picoseconds. + Weight::from_parts(1_020_000, 0) + // Standard Error: 753 + .saturating_add(Weight::from_parts(247_354, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -257,10 +257,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_776_000 picoseconds. - Weight::from_parts(2_926_000, 3506) - // Standard Error: 1_056 - .saturating_add(Weight::from_parts(670_577, 0).saturating_mul(c.into())) + // Minimum execution time: 2_780_000 picoseconds. + Weight::from_parts(2_874_000, 3506) + // Standard Error: 924 + .saturating_add(Weight::from_parts(674_078, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -269,17 +269,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_388_000 picoseconds. - Weight::from_parts(74_229_765, 0) - // Standard Error: 7_680 - .saturating_add(Weight::from_parts(2_427_178, 0).saturating_mul(c.into())) + // Minimum execution time: 51_392_000 picoseconds. + Weight::from_parts(63_325_658, 0) + // Standard Error: 13_432 + .saturating_add(Weight::from_parts(2_671_521, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 83_751_000 picoseconds. - Weight::from_parts(85_540_000, 42236) + // Minimum execution time: 85_039_000 picoseconds. + Weight::from_parts(86_523_000, 42236) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -287,8 +287,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 53_792_000 picoseconds. - Weight::from_parts(55_210_000, 21261) + // Minimum execution time: 54_302_000 picoseconds. + Weight::from_parts(56_159_000, 21261) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -296,8 +296,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 29_277_000 picoseconds. - Weight::from_parts(30_570_000, 17070) + // Minimum execution time: 29_099_000 picoseconds. + Weight::from_parts(30_610_000, 17070) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -306,22 +306,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_365_000 picoseconds. - Weight::from_parts(8_305_380, 7640) - // Standard Error: 43_605 - .saturating_add(Weight::from_parts(16_354_224, 0).saturating_mul(c.into())) + // Minimum execution time: 8_259_000 picoseconds. + Weight::from_parts(6_228_584, 7640) + // Standard Error: 37_556 + .saturating_add(Weight::from_parts(16_519_610, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1364 + c * (16389 ±0)` - // Estimated: `41434 + c * (131112 ±0)` - // Minimum execution time: 70_339_000 picoseconds. - Weight::from_parts(71_233_000, 41434) - // Standard Error: 169_422 - .saturating_add(Weight::from_parts(55_572_368, 0).saturating_mul(c.into())) + // Measured: `1297 + c * (16389 ±0)` + // Estimated: `40898 + c * (131112 ±0)` + // Minimum execution time: 70_699_000 picoseconds. + Weight::from_parts(71_447_000, 40898) + // Standard Error: 139_719 + .saturating_add(Weight::from_parts(54_319_486, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -332,22 +332,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 64_030_000 picoseconds. - Weight::from_parts(49_650_288, 4990) - // Standard Error: 40_921 - .saturating_add(Weight::from_parts(53_077_064, 0).saturating_mul(c.into())) + // Minimum execution time: 60_906_000 picoseconds. + Weight::from_parts(18_999_485, 4990) + // Standard Error: 57_215 + .saturating_add(Weight::from_parts(53_057_311, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `738` - // Estimated: `39375` - // Minimum execution time: 64_745_000 picoseconds. - Weight::from_parts(96_452_812, 39375) + // Measured: `671` + // Estimated: `38638` + // Minimum execution time: 65_623_000 picoseconds. + Weight::from_parts(88_392_610, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_572, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_635, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -357,12 +357,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 10_914_264_000 picoseconds. - Weight::from_parts(278_764_650, 34312) - // Standard Error: 156_493 - .saturating_add(Weight::from_parts(53_766_782, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_517, 0).saturating_mul(s.into())) + // Minimum execution time: 11_247_503_000 picoseconds. + Weight::from_parts(302_469_923, 34312) + // Standard Error: 147_459 + .saturating_add(Weight::from_parts(54_400_528, 0).saturating_mul(c.into())) + // Standard Error: 8 + .saturating_add(Weight::from_parts(2_571, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)) } @@ -371,10 +371,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 55_487_000 picoseconds. - Weight::from_parts(31_180_048, 23853) + // Minimum execution time: 56_802_000 picoseconds. + Weight::from_parts(33_250_791, 23853) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_177, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -383,10 +383,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `451` // Estimated: `27177` - // Minimum execution time: 59_745_000 picoseconds. - Weight::from_parts(32_264_542, 27177) + // Minimum execution time: 59_487_000 picoseconds. + Weight::from_parts(37_481_444, 27177) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_185, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } @@ -395,10 +395,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 83_935_000 picoseconds. - Weight::from_parts(67_556_120, 42227) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_190, 0).saturating_mul(p.into())) + // Minimum execution time: 86_239_000 picoseconds. + Weight::from_parts(32_106_516, 42227) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -407,22 +407,20 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1081` // Estimated: `45757` - // Minimum execution time: 95_523_000 picoseconds. - Weight::from_parts(67_846_891, 45757) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_213, 0).saturating_mul(p.into())) + // Minimum execution time: 98_413_000 picoseconds. + Weight::from_parts(52_381_439, 45757) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 306_381_000 picoseconds. - Weight::from_parts(319_153_310, 74319) - // Standard Error: 1_387 - .saturating_add(Weight::from_parts(6_138, 0).saturating_mul(q.into())) + // Minimum execution time: 302_634_000 picoseconds. + Weight::from_parts(320_223_637, 74319) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -431,10 +429,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 319_572_000 picoseconds. - Weight::from_parts(332_017_272, 74319) - // Standard Error: 1_262 - .saturating_add(Weight::from_parts(2_004, 0).saturating_mul(q.into())) + // Minimum execution time: 315_859_000 picoseconds. + Weight::from_parts(328_138_594, 74319) + // Standard Error: 1_557 + .saturating_add(Weight::from_parts(8_014, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -443,10 +441,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 47_252_000 picoseconds. - Weight::from_parts(47_900_000, 3899) - // Standard Error: 26_716 - .saturating_add(Weight::from_parts(51_791_764, 0).saturating_mul(c.into())) + // Minimum execution time: 45_804_000 picoseconds. + Weight::from_parts(46_226_000, 3899) + // Standard Error: 51_090 + .saturating_add(Weight::from_parts(51_940_069, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -456,630 +454,630 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_222_000 picoseconds. - Weight::from_parts(87_003_000, 0) - // Standard Error: 4_412_345 - .saturating_add(Weight::from_parts(709_555_221, 0).saturating_mul(r.into())) + // Minimum execution time: 80_872_000 picoseconds. + Weight::from_parts(82_358_000, 0) + // Standard Error: 3_946_533 + .saturating_add(Weight::from_parts(617_270_552, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 418_248_000 picoseconds. - Weight::from_parts(357_180_796, 0) - // Standard Error: 10_036 - .saturating_add(Weight::from_parts(34_125_905, 0).saturating_mul(p.into())) + // Minimum execution time: 365_182_000 picoseconds. + Weight::from_parts(292_523_651, 0) + // Standard Error: 7_087 + .saturating_add(Weight::from_parts(31_059_002, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 252_299_000 picoseconds. - Weight::from_parts(290_811_825, 0) - // Standard Error: 441_558 - .saturating_add(Weight::from_parts(168_655_080, 0).saturating_mul(r.into())) + // Minimum execution time: 196_771_000 picoseconds. + Weight::from_parts(219_836_156, 0) + // Standard Error: 406_704 + .saturating_add(Weight::from_parts(120_742_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_637_000 picoseconds. - Weight::from_parts(93_539_683, 0) - // Standard Error: 5_764 - .saturating_add(Weight::from_parts(4_269_453, 0).saturating_mul(r.into())) + // Minimum execution time: 86_043_000 picoseconds. + Weight::from_parts(92_117_781, 0) + // Standard Error: 7_334 + .saturating_add(Weight::from_parts(3_640_301, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_667_000 picoseconds. - Weight::from_parts(153_461_952, 0) - // Standard Error: 28_015 - .saturating_add(Weight::from_parts(4_740_934, 0).saturating_mul(r.into())) + // Minimum execution time: 146_803_000 picoseconds. + Weight::from_parts(168_908_676, 0) + // Standard Error: 28_070 + .saturating_add(Weight::from_parts(3_989_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_605_000 picoseconds. - Weight::from_parts(115_078_201, 0) - // Standard Error: 420_788 - .saturating_add(Weight::from_parts(235_062_438, 0).saturating_mul(r.into())) + // Minimum execution time: 82_421_000 picoseconds. + Weight::from_parts(109_902_108, 0) + // Standard Error: 458_197 + .saturating_add(Weight::from_parts(186_560_355, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_883_000 picoseconds. - Weight::from_parts(84_013_989, 0) - // Standard Error: 315_983 - .saturating_add(Weight::from_parts(233_618_600, 0).saturating_mul(r.into())) + // Minimum execution time: 85_173_000 picoseconds. + Weight::from_parts(81_703_608, 0) + // Standard Error: 318_823 + .saturating_add(Weight::from_parts(183_602_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_674_000 picoseconds. - Weight::from_parts(84_138_097, 0) - // Standard Error: 394_031 - .saturating_add(Weight::from_parts(234_112_935, 0).saturating_mul(r.into())) + // Minimum execution time: 85_999_000 picoseconds. + Weight::from_parts(81_002_605, 0) + // Standard Error: 269_075 + .saturating_add(Weight::from_parts(183_154_106, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_037_000 picoseconds. - Weight::from_parts(80_043_119, 0) - // Standard Error: 363_071 - .saturating_add(Weight::from_parts(234_440_419, 0).saturating_mul(r.into())) + // Minimum execution time: 82_306_000 picoseconds. + Weight::from_parts(79_166_166, 0) + // Standard Error: 332_502 + .saturating_add(Weight::from_parts(182_666_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_970_000 picoseconds. - Weight::from_parts(79_191_736, 0) - // Standard Error: 388_386 - .saturating_add(Weight::from_parts(234_797_123, 0).saturating_mul(r.into())) + // Minimum execution time: 82_459_000 picoseconds. + Weight::from_parts(80_301_392, 0) + // Standard Error: 340_598 + .saturating_add(Weight::from_parts(184_099_120, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_955_000 picoseconds. - Weight::from_parts(76_258_811, 0) - // Standard Error: 378_019 - .saturating_add(Weight::from_parts(235_845_928, 0).saturating_mul(r.into())) + // Minimum execution time: 81_140_000 picoseconds. + Weight::from_parts(72_987_262, 0) + // Standard Error: 388_909 + .saturating_add(Weight::from_parts(186_920_851, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_420_000 picoseconds. - Weight::from_parts(80_595_371, 0) - // Standard Error: 321_668 - .saturating_add(Weight::from_parts(234_918_409, 0).saturating_mul(r.into())) + // Minimum execution time: 81_336_000 picoseconds. + Weight::from_parts(79_078_269, 0) + // Standard Error: 276_322 + .saturating_add(Weight::from_parts(182_690_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_641_000 picoseconds. - Weight::from_parts(79_056_207, 0) - // Standard Error: 372_009 - .saturating_add(Weight::from_parts(236_443_753, 0).saturating_mul(r.into())) + // Minimum execution time: 84_201_000 picoseconds. + Weight::from_parts(79_459_558, 0) + // Standard Error: 357_406 + .saturating_add(Weight::from_parts(182_989_857, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 712_026_000 picoseconds. - Weight::from_parts(757_785_668, 0) - // Standard Error: 464_262 - .saturating_add(Weight::from_parts(317_512_842, 0).saturating_mul(r.into())) + // Minimum execution time: 709_298_000 picoseconds. + Weight::from_parts(792_701_124, 0) + // Standard Error: 581_476 + .saturating_add(Weight::from_parts(264_833_637, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 977_690_000 picoseconds. - Weight::from_parts(991_462_000, 0) - // Standard Error: 58_744 - .saturating_add(Weight::from_parts(13_316_633, 0).saturating_mul(n.into())) + // Minimum execution time: 958_553_000 picoseconds. + Weight::from_parts(1_002_082_000, 0) + // Standard Error: 51_056 + .saturating_add(Weight::from_parts(13_349_580, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_258_000 picoseconds. - Weight::from_parts(75_200_329, 0) - // Standard Error: 367_397 - .saturating_add(Weight::from_parts(234_793_089, 0).saturating_mul(r.into())) + // Minimum execution time: 81_092_000 picoseconds. + Weight::from_parts(70_460_333, 0) + // Standard Error: 322_779 + .saturating_add(Weight::from_parts(182_652_206, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_774_000 picoseconds. - Weight::from_parts(86_726_743, 0) - // Standard Error: 344_677 - .saturating_add(Weight::from_parts(232_758_004, 0).saturating_mul(r.into())) + // Minimum execution time: 82_315_000 picoseconds. + Weight::from_parts(77_285_940, 0) + // Standard Error: 310_862 + .saturating_add(Weight::from_parts(183_154_588, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_660_000 picoseconds. - Weight::from_parts(107_246_381, 0) - // Standard Error: 450_595 - .saturating_add(Weight::from_parts(299_226_823, 0).saturating_mul(n.into())) + // Minimum execution time: 82_813_000 picoseconds. + Weight::from_parts(83_631_977, 0) + // Standard Error: 426_894 + .saturating_add(Weight::from_parts(250_044_040, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_608_000 picoseconds. - Weight::from_parts(88_218_000, 0) - // Standard Error: 3_603_226 - .saturating_add(Weight::from_parts(1_138_570_591, 0).saturating_mul(r.into())) + // Minimum execution time: 87_342_000 picoseconds. + Weight::from_parts(88_861_000, 0) + // Standard Error: 4_034_065 + .saturating_add(Weight::from_parts(1_070_363_129, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_028_000 picoseconds. - Weight::from_parts(148_854_569, 0) - // Standard Error: 521_593 - .saturating_add(Weight::from_parts(444_403_185, 0).saturating_mul(r.into())) + // Minimum execution time: 82_887_000 picoseconds. + Weight::from_parts(154_402_402, 0) + // Standard Error: 504_137 + .saturating_add(Weight::from_parts(389_538_545, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 526_298_000 picoseconds. - Weight::from_parts(529_334_000, 0) - // Standard Error: 64_334 - .saturating_add(Weight::from_parts(21_542_119, 0).saturating_mul(n.into())) + // Minimum execution time: 467_573_000 picoseconds. + Weight::from_parts(471_685_000, 0) + // Standard Error: 64_140 + .saturating_add(Weight::from_parts(22_109_126, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_355_000 picoseconds. - Weight::from_parts(150_399_219, 0) - // Standard Error: 494_235 - .saturating_add(Weight::from_parts(448_618_346, 0).saturating_mul(r.into())) + // Minimum execution time: 86_853_000 picoseconds. + Weight::from_parts(152_053_498, 0) + // Standard Error: 538_330 + .saturating_add(Weight::from_parts(397_711_575, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 527_623_000 picoseconds. - Weight::from_parts(531_388_000, 0) - // Standard Error: 68_048 - .saturating_add(Weight::from_parts(21_511_303, 0).saturating_mul(n.into())) + // Minimum execution time: 471_875_000 picoseconds. + Weight::from_parts(475_692_000, 0) + // Standard Error: 57_997 + .saturating_add(Weight::from_parts(21_385_701, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_514_000 picoseconds. - Weight::from_parts(770_347_767, 0) - // Standard Error: 491_305 - .saturating_add(Weight::from_parts(460_521_622, 0).saturating_mul(r.into())) + // Minimum execution time: 716_684_000 picoseconds. + Weight::from_parts(781_328_373, 0) + // Standard Error: 479_933 + .saturating_add(Weight::from_parts(411_727_995, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 727_797_000 picoseconds. - Weight::from_parts(796_951_141, 0) - // Standard Error: 511_348 - .saturating_add(Weight::from_parts(465_952_417, 0).saturating_mul(r.into())) + // Minimum execution time: 746_421_000 picoseconds. + Weight::from_parts(889_163_923, 0) + // Standard Error: 621_967 + .saturating_add(Weight::from_parts(412_763_026, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_511_000 picoseconds. - Weight::from_parts(70_108_276, 0) - // Standard Error: 369_170 - .saturating_add(Weight::from_parts(244_926_400, 0).saturating_mul(r.into())) + // Minimum execution time: 81_961_000 picoseconds. + Weight::from_parts(86_031_226, 0) + // Standard Error: 355_690 + .saturating_add(Weight::from_parts(191_347_968, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_504_000 picoseconds. - Weight::from_parts(4_938_314_567, 0) - // Standard Error: 404_342 - .saturating_add(Weight::from_parts(338_431_048, 0).saturating_mul(r.into())) + // Minimum execution time: 3_797_807_000 picoseconds. + Weight::from_parts(3_948_397_472, 0) + // Standard Error: 396_090 + .saturating_add(Weight::from_parts(284_341_649, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 591_844_000 picoseconds. - Weight::from_parts(598_128_000, 0) - // Standard Error: 54_800 - .saturating_add(Weight::from_parts(31_272_502, 0).saturating_mul(n.into())) + // Minimum execution time: 485_799_000 picoseconds. + Weight::from_parts(486_862_000, 0) + // Standard Error: 47_704 + .saturating_add(Weight::from_parts(31_360_292, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_559_000 picoseconds. - Weight::from_parts(4_953_984_624, 0) - // Standard Error: 454_672 - .saturating_add(Weight::from_parts(391_509_821, 0).saturating_mul(r.into())) + // Minimum execution time: 3_842_120_000 picoseconds. + Weight::from_parts(3_943_431_716, 0) + // Standard Error: 766_406 + .saturating_add(Weight::from_parts(339_379_953, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_774_023_000 picoseconds. - Weight::from_parts(4_926_440_375, 0) - // Standard Error: 406_352 - .saturating_add(Weight::from_parts(410_066_296, 0).saturating_mul(r.into())) + // Minimum execution time: 3_828_327_000 picoseconds. + Weight::from_parts(3_976_283_101, 0) + // Standard Error: 768_169 + .saturating_add(Weight::from_parts(353_252_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 252_283_000 picoseconds. - Weight::from_parts(317_036_023, 0) - // Standard Error: 491_835 - .saturating_add(Weight::from_parts(459_054_688, 0).saturating_mul(r.into())) + // Minimum execution time: 256_679_000 picoseconds. + Weight::from_parts(330_245_572, 0) + // Standard Error: 519_345 + .saturating_add(Weight::from_parts(404_879_225, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 690_374_000 picoseconds. - Weight::from_parts(696_614_000, 0) - // Standard Error: 57_727 - .saturating_add(Weight::from_parts(21_193_900, 0).saturating_mul(n.into())) + // Minimum execution time: 640_004_000 picoseconds. + Weight::from_parts(646_769_000, 0) + // Standard Error: 55_122 + .saturating_add(Weight::from_parts(21_616_125, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_942_359_000 picoseconds. - Weight::from_parts(5_078_327_071, 0) - // Standard Error: 452_216 - .saturating_add(Weight::from_parts(410_586_501, 0).saturating_mul(r.into())) + // Minimum execution time: 3_981_155_000 picoseconds. + Weight::from_parts(4_086_072_221, 0) + // Standard Error: 1_076_069 + .saturating_add(Weight::from_parts(362_989_310, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_677_000 picoseconds. - Weight::from_parts(88_427_695, 0) - // Standard Error: 289_964 - .saturating_add(Weight::from_parts(20_836_104, 0).saturating_mul(r.into())) + // Minimum execution time: 84_145_000 picoseconds. + Weight::from_parts(88_260_563, 0) + // Standard Error: 277_576 + .saturating_add(Weight::from_parts(20_209_036, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_884_000 picoseconds. - Weight::from_parts(94_128_638, 0) - // Standard Error: 1_150 - .saturating_add(Weight::from_parts(427_959, 0).saturating_mul(n.into())) + // Minimum execution time: 102_930_000 picoseconds. + Weight::from_parts(90_280_376, 0) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(427_777, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_126_000 picoseconds. - Weight::from_parts(91_658_518, 0) - // Standard Error: 269_208 - .saturating_add(Weight::from_parts(19_110_181, 0).saturating_mul(r.into())) + // Minimum execution time: 84_156_000 picoseconds. + Weight::from_parts(89_778_763, 0) + // Standard Error: 365_767 + .saturating_add(Weight::from_parts(24_157_936, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_968_000 picoseconds. - Weight::from_parts(96_214_665, 0) - // Standard Error: 1_051 - .saturating_add(Weight::from_parts(424_356, 0).saturating_mul(n.into())) + // Minimum execution time: 105_315_000 picoseconds. + Weight::from_parts(94_894_394, 0) + // Standard Error: 993 + .saturating_add(Weight::from_parts(426_364, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_080_000 picoseconds. - Weight::from_parts(88_919_016, 0) - // Standard Error: 290_610 - .saturating_add(Weight::from_parts(20_031_683, 0).saturating_mul(r.into())) + // Minimum execution time: 81_595_000 picoseconds. + Weight::from_parts(86_259_504, 0) + // Standard Error: 284_882 + .saturating_add(Weight::from_parts(25_873_595, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_877_000 picoseconds. - Weight::from_parts(89_997_934, 0) - // Standard Error: 353_369 - .saturating_add(Weight::from_parts(21_258_265, 0).saturating_mul(r.into())) + // Minimum execution time: 80_771_000 picoseconds. + Weight::from_parts(85_313_802, 0) + // Standard Error: 265_474 + .saturating_add(Weight::from_parts(25_863_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_914_000 picoseconds. - Weight::from_parts(128_101_726, 0) - // Standard Error: 456_540 - .saturating_add(Weight::from_parts(327_004_586, 0).saturating_mul(r.into())) + // Minimum execution time: 82_396_000 picoseconds. + Weight::from_parts(126_819_617, 0) + // Standard Error: 518_749 + .saturating_add(Weight::from_parts(272_821_836, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_098_000 picoseconds. - Weight::from_parts(107_176_000, 0) - // Standard Error: 2_365 - .saturating_add(Weight::from_parts(643_572, 0).saturating_mul(n.into())) + // Minimum execution time: 98_266_000 picoseconds. + Weight::from_parts(100_843_000, 0) + // Standard Error: 2_828 + .saturating_add(Weight::from_parts(662_117, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_872_000 picoseconds. - Weight::from_parts(729_697_981, 0) - // Standard Error: 1_976_351 - .saturating_add(Weight::from_parts(36_344_818, 0).saturating_mul(r.into())) + // Minimum execution time: 707_150_000 picoseconds. + Weight::from_parts(754_398_128, 0) + // Standard Error: 5_119_788 + .saturating_add(Weight::from_parts(7_037_071, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_823_000 picoseconds. - Weight::from_parts(739_731_189, 0) - // Standard Error: 3_069_948 - .saturating_add(Weight::from_parts(1_778_910, 0).saturating_mul(r.into())) + // Minimum execution time: 712_091_000 picoseconds. + Weight::from_parts(751_999_544, 0) + // Standard Error: 4_003_265 + .saturating_add(Weight::from_parts(43_818_555, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_313_000 picoseconds. - Weight::from_parts(101_011_510, 0) - // Standard Error: 309_893 - .saturating_add(Weight::from_parts(12_424_889, 0).saturating_mul(r.into())) + // Minimum execution time: 92_234_000 picoseconds. + Weight::from_parts(96_192_773, 0) + // Standard Error: 271_871 + .saturating_add(Weight::from_parts(13_338_726, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 110_082_000 picoseconds. - Weight::from_parts(94_741_351, 0) - // Standard Error: 1_210 - .saturating_add(Weight::from_parts(428_098, 0).saturating_mul(n.into())) + // Minimum execution time: 108_190_000 picoseconds. + Weight::from_parts(92_525_926, 0) + // Standard Error: 1_134 + .saturating_add(Weight::from_parts(433_806, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_144_000 picoseconds. - Weight::from_parts(100_819_965, 0) - // Standard Error: 312_160 - .saturating_add(Weight::from_parts(12_498_034, 0).saturating_mul(r.into())) + // Minimum execution time: 92_297_000 picoseconds. + Weight::from_parts(98_054_616, 0) + // Standard Error: 394_791 + .saturating_add(Weight::from_parts(7_680_683, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_817_000 picoseconds. - Weight::from_parts(98_997_460, 0) - // Standard Error: 911 - .saturating_add(Weight::from_parts(418_183, 0).saturating_mul(n.into())) + // Minimum execution time: 106_932_000 picoseconds. + Weight::from_parts(91_150_785, 0) + // Standard Error: 1_067 + .saturating_add(Weight::from_parts(424_570, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_937_000 picoseconds. - Weight::from_parts(79_415_972, 0) - // Standard Error: 348_880 - .saturating_add(Weight::from_parts(235_937_217, 0).saturating_mul(r.into())) + // Minimum execution time: 80_591_000 picoseconds. + Weight::from_parts(79_590_461, 0) + // Standard Error: 360_038 + .saturating_add(Weight::from_parts(185_313_242, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_627_000 picoseconds. - Weight::from_parts(83_675_859, 0) - // Standard Error: 339_403 - .saturating_add(Weight::from_parts(235_762_764, 0).saturating_mul(r.into())) + // Minimum execution time: 83_379_000 picoseconds. + Weight::from_parts(82_304_672, 0) + // Standard Error: 371_508 + .saturating_add(Weight::from_parts(184_895_719, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 716_756_000 picoseconds. - Weight::from_parts(761_461_420, 0) - // Standard Error: 454_456 - .saturating_add(Weight::from_parts(248_489_654, 0).saturating_mul(r.into())) + // Minimum execution time: 714_906_000 picoseconds. + Weight::from_parts(784_837_322, 0) + // Standard Error: 485_874 + .saturating_add(Weight::from_parts(198_529_306, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 732_309_000 picoseconds. - Weight::from_parts(759_387_651, 0) - // Standard Error: 1_129 - .saturating_add(Weight::from_parts(146_886, 0).saturating_mul(n.into())) + // Minimum execution time: 735_164_000 picoseconds. + Weight::from_parts(760_829_418, 0) + // Standard Error: 2_049 + .saturating_add(Weight::from_parts(164_862, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_427_965_000 picoseconds. - Weight::from_parts(5_584_572_405, 0) - // Standard Error: 509_610 - .saturating_add(Weight::from_parts(266_723_710, 0).saturating_mul(r.into())) + // Minimum execution time: 4_467_125_000 picoseconds. + Weight::from_parts(4_668_343_697, 0) + // Standard Error: 529_569 + .saturating_add(Weight::from_parts(214_709_155, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_746_904_000 picoseconds. - Weight::from_parts(5_825_570_819, 0) - // Standard Error: 10_085 - .saturating_add(Weight::from_parts(13_639_502, 0).saturating_mul(n.into())) + // Minimum execution time: 4_716_693_000 picoseconds. + Weight::from_parts(4_810_590_943, 0) + // Standard Error: 12_440 + .saturating_add(Weight::from_parts(13_814_475, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_800_000 picoseconds. - Weight::from_parts(107_792_324, 0) - // Standard Error: 431_628 - .saturating_add(Weight::from_parts(246_303_550, 0).saturating_mul(r.into())) + // Minimum execution time: 81_721_000 picoseconds. + Weight::from_parts(95_360_878, 0) + // Standard Error: 488_163 + .saturating_add(Weight::from_parts(198_923_476, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 235_563_000 picoseconds. - Weight::from_parts(238_625_000, 0) - // Standard Error: 50_499 - .saturating_add(Weight::from_parts(25_511_187, 0).saturating_mul(n.into())) + // Minimum execution time: 189_069_000 picoseconds. + Weight::from_parts(191_834_000, 0) + // Standard Error: 53_942 + .saturating_add(Weight::from_parts(26_059_121, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_947_000 picoseconds. - Weight::from_parts(89_682_740, 0) - // Standard Error: 348_317 - .saturating_add(Weight::from_parts(234_018_615, 0).saturating_mul(r.into())) + // Minimum execution time: 83_023_000 picoseconds. + Weight::from_parts(70_919_161, 0) + // Standard Error: 442_134 + .saturating_add(Weight::from_parts(186_467_769, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_100_000 picoseconds. - Weight::from_parts(87_707_777, 0) - // Standard Error: 258_445 - .saturating_add(Weight::from_parts(29_983_122, 0).saturating_mul(r.into())) + // Minimum execution time: 80_187_000 picoseconds. + Weight::from_parts(86_256_124, 0) + // Standard Error: 333_120 + .saturating_add(Weight::from_parts(27_182_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_620_000 picoseconds. - Weight::from_parts(88_230_306, 0) - // Standard Error: 272_978 - .saturating_add(Weight::from_parts(17_120_893, 0).saturating_mul(r.into())) + // Minimum execution time: 80_373_000 picoseconds. + Weight::from_parts(83_957_387, 0) + // Standard Error: 258_914 + .saturating_add(Weight::from_parts(14_637_112, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_978_000 picoseconds. - Weight::from_parts(91_119_451, 0) - // Standard Error: 269_369 - .saturating_add(Weight::from_parts(15_184_548, 0).saturating_mul(r.into())) + // Minimum execution time: 82_886_000 picoseconds. + Weight::from_parts(86_536_767, 0) + // Standard Error: 237_087 + .saturating_add(Weight::from_parts(15_456_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_688_000 picoseconds. - Weight::from_parts(90_189_414, 0) - // Standard Error: 273_180 - .saturating_add(Weight::from_parts(15_680_285, 0).saturating_mul(r.into())) + // Minimum execution time: 82_962_000 picoseconds. + Weight::from_parts(87_038_165, 0) + // Standard Error: 267_652 + .saturating_add(Weight::from_parts(14_141_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_875_000 picoseconds. - Weight::from_parts(88_169_159, 0) - // Standard Error: 275_439 - .saturating_add(Weight::from_parts(14_520_840, 0).saturating_mul(r.into())) + // Minimum execution time: 82_976_000 picoseconds. + Weight::from_parts(87_105_967, 0) + // Standard Error: 237_581 + .saturating_add(Weight::from_parts(13_365_932, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_675_000 picoseconds. - Weight::from_parts(223_939_434, 0) - // Standard Error: 432_414 - .saturating_add(Weight::from_parts(337_824_841, 0).saturating_mul(r.into())) + // Minimum execution time: 139_585_000 picoseconds. + Weight::from_parts(203_512_831, 0) + // Standard Error: 393_346 + .saturating_add(Weight::from_parts(283_538_921, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 94_934_000 picoseconds. - Weight::from_parts(156_494_816, 0) - // Standard Error: 447_955 - .saturating_add(Weight::from_parts(528_564_684, 0).saturating_mul(r.into())) + // Minimum execution time: 98_330_000 picoseconds. + Weight::from_parts(158_669_516, 0) + // Standard Error: 440_421 + .saturating_add(Weight::from_parts(473_163_025, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1087,22 +1085,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_437_864_000 picoseconds. - Weight::from_parts(46_530_376_000, 0) - // Standard Error: 266_354 - .saturating_add(Weight::from_parts(7_234_250, 0).saturating_mul(p.into())) - // Standard Error: 266_341 - .saturating_add(Weight::from_parts(176_106_088, 0).saturating_mul(s.into())) + // Minimum execution time: 43_492_772_000 picoseconds. + Weight::from_parts(43_692_998_000, 0) + // Standard Error: 263_249 + .saturating_add(Weight::from_parts(8_169_821, 0).saturating_mul(p.into())) + // Standard Error: 263_236 + .saturating_add(Weight::from_parts(180_732_778, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_476_000 picoseconds. - Weight::from_parts(153_424_122, 0) - // Standard Error: 465_906 - .saturating_add(Weight::from_parts(532_257_834, 0).saturating_mul(r.into())) + // Minimum execution time: 97_189_000 picoseconds. + Weight::from_parts(158_677_248, 0) + // Standard Error: 452_648 + .saturating_add(Weight::from_parts(478_043_506, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1110,32 +1108,32 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_304_524_000 picoseconds. - Weight::from_parts(46_363_097_000, 0) - // Standard Error: 282_696 - .saturating_add(Weight::from_parts(6_905_555, 0).saturating_mul(p.into())) - // Standard Error: 282_682 - .saturating_add(Weight::from_parts(176_467_418, 0).saturating_mul(s.into())) + // Minimum execution time: 43_613_488_000 picoseconds. + Weight::from_parts(43_758_304_000, 0) + // Standard Error: 268_412 + .saturating_add(Weight::from_parts(7_987_894, 0).saturating_mul(p.into())) + // Standard Error: 268_399 + .saturating_add(Weight::from_parts(180_769_004, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_152_000 picoseconds. - Weight::from_parts(103_953_387, 0) - // Standard Error: 31_619 - .saturating_add(Weight::from_parts(4_051_743, 0).saturating_mul(r.into())) + // Minimum execution time: 84_210_000 picoseconds. + Weight::from_parts(99_996_695, 0) + // Standard Error: 31_808 + .saturating_add(Weight::from_parts(3_523_987, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_577_000 picoseconds. - Weight::from_parts(130_463_800, 1131) - // Standard Error: 8_489 - .saturating_add(Weight::from_parts(12_233_025, 0).saturating_mul(p.into())) + // Minimum execution time: 82_940_000 picoseconds. + Weight::from_parts(123_540_441, 1131) + // Standard Error: 7_143 + .saturating_add(Weight::from_parts(11_789_871, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1144,10 +1142,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_637_000 picoseconds. - Weight::from_parts(87_209_000, 1131) - // Standard Error: 34_392 - .saturating_add(Weight::from_parts(35_611_270, 0).saturating_mul(p.into())) + // Minimum execution time: 83_752_000 picoseconds. + Weight::from_parts(84_858_000, 1131) + // Standard Error: 48_161 + .saturating_add(Weight::from_parts(36_181_117, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1156,10 +1154,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_359_334_000 picoseconds. - Weight::from_parts(6_121_083_942, 5069931) - // Standard Error: 63_810 - .saturating_add(Weight::from_parts(36_566_054, 0).saturating_mul(p.into())) + // Minimum execution time: 6_125_138_000 picoseconds. + Weight::from_parts(5_869_525_563, 5069931) + // Standard Error: 46_521 + .saturating_add(Weight::from_parts(36_899_111, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1167,10 +1165,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_837_000 picoseconds. - Weight::from_parts(86_734_000, 1939) - // Standard Error: 52_031 - .saturating_add(Weight::from_parts(47_935_831, 0).saturating_mul(p.into())) + // Minimum execution time: 82_516_000 picoseconds. + Weight::from_parts(83_470_000, 1939) + // Standard Error: 29_769 + .saturating_add(Weight::from_parts(46_665_657, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1179,10 +1177,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 91_093_000 picoseconds. - Weight::from_parts(89_453_904, 1131) - // Standard Error: 67_270 - .saturating_add(Weight::from_parts(36_623_289, 0).saturating_mul(p.into())) + // Minimum execution time: 87_344_000 picoseconds. + Weight::from_parts(94_873_151, 1131) + // Standard Error: 55_429 + .saturating_add(Weight::from_parts(35_724_871, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1191,10 +1189,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 742_900_000 picoseconds. - Weight::from_parts(797_212_869, 1496) - // Standard Error: 203_408 - .saturating_add(Weight::from_parts(39_864_931, 0).saturating_mul(p.into())) + // Minimum execution time: 735_393_000 picoseconds. + Weight::from_parts(754_062_397, 1496) + // Standard Error: 166_437 + .saturating_add(Weight::from_parts(43_966_900, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1203,10 +1201,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_154_233_000 picoseconds. - Weight::from_parts(1_168_913_585, 317931) - // Standard Error: 156_513 - .saturating_add(Weight::from_parts(40_911_219, 0).saturating_mul(p.into())) + // Minimum execution time: 1_124_371_000 picoseconds. + Weight::from_parts(1_147_901_415, 317931) + // Standard Error: 145_342 + .saturating_add(Weight::from_parts(43_795_511, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1214,164 +1212,164 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_637_000 picoseconds. - Weight::from_parts(1_579_535, 0) - // Standard Error: 10_282 - .saturating_add(Weight::from_parts(23_979_117, 0).saturating_mul(r.into())) + // Minimum execution time: 1_510_000 picoseconds. + Weight::from_parts(1_448_006, 0) + // Standard Error: 9_868 + .saturating_add(Weight::from_parts(24_061_691, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_100_000 picoseconds. - Weight::from_parts(4_301_699_118, 0) - // Standard Error: 35_988 - .saturating_add(Weight::from_parts(3_646_485, 0).saturating_mul(r.into())) + // Minimum execution time: 4_337_991_000 picoseconds. + Weight::from_parts(4_151_991_287, 0) + // Standard Error: 60_683 + .saturating_add(Weight::from_parts(4_818_799, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_335_883_000 picoseconds. - Weight::from_parts(4_309_192_543, 0) - // Standard Error: 54_788 - .saturating_add(Weight::from_parts(3_782_929, 0).saturating_mul(r.into())) + // Minimum execution time: 4_341_162_000 picoseconds. + Weight::from_parts(4_200_807_294, 0) + // Standard Error: 51_442 + .saturating_add(Weight::from_parts(4_527_839, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_564_573_000 picoseconds. - Weight::from_parts(11_470_489_007, 0) - // Standard Error: 145_973 - .saturating_add(Weight::from_parts(9_000_414, 0).saturating_mul(r.into())) + // Minimum execution time: 10_322_767_000 picoseconds. + Weight::from_parts(11_038_976_057, 0) + // Standard Error: 150_113 + .saturating_add(Weight::from_parts(10_655_640, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_413_294_000 picoseconds. - Weight::from_parts(10_646_734_527, 0) - // Standard Error: 186_523 - .saturating_add(Weight::from_parts(10_318_180, 0).saturating_mul(r.into())) + // Minimum execution time: 10_367_826_000 picoseconds. + Weight::from_parts(11_310_983_745, 0) + // Standard Error: 145_202 + .saturating_add(Weight::from_parts(7_541_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 8_412 - .saturating_add(Weight::from_parts(3_826_675, 0).saturating_mul(r.into())) + // Minimum execution time: 2_251_000 picoseconds. + Weight::from_parts(2_304_000, 0) + // Standard Error: 8_520 + .saturating_add(Weight::from_parts(3_798_413, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 6_151 - .saturating_add(Weight::from_parts(3_061_817, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(573_722, 0) + // Standard Error: 11_642 + .saturating_add(Weight::from_parts(3_174_691, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_229_000 picoseconds. - Weight::from_parts(3_426_438, 0) - // Standard Error: 1_152 - .saturating_add(Weight::from_parts(1_567_482, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(3_155_512, 0) + // Standard Error: 1_212 + .saturating_add(Weight::from_parts(1_586_585, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_263_000, 0) - // Standard Error: 9_581 - .saturating_add(Weight::from_parts(2_965_066, 0).saturating_mul(r.into())) + // Minimum execution time: 2_160_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 8_627 + .saturating_add(Weight::from_parts(2_929_529, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_792_586, 0) - // Standard Error: 14_585 - .saturating_add(Weight::from_parts(5_083_752, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(1_609_241, 0) + // Standard Error: 19_812 + .saturating_add(Weight::from_parts(5_162_833, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_660_000 picoseconds. - Weight::from_parts(6_432_123, 0) - // Standard Error: 1_897 - .saturating_add(Weight::from_parts(133_494, 0).saturating_mul(e.into())) + // Minimum execution time: 6_892_000 picoseconds. + Weight::from_parts(5_316_811, 0) + // Standard Error: 1_578 + .saturating_add(Weight::from_parts(163_377, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(4_331_035, 0) - // Standard Error: 6_255 - .saturating_add(Weight::from_parts(2_559_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_304_000 picoseconds. + Weight::from_parts(4_554_683, 0) + // Standard Error: 7_319 + .saturating_add(Weight::from_parts(2_595_958, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_559_212 - - 2_413_142, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_595_958 - + 2_422_191, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(3_893_976, 0) - // Standard Error: 12_129 - .saturating_add(Weight::from_parts(2_413_142, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(5_046_075, 0) + // Standard Error: 13_702 + .saturating_add(Weight::from_parts(2_422_191, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_543_000 picoseconds. - Weight::from_parts(7_683_499, 0) - // Standard Error: 22_341 - .saturating_add(Weight::from_parts(10_324_116, 0).saturating_mul(r.into())) + // Minimum execution time: 2_684_000 picoseconds. + Weight::from_parts(17_324_871, 0) + // Standard Error: 38_532 + .saturating_add(Weight::from_parts(10_260_872, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_819_000 picoseconds. - Weight::from_parts(12_406_000, 0) - // Standard Error: 6_552 - .saturating_add(Weight::from_parts(1_132_455, 0).saturating_mul(p.into())) + // Minimum execution time: 12_206_000 picoseconds. + Weight::from_parts(2_634_425, 0) + // Standard Error: 5_954 + .saturating_add(Weight::from_parts(1_275_538, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_266_000 picoseconds. - Weight::from_parts(5_637_030, 0) - // Standard Error: 14 + // Minimum execution time: 5_288_000 picoseconds. + Weight::from_parts(5_570_870, 0) + // Standard Error: 12 .saturating_add(Weight::from_parts(61, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. @@ -1379,720 +1377,720 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_271_000 picoseconds. - Weight::from_parts(1_703_004, 0) - // Standard Error: 3_377 - .saturating_add(Weight::from_parts(252_219, 0).saturating_mul(r.into())) + // Minimum execution time: 2_203_000 picoseconds. + Weight::from_parts(1_788_159, 0) + // Standard Error: 3_152 + .saturating_add(Weight::from_parts(267_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_248_000, 0) - // Standard Error: 5_108 - .saturating_add(Weight::from_parts(763_832, 0).saturating_mul(r.into())) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_223_000, 0) + // Standard Error: 4_611 + .saturating_add(Weight::from_parts(721_127, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_302_000, 0) - // Standard Error: 5_040 - .saturating_add(Weight::from_parts(747_294, 0).saturating_mul(r.into())) + // Minimum execution time: 2_252_000 picoseconds. + Weight::from_parts(2_347_000, 0) + // Standard Error: 5_971 + .saturating_add(Weight::from_parts(742_209, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_251_000 picoseconds. - Weight::from_parts(1_658_576, 0) - // Standard Error: 9_292 - .saturating_add(Weight::from_parts(832_114, 0).saturating_mul(r.into())) + // Minimum execution time: 6_406_000 picoseconds. + Weight::from_parts(2_894_577, 0) + // Standard Error: 8_027 + .saturating_add(Weight::from_parts(801_493, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_366_000 picoseconds. - Weight::from_parts(6_431_000, 0) - // Standard Error: 10_465 - .saturating_add(Weight::from_parts(1_323_456, 0).saturating_mul(r.into())) + // Minimum execution time: 6_345_000 picoseconds. + Weight::from_parts(31_295, 0) + // Standard Error: 10_231 + .saturating_add(Weight::from_parts(1_543_569, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_241_000 picoseconds. - Weight::from_parts(1_511_304, 0) - // Standard Error: 11_616 - .saturating_add(Weight::from_parts(7_105_356, 0).saturating_mul(r.into())) + // Minimum execution time: 3_937_000 picoseconds. + Weight::from_parts(62_049, 0) + // Standard Error: 12_087 + .saturating_add(Weight::from_parts(7_172_920, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_186_000 picoseconds. - Weight::from_parts(2_232_000, 0) - // Standard Error: 5_638 - .saturating_add(Weight::from_parts(3_240_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_262_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 6_042 + .saturating_add(Weight::from_parts(3_394_526, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_238_000, 0) - // Standard Error: 6_253 - .saturating_add(Weight::from_parts(3_051_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_151_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 5_891 + .saturating_add(Weight::from_parts(3_138_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 6_246 - .saturating_add(Weight::from_parts(3_014_119, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_277_000, 0) + // Standard Error: 8_196 + .saturating_add(Weight::from_parts(3_167_033, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 4_860 - .saturating_add(Weight::from_parts(2_602_767, 0).saturating_mul(r.into())) + // Minimum execution time: 2_246_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 5_536 + .saturating_add(Weight::from_parts(2_668_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 3_577 - .saturating_add(Weight::from_parts(551_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(45_432, 0) + // Standard Error: 6_223 + .saturating_add(Weight::from_parts(645_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(1_480_989, 0) - // Standard Error: 3_344 - .saturating_add(Weight::from_parts(381_312, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(1_301_007, 0) + // Standard Error: 4_929 + .saturating_add(Weight::from_parts(446_280, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_251_000, 0) - // Standard Error: 11_018 - .saturating_add(Weight::from_parts(1_807_489, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_205_000, 0) + // Standard Error: 10_412 + .saturating_add(Weight::from_parts(1_894_722, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_219_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 7_919 - .saturating_add(Weight::from_parts(1_121_167, 0).saturating_mul(r.into())) + // Minimum execution time: 2_170_000 picoseconds. + Weight::from_parts(2_257_000, 0) + // Standard Error: 7_708 + .saturating_add(Weight::from_parts(1_162_246, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(1_457_189, 0) - // Standard Error: 3_846 - .saturating_add(Weight::from_parts(363_435, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(1_682_106, 0) + // Standard Error: 3_839 + .saturating_add(Weight::from_parts(384_381, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(1_738_887, 0) - // Standard Error: 3_502 - .saturating_add(Weight::from_parts(345_478, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(1_669_708, 0) + // Standard Error: 3_126 + .saturating_add(Weight::from_parts(384_474, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 3_606 - .saturating_add(Weight::from_parts(488_901, 0).saturating_mul(r.into())) + // Minimum execution time: 2_249_000 picoseconds. + Weight::from_parts(2_291_000, 0) + // Standard Error: 4_476 + .saturating_add(Weight::from_parts(497_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 3_193 - .saturating_add(Weight::from_parts(508_952, 0).saturating_mul(r.into())) + // Minimum execution time: 2_217_000 picoseconds. + Weight::from_parts(2_287_000, 0) + // Standard Error: 4_107 + .saturating_add(Weight::from_parts(524_095, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(458_524, 0) - // Standard Error: 4_582 - .saturating_add(Weight::from_parts(485_788, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(2_233_000, 0) + // Standard Error: 3_690 + .saturating_add(Weight::from_parts(501_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_235_000 picoseconds. - Weight::from_parts(1_405_338, 0) - // Standard Error: 3_418 - .saturating_add(Weight::from_parts(336_701, 0).saturating_mul(r.into())) + // Minimum execution time: 2_132_000 picoseconds. + Weight::from_parts(1_082_506, 0) + // Standard Error: 5_421 + .saturating_add(Weight::from_parts(400_448, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_703_008, 0) - // Standard Error: 2_198 - .saturating_add(Weight::from_parts(159_072, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(3_085_764, 0) + // Standard Error: 1_912 + .saturating_add(Weight::from_parts(162_384, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_814_821, 0) - // Standard Error: 1_823 - .saturating_add(Weight::from_parts(151_994, 0).saturating_mul(r.into())) + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_849_158, 0) + // Standard Error: 1_635 + .saturating_add(Weight::from_parts(153_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 10_432 - .saturating_add(Weight::from_parts(1_731_609, 0).saturating_mul(r.into())) + // Minimum execution time: 2_279_000 picoseconds. + Weight::from_parts(2_315_000, 0) + // Standard Error: 11_776 + .saturating_add(Weight::from_parts(1_779_477, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 6_705 - .saturating_add(Weight::from_parts(1_081_519, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 8_815 + .saturating_add(Weight::from_parts(1_197_093, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 9_924 - .saturating_add(Weight::from_parts(1_713_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_190_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 9_983 + .saturating_add(Weight::from_parts(1_838_257, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_207_000, 0) - // Standard Error: 7_700 - .saturating_add(Weight::from_parts(1_115_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 7_749 + .saturating_add(Weight::from_parts(1_165_862, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_175_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 9_760 - .saturating_add(Weight::from_parts(1_721_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_172_000 picoseconds. + Weight::from_parts(2_246_000, 0) + // Standard Error: 11_426 + .saturating_add(Weight::from_parts(1_828_814, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_143_000 picoseconds. - Weight::from_parts(2_264_000, 0) - // Standard Error: 8_446 - .saturating_add(Weight::from_parts(1_220_324, 0).saturating_mul(r.into())) + // Minimum execution time: 2_187_000 picoseconds. + Weight::from_parts(2_245_000, 0) + // Standard Error: 7_973 + .saturating_add(Weight::from_parts(1_145_613, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_361_000, 0) - // Standard Error: 8_442 - .saturating_add(Weight::from_parts(1_872_827, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_273_000, 0) + // Standard Error: 10_995 + .saturating_add(Weight::from_parts(1_789_814, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_989 - .saturating_add(Weight::from_parts(1_245_468, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_252_000, 0) + // Standard Error: 7_454 + .saturating_add(Weight::from_parts(1_207_539, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_242_000, 0) - // Standard Error: 9_083 - .saturating_add(Weight::from_parts(1_890_871, 0).saturating_mul(r.into())) + // Minimum execution time: 2_219_000 picoseconds. + Weight::from_parts(2_279_000, 0) + // Standard Error: 10_576 + .saturating_add(Weight::from_parts(1_855_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_165_000 picoseconds. - Weight::from_parts(2_269_000, 0) - // Standard Error: 6_819 - .saturating_add(Weight::from_parts(1_201_641, 0).saturating_mul(r.into())) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_265_000, 0) + // Standard Error: 7_405 + .saturating_add(Weight::from_parts(1_180_265, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_236_000, 0) - // Standard Error: 9_879 - .saturating_add(Weight::from_parts(1_860_276, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_285_000, 0) + // Standard Error: 10_994 + .saturating_add(Weight::from_parts(1_835_344, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_144_000 picoseconds. - Weight::from_parts(2_226_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_149_019, 0).saturating_mul(r.into())) + // Minimum execution time: 2_222_000 picoseconds. + Weight::from_parts(2_277_000, 0) + // Standard Error: 7_826 + .saturating_add(Weight::from_parts(1_163_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_259_000, 0) - // Standard Error: 9_793 - .saturating_add(Weight::from_parts(1_816_684, 0).saturating_mul(r.into())) + // Minimum execution time: 2_102_000 picoseconds. + Weight::from_parts(2_217_000, 0) + // Standard Error: 11_374 + .saturating_add(Weight::from_parts(1_910_004, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_280_000, 0) - // Standard Error: 7_439 - .saturating_add(Weight::from_parts(1_151_067, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_303_000, 0) + // Standard Error: 8_971 + .saturating_add(Weight::from_parts(1_182_859, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 10_695 - .saturating_add(Weight::from_parts(1_814_768, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_284_000, 0) + // Standard Error: 12_177 + .saturating_add(Weight::from_parts(1_866_465, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_571_000 picoseconds. - Weight::from_parts(2_646_000, 0) - // Standard Error: 7_097 - .saturating_add(Weight::from_parts(1_043_279, 0).saturating_mul(r.into())) + // Minimum execution time: 2_468_000 picoseconds. + Weight::from_parts(2_638_000, 0) + // Standard Error: 7_738 + .saturating_add(Weight::from_parts(1_119_369, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_083_000 picoseconds. - Weight::from_parts(2_227_000, 0) - // Standard Error: 12_723 - .saturating_add(Weight::from_parts(1_829_503, 0).saturating_mul(r.into())) + // Minimum execution time: 2_191_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 10_340 + .saturating_add(Weight::from_parts(1_831_738, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 6_578 - .saturating_add(Weight::from_parts(1_119_805, 0).saturating_mul(r.into())) + // Minimum execution time: 2_216_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 6_924 + .saturating_add(Weight::from_parts(1_210_933, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 12_281 - .saturating_add(Weight::from_parts(1_810_231, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_325_000, 0) + // Standard Error: 9_907 + .saturating_add(Weight::from_parts(1_822_715, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_307_000, 0) - // Standard Error: 7_105 - .saturating_add(Weight::from_parts(1_121_865, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 7_927 + .saturating_add(Weight::from_parts(1_168_287, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_112_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 7_396 - .saturating_add(Weight::from_parts(1_189_208, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 8_768 + .saturating_add(Weight::from_parts(1_295_617, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_187_000 picoseconds. - Weight::from_parts(2_282_000, 0) - // Standard Error: 3_728 - .saturating_add(Weight::from_parts(574_689, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 6_314 + .saturating_add(Weight::from_parts(658_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_261_000, 0) - // Standard Error: 7_710 - .saturating_add(Weight::from_parts(1_197_933, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 9_261 + .saturating_add(Weight::from_parts(1_348_699, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_277_000 picoseconds. - Weight::from_parts(2_337_000, 0) - // Standard Error: 4_189 - .saturating_add(Weight::from_parts(583_754, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 5_457 + .saturating_add(Weight::from_parts(671_846, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_083_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 12_478 - .saturating_add(Weight::from_parts(1_753_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_180_000 picoseconds. + Weight::from_parts(2_241_000, 0) + // Standard Error: 11_567 + .saturating_add(Weight::from_parts(1_835_171, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_292_000 picoseconds. - Weight::from_parts(2_326_000, 0) - // Standard Error: 6_909 - .saturating_add(Weight::from_parts(1_132_352, 0).saturating_mul(r.into())) + // Minimum execution time: 2_196_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 7_436 + .saturating_add(Weight::from_parts(1_171_019, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_188_000 picoseconds. - Weight::from_parts(522_728, 0) - // Standard Error: 19_552 - .saturating_add(Weight::from_parts(2_704_339, 0).saturating_mul(r.into())) + // Minimum execution time: 2_195_000 picoseconds. + Weight::from_parts(6_299_544, 0) + // Standard Error: 28_028 + .saturating_add(Weight::from_parts(2_500_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(1_526_164, 0) - // Standard Error: 10_257 - .saturating_add(Weight::from_parts(2_359_880, 0).saturating_mul(r.into())) + // Minimum execution time: 2_249_000 picoseconds. + Weight::from_parts(2_576_178, 0) + // Standard Error: 12_042 + .saturating_add(Weight::from_parts(2_335_953, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_144_000, 0) - // Standard Error: 5_377 - .saturating_add(Weight::from_parts(2_945_867, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(8_638_891, 0) + // Standard Error: 32_649 + .saturating_add(Weight::from_parts(2_462_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_169_000 picoseconds. - Weight::from_parts(2_211_000, 0) - // Standard Error: 5_247 - .saturating_add(Weight::from_parts(2_431_536, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_731_170, 0) + // Standard Error: 19_116 + .saturating_add(Weight::from_parts(2_437_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 16_019 - .saturating_add(Weight::from_parts(9_677_056, 0).saturating_mul(r.into())) + // Minimum execution time: 2_261_000 picoseconds. + Weight::from_parts(1_535_146, 0) + // Standard Error: 30_575 + .saturating_add(Weight::from_parts(9_634_377, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_063_031, 0) - // Standard Error: 44_174 - .saturating_add(Weight::from_parts(7_541_106, 0).saturating_mul(r.into())) + // Minimum execution time: 2_209_000 picoseconds. + Weight::from_parts(5_244_298, 0) + // Standard Error: 48_615 + .saturating_add(Weight::from_parts(7_381_672, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(5_205_597, 0) - // Standard Error: 24_468 - .saturating_add(Weight::from_parts(2_768_332, 0).saturating_mul(r.into())) + // Minimum execution time: 2_260_000 picoseconds. + Weight::from_parts(8_453_159, 0) + // Standard Error: 30_530 + .saturating_add(Weight::from_parts(2_541_459, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_216_000, 0) - // Standard Error: 6_057 - .saturating_add(Weight::from_parts(2_466_947, 0).saturating_mul(r.into())) + // Minimum execution time: 2_242_000 picoseconds. + Weight::from_parts(5_507_917, 0) + // Standard Error: 21_457 + .saturating_add(Weight::from_parts(2_217_886, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_260_000 picoseconds. - Weight::from_parts(2_298_000, 0) - // Standard Error: 6_931 - .saturating_add(Weight::from_parts(1_211_851, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 9_253 + .saturating_add(Weight::from_parts(1_354_282, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_267_000, 0) - // Standard Error: 5_345 - .saturating_add(Weight::from_parts(611_062, 0).saturating_mul(r.into())) + // Minimum execution time: 2_170_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 3_908 + .saturating_add(Weight::from_parts(589_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 9_629 - .saturating_add(Weight::from_parts(1_243_254, 0).saturating_mul(r.into())) + // Minimum execution time: 2_184_000 picoseconds. + Weight::from_parts(2_265_000, 0) + // Standard Error: 9_943 + .saturating_add(Weight::from_parts(1_308_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_342_000 picoseconds. - Weight::from_parts(2_377_000, 0) - // Standard Error: 4_075 - .saturating_add(Weight::from_parts(564_916, 0).saturating_mul(r.into())) + // Minimum execution time: 2_212_000 picoseconds. + Weight::from_parts(2_273_000, 0) + // Standard Error: 5_843 + .saturating_add(Weight::from_parts(653_388, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_212_472, 0).saturating_mul(r.into())) + // Minimum execution time: 2_228_000 picoseconds. + Weight::from_parts(2_293_000, 0) + // Standard Error: 9_157 + .saturating_add(Weight::from_parts(1_290_731, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_238_000, 0) - // Standard Error: 3_674 - .saturating_add(Weight::from_parts(587_206, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 4_020 + .saturating_add(Weight::from_parts(618_071, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 6_543 - .saturating_add(Weight::from_parts(993_044, 0).saturating_mul(r.into())) + // Minimum execution time: 2_239_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 7_192 + .saturating_add(Weight::from_parts(1_061_312, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_225_000, 0) - // Standard Error: 3_274 - .saturating_add(Weight::from_parts(509_569, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_245_000, 0) + // Standard Error: 3_756 + .saturating_add(Weight::from_parts(568_744, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_197_000, 0) - // Standard Error: 6_768 - .saturating_add(Weight::from_parts(979_181, 0).saturating_mul(r.into())) + // Minimum execution time: 2_248_000 picoseconds. + Weight::from_parts(2_324_000, 0) + // Standard Error: 7_917 + .saturating_add(Weight::from_parts(1_106_132, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(26_961, 0) - // Standard Error: 6_012 - .saturating_add(Weight::from_parts(578_422, 0).saturating_mul(r.into())) + // Minimum execution time: 2_205_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 4_617 + .saturating_add(Weight::from_parts(599_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_173_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 7_198 - .saturating_add(Weight::from_parts(985_992, 0).saturating_mul(r.into())) + // Minimum execution time: 2_215_000 picoseconds. + Weight::from_parts(2_346_000, 0) + // Standard Error: 7_501 + .saturating_add(Weight::from_parts(1_125_645, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 3_582 - .saturating_add(Weight::from_parts(504_208, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 5_262 + .saturating_add(Weight::from_parts(624_680, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_242_000, 0) - // Standard Error: 8_356 - .saturating_add(Weight::from_parts(1_025_849, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 7_879 + .saturating_add(Weight::from_parts(1_068_877, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_305_000 picoseconds. - Weight::from_parts(272_670, 0) - // Standard Error: 6_376 - .saturating_add(Weight::from_parts(599_190, 0).saturating_mul(r.into())) + // Minimum execution time: 2_192_000 picoseconds. + Weight::from_parts(2_288_000, 0) + // Standard Error: 4_124 + .saturating_add(Weight::from_parts(567_690, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 6_937 - .saturating_add(Weight::from_parts(1_018_594, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 8_516 + .saturating_add(Weight::from_parts(1_174_764, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_202_000, 0) - // Standard Error: 4_010 - .saturating_add(Weight::from_parts(573_907, 0).saturating_mul(r.into())) + // Minimum execution time: 2_171_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 4_901 + .saturating_add(Weight::from_parts(628_068, 0).saturating_mul(r.into())) } } @@ -2117,10 +2115,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 990_000 picoseconds. - Weight::from_parts(1_049_000, 0) - // Standard Error: 686 - .saturating_add(Weight::from_parts(242_487, 0).saturating_mul(c.into())) + // Minimum execution time: 965_000 picoseconds. + Weight::from_parts(1_020_000, 0) + // Standard Error: 753 + .saturating_add(Weight::from_parts(247_354, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -2128,10 +2126,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_776_000 picoseconds. - Weight::from_parts(2_926_000, 3506) - // Standard Error: 1_056 - .saturating_add(Weight::from_parts(670_577, 0).saturating_mul(c.into())) + // Minimum execution time: 2_780_000 picoseconds. + Weight::from_parts(2_874_000, 3506) + // Standard Error: 924 + .saturating_add(Weight::from_parts(674_078, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2140,17 +2138,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_388_000 picoseconds. - Weight::from_parts(74_229_765, 0) - // Standard Error: 7_680 - .saturating_add(Weight::from_parts(2_427_178, 0).saturating_mul(c.into())) + // Minimum execution time: 51_392_000 picoseconds. + Weight::from_parts(63_325_658, 0) + // Standard Error: 13_432 + .saturating_add(Weight::from_parts(2_671_521, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 83_751_000 picoseconds. - Weight::from_parts(85_540_000, 42236) + // Minimum execution time: 85_039_000 picoseconds. + Weight::from_parts(86_523_000, 42236) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2158,8 +2156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 53_792_000 picoseconds. - Weight::from_parts(55_210_000, 21261) + // Minimum execution time: 54_302_000 picoseconds. + Weight::from_parts(56_159_000, 21261) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2167,8 +2165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 29_277_000 picoseconds. - Weight::from_parts(30_570_000, 17070) + // Minimum execution time: 29_099_000 picoseconds. + Weight::from_parts(30_610_000, 17070) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2177,22 +2175,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_365_000 picoseconds. - Weight::from_parts(8_305_380, 7640) - // Standard Error: 43_605 - .saturating_add(Weight::from_parts(16_354_224, 0).saturating_mul(c.into())) + // Minimum execution time: 8_259_000 picoseconds. + Weight::from_parts(6_228_584, 7640) + // Standard Error: 37_556 + .saturating_add(Weight::from_parts(16_519_610, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1364 + c * (16389 ±0)` - // Estimated: `41434 + c * (131112 ±0)` - // Minimum execution time: 70_339_000 picoseconds. - Weight::from_parts(71_233_000, 41434) - // Standard Error: 169_422 - .saturating_add(Weight::from_parts(55_572_368, 0).saturating_mul(c.into())) + // Measured: `1297 + c * (16389 ±0)` + // Estimated: `40898 + c * (131112 ±0)` + // Minimum execution time: 70_699_000 picoseconds. + Weight::from_parts(71_447_000, 40898) + // Standard Error: 139_719 + .saturating_add(Weight::from_parts(54_319_486, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2203,22 +2201,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 64_030_000 picoseconds. - Weight::from_parts(49_650_288, 4990) - // Standard Error: 40_921 - .saturating_add(Weight::from_parts(53_077_064, 0).saturating_mul(c.into())) + // Minimum execution time: 60_906_000 picoseconds. + Weight::from_parts(18_999_485, 4990) + // Standard Error: 57_215 + .saturating_add(Weight::from_parts(53_057_311, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `738` - // Estimated: `39375` - // Minimum execution time: 64_745_000 picoseconds. - Weight::from_parts(96_452_812, 39375) + // Measured: `671` + // Estimated: `38638` + // Minimum execution time: 65_623_000 picoseconds. + Weight::from_parts(88_392_610, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_572, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_635, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2228,12 +2226,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 10_914_264_000 picoseconds. - Weight::from_parts(278_764_650, 34312) - // Standard Error: 156_493 - .saturating_add(Weight::from_parts(53_766_782, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_517, 0).saturating_mul(s.into())) + // Minimum execution time: 11_247_503_000 picoseconds. + Weight::from_parts(302_469_923, 34312) + // Standard Error: 147_459 + .saturating_add(Weight::from_parts(54_400_528, 0).saturating_mul(c.into())) + // Standard Error: 8 + .saturating_add(Weight::from_parts(2_571, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } @@ -2242,10 +2240,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 55_487_000 picoseconds. - Weight::from_parts(31_180_048, 23853) + // Minimum execution time: 56_802_000 picoseconds. + Weight::from_parts(33_250_791, 23853) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_177, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -2254,10 +2252,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `451` // Estimated: `27177` - // Minimum execution time: 59_745_000 picoseconds. - Weight::from_parts(32_264_542, 27177) + // Minimum execution time: 59_487_000 picoseconds. + Weight::from_parts(37_481_444, 27177) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_185, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } @@ -2266,10 +2264,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 83_935_000 picoseconds. - Weight::from_parts(67_556_120, 42227) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_190, 0).saturating_mul(p.into())) + // Minimum execution time: 86_239_000 picoseconds. + Weight::from_parts(32_106_516, 42227) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2278,22 +2276,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1081` // Estimated: `45757` - // Minimum execution time: 95_523_000 picoseconds. - Weight::from_parts(67_846_891, 45757) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_213, 0).saturating_mul(p.into())) + // Minimum execution time: 98_413_000 picoseconds. + Weight::from_parts(52_381_439, 45757) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(11_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 306_381_000 picoseconds. - Weight::from_parts(319_153_310, 74319) - // Standard Error: 1_387 - .saturating_add(Weight::from_parts(6_138, 0).saturating_mul(q.into())) + // Minimum execution time: 302_634_000 picoseconds. + Weight::from_parts(320_223_637, 74319) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2302,10 +2298,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 319_572_000 picoseconds. - Weight::from_parts(332_017_272, 74319) - // Standard Error: 1_262 - .saturating_add(Weight::from_parts(2_004, 0).saturating_mul(q.into())) + // Minimum execution time: 315_859_000 picoseconds. + Weight::from_parts(328_138_594, 74319) + // Standard Error: 1_557 + .saturating_add(Weight::from_parts(8_014, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2314,10 +2310,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 47_252_000 picoseconds. - Weight::from_parts(47_900_000, 3899) - // Standard Error: 26_716 - .saturating_add(Weight::from_parts(51_791_764, 0).saturating_mul(c.into())) + // Minimum execution time: 45_804_000 picoseconds. + Weight::from_parts(46_226_000, 3899) + // Standard Error: 51_090 + .saturating_add(Weight::from_parts(51_940_069, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2327,630 +2323,630 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_222_000 picoseconds. - Weight::from_parts(87_003_000, 0) - // Standard Error: 4_412_345 - .saturating_add(Weight::from_parts(709_555_221, 0).saturating_mul(r.into())) + // Minimum execution time: 80_872_000 picoseconds. + Weight::from_parts(82_358_000, 0) + // Standard Error: 3_946_533 + .saturating_add(Weight::from_parts(617_270_552, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 418_248_000 picoseconds. - Weight::from_parts(357_180_796, 0) - // Standard Error: 10_036 - .saturating_add(Weight::from_parts(34_125_905, 0).saturating_mul(p.into())) + // Minimum execution time: 365_182_000 picoseconds. + Weight::from_parts(292_523_651, 0) + // Standard Error: 7_087 + .saturating_add(Weight::from_parts(31_059_002, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 252_299_000 picoseconds. - Weight::from_parts(290_811_825, 0) - // Standard Error: 441_558 - .saturating_add(Weight::from_parts(168_655_080, 0).saturating_mul(r.into())) + // Minimum execution time: 196_771_000 picoseconds. + Weight::from_parts(219_836_156, 0) + // Standard Error: 406_704 + .saturating_add(Weight::from_parts(120_742_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_637_000 picoseconds. - Weight::from_parts(93_539_683, 0) - // Standard Error: 5_764 - .saturating_add(Weight::from_parts(4_269_453, 0).saturating_mul(r.into())) + // Minimum execution time: 86_043_000 picoseconds. + Weight::from_parts(92_117_781, 0) + // Standard Error: 7_334 + .saturating_add(Weight::from_parts(3_640_301, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_667_000 picoseconds. - Weight::from_parts(153_461_952, 0) - // Standard Error: 28_015 - .saturating_add(Weight::from_parts(4_740_934, 0).saturating_mul(r.into())) + // Minimum execution time: 146_803_000 picoseconds. + Weight::from_parts(168_908_676, 0) + // Standard Error: 28_070 + .saturating_add(Weight::from_parts(3_989_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_605_000 picoseconds. - Weight::from_parts(115_078_201, 0) - // Standard Error: 420_788 - .saturating_add(Weight::from_parts(235_062_438, 0).saturating_mul(r.into())) + // Minimum execution time: 82_421_000 picoseconds. + Weight::from_parts(109_902_108, 0) + // Standard Error: 458_197 + .saturating_add(Weight::from_parts(186_560_355, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_883_000 picoseconds. - Weight::from_parts(84_013_989, 0) - // Standard Error: 315_983 - .saturating_add(Weight::from_parts(233_618_600, 0).saturating_mul(r.into())) + // Minimum execution time: 85_173_000 picoseconds. + Weight::from_parts(81_703_608, 0) + // Standard Error: 318_823 + .saturating_add(Weight::from_parts(183_602_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_674_000 picoseconds. - Weight::from_parts(84_138_097, 0) - // Standard Error: 394_031 - .saturating_add(Weight::from_parts(234_112_935, 0).saturating_mul(r.into())) + // Minimum execution time: 85_999_000 picoseconds. + Weight::from_parts(81_002_605, 0) + // Standard Error: 269_075 + .saturating_add(Weight::from_parts(183_154_106, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_037_000 picoseconds. - Weight::from_parts(80_043_119, 0) - // Standard Error: 363_071 - .saturating_add(Weight::from_parts(234_440_419, 0).saturating_mul(r.into())) + // Minimum execution time: 82_306_000 picoseconds. + Weight::from_parts(79_166_166, 0) + // Standard Error: 332_502 + .saturating_add(Weight::from_parts(182_666_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_970_000 picoseconds. - Weight::from_parts(79_191_736, 0) - // Standard Error: 388_386 - .saturating_add(Weight::from_parts(234_797_123, 0).saturating_mul(r.into())) + // Minimum execution time: 82_459_000 picoseconds. + Weight::from_parts(80_301_392, 0) + // Standard Error: 340_598 + .saturating_add(Weight::from_parts(184_099_120, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_955_000 picoseconds. - Weight::from_parts(76_258_811, 0) - // Standard Error: 378_019 - .saturating_add(Weight::from_parts(235_845_928, 0).saturating_mul(r.into())) + // Minimum execution time: 81_140_000 picoseconds. + Weight::from_parts(72_987_262, 0) + // Standard Error: 388_909 + .saturating_add(Weight::from_parts(186_920_851, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_420_000 picoseconds. - Weight::from_parts(80_595_371, 0) - // Standard Error: 321_668 - .saturating_add(Weight::from_parts(234_918_409, 0).saturating_mul(r.into())) + // Minimum execution time: 81_336_000 picoseconds. + Weight::from_parts(79_078_269, 0) + // Standard Error: 276_322 + .saturating_add(Weight::from_parts(182_690_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_641_000 picoseconds. - Weight::from_parts(79_056_207, 0) - // Standard Error: 372_009 - .saturating_add(Weight::from_parts(236_443_753, 0).saturating_mul(r.into())) + // Minimum execution time: 84_201_000 picoseconds. + Weight::from_parts(79_459_558, 0) + // Standard Error: 357_406 + .saturating_add(Weight::from_parts(182_989_857, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 712_026_000 picoseconds. - Weight::from_parts(757_785_668, 0) - // Standard Error: 464_262 - .saturating_add(Weight::from_parts(317_512_842, 0).saturating_mul(r.into())) + // Minimum execution time: 709_298_000 picoseconds. + Weight::from_parts(792_701_124, 0) + // Standard Error: 581_476 + .saturating_add(Weight::from_parts(264_833_637, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 977_690_000 picoseconds. - Weight::from_parts(991_462_000, 0) - // Standard Error: 58_744 - .saturating_add(Weight::from_parts(13_316_633, 0).saturating_mul(n.into())) + // Minimum execution time: 958_553_000 picoseconds. + Weight::from_parts(1_002_082_000, 0) + // Standard Error: 51_056 + .saturating_add(Weight::from_parts(13_349_580, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_258_000 picoseconds. - Weight::from_parts(75_200_329, 0) - // Standard Error: 367_397 - .saturating_add(Weight::from_parts(234_793_089, 0).saturating_mul(r.into())) + // Minimum execution time: 81_092_000 picoseconds. + Weight::from_parts(70_460_333, 0) + // Standard Error: 322_779 + .saturating_add(Weight::from_parts(182_652_206, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_774_000 picoseconds. - Weight::from_parts(86_726_743, 0) - // Standard Error: 344_677 - .saturating_add(Weight::from_parts(232_758_004, 0).saturating_mul(r.into())) + // Minimum execution time: 82_315_000 picoseconds. + Weight::from_parts(77_285_940, 0) + // Standard Error: 310_862 + .saturating_add(Weight::from_parts(183_154_588, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_660_000 picoseconds. - Weight::from_parts(107_246_381, 0) - // Standard Error: 450_595 - .saturating_add(Weight::from_parts(299_226_823, 0).saturating_mul(n.into())) + // Minimum execution time: 82_813_000 picoseconds. + Weight::from_parts(83_631_977, 0) + // Standard Error: 426_894 + .saturating_add(Weight::from_parts(250_044_040, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_608_000 picoseconds. - Weight::from_parts(88_218_000, 0) - // Standard Error: 3_603_226 - .saturating_add(Weight::from_parts(1_138_570_591, 0).saturating_mul(r.into())) + // Minimum execution time: 87_342_000 picoseconds. + Weight::from_parts(88_861_000, 0) + // Standard Error: 4_034_065 + .saturating_add(Weight::from_parts(1_070_363_129, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_028_000 picoseconds. - Weight::from_parts(148_854_569, 0) - // Standard Error: 521_593 - .saturating_add(Weight::from_parts(444_403_185, 0).saturating_mul(r.into())) + // Minimum execution time: 82_887_000 picoseconds. + Weight::from_parts(154_402_402, 0) + // Standard Error: 504_137 + .saturating_add(Weight::from_parts(389_538_545, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 526_298_000 picoseconds. - Weight::from_parts(529_334_000, 0) - // Standard Error: 64_334 - .saturating_add(Weight::from_parts(21_542_119, 0).saturating_mul(n.into())) + // Minimum execution time: 467_573_000 picoseconds. + Weight::from_parts(471_685_000, 0) + // Standard Error: 64_140 + .saturating_add(Weight::from_parts(22_109_126, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_355_000 picoseconds. - Weight::from_parts(150_399_219, 0) - // Standard Error: 494_235 - .saturating_add(Weight::from_parts(448_618_346, 0).saturating_mul(r.into())) + // Minimum execution time: 86_853_000 picoseconds. + Weight::from_parts(152_053_498, 0) + // Standard Error: 538_330 + .saturating_add(Weight::from_parts(397_711_575, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 527_623_000 picoseconds. - Weight::from_parts(531_388_000, 0) - // Standard Error: 68_048 - .saturating_add(Weight::from_parts(21_511_303, 0).saturating_mul(n.into())) + // Minimum execution time: 471_875_000 picoseconds. + Weight::from_parts(475_692_000, 0) + // Standard Error: 57_997 + .saturating_add(Weight::from_parts(21_385_701, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_514_000 picoseconds. - Weight::from_parts(770_347_767, 0) - // Standard Error: 491_305 - .saturating_add(Weight::from_parts(460_521_622, 0).saturating_mul(r.into())) + // Minimum execution time: 716_684_000 picoseconds. + Weight::from_parts(781_328_373, 0) + // Standard Error: 479_933 + .saturating_add(Weight::from_parts(411_727_995, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 727_797_000 picoseconds. - Weight::from_parts(796_951_141, 0) - // Standard Error: 511_348 - .saturating_add(Weight::from_parts(465_952_417, 0).saturating_mul(r.into())) + // Minimum execution time: 746_421_000 picoseconds. + Weight::from_parts(889_163_923, 0) + // Standard Error: 621_967 + .saturating_add(Weight::from_parts(412_763_026, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_511_000 picoseconds. - Weight::from_parts(70_108_276, 0) - // Standard Error: 369_170 - .saturating_add(Weight::from_parts(244_926_400, 0).saturating_mul(r.into())) + // Minimum execution time: 81_961_000 picoseconds. + Weight::from_parts(86_031_226, 0) + // Standard Error: 355_690 + .saturating_add(Weight::from_parts(191_347_968, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_504_000 picoseconds. - Weight::from_parts(4_938_314_567, 0) - // Standard Error: 404_342 - .saturating_add(Weight::from_parts(338_431_048, 0).saturating_mul(r.into())) + // Minimum execution time: 3_797_807_000 picoseconds. + Weight::from_parts(3_948_397_472, 0) + // Standard Error: 396_090 + .saturating_add(Weight::from_parts(284_341_649, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 591_844_000 picoseconds. - Weight::from_parts(598_128_000, 0) - // Standard Error: 54_800 - .saturating_add(Weight::from_parts(31_272_502, 0).saturating_mul(n.into())) + // Minimum execution time: 485_799_000 picoseconds. + Weight::from_parts(486_862_000, 0) + // Standard Error: 47_704 + .saturating_add(Weight::from_parts(31_360_292, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_559_000 picoseconds. - Weight::from_parts(4_953_984_624, 0) - // Standard Error: 454_672 - .saturating_add(Weight::from_parts(391_509_821, 0).saturating_mul(r.into())) + // Minimum execution time: 3_842_120_000 picoseconds. + Weight::from_parts(3_943_431_716, 0) + // Standard Error: 766_406 + .saturating_add(Weight::from_parts(339_379_953, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_774_023_000 picoseconds. - Weight::from_parts(4_926_440_375, 0) - // Standard Error: 406_352 - .saturating_add(Weight::from_parts(410_066_296, 0).saturating_mul(r.into())) + // Minimum execution time: 3_828_327_000 picoseconds. + Weight::from_parts(3_976_283_101, 0) + // Standard Error: 768_169 + .saturating_add(Weight::from_parts(353_252_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 252_283_000 picoseconds. - Weight::from_parts(317_036_023, 0) - // Standard Error: 491_835 - .saturating_add(Weight::from_parts(459_054_688, 0).saturating_mul(r.into())) + // Minimum execution time: 256_679_000 picoseconds. + Weight::from_parts(330_245_572, 0) + // Standard Error: 519_345 + .saturating_add(Weight::from_parts(404_879_225, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 690_374_000 picoseconds. - Weight::from_parts(696_614_000, 0) - // Standard Error: 57_727 - .saturating_add(Weight::from_parts(21_193_900, 0).saturating_mul(n.into())) + // Minimum execution time: 640_004_000 picoseconds. + Weight::from_parts(646_769_000, 0) + // Standard Error: 55_122 + .saturating_add(Weight::from_parts(21_616_125, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_942_359_000 picoseconds. - Weight::from_parts(5_078_327_071, 0) - // Standard Error: 452_216 - .saturating_add(Weight::from_parts(410_586_501, 0).saturating_mul(r.into())) + // Minimum execution time: 3_981_155_000 picoseconds. + Weight::from_parts(4_086_072_221, 0) + // Standard Error: 1_076_069 + .saturating_add(Weight::from_parts(362_989_310, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_677_000 picoseconds. - Weight::from_parts(88_427_695, 0) - // Standard Error: 289_964 - .saturating_add(Weight::from_parts(20_836_104, 0).saturating_mul(r.into())) + // Minimum execution time: 84_145_000 picoseconds. + Weight::from_parts(88_260_563, 0) + // Standard Error: 277_576 + .saturating_add(Weight::from_parts(20_209_036, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_884_000 picoseconds. - Weight::from_parts(94_128_638, 0) - // Standard Error: 1_150 - .saturating_add(Weight::from_parts(427_959, 0).saturating_mul(n.into())) + // Minimum execution time: 102_930_000 picoseconds. + Weight::from_parts(90_280_376, 0) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(427_777, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_126_000 picoseconds. - Weight::from_parts(91_658_518, 0) - // Standard Error: 269_208 - .saturating_add(Weight::from_parts(19_110_181, 0).saturating_mul(r.into())) + // Minimum execution time: 84_156_000 picoseconds. + Weight::from_parts(89_778_763, 0) + // Standard Error: 365_767 + .saturating_add(Weight::from_parts(24_157_936, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_968_000 picoseconds. - Weight::from_parts(96_214_665, 0) - // Standard Error: 1_051 - .saturating_add(Weight::from_parts(424_356, 0).saturating_mul(n.into())) + // Minimum execution time: 105_315_000 picoseconds. + Weight::from_parts(94_894_394, 0) + // Standard Error: 993 + .saturating_add(Weight::from_parts(426_364, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_080_000 picoseconds. - Weight::from_parts(88_919_016, 0) - // Standard Error: 290_610 - .saturating_add(Weight::from_parts(20_031_683, 0).saturating_mul(r.into())) + // Minimum execution time: 81_595_000 picoseconds. + Weight::from_parts(86_259_504, 0) + // Standard Error: 284_882 + .saturating_add(Weight::from_parts(25_873_595, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_877_000 picoseconds. - Weight::from_parts(89_997_934, 0) - // Standard Error: 353_369 - .saturating_add(Weight::from_parts(21_258_265, 0).saturating_mul(r.into())) + // Minimum execution time: 80_771_000 picoseconds. + Weight::from_parts(85_313_802, 0) + // Standard Error: 265_474 + .saturating_add(Weight::from_parts(25_863_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_914_000 picoseconds. - Weight::from_parts(128_101_726, 0) - // Standard Error: 456_540 - .saturating_add(Weight::from_parts(327_004_586, 0).saturating_mul(r.into())) + // Minimum execution time: 82_396_000 picoseconds. + Weight::from_parts(126_819_617, 0) + // Standard Error: 518_749 + .saturating_add(Weight::from_parts(272_821_836, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_098_000 picoseconds. - Weight::from_parts(107_176_000, 0) - // Standard Error: 2_365 - .saturating_add(Weight::from_parts(643_572, 0).saturating_mul(n.into())) + // Minimum execution time: 98_266_000 picoseconds. + Weight::from_parts(100_843_000, 0) + // Standard Error: 2_828 + .saturating_add(Weight::from_parts(662_117, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_872_000 picoseconds. - Weight::from_parts(729_697_981, 0) - // Standard Error: 1_976_351 - .saturating_add(Weight::from_parts(36_344_818, 0).saturating_mul(r.into())) + // Minimum execution time: 707_150_000 picoseconds. + Weight::from_parts(754_398_128, 0) + // Standard Error: 5_119_788 + .saturating_add(Weight::from_parts(7_037_071, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_823_000 picoseconds. - Weight::from_parts(739_731_189, 0) - // Standard Error: 3_069_948 - .saturating_add(Weight::from_parts(1_778_910, 0).saturating_mul(r.into())) + // Minimum execution time: 712_091_000 picoseconds. + Weight::from_parts(751_999_544, 0) + // Standard Error: 4_003_265 + .saturating_add(Weight::from_parts(43_818_555, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_313_000 picoseconds. - Weight::from_parts(101_011_510, 0) - // Standard Error: 309_893 - .saturating_add(Weight::from_parts(12_424_889, 0).saturating_mul(r.into())) + // Minimum execution time: 92_234_000 picoseconds. + Weight::from_parts(96_192_773, 0) + // Standard Error: 271_871 + .saturating_add(Weight::from_parts(13_338_726, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 110_082_000 picoseconds. - Weight::from_parts(94_741_351, 0) - // Standard Error: 1_210 - .saturating_add(Weight::from_parts(428_098, 0).saturating_mul(n.into())) + // Minimum execution time: 108_190_000 picoseconds. + Weight::from_parts(92_525_926, 0) + // Standard Error: 1_134 + .saturating_add(Weight::from_parts(433_806, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_144_000 picoseconds. - Weight::from_parts(100_819_965, 0) - // Standard Error: 312_160 - .saturating_add(Weight::from_parts(12_498_034, 0).saturating_mul(r.into())) + // Minimum execution time: 92_297_000 picoseconds. + Weight::from_parts(98_054_616, 0) + // Standard Error: 394_791 + .saturating_add(Weight::from_parts(7_680_683, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_817_000 picoseconds. - Weight::from_parts(98_997_460, 0) - // Standard Error: 911 - .saturating_add(Weight::from_parts(418_183, 0).saturating_mul(n.into())) + // Minimum execution time: 106_932_000 picoseconds. + Weight::from_parts(91_150_785, 0) + // Standard Error: 1_067 + .saturating_add(Weight::from_parts(424_570, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_937_000 picoseconds. - Weight::from_parts(79_415_972, 0) - // Standard Error: 348_880 - .saturating_add(Weight::from_parts(235_937_217, 0).saturating_mul(r.into())) + // Minimum execution time: 80_591_000 picoseconds. + Weight::from_parts(79_590_461, 0) + // Standard Error: 360_038 + .saturating_add(Weight::from_parts(185_313_242, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_627_000 picoseconds. - Weight::from_parts(83_675_859, 0) - // Standard Error: 339_403 - .saturating_add(Weight::from_parts(235_762_764, 0).saturating_mul(r.into())) + // Minimum execution time: 83_379_000 picoseconds. + Weight::from_parts(82_304_672, 0) + // Standard Error: 371_508 + .saturating_add(Weight::from_parts(184_895_719, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 716_756_000 picoseconds. - Weight::from_parts(761_461_420, 0) - // Standard Error: 454_456 - .saturating_add(Weight::from_parts(248_489_654, 0).saturating_mul(r.into())) + // Minimum execution time: 714_906_000 picoseconds. + Weight::from_parts(784_837_322, 0) + // Standard Error: 485_874 + .saturating_add(Weight::from_parts(198_529_306, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 732_309_000 picoseconds. - Weight::from_parts(759_387_651, 0) - // Standard Error: 1_129 - .saturating_add(Weight::from_parts(146_886, 0).saturating_mul(n.into())) + // Minimum execution time: 735_164_000 picoseconds. + Weight::from_parts(760_829_418, 0) + // Standard Error: 2_049 + .saturating_add(Weight::from_parts(164_862, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_427_965_000 picoseconds. - Weight::from_parts(5_584_572_405, 0) - // Standard Error: 509_610 - .saturating_add(Weight::from_parts(266_723_710, 0).saturating_mul(r.into())) + // Minimum execution time: 4_467_125_000 picoseconds. + Weight::from_parts(4_668_343_697, 0) + // Standard Error: 529_569 + .saturating_add(Weight::from_parts(214_709_155, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_746_904_000 picoseconds. - Weight::from_parts(5_825_570_819, 0) - // Standard Error: 10_085 - .saturating_add(Weight::from_parts(13_639_502, 0).saturating_mul(n.into())) + // Minimum execution time: 4_716_693_000 picoseconds. + Weight::from_parts(4_810_590_943, 0) + // Standard Error: 12_440 + .saturating_add(Weight::from_parts(13_814_475, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_800_000 picoseconds. - Weight::from_parts(107_792_324, 0) - // Standard Error: 431_628 - .saturating_add(Weight::from_parts(246_303_550, 0).saturating_mul(r.into())) + // Minimum execution time: 81_721_000 picoseconds. + Weight::from_parts(95_360_878, 0) + // Standard Error: 488_163 + .saturating_add(Weight::from_parts(198_923_476, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 235_563_000 picoseconds. - Weight::from_parts(238_625_000, 0) - // Standard Error: 50_499 - .saturating_add(Weight::from_parts(25_511_187, 0).saturating_mul(n.into())) + // Minimum execution time: 189_069_000 picoseconds. + Weight::from_parts(191_834_000, 0) + // Standard Error: 53_942 + .saturating_add(Weight::from_parts(26_059_121, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_947_000 picoseconds. - Weight::from_parts(89_682_740, 0) - // Standard Error: 348_317 - .saturating_add(Weight::from_parts(234_018_615, 0).saturating_mul(r.into())) + // Minimum execution time: 83_023_000 picoseconds. + Weight::from_parts(70_919_161, 0) + // Standard Error: 442_134 + .saturating_add(Weight::from_parts(186_467_769, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_100_000 picoseconds. - Weight::from_parts(87_707_777, 0) - // Standard Error: 258_445 - .saturating_add(Weight::from_parts(29_983_122, 0).saturating_mul(r.into())) + // Minimum execution time: 80_187_000 picoseconds. + Weight::from_parts(86_256_124, 0) + // Standard Error: 333_120 + .saturating_add(Weight::from_parts(27_182_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_620_000 picoseconds. - Weight::from_parts(88_230_306, 0) - // Standard Error: 272_978 - .saturating_add(Weight::from_parts(17_120_893, 0).saturating_mul(r.into())) + // Minimum execution time: 80_373_000 picoseconds. + Weight::from_parts(83_957_387, 0) + // Standard Error: 258_914 + .saturating_add(Weight::from_parts(14_637_112, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_978_000 picoseconds. - Weight::from_parts(91_119_451, 0) - // Standard Error: 269_369 - .saturating_add(Weight::from_parts(15_184_548, 0).saturating_mul(r.into())) + // Minimum execution time: 82_886_000 picoseconds. + Weight::from_parts(86_536_767, 0) + // Standard Error: 237_087 + .saturating_add(Weight::from_parts(15_456_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_688_000 picoseconds. - Weight::from_parts(90_189_414, 0) - // Standard Error: 273_180 - .saturating_add(Weight::from_parts(15_680_285, 0).saturating_mul(r.into())) + // Minimum execution time: 82_962_000 picoseconds. + Weight::from_parts(87_038_165, 0) + // Standard Error: 267_652 + .saturating_add(Weight::from_parts(14_141_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_875_000 picoseconds. - Weight::from_parts(88_169_159, 0) - // Standard Error: 275_439 - .saturating_add(Weight::from_parts(14_520_840, 0).saturating_mul(r.into())) + // Minimum execution time: 82_976_000 picoseconds. + Weight::from_parts(87_105_967, 0) + // Standard Error: 237_581 + .saturating_add(Weight::from_parts(13_365_932, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_675_000 picoseconds. - Weight::from_parts(223_939_434, 0) - // Standard Error: 432_414 - .saturating_add(Weight::from_parts(337_824_841, 0).saturating_mul(r.into())) + // Minimum execution time: 139_585_000 picoseconds. + Weight::from_parts(203_512_831, 0) + // Standard Error: 393_346 + .saturating_add(Weight::from_parts(283_538_921, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 94_934_000 picoseconds. - Weight::from_parts(156_494_816, 0) - // Standard Error: 447_955 - .saturating_add(Weight::from_parts(528_564_684, 0).saturating_mul(r.into())) + // Minimum execution time: 98_330_000 picoseconds. + Weight::from_parts(158_669_516, 0) + // Standard Error: 440_421 + .saturating_add(Weight::from_parts(473_163_025, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2958,22 +2954,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_437_864_000 picoseconds. - Weight::from_parts(46_530_376_000, 0) - // Standard Error: 266_354 - .saturating_add(Weight::from_parts(7_234_250, 0).saturating_mul(p.into())) - // Standard Error: 266_341 - .saturating_add(Weight::from_parts(176_106_088, 0).saturating_mul(s.into())) + // Minimum execution time: 43_492_772_000 picoseconds. + Weight::from_parts(43_692_998_000, 0) + // Standard Error: 263_249 + .saturating_add(Weight::from_parts(8_169_821, 0).saturating_mul(p.into())) + // Standard Error: 263_236 + .saturating_add(Weight::from_parts(180_732_778, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_476_000 picoseconds. - Weight::from_parts(153_424_122, 0) - // Standard Error: 465_906 - .saturating_add(Weight::from_parts(532_257_834, 0).saturating_mul(r.into())) + // Minimum execution time: 97_189_000 picoseconds. + Weight::from_parts(158_677_248, 0) + // Standard Error: 452_648 + .saturating_add(Weight::from_parts(478_043_506, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2981,32 +2977,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_304_524_000 picoseconds. - Weight::from_parts(46_363_097_000, 0) - // Standard Error: 282_696 - .saturating_add(Weight::from_parts(6_905_555, 0).saturating_mul(p.into())) - // Standard Error: 282_682 - .saturating_add(Weight::from_parts(176_467_418, 0).saturating_mul(s.into())) + // Minimum execution time: 43_613_488_000 picoseconds. + Weight::from_parts(43_758_304_000, 0) + // Standard Error: 268_412 + .saturating_add(Weight::from_parts(7_987_894, 0).saturating_mul(p.into())) + // Standard Error: 268_399 + .saturating_add(Weight::from_parts(180_769_004, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_152_000 picoseconds. - Weight::from_parts(103_953_387, 0) - // Standard Error: 31_619 - .saturating_add(Weight::from_parts(4_051_743, 0).saturating_mul(r.into())) + // Minimum execution time: 84_210_000 picoseconds. + Weight::from_parts(99_996_695, 0) + // Standard Error: 31_808 + .saturating_add(Weight::from_parts(3_523_987, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_577_000 picoseconds. - Weight::from_parts(130_463_800, 1131) - // Standard Error: 8_489 - .saturating_add(Weight::from_parts(12_233_025, 0).saturating_mul(p.into())) + // Minimum execution time: 82_940_000 picoseconds. + Weight::from_parts(123_540_441, 1131) + // Standard Error: 7_143 + .saturating_add(Weight::from_parts(11_789_871, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3015,10 +3011,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_637_000 picoseconds. - Weight::from_parts(87_209_000, 1131) - // Standard Error: 34_392 - .saturating_add(Weight::from_parts(35_611_270, 0).saturating_mul(p.into())) + // Minimum execution time: 83_752_000 picoseconds. + Weight::from_parts(84_858_000, 1131) + // Standard Error: 48_161 + .saturating_add(Weight::from_parts(36_181_117, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3027,10 +3023,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_359_334_000 picoseconds. - Weight::from_parts(6_121_083_942, 5069931) - // Standard Error: 63_810 - .saturating_add(Weight::from_parts(36_566_054, 0).saturating_mul(p.into())) + // Minimum execution time: 6_125_138_000 picoseconds. + Weight::from_parts(5_869_525_563, 5069931) + // Standard Error: 46_521 + .saturating_add(Weight::from_parts(36_899_111, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -3038,10 +3034,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_837_000 picoseconds. - Weight::from_parts(86_734_000, 1939) - // Standard Error: 52_031 - .saturating_add(Weight::from_parts(47_935_831, 0).saturating_mul(p.into())) + // Minimum execution time: 82_516_000 picoseconds. + Weight::from_parts(83_470_000, 1939) + // Standard Error: 29_769 + .saturating_add(Weight::from_parts(46_665_657, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -3050,10 +3046,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 91_093_000 picoseconds. - Weight::from_parts(89_453_904, 1131) - // Standard Error: 67_270 - .saturating_add(Weight::from_parts(36_623_289, 0).saturating_mul(p.into())) + // Minimum execution time: 87_344_000 picoseconds. + Weight::from_parts(94_873_151, 1131) + // Standard Error: 55_429 + .saturating_add(Weight::from_parts(35_724_871, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3062,10 +3058,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 742_900_000 picoseconds. - Weight::from_parts(797_212_869, 1496) - // Standard Error: 203_408 - .saturating_add(Weight::from_parts(39_864_931, 0).saturating_mul(p.into())) + // Minimum execution time: 735_393_000 picoseconds. + Weight::from_parts(754_062_397, 1496) + // Standard Error: 166_437 + .saturating_add(Weight::from_parts(43_966_900, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3074,10 +3070,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_154_233_000 picoseconds. - Weight::from_parts(1_168_913_585, 317931) - // Standard Error: 156_513 - .saturating_add(Weight::from_parts(40_911_219, 0).saturating_mul(p.into())) + // Minimum execution time: 1_124_371_000 picoseconds. + Weight::from_parts(1_147_901_415, 317931) + // Standard Error: 145_342 + .saturating_add(Weight::from_parts(43_795_511, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3085,164 +3081,164 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_637_000 picoseconds. - Weight::from_parts(1_579_535, 0) - // Standard Error: 10_282 - .saturating_add(Weight::from_parts(23_979_117, 0).saturating_mul(r.into())) + // Minimum execution time: 1_510_000 picoseconds. + Weight::from_parts(1_448_006, 0) + // Standard Error: 9_868 + .saturating_add(Weight::from_parts(24_061_691, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_100_000 picoseconds. - Weight::from_parts(4_301_699_118, 0) - // Standard Error: 35_988 - .saturating_add(Weight::from_parts(3_646_485, 0).saturating_mul(r.into())) + // Minimum execution time: 4_337_991_000 picoseconds. + Weight::from_parts(4_151_991_287, 0) + // Standard Error: 60_683 + .saturating_add(Weight::from_parts(4_818_799, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_335_883_000 picoseconds. - Weight::from_parts(4_309_192_543, 0) - // Standard Error: 54_788 - .saturating_add(Weight::from_parts(3_782_929, 0).saturating_mul(r.into())) + // Minimum execution time: 4_341_162_000 picoseconds. + Weight::from_parts(4_200_807_294, 0) + // Standard Error: 51_442 + .saturating_add(Weight::from_parts(4_527_839, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_564_573_000 picoseconds. - Weight::from_parts(11_470_489_007, 0) - // Standard Error: 145_973 - .saturating_add(Weight::from_parts(9_000_414, 0).saturating_mul(r.into())) + // Minimum execution time: 10_322_767_000 picoseconds. + Weight::from_parts(11_038_976_057, 0) + // Standard Error: 150_113 + .saturating_add(Weight::from_parts(10_655_640, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_413_294_000 picoseconds. - Weight::from_parts(10_646_734_527, 0) - // Standard Error: 186_523 - .saturating_add(Weight::from_parts(10_318_180, 0).saturating_mul(r.into())) + // Minimum execution time: 10_367_826_000 picoseconds. + Weight::from_parts(11_310_983_745, 0) + // Standard Error: 145_202 + .saturating_add(Weight::from_parts(7_541_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 8_412 - .saturating_add(Weight::from_parts(3_826_675, 0).saturating_mul(r.into())) + // Minimum execution time: 2_251_000 picoseconds. + Weight::from_parts(2_304_000, 0) + // Standard Error: 8_520 + .saturating_add(Weight::from_parts(3_798_413, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 6_151 - .saturating_add(Weight::from_parts(3_061_817, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(573_722, 0) + // Standard Error: 11_642 + .saturating_add(Weight::from_parts(3_174_691, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_229_000 picoseconds. - Weight::from_parts(3_426_438, 0) - // Standard Error: 1_152 - .saturating_add(Weight::from_parts(1_567_482, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(3_155_512, 0) + // Standard Error: 1_212 + .saturating_add(Weight::from_parts(1_586_585, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_263_000, 0) - // Standard Error: 9_581 - .saturating_add(Weight::from_parts(2_965_066, 0).saturating_mul(r.into())) + // Minimum execution time: 2_160_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 8_627 + .saturating_add(Weight::from_parts(2_929_529, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_792_586, 0) - // Standard Error: 14_585 - .saturating_add(Weight::from_parts(5_083_752, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(1_609_241, 0) + // Standard Error: 19_812 + .saturating_add(Weight::from_parts(5_162_833, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_660_000 picoseconds. - Weight::from_parts(6_432_123, 0) - // Standard Error: 1_897 - .saturating_add(Weight::from_parts(133_494, 0).saturating_mul(e.into())) + // Minimum execution time: 6_892_000 picoseconds. + Weight::from_parts(5_316_811, 0) + // Standard Error: 1_578 + .saturating_add(Weight::from_parts(163_377, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(4_331_035, 0) - // Standard Error: 6_255 - .saturating_add(Weight::from_parts(2_559_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_304_000 picoseconds. + Weight::from_parts(4_554_683, 0) + // Standard Error: 7_319 + .saturating_add(Weight::from_parts(2_595_958, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_559_212 - - 2_413_142, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_595_958 - + 2_422_191, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(3_893_976, 0) - // Standard Error: 12_129 - .saturating_add(Weight::from_parts(2_413_142, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(5_046_075, 0) + // Standard Error: 13_702 + .saturating_add(Weight::from_parts(2_422_191, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_543_000 picoseconds. - Weight::from_parts(7_683_499, 0) - // Standard Error: 22_341 - .saturating_add(Weight::from_parts(10_324_116, 0).saturating_mul(r.into())) + // Minimum execution time: 2_684_000 picoseconds. + Weight::from_parts(17_324_871, 0) + // Standard Error: 38_532 + .saturating_add(Weight::from_parts(10_260_872, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_819_000 picoseconds. - Weight::from_parts(12_406_000, 0) - // Standard Error: 6_552 - .saturating_add(Weight::from_parts(1_132_455, 0).saturating_mul(p.into())) + // Minimum execution time: 12_206_000 picoseconds. + Weight::from_parts(2_634_425, 0) + // Standard Error: 5_954 + .saturating_add(Weight::from_parts(1_275_538, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_266_000 picoseconds. - Weight::from_parts(5_637_030, 0) - // Standard Error: 14 + // Minimum execution time: 5_288_000 picoseconds. + Weight::from_parts(5_570_870, 0) + // Standard Error: 12 .saturating_add(Weight::from_parts(61, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. @@ -3250,719 +3246,719 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_271_000 picoseconds. - Weight::from_parts(1_703_004, 0) - // Standard Error: 3_377 - .saturating_add(Weight::from_parts(252_219, 0).saturating_mul(r.into())) + // Minimum execution time: 2_203_000 picoseconds. + Weight::from_parts(1_788_159, 0) + // Standard Error: 3_152 + .saturating_add(Weight::from_parts(267_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_248_000, 0) - // Standard Error: 5_108 - .saturating_add(Weight::from_parts(763_832, 0).saturating_mul(r.into())) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_223_000, 0) + // Standard Error: 4_611 + .saturating_add(Weight::from_parts(721_127, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_302_000, 0) - // Standard Error: 5_040 - .saturating_add(Weight::from_parts(747_294, 0).saturating_mul(r.into())) + // Minimum execution time: 2_252_000 picoseconds. + Weight::from_parts(2_347_000, 0) + // Standard Error: 5_971 + .saturating_add(Weight::from_parts(742_209, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_251_000 picoseconds. - Weight::from_parts(1_658_576, 0) - // Standard Error: 9_292 - .saturating_add(Weight::from_parts(832_114, 0).saturating_mul(r.into())) + // Minimum execution time: 6_406_000 picoseconds. + Weight::from_parts(2_894_577, 0) + // Standard Error: 8_027 + .saturating_add(Weight::from_parts(801_493, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_366_000 picoseconds. - Weight::from_parts(6_431_000, 0) - // Standard Error: 10_465 - .saturating_add(Weight::from_parts(1_323_456, 0).saturating_mul(r.into())) + // Minimum execution time: 6_345_000 picoseconds. + Weight::from_parts(31_295, 0) + // Standard Error: 10_231 + .saturating_add(Weight::from_parts(1_543_569, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_241_000 picoseconds. - Weight::from_parts(1_511_304, 0) - // Standard Error: 11_616 - .saturating_add(Weight::from_parts(7_105_356, 0).saturating_mul(r.into())) + // Minimum execution time: 3_937_000 picoseconds. + Weight::from_parts(62_049, 0) + // Standard Error: 12_087 + .saturating_add(Weight::from_parts(7_172_920, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_186_000 picoseconds. - Weight::from_parts(2_232_000, 0) - // Standard Error: 5_638 - .saturating_add(Weight::from_parts(3_240_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_262_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 6_042 + .saturating_add(Weight::from_parts(3_394_526, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_238_000, 0) - // Standard Error: 6_253 - .saturating_add(Weight::from_parts(3_051_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_151_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 5_891 + .saturating_add(Weight::from_parts(3_138_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 6_246 - .saturating_add(Weight::from_parts(3_014_119, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_277_000, 0) + // Standard Error: 8_196 + .saturating_add(Weight::from_parts(3_167_033, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 4_860 - .saturating_add(Weight::from_parts(2_602_767, 0).saturating_mul(r.into())) + // Minimum execution time: 2_246_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 5_536 + .saturating_add(Weight::from_parts(2_668_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 3_577 - .saturating_add(Weight::from_parts(551_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(45_432, 0) + // Standard Error: 6_223 + .saturating_add(Weight::from_parts(645_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(1_480_989, 0) - // Standard Error: 3_344 - .saturating_add(Weight::from_parts(381_312, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(1_301_007, 0) + // Standard Error: 4_929 + .saturating_add(Weight::from_parts(446_280, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_251_000, 0) - // Standard Error: 11_018 - .saturating_add(Weight::from_parts(1_807_489, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_205_000, 0) + // Standard Error: 10_412 + .saturating_add(Weight::from_parts(1_894_722, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_219_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 7_919 - .saturating_add(Weight::from_parts(1_121_167, 0).saturating_mul(r.into())) + // Minimum execution time: 2_170_000 picoseconds. + Weight::from_parts(2_257_000, 0) + // Standard Error: 7_708 + .saturating_add(Weight::from_parts(1_162_246, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(1_457_189, 0) - // Standard Error: 3_846 - .saturating_add(Weight::from_parts(363_435, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(1_682_106, 0) + // Standard Error: 3_839 + .saturating_add(Weight::from_parts(384_381, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(1_738_887, 0) - // Standard Error: 3_502 - .saturating_add(Weight::from_parts(345_478, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(1_669_708, 0) + // Standard Error: 3_126 + .saturating_add(Weight::from_parts(384_474, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 3_606 - .saturating_add(Weight::from_parts(488_901, 0).saturating_mul(r.into())) + // Minimum execution time: 2_249_000 picoseconds. + Weight::from_parts(2_291_000, 0) + // Standard Error: 4_476 + .saturating_add(Weight::from_parts(497_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 3_193 - .saturating_add(Weight::from_parts(508_952, 0).saturating_mul(r.into())) + // Minimum execution time: 2_217_000 picoseconds. + Weight::from_parts(2_287_000, 0) + // Standard Error: 4_107 + .saturating_add(Weight::from_parts(524_095, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(458_524, 0) - // Standard Error: 4_582 - .saturating_add(Weight::from_parts(485_788, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(2_233_000, 0) + // Standard Error: 3_690 + .saturating_add(Weight::from_parts(501_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_235_000 picoseconds. - Weight::from_parts(1_405_338, 0) - // Standard Error: 3_418 - .saturating_add(Weight::from_parts(336_701, 0).saturating_mul(r.into())) + // Minimum execution time: 2_132_000 picoseconds. + Weight::from_parts(1_082_506, 0) + // Standard Error: 5_421 + .saturating_add(Weight::from_parts(400_448, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_703_008, 0) - // Standard Error: 2_198 - .saturating_add(Weight::from_parts(159_072, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(3_085_764, 0) + // Standard Error: 1_912 + .saturating_add(Weight::from_parts(162_384, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_814_821, 0) - // Standard Error: 1_823 - .saturating_add(Weight::from_parts(151_994, 0).saturating_mul(r.into())) + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_849_158, 0) + // Standard Error: 1_635 + .saturating_add(Weight::from_parts(153_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 10_432 - .saturating_add(Weight::from_parts(1_731_609, 0).saturating_mul(r.into())) + // Minimum execution time: 2_279_000 picoseconds. + Weight::from_parts(2_315_000, 0) + // Standard Error: 11_776 + .saturating_add(Weight::from_parts(1_779_477, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 6_705 - .saturating_add(Weight::from_parts(1_081_519, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 8_815 + .saturating_add(Weight::from_parts(1_197_093, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 9_924 - .saturating_add(Weight::from_parts(1_713_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_190_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 9_983 + .saturating_add(Weight::from_parts(1_838_257, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_207_000, 0) - // Standard Error: 7_700 - .saturating_add(Weight::from_parts(1_115_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 7_749 + .saturating_add(Weight::from_parts(1_165_862, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_175_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 9_760 - .saturating_add(Weight::from_parts(1_721_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_172_000 picoseconds. + Weight::from_parts(2_246_000, 0) + // Standard Error: 11_426 + .saturating_add(Weight::from_parts(1_828_814, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_143_000 picoseconds. - Weight::from_parts(2_264_000, 0) - // Standard Error: 8_446 - .saturating_add(Weight::from_parts(1_220_324, 0).saturating_mul(r.into())) + // Minimum execution time: 2_187_000 picoseconds. + Weight::from_parts(2_245_000, 0) + // Standard Error: 7_973 + .saturating_add(Weight::from_parts(1_145_613, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_361_000, 0) - // Standard Error: 8_442 - .saturating_add(Weight::from_parts(1_872_827, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_273_000, 0) + // Standard Error: 10_995 + .saturating_add(Weight::from_parts(1_789_814, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_989 - .saturating_add(Weight::from_parts(1_245_468, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_252_000, 0) + // Standard Error: 7_454 + .saturating_add(Weight::from_parts(1_207_539, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_242_000, 0) - // Standard Error: 9_083 - .saturating_add(Weight::from_parts(1_890_871, 0).saturating_mul(r.into())) + // Minimum execution time: 2_219_000 picoseconds. + Weight::from_parts(2_279_000, 0) + // Standard Error: 10_576 + .saturating_add(Weight::from_parts(1_855_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_165_000 picoseconds. - Weight::from_parts(2_269_000, 0) - // Standard Error: 6_819 - .saturating_add(Weight::from_parts(1_201_641, 0).saturating_mul(r.into())) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_265_000, 0) + // Standard Error: 7_405 + .saturating_add(Weight::from_parts(1_180_265, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_236_000, 0) - // Standard Error: 9_879 - .saturating_add(Weight::from_parts(1_860_276, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_285_000, 0) + // Standard Error: 10_994 + .saturating_add(Weight::from_parts(1_835_344, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_144_000 picoseconds. - Weight::from_parts(2_226_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_149_019, 0).saturating_mul(r.into())) + // Minimum execution time: 2_222_000 picoseconds. + Weight::from_parts(2_277_000, 0) + // Standard Error: 7_826 + .saturating_add(Weight::from_parts(1_163_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_259_000, 0) - // Standard Error: 9_793 - .saturating_add(Weight::from_parts(1_816_684, 0).saturating_mul(r.into())) + // Minimum execution time: 2_102_000 picoseconds. + Weight::from_parts(2_217_000, 0) + // Standard Error: 11_374 + .saturating_add(Weight::from_parts(1_910_004, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_280_000, 0) - // Standard Error: 7_439 - .saturating_add(Weight::from_parts(1_151_067, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_303_000, 0) + // Standard Error: 8_971 + .saturating_add(Weight::from_parts(1_182_859, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 10_695 - .saturating_add(Weight::from_parts(1_814_768, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_284_000, 0) + // Standard Error: 12_177 + .saturating_add(Weight::from_parts(1_866_465, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_571_000 picoseconds. - Weight::from_parts(2_646_000, 0) - // Standard Error: 7_097 - .saturating_add(Weight::from_parts(1_043_279, 0).saturating_mul(r.into())) + // Minimum execution time: 2_468_000 picoseconds. + Weight::from_parts(2_638_000, 0) + // Standard Error: 7_738 + .saturating_add(Weight::from_parts(1_119_369, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_083_000 picoseconds. - Weight::from_parts(2_227_000, 0) - // Standard Error: 12_723 - .saturating_add(Weight::from_parts(1_829_503, 0).saturating_mul(r.into())) + // Minimum execution time: 2_191_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 10_340 + .saturating_add(Weight::from_parts(1_831_738, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 6_578 - .saturating_add(Weight::from_parts(1_119_805, 0).saturating_mul(r.into())) + // Minimum execution time: 2_216_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 6_924 + .saturating_add(Weight::from_parts(1_210_933, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 12_281 - .saturating_add(Weight::from_parts(1_810_231, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_325_000, 0) + // Standard Error: 9_907 + .saturating_add(Weight::from_parts(1_822_715, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_307_000, 0) - // Standard Error: 7_105 - .saturating_add(Weight::from_parts(1_121_865, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 7_927 + .saturating_add(Weight::from_parts(1_168_287, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_112_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 7_396 - .saturating_add(Weight::from_parts(1_189_208, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 8_768 + .saturating_add(Weight::from_parts(1_295_617, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_187_000 picoseconds. - Weight::from_parts(2_282_000, 0) - // Standard Error: 3_728 - .saturating_add(Weight::from_parts(574_689, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 6_314 + .saturating_add(Weight::from_parts(658_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_261_000, 0) - // Standard Error: 7_710 - .saturating_add(Weight::from_parts(1_197_933, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 9_261 + .saturating_add(Weight::from_parts(1_348_699, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_277_000 picoseconds. - Weight::from_parts(2_337_000, 0) - // Standard Error: 4_189 - .saturating_add(Weight::from_parts(583_754, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 5_457 + .saturating_add(Weight::from_parts(671_846, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_083_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 12_478 - .saturating_add(Weight::from_parts(1_753_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_180_000 picoseconds. + Weight::from_parts(2_241_000, 0) + // Standard Error: 11_567 + .saturating_add(Weight::from_parts(1_835_171, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_292_000 picoseconds. - Weight::from_parts(2_326_000, 0) - // Standard Error: 6_909 - .saturating_add(Weight::from_parts(1_132_352, 0).saturating_mul(r.into())) + // Minimum execution time: 2_196_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 7_436 + .saturating_add(Weight::from_parts(1_171_019, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_188_000 picoseconds. - Weight::from_parts(522_728, 0) - // Standard Error: 19_552 - .saturating_add(Weight::from_parts(2_704_339, 0).saturating_mul(r.into())) + // Minimum execution time: 2_195_000 picoseconds. + Weight::from_parts(6_299_544, 0) + // Standard Error: 28_028 + .saturating_add(Weight::from_parts(2_500_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(1_526_164, 0) - // Standard Error: 10_257 - .saturating_add(Weight::from_parts(2_359_880, 0).saturating_mul(r.into())) + // Minimum execution time: 2_249_000 picoseconds. + Weight::from_parts(2_576_178, 0) + // Standard Error: 12_042 + .saturating_add(Weight::from_parts(2_335_953, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_144_000, 0) - // Standard Error: 5_377 - .saturating_add(Weight::from_parts(2_945_867, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(8_638_891, 0) + // Standard Error: 32_649 + .saturating_add(Weight::from_parts(2_462_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_169_000 picoseconds. - Weight::from_parts(2_211_000, 0) - // Standard Error: 5_247 - .saturating_add(Weight::from_parts(2_431_536, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_731_170, 0) + // Standard Error: 19_116 + .saturating_add(Weight::from_parts(2_437_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 16_019 - .saturating_add(Weight::from_parts(9_677_056, 0).saturating_mul(r.into())) + // Minimum execution time: 2_261_000 picoseconds. + Weight::from_parts(1_535_146, 0) + // Standard Error: 30_575 + .saturating_add(Weight::from_parts(9_634_377, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_063_031, 0) - // Standard Error: 44_174 - .saturating_add(Weight::from_parts(7_541_106, 0).saturating_mul(r.into())) + // Minimum execution time: 2_209_000 picoseconds. + Weight::from_parts(5_244_298, 0) + // Standard Error: 48_615 + .saturating_add(Weight::from_parts(7_381_672, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(5_205_597, 0) - // Standard Error: 24_468 - .saturating_add(Weight::from_parts(2_768_332, 0).saturating_mul(r.into())) + // Minimum execution time: 2_260_000 picoseconds. + Weight::from_parts(8_453_159, 0) + // Standard Error: 30_530 + .saturating_add(Weight::from_parts(2_541_459, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_216_000, 0) - // Standard Error: 6_057 - .saturating_add(Weight::from_parts(2_466_947, 0).saturating_mul(r.into())) + // Minimum execution time: 2_242_000 picoseconds. + Weight::from_parts(5_507_917, 0) + // Standard Error: 21_457 + .saturating_add(Weight::from_parts(2_217_886, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_260_000 picoseconds. - Weight::from_parts(2_298_000, 0) - // Standard Error: 6_931 - .saturating_add(Weight::from_parts(1_211_851, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 9_253 + .saturating_add(Weight::from_parts(1_354_282, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_267_000, 0) - // Standard Error: 5_345 - .saturating_add(Weight::from_parts(611_062, 0).saturating_mul(r.into())) + // Minimum execution time: 2_170_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 3_908 + .saturating_add(Weight::from_parts(589_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 9_629 - .saturating_add(Weight::from_parts(1_243_254, 0).saturating_mul(r.into())) + // Minimum execution time: 2_184_000 picoseconds. + Weight::from_parts(2_265_000, 0) + // Standard Error: 9_943 + .saturating_add(Weight::from_parts(1_308_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_342_000 picoseconds. - Weight::from_parts(2_377_000, 0) - // Standard Error: 4_075 - .saturating_add(Weight::from_parts(564_916, 0).saturating_mul(r.into())) + // Minimum execution time: 2_212_000 picoseconds. + Weight::from_parts(2_273_000, 0) + // Standard Error: 5_843 + .saturating_add(Weight::from_parts(653_388, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_212_472, 0).saturating_mul(r.into())) + // Minimum execution time: 2_228_000 picoseconds. + Weight::from_parts(2_293_000, 0) + // Standard Error: 9_157 + .saturating_add(Weight::from_parts(1_290_731, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_238_000, 0) - // Standard Error: 3_674 - .saturating_add(Weight::from_parts(587_206, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 4_020 + .saturating_add(Weight::from_parts(618_071, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 6_543 - .saturating_add(Weight::from_parts(993_044, 0).saturating_mul(r.into())) + // Minimum execution time: 2_239_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 7_192 + .saturating_add(Weight::from_parts(1_061_312, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_225_000, 0) - // Standard Error: 3_274 - .saturating_add(Weight::from_parts(509_569, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_245_000, 0) + // Standard Error: 3_756 + .saturating_add(Weight::from_parts(568_744, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_197_000, 0) - // Standard Error: 6_768 - .saturating_add(Weight::from_parts(979_181, 0).saturating_mul(r.into())) + // Minimum execution time: 2_248_000 picoseconds. + Weight::from_parts(2_324_000, 0) + // Standard Error: 7_917 + .saturating_add(Weight::from_parts(1_106_132, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(26_961, 0) - // Standard Error: 6_012 - .saturating_add(Weight::from_parts(578_422, 0).saturating_mul(r.into())) + // Minimum execution time: 2_205_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 4_617 + .saturating_add(Weight::from_parts(599_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_173_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 7_198 - .saturating_add(Weight::from_parts(985_992, 0).saturating_mul(r.into())) + // Minimum execution time: 2_215_000 picoseconds. + Weight::from_parts(2_346_000, 0) + // Standard Error: 7_501 + .saturating_add(Weight::from_parts(1_125_645, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 3_582 - .saturating_add(Weight::from_parts(504_208, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 5_262 + .saturating_add(Weight::from_parts(624_680, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_242_000, 0) - // Standard Error: 8_356 - .saturating_add(Weight::from_parts(1_025_849, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 7_879 + .saturating_add(Weight::from_parts(1_068_877, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_305_000 picoseconds. - Weight::from_parts(272_670, 0) - // Standard Error: 6_376 - .saturating_add(Weight::from_parts(599_190, 0).saturating_mul(r.into())) + // Minimum execution time: 2_192_000 picoseconds. + Weight::from_parts(2_288_000, 0) + // Standard Error: 4_124 + .saturating_add(Weight::from_parts(567_690, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 6_937 - .saturating_add(Weight::from_parts(1_018_594, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 8_516 + .saturating_add(Weight::from_parts(1_174_764, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_202_000, 0) - // Standard Error: 4_010 - .saturating_add(Weight::from_parts(573_907, 0).saturating_mul(r.into())) + // Minimum execution time: 2_171_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 4_901 + .saturating_add(Weight::from_parts(628_068, 0).saturating_mul(r.into())) } } diff --git a/runtime-interface/src/lib.rs b/runtime-interface/src/lib.rs index 8f86ccf8a32..62b2fd416d5 100644 --- a/runtime-interface/src/lib.rs +++ b/runtime-interface/src/lib.rs @@ -105,13 +105,27 @@ pub trait GearRI { .unwrap_or_else(|err| unreachable!("Cannot get lazy-pages status: {err}")),) } + fn init_lazy_pages(ctx: LazyPagesRuntimeContext) -> bool { + use lazy_pages::LazyPagesVersion; + + lazy_pages::init( + LazyPagesVersion::Version1, + ctx.page_sizes, + ctx.global_names, + ctx.pages_storage_prefix, + ) + .map_err(|err| log::error!("Cannot initialize lazy-pages: {}", err)) + .is_ok() + } + /// Init lazy-pages. /// Returns whether initialization was successful. + #[version(2)] fn init_lazy_pages(ctx: LazyPagesRuntimeContext) -> bool { use lazy_pages::LazyPagesVersion; lazy_pages::init( - LazyPagesVersion::Version1, + LazyPagesVersion::Version2, ctx.page_sizes, ctx.global_names, ctx.pages_storage_prefix, diff --git a/runtime/gear/src/tests.rs b/runtime/gear/src/tests.rs index 3ff63c03950..1c3696b1964 100644 --- a/runtime/gear/src/tests.rs +++ b/runtime/gear/src/tests.rs @@ -141,7 +141,7 @@ fn page_costs_heuristic_test() { lazy_pages_signal_write_after_read: 8_624_904.into(), lazy_pages_host_func_read: 29_000_000.into(), lazy_pages_host_func_write: 33_000_000.into(), - lazy_pages_host_func_write_after_read: 7_531_864.into(), + lazy_pages_host_func_write_after_read: 8_294_669.into(), load_page_data: 8_700_000.into(), upload_page_data: 104_000_000.into(), static_page: 100.into(), diff --git a/runtime/gear/src/weights/frame_system.rs b/runtime/gear/src/weights/frame_system.rs index be34b48746b..57bbef7223e 100644 --- a/runtime/gear/src/weights/frame_system.rs +++ b/runtime/gear/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_612_000 picoseconds. - Weight::from_parts(1_289_228, 0) + // Minimum execution time: 1_652_000 picoseconds. + Weight::from_parts(1_044_833, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) } @@ -63,17 +63,17 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_994_000 picoseconds. - Weight::from_parts(6_151_000, 0) + // Minimum execution time: 6_078_000 picoseconds. + Weight::from_parts(6_338_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_441, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_433, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_924_000 picoseconds. - Weight::from_parts(3_218_000, 1485) + // Minimum execution time: 3_023_000 picoseconds. + Weight::from_parts(3_268_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -82,10 +82,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_525_000 picoseconds. - Weight::from_parts(1_605_000, 0) - // Standard Error: 1_064 - .saturating_add(Weight::from_parts(703_583, 0).saturating_mul(i.into())) + // Minimum execution time: 1_662_000 picoseconds. + Weight::from_parts(1_751_000, 0) + // Standard Error: 965 + .saturating_add(Weight::from_parts(690_953, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -93,10 +93,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_517_000 picoseconds. - Weight::from_parts(1_556_000, 0) - // Standard Error: 751 - .saturating_add(Weight::from_parts(532_261, 0).saturating_mul(i.into())) + // Minimum execution time: 1_656_000 picoseconds. + Weight::from_parts(1_676_000, 0) + // Standard Error: 886 + .saturating_add(Weight::from_parts(524_369, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -104,10 +104,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `64 + p * (69 ±0)` // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 3_212_000 picoseconds. - Weight::from_parts(3_367_000, 66) - // Standard Error: 1_254 - .saturating_add(Weight::from_parts(1_105_532, 0).saturating_mul(p.into())) + // Minimum execution time: 3_381_000 picoseconds. + Weight::from_parts(3_523_000, 66) + // Standard Error: 1_488 + .saturating_add(Weight::from_parts(1_108_252, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -121,8 +121,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_612_000 picoseconds. - Weight::from_parts(1_289_228, 0) + // Minimum execution time: 1_652_000 picoseconds. + Weight::from_parts(1_044_833, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) } @@ -131,17 +131,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_994_000 picoseconds. - Weight::from_parts(6_151_000, 0) + // Minimum execution time: 6_078_000 picoseconds. + Weight::from_parts(6_338_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_441, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_433, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_924_000 picoseconds. - Weight::from_parts(3_218_000, 1485) + // Minimum execution time: 3_023_000 picoseconds. + Weight::from_parts(3_268_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -150,10 +150,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_525_000 picoseconds. - Weight::from_parts(1_605_000, 0) - // Standard Error: 1_064 - .saturating_add(Weight::from_parts(703_583, 0).saturating_mul(i.into())) + // Minimum execution time: 1_662_000 picoseconds. + Weight::from_parts(1_751_000, 0) + // Standard Error: 965 + .saturating_add(Weight::from_parts(690_953, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -161,10 +161,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_517_000 picoseconds. - Weight::from_parts(1_556_000, 0) - // Standard Error: 751 - .saturating_add(Weight::from_parts(532_261, 0).saturating_mul(i.into())) + // Minimum execution time: 1_656_000 picoseconds. + Weight::from_parts(1_676_000, 0) + // Standard Error: 886 + .saturating_add(Weight::from_parts(524_369, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -172,10 +172,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `64 + p * (69 ±0)` // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 3_212_000 picoseconds. - Weight::from_parts(3_367_000, 66) - // Standard Error: 1_254 - .saturating_add(Weight::from_parts(1_105_532, 0).saturating_mul(p.into())) + // Minimum execution time: 3_381_000 picoseconds. + Weight::from_parts(3_523_000, 66) + // Standard Error: 1_488 + .saturating_add(Weight::from_parts(1_108_252, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/runtime/gear/src/weights/pallet_balances.rs b/runtime/gear/src/weights/pallet_balances.rs index 827c605e2e8..8c7c2852b75 100644 --- a/runtime/gear/src/weights/pallet_balances.rs +++ b/runtime/gear/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_760_000 picoseconds. - Weight::from_parts(32_353_000, 3593) + // Minimum execution time: 31_661_000 picoseconds. + Weight::from_parts(32_358_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -62,8 +62,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 22_899_000 picoseconds. - Weight::from_parts(23_362_000, 3593) + // Minimum execution time: 23_643_000 picoseconds. + Weight::from_parts(23_917_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -71,8 +71,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_819_000 picoseconds. - Weight::from_parts(13_296_000, 3593) + // Minimum execution time: 13_269_000 picoseconds. + Weight::from_parts(13_533_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +80,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_551_000 picoseconds. - Weight::from_parts(15_965_000, 3593) + // Minimum execution time: 15_877_000 picoseconds. + Weight::from_parts(16_512_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -89,8 +89,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 33_720_000 picoseconds. - Weight::from_parts(34_045_000, 6196) + // Minimum execution time: 33_754_000 picoseconds. + Weight::from_parts(34_473_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -98,8 +98,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_261_000 picoseconds. - Weight::from_parts(29_921_000, 3593) + // Minimum execution time: 29_975_000 picoseconds. + Weight::from_parts(30_556_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,8 +107,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_592_000 picoseconds. - Weight::from_parts(12_892_000, 3593) + // Minimum execution time: 12_611_000 picoseconds. + Weight::from_parts(13_043_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +120,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_760_000 picoseconds. - Weight::from_parts(32_353_000, 3593) + // Minimum execution time: 31_661_000 picoseconds. + Weight::from_parts(32_358_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -129,8 +129,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 22_899_000 picoseconds. - Weight::from_parts(23_362_000, 3593) + // Minimum execution time: 23_643_000 picoseconds. + Weight::from_parts(23_917_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_819_000 picoseconds. - Weight::from_parts(13_296_000, 3593) + // Minimum execution time: 13_269_000 picoseconds. + Weight::from_parts(13_533_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -147,8 +147,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_551_000 picoseconds. - Weight::from_parts(15_965_000, 3593) + // Minimum execution time: 15_877_000 picoseconds. + Weight::from_parts(16_512_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -156,8 +156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 33_720_000 picoseconds. - Weight::from_parts(34_045_000, 6196) + // Minimum execution time: 33_754_000 picoseconds. + Weight::from_parts(34_473_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -165,8 +165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_261_000 picoseconds. - Weight::from_parts(29_921_000, 3593) + // Minimum execution time: 29_975_000 picoseconds. + Weight::from_parts(30_556_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -174,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_592_000 picoseconds. - Weight::from_parts(12_892_000, 3593) + // Minimum execution time: 12_611_000 picoseconds. + Weight::from_parts(13_043_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/runtime/gear/src/weights/pallet_gear.rs b/runtime/gear/src/weights/pallet_gear.rs index d01ed8cedd2..210fc7cd252 100644 --- a/runtime/gear/src/weights/pallet_gear.rs +++ b/runtime/gear/src/weights/pallet_gear.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -246,10 +246,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 990_000 picoseconds. - Weight::from_parts(1_049_000, 0) - // Standard Error: 686 - .saturating_add(Weight::from_parts(242_487, 0).saturating_mul(c.into())) + // Minimum execution time: 965_000 picoseconds. + Weight::from_parts(1_020_000, 0) + // Standard Error: 753 + .saturating_add(Weight::from_parts(247_354, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -257,10 +257,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_776_000 picoseconds. - Weight::from_parts(2_926_000, 3506) - // Standard Error: 1_056 - .saturating_add(Weight::from_parts(670_577, 0).saturating_mul(c.into())) + // Minimum execution time: 2_780_000 picoseconds. + Weight::from_parts(2_874_000, 3506) + // Standard Error: 924 + .saturating_add(Weight::from_parts(674_078, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -269,17 +269,17 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_388_000 picoseconds. - Weight::from_parts(74_229_765, 0) - // Standard Error: 7_680 - .saturating_add(Weight::from_parts(2_427_178, 0).saturating_mul(c.into())) + // Minimum execution time: 51_392_000 picoseconds. + Weight::from_parts(63_325_658, 0) + // Standard Error: 13_432 + .saturating_add(Weight::from_parts(2_671_521, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 83_751_000 picoseconds. - Weight::from_parts(85_540_000, 42236) + // Minimum execution time: 85_039_000 picoseconds. + Weight::from_parts(86_523_000, 42236) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -287,8 +287,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 53_792_000 picoseconds. - Weight::from_parts(55_210_000, 21261) + // Minimum execution time: 54_302_000 picoseconds. + Weight::from_parts(56_159_000, 21261) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -296,8 +296,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 29_277_000 picoseconds. - Weight::from_parts(30_570_000, 17070) + // Minimum execution time: 29_099_000 picoseconds. + Weight::from_parts(30_610_000, 17070) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -306,22 +306,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_365_000 picoseconds. - Weight::from_parts(8_305_380, 7640) - // Standard Error: 43_605 - .saturating_add(Weight::from_parts(16_354_224, 0).saturating_mul(c.into())) + // Minimum execution time: 8_259_000 picoseconds. + Weight::from_parts(6_228_584, 7640) + // Standard Error: 37_556 + .saturating_add(Weight::from_parts(16_519_610, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1364 + c * (16389 ±0)` - // Estimated: `41434 + c * (131112 ±0)` - // Minimum execution time: 70_339_000 picoseconds. - Weight::from_parts(71_233_000, 41434) - // Standard Error: 169_422 - .saturating_add(Weight::from_parts(55_572_368, 0).saturating_mul(c.into())) + // Measured: `1297 + c * (16389 ±0)` + // Estimated: `40898 + c * (131112 ±0)` + // Minimum execution time: 70_699_000 picoseconds. + Weight::from_parts(71_447_000, 40898) + // Standard Error: 139_719 + .saturating_add(Weight::from_parts(54_319_486, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -332,22 +332,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 64_030_000 picoseconds. - Weight::from_parts(49_650_288, 4990) - // Standard Error: 40_921 - .saturating_add(Weight::from_parts(53_077_064, 0).saturating_mul(c.into())) + // Minimum execution time: 60_906_000 picoseconds. + Weight::from_parts(18_999_485, 4990) + // Standard Error: 57_215 + .saturating_add(Weight::from_parts(53_057_311, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `738` - // Estimated: `39375` - // Minimum execution time: 64_745_000 picoseconds. - Weight::from_parts(96_452_812, 39375) + // Measured: `671` + // Estimated: `38638` + // Minimum execution time: 65_623_000 picoseconds. + Weight::from_parts(88_392_610, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_572, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_635, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -357,12 +357,12 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 10_914_264_000 picoseconds. - Weight::from_parts(278_764_650, 34312) - // Standard Error: 156_493 - .saturating_add(Weight::from_parts(53_766_782, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_517, 0).saturating_mul(s.into())) + // Minimum execution time: 11_247_503_000 picoseconds. + Weight::from_parts(302_469_923, 34312) + // Standard Error: 147_459 + .saturating_add(Weight::from_parts(54_400_528, 0).saturating_mul(c.into())) + // Standard Error: 8 + .saturating_add(Weight::from_parts(2_571, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)) } @@ -371,10 +371,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 55_487_000 picoseconds. - Weight::from_parts(31_180_048, 23853) + // Minimum execution time: 56_802_000 picoseconds. + Weight::from_parts(33_250_791, 23853) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_177, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -383,10 +383,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `451` // Estimated: `27177` - // Minimum execution time: 59_745_000 picoseconds. - Weight::from_parts(32_264_542, 27177) + // Minimum execution time: 59_487_000 picoseconds. + Weight::from_parts(37_481_444, 27177) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_185, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } @@ -395,10 +395,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 83_935_000 picoseconds. - Weight::from_parts(67_556_120, 42227) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_190, 0).saturating_mul(p.into())) + // Minimum execution time: 86_239_000 picoseconds. + Weight::from_parts(32_106_516, 42227) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -407,22 +407,20 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1081` // Estimated: `45757` - // Minimum execution time: 95_523_000 picoseconds. - Weight::from_parts(67_846_891, 45757) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_213, 0).saturating_mul(p.into())) + // Minimum execution time: 98_413_000 picoseconds. + Weight::from_parts(52_381_439, 45757) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 306_381_000 picoseconds. - Weight::from_parts(319_153_310, 74319) - // Standard Error: 1_387 - .saturating_add(Weight::from_parts(6_138, 0).saturating_mul(q.into())) + // Minimum execution time: 302_634_000 picoseconds. + Weight::from_parts(320_223_637, 74319) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -431,10 +429,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 319_572_000 picoseconds. - Weight::from_parts(332_017_272, 74319) - // Standard Error: 1_262 - .saturating_add(Weight::from_parts(2_004, 0).saturating_mul(q.into())) + // Minimum execution time: 315_859_000 picoseconds. + Weight::from_parts(328_138_594, 74319) + // Standard Error: 1_557 + .saturating_add(Weight::from_parts(8_014, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -443,10 +441,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 47_252_000 picoseconds. - Weight::from_parts(47_900_000, 3899) - // Standard Error: 26_716 - .saturating_add(Weight::from_parts(51_791_764, 0).saturating_mul(c.into())) + // Minimum execution time: 45_804_000 picoseconds. + Weight::from_parts(46_226_000, 3899) + // Standard Error: 51_090 + .saturating_add(Weight::from_parts(51_940_069, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -456,630 +454,630 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_222_000 picoseconds. - Weight::from_parts(87_003_000, 0) - // Standard Error: 4_412_345 - .saturating_add(Weight::from_parts(709_555_221, 0).saturating_mul(r.into())) + // Minimum execution time: 80_872_000 picoseconds. + Weight::from_parts(82_358_000, 0) + // Standard Error: 3_946_533 + .saturating_add(Weight::from_parts(617_270_552, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 418_248_000 picoseconds. - Weight::from_parts(357_180_796, 0) - // Standard Error: 10_036 - .saturating_add(Weight::from_parts(34_125_905, 0).saturating_mul(p.into())) + // Minimum execution time: 365_182_000 picoseconds. + Weight::from_parts(292_523_651, 0) + // Standard Error: 7_087 + .saturating_add(Weight::from_parts(31_059_002, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 252_299_000 picoseconds. - Weight::from_parts(290_811_825, 0) - // Standard Error: 441_558 - .saturating_add(Weight::from_parts(168_655_080, 0).saturating_mul(r.into())) + // Minimum execution time: 196_771_000 picoseconds. + Weight::from_parts(219_836_156, 0) + // Standard Error: 406_704 + .saturating_add(Weight::from_parts(120_742_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_637_000 picoseconds. - Weight::from_parts(93_539_683, 0) - // Standard Error: 5_764 - .saturating_add(Weight::from_parts(4_269_453, 0).saturating_mul(r.into())) + // Minimum execution time: 86_043_000 picoseconds. + Weight::from_parts(92_117_781, 0) + // Standard Error: 7_334 + .saturating_add(Weight::from_parts(3_640_301, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_667_000 picoseconds. - Weight::from_parts(153_461_952, 0) - // Standard Error: 28_015 - .saturating_add(Weight::from_parts(4_740_934, 0).saturating_mul(r.into())) + // Minimum execution time: 146_803_000 picoseconds. + Weight::from_parts(168_908_676, 0) + // Standard Error: 28_070 + .saturating_add(Weight::from_parts(3_989_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_605_000 picoseconds. - Weight::from_parts(115_078_201, 0) - // Standard Error: 420_788 - .saturating_add(Weight::from_parts(235_062_438, 0).saturating_mul(r.into())) + // Minimum execution time: 82_421_000 picoseconds. + Weight::from_parts(109_902_108, 0) + // Standard Error: 458_197 + .saturating_add(Weight::from_parts(186_560_355, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_883_000 picoseconds. - Weight::from_parts(84_013_989, 0) - // Standard Error: 315_983 - .saturating_add(Weight::from_parts(233_618_600, 0).saturating_mul(r.into())) + // Minimum execution time: 85_173_000 picoseconds. + Weight::from_parts(81_703_608, 0) + // Standard Error: 318_823 + .saturating_add(Weight::from_parts(183_602_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_674_000 picoseconds. - Weight::from_parts(84_138_097, 0) - // Standard Error: 394_031 - .saturating_add(Weight::from_parts(234_112_935, 0).saturating_mul(r.into())) + // Minimum execution time: 85_999_000 picoseconds. + Weight::from_parts(81_002_605, 0) + // Standard Error: 269_075 + .saturating_add(Weight::from_parts(183_154_106, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_037_000 picoseconds. - Weight::from_parts(80_043_119, 0) - // Standard Error: 363_071 - .saturating_add(Weight::from_parts(234_440_419, 0).saturating_mul(r.into())) + // Minimum execution time: 82_306_000 picoseconds. + Weight::from_parts(79_166_166, 0) + // Standard Error: 332_502 + .saturating_add(Weight::from_parts(182_666_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_970_000 picoseconds. - Weight::from_parts(79_191_736, 0) - // Standard Error: 388_386 - .saturating_add(Weight::from_parts(234_797_123, 0).saturating_mul(r.into())) + // Minimum execution time: 82_459_000 picoseconds. + Weight::from_parts(80_301_392, 0) + // Standard Error: 340_598 + .saturating_add(Weight::from_parts(184_099_120, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_955_000 picoseconds. - Weight::from_parts(76_258_811, 0) - // Standard Error: 378_019 - .saturating_add(Weight::from_parts(235_845_928, 0).saturating_mul(r.into())) + // Minimum execution time: 81_140_000 picoseconds. + Weight::from_parts(72_987_262, 0) + // Standard Error: 388_909 + .saturating_add(Weight::from_parts(186_920_851, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_420_000 picoseconds. - Weight::from_parts(80_595_371, 0) - // Standard Error: 321_668 - .saturating_add(Weight::from_parts(234_918_409, 0).saturating_mul(r.into())) + // Minimum execution time: 81_336_000 picoseconds. + Weight::from_parts(79_078_269, 0) + // Standard Error: 276_322 + .saturating_add(Weight::from_parts(182_690_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_641_000 picoseconds. - Weight::from_parts(79_056_207, 0) - // Standard Error: 372_009 - .saturating_add(Weight::from_parts(236_443_753, 0).saturating_mul(r.into())) + // Minimum execution time: 84_201_000 picoseconds. + Weight::from_parts(79_459_558, 0) + // Standard Error: 357_406 + .saturating_add(Weight::from_parts(182_989_857, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 712_026_000 picoseconds. - Weight::from_parts(757_785_668, 0) - // Standard Error: 464_262 - .saturating_add(Weight::from_parts(317_512_842, 0).saturating_mul(r.into())) + // Minimum execution time: 709_298_000 picoseconds. + Weight::from_parts(792_701_124, 0) + // Standard Error: 581_476 + .saturating_add(Weight::from_parts(264_833_637, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 977_690_000 picoseconds. - Weight::from_parts(991_462_000, 0) - // Standard Error: 58_744 - .saturating_add(Weight::from_parts(13_316_633, 0).saturating_mul(n.into())) + // Minimum execution time: 958_553_000 picoseconds. + Weight::from_parts(1_002_082_000, 0) + // Standard Error: 51_056 + .saturating_add(Weight::from_parts(13_349_580, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_258_000 picoseconds. - Weight::from_parts(75_200_329, 0) - // Standard Error: 367_397 - .saturating_add(Weight::from_parts(234_793_089, 0).saturating_mul(r.into())) + // Minimum execution time: 81_092_000 picoseconds. + Weight::from_parts(70_460_333, 0) + // Standard Error: 322_779 + .saturating_add(Weight::from_parts(182_652_206, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_774_000 picoseconds. - Weight::from_parts(86_726_743, 0) - // Standard Error: 344_677 - .saturating_add(Weight::from_parts(232_758_004, 0).saturating_mul(r.into())) + // Minimum execution time: 82_315_000 picoseconds. + Weight::from_parts(77_285_940, 0) + // Standard Error: 310_862 + .saturating_add(Weight::from_parts(183_154_588, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_660_000 picoseconds. - Weight::from_parts(107_246_381, 0) - // Standard Error: 450_595 - .saturating_add(Weight::from_parts(299_226_823, 0).saturating_mul(n.into())) + // Minimum execution time: 82_813_000 picoseconds. + Weight::from_parts(83_631_977, 0) + // Standard Error: 426_894 + .saturating_add(Weight::from_parts(250_044_040, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_608_000 picoseconds. - Weight::from_parts(88_218_000, 0) - // Standard Error: 3_603_226 - .saturating_add(Weight::from_parts(1_138_570_591, 0).saturating_mul(r.into())) + // Minimum execution time: 87_342_000 picoseconds. + Weight::from_parts(88_861_000, 0) + // Standard Error: 4_034_065 + .saturating_add(Weight::from_parts(1_070_363_129, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_028_000 picoseconds. - Weight::from_parts(148_854_569, 0) - // Standard Error: 521_593 - .saturating_add(Weight::from_parts(444_403_185, 0).saturating_mul(r.into())) + // Minimum execution time: 82_887_000 picoseconds. + Weight::from_parts(154_402_402, 0) + // Standard Error: 504_137 + .saturating_add(Weight::from_parts(389_538_545, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 526_298_000 picoseconds. - Weight::from_parts(529_334_000, 0) - // Standard Error: 64_334 - .saturating_add(Weight::from_parts(21_542_119, 0).saturating_mul(n.into())) + // Minimum execution time: 467_573_000 picoseconds. + Weight::from_parts(471_685_000, 0) + // Standard Error: 64_140 + .saturating_add(Weight::from_parts(22_109_126, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_355_000 picoseconds. - Weight::from_parts(150_399_219, 0) - // Standard Error: 494_235 - .saturating_add(Weight::from_parts(448_618_346, 0).saturating_mul(r.into())) + // Minimum execution time: 86_853_000 picoseconds. + Weight::from_parts(152_053_498, 0) + // Standard Error: 538_330 + .saturating_add(Weight::from_parts(397_711_575, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 527_623_000 picoseconds. - Weight::from_parts(531_388_000, 0) - // Standard Error: 68_048 - .saturating_add(Weight::from_parts(21_511_303, 0).saturating_mul(n.into())) + // Minimum execution time: 471_875_000 picoseconds. + Weight::from_parts(475_692_000, 0) + // Standard Error: 57_997 + .saturating_add(Weight::from_parts(21_385_701, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_514_000 picoseconds. - Weight::from_parts(770_347_767, 0) - // Standard Error: 491_305 - .saturating_add(Weight::from_parts(460_521_622, 0).saturating_mul(r.into())) + // Minimum execution time: 716_684_000 picoseconds. + Weight::from_parts(781_328_373, 0) + // Standard Error: 479_933 + .saturating_add(Weight::from_parts(411_727_995, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 727_797_000 picoseconds. - Weight::from_parts(796_951_141, 0) - // Standard Error: 511_348 - .saturating_add(Weight::from_parts(465_952_417, 0).saturating_mul(r.into())) + // Minimum execution time: 746_421_000 picoseconds. + Weight::from_parts(889_163_923, 0) + // Standard Error: 621_967 + .saturating_add(Weight::from_parts(412_763_026, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_511_000 picoseconds. - Weight::from_parts(70_108_276, 0) - // Standard Error: 369_170 - .saturating_add(Weight::from_parts(244_926_400, 0).saturating_mul(r.into())) + // Minimum execution time: 81_961_000 picoseconds. + Weight::from_parts(86_031_226, 0) + // Standard Error: 355_690 + .saturating_add(Weight::from_parts(191_347_968, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_504_000 picoseconds. - Weight::from_parts(4_938_314_567, 0) - // Standard Error: 404_342 - .saturating_add(Weight::from_parts(338_431_048, 0).saturating_mul(r.into())) + // Minimum execution time: 3_797_807_000 picoseconds. + Weight::from_parts(3_948_397_472, 0) + // Standard Error: 396_090 + .saturating_add(Weight::from_parts(284_341_649, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 591_844_000 picoseconds. - Weight::from_parts(598_128_000, 0) - // Standard Error: 54_800 - .saturating_add(Weight::from_parts(31_272_502, 0).saturating_mul(n.into())) + // Minimum execution time: 485_799_000 picoseconds. + Weight::from_parts(486_862_000, 0) + // Standard Error: 47_704 + .saturating_add(Weight::from_parts(31_360_292, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_559_000 picoseconds. - Weight::from_parts(4_953_984_624, 0) - // Standard Error: 454_672 - .saturating_add(Weight::from_parts(391_509_821, 0).saturating_mul(r.into())) + // Minimum execution time: 3_842_120_000 picoseconds. + Weight::from_parts(3_943_431_716, 0) + // Standard Error: 766_406 + .saturating_add(Weight::from_parts(339_379_953, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_774_023_000 picoseconds. - Weight::from_parts(4_926_440_375, 0) - // Standard Error: 406_352 - .saturating_add(Weight::from_parts(410_066_296, 0).saturating_mul(r.into())) + // Minimum execution time: 3_828_327_000 picoseconds. + Weight::from_parts(3_976_283_101, 0) + // Standard Error: 768_169 + .saturating_add(Weight::from_parts(353_252_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 252_283_000 picoseconds. - Weight::from_parts(317_036_023, 0) - // Standard Error: 491_835 - .saturating_add(Weight::from_parts(459_054_688, 0).saturating_mul(r.into())) + // Minimum execution time: 256_679_000 picoseconds. + Weight::from_parts(330_245_572, 0) + // Standard Error: 519_345 + .saturating_add(Weight::from_parts(404_879_225, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 690_374_000 picoseconds. - Weight::from_parts(696_614_000, 0) - // Standard Error: 57_727 - .saturating_add(Weight::from_parts(21_193_900, 0).saturating_mul(n.into())) + // Minimum execution time: 640_004_000 picoseconds. + Weight::from_parts(646_769_000, 0) + // Standard Error: 55_122 + .saturating_add(Weight::from_parts(21_616_125, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_942_359_000 picoseconds. - Weight::from_parts(5_078_327_071, 0) - // Standard Error: 452_216 - .saturating_add(Weight::from_parts(410_586_501, 0).saturating_mul(r.into())) + // Minimum execution time: 3_981_155_000 picoseconds. + Weight::from_parts(4_086_072_221, 0) + // Standard Error: 1_076_069 + .saturating_add(Weight::from_parts(362_989_310, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_677_000 picoseconds. - Weight::from_parts(88_427_695, 0) - // Standard Error: 289_964 - .saturating_add(Weight::from_parts(20_836_104, 0).saturating_mul(r.into())) + // Minimum execution time: 84_145_000 picoseconds. + Weight::from_parts(88_260_563, 0) + // Standard Error: 277_576 + .saturating_add(Weight::from_parts(20_209_036, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_884_000 picoseconds. - Weight::from_parts(94_128_638, 0) - // Standard Error: 1_150 - .saturating_add(Weight::from_parts(427_959, 0).saturating_mul(n.into())) + // Minimum execution time: 102_930_000 picoseconds. + Weight::from_parts(90_280_376, 0) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(427_777, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_126_000 picoseconds. - Weight::from_parts(91_658_518, 0) - // Standard Error: 269_208 - .saturating_add(Weight::from_parts(19_110_181, 0).saturating_mul(r.into())) + // Minimum execution time: 84_156_000 picoseconds. + Weight::from_parts(89_778_763, 0) + // Standard Error: 365_767 + .saturating_add(Weight::from_parts(24_157_936, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_968_000 picoseconds. - Weight::from_parts(96_214_665, 0) - // Standard Error: 1_051 - .saturating_add(Weight::from_parts(424_356, 0).saturating_mul(n.into())) + // Minimum execution time: 105_315_000 picoseconds. + Weight::from_parts(94_894_394, 0) + // Standard Error: 993 + .saturating_add(Weight::from_parts(426_364, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_080_000 picoseconds. - Weight::from_parts(88_919_016, 0) - // Standard Error: 290_610 - .saturating_add(Weight::from_parts(20_031_683, 0).saturating_mul(r.into())) + // Minimum execution time: 81_595_000 picoseconds. + Weight::from_parts(86_259_504, 0) + // Standard Error: 284_882 + .saturating_add(Weight::from_parts(25_873_595, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_877_000 picoseconds. - Weight::from_parts(89_997_934, 0) - // Standard Error: 353_369 - .saturating_add(Weight::from_parts(21_258_265, 0).saturating_mul(r.into())) + // Minimum execution time: 80_771_000 picoseconds. + Weight::from_parts(85_313_802, 0) + // Standard Error: 265_474 + .saturating_add(Weight::from_parts(25_863_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_914_000 picoseconds. - Weight::from_parts(128_101_726, 0) - // Standard Error: 456_540 - .saturating_add(Weight::from_parts(327_004_586, 0).saturating_mul(r.into())) + // Minimum execution time: 82_396_000 picoseconds. + Weight::from_parts(126_819_617, 0) + // Standard Error: 518_749 + .saturating_add(Weight::from_parts(272_821_836, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_098_000 picoseconds. - Weight::from_parts(107_176_000, 0) - // Standard Error: 2_365 - .saturating_add(Weight::from_parts(643_572, 0).saturating_mul(n.into())) + // Minimum execution time: 98_266_000 picoseconds. + Weight::from_parts(100_843_000, 0) + // Standard Error: 2_828 + .saturating_add(Weight::from_parts(662_117, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_872_000 picoseconds. - Weight::from_parts(729_697_981, 0) - // Standard Error: 1_976_351 - .saturating_add(Weight::from_parts(36_344_818, 0).saturating_mul(r.into())) + // Minimum execution time: 707_150_000 picoseconds. + Weight::from_parts(754_398_128, 0) + // Standard Error: 5_119_788 + .saturating_add(Weight::from_parts(7_037_071, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_823_000 picoseconds. - Weight::from_parts(739_731_189, 0) - // Standard Error: 3_069_948 - .saturating_add(Weight::from_parts(1_778_910, 0).saturating_mul(r.into())) + // Minimum execution time: 712_091_000 picoseconds. + Weight::from_parts(751_999_544, 0) + // Standard Error: 4_003_265 + .saturating_add(Weight::from_parts(43_818_555, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_313_000 picoseconds. - Weight::from_parts(101_011_510, 0) - // Standard Error: 309_893 - .saturating_add(Weight::from_parts(12_424_889, 0).saturating_mul(r.into())) + // Minimum execution time: 92_234_000 picoseconds. + Weight::from_parts(96_192_773, 0) + // Standard Error: 271_871 + .saturating_add(Weight::from_parts(13_338_726, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 110_082_000 picoseconds. - Weight::from_parts(94_741_351, 0) - // Standard Error: 1_210 - .saturating_add(Weight::from_parts(428_098, 0).saturating_mul(n.into())) + // Minimum execution time: 108_190_000 picoseconds. + Weight::from_parts(92_525_926, 0) + // Standard Error: 1_134 + .saturating_add(Weight::from_parts(433_806, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_144_000 picoseconds. - Weight::from_parts(100_819_965, 0) - // Standard Error: 312_160 - .saturating_add(Weight::from_parts(12_498_034, 0).saturating_mul(r.into())) + // Minimum execution time: 92_297_000 picoseconds. + Weight::from_parts(98_054_616, 0) + // Standard Error: 394_791 + .saturating_add(Weight::from_parts(7_680_683, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_817_000 picoseconds. - Weight::from_parts(98_997_460, 0) - // Standard Error: 911 - .saturating_add(Weight::from_parts(418_183, 0).saturating_mul(n.into())) + // Minimum execution time: 106_932_000 picoseconds. + Weight::from_parts(91_150_785, 0) + // Standard Error: 1_067 + .saturating_add(Weight::from_parts(424_570, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_937_000 picoseconds. - Weight::from_parts(79_415_972, 0) - // Standard Error: 348_880 - .saturating_add(Weight::from_parts(235_937_217, 0).saturating_mul(r.into())) + // Minimum execution time: 80_591_000 picoseconds. + Weight::from_parts(79_590_461, 0) + // Standard Error: 360_038 + .saturating_add(Weight::from_parts(185_313_242, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_627_000 picoseconds. - Weight::from_parts(83_675_859, 0) - // Standard Error: 339_403 - .saturating_add(Weight::from_parts(235_762_764, 0).saturating_mul(r.into())) + // Minimum execution time: 83_379_000 picoseconds. + Weight::from_parts(82_304_672, 0) + // Standard Error: 371_508 + .saturating_add(Weight::from_parts(184_895_719, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 716_756_000 picoseconds. - Weight::from_parts(761_461_420, 0) - // Standard Error: 454_456 - .saturating_add(Weight::from_parts(248_489_654, 0).saturating_mul(r.into())) + // Minimum execution time: 714_906_000 picoseconds. + Weight::from_parts(784_837_322, 0) + // Standard Error: 485_874 + .saturating_add(Weight::from_parts(198_529_306, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 732_309_000 picoseconds. - Weight::from_parts(759_387_651, 0) - // Standard Error: 1_129 - .saturating_add(Weight::from_parts(146_886, 0).saturating_mul(n.into())) + // Minimum execution time: 735_164_000 picoseconds. + Weight::from_parts(760_829_418, 0) + // Standard Error: 2_049 + .saturating_add(Weight::from_parts(164_862, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_427_965_000 picoseconds. - Weight::from_parts(5_584_572_405, 0) - // Standard Error: 509_610 - .saturating_add(Weight::from_parts(266_723_710, 0).saturating_mul(r.into())) + // Minimum execution time: 4_467_125_000 picoseconds. + Weight::from_parts(4_668_343_697, 0) + // Standard Error: 529_569 + .saturating_add(Weight::from_parts(214_709_155, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_746_904_000 picoseconds. - Weight::from_parts(5_825_570_819, 0) - // Standard Error: 10_085 - .saturating_add(Weight::from_parts(13_639_502, 0).saturating_mul(n.into())) + // Minimum execution time: 4_716_693_000 picoseconds. + Weight::from_parts(4_810_590_943, 0) + // Standard Error: 12_440 + .saturating_add(Weight::from_parts(13_814_475, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_800_000 picoseconds. - Weight::from_parts(107_792_324, 0) - // Standard Error: 431_628 - .saturating_add(Weight::from_parts(246_303_550, 0).saturating_mul(r.into())) + // Minimum execution time: 81_721_000 picoseconds. + Weight::from_parts(95_360_878, 0) + // Standard Error: 488_163 + .saturating_add(Weight::from_parts(198_923_476, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 235_563_000 picoseconds. - Weight::from_parts(238_625_000, 0) - // Standard Error: 50_499 - .saturating_add(Weight::from_parts(25_511_187, 0).saturating_mul(n.into())) + // Minimum execution time: 189_069_000 picoseconds. + Weight::from_parts(191_834_000, 0) + // Standard Error: 53_942 + .saturating_add(Weight::from_parts(26_059_121, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_947_000 picoseconds. - Weight::from_parts(89_682_740, 0) - // Standard Error: 348_317 - .saturating_add(Weight::from_parts(234_018_615, 0).saturating_mul(r.into())) + // Minimum execution time: 83_023_000 picoseconds. + Weight::from_parts(70_919_161, 0) + // Standard Error: 442_134 + .saturating_add(Weight::from_parts(186_467_769, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_100_000 picoseconds. - Weight::from_parts(87_707_777, 0) - // Standard Error: 258_445 - .saturating_add(Weight::from_parts(29_983_122, 0).saturating_mul(r.into())) + // Minimum execution time: 80_187_000 picoseconds. + Weight::from_parts(86_256_124, 0) + // Standard Error: 333_120 + .saturating_add(Weight::from_parts(27_182_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_620_000 picoseconds. - Weight::from_parts(88_230_306, 0) - // Standard Error: 272_978 - .saturating_add(Weight::from_parts(17_120_893, 0).saturating_mul(r.into())) + // Minimum execution time: 80_373_000 picoseconds. + Weight::from_parts(83_957_387, 0) + // Standard Error: 258_914 + .saturating_add(Weight::from_parts(14_637_112, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_978_000 picoseconds. - Weight::from_parts(91_119_451, 0) - // Standard Error: 269_369 - .saturating_add(Weight::from_parts(15_184_548, 0).saturating_mul(r.into())) + // Minimum execution time: 82_886_000 picoseconds. + Weight::from_parts(86_536_767, 0) + // Standard Error: 237_087 + .saturating_add(Weight::from_parts(15_456_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_688_000 picoseconds. - Weight::from_parts(90_189_414, 0) - // Standard Error: 273_180 - .saturating_add(Weight::from_parts(15_680_285, 0).saturating_mul(r.into())) + // Minimum execution time: 82_962_000 picoseconds. + Weight::from_parts(87_038_165, 0) + // Standard Error: 267_652 + .saturating_add(Weight::from_parts(14_141_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_875_000 picoseconds. - Weight::from_parts(88_169_159, 0) - // Standard Error: 275_439 - .saturating_add(Weight::from_parts(14_520_840, 0).saturating_mul(r.into())) + // Minimum execution time: 82_976_000 picoseconds. + Weight::from_parts(87_105_967, 0) + // Standard Error: 237_581 + .saturating_add(Weight::from_parts(13_365_932, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_675_000 picoseconds. - Weight::from_parts(223_939_434, 0) - // Standard Error: 432_414 - .saturating_add(Weight::from_parts(337_824_841, 0).saturating_mul(r.into())) + // Minimum execution time: 139_585_000 picoseconds. + Weight::from_parts(203_512_831, 0) + // Standard Error: 393_346 + .saturating_add(Weight::from_parts(283_538_921, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 94_934_000 picoseconds. - Weight::from_parts(156_494_816, 0) - // Standard Error: 447_955 - .saturating_add(Weight::from_parts(528_564_684, 0).saturating_mul(r.into())) + // Minimum execution time: 98_330_000 picoseconds. + Weight::from_parts(158_669_516, 0) + // Standard Error: 440_421 + .saturating_add(Weight::from_parts(473_163_025, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1087,22 +1085,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_437_864_000 picoseconds. - Weight::from_parts(46_530_376_000, 0) - // Standard Error: 266_354 - .saturating_add(Weight::from_parts(7_234_250, 0).saturating_mul(p.into())) - // Standard Error: 266_341 - .saturating_add(Weight::from_parts(176_106_088, 0).saturating_mul(s.into())) + // Minimum execution time: 43_492_772_000 picoseconds. + Weight::from_parts(43_692_998_000, 0) + // Standard Error: 263_249 + .saturating_add(Weight::from_parts(8_169_821, 0).saturating_mul(p.into())) + // Standard Error: 263_236 + .saturating_add(Weight::from_parts(180_732_778, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_476_000 picoseconds. - Weight::from_parts(153_424_122, 0) - // Standard Error: 465_906 - .saturating_add(Weight::from_parts(532_257_834, 0).saturating_mul(r.into())) + // Minimum execution time: 97_189_000 picoseconds. + Weight::from_parts(158_677_248, 0) + // Standard Error: 452_648 + .saturating_add(Weight::from_parts(478_043_506, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1110,32 +1108,32 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_304_524_000 picoseconds. - Weight::from_parts(46_363_097_000, 0) - // Standard Error: 282_696 - .saturating_add(Weight::from_parts(6_905_555, 0).saturating_mul(p.into())) - // Standard Error: 282_682 - .saturating_add(Weight::from_parts(176_467_418, 0).saturating_mul(s.into())) + // Minimum execution time: 43_613_488_000 picoseconds. + Weight::from_parts(43_758_304_000, 0) + // Standard Error: 268_412 + .saturating_add(Weight::from_parts(7_987_894, 0).saturating_mul(p.into())) + // Standard Error: 268_399 + .saturating_add(Weight::from_parts(180_769_004, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_152_000 picoseconds. - Weight::from_parts(103_953_387, 0) - // Standard Error: 31_619 - .saturating_add(Weight::from_parts(4_051_743, 0).saturating_mul(r.into())) + // Minimum execution time: 84_210_000 picoseconds. + Weight::from_parts(99_996_695, 0) + // Standard Error: 31_808 + .saturating_add(Weight::from_parts(3_523_987, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_577_000 picoseconds. - Weight::from_parts(130_463_800, 1131) - // Standard Error: 8_489 - .saturating_add(Weight::from_parts(12_233_025, 0).saturating_mul(p.into())) + // Minimum execution time: 82_940_000 picoseconds. + Weight::from_parts(123_540_441, 1131) + // Standard Error: 7_143 + .saturating_add(Weight::from_parts(11_789_871, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1144,10 +1142,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_637_000 picoseconds. - Weight::from_parts(87_209_000, 1131) - // Standard Error: 34_392 - .saturating_add(Weight::from_parts(35_611_270, 0).saturating_mul(p.into())) + // Minimum execution time: 83_752_000 picoseconds. + Weight::from_parts(84_858_000, 1131) + // Standard Error: 48_161 + .saturating_add(Weight::from_parts(36_181_117, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1156,10 +1154,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_359_334_000 picoseconds. - Weight::from_parts(6_121_083_942, 5069931) - // Standard Error: 63_810 - .saturating_add(Weight::from_parts(36_566_054, 0).saturating_mul(p.into())) + // Minimum execution time: 6_125_138_000 picoseconds. + Weight::from_parts(5_869_525_563, 5069931) + // Standard Error: 46_521 + .saturating_add(Weight::from_parts(36_899_111, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1167,10 +1165,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_837_000 picoseconds. - Weight::from_parts(86_734_000, 1939) - // Standard Error: 52_031 - .saturating_add(Weight::from_parts(47_935_831, 0).saturating_mul(p.into())) + // Minimum execution time: 82_516_000 picoseconds. + Weight::from_parts(83_470_000, 1939) + // Standard Error: 29_769 + .saturating_add(Weight::from_parts(46_665_657, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1179,10 +1177,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 91_093_000 picoseconds. - Weight::from_parts(89_453_904, 1131) - // Standard Error: 67_270 - .saturating_add(Weight::from_parts(36_623_289, 0).saturating_mul(p.into())) + // Minimum execution time: 87_344_000 picoseconds. + Weight::from_parts(94_873_151, 1131) + // Standard Error: 55_429 + .saturating_add(Weight::from_parts(35_724_871, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1191,10 +1189,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 742_900_000 picoseconds. - Weight::from_parts(797_212_869, 1496) - // Standard Error: 203_408 - .saturating_add(Weight::from_parts(39_864_931, 0).saturating_mul(p.into())) + // Minimum execution time: 735_393_000 picoseconds. + Weight::from_parts(754_062_397, 1496) + // Standard Error: 166_437 + .saturating_add(Weight::from_parts(43_966_900, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1203,10 +1201,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_154_233_000 picoseconds. - Weight::from_parts(1_168_913_585, 317931) - // Standard Error: 156_513 - .saturating_add(Weight::from_parts(40_911_219, 0).saturating_mul(p.into())) + // Minimum execution time: 1_124_371_000 picoseconds. + Weight::from_parts(1_147_901_415, 317931) + // Standard Error: 145_342 + .saturating_add(Weight::from_parts(43_795_511, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1214,164 +1212,164 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_637_000 picoseconds. - Weight::from_parts(1_579_535, 0) - // Standard Error: 10_282 - .saturating_add(Weight::from_parts(23_979_117, 0).saturating_mul(r.into())) + // Minimum execution time: 1_510_000 picoseconds. + Weight::from_parts(1_448_006, 0) + // Standard Error: 9_868 + .saturating_add(Weight::from_parts(24_061_691, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_100_000 picoseconds. - Weight::from_parts(4_301_699_118, 0) - // Standard Error: 35_988 - .saturating_add(Weight::from_parts(3_646_485, 0).saturating_mul(r.into())) + // Minimum execution time: 4_337_991_000 picoseconds. + Weight::from_parts(4_151_991_287, 0) + // Standard Error: 60_683 + .saturating_add(Weight::from_parts(4_818_799, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_335_883_000 picoseconds. - Weight::from_parts(4_309_192_543, 0) - // Standard Error: 54_788 - .saturating_add(Weight::from_parts(3_782_929, 0).saturating_mul(r.into())) + // Minimum execution time: 4_341_162_000 picoseconds. + Weight::from_parts(4_200_807_294, 0) + // Standard Error: 51_442 + .saturating_add(Weight::from_parts(4_527_839, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_564_573_000 picoseconds. - Weight::from_parts(11_470_489_007, 0) - // Standard Error: 145_973 - .saturating_add(Weight::from_parts(9_000_414, 0).saturating_mul(r.into())) + // Minimum execution time: 10_322_767_000 picoseconds. + Weight::from_parts(11_038_976_057, 0) + // Standard Error: 150_113 + .saturating_add(Weight::from_parts(10_655_640, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_413_294_000 picoseconds. - Weight::from_parts(10_646_734_527, 0) - // Standard Error: 186_523 - .saturating_add(Weight::from_parts(10_318_180, 0).saturating_mul(r.into())) + // Minimum execution time: 10_367_826_000 picoseconds. + Weight::from_parts(11_310_983_745, 0) + // Standard Error: 145_202 + .saturating_add(Weight::from_parts(7_541_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 8_412 - .saturating_add(Weight::from_parts(3_826_675, 0).saturating_mul(r.into())) + // Minimum execution time: 2_251_000 picoseconds. + Weight::from_parts(2_304_000, 0) + // Standard Error: 8_520 + .saturating_add(Weight::from_parts(3_798_413, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 6_151 - .saturating_add(Weight::from_parts(3_061_817, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(573_722, 0) + // Standard Error: 11_642 + .saturating_add(Weight::from_parts(3_174_691, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_229_000 picoseconds. - Weight::from_parts(3_426_438, 0) - // Standard Error: 1_152 - .saturating_add(Weight::from_parts(1_567_482, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(3_155_512, 0) + // Standard Error: 1_212 + .saturating_add(Weight::from_parts(1_586_585, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_263_000, 0) - // Standard Error: 9_581 - .saturating_add(Weight::from_parts(2_965_066, 0).saturating_mul(r.into())) + // Minimum execution time: 2_160_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 8_627 + .saturating_add(Weight::from_parts(2_929_529, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_792_586, 0) - // Standard Error: 14_585 - .saturating_add(Weight::from_parts(5_083_752, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(1_609_241, 0) + // Standard Error: 19_812 + .saturating_add(Weight::from_parts(5_162_833, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_660_000 picoseconds. - Weight::from_parts(6_432_123, 0) - // Standard Error: 1_897 - .saturating_add(Weight::from_parts(133_494, 0).saturating_mul(e.into())) + // Minimum execution time: 6_892_000 picoseconds. + Weight::from_parts(5_316_811, 0) + // Standard Error: 1_578 + .saturating_add(Weight::from_parts(163_377, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(4_331_035, 0) - // Standard Error: 6_255 - .saturating_add(Weight::from_parts(2_559_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_304_000 picoseconds. + Weight::from_parts(4_554_683, 0) + // Standard Error: 7_319 + .saturating_add(Weight::from_parts(2_595_958, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_559_212 - - 2_413_142, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_595_958 - + 2_422_191, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(3_893_976, 0) - // Standard Error: 12_129 - .saturating_add(Weight::from_parts(2_413_142, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(5_046_075, 0) + // Standard Error: 13_702 + .saturating_add(Weight::from_parts(2_422_191, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_543_000 picoseconds. - Weight::from_parts(7_683_499, 0) - // Standard Error: 22_341 - .saturating_add(Weight::from_parts(10_324_116, 0).saturating_mul(r.into())) + // Minimum execution time: 2_684_000 picoseconds. + Weight::from_parts(17_324_871, 0) + // Standard Error: 38_532 + .saturating_add(Weight::from_parts(10_260_872, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_819_000 picoseconds. - Weight::from_parts(12_406_000, 0) - // Standard Error: 6_552 - .saturating_add(Weight::from_parts(1_132_455, 0).saturating_mul(p.into())) + // Minimum execution time: 12_206_000 picoseconds. + Weight::from_parts(2_634_425, 0) + // Standard Error: 5_954 + .saturating_add(Weight::from_parts(1_275_538, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_266_000 picoseconds. - Weight::from_parts(5_637_030, 0) - // Standard Error: 14 + // Minimum execution time: 5_288_000 picoseconds. + Weight::from_parts(5_570_870, 0) + // Standard Error: 12 .saturating_add(Weight::from_parts(61, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. @@ -1379,720 +1377,720 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_271_000 picoseconds. - Weight::from_parts(1_703_004, 0) - // Standard Error: 3_377 - .saturating_add(Weight::from_parts(252_219, 0).saturating_mul(r.into())) + // Minimum execution time: 2_203_000 picoseconds. + Weight::from_parts(1_788_159, 0) + // Standard Error: 3_152 + .saturating_add(Weight::from_parts(267_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_248_000, 0) - // Standard Error: 5_108 - .saturating_add(Weight::from_parts(763_832, 0).saturating_mul(r.into())) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_223_000, 0) + // Standard Error: 4_611 + .saturating_add(Weight::from_parts(721_127, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_302_000, 0) - // Standard Error: 5_040 - .saturating_add(Weight::from_parts(747_294, 0).saturating_mul(r.into())) + // Minimum execution time: 2_252_000 picoseconds. + Weight::from_parts(2_347_000, 0) + // Standard Error: 5_971 + .saturating_add(Weight::from_parts(742_209, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_251_000 picoseconds. - Weight::from_parts(1_658_576, 0) - // Standard Error: 9_292 - .saturating_add(Weight::from_parts(832_114, 0).saturating_mul(r.into())) + // Minimum execution time: 6_406_000 picoseconds. + Weight::from_parts(2_894_577, 0) + // Standard Error: 8_027 + .saturating_add(Weight::from_parts(801_493, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_366_000 picoseconds. - Weight::from_parts(6_431_000, 0) - // Standard Error: 10_465 - .saturating_add(Weight::from_parts(1_323_456, 0).saturating_mul(r.into())) + // Minimum execution time: 6_345_000 picoseconds. + Weight::from_parts(31_295, 0) + // Standard Error: 10_231 + .saturating_add(Weight::from_parts(1_543_569, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_241_000 picoseconds. - Weight::from_parts(1_511_304, 0) - // Standard Error: 11_616 - .saturating_add(Weight::from_parts(7_105_356, 0).saturating_mul(r.into())) + // Minimum execution time: 3_937_000 picoseconds. + Weight::from_parts(62_049, 0) + // Standard Error: 12_087 + .saturating_add(Weight::from_parts(7_172_920, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_186_000 picoseconds. - Weight::from_parts(2_232_000, 0) - // Standard Error: 5_638 - .saturating_add(Weight::from_parts(3_240_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_262_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 6_042 + .saturating_add(Weight::from_parts(3_394_526, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_238_000, 0) - // Standard Error: 6_253 - .saturating_add(Weight::from_parts(3_051_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_151_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 5_891 + .saturating_add(Weight::from_parts(3_138_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 6_246 - .saturating_add(Weight::from_parts(3_014_119, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_277_000, 0) + // Standard Error: 8_196 + .saturating_add(Weight::from_parts(3_167_033, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 4_860 - .saturating_add(Weight::from_parts(2_602_767, 0).saturating_mul(r.into())) + // Minimum execution time: 2_246_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 5_536 + .saturating_add(Weight::from_parts(2_668_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 3_577 - .saturating_add(Weight::from_parts(551_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(45_432, 0) + // Standard Error: 6_223 + .saturating_add(Weight::from_parts(645_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(1_480_989, 0) - // Standard Error: 3_344 - .saturating_add(Weight::from_parts(381_312, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(1_301_007, 0) + // Standard Error: 4_929 + .saturating_add(Weight::from_parts(446_280, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_251_000, 0) - // Standard Error: 11_018 - .saturating_add(Weight::from_parts(1_807_489, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_205_000, 0) + // Standard Error: 10_412 + .saturating_add(Weight::from_parts(1_894_722, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_219_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 7_919 - .saturating_add(Weight::from_parts(1_121_167, 0).saturating_mul(r.into())) + // Minimum execution time: 2_170_000 picoseconds. + Weight::from_parts(2_257_000, 0) + // Standard Error: 7_708 + .saturating_add(Weight::from_parts(1_162_246, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(1_457_189, 0) - // Standard Error: 3_846 - .saturating_add(Weight::from_parts(363_435, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(1_682_106, 0) + // Standard Error: 3_839 + .saturating_add(Weight::from_parts(384_381, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(1_738_887, 0) - // Standard Error: 3_502 - .saturating_add(Weight::from_parts(345_478, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(1_669_708, 0) + // Standard Error: 3_126 + .saturating_add(Weight::from_parts(384_474, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 3_606 - .saturating_add(Weight::from_parts(488_901, 0).saturating_mul(r.into())) + // Minimum execution time: 2_249_000 picoseconds. + Weight::from_parts(2_291_000, 0) + // Standard Error: 4_476 + .saturating_add(Weight::from_parts(497_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 3_193 - .saturating_add(Weight::from_parts(508_952, 0).saturating_mul(r.into())) + // Minimum execution time: 2_217_000 picoseconds. + Weight::from_parts(2_287_000, 0) + // Standard Error: 4_107 + .saturating_add(Weight::from_parts(524_095, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(458_524, 0) - // Standard Error: 4_582 - .saturating_add(Weight::from_parts(485_788, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(2_233_000, 0) + // Standard Error: 3_690 + .saturating_add(Weight::from_parts(501_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_235_000 picoseconds. - Weight::from_parts(1_405_338, 0) - // Standard Error: 3_418 - .saturating_add(Weight::from_parts(336_701, 0).saturating_mul(r.into())) + // Minimum execution time: 2_132_000 picoseconds. + Weight::from_parts(1_082_506, 0) + // Standard Error: 5_421 + .saturating_add(Weight::from_parts(400_448, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_703_008, 0) - // Standard Error: 2_198 - .saturating_add(Weight::from_parts(159_072, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(3_085_764, 0) + // Standard Error: 1_912 + .saturating_add(Weight::from_parts(162_384, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_814_821, 0) - // Standard Error: 1_823 - .saturating_add(Weight::from_parts(151_994, 0).saturating_mul(r.into())) + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_849_158, 0) + // Standard Error: 1_635 + .saturating_add(Weight::from_parts(153_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 10_432 - .saturating_add(Weight::from_parts(1_731_609, 0).saturating_mul(r.into())) + // Minimum execution time: 2_279_000 picoseconds. + Weight::from_parts(2_315_000, 0) + // Standard Error: 11_776 + .saturating_add(Weight::from_parts(1_779_477, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 6_705 - .saturating_add(Weight::from_parts(1_081_519, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 8_815 + .saturating_add(Weight::from_parts(1_197_093, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 9_924 - .saturating_add(Weight::from_parts(1_713_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_190_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 9_983 + .saturating_add(Weight::from_parts(1_838_257, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_207_000, 0) - // Standard Error: 7_700 - .saturating_add(Weight::from_parts(1_115_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 7_749 + .saturating_add(Weight::from_parts(1_165_862, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_175_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 9_760 - .saturating_add(Weight::from_parts(1_721_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_172_000 picoseconds. + Weight::from_parts(2_246_000, 0) + // Standard Error: 11_426 + .saturating_add(Weight::from_parts(1_828_814, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_143_000 picoseconds. - Weight::from_parts(2_264_000, 0) - // Standard Error: 8_446 - .saturating_add(Weight::from_parts(1_220_324, 0).saturating_mul(r.into())) + // Minimum execution time: 2_187_000 picoseconds. + Weight::from_parts(2_245_000, 0) + // Standard Error: 7_973 + .saturating_add(Weight::from_parts(1_145_613, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_361_000, 0) - // Standard Error: 8_442 - .saturating_add(Weight::from_parts(1_872_827, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_273_000, 0) + // Standard Error: 10_995 + .saturating_add(Weight::from_parts(1_789_814, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_989 - .saturating_add(Weight::from_parts(1_245_468, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_252_000, 0) + // Standard Error: 7_454 + .saturating_add(Weight::from_parts(1_207_539, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_242_000, 0) - // Standard Error: 9_083 - .saturating_add(Weight::from_parts(1_890_871, 0).saturating_mul(r.into())) + // Minimum execution time: 2_219_000 picoseconds. + Weight::from_parts(2_279_000, 0) + // Standard Error: 10_576 + .saturating_add(Weight::from_parts(1_855_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_165_000 picoseconds. - Weight::from_parts(2_269_000, 0) - // Standard Error: 6_819 - .saturating_add(Weight::from_parts(1_201_641, 0).saturating_mul(r.into())) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_265_000, 0) + // Standard Error: 7_405 + .saturating_add(Weight::from_parts(1_180_265, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_236_000, 0) - // Standard Error: 9_879 - .saturating_add(Weight::from_parts(1_860_276, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_285_000, 0) + // Standard Error: 10_994 + .saturating_add(Weight::from_parts(1_835_344, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_144_000 picoseconds. - Weight::from_parts(2_226_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_149_019, 0).saturating_mul(r.into())) + // Minimum execution time: 2_222_000 picoseconds. + Weight::from_parts(2_277_000, 0) + // Standard Error: 7_826 + .saturating_add(Weight::from_parts(1_163_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_259_000, 0) - // Standard Error: 9_793 - .saturating_add(Weight::from_parts(1_816_684, 0).saturating_mul(r.into())) + // Minimum execution time: 2_102_000 picoseconds. + Weight::from_parts(2_217_000, 0) + // Standard Error: 11_374 + .saturating_add(Weight::from_parts(1_910_004, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_280_000, 0) - // Standard Error: 7_439 - .saturating_add(Weight::from_parts(1_151_067, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_303_000, 0) + // Standard Error: 8_971 + .saturating_add(Weight::from_parts(1_182_859, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 10_695 - .saturating_add(Weight::from_parts(1_814_768, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_284_000, 0) + // Standard Error: 12_177 + .saturating_add(Weight::from_parts(1_866_465, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_571_000 picoseconds. - Weight::from_parts(2_646_000, 0) - // Standard Error: 7_097 - .saturating_add(Weight::from_parts(1_043_279, 0).saturating_mul(r.into())) + // Minimum execution time: 2_468_000 picoseconds. + Weight::from_parts(2_638_000, 0) + // Standard Error: 7_738 + .saturating_add(Weight::from_parts(1_119_369, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_083_000 picoseconds. - Weight::from_parts(2_227_000, 0) - // Standard Error: 12_723 - .saturating_add(Weight::from_parts(1_829_503, 0).saturating_mul(r.into())) + // Minimum execution time: 2_191_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 10_340 + .saturating_add(Weight::from_parts(1_831_738, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 6_578 - .saturating_add(Weight::from_parts(1_119_805, 0).saturating_mul(r.into())) + // Minimum execution time: 2_216_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 6_924 + .saturating_add(Weight::from_parts(1_210_933, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 12_281 - .saturating_add(Weight::from_parts(1_810_231, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_325_000, 0) + // Standard Error: 9_907 + .saturating_add(Weight::from_parts(1_822_715, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_307_000, 0) - // Standard Error: 7_105 - .saturating_add(Weight::from_parts(1_121_865, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 7_927 + .saturating_add(Weight::from_parts(1_168_287, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_112_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 7_396 - .saturating_add(Weight::from_parts(1_189_208, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 8_768 + .saturating_add(Weight::from_parts(1_295_617, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_187_000 picoseconds. - Weight::from_parts(2_282_000, 0) - // Standard Error: 3_728 - .saturating_add(Weight::from_parts(574_689, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 6_314 + .saturating_add(Weight::from_parts(658_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_261_000, 0) - // Standard Error: 7_710 - .saturating_add(Weight::from_parts(1_197_933, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 9_261 + .saturating_add(Weight::from_parts(1_348_699, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_277_000 picoseconds. - Weight::from_parts(2_337_000, 0) - // Standard Error: 4_189 - .saturating_add(Weight::from_parts(583_754, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 5_457 + .saturating_add(Weight::from_parts(671_846, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_083_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 12_478 - .saturating_add(Weight::from_parts(1_753_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_180_000 picoseconds. + Weight::from_parts(2_241_000, 0) + // Standard Error: 11_567 + .saturating_add(Weight::from_parts(1_835_171, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_292_000 picoseconds. - Weight::from_parts(2_326_000, 0) - // Standard Error: 6_909 - .saturating_add(Weight::from_parts(1_132_352, 0).saturating_mul(r.into())) + // Minimum execution time: 2_196_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 7_436 + .saturating_add(Weight::from_parts(1_171_019, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_188_000 picoseconds. - Weight::from_parts(522_728, 0) - // Standard Error: 19_552 - .saturating_add(Weight::from_parts(2_704_339, 0).saturating_mul(r.into())) + // Minimum execution time: 2_195_000 picoseconds. + Weight::from_parts(6_299_544, 0) + // Standard Error: 28_028 + .saturating_add(Weight::from_parts(2_500_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(1_526_164, 0) - // Standard Error: 10_257 - .saturating_add(Weight::from_parts(2_359_880, 0).saturating_mul(r.into())) + // Minimum execution time: 2_249_000 picoseconds. + Weight::from_parts(2_576_178, 0) + // Standard Error: 12_042 + .saturating_add(Weight::from_parts(2_335_953, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_144_000, 0) - // Standard Error: 5_377 - .saturating_add(Weight::from_parts(2_945_867, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(8_638_891, 0) + // Standard Error: 32_649 + .saturating_add(Weight::from_parts(2_462_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_169_000 picoseconds. - Weight::from_parts(2_211_000, 0) - // Standard Error: 5_247 - .saturating_add(Weight::from_parts(2_431_536, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_731_170, 0) + // Standard Error: 19_116 + .saturating_add(Weight::from_parts(2_437_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 16_019 - .saturating_add(Weight::from_parts(9_677_056, 0).saturating_mul(r.into())) + // Minimum execution time: 2_261_000 picoseconds. + Weight::from_parts(1_535_146, 0) + // Standard Error: 30_575 + .saturating_add(Weight::from_parts(9_634_377, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_063_031, 0) - // Standard Error: 44_174 - .saturating_add(Weight::from_parts(7_541_106, 0).saturating_mul(r.into())) + // Minimum execution time: 2_209_000 picoseconds. + Weight::from_parts(5_244_298, 0) + // Standard Error: 48_615 + .saturating_add(Weight::from_parts(7_381_672, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(5_205_597, 0) - // Standard Error: 24_468 - .saturating_add(Weight::from_parts(2_768_332, 0).saturating_mul(r.into())) + // Minimum execution time: 2_260_000 picoseconds. + Weight::from_parts(8_453_159, 0) + // Standard Error: 30_530 + .saturating_add(Weight::from_parts(2_541_459, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_216_000, 0) - // Standard Error: 6_057 - .saturating_add(Weight::from_parts(2_466_947, 0).saturating_mul(r.into())) + // Minimum execution time: 2_242_000 picoseconds. + Weight::from_parts(5_507_917, 0) + // Standard Error: 21_457 + .saturating_add(Weight::from_parts(2_217_886, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_260_000 picoseconds. - Weight::from_parts(2_298_000, 0) - // Standard Error: 6_931 - .saturating_add(Weight::from_parts(1_211_851, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 9_253 + .saturating_add(Weight::from_parts(1_354_282, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_267_000, 0) - // Standard Error: 5_345 - .saturating_add(Weight::from_parts(611_062, 0).saturating_mul(r.into())) + // Minimum execution time: 2_170_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 3_908 + .saturating_add(Weight::from_parts(589_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 9_629 - .saturating_add(Weight::from_parts(1_243_254, 0).saturating_mul(r.into())) + // Minimum execution time: 2_184_000 picoseconds. + Weight::from_parts(2_265_000, 0) + // Standard Error: 9_943 + .saturating_add(Weight::from_parts(1_308_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_342_000 picoseconds. - Weight::from_parts(2_377_000, 0) - // Standard Error: 4_075 - .saturating_add(Weight::from_parts(564_916, 0).saturating_mul(r.into())) + // Minimum execution time: 2_212_000 picoseconds. + Weight::from_parts(2_273_000, 0) + // Standard Error: 5_843 + .saturating_add(Weight::from_parts(653_388, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_212_472, 0).saturating_mul(r.into())) + // Minimum execution time: 2_228_000 picoseconds. + Weight::from_parts(2_293_000, 0) + // Standard Error: 9_157 + .saturating_add(Weight::from_parts(1_290_731, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_238_000, 0) - // Standard Error: 3_674 - .saturating_add(Weight::from_parts(587_206, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 4_020 + .saturating_add(Weight::from_parts(618_071, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 6_543 - .saturating_add(Weight::from_parts(993_044, 0).saturating_mul(r.into())) + // Minimum execution time: 2_239_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 7_192 + .saturating_add(Weight::from_parts(1_061_312, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_225_000, 0) - // Standard Error: 3_274 - .saturating_add(Weight::from_parts(509_569, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_245_000, 0) + // Standard Error: 3_756 + .saturating_add(Weight::from_parts(568_744, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_197_000, 0) - // Standard Error: 6_768 - .saturating_add(Weight::from_parts(979_181, 0).saturating_mul(r.into())) + // Minimum execution time: 2_248_000 picoseconds. + Weight::from_parts(2_324_000, 0) + // Standard Error: 7_917 + .saturating_add(Weight::from_parts(1_106_132, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(26_961, 0) - // Standard Error: 6_012 - .saturating_add(Weight::from_parts(578_422, 0).saturating_mul(r.into())) + // Minimum execution time: 2_205_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 4_617 + .saturating_add(Weight::from_parts(599_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_173_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 7_198 - .saturating_add(Weight::from_parts(985_992, 0).saturating_mul(r.into())) + // Minimum execution time: 2_215_000 picoseconds. + Weight::from_parts(2_346_000, 0) + // Standard Error: 7_501 + .saturating_add(Weight::from_parts(1_125_645, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 3_582 - .saturating_add(Weight::from_parts(504_208, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 5_262 + .saturating_add(Weight::from_parts(624_680, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_242_000, 0) - // Standard Error: 8_356 - .saturating_add(Weight::from_parts(1_025_849, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 7_879 + .saturating_add(Weight::from_parts(1_068_877, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_305_000 picoseconds. - Weight::from_parts(272_670, 0) - // Standard Error: 6_376 - .saturating_add(Weight::from_parts(599_190, 0).saturating_mul(r.into())) + // Minimum execution time: 2_192_000 picoseconds. + Weight::from_parts(2_288_000, 0) + // Standard Error: 4_124 + .saturating_add(Weight::from_parts(567_690, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 6_937 - .saturating_add(Weight::from_parts(1_018_594, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 8_516 + .saturating_add(Weight::from_parts(1_174_764, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_202_000, 0) - // Standard Error: 4_010 - .saturating_add(Weight::from_parts(573_907, 0).saturating_mul(r.into())) + // Minimum execution time: 2_171_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 4_901 + .saturating_add(Weight::from_parts(628_068, 0).saturating_mul(r.into())) } } @@ -2117,10 +2115,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 990_000 picoseconds. - Weight::from_parts(1_049_000, 0) - // Standard Error: 686 - .saturating_add(Weight::from_parts(242_487, 0).saturating_mul(c.into())) + // Minimum execution time: 965_000 picoseconds. + Weight::from_parts(1_020_000, 0) + // Standard Error: 753 + .saturating_add(Weight::from_parts(247_354, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -2128,10 +2126,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_776_000 picoseconds. - Weight::from_parts(2_926_000, 3506) - // Standard Error: 1_056 - .saturating_add(Weight::from_parts(670_577, 0).saturating_mul(c.into())) + // Minimum execution time: 2_780_000 picoseconds. + Weight::from_parts(2_874_000, 3506) + // Standard Error: 924 + .saturating_add(Weight::from_parts(674_078, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2140,17 +2138,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_388_000 picoseconds. - Weight::from_parts(74_229_765, 0) - // Standard Error: 7_680 - .saturating_add(Weight::from_parts(2_427_178, 0).saturating_mul(c.into())) + // Minimum execution time: 51_392_000 picoseconds. + Weight::from_parts(63_325_658, 0) + // Standard Error: 13_432 + .saturating_add(Weight::from_parts(2_671_521, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 83_751_000 picoseconds. - Weight::from_parts(85_540_000, 42236) + // Minimum execution time: 85_039_000 picoseconds. + Weight::from_parts(86_523_000, 42236) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2158,8 +2156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 53_792_000 picoseconds. - Weight::from_parts(55_210_000, 21261) + // Minimum execution time: 54_302_000 picoseconds. + Weight::from_parts(56_159_000, 21261) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2167,8 +2165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 29_277_000 picoseconds. - Weight::from_parts(30_570_000, 17070) + // Minimum execution time: 29_099_000 picoseconds. + Weight::from_parts(30_610_000, 17070) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2177,22 +2175,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_365_000 picoseconds. - Weight::from_parts(8_305_380, 7640) - // Standard Error: 43_605 - .saturating_add(Weight::from_parts(16_354_224, 0).saturating_mul(c.into())) + // Minimum execution time: 8_259_000 picoseconds. + Weight::from_parts(6_228_584, 7640) + // Standard Error: 37_556 + .saturating_add(Weight::from_parts(16_519_610, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1364 + c * (16389 ±0)` - // Estimated: `41434 + c * (131112 ±0)` - // Minimum execution time: 70_339_000 picoseconds. - Weight::from_parts(71_233_000, 41434) - // Standard Error: 169_422 - .saturating_add(Weight::from_parts(55_572_368, 0).saturating_mul(c.into())) + // Measured: `1297 + c * (16389 ±0)` + // Estimated: `40898 + c * (131112 ±0)` + // Minimum execution time: 70_699_000 picoseconds. + Weight::from_parts(71_447_000, 40898) + // Standard Error: 139_719 + .saturating_add(Weight::from_parts(54_319_486, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2203,22 +2201,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 64_030_000 picoseconds. - Weight::from_parts(49_650_288, 4990) - // Standard Error: 40_921 - .saturating_add(Weight::from_parts(53_077_064, 0).saturating_mul(c.into())) + // Minimum execution time: 60_906_000 picoseconds. + Weight::from_parts(18_999_485, 4990) + // Standard Error: 57_215 + .saturating_add(Weight::from_parts(53_057_311, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `738` - // Estimated: `39375` - // Minimum execution time: 64_745_000 picoseconds. - Weight::from_parts(96_452_812, 39375) + // Measured: `671` + // Estimated: `38638` + // Minimum execution time: 65_623_000 picoseconds. + Weight::from_parts(88_392_610, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_572, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_635, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2228,12 +2226,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 10_914_264_000 picoseconds. - Weight::from_parts(278_764_650, 34312) - // Standard Error: 156_493 - .saturating_add(Weight::from_parts(53_766_782, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_517, 0).saturating_mul(s.into())) + // Minimum execution time: 11_247_503_000 picoseconds. + Weight::from_parts(302_469_923, 34312) + // Standard Error: 147_459 + .saturating_add(Weight::from_parts(54_400_528, 0).saturating_mul(c.into())) + // Standard Error: 8 + .saturating_add(Weight::from_parts(2_571, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } @@ -2242,10 +2240,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 55_487_000 picoseconds. - Weight::from_parts(31_180_048, 23853) + // Minimum execution time: 56_802_000 picoseconds. + Weight::from_parts(33_250_791, 23853) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_177, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -2254,10 +2252,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `451` // Estimated: `27177` - // Minimum execution time: 59_745_000 picoseconds. - Weight::from_parts(32_264_542, 27177) + // Minimum execution time: 59_487_000 picoseconds. + Weight::from_parts(37_481_444, 27177) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_185, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } @@ -2266,10 +2264,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 83_935_000 picoseconds. - Weight::from_parts(67_556_120, 42227) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_190, 0).saturating_mul(p.into())) + // Minimum execution time: 86_239_000 picoseconds. + Weight::from_parts(32_106_516, 42227) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2278,22 +2276,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1081` // Estimated: `45757` - // Minimum execution time: 95_523_000 picoseconds. - Weight::from_parts(67_846_891, 45757) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_213, 0).saturating_mul(p.into())) + // Minimum execution time: 98_413_000 picoseconds. + Weight::from_parts(52_381_439, 45757) + // Standard Error: 3 + .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(11_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 306_381_000 picoseconds. - Weight::from_parts(319_153_310, 74319) - // Standard Error: 1_387 - .saturating_add(Weight::from_parts(6_138, 0).saturating_mul(q.into())) + // Minimum execution time: 302_634_000 picoseconds. + Weight::from_parts(320_223_637, 74319) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2302,10 +2298,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 319_572_000 picoseconds. - Weight::from_parts(332_017_272, 74319) - // Standard Error: 1_262 - .saturating_add(Weight::from_parts(2_004, 0).saturating_mul(q.into())) + // Minimum execution time: 315_859_000 picoseconds. + Weight::from_parts(328_138_594, 74319) + // Standard Error: 1_557 + .saturating_add(Weight::from_parts(8_014, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2314,10 +2310,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 47_252_000 picoseconds. - Weight::from_parts(47_900_000, 3899) - // Standard Error: 26_716 - .saturating_add(Weight::from_parts(51_791_764, 0).saturating_mul(c.into())) + // Minimum execution time: 45_804_000 picoseconds. + Weight::from_parts(46_226_000, 3899) + // Standard Error: 51_090 + .saturating_add(Weight::from_parts(51_940_069, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2327,630 +2323,630 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_222_000 picoseconds. - Weight::from_parts(87_003_000, 0) - // Standard Error: 4_412_345 - .saturating_add(Weight::from_parts(709_555_221, 0).saturating_mul(r.into())) + // Minimum execution time: 80_872_000 picoseconds. + Weight::from_parts(82_358_000, 0) + // Standard Error: 3_946_533 + .saturating_add(Weight::from_parts(617_270_552, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 418_248_000 picoseconds. - Weight::from_parts(357_180_796, 0) - // Standard Error: 10_036 - .saturating_add(Weight::from_parts(34_125_905, 0).saturating_mul(p.into())) + // Minimum execution time: 365_182_000 picoseconds. + Weight::from_parts(292_523_651, 0) + // Standard Error: 7_087 + .saturating_add(Weight::from_parts(31_059_002, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 252_299_000 picoseconds. - Weight::from_parts(290_811_825, 0) - // Standard Error: 441_558 - .saturating_add(Weight::from_parts(168_655_080, 0).saturating_mul(r.into())) + // Minimum execution time: 196_771_000 picoseconds. + Weight::from_parts(219_836_156, 0) + // Standard Error: 406_704 + .saturating_add(Weight::from_parts(120_742_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_637_000 picoseconds. - Weight::from_parts(93_539_683, 0) - // Standard Error: 5_764 - .saturating_add(Weight::from_parts(4_269_453, 0).saturating_mul(r.into())) + // Minimum execution time: 86_043_000 picoseconds. + Weight::from_parts(92_117_781, 0) + // Standard Error: 7_334 + .saturating_add(Weight::from_parts(3_640_301, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_667_000 picoseconds. - Weight::from_parts(153_461_952, 0) - // Standard Error: 28_015 - .saturating_add(Weight::from_parts(4_740_934, 0).saturating_mul(r.into())) + // Minimum execution time: 146_803_000 picoseconds. + Weight::from_parts(168_908_676, 0) + // Standard Error: 28_070 + .saturating_add(Weight::from_parts(3_989_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_605_000 picoseconds. - Weight::from_parts(115_078_201, 0) - // Standard Error: 420_788 - .saturating_add(Weight::from_parts(235_062_438, 0).saturating_mul(r.into())) + // Minimum execution time: 82_421_000 picoseconds. + Weight::from_parts(109_902_108, 0) + // Standard Error: 458_197 + .saturating_add(Weight::from_parts(186_560_355, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_883_000 picoseconds. - Weight::from_parts(84_013_989, 0) - // Standard Error: 315_983 - .saturating_add(Weight::from_parts(233_618_600, 0).saturating_mul(r.into())) + // Minimum execution time: 85_173_000 picoseconds. + Weight::from_parts(81_703_608, 0) + // Standard Error: 318_823 + .saturating_add(Weight::from_parts(183_602_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_674_000 picoseconds. - Weight::from_parts(84_138_097, 0) - // Standard Error: 394_031 - .saturating_add(Weight::from_parts(234_112_935, 0).saturating_mul(r.into())) + // Minimum execution time: 85_999_000 picoseconds. + Weight::from_parts(81_002_605, 0) + // Standard Error: 269_075 + .saturating_add(Weight::from_parts(183_154_106, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_037_000 picoseconds. - Weight::from_parts(80_043_119, 0) - // Standard Error: 363_071 - .saturating_add(Weight::from_parts(234_440_419, 0).saturating_mul(r.into())) + // Minimum execution time: 82_306_000 picoseconds. + Weight::from_parts(79_166_166, 0) + // Standard Error: 332_502 + .saturating_add(Weight::from_parts(182_666_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_970_000 picoseconds. - Weight::from_parts(79_191_736, 0) - // Standard Error: 388_386 - .saturating_add(Weight::from_parts(234_797_123, 0).saturating_mul(r.into())) + // Minimum execution time: 82_459_000 picoseconds. + Weight::from_parts(80_301_392, 0) + // Standard Error: 340_598 + .saturating_add(Weight::from_parts(184_099_120, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_955_000 picoseconds. - Weight::from_parts(76_258_811, 0) - // Standard Error: 378_019 - .saturating_add(Weight::from_parts(235_845_928, 0).saturating_mul(r.into())) + // Minimum execution time: 81_140_000 picoseconds. + Weight::from_parts(72_987_262, 0) + // Standard Error: 388_909 + .saturating_add(Weight::from_parts(186_920_851, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_420_000 picoseconds. - Weight::from_parts(80_595_371, 0) - // Standard Error: 321_668 - .saturating_add(Weight::from_parts(234_918_409, 0).saturating_mul(r.into())) + // Minimum execution time: 81_336_000 picoseconds. + Weight::from_parts(79_078_269, 0) + // Standard Error: 276_322 + .saturating_add(Weight::from_parts(182_690_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_641_000 picoseconds. - Weight::from_parts(79_056_207, 0) - // Standard Error: 372_009 - .saturating_add(Weight::from_parts(236_443_753, 0).saturating_mul(r.into())) + // Minimum execution time: 84_201_000 picoseconds. + Weight::from_parts(79_459_558, 0) + // Standard Error: 357_406 + .saturating_add(Weight::from_parts(182_989_857, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 712_026_000 picoseconds. - Weight::from_parts(757_785_668, 0) - // Standard Error: 464_262 - .saturating_add(Weight::from_parts(317_512_842, 0).saturating_mul(r.into())) + // Minimum execution time: 709_298_000 picoseconds. + Weight::from_parts(792_701_124, 0) + // Standard Error: 581_476 + .saturating_add(Weight::from_parts(264_833_637, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 977_690_000 picoseconds. - Weight::from_parts(991_462_000, 0) - // Standard Error: 58_744 - .saturating_add(Weight::from_parts(13_316_633, 0).saturating_mul(n.into())) + // Minimum execution time: 958_553_000 picoseconds. + Weight::from_parts(1_002_082_000, 0) + // Standard Error: 51_056 + .saturating_add(Weight::from_parts(13_349_580, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_258_000 picoseconds. - Weight::from_parts(75_200_329, 0) - // Standard Error: 367_397 - .saturating_add(Weight::from_parts(234_793_089, 0).saturating_mul(r.into())) + // Minimum execution time: 81_092_000 picoseconds. + Weight::from_parts(70_460_333, 0) + // Standard Error: 322_779 + .saturating_add(Weight::from_parts(182_652_206, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_774_000 picoseconds. - Weight::from_parts(86_726_743, 0) - // Standard Error: 344_677 - .saturating_add(Weight::from_parts(232_758_004, 0).saturating_mul(r.into())) + // Minimum execution time: 82_315_000 picoseconds. + Weight::from_parts(77_285_940, 0) + // Standard Error: 310_862 + .saturating_add(Weight::from_parts(183_154_588, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_660_000 picoseconds. - Weight::from_parts(107_246_381, 0) - // Standard Error: 450_595 - .saturating_add(Weight::from_parts(299_226_823, 0).saturating_mul(n.into())) + // Minimum execution time: 82_813_000 picoseconds. + Weight::from_parts(83_631_977, 0) + // Standard Error: 426_894 + .saturating_add(Weight::from_parts(250_044_040, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_608_000 picoseconds. - Weight::from_parts(88_218_000, 0) - // Standard Error: 3_603_226 - .saturating_add(Weight::from_parts(1_138_570_591, 0).saturating_mul(r.into())) + // Minimum execution time: 87_342_000 picoseconds. + Weight::from_parts(88_861_000, 0) + // Standard Error: 4_034_065 + .saturating_add(Weight::from_parts(1_070_363_129, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_028_000 picoseconds. - Weight::from_parts(148_854_569, 0) - // Standard Error: 521_593 - .saturating_add(Weight::from_parts(444_403_185, 0).saturating_mul(r.into())) + // Minimum execution time: 82_887_000 picoseconds. + Weight::from_parts(154_402_402, 0) + // Standard Error: 504_137 + .saturating_add(Weight::from_parts(389_538_545, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 526_298_000 picoseconds. - Weight::from_parts(529_334_000, 0) - // Standard Error: 64_334 - .saturating_add(Weight::from_parts(21_542_119, 0).saturating_mul(n.into())) + // Minimum execution time: 467_573_000 picoseconds. + Weight::from_parts(471_685_000, 0) + // Standard Error: 64_140 + .saturating_add(Weight::from_parts(22_109_126, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_355_000 picoseconds. - Weight::from_parts(150_399_219, 0) - // Standard Error: 494_235 - .saturating_add(Weight::from_parts(448_618_346, 0).saturating_mul(r.into())) + // Minimum execution time: 86_853_000 picoseconds. + Weight::from_parts(152_053_498, 0) + // Standard Error: 538_330 + .saturating_add(Weight::from_parts(397_711_575, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 527_623_000 picoseconds. - Weight::from_parts(531_388_000, 0) - // Standard Error: 68_048 - .saturating_add(Weight::from_parts(21_511_303, 0).saturating_mul(n.into())) + // Minimum execution time: 471_875_000 picoseconds. + Weight::from_parts(475_692_000, 0) + // Standard Error: 57_997 + .saturating_add(Weight::from_parts(21_385_701, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_514_000 picoseconds. - Weight::from_parts(770_347_767, 0) - // Standard Error: 491_305 - .saturating_add(Weight::from_parts(460_521_622, 0).saturating_mul(r.into())) + // Minimum execution time: 716_684_000 picoseconds. + Weight::from_parts(781_328_373, 0) + // Standard Error: 479_933 + .saturating_add(Weight::from_parts(411_727_995, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 727_797_000 picoseconds. - Weight::from_parts(796_951_141, 0) - // Standard Error: 511_348 - .saturating_add(Weight::from_parts(465_952_417, 0).saturating_mul(r.into())) + // Minimum execution time: 746_421_000 picoseconds. + Weight::from_parts(889_163_923, 0) + // Standard Error: 621_967 + .saturating_add(Weight::from_parts(412_763_026, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_511_000 picoseconds. - Weight::from_parts(70_108_276, 0) - // Standard Error: 369_170 - .saturating_add(Weight::from_parts(244_926_400, 0).saturating_mul(r.into())) + // Minimum execution time: 81_961_000 picoseconds. + Weight::from_parts(86_031_226, 0) + // Standard Error: 355_690 + .saturating_add(Weight::from_parts(191_347_968, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_504_000 picoseconds. - Weight::from_parts(4_938_314_567, 0) - // Standard Error: 404_342 - .saturating_add(Weight::from_parts(338_431_048, 0).saturating_mul(r.into())) + // Minimum execution time: 3_797_807_000 picoseconds. + Weight::from_parts(3_948_397_472, 0) + // Standard Error: 396_090 + .saturating_add(Weight::from_parts(284_341_649, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 591_844_000 picoseconds. - Weight::from_parts(598_128_000, 0) - // Standard Error: 54_800 - .saturating_add(Weight::from_parts(31_272_502, 0).saturating_mul(n.into())) + // Minimum execution time: 485_799_000 picoseconds. + Weight::from_parts(486_862_000, 0) + // Standard Error: 47_704 + .saturating_add(Weight::from_parts(31_360_292, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_559_000 picoseconds. - Weight::from_parts(4_953_984_624, 0) - // Standard Error: 454_672 - .saturating_add(Weight::from_parts(391_509_821, 0).saturating_mul(r.into())) + // Minimum execution time: 3_842_120_000 picoseconds. + Weight::from_parts(3_943_431_716, 0) + // Standard Error: 766_406 + .saturating_add(Weight::from_parts(339_379_953, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_774_023_000 picoseconds. - Weight::from_parts(4_926_440_375, 0) - // Standard Error: 406_352 - .saturating_add(Weight::from_parts(410_066_296, 0).saturating_mul(r.into())) + // Minimum execution time: 3_828_327_000 picoseconds. + Weight::from_parts(3_976_283_101, 0) + // Standard Error: 768_169 + .saturating_add(Weight::from_parts(353_252_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 252_283_000 picoseconds. - Weight::from_parts(317_036_023, 0) - // Standard Error: 491_835 - .saturating_add(Weight::from_parts(459_054_688, 0).saturating_mul(r.into())) + // Minimum execution time: 256_679_000 picoseconds. + Weight::from_parts(330_245_572, 0) + // Standard Error: 519_345 + .saturating_add(Weight::from_parts(404_879_225, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 690_374_000 picoseconds. - Weight::from_parts(696_614_000, 0) - // Standard Error: 57_727 - .saturating_add(Weight::from_parts(21_193_900, 0).saturating_mul(n.into())) + // Minimum execution time: 640_004_000 picoseconds. + Weight::from_parts(646_769_000, 0) + // Standard Error: 55_122 + .saturating_add(Weight::from_parts(21_616_125, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_942_359_000 picoseconds. - Weight::from_parts(5_078_327_071, 0) - // Standard Error: 452_216 - .saturating_add(Weight::from_parts(410_586_501, 0).saturating_mul(r.into())) + // Minimum execution time: 3_981_155_000 picoseconds. + Weight::from_parts(4_086_072_221, 0) + // Standard Error: 1_076_069 + .saturating_add(Weight::from_parts(362_989_310, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_677_000 picoseconds. - Weight::from_parts(88_427_695, 0) - // Standard Error: 289_964 - .saturating_add(Weight::from_parts(20_836_104, 0).saturating_mul(r.into())) + // Minimum execution time: 84_145_000 picoseconds. + Weight::from_parts(88_260_563, 0) + // Standard Error: 277_576 + .saturating_add(Weight::from_parts(20_209_036, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_884_000 picoseconds. - Weight::from_parts(94_128_638, 0) - // Standard Error: 1_150 - .saturating_add(Weight::from_parts(427_959, 0).saturating_mul(n.into())) + // Minimum execution time: 102_930_000 picoseconds. + Weight::from_parts(90_280_376, 0) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(427_777, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_126_000 picoseconds. - Weight::from_parts(91_658_518, 0) - // Standard Error: 269_208 - .saturating_add(Weight::from_parts(19_110_181, 0).saturating_mul(r.into())) + // Minimum execution time: 84_156_000 picoseconds. + Weight::from_parts(89_778_763, 0) + // Standard Error: 365_767 + .saturating_add(Weight::from_parts(24_157_936, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_968_000 picoseconds. - Weight::from_parts(96_214_665, 0) - // Standard Error: 1_051 - .saturating_add(Weight::from_parts(424_356, 0).saturating_mul(n.into())) + // Minimum execution time: 105_315_000 picoseconds. + Weight::from_parts(94_894_394, 0) + // Standard Error: 993 + .saturating_add(Weight::from_parts(426_364, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_080_000 picoseconds. - Weight::from_parts(88_919_016, 0) - // Standard Error: 290_610 - .saturating_add(Weight::from_parts(20_031_683, 0).saturating_mul(r.into())) + // Minimum execution time: 81_595_000 picoseconds. + Weight::from_parts(86_259_504, 0) + // Standard Error: 284_882 + .saturating_add(Weight::from_parts(25_873_595, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_877_000 picoseconds. - Weight::from_parts(89_997_934, 0) - // Standard Error: 353_369 - .saturating_add(Weight::from_parts(21_258_265, 0).saturating_mul(r.into())) + // Minimum execution time: 80_771_000 picoseconds. + Weight::from_parts(85_313_802, 0) + // Standard Error: 265_474 + .saturating_add(Weight::from_parts(25_863_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_914_000 picoseconds. - Weight::from_parts(128_101_726, 0) - // Standard Error: 456_540 - .saturating_add(Weight::from_parts(327_004_586, 0).saturating_mul(r.into())) + // Minimum execution time: 82_396_000 picoseconds. + Weight::from_parts(126_819_617, 0) + // Standard Error: 518_749 + .saturating_add(Weight::from_parts(272_821_836, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_098_000 picoseconds. - Weight::from_parts(107_176_000, 0) - // Standard Error: 2_365 - .saturating_add(Weight::from_parts(643_572, 0).saturating_mul(n.into())) + // Minimum execution time: 98_266_000 picoseconds. + Weight::from_parts(100_843_000, 0) + // Standard Error: 2_828 + .saturating_add(Weight::from_parts(662_117, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_872_000 picoseconds. - Weight::from_parts(729_697_981, 0) - // Standard Error: 1_976_351 - .saturating_add(Weight::from_parts(36_344_818, 0).saturating_mul(r.into())) + // Minimum execution time: 707_150_000 picoseconds. + Weight::from_parts(754_398_128, 0) + // Standard Error: 5_119_788 + .saturating_add(Weight::from_parts(7_037_071, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_823_000 picoseconds. - Weight::from_parts(739_731_189, 0) - // Standard Error: 3_069_948 - .saturating_add(Weight::from_parts(1_778_910, 0).saturating_mul(r.into())) + // Minimum execution time: 712_091_000 picoseconds. + Weight::from_parts(751_999_544, 0) + // Standard Error: 4_003_265 + .saturating_add(Weight::from_parts(43_818_555, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_313_000 picoseconds. - Weight::from_parts(101_011_510, 0) - // Standard Error: 309_893 - .saturating_add(Weight::from_parts(12_424_889, 0).saturating_mul(r.into())) + // Minimum execution time: 92_234_000 picoseconds. + Weight::from_parts(96_192_773, 0) + // Standard Error: 271_871 + .saturating_add(Weight::from_parts(13_338_726, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 110_082_000 picoseconds. - Weight::from_parts(94_741_351, 0) - // Standard Error: 1_210 - .saturating_add(Weight::from_parts(428_098, 0).saturating_mul(n.into())) + // Minimum execution time: 108_190_000 picoseconds. + Weight::from_parts(92_525_926, 0) + // Standard Error: 1_134 + .saturating_add(Weight::from_parts(433_806, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_144_000 picoseconds. - Weight::from_parts(100_819_965, 0) - // Standard Error: 312_160 - .saturating_add(Weight::from_parts(12_498_034, 0).saturating_mul(r.into())) + // Minimum execution time: 92_297_000 picoseconds. + Weight::from_parts(98_054_616, 0) + // Standard Error: 394_791 + .saturating_add(Weight::from_parts(7_680_683, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_817_000 picoseconds. - Weight::from_parts(98_997_460, 0) - // Standard Error: 911 - .saturating_add(Weight::from_parts(418_183, 0).saturating_mul(n.into())) + // Minimum execution time: 106_932_000 picoseconds. + Weight::from_parts(91_150_785, 0) + // Standard Error: 1_067 + .saturating_add(Weight::from_parts(424_570, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_937_000 picoseconds. - Weight::from_parts(79_415_972, 0) - // Standard Error: 348_880 - .saturating_add(Weight::from_parts(235_937_217, 0).saturating_mul(r.into())) + // Minimum execution time: 80_591_000 picoseconds. + Weight::from_parts(79_590_461, 0) + // Standard Error: 360_038 + .saturating_add(Weight::from_parts(185_313_242, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_627_000 picoseconds. - Weight::from_parts(83_675_859, 0) - // Standard Error: 339_403 - .saturating_add(Weight::from_parts(235_762_764, 0).saturating_mul(r.into())) + // Minimum execution time: 83_379_000 picoseconds. + Weight::from_parts(82_304_672, 0) + // Standard Error: 371_508 + .saturating_add(Weight::from_parts(184_895_719, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 716_756_000 picoseconds. - Weight::from_parts(761_461_420, 0) - // Standard Error: 454_456 - .saturating_add(Weight::from_parts(248_489_654, 0).saturating_mul(r.into())) + // Minimum execution time: 714_906_000 picoseconds. + Weight::from_parts(784_837_322, 0) + // Standard Error: 485_874 + .saturating_add(Weight::from_parts(198_529_306, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 732_309_000 picoseconds. - Weight::from_parts(759_387_651, 0) - // Standard Error: 1_129 - .saturating_add(Weight::from_parts(146_886, 0).saturating_mul(n.into())) + // Minimum execution time: 735_164_000 picoseconds. + Weight::from_parts(760_829_418, 0) + // Standard Error: 2_049 + .saturating_add(Weight::from_parts(164_862, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_427_965_000 picoseconds. - Weight::from_parts(5_584_572_405, 0) - // Standard Error: 509_610 - .saturating_add(Weight::from_parts(266_723_710, 0).saturating_mul(r.into())) + // Minimum execution time: 4_467_125_000 picoseconds. + Weight::from_parts(4_668_343_697, 0) + // Standard Error: 529_569 + .saturating_add(Weight::from_parts(214_709_155, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_746_904_000 picoseconds. - Weight::from_parts(5_825_570_819, 0) - // Standard Error: 10_085 - .saturating_add(Weight::from_parts(13_639_502, 0).saturating_mul(n.into())) + // Minimum execution time: 4_716_693_000 picoseconds. + Weight::from_parts(4_810_590_943, 0) + // Standard Error: 12_440 + .saturating_add(Weight::from_parts(13_814_475, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_800_000 picoseconds. - Weight::from_parts(107_792_324, 0) - // Standard Error: 431_628 - .saturating_add(Weight::from_parts(246_303_550, 0).saturating_mul(r.into())) + // Minimum execution time: 81_721_000 picoseconds. + Weight::from_parts(95_360_878, 0) + // Standard Error: 488_163 + .saturating_add(Weight::from_parts(198_923_476, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 235_563_000 picoseconds. - Weight::from_parts(238_625_000, 0) - // Standard Error: 50_499 - .saturating_add(Weight::from_parts(25_511_187, 0).saturating_mul(n.into())) + // Minimum execution time: 189_069_000 picoseconds. + Weight::from_parts(191_834_000, 0) + // Standard Error: 53_942 + .saturating_add(Weight::from_parts(26_059_121, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_947_000 picoseconds. - Weight::from_parts(89_682_740, 0) - // Standard Error: 348_317 - .saturating_add(Weight::from_parts(234_018_615, 0).saturating_mul(r.into())) + // Minimum execution time: 83_023_000 picoseconds. + Weight::from_parts(70_919_161, 0) + // Standard Error: 442_134 + .saturating_add(Weight::from_parts(186_467_769, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_100_000 picoseconds. - Weight::from_parts(87_707_777, 0) - // Standard Error: 258_445 - .saturating_add(Weight::from_parts(29_983_122, 0).saturating_mul(r.into())) + // Minimum execution time: 80_187_000 picoseconds. + Weight::from_parts(86_256_124, 0) + // Standard Error: 333_120 + .saturating_add(Weight::from_parts(27_182_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_620_000 picoseconds. - Weight::from_parts(88_230_306, 0) - // Standard Error: 272_978 - .saturating_add(Weight::from_parts(17_120_893, 0).saturating_mul(r.into())) + // Minimum execution time: 80_373_000 picoseconds. + Weight::from_parts(83_957_387, 0) + // Standard Error: 258_914 + .saturating_add(Weight::from_parts(14_637_112, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_978_000 picoseconds. - Weight::from_parts(91_119_451, 0) - // Standard Error: 269_369 - .saturating_add(Weight::from_parts(15_184_548, 0).saturating_mul(r.into())) + // Minimum execution time: 82_886_000 picoseconds. + Weight::from_parts(86_536_767, 0) + // Standard Error: 237_087 + .saturating_add(Weight::from_parts(15_456_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_688_000 picoseconds. - Weight::from_parts(90_189_414, 0) - // Standard Error: 273_180 - .saturating_add(Weight::from_parts(15_680_285, 0).saturating_mul(r.into())) + // Minimum execution time: 82_962_000 picoseconds. + Weight::from_parts(87_038_165, 0) + // Standard Error: 267_652 + .saturating_add(Weight::from_parts(14_141_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_875_000 picoseconds. - Weight::from_parts(88_169_159, 0) - // Standard Error: 275_439 - .saturating_add(Weight::from_parts(14_520_840, 0).saturating_mul(r.into())) + // Minimum execution time: 82_976_000 picoseconds. + Weight::from_parts(87_105_967, 0) + // Standard Error: 237_581 + .saturating_add(Weight::from_parts(13_365_932, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_675_000 picoseconds. - Weight::from_parts(223_939_434, 0) - // Standard Error: 432_414 - .saturating_add(Weight::from_parts(337_824_841, 0).saturating_mul(r.into())) + // Minimum execution time: 139_585_000 picoseconds. + Weight::from_parts(203_512_831, 0) + // Standard Error: 393_346 + .saturating_add(Weight::from_parts(283_538_921, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 94_934_000 picoseconds. - Weight::from_parts(156_494_816, 0) - // Standard Error: 447_955 - .saturating_add(Weight::from_parts(528_564_684, 0).saturating_mul(r.into())) + // Minimum execution time: 98_330_000 picoseconds. + Weight::from_parts(158_669_516, 0) + // Standard Error: 440_421 + .saturating_add(Weight::from_parts(473_163_025, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2958,22 +2954,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_437_864_000 picoseconds. - Weight::from_parts(46_530_376_000, 0) - // Standard Error: 266_354 - .saturating_add(Weight::from_parts(7_234_250, 0).saturating_mul(p.into())) - // Standard Error: 266_341 - .saturating_add(Weight::from_parts(176_106_088, 0).saturating_mul(s.into())) + // Minimum execution time: 43_492_772_000 picoseconds. + Weight::from_parts(43_692_998_000, 0) + // Standard Error: 263_249 + .saturating_add(Weight::from_parts(8_169_821, 0).saturating_mul(p.into())) + // Standard Error: 263_236 + .saturating_add(Weight::from_parts(180_732_778, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_476_000 picoseconds. - Weight::from_parts(153_424_122, 0) - // Standard Error: 465_906 - .saturating_add(Weight::from_parts(532_257_834, 0).saturating_mul(r.into())) + // Minimum execution time: 97_189_000 picoseconds. + Weight::from_parts(158_677_248, 0) + // Standard Error: 452_648 + .saturating_add(Weight::from_parts(478_043_506, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2981,32 +2977,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_304_524_000 picoseconds. - Weight::from_parts(46_363_097_000, 0) - // Standard Error: 282_696 - .saturating_add(Weight::from_parts(6_905_555, 0).saturating_mul(p.into())) - // Standard Error: 282_682 - .saturating_add(Weight::from_parts(176_467_418, 0).saturating_mul(s.into())) + // Minimum execution time: 43_613_488_000 picoseconds. + Weight::from_parts(43_758_304_000, 0) + // Standard Error: 268_412 + .saturating_add(Weight::from_parts(7_987_894, 0).saturating_mul(p.into())) + // Standard Error: 268_399 + .saturating_add(Weight::from_parts(180_769_004, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_152_000 picoseconds. - Weight::from_parts(103_953_387, 0) - // Standard Error: 31_619 - .saturating_add(Weight::from_parts(4_051_743, 0).saturating_mul(r.into())) + // Minimum execution time: 84_210_000 picoseconds. + Weight::from_parts(99_996_695, 0) + // Standard Error: 31_808 + .saturating_add(Weight::from_parts(3_523_987, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_577_000 picoseconds. - Weight::from_parts(130_463_800, 1131) - // Standard Error: 8_489 - .saturating_add(Weight::from_parts(12_233_025, 0).saturating_mul(p.into())) + // Minimum execution time: 82_940_000 picoseconds. + Weight::from_parts(123_540_441, 1131) + // Standard Error: 7_143 + .saturating_add(Weight::from_parts(11_789_871, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3015,10 +3011,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_637_000 picoseconds. - Weight::from_parts(87_209_000, 1131) - // Standard Error: 34_392 - .saturating_add(Weight::from_parts(35_611_270, 0).saturating_mul(p.into())) + // Minimum execution time: 83_752_000 picoseconds. + Weight::from_parts(84_858_000, 1131) + // Standard Error: 48_161 + .saturating_add(Weight::from_parts(36_181_117, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3027,10 +3023,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_359_334_000 picoseconds. - Weight::from_parts(6_121_083_942, 5069931) - // Standard Error: 63_810 - .saturating_add(Weight::from_parts(36_566_054, 0).saturating_mul(p.into())) + // Minimum execution time: 6_125_138_000 picoseconds. + Weight::from_parts(5_869_525_563, 5069931) + // Standard Error: 46_521 + .saturating_add(Weight::from_parts(36_899_111, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -3038,10 +3034,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_837_000 picoseconds. - Weight::from_parts(86_734_000, 1939) - // Standard Error: 52_031 - .saturating_add(Weight::from_parts(47_935_831, 0).saturating_mul(p.into())) + // Minimum execution time: 82_516_000 picoseconds. + Weight::from_parts(83_470_000, 1939) + // Standard Error: 29_769 + .saturating_add(Weight::from_parts(46_665_657, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -3050,10 +3046,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 91_093_000 picoseconds. - Weight::from_parts(89_453_904, 1131) - // Standard Error: 67_270 - .saturating_add(Weight::from_parts(36_623_289, 0).saturating_mul(p.into())) + // Minimum execution time: 87_344_000 picoseconds. + Weight::from_parts(94_873_151, 1131) + // Standard Error: 55_429 + .saturating_add(Weight::from_parts(35_724_871, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3062,10 +3058,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 742_900_000 picoseconds. - Weight::from_parts(797_212_869, 1496) - // Standard Error: 203_408 - .saturating_add(Weight::from_parts(39_864_931, 0).saturating_mul(p.into())) + // Minimum execution time: 735_393_000 picoseconds. + Weight::from_parts(754_062_397, 1496) + // Standard Error: 166_437 + .saturating_add(Weight::from_parts(43_966_900, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3074,10 +3070,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_154_233_000 picoseconds. - Weight::from_parts(1_168_913_585, 317931) - // Standard Error: 156_513 - .saturating_add(Weight::from_parts(40_911_219, 0).saturating_mul(p.into())) + // Minimum execution time: 1_124_371_000 picoseconds. + Weight::from_parts(1_147_901_415, 317931) + // Standard Error: 145_342 + .saturating_add(Weight::from_parts(43_795_511, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3085,164 +3081,164 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_637_000 picoseconds. - Weight::from_parts(1_579_535, 0) - // Standard Error: 10_282 - .saturating_add(Weight::from_parts(23_979_117, 0).saturating_mul(r.into())) + // Minimum execution time: 1_510_000 picoseconds. + Weight::from_parts(1_448_006, 0) + // Standard Error: 9_868 + .saturating_add(Weight::from_parts(24_061_691, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_100_000 picoseconds. - Weight::from_parts(4_301_699_118, 0) - // Standard Error: 35_988 - .saturating_add(Weight::from_parts(3_646_485, 0).saturating_mul(r.into())) + // Minimum execution time: 4_337_991_000 picoseconds. + Weight::from_parts(4_151_991_287, 0) + // Standard Error: 60_683 + .saturating_add(Weight::from_parts(4_818_799, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_335_883_000 picoseconds. - Weight::from_parts(4_309_192_543, 0) - // Standard Error: 54_788 - .saturating_add(Weight::from_parts(3_782_929, 0).saturating_mul(r.into())) + // Minimum execution time: 4_341_162_000 picoseconds. + Weight::from_parts(4_200_807_294, 0) + // Standard Error: 51_442 + .saturating_add(Weight::from_parts(4_527_839, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_564_573_000 picoseconds. - Weight::from_parts(11_470_489_007, 0) - // Standard Error: 145_973 - .saturating_add(Weight::from_parts(9_000_414, 0).saturating_mul(r.into())) + // Minimum execution time: 10_322_767_000 picoseconds. + Weight::from_parts(11_038_976_057, 0) + // Standard Error: 150_113 + .saturating_add(Weight::from_parts(10_655_640, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_413_294_000 picoseconds. - Weight::from_parts(10_646_734_527, 0) - // Standard Error: 186_523 - .saturating_add(Weight::from_parts(10_318_180, 0).saturating_mul(r.into())) + // Minimum execution time: 10_367_826_000 picoseconds. + Weight::from_parts(11_310_983_745, 0) + // Standard Error: 145_202 + .saturating_add(Weight::from_parts(7_541_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 8_412 - .saturating_add(Weight::from_parts(3_826_675, 0).saturating_mul(r.into())) + // Minimum execution time: 2_251_000 picoseconds. + Weight::from_parts(2_304_000, 0) + // Standard Error: 8_520 + .saturating_add(Weight::from_parts(3_798_413, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 6_151 - .saturating_add(Weight::from_parts(3_061_817, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(573_722, 0) + // Standard Error: 11_642 + .saturating_add(Weight::from_parts(3_174_691, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_229_000 picoseconds. - Weight::from_parts(3_426_438, 0) - // Standard Error: 1_152 - .saturating_add(Weight::from_parts(1_567_482, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(3_155_512, 0) + // Standard Error: 1_212 + .saturating_add(Weight::from_parts(1_586_585, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_263_000, 0) - // Standard Error: 9_581 - .saturating_add(Weight::from_parts(2_965_066, 0).saturating_mul(r.into())) + // Minimum execution time: 2_160_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 8_627 + .saturating_add(Weight::from_parts(2_929_529, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_792_586, 0) - // Standard Error: 14_585 - .saturating_add(Weight::from_parts(5_083_752, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(1_609_241, 0) + // Standard Error: 19_812 + .saturating_add(Weight::from_parts(5_162_833, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_660_000 picoseconds. - Weight::from_parts(6_432_123, 0) - // Standard Error: 1_897 - .saturating_add(Weight::from_parts(133_494, 0).saturating_mul(e.into())) + // Minimum execution time: 6_892_000 picoseconds. + Weight::from_parts(5_316_811, 0) + // Standard Error: 1_578 + .saturating_add(Weight::from_parts(163_377, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(4_331_035, 0) - // Standard Error: 6_255 - .saturating_add(Weight::from_parts(2_559_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_304_000 picoseconds. + Weight::from_parts(4_554_683, 0) + // Standard Error: 7_319 + .saturating_add(Weight::from_parts(2_595_958, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_559_212 - - 2_413_142, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_595_958 - + 2_422_191, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(3_893_976, 0) - // Standard Error: 12_129 - .saturating_add(Weight::from_parts(2_413_142, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(5_046_075, 0) + // Standard Error: 13_702 + .saturating_add(Weight::from_parts(2_422_191, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_543_000 picoseconds. - Weight::from_parts(7_683_499, 0) - // Standard Error: 22_341 - .saturating_add(Weight::from_parts(10_324_116, 0).saturating_mul(r.into())) + // Minimum execution time: 2_684_000 picoseconds. + Weight::from_parts(17_324_871, 0) + // Standard Error: 38_532 + .saturating_add(Weight::from_parts(10_260_872, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_819_000 picoseconds. - Weight::from_parts(12_406_000, 0) - // Standard Error: 6_552 - .saturating_add(Weight::from_parts(1_132_455, 0).saturating_mul(p.into())) + // Minimum execution time: 12_206_000 picoseconds. + Weight::from_parts(2_634_425, 0) + // Standard Error: 5_954 + .saturating_add(Weight::from_parts(1_275_538, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_266_000 picoseconds. - Weight::from_parts(5_637_030, 0) - // Standard Error: 14 + // Minimum execution time: 5_288_000 picoseconds. + Weight::from_parts(5_570_870, 0) + // Standard Error: 12 .saturating_add(Weight::from_parts(61, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. @@ -3250,719 +3246,719 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_271_000 picoseconds. - Weight::from_parts(1_703_004, 0) - // Standard Error: 3_377 - .saturating_add(Weight::from_parts(252_219, 0).saturating_mul(r.into())) + // Minimum execution time: 2_203_000 picoseconds. + Weight::from_parts(1_788_159, 0) + // Standard Error: 3_152 + .saturating_add(Weight::from_parts(267_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_248_000, 0) - // Standard Error: 5_108 - .saturating_add(Weight::from_parts(763_832, 0).saturating_mul(r.into())) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_223_000, 0) + // Standard Error: 4_611 + .saturating_add(Weight::from_parts(721_127, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_302_000, 0) - // Standard Error: 5_040 - .saturating_add(Weight::from_parts(747_294, 0).saturating_mul(r.into())) + // Minimum execution time: 2_252_000 picoseconds. + Weight::from_parts(2_347_000, 0) + // Standard Error: 5_971 + .saturating_add(Weight::from_parts(742_209, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_251_000 picoseconds. - Weight::from_parts(1_658_576, 0) - // Standard Error: 9_292 - .saturating_add(Weight::from_parts(832_114, 0).saturating_mul(r.into())) + // Minimum execution time: 6_406_000 picoseconds. + Weight::from_parts(2_894_577, 0) + // Standard Error: 8_027 + .saturating_add(Weight::from_parts(801_493, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_366_000 picoseconds. - Weight::from_parts(6_431_000, 0) - // Standard Error: 10_465 - .saturating_add(Weight::from_parts(1_323_456, 0).saturating_mul(r.into())) + // Minimum execution time: 6_345_000 picoseconds. + Weight::from_parts(31_295, 0) + // Standard Error: 10_231 + .saturating_add(Weight::from_parts(1_543_569, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_241_000 picoseconds. - Weight::from_parts(1_511_304, 0) - // Standard Error: 11_616 - .saturating_add(Weight::from_parts(7_105_356, 0).saturating_mul(r.into())) + // Minimum execution time: 3_937_000 picoseconds. + Weight::from_parts(62_049, 0) + // Standard Error: 12_087 + .saturating_add(Weight::from_parts(7_172_920, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_186_000 picoseconds. - Weight::from_parts(2_232_000, 0) - // Standard Error: 5_638 - .saturating_add(Weight::from_parts(3_240_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_262_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 6_042 + .saturating_add(Weight::from_parts(3_394_526, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_238_000, 0) - // Standard Error: 6_253 - .saturating_add(Weight::from_parts(3_051_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_151_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 5_891 + .saturating_add(Weight::from_parts(3_138_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 6_246 - .saturating_add(Weight::from_parts(3_014_119, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_277_000, 0) + // Standard Error: 8_196 + .saturating_add(Weight::from_parts(3_167_033, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 4_860 - .saturating_add(Weight::from_parts(2_602_767, 0).saturating_mul(r.into())) + // Minimum execution time: 2_246_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 5_536 + .saturating_add(Weight::from_parts(2_668_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 3_577 - .saturating_add(Weight::from_parts(551_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(45_432, 0) + // Standard Error: 6_223 + .saturating_add(Weight::from_parts(645_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(1_480_989, 0) - // Standard Error: 3_344 - .saturating_add(Weight::from_parts(381_312, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(1_301_007, 0) + // Standard Error: 4_929 + .saturating_add(Weight::from_parts(446_280, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_251_000, 0) - // Standard Error: 11_018 - .saturating_add(Weight::from_parts(1_807_489, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_205_000, 0) + // Standard Error: 10_412 + .saturating_add(Weight::from_parts(1_894_722, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_219_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 7_919 - .saturating_add(Weight::from_parts(1_121_167, 0).saturating_mul(r.into())) + // Minimum execution time: 2_170_000 picoseconds. + Weight::from_parts(2_257_000, 0) + // Standard Error: 7_708 + .saturating_add(Weight::from_parts(1_162_246, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(1_457_189, 0) - // Standard Error: 3_846 - .saturating_add(Weight::from_parts(363_435, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(1_682_106, 0) + // Standard Error: 3_839 + .saturating_add(Weight::from_parts(384_381, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(1_738_887, 0) - // Standard Error: 3_502 - .saturating_add(Weight::from_parts(345_478, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(1_669_708, 0) + // Standard Error: 3_126 + .saturating_add(Weight::from_parts(384_474, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 3_606 - .saturating_add(Weight::from_parts(488_901, 0).saturating_mul(r.into())) + // Minimum execution time: 2_249_000 picoseconds. + Weight::from_parts(2_291_000, 0) + // Standard Error: 4_476 + .saturating_add(Weight::from_parts(497_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 3_193 - .saturating_add(Weight::from_parts(508_952, 0).saturating_mul(r.into())) + // Minimum execution time: 2_217_000 picoseconds. + Weight::from_parts(2_287_000, 0) + // Standard Error: 4_107 + .saturating_add(Weight::from_parts(524_095, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(458_524, 0) - // Standard Error: 4_582 - .saturating_add(Weight::from_parts(485_788, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(2_233_000, 0) + // Standard Error: 3_690 + .saturating_add(Weight::from_parts(501_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_235_000 picoseconds. - Weight::from_parts(1_405_338, 0) - // Standard Error: 3_418 - .saturating_add(Weight::from_parts(336_701, 0).saturating_mul(r.into())) + // Minimum execution time: 2_132_000 picoseconds. + Weight::from_parts(1_082_506, 0) + // Standard Error: 5_421 + .saturating_add(Weight::from_parts(400_448, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_703_008, 0) - // Standard Error: 2_198 - .saturating_add(Weight::from_parts(159_072, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(3_085_764, 0) + // Standard Error: 1_912 + .saturating_add(Weight::from_parts(162_384, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_814_821, 0) - // Standard Error: 1_823 - .saturating_add(Weight::from_parts(151_994, 0).saturating_mul(r.into())) + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_849_158, 0) + // Standard Error: 1_635 + .saturating_add(Weight::from_parts(153_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 10_432 - .saturating_add(Weight::from_parts(1_731_609, 0).saturating_mul(r.into())) + // Minimum execution time: 2_279_000 picoseconds. + Weight::from_parts(2_315_000, 0) + // Standard Error: 11_776 + .saturating_add(Weight::from_parts(1_779_477, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 6_705 - .saturating_add(Weight::from_parts(1_081_519, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 8_815 + .saturating_add(Weight::from_parts(1_197_093, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 9_924 - .saturating_add(Weight::from_parts(1_713_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_190_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 9_983 + .saturating_add(Weight::from_parts(1_838_257, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_207_000, 0) - // Standard Error: 7_700 - .saturating_add(Weight::from_parts(1_115_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 7_749 + .saturating_add(Weight::from_parts(1_165_862, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_175_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 9_760 - .saturating_add(Weight::from_parts(1_721_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_172_000 picoseconds. + Weight::from_parts(2_246_000, 0) + // Standard Error: 11_426 + .saturating_add(Weight::from_parts(1_828_814, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_143_000 picoseconds. - Weight::from_parts(2_264_000, 0) - // Standard Error: 8_446 - .saturating_add(Weight::from_parts(1_220_324, 0).saturating_mul(r.into())) + // Minimum execution time: 2_187_000 picoseconds. + Weight::from_parts(2_245_000, 0) + // Standard Error: 7_973 + .saturating_add(Weight::from_parts(1_145_613, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_361_000, 0) - // Standard Error: 8_442 - .saturating_add(Weight::from_parts(1_872_827, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_273_000, 0) + // Standard Error: 10_995 + .saturating_add(Weight::from_parts(1_789_814, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_989 - .saturating_add(Weight::from_parts(1_245_468, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_252_000, 0) + // Standard Error: 7_454 + .saturating_add(Weight::from_parts(1_207_539, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_242_000, 0) - // Standard Error: 9_083 - .saturating_add(Weight::from_parts(1_890_871, 0).saturating_mul(r.into())) + // Minimum execution time: 2_219_000 picoseconds. + Weight::from_parts(2_279_000, 0) + // Standard Error: 10_576 + .saturating_add(Weight::from_parts(1_855_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_165_000 picoseconds. - Weight::from_parts(2_269_000, 0) - // Standard Error: 6_819 - .saturating_add(Weight::from_parts(1_201_641, 0).saturating_mul(r.into())) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_265_000, 0) + // Standard Error: 7_405 + .saturating_add(Weight::from_parts(1_180_265, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_236_000, 0) - // Standard Error: 9_879 - .saturating_add(Weight::from_parts(1_860_276, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_285_000, 0) + // Standard Error: 10_994 + .saturating_add(Weight::from_parts(1_835_344, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_144_000 picoseconds. - Weight::from_parts(2_226_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_149_019, 0).saturating_mul(r.into())) + // Minimum execution time: 2_222_000 picoseconds. + Weight::from_parts(2_277_000, 0) + // Standard Error: 7_826 + .saturating_add(Weight::from_parts(1_163_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_259_000, 0) - // Standard Error: 9_793 - .saturating_add(Weight::from_parts(1_816_684, 0).saturating_mul(r.into())) + // Minimum execution time: 2_102_000 picoseconds. + Weight::from_parts(2_217_000, 0) + // Standard Error: 11_374 + .saturating_add(Weight::from_parts(1_910_004, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_280_000, 0) - // Standard Error: 7_439 - .saturating_add(Weight::from_parts(1_151_067, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_303_000, 0) + // Standard Error: 8_971 + .saturating_add(Weight::from_parts(1_182_859, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_176_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 10_695 - .saturating_add(Weight::from_parts(1_814_768, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_284_000, 0) + // Standard Error: 12_177 + .saturating_add(Weight::from_parts(1_866_465, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_571_000 picoseconds. - Weight::from_parts(2_646_000, 0) - // Standard Error: 7_097 - .saturating_add(Weight::from_parts(1_043_279, 0).saturating_mul(r.into())) + // Minimum execution time: 2_468_000 picoseconds. + Weight::from_parts(2_638_000, 0) + // Standard Error: 7_738 + .saturating_add(Weight::from_parts(1_119_369, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_083_000 picoseconds. - Weight::from_parts(2_227_000, 0) - // Standard Error: 12_723 - .saturating_add(Weight::from_parts(1_829_503, 0).saturating_mul(r.into())) + // Minimum execution time: 2_191_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 10_340 + .saturating_add(Weight::from_parts(1_831_738, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 6_578 - .saturating_add(Weight::from_parts(1_119_805, 0).saturating_mul(r.into())) + // Minimum execution time: 2_216_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 6_924 + .saturating_add(Weight::from_parts(1_210_933, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 12_281 - .saturating_add(Weight::from_parts(1_810_231, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_325_000, 0) + // Standard Error: 9_907 + .saturating_add(Weight::from_parts(1_822_715, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_307_000, 0) - // Standard Error: 7_105 - .saturating_add(Weight::from_parts(1_121_865, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 7_927 + .saturating_add(Weight::from_parts(1_168_287, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_112_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 7_396 - .saturating_add(Weight::from_parts(1_189_208, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 8_768 + .saturating_add(Weight::from_parts(1_295_617, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_187_000 picoseconds. - Weight::from_parts(2_282_000, 0) - // Standard Error: 3_728 - .saturating_add(Weight::from_parts(574_689, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 6_314 + .saturating_add(Weight::from_parts(658_832, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_261_000, 0) - // Standard Error: 7_710 - .saturating_add(Weight::from_parts(1_197_933, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 9_261 + .saturating_add(Weight::from_parts(1_348_699, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_277_000 picoseconds. - Weight::from_parts(2_337_000, 0) - // Standard Error: 4_189 - .saturating_add(Weight::from_parts(583_754, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 5_457 + .saturating_add(Weight::from_parts(671_846, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_083_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 12_478 - .saturating_add(Weight::from_parts(1_753_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_180_000 picoseconds. + Weight::from_parts(2_241_000, 0) + // Standard Error: 11_567 + .saturating_add(Weight::from_parts(1_835_171, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_292_000 picoseconds. - Weight::from_parts(2_326_000, 0) - // Standard Error: 6_909 - .saturating_add(Weight::from_parts(1_132_352, 0).saturating_mul(r.into())) + // Minimum execution time: 2_196_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 7_436 + .saturating_add(Weight::from_parts(1_171_019, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_188_000 picoseconds. - Weight::from_parts(522_728, 0) - // Standard Error: 19_552 - .saturating_add(Weight::from_parts(2_704_339, 0).saturating_mul(r.into())) + // Minimum execution time: 2_195_000 picoseconds. + Weight::from_parts(6_299_544, 0) + // Standard Error: 28_028 + .saturating_add(Weight::from_parts(2_500_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(1_526_164, 0) - // Standard Error: 10_257 - .saturating_add(Weight::from_parts(2_359_880, 0).saturating_mul(r.into())) + // Minimum execution time: 2_249_000 picoseconds. + Weight::from_parts(2_576_178, 0) + // Standard Error: 12_042 + .saturating_add(Weight::from_parts(2_335_953, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_144_000, 0) - // Standard Error: 5_377 - .saturating_add(Weight::from_parts(2_945_867, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(8_638_891, 0) + // Standard Error: 32_649 + .saturating_add(Weight::from_parts(2_462_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_169_000 picoseconds. - Weight::from_parts(2_211_000, 0) - // Standard Error: 5_247 - .saturating_add(Weight::from_parts(2_431_536, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_731_170, 0) + // Standard Error: 19_116 + .saturating_add(Weight::from_parts(2_437_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 16_019 - .saturating_add(Weight::from_parts(9_677_056, 0).saturating_mul(r.into())) + // Minimum execution time: 2_261_000 picoseconds. + Weight::from_parts(1_535_146, 0) + // Standard Error: 30_575 + .saturating_add(Weight::from_parts(9_634_377, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_063_031, 0) - // Standard Error: 44_174 - .saturating_add(Weight::from_parts(7_541_106, 0).saturating_mul(r.into())) + // Minimum execution time: 2_209_000 picoseconds. + Weight::from_parts(5_244_298, 0) + // Standard Error: 48_615 + .saturating_add(Weight::from_parts(7_381_672, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(5_205_597, 0) - // Standard Error: 24_468 - .saturating_add(Weight::from_parts(2_768_332, 0).saturating_mul(r.into())) + // Minimum execution time: 2_260_000 picoseconds. + Weight::from_parts(8_453_159, 0) + // Standard Error: 30_530 + .saturating_add(Weight::from_parts(2_541_459, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_216_000, 0) - // Standard Error: 6_057 - .saturating_add(Weight::from_parts(2_466_947, 0).saturating_mul(r.into())) + // Minimum execution time: 2_242_000 picoseconds. + Weight::from_parts(5_507_917, 0) + // Standard Error: 21_457 + .saturating_add(Weight::from_parts(2_217_886, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_260_000 picoseconds. - Weight::from_parts(2_298_000, 0) - // Standard Error: 6_931 - .saturating_add(Weight::from_parts(1_211_851, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 9_253 + .saturating_add(Weight::from_parts(1_354_282, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_267_000, 0) - // Standard Error: 5_345 - .saturating_add(Weight::from_parts(611_062, 0).saturating_mul(r.into())) + // Minimum execution time: 2_170_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 3_908 + .saturating_add(Weight::from_parts(589_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 9_629 - .saturating_add(Weight::from_parts(1_243_254, 0).saturating_mul(r.into())) + // Minimum execution time: 2_184_000 picoseconds. + Weight::from_parts(2_265_000, 0) + // Standard Error: 9_943 + .saturating_add(Weight::from_parts(1_308_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_342_000 picoseconds. - Weight::from_parts(2_377_000, 0) - // Standard Error: 4_075 - .saturating_add(Weight::from_parts(564_916, 0).saturating_mul(r.into())) + // Minimum execution time: 2_212_000 picoseconds. + Weight::from_parts(2_273_000, 0) + // Standard Error: 5_843 + .saturating_add(Weight::from_parts(653_388, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_212_472, 0).saturating_mul(r.into())) + // Minimum execution time: 2_228_000 picoseconds. + Weight::from_parts(2_293_000, 0) + // Standard Error: 9_157 + .saturating_add(Weight::from_parts(1_290_731, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_238_000, 0) - // Standard Error: 3_674 - .saturating_add(Weight::from_parts(587_206, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 4_020 + .saturating_add(Weight::from_parts(618_071, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 6_543 - .saturating_add(Weight::from_parts(993_044, 0).saturating_mul(r.into())) + // Minimum execution time: 2_239_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 7_192 + .saturating_add(Weight::from_parts(1_061_312, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_225_000, 0) - // Standard Error: 3_274 - .saturating_add(Weight::from_parts(509_569, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_245_000, 0) + // Standard Error: 3_756 + .saturating_add(Weight::from_parts(568_744, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_197_000, 0) - // Standard Error: 6_768 - .saturating_add(Weight::from_parts(979_181, 0).saturating_mul(r.into())) + // Minimum execution time: 2_248_000 picoseconds. + Weight::from_parts(2_324_000, 0) + // Standard Error: 7_917 + .saturating_add(Weight::from_parts(1_106_132, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(26_961, 0) - // Standard Error: 6_012 - .saturating_add(Weight::from_parts(578_422, 0).saturating_mul(r.into())) + // Minimum execution time: 2_205_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 4_617 + .saturating_add(Weight::from_parts(599_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_173_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 7_198 - .saturating_add(Weight::from_parts(985_992, 0).saturating_mul(r.into())) + // Minimum execution time: 2_215_000 picoseconds. + Weight::from_parts(2_346_000, 0) + // Standard Error: 7_501 + .saturating_add(Weight::from_parts(1_125_645, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 3_582 - .saturating_add(Weight::from_parts(504_208, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 5_262 + .saturating_add(Weight::from_parts(624_680, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_242_000, 0) - // Standard Error: 8_356 - .saturating_add(Weight::from_parts(1_025_849, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 7_879 + .saturating_add(Weight::from_parts(1_068_877, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_305_000 picoseconds. - Weight::from_parts(272_670, 0) - // Standard Error: 6_376 - .saturating_add(Weight::from_parts(599_190, 0).saturating_mul(r.into())) + // Minimum execution time: 2_192_000 picoseconds. + Weight::from_parts(2_288_000, 0) + // Standard Error: 4_124 + .saturating_add(Weight::from_parts(567_690, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 6_937 - .saturating_add(Weight::from_parts(1_018_594, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 8_516 + .saturating_add(Weight::from_parts(1_174_764, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_202_000, 0) - // Standard Error: 4_010 - .saturating_add(Weight::from_parts(573_907, 0).saturating_mul(r.into())) + // Minimum execution time: 2_171_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 4_901 + .saturating_add(Weight::from_parts(628_068, 0).saturating_mul(r.into())) } } diff --git a/runtime/gear/src/weights/pallet_gear_voucher.rs b/runtime/gear/src/weights/pallet_gear_voucher.rs index 0d33d1af77c..9ce90d81e6b 100644 --- a/runtime/gear/src/weights/pallet_gear_voucher.rs +++ b/runtime/gear/src/weights/pallet_gear_voucher.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear_voucher //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -47,8 +47,8 @@ impl pallet_gear_voucher::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 28_289_000 picoseconds. - Weight::from_parts(29_529_000, 6196) + // Minimum execution time: 28_703_000 picoseconds. + Weight::from_parts(29_520_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -60,8 +60,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 28_289_000 picoseconds. - Weight::from_parts(29_529_000, 6196) + // Minimum execution time: 28_703_000 picoseconds. + Weight::from_parts(29_520_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/runtime/gear/src/weights/pallet_timestamp.rs b/runtime/gear/src/weights/pallet_timestamp.rs index 2739068af11..bddda071d0f 100644 --- a/runtime/gear/src/weights/pallet_timestamp.rs +++ b/runtime/gear/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -48,8 +48,8 @@ impl pallet_timestamp::WeightInfo for SubstrateWeight pallet_timestamp::WeightInfo for SubstrateWeight pallet_utility::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_368_000 picoseconds. - Weight::from_parts(11_789_021, 0) - // Standard Error: 4_504 - .saturating_add(Weight::from_parts(4_009_148, 0).saturating_mul(c.into())) + // Minimum execution time: 5_618_000 picoseconds. + Weight::from_parts(13_560_220, 0) + // Standard Error: 5_243 + .saturating_add(Weight::from_parts(3_938_406, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_046_000 picoseconds. - Weight::from_parts(4_152_000, 0) + // Minimum execution time: 3_826_000 picoseconds. + Weight::from_parts(4_114_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_502_000 picoseconds. - Weight::from_parts(11_623_880, 0) - // Standard Error: 7_083 - .saturating_add(Weight::from_parts(4_332_482, 0).saturating_mul(c.into())) + // Minimum execution time: 5_376_000 picoseconds. + Weight::from_parts(4_303_245, 0) + // Standard Error: 7_216 + .saturating_add(Weight::from_parts(4_194_979, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_088_000 picoseconds. - Weight::from_parts(7_457_000, 0) + // Minimum execution time: 7_307_000 picoseconds. + Weight::from_parts(7_643_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_461_000 picoseconds. - Weight::from_parts(4_295_594, 0) - // Standard Error: 4_960 - .saturating_add(Weight::from_parts(4_016_962, 0).saturating_mul(c.into())) + // Minimum execution time: 5_123_000 picoseconds. + Weight::from_parts(5_780_504, 0) + // Standard Error: 7_424 + .saturating_add(Weight::from_parts(3_988_181, 0).saturating_mul(c.into())) } } @@ -100,43 +100,43 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_368_000 picoseconds. - Weight::from_parts(11_789_021, 0) - // Standard Error: 4_504 - .saturating_add(Weight::from_parts(4_009_148, 0).saturating_mul(c.into())) + // Minimum execution time: 5_618_000 picoseconds. + Weight::from_parts(13_560_220, 0) + // Standard Error: 5_243 + .saturating_add(Weight::from_parts(3_938_406, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_046_000 picoseconds. - Weight::from_parts(4_152_000, 0) + // Minimum execution time: 3_826_000 picoseconds. + Weight::from_parts(4_114_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_502_000 picoseconds. - Weight::from_parts(11_623_880, 0) - // Standard Error: 7_083 - .saturating_add(Weight::from_parts(4_332_482, 0).saturating_mul(c.into())) + // Minimum execution time: 5_376_000 picoseconds. + Weight::from_parts(4_303_245, 0) + // Standard Error: 7_216 + .saturating_add(Weight::from_parts(4_194_979, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_088_000 picoseconds. - Weight::from_parts(7_457_000, 0) + // Minimum execution time: 7_307_000 picoseconds. + Weight::from_parts(7_643_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_461_000 picoseconds. - Weight::from_parts(4_295_594, 0) - // Standard Error: 4_960 - .saturating_add(Weight::from_parts(4_016_962, 0).saturating_mul(c.into())) + // Minimum execution time: 5_123_000 picoseconds. + Weight::from_parts(5_780_504, 0) + // Standard Error: 7_424 + .saturating_add(Weight::from_parts(3_988_181, 0).saturating_mul(c.into())) } } diff --git a/runtime/vara/src/tests.rs b/runtime/vara/src/tests.rs index bc3e90d69ea..1151b53d08e 100644 --- a/runtime/vara/src/tests.rs +++ b/runtime/vara/src/tests.rs @@ -145,7 +145,7 @@ fn page_costs_heuristic_test() { load_page_data: 8_700_000.into(), upload_page_data: 104_000_000.into(), static_page: 100.into(), - mem_grow: 277_000.into(), + mem_grow: 306_170.into(), parachain_load_heuristic: 0.into(), }; diff --git a/runtime/vara/src/weights/frame_system.rs b/runtime/vara/src/weights/frame_system.rs index 81a9a00a7c7..d2c4cc19e52 100644 --- a/runtime/vara/src/weights/frame_system.rs +++ b/runtime/vara/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_518_000 picoseconds. - Weight::from_parts(1_192_167, 0) + // Minimum execution time: 1_545_000 picoseconds. + Weight::from_parts(1_316_572, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(459, 0).saturating_mul(b.into())) } @@ -63,17 +63,17 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_888_000 picoseconds. - Weight::from_parts(4_658_507, 0) - // Standard Error: 2 + // Minimum execution time: 5_923_000 picoseconds. + Weight::from_parts(6_124_000, 0) + // Standard Error: 0 .saturating_add(Weight::from_parts(1_437, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_970_000 picoseconds. - Weight::from_parts(3_270_000, 1485) + // Minimum execution time: 3_063_000 picoseconds. + Weight::from_parts(3_389_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -82,10 +82,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_559_000 picoseconds. - Weight::from_parts(1_661_000, 0) - // Standard Error: 950 - .saturating_add(Weight::from_parts(685_802, 0).saturating_mul(i.into())) + // Minimum execution time: 1_641_000 picoseconds. + Weight::from_parts(1_707_000, 0) + // Standard Error: 959 + .saturating_add(Weight::from_parts(686_028, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -93,10 +93,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_596_000 picoseconds. - Weight::from_parts(1_636_000, 0) - // Standard Error: 771 - .saturating_add(Weight::from_parts(525_176, 0).saturating_mul(i.into())) + // Minimum execution time: 1_644_000 picoseconds. + Weight::from_parts(1_678_000, 0) + // Standard Error: 747 + .saturating_add(Weight::from_parts(524_085, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -104,10 +104,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `82 + p * (69 ±0)` // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 3_380_000 picoseconds. - Weight::from_parts(3_527_000, 83) - // Standard Error: 1_332 - .saturating_add(Weight::from_parts(1_106_297, 0).saturating_mul(p.into())) + // Minimum execution time: 3_294_000 picoseconds. + Weight::from_parts(3_471_000, 83) + // Standard Error: 1_159 + .saturating_add(Weight::from_parts(1_110_583, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -121,8 +121,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_518_000 picoseconds. - Weight::from_parts(1_192_167, 0) + // Minimum execution time: 1_545_000 picoseconds. + Weight::from_parts(1_316_572, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(459, 0).saturating_mul(b.into())) } @@ -131,17 +131,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_888_000 picoseconds. - Weight::from_parts(4_658_507, 0) - // Standard Error: 2 + // Minimum execution time: 5_923_000 picoseconds. + Weight::from_parts(6_124_000, 0) + // Standard Error: 0 .saturating_add(Weight::from_parts(1_437, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_970_000 picoseconds. - Weight::from_parts(3_270_000, 1485) + // Minimum execution time: 3_063_000 picoseconds. + Weight::from_parts(3_389_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -150,10 +150,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_559_000 picoseconds. - Weight::from_parts(1_661_000, 0) - // Standard Error: 950 - .saturating_add(Weight::from_parts(685_802, 0).saturating_mul(i.into())) + // Minimum execution time: 1_641_000 picoseconds. + Weight::from_parts(1_707_000, 0) + // Standard Error: 959 + .saturating_add(Weight::from_parts(686_028, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -161,10 +161,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_596_000 picoseconds. - Weight::from_parts(1_636_000, 0) - // Standard Error: 771 - .saturating_add(Weight::from_parts(525_176, 0).saturating_mul(i.into())) + // Minimum execution time: 1_644_000 picoseconds. + Weight::from_parts(1_678_000, 0) + // Standard Error: 747 + .saturating_add(Weight::from_parts(524_085, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -172,10 +172,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `82 + p * (69 ±0)` // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 3_380_000 picoseconds. - Weight::from_parts(3_527_000, 83) - // Standard Error: 1_332 - .saturating_add(Weight::from_parts(1_106_297, 0).saturating_mul(p.into())) + // Minimum execution time: 3_294_000 picoseconds. + Weight::from_parts(3_471_000, 83) + // Standard Error: 1_159 + .saturating_add(Weight::from_parts(1_110_583, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/runtime/vara/src/weights/pallet_balances.rs b/runtime/vara/src/weights/pallet_balances.rs index 214bcb386d2..7c5d3c9d263 100644 --- a/runtime/vara/src/weights/pallet_balances.rs +++ b/runtime/vara/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_182_000 picoseconds. - Weight::from_parts(31_788_000, 3593) + // Minimum execution time: 31_720_000 picoseconds. + Weight::from_parts(32_331_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -62,8 +62,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 22_735_000 picoseconds. - Weight::from_parts(23_348_000, 3593) + // Minimum execution time: 23_027_000 picoseconds. + Weight::from_parts(23_472_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -71,8 +71,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 13_042_000 picoseconds. - Weight::from_parts(13_473_000, 3593) + // Minimum execution time: 12_856_000 picoseconds. + Weight::from_parts(13_281_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +80,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_436_000 picoseconds. - Weight::from_parts(15_780_000, 3593) + // Minimum execution time: 15_656_000 picoseconds. + Weight::from_parts(16_124_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -89,8 +89,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 32_661_000 picoseconds. - Weight::from_parts(33_349_000, 6196) + // Minimum execution time: 33_238_000 picoseconds. + Weight::from_parts(33_914_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -98,8 +98,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 28_900_000 picoseconds. - Weight::from_parts(29_677_000, 3593) + // Minimum execution time: 29_167_000 picoseconds. + Weight::from_parts(29_692_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,8 +107,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_306_000 picoseconds. - Weight::from_parts(12_757_000, 3593) + // Minimum execution time: 12_557_000 picoseconds. + Weight::from_parts(12_942_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +120,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_182_000 picoseconds. - Weight::from_parts(31_788_000, 3593) + // Minimum execution time: 31_720_000 picoseconds. + Weight::from_parts(32_331_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -129,8 +129,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 22_735_000 picoseconds. - Weight::from_parts(23_348_000, 3593) + // Minimum execution time: 23_027_000 picoseconds. + Weight::from_parts(23_472_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 13_042_000 picoseconds. - Weight::from_parts(13_473_000, 3593) + // Minimum execution time: 12_856_000 picoseconds. + Weight::from_parts(13_281_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -147,8 +147,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_436_000 picoseconds. - Weight::from_parts(15_780_000, 3593) + // Minimum execution time: 15_656_000 picoseconds. + Weight::from_parts(16_124_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -156,8 +156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 32_661_000 picoseconds. - Weight::from_parts(33_349_000, 6196) + // Minimum execution time: 33_238_000 picoseconds. + Weight::from_parts(33_914_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -165,8 +165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 28_900_000 picoseconds. - Weight::from_parts(29_677_000, 3593) + // Minimum execution time: 29_167_000 picoseconds. + Weight::from_parts(29_692_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -174,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_306_000 picoseconds. - Weight::from_parts(12_757_000, 3593) + // Minimum execution time: 12_557_000 picoseconds. + Weight::from_parts(12_942_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/runtime/vara/src/weights/pallet_gear.rs b/runtime/vara/src/weights/pallet_gear.rs index 77cd5c675f5..89a72918825 100644 --- a/runtime/vara/src/weights/pallet_gear.rs +++ b/runtime/vara/src/weights/pallet_gear.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -246,10 +246,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_013_000 picoseconds. - Weight::from_parts(1_062_000, 0) - // Standard Error: 762 - .saturating_add(Weight::from_parts(208_216, 0).saturating_mul(c.into())) + // Minimum execution time: 1_003_000 picoseconds. + Weight::from_parts(1_051_000, 0) + // Standard Error: 968 + .saturating_add(Weight::from_parts(212_482, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -257,10 +257,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `113 + c * (1024 ±0)` // Estimated: `3577 + c * (1024 ±0)` - // Minimum execution time: 3_308_000 picoseconds. - Weight::from_parts(3_370_000, 3577) - // Standard Error: 862 - .saturating_add(Weight::from_parts(670_306, 0).saturating_mul(c.into())) + // Minimum execution time: 3_267_000 picoseconds. + Weight::from_parts(3_316_000, 3577) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(688_242, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -269,17 +269,17 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 53_243_000 picoseconds. - Weight::from_parts(97_332_650, 0) - // Standard Error: 9_388 - .saturating_add(Weight::from_parts(2_412_828, 0).saturating_mul(c.into())) + // Minimum execution time: 53_248_000 picoseconds. + Weight::from_parts(71_345_881, 0) + // Standard Error: 10_707 + .saturating_add(Weight::from_parts(2_548_249, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1050` // Estimated: `42875` - // Minimum execution time: 85_496_000 picoseconds. - Weight::from_parts(87_834_000, 42875) + // Minimum execution time: 84_992_000 picoseconds. + Weight::from_parts(88_176_000, 42875) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -287,8 +287,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `958` // Estimated: `21477` - // Minimum execution time: 56_911_000 picoseconds. - Weight::from_parts(58_442_000, 21477) + // Minimum execution time: 56_951_000 picoseconds. + Weight::from_parts(58_755_000, 21477) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -296,8 +296,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `605` // Estimated: `17354` - // Minimum execution time: 30_232_000 picoseconds. - Weight::from_parts(31_315_000, 17354) + // Minimum execution time: 30_483_000 picoseconds. + Weight::from_parts(31_174_000, 17354) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -306,22 +306,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_178_000 picoseconds. - Weight::from_parts(3_437_304, 7640) - // Standard Error: 39_204 - .saturating_add(Weight::from_parts(15_994_815, 0).saturating_mul(c.into())) + // Minimum execution time: 8_269_000 picoseconds. + Weight::from_parts(7_343_300, 7640) + // Standard Error: 45_015 + .saturating_add(Weight::from_parts(15_758_869, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1506 + c * (16389 ±0)` - // Estimated: `42570 + c * (131112 ±0)` - // Minimum execution time: 72_721_000 picoseconds. - Weight::from_parts(73_726_000, 42570) - // Standard Error: 154_956 - .saturating_add(Weight::from_parts(53_504_047, 0).saturating_mul(c.into())) + // Measured: `1439 + c * (16389 ±0)` + // Estimated: `42034 + c * (131112 ±0)` + // Minimum execution time: 70_643_000 picoseconds. + Weight::from_parts(71_487_000, 42034) + // Standard Error: 217_960 + .saturating_add(Weight::from_parts(56_304_860, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -332,22 +332,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `80` // Estimated: `5270` - // Minimum execution time: 65_687_000 picoseconds. - Weight::from_parts(46_647_789, 5270) - // Standard Error: 54_648 - .saturating_add(Weight::from_parts(51_714_144, 0).saturating_mul(c.into())) + // Minimum execution time: 63_871_000 picoseconds. + Weight::from_parts(31_431_372, 5270) + // Standard Error: 58_224 + .saturating_add(Weight::from_parts(52_560_364, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `809` - // Estimated: `40156` - // Minimum execution time: 66_542_000 picoseconds. - Weight::from_parts(93_243_157, 40156) - // Standard Error: 0 - .saturating_add(Weight::from_parts(2_589, 0).saturating_mul(s.into())) + // Measured: `742` + // Estimated: `39419` + // Minimum execution time: 65_988_000 picoseconds. + Weight::from_parts(102_441_114, 39419) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_612, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -357,12 +357,12 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `306` // Estimated: `35235` - // Minimum execution time: 10_927_529_000 picoseconds. - Weight::from_parts(210_363_179, 35235) - // Standard Error: 181_741 - .saturating_add(Weight::from_parts(53_013_780, 0).saturating_mul(c.into())) + // Minimum execution time: 11_021_135_000 picoseconds. + Weight::from_parts(397_699_856, 35235) + // Standard Error: 169_994 + .saturating_add(Weight::from_parts(52_665_060, 0).saturating_mul(c.into())) // Standard Error: 10 - .saturating_add(Weight::from_parts(2_549, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_533, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)) } @@ -371,10 +371,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `349` // Estimated: `23860` - // Minimum execution time: 57_520_000 picoseconds. - Weight::from_parts(25_773_414, 23860) + // Minimum execution time: 57_013_000 picoseconds. + Weight::from_parts(35_413_717, 23860) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_183, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_158, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -383,10 +383,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452` // Estimated: `27184` - // Minimum execution time: 61_121_000 picoseconds. - Weight::from_parts(62_484_320, 27184) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_130, 0).saturating_mul(p.into())) + // Minimum execution time: 60_180_000 picoseconds. + Weight::from_parts(33_390_466, 27184) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_167, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } @@ -395,10 +395,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1049` // Estimated: `42866` - // Minimum execution time: 86_054_000 picoseconds. - Weight::from_parts(67_868_446, 42866) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_154, 0).saturating_mul(p.into())) + // Minimum execution time: 87_446_000 picoseconds. + Weight::from_parts(69_330_706, 42866) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_174, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -407,22 +407,20 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1152` // Estimated: `46396` - // Minimum execution time: 97_133_000 picoseconds. - Weight::from_parts(79_387_060, 46396) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_154, 0).saturating_mul(p.into())) + // Minimum execution time: 97_152_000 picoseconds. + Weight::from_parts(77_891_346, 46396) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_170, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85981` - // Minimum execution time: 328_011_000 picoseconds. - Weight::from_parts(342_159_914, 85981) - // Standard Error: 1_525 - .saturating_add(Weight::from_parts(1_995, 0).saturating_mul(q.into())) + // Minimum execution time: 323_882_000 picoseconds. + Weight::from_parts(336_539_045, 85981) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().writes(23_u64)) } @@ -431,8 +429,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85905` - // Minimum execution time: 340_290_000 picoseconds. - Weight::from_parts(358_988_235, 85905) + // Minimum execution time: 336_406_000 picoseconds. + Weight::from_parts(353_807_338, 85905) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().writes(23_u64)) } @@ -441,10 +439,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 46_941_000 picoseconds. - Weight::from_parts(47_858_000, 3899) - // Standard Error: 33_955 - .saturating_add(Weight::from_parts(52_183_484, 0).saturating_mul(c.into())) + // Minimum execution time: 45_464_000 picoseconds. + Weight::from_parts(45_831_000, 3899) + // Standard Error: 36_617 + .saturating_add(Weight::from_parts(51_273_892, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -454,630 +452,630 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_721_000 picoseconds. - Weight::from_parts(91_686_000, 0) - // Standard Error: 4_360_909 - .saturating_add(Weight::from_parts(708_494_415, 0).saturating_mul(r.into())) + // Minimum execution time: 84_254_000 picoseconds. + Weight::from_parts(86_749_000, 0) + // Standard Error: 3_967_638 + .saturating_add(Weight::from_parts(617_894_062, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 425_225_000 picoseconds. - Weight::from_parts(342_526_988, 0) - // Standard Error: 8_800 - .saturating_add(Weight::from_parts(34_071_489, 0).saturating_mul(p.into())) + // Minimum execution time: 366_392_000 picoseconds. + Weight::from_parts(294_624_660, 0) + // Standard Error: 10_067 + .saturating_add(Weight::from_parts(30_802_641, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 251_684_000 picoseconds. - Weight::from_parts(287_320_625, 0) - // Standard Error: 420_785 - .saturating_add(Weight::from_parts(164_219_884, 0).saturating_mul(r.into())) + // Minimum execution time: 199_070_000 picoseconds. + Weight::from_parts(213_938_845, 0) + // Standard Error: 343_895 + .saturating_add(Weight::from_parts(120_152_478, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_698_000 picoseconds. - Weight::from_parts(96_719_489, 0) - // Standard Error: 4_542 - .saturating_add(Weight::from_parts(4_169_455, 0).saturating_mul(r.into())) + // Minimum execution time: 85_714_000 picoseconds. + Weight::from_parts(96_261_609, 0) + // Standard Error: 3_991 + .saturating_add(Weight::from_parts(3_567_375, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_286_000 picoseconds. - Weight::from_parts(187_984_555, 0) - // Standard Error: 33_004 - .saturating_add(Weight::from_parts(4_435_556, 0).saturating_mul(r.into())) + // Minimum execution time: 139_882_000 picoseconds. + Weight::from_parts(221_553_985, 0) + // Standard Error: 29_743 + .saturating_add(Weight::from_parts(3_602_987, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_614_000 picoseconds. - Weight::from_parts(118_513_629, 0) - // Standard Error: 374_601 - .saturating_add(Weight::from_parts(233_587_547, 0).saturating_mul(r.into())) + // Minimum execution time: 87_497_000 picoseconds. + Weight::from_parts(118_603_695, 0) + // Standard Error: 431_810 + .saturating_add(Weight::from_parts(177_456_338, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_577_000 picoseconds. - Weight::from_parts(88_217_180, 0) - // Standard Error: 308_296 - .saturating_add(Weight::from_parts(231_658_884, 0).saturating_mul(r.into())) + // Minimum execution time: 88_831_000 picoseconds. + Weight::from_parts(88_005_607, 0) + // Standard Error: 244_708 + .saturating_add(Weight::from_parts(175_744_834, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_776_000 picoseconds. - Weight::from_parts(84_411_464, 0) - // Standard Error: 300_083 - .saturating_add(Weight::from_parts(231_214_712, 0).saturating_mul(r.into())) + // Minimum execution time: 84_145_000 picoseconds. + Weight::from_parts(86_969_872, 0) + // Standard Error: 302_008 + .saturating_add(Weight::from_parts(180_744_297, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_020_000 picoseconds. - Weight::from_parts(88_213_734, 0) - // Standard Error: 299_486 - .saturating_add(Weight::from_parts(234_626_108, 0).saturating_mul(r.into())) + // Minimum execution time: 84_337_000 picoseconds. + Weight::from_parts(80_268_581, 0) + // Standard Error: 290_578 + .saturating_add(Weight::from_parts(180_541_423, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 90_531_000 picoseconds. - Weight::from_parts(77_088_751, 0) - // Standard Error: 300_109 - .saturating_add(Weight::from_parts(230_369_251, 0).saturating_mul(r.into())) + // Minimum execution time: 85_327_000 picoseconds. + Weight::from_parts(84_307_332, 0) + // Standard Error: 316_639 + .saturating_add(Weight::from_parts(179_561_839, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_087_000 picoseconds. - Weight::from_parts(84_427_914, 0) - // Standard Error: 251_575 - .saturating_add(Weight::from_parts(230_149_202, 0).saturating_mul(r.into())) + // Minimum execution time: 85_300_000 picoseconds. + Weight::from_parts(70_645_226, 0) + // Standard Error: 320_673 + .saturating_add(Weight::from_parts(182_342_085, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_844_000 picoseconds. - Weight::from_parts(86_923_662, 0) - // Standard Error: 276_902 - .saturating_add(Weight::from_parts(228_642_855, 0).saturating_mul(r.into())) + // Minimum execution time: 86_250_000 picoseconds. + Weight::from_parts(81_902_510, 0) + // Standard Error: 273_253 + .saturating_add(Weight::from_parts(180_582_426, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_211_000 picoseconds. - Weight::from_parts(97_915_752, 0) - // Standard Error: 307_205 - .saturating_add(Weight::from_parts(227_793_024, 0).saturating_mul(r.into())) + // Minimum execution time: 84_232_000 picoseconds. + Weight::from_parts(87_259_581, 0) + // Standard Error: 294_035 + .saturating_add(Weight::from_parts(175_294_464, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 565_301_000 picoseconds. - Weight::from_parts(644_433_401, 0) - // Standard Error: 568_889 - .saturating_add(Weight::from_parts(310_873_805, 0).saturating_mul(r.into())) + // Minimum execution time: 595_636_000 picoseconds. + Weight::from_parts(656_136_663, 0) + // Standard Error: 485_302 + .saturating_add(Weight::from_parts(261_855_478, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 854_359_000 picoseconds. - Weight::from_parts(867_584_000, 0) - // Standard Error: 55_314 - .saturating_add(Weight::from_parts(13_529_431, 0).saturating_mul(n.into())) + // Minimum execution time: 850_360_000 picoseconds. + Weight::from_parts(903_367_000, 0) + // Standard Error: 55_203 + .saturating_add(Weight::from_parts(13_094_816, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_162_000 picoseconds. - Weight::from_parts(73_330_737, 0) - // Standard Error: 367_053 - .saturating_add(Weight::from_parts(230_816_956, 0).saturating_mul(r.into())) + // Minimum execution time: 87_957_000 picoseconds. + Weight::from_parts(87_586_547, 0) + // Standard Error: 323_063 + .saturating_add(Weight::from_parts(174_117_671, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_475_000 picoseconds. - Weight::from_parts(88_825_613, 0) - // Standard Error: 317_797 - .saturating_add(Weight::from_parts(229_372_938, 0).saturating_mul(r.into())) + // Minimum execution time: 87_008_000 picoseconds. + Weight::from_parts(78_303_076, 0) + // Standard Error: 299_495 + .saturating_add(Weight::from_parts(175_222_715, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_490_000 picoseconds. - Weight::from_parts(101_323_435, 0) - // Standard Error: 334_119 - .saturating_add(Weight::from_parts(299_903_252, 0).saturating_mul(n.into())) + // Minimum execution time: 84_234_000 picoseconds. + Weight::from_parts(103_801_859, 0) + // Standard Error: 382_198 + .saturating_add(Weight::from_parts(245_171_881, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_576_000 picoseconds. - Weight::from_parts(94_527_000, 0) - // Standard Error: 4_270_115 - .saturating_add(Weight::from_parts(1_194_160_557, 0).saturating_mul(r.into())) + // Minimum execution time: 85_211_000 picoseconds. + Weight::from_parts(87_766_000, 0) + // Standard Error: 4_237_435 + .saturating_add(Weight::from_parts(1_076_031_771, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_977_000 picoseconds. - Weight::from_parts(141_823_097, 0) - // Standard Error: 496_715 - .saturating_add(Weight::from_parts(434_963_088, 0).saturating_mul(r.into())) + // Minimum execution time: 84_722_000 picoseconds. + Weight::from_parts(144_011_827, 0) + // Standard Error: 476_324 + .saturating_add(Weight::from_parts(387_231_993, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 518_193_000 picoseconds. - Weight::from_parts(524_909_000, 0) - // Standard Error: 62_300 - .saturating_add(Weight::from_parts(21_321_135, 0).saturating_mul(n.into())) + // Minimum execution time: 461_434_000 picoseconds. + Weight::from_parts(469_780_000, 0) + // Standard Error: 61_125 + .saturating_add(Weight::from_parts(21_613_603, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_523_000 picoseconds. - Weight::from_parts(151_675_920, 0) - // Standard Error: 482_814 - .saturating_add(Weight::from_parts(439_883_435, 0).saturating_mul(r.into())) + // Minimum execution time: 88_818_000 picoseconds. + Weight::from_parts(149_809_757, 0) + // Standard Error: 456_443 + .saturating_add(Weight::from_parts(395_488_333, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 526_574_000 picoseconds. - Weight::from_parts(532_320_000, 0) - // Standard Error: 57_892 - .saturating_add(Weight::from_parts(21_033_810, 0).saturating_mul(n.into())) + // Minimum execution time: 479_154_000 picoseconds. + Weight::from_parts(483_278_000, 0) + // Standard Error: 67_159 + .saturating_add(Weight::from_parts(21_947_194, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 565_329_000 picoseconds. - Weight::from_parts(628_847_199, 0) - // Standard Error: 567_127 - .saturating_add(Weight::from_parts(459_380_406, 0).saturating_mul(r.into())) + // Minimum execution time: 567_500_000 picoseconds. + Weight::from_parts(693_644_323, 0) + // Standard Error: 568_410 + .saturating_add(Weight::from_parts(412_109_027, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 563_636_000 picoseconds. - Weight::from_parts(667_937_303, 0) - // Standard Error: 627_480 - .saturating_add(Weight::from_parts(464_327_915, 0).saturating_mul(r.into())) + // Minimum execution time: 575_808_000 picoseconds. + Weight::from_parts(724_736_213, 0) + // Standard Error: 602_935 + .saturating_add(Weight::from_parts(412_885_093, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_009_000 picoseconds. - Weight::from_parts(90_613_264, 0) - // Standard Error: 336_555 - .saturating_add(Weight::from_parts(239_670_711, 0).saturating_mul(r.into())) + // Minimum execution time: 85_691_000 picoseconds. + Weight::from_parts(74_497_929, 0) + // Standard Error: 328_672 + .saturating_add(Weight::from_parts(197_295_056, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_427_000 picoseconds. - Weight::from_parts(4_919_028_362, 0) - // Standard Error: 436_952 - .saturating_add(Weight::from_parts(334_184_878, 0).saturating_mul(r.into())) + // Minimum execution time: 3_899_275_000 picoseconds. + Weight::from_parts(4_052_914_766, 0) + // Standard Error: 433_071 + .saturating_add(Weight::from_parts(279_414_467, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 581_270_000 picoseconds. - Weight::from_parts(587_607_000, 0) - // Standard Error: 56_972 - .saturating_add(Weight::from_parts(29_524_607, 0).saturating_mul(n.into())) + // Minimum execution time: 481_093_000 picoseconds. + Weight::from_parts(489_651_000, 0) + // Standard Error: 58_131 + .saturating_add(Weight::from_parts(29_725_779, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_804_492_000 picoseconds. - Weight::from_parts(4_913_430_363, 0) - // Standard Error: 550_705 - .saturating_add(Weight::from_parts(396_433_500, 0).saturating_mul(r.into())) + // Minimum execution time: 3_898_930_000 picoseconds. + Weight::from_parts(4_051_051_643, 0) + // Standard Error: 422_685 + .saturating_add(Weight::from_parts(335_909_883, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_795_428_000 picoseconds. - Weight::from_parts(4_944_127_505, 0) - // Standard Error: 488_447 - .saturating_add(Weight::from_parts(404_922_939, 0).saturating_mul(r.into())) + // Minimum execution time: 3_889_863_000 picoseconds. + Weight::from_parts(4_037_859_582, 0) + // Standard Error: 492_684 + .saturating_add(Weight::from_parts(354_039_027, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 255_233_000 picoseconds. - Weight::from_parts(318_618_896, 0) - // Standard Error: 505_767 - .saturating_add(Weight::from_parts(453_094_917, 0).saturating_mul(r.into())) + // Minimum execution time: 254_292_000 picoseconds. + Weight::from_parts(299_243_857, 0) + // Standard Error: 453_209 + .saturating_add(Weight::from_parts(402_577_817, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 681_100_000 picoseconds. - Weight::from_parts(694_074_000, 0) - // Standard Error: 58_042 - .saturating_add(Weight::from_parts(21_718_065, 0).saturating_mul(n.into())) + // Minimum execution time: 654_055_000 picoseconds. + Weight::from_parts(663_310_000, 0) + // Standard Error: 60_031 + .saturating_add(Weight::from_parts(21_652_831, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_971_144_000 picoseconds. - Weight::from_parts(5_113_524_443, 0) - // Standard Error: 622_444 - .saturating_add(Weight::from_parts(405_616_523, 0).saturating_mul(r.into())) + // Minimum execution time: 4_054_583_000 picoseconds. + Weight::from_parts(4_192_801_478, 0) + // Standard Error: 494_878 + .saturating_add(Weight::from_parts(356_698_705, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_531_000 picoseconds. - Weight::from_parts(92_058_153, 0) - // Standard Error: 277_495 - .saturating_add(Weight::from_parts(22_329_146, 0).saturating_mul(r.into())) + // Minimum execution time: 84_037_000 picoseconds. + Weight::from_parts(88_828_036, 0) + // Standard Error: 335_490 + .saturating_add(Weight::from_parts(26_597_063, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_664_000 picoseconds. - Weight::from_parts(89_554_700, 0) - // Standard Error: 5_459 - .saturating_add(Weight::from_parts(440_219, 0).saturating_mul(n.into())) + // Minimum execution time: 108_733_000 picoseconds. + Weight::from_parts(93_898_943, 0) + // Standard Error: 1_151 + .saturating_add(Weight::from_parts(428_904, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_067_000 picoseconds. - Weight::from_parts(89_450_440, 0) - // Standard Error: 271_734 - .saturating_add(Weight::from_parts(21_972_159, 0).saturating_mul(r.into())) + // Minimum execution time: 82_569_000 picoseconds. + Weight::from_parts(89_213_638, 0) + // Standard Error: 317_917 + .saturating_add(Weight::from_parts(22_797_961, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 108_108_000 picoseconds. - Weight::from_parts(100_790_952, 0) - // Standard Error: 1_751 - .saturating_add(Weight::from_parts(424_412, 0).saturating_mul(n.into())) + // Minimum execution time: 109_164_000 picoseconds. + Weight::from_parts(95_571_505, 0) + // Standard Error: 1_085 + .saturating_add(Weight::from_parts(425_025, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_953_000 picoseconds. - Weight::from_parts(89_527_906, 0) - // Standard Error: 343_008 - .saturating_add(Weight::from_parts(25_490_493, 0).saturating_mul(r.into())) + // Minimum execution time: 83_844_000 picoseconds. + Weight::from_parts(88_247_426, 0) + // Standard Error: 280_700 + .saturating_add(Weight::from_parts(17_706_873, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_267_000 picoseconds. - Weight::from_parts(91_613_297, 0) - // Standard Error: 266_992 - .saturating_add(Weight::from_parts(18_796_902, 0).saturating_mul(r.into())) + // Minimum execution time: 82_987_000 picoseconds. + Weight::from_parts(87_544_514, 0) + // Standard Error: 269_120 + .saturating_add(Weight::from_parts(21_098_185, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_555_000 picoseconds. - Weight::from_parts(125_646_143, 0) - // Standard Error: 438_029 - .saturating_add(Weight::from_parts(321_292_767, 0).saturating_mul(r.into())) + // Minimum execution time: 82_012_000 picoseconds. + Weight::from_parts(115_149_368, 0) + // Standard Error: 328_818 + .saturating_add(Weight::from_parts(265_684_350, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 106_780_000 picoseconds. - Weight::from_parts(108_777_000, 0) - // Standard Error: 2_695 - .saturating_add(Weight::from_parts(621_479, 0).saturating_mul(n.into())) + // Minimum execution time: 100_890_000 picoseconds. + Weight::from_parts(102_844_000, 0) + // Standard Error: 2_931 + .saturating_add(Weight::from_parts(635_797, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 568_972_000 picoseconds. - Weight::from_parts(609_033_910, 0) - // Standard Error: 4_571_153 - .saturating_add(Weight::from_parts(9_603_389, 0).saturating_mul(r.into())) + // Minimum execution time: 563_182_000 picoseconds. + Weight::from_parts(640_794_146, 0) + // Standard Error: 7_497_207 + .saturating_add(Weight::from_parts(15_239_053, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 563_090_000 picoseconds. - Weight::from_parts(592_066_973, 0) - // Standard Error: 2_340_115 - .saturating_add(Weight::from_parts(43_394_026, 0).saturating_mul(r.into())) + // Minimum execution time: 560_481_000 picoseconds. + Weight::from_parts(593_427_573, 0) + // Standard Error: 3_203_142 + .saturating_add(Weight::from_parts(25_969_526, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_249_000 picoseconds. - Weight::from_parts(101_672_638, 0) - // Standard Error: 324_954 - .saturating_add(Weight::from_parts(14_253_161, 0).saturating_mul(r.into())) + // Minimum execution time: 92_574_000 picoseconds. + Weight::from_parts(97_280_140, 0) + // Standard Error: 268_694 + .saturating_add(Weight::from_parts(12_092_859, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_010_000 picoseconds. - Weight::from_parts(100_030_007, 0) - // Standard Error: 1_129 - .saturating_add(Weight::from_parts(428_607, 0).saturating_mul(n.into())) + // Minimum execution time: 109_631_000 picoseconds. + Weight::from_parts(94_175_255, 0) + // Standard Error: 1_213 + .saturating_add(Weight::from_parts(427_553, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_185_000 picoseconds. - Weight::from_parts(99_966_330, 0) - // Standard Error: 301_219 - .saturating_add(Weight::from_parts(14_061_369, 0).saturating_mul(r.into())) + // Minimum execution time: 95_505_000 picoseconds. + Weight::from_parts(100_109_459, 0) + // Standard Error: 279_145 + .saturating_add(Weight::from_parts(8_335_840, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 113_423_000 picoseconds. - Weight::from_parts(96_606_724, 0) - // Standard Error: 1_205 - .saturating_add(Weight::from_parts(428_607, 0).saturating_mul(n.into())) + // Minimum execution time: 105_015_000 picoseconds. + Weight::from_parts(96_000_128, 0) + // Standard Error: 1_363 + .saturating_add(Weight::from_parts(423_685, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_774_000 picoseconds. - Weight::from_parts(83_857_549, 0) - // Standard Error: 297_267 - .saturating_add(Weight::from_parts(233_219_125, 0).saturating_mul(r.into())) + // Minimum execution time: 84_784_000 picoseconds. + Weight::from_parts(84_956_444, 0) + // Standard Error: 285_268 + .saturating_add(Weight::from_parts(178_346_410, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_953_000 picoseconds. - Weight::from_parts(88_940_722, 0) - // Standard Error: 258_844 - .saturating_add(Weight::from_parts(233_676_090, 0).saturating_mul(r.into())) + // Minimum execution time: 85_915_000 picoseconds. + Weight::from_parts(78_586_027, 0) + // Standard Error: 254_710 + .saturating_add(Weight::from_parts(178_243_954, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 564_724_000 picoseconds. - Weight::from_parts(626_617_925, 0) - // Standard Error: 538_611 - .saturating_add(Weight::from_parts(242_663_753, 0).saturating_mul(r.into())) + // Minimum execution time: 557_380_000 picoseconds. + Weight::from_parts(633_253_100, 0) + // Standard Error: 538_762 + .saturating_add(Weight::from_parts(195_061_580, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 587_473_000 picoseconds. - Weight::from_parts(628_885_094, 0) - // Standard Error: 2_965 - .saturating_add(Weight::from_parts(136_594, 0).saturating_mul(n.into())) + // Minimum execution time: 597_682_000 picoseconds. + Weight::from_parts(661_897_574, 0) + // Standard Error: 3_826 + .saturating_add(Weight::from_parts(136_457, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_309_979_000 picoseconds. - Weight::from_parts(5_518_613_800, 0) - // Standard Error: 495_795 - .saturating_add(Weight::from_parts(255_179_221, 0).saturating_mul(r.into())) + // Minimum execution time: 4_454_821_000 picoseconds. + Weight::from_parts(4_682_125_339, 0) + // Standard Error: 520_741 + .saturating_add(Weight::from_parts(206_155_172, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_619_977_000 picoseconds. - Weight::from_parts(5_618_998_968, 0) - // Standard Error: 15_127 - .saturating_add(Weight::from_parts(11_998_735, 0).saturating_mul(n.into())) + // Minimum execution time: 4_637_831_000 picoseconds. + Weight::from_parts(4_748_853_254, 0) + // Standard Error: 16_010 + .saturating_add(Weight::from_parts(12_276_105, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_971_000 picoseconds. - Weight::from_parts(108_261_938, 0) - // Standard Error: 357_345 - .saturating_add(Weight::from_parts(247_489_332, 0).saturating_mul(r.into())) + // Minimum execution time: 84_447_000 picoseconds. + Weight::from_parts(111_081_974, 0) + // Standard Error: 422_093 + .saturating_add(Weight::from_parts(195_515_962, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 246_916_000 picoseconds. - Weight::from_parts(250_528_000, 0) - // Standard Error: 62_481 - .saturating_add(Weight::from_parts(26_192_033, 0).saturating_mul(n.into())) + // Minimum execution time: 188_901_000 picoseconds. + Weight::from_parts(192_422_000, 0) + // Standard Error: 54_402 + .saturating_add(Weight::from_parts(25_703_289, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_844_000 picoseconds. - Weight::from_parts(86_460_466, 0) - // Standard Error: 314_595 - .saturating_add(Weight::from_parts(229_172_736, 0).saturating_mul(r.into())) + // Minimum execution time: 85_538_000 picoseconds. + Weight::from_parts(83_073_715, 0) + // Standard Error: 285_530 + .saturating_add(Weight::from_parts(174_178_092, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_011_000 picoseconds. - Weight::from_parts(89_540_236, 0) - // Standard Error: 277_012 - .saturating_add(Weight::from_parts(24_910_563, 0).saturating_mul(r.into())) + // Minimum execution time: 84_697_000 picoseconds. + Weight::from_parts(89_049_881, 0) + // Standard Error: 281_628 + .saturating_add(Weight::from_parts(27_362_618, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_836_000 picoseconds. - Weight::from_parts(90_857_869, 0) - // Standard Error: 291_210 - .saturating_add(Weight::from_parts(17_718_230, 0).saturating_mul(r.into())) + // Minimum execution time: 83_006_000 picoseconds. + Weight::from_parts(86_657_161, 0) + // Standard Error: 254_208 + .saturating_add(Weight::from_parts(14_853_038, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_114_000 picoseconds. - Weight::from_parts(88_948_630, 0) - // Standard Error: 281_540 - .saturating_add(Weight::from_parts(14_540_169, 0).saturating_mul(r.into())) + // Minimum execution time: 83_155_000 picoseconds. + Weight::from_parts(87_136_381, 0) + // Standard Error: 296_075 + .saturating_add(Weight::from_parts(15_564_718, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_936_000 picoseconds. - Weight::from_parts(89_554_053, 0) - // Standard Error: 298_663 - .saturating_add(Weight::from_parts(14_576_446, 0).saturating_mul(r.into())) + // Minimum execution time: 83_160_000 picoseconds. + Weight::from_parts(87_382_440, 0) + // Standard Error: 263_499 + .saturating_add(Weight::from_parts(17_288_459, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_247_000 picoseconds. - Weight::from_parts(89_623_508, 0) - // Standard Error: 282_863 - .saturating_add(Weight::from_parts(15_308_291, 0).saturating_mul(r.into())) + // Minimum execution time: 86_780_000 picoseconds. + Weight::from_parts(90_970_389, 0) + // Standard Error: 273_512 + .saturating_add(Weight::from_parts(14_976_210, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 141_231_000 picoseconds. - Weight::from_parts(217_400_187, 0) - // Standard Error: 337_987 - .saturating_add(Weight::from_parts(328_969_338, 0).saturating_mul(r.into())) + // Minimum execution time: 141_871_000 picoseconds. + Weight::from_parts(203_107_595, 0) + // Standard Error: 322_999 + .saturating_add(Weight::from_parts(280_023_774, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 99_426_000 picoseconds. - Weight::from_parts(161_723_004, 0) - // Standard Error: 460_097 - .saturating_add(Weight::from_parts(527_605_370, 0).saturating_mul(r.into())) + // Minimum execution time: 99_132_000 picoseconds. + Weight::from_parts(166_620_417, 0) + // Standard Error: 428_363 + .saturating_add(Weight::from_parts(469_520_431, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1085,22 +1083,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_162_817_000 picoseconds. - Weight::from_parts(43_297_354_000, 0) - // Standard Error: 264_494 - .saturating_add(Weight::from_parts(7_584_082, 0).saturating_mul(p.into())) - // Standard Error: 264_481 - .saturating_add(Weight::from_parts(178_777_430, 0).saturating_mul(s.into())) + // Minimum execution time: 46_670_030_000 picoseconds. + Weight::from_parts(46_979_707_000, 0) + // Standard Error: 290_199 + .saturating_add(Weight::from_parts(7_295_075, 0).saturating_mul(p.into())) + // Standard Error: 290_185 + .saturating_add(Weight::from_parts(178_049_340, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_693_000 picoseconds. - Weight::from_parts(166_444_602, 0) - // Standard Error: 495_644 - .saturating_add(Weight::from_parts(530_773_692, 0).saturating_mul(r.into())) + // Minimum execution time: 95_401_000 picoseconds. + Weight::from_parts(162_215_381, 0) + // Standard Error: 435_866 + .saturating_add(Weight::from_parts(479_266_464, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1108,32 +1106,32 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_177_326_000 picoseconds. - Weight::from_parts(43_276_934_000, 0) - // Standard Error: 258_837 - .saturating_add(Weight::from_parts(7_780_932, 0).saturating_mul(p.into())) - // Standard Error: 258_825 - .saturating_add(Weight::from_parts(178_845_680, 0).saturating_mul(s.into())) + // Minimum execution time: 44_093_174_000 picoseconds. + Weight::from_parts(44_268_099_000, 0) + // Standard Error: 249_484 + .saturating_add(Weight::from_parts(7_595_737, 0).saturating_mul(p.into())) + // Standard Error: 249_471 + .saturating_add(Weight::from_parts(179_055_114, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_913_000 picoseconds. - Weight::from_parts(103_423_829, 0) - // Standard Error: 30_584 - .saturating_add(Weight::from_parts(4_067_667, 0).saturating_mul(r.into())) + // Minimum execution time: 84_188_000 picoseconds. + Weight::from_parts(101_583_480, 0) + // Standard Error: 35_878 + .saturating_add(Weight::from_parts(3_611_568, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 86_329_000 picoseconds. - Weight::from_parts(122_711_700, 1131) - // Standard Error: 6_939 - .saturating_add(Weight::from_parts(12_248_450, 0).saturating_mul(p.into())) + // Minimum execution time: 86_183_000 picoseconds. + Weight::from_parts(118_618_192, 1131) + // Standard Error: 6_832 + .saturating_add(Weight::from_parts(11_877_671, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1142,10 +1140,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_299_000 picoseconds. - Weight::from_parts(88_786_000, 1131) - // Standard Error: 45_222 - .saturating_add(Weight::from_parts(35_865_045, 0).saturating_mul(p.into())) + // Minimum execution time: 84_629_000 picoseconds. + Weight::from_parts(86_416_000, 1131) + // Standard Error: 28_253 + .saturating_add(Weight::from_parts(36_463_142, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1154,10 +1152,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_294_375_000 picoseconds. - Weight::from_parts(5_970_923_161, 5069931) - // Standard Error: 84_190 - .saturating_add(Weight::from_parts(37_074_862, 0).saturating_mul(p.into())) + // Minimum execution time: 6_148_282_000 picoseconds. + Weight::from_parts(5_977_321_351, 5069931) + // Standard Error: 52_501 + .saturating_add(Weight::from_parts(36_684_019, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1165,10 +1163,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 86_701_000 picoseconds. - Weight::from_parts(88_528_000, 1939) - // Standard Error: 23_868 - .saturating_add(Weight::from_parts(45_548_960, 0).saturating_mul(p.into())) + // Minimum execution time: 85_557_000 picoseconds. + Weight::from_parts(86_547_000, 1939) + // Standard Error: 32_777 + .saturating_add(Weight::from_parts(46_224_064, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1177,10 +1175,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 96_310_000 picoseconds. - Weight::from_parts(94_183_637, 1131) - // Standard Error: 63_935 - .saturating_add(Weight::from_parts(36_590_808, 0).saturating_mul(p.into())) + // Minimum execution time: 89_966_000 picoseconds. + Weight::from_parts(89_543_596, 1131) + // Standard Error: 68_448 + .saturating_add(Weight::from_parts(36_359_585, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1189,10 +1187,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 598_904_000 picoseconds. - Weight::from_parts(619_105_409, 1496) - // Standard Error: 245_290 - .saturating_add(Weight::from_parts(42_961_968, 0).saturating_mul(p.into())) + // Minimum execution time: 600_329_000 picoseconds. + Weight::from_parts(623_878_315, 1496) + // Standard Error: 267_055 + .saturating_add(Weight::from_parts(46_147_238, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1201,10 +1199,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_017_010_000 picoseconds. - Weight::from_parts(1_027_116_414, 317931) - // Standard Error: 208_481 - .saturating_add(Weight::from_parts(42_351_428, 0).saturating_mul(p.into())) + // Minimum execution time: 1_023_023_000 picoseconds. + Weight::from_parts(1_022_993_537, 317931) + // Standard Error: 203_791 + .saturating_add(Weight::from_parts(43_538_291, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1212,505 +1210,505 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_561_000 picoseconds. - Weight::from_parts(2_759_075, 0) - // Standard Error: 6_571 - .saturating_add(Weight::from_parts(23_969_853, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_436_506, 0) + // Standard Error: 16_946 + .saturating_add(Weight::from_parts(24_493_632, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_328_660_000 picoseconds. - Weight::from_parts(4_143_980_969, 0) - // Standard Error: 82_202 - .saturating_add(Weight::from_parts(5_228_381, 0).saturating_mul(r.into())) + // Minimum execution time: 4_347_874_000 picoseconds. + Weight::from_parts(4_179_322_071, 0) + // Standard Error: 53_086 + .saturating_add(Weight::from_parts(4_505_224, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_356_758_000 picoseconds. - Weight::from_parts(4_127_092_336, 0) - // Standard Error: 81_533 - .saturating_add(Weight::from_parts(5_327_098, 0).saturating_mul(r.into())) + // Minimum execution time: 4_348_187_000 picoseconds. + Weight::from_parts(4_205_195_765, 0) + // Standard Error: 44_017 + .saturating_add(Weight::from_parts(4_404_586, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_325_202_000 picoseconds. - Weight::from_parts(11_524_412_486, 0) - // Standard Error: 169_048 - .saturating_add(Weight::from_parts(8_747_721, 0).saturating_mul(r.into())) + // Minimum execution time: 10_882_662_000 picoseconds. + Weight::from_parts(11_083_501_979, 0) + // Standard Error: 200_162 + .saturating_add(Weight::from_parts(13_165_815, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_155_518_000 picoseconds. - Weight::from_parts(11_305_969_431, 0) - // Standard Error: 149_327 - .saturating_add(Weight::from_parts(7_628_408, 0).saturating_mul(r.into())) + // Minimum execution time: 10_784_867_000 picoseconds. + Weight::from_parts(11_957_102_430, 0) + // Standard Error: 187_347 + .saturating_add(Weight::from_parts(8_480_335, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_349_000, 0) - // Standard Error: 8_979 - .saturating_add(Weight::from_parts(3_801_082, 0).saturating_mul(r.into())) + // Minimum execution time: 2_343_000 picoseconds. + Weight::from_parts(2_421_000, 0) + // Standard Error: 9_011 + .saturating_add(Weight::from_parts(3_834_828, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 4_990 - .saturating_add(Weight::from_parts(3_041_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_326_000 picoseconds. + Weight::from_parts(2_421_000, 0) + // Standard Error: 5_612 + .saturating_add(Weight::from_parts(3_061_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_807_134, 0) - // Standard Error: 2_945 - .saturating_add(Weight::from_parts(1_608_008, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(3_427_769, 0) + // Standard Error: 941 + .saturating_add(Weight::from_parts(1_568_677, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(2_313_000, 0) - // Standard Error: 9_217 - .saturating_add(Weight::from_parts(3_001_349, 0).saturating_mul(r.into())) + // Minimum execution time: 2_284_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 8_418 + .saturating_add(Weight::from_parts(2_921_747, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_275_000 picoseconds. - Weight::from_parts(5_247_232, 0) - // Standard Error: 23_149 - .saturating_add(Weight::from_parts(5_086_357, 0).saturating_mul(r.into())) + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(1_354_050, 0) + // Standard Error: 14_642 + .saturating_add(Weight::from_parts(5_182_595, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_867_000 picoseconds. - Weight::from_parts(5_126_797, 0) - // Standard Error: 1_332 - .saturating_add(Weight::from_parts(171_719, 0).saturating_mul(e.into())) + // Minimum execution time: 7_011_000 picoseconds. + Weight::from_parts(5_823_252, 0) + // Standard Error: 2_035 + .saturating_add(Weight::from_parts(162_988, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_293_000 picoseconds. - Weight::from_parts(5_216_165, 0) - // Standard Error: 7_649 - .saturating_add(Weight::from_parts(2_565_620, 0).saturating_mul(r.into())) + // Minimum execution time: 2_405_000 picoseconds. + Weight::from_parts(5_172_082, 0) + // Standard Error: 7_906 + .saturating_add(Weight::from_parts(2_576_107, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_565_620 - - 2_416_114, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_576_107 - + 2_413_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_281_000 picoseconds. - Weight::from_parts(4_597_442, 0) - // Standard Error: 12_255 - .saturating_add(Weight::from_parts(2_416_114, 0).saturating_mul(r.into())) + // Minimum execution time: 2_315_000 picoseconds. + Weight::from_parts(4_417_546, 0) + // Standard Error: 12_281 + .saturating_add(Weight::from_parts(2_413_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_644_000 picoseconds. - Weight::from_parts(14_659_973, 0) - // Standard Error: 22_420 - .saturating_add(Weight::from_parts(10_375_527, 0).saturating_mul(r.into())) + // Minimum execution time: 2_774_000 picoseconds. + Weight::from_parts(19_445_534, 0) + // Standard Error: 34_031 + .saturating_add(Weight::from_parts(9_947_648, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_012_000 picoseconds. - Weight::from_parts(125_533, 0) - // Standard Error: 6_220 - .saturating_add(Weight::from_parts(1_333_743, 0).saturating_mul(p.into())) + // Minimum execution time: 12_663_000 picoseconds. + Weight::from_parts(2_443_915, 0) + // Standard Error: 6_189 + .saturating_add(Weight::from_parts(1_274_832, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_409_000 picoseconds. - Weight::from_parts(5_781_918, 0) - // Standard Error: 17 - .saturating_add(Weight::from_parts(5, 0).saturating_mul(l.into())) + // Minimum execution time: 5_382_000 picoseconds. + Weight::from_parts(5_657_220, 0) + // Standard Error: 12 + .saturating_add(Weight::from_parts(14, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_326_000 picoseconds. - Weight::from_parts(1_651_020, 0) - // Standard Error: 4_374 - .saturating_add(Weight::from_parts(290_475, 0).saturating_mul(r.into())) + // Minimum execution time: 2_461_000 picoseconds. + Weight::from_parts(1_936_508, 0) + // Standard Error: 3_019 + .saturating_add(Weight::from_parts(275_086, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_332_000, 0) - // Standard Error: 6_148 - .saturating_add(Weight::from_parts(854_221, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_394_000, 0) + // Standard Error: 4_239 + .saturating_add(Weight::from_parts(763_775, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(2_302_000, 0) - // Standard Error: 5_829 - .saturating_add(Weight::from_parts(849_053, 0).saturating_mul(r.into())) + // Minimum execution time: 2_367_000 picoseconds. + Weight::from_parts(2_411_000, 0) + // Standard Error: 5_426 + .saturating_add(Weight::from_parts(771_295, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_331_000 picoseconds. - Weight::from_parts(2_255_535, 0) - // Standard Error: 8_243 - .saturating_add(Weight::from_parts(867_515, 0).saturating_mul(r.into())) + // Minimum execution time: 6_346_000 picoseconds. + Weight::from_parts(2_691_888, 0) + // Standard Error: 7_020 + .saturating_add(Weight::from_parts(804_877, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_337_000 picoseconds. - Weight::from_parts(6_517_000, 0) - // Standard Error: 7_847 - .saturating_add(Weight::from_parts(1_426_655, 0).saturating_mul(r.into())) + // Minimum execution time: 6_476_000 picoseconds. + Weight::from_parts(6_582_000, 0) + // Standard Error: 8_493 + .saturating_add(Weight::from_parts(1_358_866, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_163_000 picoseconds. - Weight::from_parts(2_440_836, 0) - // Standard Error: 8_886 - .saturating_add(Weight::from_parts(7_297_596, 0).saturating_mul(r.into())) + // Minimum execution time: 4_943_000 picoseconds. + Weight::from_parts(1_102_558, 0) + // Standard Error: 12_614 + .saturating_add(Weight::from_parts(7_099_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_231_000, 0) - // Standard Error: 6_013 - .saturating_add(Weight::from_parts(3_453_309, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(2_357_000, 0) + // Standard Error: 7_419 + .saturating_add(Weight::from_parts(3_438_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_297_000 picoseconds. - Weight::from_parts(2_335_000, 0) - // Standard Error: 5_409 - .saturating_add(Weight::from_parts(3_213_419, 0).saturating_mul(r.into())) + // Minimum execution time: 2_201_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 7_089 + .saturating_add(Weight::from_parts(3_224_674, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_319_000, 0) - // Standard Error: 5_741 - .saturating_add(Weight::from_parts(3_164_881, 0).saturating_mul(r.into())) + // Minimum execution time: 2_358_000 picoseconds. + Weight::from_parts(2_444_000, 0) + // Standard Error: 5_880 + .saturating_add(Weight::from_parts(3_196_577, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(2_404_000, 0) - // Standard Error: 5_514 - .saturating_add(Weight::from_parts(2_656_016, 0).saturating_mul(r.into())) + // Minimum execution time: 2_205_000 picoseconds. + Weight::from_parts(2_361_000, 0) + // Standard Error: 5_007 + .saturating_add(Weight::from_parts(2_694_074, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_332_000, 0) - // Standard Error: 4_301 - .saturating_add(Weight::from_parts(566_740, 0).saturating_mul(r.into())) + // Minimum execution time: 2_217_000 picoseconds. + Weight::from_parts(2_339_000, 0) + // Standard Error: 4_242 + .saturating_add(Weight::from_parts(562_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(1_380_111, 0) - // Standard Error: 4_021 - .saturating_add(Weight::from_parts(394_594, 0).saturating_mul(r.into())) + // Minimum execution time: 2_180_000 picoseconds. + Weight::from_parts(1_150_328, 0) + // Standard Error: 4_155 + .saturating_add(Weight::from_parts(430_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 11_230 - .saturating_add(Weight::from_parts(1_866_720, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_269_000, 0) + // Standard Error: 12_863 + .saturating_add(Weight::from_parts(1_875_276, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(2_251_000, 0) - // Standard Error: 7_963 - .saturating_add(Weight::from_parts(1_115_416, 0).saturating_mul(r.into())) + // Minimum execution time: 2_290_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 8_333 + .saturating_add(Weight::from_parts(1_185_939, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_239_000 picoseconds. - Weight::from_parts(1_345_300, 0) - // Standard Error: 3_470 - .saturating_add(Weight::from_parts(360_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_384_000 picoseconds. + Weight::from_parts(1_572_617, 0) + // Standard Error: 3_727 + .saturating_add(Weight::from_parts(382_695, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_224_000 picoseconds. - Weight::from_parts(1_283_809, 0) - // Standard Error: 3_741 - .saturating_add(Weight::from_parts(386_488, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(1_495_799, 0) + // Standard Error: 4_058 + .saturating_add(Weight::from_parts(373_636, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_266_000, 0) - // Standard Error: 3_756 - .saturating_add(Weight::from_parts(503_289, 0).saturating_mul(r.into())) + // Minimum execution time: 2_341_000 picoseconds. + Weight::from_parts(465_059, 0) + // Standard Error: 4_917 + .saturating_add(Weight::from_parts(551_259, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_314_000, 0) - // Standard Error: 3_752 - .saturating_add(Weight::from_parts(508_162, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(515_890, 0) + // Standard Error: 4_848 + .saturating_add(Weight::from_parts(545_542, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_253_000 picoseconds. - Weight::from_parts(699_457, 0) - // Standard Error: 5_310 - .saturating_add(Weight::from_parts(500_136, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(739_709, 0) + // Standard Error: 4_827 + .saturating_add(Weight::from_parts(496_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(1_730_310, 0) - // Standard Error: 3_237 - .saturating_add(Weight::from_parts(335_706, 0).saturating_mul(r.into())) + // Minimum execution time: 2_322_000 picoseconds. + Weight::from_parts(1_492_190, 0) + // Standard Error: 3_923 + .saturating_add(Weight::from_parts(340_665, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_536_419, 0) - // Standard Error: 2_151 - .saturating_add(Weight::from_parts(176_722, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_979_817, 0) + // Standard Error: 1_972 + .saturating_add(Weight::from_parts(154_315, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_154_000 picoseconds. - Weight::from_parts(2_831_218, 0) - // Standard Error: 1_859 - .saturating_add(Weight::from_parts(170_795, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(2_877_230, 0) + // Standard Error: 1_753 + .saturating_add(Weight::from_parts(153_462, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(2_257_000, 0) - // Standard Error: 12_552 - .saturating_add(Weight::from_parts(1_890_934, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 11_649 + .saturating_add(Weight::from_parts(1_795_062, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_307_000, 0) - // Standard Error: 6_846 - .saturating_add(Weight::from_parts(1_121_975, 0).saturating_mul(r.into())) + // Minimum execution time: 2_303_000 picoseconds. + Weight::from_parts(2_366_000, 0) + // Standard Error: 7_436 + .saturating_add(Weight::from_parts(1_091_962, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_327_000, 0) - // Standard Error: 12_461 - .saturating_add(Weight::from_parts(1_833_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_346_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 11_197 + .saturating_add(Weight::from_parts(1_828_518, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_343_000, 0) - // Standard Error: 7_617 - .saturating_add(Weight::from_parts(1_119_136, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_384_000, 0) + // Standard Error: 7_307 + .saturating_add(Weight::from_parts(1_106_869, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_327_000, 0) - // Standard Error: 12_329 - .saturating_add(Weight::from_parts(1_835_082, 0).saturating_mul(r.into())) + // Minimum execution time: 2_286_000 picoseconds. + Weight::from_parts(2_343_000, 0) + // Standard Error: 10_932 + .saturating_add(Weight::from_parts(1_789_419, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_252_000, 0) - // Standard Error: 7_701 - .saturating_add(Weight::from_parts(1_124_368, 0).saturating_mul(r.into())) + // Minimum execution time: 2_214_000 picoseconds. + Weight::from_parts(2_283_000, 0) + // Standard Error: 7_556 + .saturating_add(Weight::from_parts(1_111_326, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(2_263_000, 0) - // Standard Error: 11_813 - .saturating_add(Weight::from_parts(1_875_008, 0).saturating_mul(r.into())) + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 10_995 + .saturating_add(Weight::from_parts(1_822_680, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_240_000, 0) - // Standard Error: 8_075 - .saturating_add(Weight::from_parts(1_160_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(2_334_000, 0) + // Standard Error: 6_944 + .saturating_add(Weight::from_parts(1_121_080, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_196_000 picoseconds. - Weight::from_parts(2_275_000, 0) - // Standard Error: 13_171 - .saturating_add(Weight::from_parts(1_950_456, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 11_873 + .saturating_add(Weight::from_parts(1_840_273, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_205_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 7_284 - .saturating_add(Weight::from_parts(1_178_320, 0).saturating_mul(r.into())) + // Minimum execution time: 2_265_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 7_972 + .saturating_add(Weight::from_parts(1_134_825, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_264_000 picoseconds. - Weight::from_parts(2_317_000, 0) - // Standard Error: 9_368 - .saturating_add(Weight::from_parts(1_868_546, 0).saturating_mul(r.into())) + // Minimum execution time: 2_269_000 picoseconds. + Weight::from_parts(2_355_000, 0) + // Standard Error: 11_547 + .saturating_add(Weight::from_parts(1_813_029, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_284_000 picoseconds. - Weight::from_parts(2_405_000, 0) - // Standard Error: 8_061 - .saturating_add(Weight::from_parts(1_197_559, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_349_000, 0) + // Standard Error: 6_487 + .saturating_add(Weight::from_parts(1_091_201, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { @@ -1718,379 +1716,379 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Measured: `0` // Estimated: `0` // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_300_000, 0) - // Standard Error: 11_834 - .saturating_add(Weight::from_parts(1_923_567, 0).saturating_mul(r.into())) + Weight::from_parts(2_329_000, 0) + // Standard Error: 12_018 + .saturating_add(Weight::from_parts(1_823_755, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_274_000, 0) - // Standard Error: 9_362 - .saturating_add(Weight::from_parts(1_190_357, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(2_359_000, 0) + // Standard Error: 7_325 + .saturating_add(Weight::from_parts(1_192_292, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 11_991 - .saturating_add(Weight::from_parts(1_870_585, 0).saturating_mul(r.into())) + // Minimum execution time: 2_352_000 picoseconds. + Weight::from_parts(2_386_000, 0) + // Standard Error: 10_009 + .saturating_add(Weight::from_parts(1_870_539, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_207_000 picoseconds. - Weight::from_parts(2_267_000, 0) - // Standard Error: 7_987 - .saturating_add(Weight::from_parts(1_127_255, 0).saturating_mul(r.into())) + // Minimum execution time: 2_315_000 picoseconds. + Weight::from_parts(2_382_000, 0) + // Standard Error: 7_109 + .saturating_add(Weight::from_parts(1_122_152, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_234_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 10_810 - .saturating_add(Weight::from_parts(1_837_668, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_337_000, 0) + // Standard Error: 11_700 + .saturating_add(Weight::from_parts(1_825_021, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_203_000 picoseconds. - Weight::from_parts(2_291_000, 0) - // Standard Error: 7_532 - .saturating_add(Weight::from_parts(1_128_887, 0).saturating_mul(r.into())) + // Minimum execution time: 2_357_000 picoseconds. + Weight::from_parts(2_407_000, 0) + // Standard Error: 7_769 + .saturating_add(Weight::from_parts(1_146_472, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 13_291 - .saturating_add(Weight::from_parts(1_912_800, 0).saturating_mul(r.into())) + // Minimum execution time: 2_196_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 9_908 + .saturating_add(Weight::from_parts(1_845_094, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_314_000, 0) - // Standard Error: 8_690 - .saturating_add(Weight::from_parts(1_153_175, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(2_382_000, 0) + // Standard Error: 9_519 + .saturating_add(Weight::from_parts(1_241_507, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_313_000, 0) - // Standard Error: 8_536 - .saturating_add(Weight::from_parts(1_274_613, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_323_000, 0) + // Standard Error: 7_921 + .saturating_add(Weight::from_parts(1_330_988, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_272_000, 0) - // Standard Error: 5_570 - .saturating_add(Weight::from_parts(643_298, 0).saturating_mul(r.into())) + // Minimum execution time: 2_203_000 picoseconds. + Weight::from_parts(2_262_000, 0) + // Standard Error: 4_732 + .saturating_add(Weight::from_parts(619_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(2_266_000, 0) - // Standard Error: 8_347 - .saturating_add(Weight::from_parts(1_274_115, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_318_000, 0) + // Standard Error: 8_121 + .saturating_add(Weight::from_parts(1_255_733, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_154_000 picoseconds. - Weight::from_parts(2_227_000, 0) - // Standard Error: 4_699 - .saturating_add(Weight::from_parts(628_921, 0).saturating_mul(r.into())) + // Minimum execution time: 2_332_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 5_698 + .saturating_add(Weight::from_parts(666_782, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_220_000 picoseconds. - Weight::from_parts(2_256_000, 0) - // Standard Error: 13_065 - .saturating_add(Weight::from_parts(1_893_638, 0).saturating_mul(r.into())) + // Minimum execution time: 2_269_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 10_724 + .saturating_add(Weight::from_parts(1_779_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 8_533 - .saturating_add(Weight::from_parts(1_231_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_239_000 picoseconds. + Weight::from_parts(2_377_000, 0) + // Standard Error: 8_303 + .saturating_add(Weight::from_parts(1_231_579, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_169_000 picoseconds. - Weight::from_parts(2_444_956, 0) - // Standard Error: 20_020 - .saturating_add(Weight::from_parts(2_735_228, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(3_881_473, 0) + // Standard Error: 22_336 + .saturating_add(Weight::from_parts(2_602_873, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_330_000, 0) - // Standard Error: 6_388 - .saturating_add(Weight::from_parts(2_443_190, 0).saturating_mul(r.into())) + // Minimum execution time: 2_366_000 picoseconds. + Weight::from_parts(971_800, 0) + // Standard Error: 9_516 + .saturating_add(Weight::from_parts(2_473_994, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_275_000, 0) - // Standard Error: 8_585 - .saturating_add(Weight::from_parts(2_921_612, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(3_150_808, 0) + // Standard Error: 24_239 + .saturating_add(Weight::from_parts(2_853_024, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 7_183 - .saturating_add(Weight::from_parts(2_537_552, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(1_149_774, 0) + // Standard Error: 13_355 + .saturating_add(Weight::from_parts(2_517_122, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(414_212, 0) - // Standard Error: 42_344 - .saturating_add(Weight::from_parts(9_454_771, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(1_527_824, 0) + // Standard Error: 31_972 + .saturating_add(Weight::from_parts(9_267_865, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(1_328_463, 0) - // Standard Error: 44_234 - .saturating_add(Weight::from_parts(7_539_740, 0).saturating_mul(r.into())) + // Minimum execution time: 2_323_000 picoseconds. + Weight::from_parts(988_781, 0) + // Standard Error: 44_193 + .saturating_add(Weight::from_parts(7_612_584, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_117_006, 0) - // Standard Error: 14_944 - .saturating_add(Weight::from_parts(2_960_667, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(2_334_729, 0) + // Standard Error: 15_965 + .saturating_add(Weight::from_parts(2_951_129, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_233_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 7_481 - .saturating_add(Weight::from_parts(2_538_984, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(1_116_651, 0) + // Standard Error: 17_134 + .saturating_add(Weight::from_parts(2_528_749, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_237_000 picoseconds. - Weight::from_parts(2_325_000, 0) - // Standard Error: 9_311 - .saturating_add(Weight::from_parts(1_303_917, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_268_000, 0) + // Standard Error: 8_575 + .saturating_add(Weight::from_parts(1_262_352, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 4_197 - .saturating_add(Weight::from_parts(607_955, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_338_000, 0) + // Standard Error: 4_378 + .saturating_add(Weight::from_parts(623_671, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(2_315_000, 0) - // Standard Error: 8_973 - .saturating_add(Weight::from_parts(1_276_071, 0).saturating_mul(r.into())) + // Minimum execution time: 2_335_000 picoseconds. + Weight::from_parts(2_380_000, 0) + // Standard Error: 8_320 + .saturating_add(Weight::from_parts(1_276_618, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_301_000, 0) - // Standard Error: 4_647 - .saturating_add(Weight::from_parts(634_889, 0).saturating_mul(r.into())) + // Minimum execution time: 2_330_000 picoseconds. + Weight::from_parts(2_374_000, 0) + // Standard Error: 4_039 + .saturating_add(Weight::from_parts(593_652, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_194_000 picoseconds. - Weight::from_parts(2_252_000, 0) - // Standard Error: 9_373 - .saturating_add(Weight::from_parts(1_262_774, 0).saturating_mul(r.into())) + // Minimum execution time: 2_220_000 picoseconds. + Weight::from_parts(2_325_000, 0) + // Standard Error: 8_112 + .saturating_add(Weight::from_parts(1_247_970, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 4_485 - .saturating_add(Weight::from_parts(593_561, 0).saturating_mul(r.into())) + // Minimum execution time: 2_280_000 picoseconds. + Weight::from_parts(2_353_000, 0) + // Standard Error: 4_344 + .saturating_add(Weight::from_parts(606_457, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 7_602 - .saturating_add(Weight::from_parts(1_053_865, 0).saturating_mul(r.into())) + // Minimum execution time: 2_234_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 7_296 + .saturating_add(Weight::from_parts(1_053_977, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_282_000, 0) - // Standard Error: 4_413 - .saturating_add(Weight::from_parts(573_275, 0).saturating_mul(r.into())) + // Minimum execution time: 2_342_000 picoseconds. + Weight::from_parts(75_359, 0) + // Standard Error: 6_197 + .saturating_add(Weight::from_parts(627_367, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_253_000 picoseconds. - Weight::from_parts(2_324_000, 0) - // Standard Error: 8_149 - .saturating_add(Weight::from_parts(1_098_821, 0).saturating_mul(r.into())) + // Minimum execution time: 2_281_000 picoseconds. + Weight::from_parts(2_367_000, 0) + // Standard Error: 6_750 + .saturating_add(Weight::from_parts(1_078_782, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_338_000, 0) - // Standard Error: 3_787 - .saturating_add(Weight::from_parts(561_596, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 4_413 + .saturating_add(Weight::from_parts(586_782, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_181_000 picoseconds. - Weight::from_parts(2_293_000, 0) - // Standard Error: 7_403 - .saturating_add(Weight::from_parts(1_093_703, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 9_421 + .saturating_add(Weight::from_parts(1_130_965, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_182_000 picoseconds. - Weight::from_parts(2_295_000, 0) - // Standard Error: 3_652 - .saturating_add(Weight::from_parts(563_961, 0).saturating_mul(r.into())) + // Minimum execution time: 2_344_000 picoseconds. + Weight::from_parts(2_438_000, 0) + // Standard Error: 5_975 + .saturating_add(Weight::from_parts(638_969, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 7_027 - .saturating_add(Weight::from_parts(1_052_281, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(2_356_000, 0) + // Standard Error: 8_189 + .saturating_add(Weight::from_parts(1_080_515, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 4_511 - .saturating_add(Weight::from_parts(584_911, 0).saturating_mul(r.into())) + // Minimum execution time: 2_253_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 3_500 + .saturating_add(Weight::from_parts(556_273, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_237_000 picoseconds. - Weight::from_parts(2_284_000, 0) - // Standard Error: 8_733 - .saturating_add(Weight::from_parts(1_138_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_215_000 picoseconds. + Weight::from_parts(2_333_000, 0) + // Standard Error: 7_954 + .saturating_add(Weight::from_parts(1_067_773, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_235_000 picoseconds. - Weight::from_parts(2_275_000, 0) - // Standard Error: 3_542 - .saturating_add(Weight::from_parts(541_237, 0).saturating_mul(r.into())) + // Minimum execution time: 2_183_000 picoseconds. + Weight::from_parts(2_223_000, 0) + // Standard Error: 3_658 + .saturating_add(Weight::from_parts(566_527, 0).saturating_mul(r.into())) } } @@ -2115,10 +2113,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_013_000 picoseconds. - Weight::from_parts(1_062_000, 0) - // Standard Error: 762 - .saturating_add(Weight::from_parts(208_216, 0).saturating_mul(c.into())) + // Minimum execution time: 1_003_000 picoseconds. + Weight::from_parts(1_051_000, 0) + // Standard Error: 968 + .saturating_add(Weight::from_parts(212_482, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -2126,10 +2124,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `113 + c * (1024 ±0)` // Estimated: `3577 + c * (1024 ±0)` - // Minimum execution time: 3_308_000 picoseconds. - Weight::from_parts(3_370_000, 3577) - // Standard Error: 862 - .saturating_add(Weight::from_parts(670_306, 0).saturating_mul(c.into())) + // Minimum execution time: 3_267_000 picoseconds. + Weight::from_parts(3_316_000, 3577) + // Standard Error: 1_072 + .saturating_add(Weight::from_parts(688_242, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2138,17 +2136,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 53_243_000 picoseconds. - Weight::from_parts(97_332_650, 0) - // Standard Error: 9_388 - .saturating_add(Weight::from_parts(2_412_828, 0).saturating_mul(c.into())) + // Minimum execution time: 53_248_000 picoseconds. + Weight::from_parts(71_345_881, 0) + // Standard Error: 10_707 + .saturating_add(Weight::from_parts(2_548_249, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1050` // Estimated: `42875` - // Minimum execution time: 85_496_000 picoseconds. - Weight::from_parts(87_834_000, 42875) + // Minimum execution time: 84_992_000 picoseconds. + Weight::from_parts(88_176_000, 42875) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2156,8 +2154,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `958` // Estimated: `21477` - // Minimum execution time: 56_911_000 picoseconds. - Weight::from_parts(58_442_000, 21477) + // Minimum execution time: 56_951_000 picoseconds. + Weight::from_parts(58_755_000, 21477) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2165,8 +2163,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `605` // Estimated: `17354` - // Minimum execution time: 30_232_000 picoseconds. - Weight::from_parts(31_315_000, 17354) + // Minimum execution time: 30_483_000 picoseconds. + Weight::from_parts(31_174_000, 17354) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2175,22 +2173,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_178_000 picoseconds. - Weight::from_parts(3_437_304, 7640) - // Standard Error: 39_204 - .saturating_add(Weight::from_parts(15_994_815, 0).saturating_mul(c.into())) + // Minimum execution time: 8_269_000 picoseconds. + Weight::from_parts(7_343_300, 7640) + // Standard Error: 45_015 + .saturating_add(Weight::from_parts(15_758_869, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1506 + c * (16389 ±0)` - // Estimated: `42570 + c * (131112 ±0)` - // Minimum execution time: 72_721_000 picoseconds. - Weight::from_parts(73_726_000, 42570) - // Standard Error: 154_956 - .saturating_add(Weight::from_parts(53_504_047, 0).saturating_mul(c.into())) + // Measured: `1439 + c * (16389 ±0)` + // Estimated: `42034 + c * (131112 ±0)` + // Minimum execution time: 70_643_000 picoseconds. + Weight::from_parts(71_487_000, 42034) + // Standard Error: 217_960 + .saturating_add(Weight::from_parts(56_304_860, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2201,22 +2199,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `80` // Estimated: `5270` - // Minimum execution time: 65_687_000 picoseconds. - Weight::from_parts(46_647_789, 5270) - // Standard Error: 54_648 - .saturating_add(Weight::from_parts(51_714_144, 0).saturating_mul(c.into())) + // Minimum execution time: 63_871_000 picoseconds. + Weight::from_parts(31_431_372, 5270) + // Standard Error: 58_224 + .saturating_add(Weight::from_parts(52_560_364, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `809` - // Estimated: `40156` - // Minimum execution time: 66_542_000 picoseconds. - Weight::from_parts(93_243_157, 40156) - // Standard Error: 0 - .saturating_add(Weight::from_parts(2_589, 0).saturating_mul(s.into())) + // Measured: `742` + // Estimated: `39419` + // Minimum execution time: 65_988_000 picoseconds. + Weight::from_parts(102_441_114, 39419) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_612, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2226,12 +2224,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `306` // Estimated: `35235` - // Minimum execution time: 10_927_529_000 picoseconds. - Weight::from_parts(210_363_179, 35235) - // Standard Error: 181_741 - .saturating_add(Weight::from_parts(53_013_780, 0).saturating_mul(c.into())) + // Minimum execution time: 11_021_135_000 picoseconds. + Weight::from_parts(397_699_856, 35235) + // Standard Error: 169_994 + .saturating_add(Weight::from_parts(52_665_060, 0).saturating_mul(c.into())) // Standard Error: 10 - .saturating_add(Weight::from_parts(2_549, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_533, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } @@ -2240,10 +2238,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `349` // Estimated: `23860` - // Minimum execution time: 57_520_000 picoseconds. - Weight::from_parts(25_773_414, 23860) + // Minimum execution time: 57_013_000 picoseconds. + Weight::from_parts(35_413_717, 23860) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_183, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_158, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -2252,10 +2250,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452` // Estimated: `27184` - // Minimum execution time: 61_121_000 picoseconds. - Weight::from_parts(62_484_320, 27184) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_130, 0).saturating_mul(p.into())) + // Minimum execution time: 60_180_000 picoseconds. + Weight::from_parts(33_390_466, 27184) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_167, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } @@ -2264,10 +2262,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1049` // Estimated: `42866` - // Minimum execution time: 86_054_000 picoseconds. - Weight::from_parts(67_868_446, 42866) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_154, 0).saturating_mul(p.into())) + // Minimum execution time: 87_446_000 picoseconds. + Weight::from_parts(69_330_706, 42866) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_174, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2276,22 +2274,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1152` // Estimated: `46396` - // Minimum execution time: 97_133_000 picoseconds. - Weight::from_parts(79_387_060, 46396) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_154, 0).saturating_mul(p.into())) + // Minimum execution time: 97_152_000 picoseconds. + Weight::from_parts(77_891_346, 46396) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_170, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(11_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85981` - // Minimum execution time: 328_011_000 picoseconds. - Weight::from_parts(342_159_914, 85981) - // Standard Error: 1_525 - .saturating_add(Weight::from_parts(1_995, 0).saturating_mul(q.into())) + // Minimum execution time: 323_882_000 picoseconds. + Weight::from_parts(336_539_045, 85981) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().writes(23_u64)) } @@ -2300,8 +2296,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85905` - // Minimum execution time: 340_290_000 picoseconds. - Weight::from_parts(358_988_235, 85905) + // Minimum execution time: 336_406_000 picoseconds. + Weight::from_parts(353_807_338, 85905) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().writes(23_u64)) } @@ -2310,10 +2306,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 46_941_000 picoseconds. - Weight::from_parts(47_858_000, 3899) - // Standard Error: 33_955 - .saturating_add(Weight::from_parts(52_183_484, 0).saturating_mul(c.into())) + // Minimum execution time: 45_464_000 picoseconds. + Weight::from_parts(45_831_000, 3899) + // Standard Error: 36_617 + .saturating_add(Weight::from_parts(51_273_892, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2323,630 +2319,630 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_721_000 picoseconds. - Weight::from_parts(91_686_000, 0) - // Standard Error: 4_360_909 - .saturating_add(Weight::from_parts(708_494_415, 0).saturating_mul(r.into())) + // Minimum execution time: 84_254_000 picoseconds. + Weight::from_parts(86_749_000, 0) + // Standard Error: 3_967_638 + .saturating_add(Weight::from_parts(617_894_062, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 425_225_000 picoseconds. - Weight::from_parts(342_526_988, 0) - // Standard Error: 8_800 - .saturating_add(Weight::from_parts(34_071_489, 0).saturating_mul(p.into())) + // Minimum execution time: 366_392_000 picoseconds. + Weight::from_parts(294_624_660, 0) + // Standard Error: 10_067 + .saturating_add(Weight::from_parts(30_802_641, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 251_684_000 picoseconds. - Weight::from_parts(287_320_625, 0) - // Standard Error: 420_785 - .saturating_add(Weight::from_parts(164_219_884, 0).saturating_mul(r.into())) + // Minimum execution time: 199_070_000 picoseconds. + Weight::from_parts(213_938_845, 0) + // Standard Error: 343_895 + .saturating_add(Weight::from_parts(120_152_478, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_698_000 picoseconds. - Weight::from_parts(96_719_489, 0) - // Standard Error: 4_542 - .saturating_add(Weight::from_parts(4_169_455, 0).saturating_mul(r.into())) + // Minimum execution time: 85_714_000 picoseconds. + Weight::from_parts(96_261_609, 0) + // Standard Error: 3_991 + .saturating_add(Weight::from_parts(3_567_375, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_286_000 picoseconds. - Weight::from_parts(187_984_555, 0) - // Standard Error: 33_004 - .saturating_add(Weight::from_parts(4_435_556, 0).saturating_mul(r.into())) + // Minimum execution time: 139_882_000 picoseconds. + Weight::from_parts(221_553_985, 0) + // Standard Error: 29_743 + .saturating_add(Weight::from_parts(3_602_987, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_614_000 picoseconds. - Weight::from_parts(118_513_629, 0) - // Standard Error: 374_601 - .saturating_add(Weight::from_parts(233_587_547, 0).saturating_mul(r.into())) + // Minimum execution time: 87_497_000 picoseconds. + Weight::from_parts(118_603_695, 0) + // Standard Error: 431_810 + .saturating_add(Weight::from_parts(177_456_338, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_577_000 picoseconds. - Weight::from_parts(88_217_180, 0) - // Standard Error: 308_296 - .saturating_add(Weight::from_parts(231_658_884, 0).saturating_mul(r.into())) + // Minimum execution time: 88_831_000 picoseconds. + Weight::from_parts(88_005_607, 0) + // Standard Error: 244_708 + .saturating_add(Weight::from_parts(175_744_834, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_776_000 picoseconds. - Weight::from_parts(84_411_464, 0) - // Standard Error: 300_083 - .saturating_add(Weight::from_parts(231_214_712, 0).saturating_mul(r.into())) + // Minimum execution time: 84_145_000 picoseconds. + Weight::from_parts(86_969_872, 0) + // Standard Error: 302_008 + .saturating_add(Weight::from_parts(180_744_297, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_020_000 picoseconds. - Weight::from_parts(88_213_734, 0) - // Standard Error: 299_486 - .saturating_add(Weight::from_parts(234_626_108, 0).saturating_mul(r.into())) + // Minimum execution time: 84_337_000 picoseconds. + Weight::from_parts(80_268_581, 0) + // Standard Error: 290_578 + .saturating_add(Weight::from_parts(180_541_423, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 90_531_000 picoseconds. - Weight::from_parts(77_088_751, 0) - // Standard Error: 300_109 - .saturating_add(Weight::from_parts(230_369_251, 0).saturating_mul(r.into())) + // Minimum execution time: 85_327_000 picoseconds. + Weight::from_parts(84_307_332, 0) + // Standard Error: 316_639 + .saturating_add(Weight::from_parts(179_561_839, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_087_000 picoseconds. - Weight::from_parts(84_427_914, 0) - // Standard Error: 251_575 - .saturating_add(Weight::from_parts(230_149_202, 0).saturating_mul(r.into())) + // Minimum execution time: 85_300_000 picoseconds. + Weight::from_parts(70_645_226, 0) + // Standard Error: 320_673 + .saturating_add(Weight::from_parts(182_342_085, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_844_000 picoseconds. - Weight::from_parts(86_923_662, 0) - // Standard Error: 276_902 - .saturating_add(Weight::from_parts(228_642_855, 0).saturating_mul(r.into())) + // Minimum execution time: 86_250_000 picoseconds. + Weight::from_parts(81_902_510, 0) + // Standard Error: 273_253 + .saturating_add(Weight::from_parts(180_582_426, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_211_000 picoseconds. - Weight::from_parts(97_915_752, 0) - // Standard Error: 307_205 - .saturating_add(Weight::from_parts(227_793_024, 0).saturating_mul(r.into())) + // Minimum execution time: 84_232_000 picoseconds. + Weight::from_parts(87_259_581, 0) + // Standard Error: 294_035 + .saturating_add(Weight::from_parts(175_294_464, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 565_301_000 picoseconds. - Weight::from_parts(644_433_401, 0) - // Standard Error: 568_889 - .saturating_add(Weight::from_parts(310_873_805, 0).saturating_mul(r.into())) + // Minimum execution time: 595_636_000 picoseconds. + Weight::from_parts(656_136_663, 0) + // Standard Error: 485_302 + .saturating_add(Weight::from_parts(261_855_478, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 854_359_000 picoseconds. - Weight::from_parts(867_584_000, 0) - // Standard Error: 55_314 - .saturating_add(Weight::from_parts(13_529_431, 0).saturating_mul(n.into())) + // Minimum execution time: 850_360_000 picoseconds. + Weight::from_parts(903_367_000, 0) + // Standard Error: 55_203 + .saturating_add(Weight::from_parts(13_094_816, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_162_000 picoseconds. - Weight::from_parts(73_330_737, 0) - // Standard Error: 367_053 - .saturating_add(Weight::from_parts(230_816_956, 0).saturating_mul(r.into())) + // Minimum execution time: 87_957_000 picoseconds. + Weight::from_parts(87_586_547, 0) + // Standard Error: 323_063 + .saturating_add(Weight::from_parts(174_117_671, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_475_000 picoseconds. - Weight::from_parts(88_825_613, 0) - // Standard Error: 317_797 - .saturating_add(Weight::from_parts(229_372_938, 0).saturating_mul(r.into())) + // Minimum execution time: 87_008_000 picoseconds. + Weight::from_parts(78_303_076, 0) + // Standard Error: 299_495 + .saturating_add(Weight::from_parts(175_222_715, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_490_000 picoseconds. - Weight::from_parts(101_323_435, 0) - // Standard Error: 334_119 - .saturating_add(Weight::from_parts(299_903_252, 0).saturating_mul(n.into())) + // Minimum execution time: 84_234_000 picoseconds. + Weight::from_parts(103_801_859, 0) + // Standard Error: 382_198 + .saturating_add(Weight::from_parts(245_171_881, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_576_000 picoseconds. - Weight::from_parts(94_527_000, 0) - // Standard Error: 4_270_115 - .saturating_add(Weight::from_parts(1_194_160_557, 0).saturating_mul(r.into())) + // Minimum execution time: 85_211_000 picoseconds. + Weight::from_parts(87_766_000, 0) + // Standard Error: 4_237_435 + .saturating_add(Weight::from_parts(1_076_031_771, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_977_000 picoseconds. - Weight::from_parts(141_823_097, 0) - // Standard Error: 496_715 - .saturating_add(Weight::from_parts(434_963_088, 0).saturating_mul(r.into())) + // Minimum execution time: 84_722_000 picoseconds. + Weight::from_parts(144_011_827, 0) + // Standard Error: 476_324 + .saturating_add(Weight::from_parts(387_231_993, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 518_193_000 picoseconds. - Weight::from_parts(524_909_000, 0) - // Standard Error: 62_300 - .saturating_add(Weight::from_parts(21_321_135, 0).saturating_mul(n.into())) + // Minimum execution time: 461_434_000 picoseconds. + Weight::from_parts(469_780_000, 0) + // Standard Error: 61_125 + .saturating_add(Weight::from_parts(21_613_603, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_523_000 picoseconds. - Weight::from_parts(151_675_920, 0) - // Standard Error: 482_814 - .saturating_add(Weight::from_parts(439_883_435, 0).saturating_mul(r.into())) + // Minimum execution time: 88_818_000 picoseconds. + Weight::from_parts(149_809_757, 0) + // Standard Error: 456_443 + .saturating_add(Weight::from_parts(395_488_333, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 526_574_000 picoseconds. - Weight::from_parts(532_320_000, 0) - // Standard Error: 57_892 - .saturating_add(Weight::from_parts(21_033_810, 0).saturating_mul(n.into())) + // Minimum execution time: 479_154_000 picoseconds. + Weight::from_parts(483_278_000, 0) + // Standard Error: 67_159 + .saturating_add(Weight::from_parts(21_947_194, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 565_329_000 picoseconds. - Weight::from_parts(628_847_199, 0) - // Standard Error: 567_127 - .saturating_add(Weight::from_parts(459_380_406, 0).saturating_mul(r.into())) + // Minimum execution time: 567_500_000 picoseconds. + Weight::from_parts(693_644_323, 0) + // Standard Error: 568_410 + .saturating_add(Weight::from_parts(412_109_027, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 563_636_000 picoseconds. - Weight::from_parts(667_937_303, 0) - // Standard Error: 627_480 - .saturating_add(Weight::from_parts(464_327_915, 0).saturating_mul(r.into())) + // Minimum execution time: 575_808_000 picoseconds. + Weight::from_parts(724_736_213, 0) + // Standard Error: 602_935 + .saturating_add(Weight::from_parts(412_885_093, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_009_000 picoseconds. - Weight::from_parts(90_613_264, 0) - // Standard Error: 336_555 - .saturating_add(Weight::from_parts(239_670_711, 0).saturating_mul(r.into())) + // Minimum execution time: 85_691_000 picoseconds. + Weight::from_parts(74_497_929, 0) + // Standard Error: 328_672 + .saturating_add(Weight::from_parts(197_295_056, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_793_427_000 picoseconds. - Weight::from_parts(4_919_028_362, 0) - // Standard Error: 436_952 - .saturating_add(Weight::from_parts(334_184_878, 0).saturating_mul(r.into())) + // Minimum execution time: 3_899_275_000 picoseconds. + Weight::from_parts(4_052_914_766, 0) + // Standard Error: 433_071 + .saturating_add(Weight::from_parts(279_414_467, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 581_270_000 picoseconds. - Weight::from_parts(587_607_000, 0) - // Standard Error: 56_972 - .saturating_add(Weight::from_parts(29_524_607, 0).saturating_mul(n.into())) + // Minimum execution time: 481_093_000 picoseconds. + Weight::from_parts(489_651_000, 0) + // Standard Error: 58_131 + .saturating_add(Weight::from_parts(29_725_779, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_804_492_000 picoseconds. - Weight::from_parts(4_913_430_363, 0) - // Standard Error: 550_705 - .saturating_add(Weight::from_parts(396_433_500, 0).saturating_mul(r.into())) + // Minimum execution time: 3_898_930_000 picoseconds. + Weight::from_parts(4_051_051_643, 0) + // Standard Error: 422_685 + .saturating_add(Weight::from_parts(335_909_883, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_795_428_000 picoseconds. - Weight::from_parts(4_944_127_505, 0) - // Standard Error: 488_447 - .saturating_add(Weight::from_parts(404_922_939, 0).saturating_mul(r.into())) + // Minimum execution time: 3_889_863_000 picoseconds. + Weight::from_parts(4_037_859_582, 0) + // Standard Error: 492_684 + .saturating_add(Weight::from_parts(354_039_027, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 255_233_000 picoseconds. - Weight::from_parts(318_618_896, 0) - // Standard Error: 505_767 - .saturating_add(Weight::from_parts(453_094_917, 0).saturating_mul(r.into())) + // Minimum execution time: 254_292_000 picoseconds. + Weight::from_parts(299_243_857, 0) + // Standard Error: 453_209 + .saturating_add(Weight::from_parts(402_577_817, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 681_100_000 picoseconds. - Weight::from_parts(694_074_000, 0) - // Standard Error: 58_042 - .saturating_add(Weight::from_parts(21_718_065, 0).saturating_mul(n.into())) + // Minimum execution time: 654_055_000 picoseconds. + Weight::from_parts(663_310_000, 0) + // Standard Error: 60_031 + .saturating_add(Weight::from_parts(21_652_831, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_971_144_000 picoseconds. - Weight::from_parts(5_113_524_443, 0) - // Standard Error: 622_444 - .saturating_add(Weight::from_parts(405_616_523, 0).saturating_mul(r.into())) + // Minimum execution time: 4_054_583_000 picoseconds. + Weight::from_parts(4_192_801_478, 0) + // Standard Error: 494_878 + .saturating_add(Weight::from_parts(356_698_705, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_531_000 picoseconds. - Weight::from_parts(92_058_153, 0) - // Standard Error: 277_495 - .saturating_add(Weight::from_parts(22_329_146, 0).saturating_mul(r.into())) + // Minimum execution time: 84_037_000 picoseconds. + Weight::from_parts(88_828_036, 0) + // Standard Error: 335_490 + .saturating_add(Weight::from_parts(26_597_063, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_664_000 picoseconds. - Weight::from_parts(89_554_700, 0) - // Standard Error: 5_459 - .saturating_add(Weight::from_parts(440_219, 0).saturating_mul(n.into())) + // Minimum execution time: 108_733_000 picoseconds. + Weight::from_parts(93_898_943, 0) + // Standard Error: 1_151 + .saturating_add(Weight::from_parts(428_904, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_067_000 picoseconds. - Weight::from_parts(89_450_440, 0) - // Standard Error: 271_734 - .saturating_add(Weight::from_parts(21_972_159, 0).saturating_mul(r.into())) + // Minimum execution time: 82_569_000 picoseconds. + Weight::from_parts(89_213_638, 0) + // Standard Error: 317_917 + .saturating_add(Weight::from_parts(22_797_961, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 108_108_000 picoseconds. - Weight::from_parts(100_790_952, 0) - // Standard Error: 1_751 - .saturating_add(Weight::from_parts(424_412, 0).saturating_mul(n.into())) + // Minimum execution time: 109_164_000 picoseconds. + Weight::from_parts(95_571_505, 0) + // Standard Error: 1_085 + .saturating_add(Weight::from_parts(425_025, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_953_000 picoseconds. - Weight::from_parts(89_527_906, 0) - // Standard Error: 343_008 - .saturating_add(Weight::from_parts(25_490_493, 0).saturating_mul(r.into())) + // Minimum execution time: 83_844_000 picoseconds. + Weight::from_parts(88_247_426, 0) + // Standard Error: 280_700 + .saturating_add(Weight::from_parts(17_706_873, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_267_000 picoseconds. - Weight::from_parts(91_613_297, 0) - // Standard Error: 266_992 - .saturating_add(Weight::from_parts(18_796_902, 0).saturating_mul(r.into())) + // Minimum execution time: 82_987_000 picoseconds. + Weight::from_parts(87_544_514, 0) + // Standard Error: 269_120 + .saturating_add(Weight::from_parts(21_098_185, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_555_000 picoseconds. - Weight::from_parts(125_646_143, 0) - // Standard Error: 438_029 - .saturating_add(Weight::from_parts(321_292_767, 0).saturating_mul(r.into())) + // Minimum execution time: 82_012_000 picoseconds. + Weight::from_parts(115_149_368, 0) + // Standard Error: 328_818 + .saturating_add(Weight::from_parts(265_684_350, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 106_780_000 picoseconds. - Weight::from_parts(108_777_000, 0) - // Standard Error: 2_695 - .saturating_add(Weight::from_parts(621_479, 0).saturating_mul(n.into())) + // Minimum execution time: 100_890_000 picoseconds. + Weight::from_parts(102_844_000, 0) + // Standard Error: 2_931 + .saturating_add(Weight::from_parts(635_797, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 568_972_000 picoseconds. - Weight::from_parts(609_033_910, 0) - // Standard Error: 4_571_153 - .saturating_add(Weight::from_parts(9_603_389, 0).saturating_mul(r.into())) + // Minimum execution time: 563_182_000 picoseconds. + Weight::from_parts(640_794_146, 0) + // Standard Error: 7_497_207 + .saturating_add(Weight::from_parts(15_239_053, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 563_090_000 picoseconds. - Weight::from_parts(592_066_973, 0) - // Standard Error: 2_340_115 - .saturating_add(Weight::from_parts(43_394_026, 0).saturating_mul(r.into())) + // Minimum execution time: 560_481_000 picoseconds. + Weight::from_parts(593_427_573, 0) + // Standard Error: 3_203_142 + .saturating_add(Weight::from_parts(25_969_526, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_249_000 picoseconds. - Weight::from_parts(101_672_638, 0) - // Standard Error: 324_954 - .saturating_add(Weight::from_parts(14_253_161, 0).saturating_mul(r.into())) + // Minimum execution time: 92_574_000 picoseconds. + Weight::from_parts(97_280_140, 0) + // Standard Error: 268_694 + .saturating_add(Weight::from_parts(12_092_859, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_010_000 picoseconds. - Weight::from_parts(100_030_007, 0) - // Standard Error: 1_129 - .saturating_add(Weight::from_parts(428_607, 0).saturating_mul(n.into())) + // Minimum execution time: 109_631_000 picoseconds. + Weight::from_parts(94_175_255, 0) + // Standard Error: 1_213 + .saturating_add(Weight::from_parts(427_553, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_185_000 picoseconds. - Weight::from_parts(99_966_330, 0) - // Standard Error: 301_219 - .saturating_add(Weight::from_parts(14_061_369, 0).saturating_mul(r.into())) + // Minimum execution time: 95_505_000 picoseconds. + Weight::from_parts(100_109_459, 0) + // Standard Error: 279_145 + .saturating_add(Weight::from_parts(8_335_840, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 113_423_000 picoseconds. - Weight::from_parts(96_606_724, 0) - // Standard Error: 1_205 - .saturating_add(Weight::from_parts(428_607, 0).saturating_mul(n.into())) + // Minimum execution time: 105_015_000 picoseconds. + Weight::from_parts(96_000_128, 0) + // Standard Error: 1_363 + .saturating_add(Weight::from_parts(423_685, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_774_000 picoseconds. - Weight::from_parts(83_857_549, 0) - // Standard Error: 297_267 - .saturating_add(Weight::from_parts(233_219_125, 0).saturating_mul(r.into())) + // Minimum execution time: 84_784_000 picoseconds. + Weight::from_parts(84_956_444, 0) + // Standard Error: 285_268 + .saturating_add(Weight::from_parts(178_346_410, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_953_000 picoseconds. - Weight::from_parts(88_940_722, 0) - // Standard Error: 258_844 - .saturating_add(Weight::from_parts(233_676_090, 0).saturating_mul(r.into())) + // Minimum execution time: 85_915_000 picoseconds. + Weight::from_parts(78_586_027, 0) + // Standard Error: 254_710 + .saturating_add(Weight::from_parts(178_243_954, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 564_724_000 picoseconds. - Weight::from_parts(626_617_925, 0) - // Standard Error: 538_611 - .saturating_add(Weight::from_parts(242_663_753, 0).saturating_mul(r.into())) + // Minimum execution time: 557_380_000 picoseconds. + Weight::from_parts(633_253_100, 0) + // Standard Error: 538_762 + .saturating_add(Weight::from_parts(195_061_580, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 587_473_000 picoseconds. - Weight::from_parts(628_885_094, 0) - // Standard Error: 2_965 - .saturating_add(Weight::from_parts(136_594, 0).saturating_mul(n.into())) + // Minimum execution time: 597_682_000 picoseconds. + Weight::from_parts(661_897_574, 0) + // Standard Error: 3_826 + .saturating_add(Weight::from_parts(136_457, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_309_979_000 picoseconds. - Weight::from_parts(5_518_613_800, 0) - // Standard Error: 495_795 - .saturating_add(Weight::from_parts(255_179_221, 0).saturating_mul(r.into())) + // Minimum execution time: 4_454_821_000 picoseconds. + Weight::from_parts(4_682_125_339, 0) + // Standard Error: 520_741 + .saturating_add(Weight::from_parts(206_155_172, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_619_977_000 picoseconds. - Weight::from_parts(5_618_998_968, 0) - // Standard Error: 15_127 - .saturating_add(Weight::from_parts(11_998_735, 0).saturating_mul(n.into())) + // Minimum execution time: 4_637_831_000 picoseconds. + Weight::from_parts(4_748_853_254, 0) + // Standard Error: 16_010 + .saturating_add(Weight::from_parts(12_276_105, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_971_000 picoseconds. - Weight::from_parts(108_261_938, 0) - // Standard Error: 357_345 - .saturating_add(Weight::from_parts(247_489_332, 0).saturating_mul(r.into())) + // Minimum execution time: 84_447_000 picoseconds. + Weight::from_parts(111_081_974, 0) + // Standard Error: 422_093 + .saturating_add(Weight::from_parts(195_515_962, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 246_916_000 picoseconds. - Weight::from_parts(250_528_000, 0) - // Standard Error: 62_481 - .saturating_add(Weight::from_parts(26_192_033, 0).saturating_mul(n.into())) + // Minimum execution time: 188_901_000 picoseconds. + Weight::from_parts(192_422_000, 0) + // Standard Error: 54_402 + .saturating_add(Weight::from_parts(25_703_289, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_844_000 picoseconds. - Weight::from_parts(86_460_466, 0) - // Standard Error: 314_595 - .saturating_add(Weight::from_parts(229_172_736, 0).saturating_mul(r.into())) + // Minimum execution time: 85_538_000 picoseconds. + Weight::from_parts(83_073_715, 0) + // Standard Error: 285_530 + .saturating_add(Weight::from_parts(174_178_092, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_011_000 picoseconds. - Weight::from_parts(89_540_236, 0) - // Standard Error: 277_012 - .saturating_add(Weight::from_parts(24_910_563, 0).saturating_mul(r.into())) + // Minimum execution time: 84_697_000 picoseconds. + Weight::from_parts(89_049_881, 0) + // Standard Error: 281_628 + .saturating_add(Weight::from_parts(27_362_618, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_836_000 picoseconds. - Weight::from_parts(90_857_869, 0) - // Standard Error: 291_210 - .saturating_add(Weight::from_parts(17_718_230, 0).saturating_mul(r.into())) + // Minimum execution time: 83_006_000 picoseconds. + Weight::from_parts(86_657_161, 0) + // Standard Error: 254_208 + .saturating_add(Weight::from_parts(14_853_038, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_114_000 picoseconds. - Weight::from_parts(88_948_630, 0) - // Standard Error: 281_540 - .saturating_add(Weight::from_parts(14_540_169, 0).saturating_mul(r.into())) + // Minimum execution time: 83_155_000 picoseconds. + Weight::from_parts(87_136_381, 0) + // Standard Error: 296_075 + .saturating_add(Weight::from_parts(15_564_718, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_936_000 picoseconds. - Weight::from_parts(89_554_053, 0) - // Standard Error: 298_663 - .saturating_add(Weight::from_parts(14_576_446, 0).saturating_mul(r.into())) + // Minimum execution time: 83_160_000 picoseconds. + Weight::from_parts(87_382_440, 0) + // Standard Error: 263_499 + .saturating_add(Weight::from_parts(17_288_459, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_247_000 picoseconds. - Weight::from_parts(89_623_508, 0) - // Standard Error: 282_863 - .saturating_add(Weight::from_parts(15_308_291, 0).saturating_mul(r.into())) + // Minimum execution time: 86_780_000 picoseconds. + Weight::from_parts(90_970_389, 0) + // Standard Error: 273_512 + .saturating_add(Weight::from_parts(14_976_210, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 141_231_000 picoseconds. - Weight::from_parts(217_400_187, 0) - // Standard Error: 337_987 - .saturating_add(Weight::from_parts(328_969_338, 0).saturating_mul(r.into())) + // Minimum execution time: 141_871_000 picoseconds. + Weight::from_parts(203_107_595, 0) + // Standard Error: 322_999 + .saturating_add(Weight::from_parts(280_023_774, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 99_426_000 picoseconds. - Weight::from_parts(161_723_004, 0) - // Standard Error: 460_097 - .saturating_add(Weight::from_parts(527_605_370, 0).saturating_mul(r.into())) + // Minimum execution time: 99_132_000 picoseconds. + Weight::from_parts(166_620_417, 0) + // Standard Error: 428_363 + .saturating_add(Weight::from_parts(469_520_431, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2954,22 +2950,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_162_817_000 picoseconds. - Weight::from_parts(43_297_354_000, 0) - // Standard Error: 264_494 - .saturating_add(Weight::from_parts(7_584_082, 0).saturating_mul(p.into())) - // Standard Error: 264_481 - .saturating_add(Weight::from_parts(178_777_430, 0).saturating_mul(s.into())) + // Minimum execution time: 46_670_030_000 picoseconds. + Weight::from_parts(46_979_707_000, 0) + // Standard Error: 290_199 + .saturating_add(Weight::from_parts(7_295_075, 0).saturating_mul(p.into())) + // Standard Error: 290_185 + .saturating_add(Weight::from_parts(178_049_340, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_693_000 picoseconds. - Weight::from_parts(166_444_602, 0) - // Standard Error: 495_644 - .saturating_add(Weight::from_parts(530_773_692, 0).saturating_mul(r.into())) + // Minimum execution time: 95_401_000 picoseconds. + Weight::from_parts(162_215_381, 0) + // Standard Error: 435_866 + .saturating_add(Weight::from_parts(479_266_464, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2977,32 +2973,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_177_326_000 picoseconds. - Weight::from_parts(43_276_934_000, 0) - // Standard Error: 258_837 - .saturating_add(Weight::from_parts(7_780_932, 0).saturating_mul(p.into())) - // Standard Error: 258_825 - .saturating_add(Weight::from_parts(178_845_680, 0).saturating_mul(s.into())) + // Minimum execution time: 44_093_174_000 picoseconds. + Weight::from_parts(44_268_099_000, 0) + // Standard Error: 249_484 + .saturating_add(Weight::from_parts(7_595_737, 0).saturating_mul(p.into())) + // Standard Error: 249_471 + .saturating_add(Weight::from_parts(179_055_114, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_913_000 picoseconds. - Weight::from_parts(103_423_829, 0) - // Standard Error: 30_584 - .saturating_add(Weight::from_parts(4_067_667, 0).saturating_mul(r.into())) + // Minimum execution time: 84_188_000 picoseconds. + Weight::from_parts(101_583_480, 0) + // Standard Error: 35_878 + .saturating_add(Weight::from_parts(3_611_568, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 86_329_000 picoseconds. - Weight::from_parts(122_711_700, 1131) - // Standard Error: 6_939 - .saturating_add(Weight::from_parts(12_248_450, 0).saturating_mul(p.into())) + // Minimum execution time: 86_183_000 picoseconds. + Weight::from_parts(118_618_192, 1131) + // Standard Error: 6_832 + .saturating_add(Weight::from_parts(11_877_671, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3011,10 +3007,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_299_000 picoseconds. - Weight::from_parts(88_786_000, 1131) - // Standard Error: 45_222 - .saturating_add(Weight::from_parts(35_865_045, 0).saturating_mul(p.into())) + // Minimum execution time: 84_629_000 picoseconds. + Weight::from_parts(86_416_000, 1131) + // Standard Error: 28_253 + .saturating_add(Weight::from_parts(36_463_142, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3023,10 +3019,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_294_375_000 picoseconds. - Weight::from_parts(5_970_923_161, 5069931) - // Standard Error: 84_190 - .saturating_add(Weight::from_parts(37_074_862, 0).saturating_mul(p.into())) + // Minimum execution time: 6_148_282_000 picoseconds. + Weight::from_parts(5_977_321_351, 5069931) + // Standard Error: 52_501 + .saturating_add(Weight::from_parts(36_684_019, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -3034,10 +3030,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 86_701_000 picoseconds. - Weight::from_parts(88_528_000, 1939) - // Standard Error: 23_868 - .saturating_add(Weight::from_parts(45_548_960, 0).saturating_mul(p.into())) + // Minimum execution time: 85_557_000 picoseconds. + Weight::from_parts(86_547_000, 1939) + // Standard Error: 32_777 + .saturating_add(Weight::from_parts(46_224_064, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -3046,10 +3042,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 96_310_000 picoseconds. - Weight::from_parts(94_183_637, 1131) - // Standard Error: 63_935 - .saturating_add(Weight::from_parts(36_590_808, 0).saturating_mul(p.into())) + // Minimum execution time: 89_966_000 picoseconds. + Weight::from_parts(89_543_596, 1131) + // Standard Error: 68_448 + .saturating_add(Weight::from_parts(36_359_585, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3058,10 +3054,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 598_904_000 picoseconds. - Weight::from_parts(619_105_409, 1496) - // Standard Error: 245_290 - .saturating_add(Weight::from_parts(42_961_968, 0).saturating_mul(p.into())) + // Minimum execution time: 600_329_000 picoseconds. + Weight::from_parts(623_878_315, 1496) + // Standard Error: 267_055 + .saturating_add(Weight::from_parts(46_147_238, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3070,10 +3066,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_017_010_000 picoseconds. - Weight::from_parts(1_027_116_414, 317931) - // Standard Error: 208_481 - .saturating_add(Weight::from_parts(42_351_428, 0).saturating_mul(p.into())) + // Minimum execution time: 1_023_023_000 picoseconds. + Weight::from_parts(1_022_993_537, 317931) + // Standard Error: 203_791 + .saturating_add(Weight::from_parts(43_538_291, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3081,505 +3077,505 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_561_000 picoseconds. - Weight::from_parts(2_759_075, 0) - // Standard Error: 6_571 - .saturating_add(Weight::from_parts(23_969_853, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_436_506, 0) + // Standard Error: 16_946 + .saturating_add(Weight::from_parts(24_493_632, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_328_660_000 picoseconds. - Weight::from_parts(4_143_980_969, 0) - // Standard Error: 82_202 - .saturating_add(Weight::from_parts(5_228_381, 0).saturating_mul(r.into())) + // Minimum execution time: 4_347_874_000 picoseconds. + Weight::from_parts(4_179_322_071, 0) + // Standard Error: 53_086 + .saturating_add(Weight::from_parts(4_505_224, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_356_758_000 picoseconds. - Weight::from_parts(4_127_092_336, 0) - // Standard Error: 81_533 - .saturating_add(Weight::from_parts(5_327_098, 0).saturating_mul(r.into())) + // Minimum execution time: 4_348_187_000 picoseconds. + Weight::from_parts(4_205_195_765, 0) + // Standard Error: 44_017 + .saturating_add(Weight::from_parts(4_404_586, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_325_202_000 picoseconds. - Weight::from_parts(11_524_412_486, 0) - // Standard Error: 169_048 - .saturating_add(Weight::from_parts(8_747_721, 0).saturating_mul(r.into())) + // Minimum execution time: 10_882_662_000 picoseconds. + Weight::from_parts(11_083_501_979, 0) + // Standard Error: 200_162 + .saturating_add(Weight::from_parts(13_165_815, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_155_518_000 picoseconds. - Weight::from_parts(11_305_969_431, 0) - // Standard Error: 149_327 - .saturating_add(Weight::from_parts(7_628_408, 0).saturating_mul(r.into())) + // Minimum execution time: 10_784_867_000 picoseconds. + Weight::from_parts(11_957_102_430, 0) + // Standard Error: 187_347 + .saturating_add(Weight::from_parts(8_480_335, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_349_000, 0) - // Standard Error: 8_979 - .saturating_add(Weight::from_parts(3_801_082, 0).saturating_mul(r.into())) + // Minimum execution time: 2_343_000 picoseconds. + Weight::from_parts(2_421_000, 0) + // Standard Error: 9_011 + .saturating_add(Weight::from_parts(3_834_828, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 4_990 - .saturating_add(Weight::from_parts(3_041_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_326_000 picoseconds. + Weight::from_parts(2_421_000, 0) + // Standard Error: 5_612 + .saturating_add(Weight::from_parts(3_061_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_807_134, 0) - // Standard Error: 2_945 - .saturating_add(Weight::from_parts(1_608_008, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(3_427_769, 0) + // Standard Error: 941 + .saturating_add(Weight::from_parts(1_568_677, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(2_313_000, 0) - // Standard Error: 9_217 - .saturating_add(Weight::from_parts(3_001_349, 0).saturating_mul(r.into())) + // Minimum execution time: 2_284_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 8_418 + .saturating_add(Weight::from_parts(2_921_747, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_275_000 picoseconds. - Weight::from_parts(5_247_232, 0) - // Standard Error: 23_149 - .saturating_add(Weight::from_parts(5_086_357, 0).saturating_mul(r.into())) + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(1_354_050, 0) + // Standard Error: 14_642 + .saturating_add(Weight::from_parts(5_182_595, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_867_000 picoseconds. - Weight::from_parts(5_126_797, 0) - // Standard Error: 1_332 - .saturating_add(Weight::from_parts(171_719, 0).saturating_mul(e.into())) + // Minimum execution time: 7_011_000 picoseconds. + Weight::from_parts(5_823_252, 0) + // Standard Error: 2_035 + .saturating_add(Weight::from_parts(162_988, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_293_000 picoseconds. - Weight::from_parts(5_216_165, 0) - // Standard Error: 7_649 - .saturating_add(Weight::from_parts(2_565_620, 0).saturating_mul(r.into())) + // Minimum execution time: 2_405_000 picoseconds. + Weight::from_parts(5_172_082, 0) + // Standard Error: 7_906 + .saturating_add(Weight::from_parts(2_576_107, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_565_620 - - 2_416_114, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_576_107 - + 2_413_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_281_000 picoseconds. - Weight::from_parts(4_597_442, 0) - // Standard Error: 12_255 - .saturating_add(Weight::from_parts(2_416_114, 0).saturating_mul(r.into())) + // Minimum execution time: 2_315_000 picoseconds. + Weight::from_parts(4_417_546, 0) + // Standard Error: 12_281 + .saturating_add(Weight::from_parts(2_413_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_644_000 picoseconds. - Weight::from_parts(14_659_973, 0) - // Standard Error: 22_420 - .saturating_add(Weight::from_parts(10_375_527, 0).saturating_mul(r.into())) + // Minimum execution time: 2_774_000 picoseconds. + Weight::from_parts(19_445_534, 0) + // Standard Error: 34_031 + .saturating_add(Weight::from_parts(9_947_648, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_012_000 picoseconds. - Weight::from_parts(125_533, 0) - // Standard Error: 6_220 - .saturating_add(Weight::from_parts(1_333_743, 0).saturating_mul(p.into())) + // Minimum execution time: 12_663_000 picoseconds. + Weight::from_parts(2_443_915, 0) + // Standard Error: 6_189 + .saturating_add(Weight::from_parts(1_274_832, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_409_000 picoseconds. - Weight::from_parts(5_781_918, 0) - // Standard Error: 17 - .saturating_add(Weight::from_parts(5, 0).saturating_mul(l.into())) + // Minimum execution time: 5_382_000 picoseconds. + Weight::from_parts(5_657_220, 0) + // Standard Error: 12 + .saturating_add(Weight::from_parts(14, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_326_000 picoseconds. - Weight::from_parts(1_651_020, 0) - // Standard Error: 4_374 - .saturating_add(Weight::from_parts(290_475, 0).saturating_mul(r.into())) + // Minimum execution time: 2_461_000 picoseconds. + Weight::from_parts(1_936_508, 0) + // Standard Error: 3_019 + .saturating_add(Weight::from_parts(275_086, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_332_000, 0) - // Standard Error: 6_148 - .saturating_add(Weight::from_parts(854_221, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_394_000, 0) + // Standard Error: 4_239 + .saturating_add(Weight::from_parts(763_775, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(2_302_000, 0) - // Standard Error: 5_829 - .saturating_add(Weight::from_parts(849_053, 0).saturating_mul(r.into())) + // Minimum execution time: 2_367_000 picoseconds. + Weight::from_parts(2_411_000, 0) + // Standard Error: 5_426 + .saturating_add(Weight::from_parts(771_295, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_331_000 picoseconds. - Weight::from_parts(2_255_535, 0) - // Standard Error: 8_243 - .saturating_add(Weight::from_parts(867_515, 0).saturating_mul(r.into())) + // Minimum execution time: 6_346_000 picoseconds. + Weight::from_parts(2_691_888, 0) + // Standard Error: 7_020 + .saturating_add(Weight::from_parts(804_877, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_337_000 picoseconds. - Weight::from_parts(6_517_000, 0) - // Standard Error: 7_847 - .saturating_add(Weight::from_parts(1_426_655, 0).saturating_mul(r.into())) + // Minimum execution time: 6_476_000 picoseconds. + Weight::from_parts(6_582_000, 0) + // Standard Error: 8_493 + .saturating_add(Weight::from_parts(1_358_866, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_163_000 picoseconds. - Weight::from_parts(2_440_836, 0) - // Standard Error: 8_886 - .saturating_add(Weight::from_parts(7_297_596, 0).saturating_mul(r.into())) + // Minimum execution time: 4_943_000 picoseconds. + Weight::from_parts(1_102_558, 0) + // Standard Error: 12_614 + .saturating_add(Weight::from_parts(7_099_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_231_000, 0) - // Standard Error: 6_013 - .saturating_add(Weight::from_parts(3_453_309, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(2_357_000, 0) + // Standard Error: 7_419 + .saturating_add(Weight::from_parts(3_438_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_297_000 picoseconds. - Weight::from_parts(2_335_000, 0) - // Standard Error: 5_409 - .saturating_add(Weight::from_parts(3_213_419, 0).saturating_mul(r.into())) + // Minimum execution time: 2_201_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 7_089 + .saturating_add(Weight::from_parts(3_224_674, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_319_000, 0) - // Standard Error: 5_741 - .saturating_add(Weight::from_parts(3_164_881, 0).saturating_mul(r.into())) + // Minimum execution time: 2_358_000 picoseconds. + Weight::from_parts(2_444_000, 0) + // Standard Error: 5_880 + .saturating_add(Weight::from_parts(3_196_577, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(2_404_000, 0) - // Standard Error: 5_514 - .saturating_add(Weight::from_parts(2_656_016, 0).saturating_mul(r.into())) + // Minimum execution time: 2_205_000 picoseconds. + Weight::from_parts(2_361_000, 0) + // Standard Error: 5_007 + .saturating_add(Weight::from_parts(2_694_074, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_332_000, 0) - // Standard Error: 4_301 - .saturating_add(Weight::from_parts(566_740, 0).saturating_mul(r.into())) + // Minimum execution time: 2_217_000 picoseconds. + Weight::from_parts(2_339_000, 0) + // Standard Error: 4_242 + .saturating_add(Weight::from_parts(562_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(1_380_111, 0) - // Standard Error: 4_021 - .saturating_add(Weight::from_parts(394_594, 0).saturating_mul(r.into())) + // Minimum execution time: 2_180_000 picoseconds. + Weight::from_parts(1_150_328, 0) + // Standard Error: 4_155 + .saturating_add(Weight::from_parts(430_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 11_230 - .saturating_add(Weight::from_parts(1_866_720, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_269_000, 0) + // Standard Error: 12_863 + .saturating_add(Weight::from_parts(1_875_276, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(2_251_000, 0) - // Standard Error: 7_963 - .saturating_add(Weight::from_parts(1_115_416, 0).saturating_mul(r.into())) + // Minimum execution time: 2_290_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 8_333 + .saturating_add(Weight::from_parts(1_185_939, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_239_000 picoseconds. - Weight::from_parts(1_345_300, 0) - // Standard Error: 3_470 - .saturating_add(Weight::from_parts(360_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_384_000 picoseconds. + Weight::from_parts(1_572_617, 0) + // Standard Error: 3_727 + .saturating_add(Weight::from_parts(382_695, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_224_000 picoseconds. - Weight::from_parts(1_283_809, 0) - // Standard Error: 3_741 - .saturating_add(Weight::from_parts(386_488, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(1_495_799, 0) + // Standard Error: 4_058 + .saturating_add(Weight::from_parts(373_636, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_266_000, 0) - // Standard Error: 3_756 - .saturating_add(Weight::from_parts(503_289, 0).saturating_mul(r.into())) + // Minimum execution time: 2_341_000 picoseconds. + Weight::from_parts(465_059, 0) + // Standard Error: 4_917 + .saturating_add(Weight::from_parts(551_259, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_314_000, 0) - // Standard Error: 3_752 - .saturating_add(Weight::from_parts(508_162, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(515_890, 0) + // Standard Error: 4_848 + .saturating_add(Weight::from_parts(545_542, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_253_000 picoseconds. - Weight::from_parts(699_457, 0) - // Standard Error: 5_310 - .saturating_add(Weight::from_parts(500_136, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(739_709, 0) + // Standard Error: 4_827 + .saturating_add(Weight::from_parts(496_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(1_730_310, 0) - // Standard Error: 3_237 - .saturating_add(Weight::from_parts(335_706, 0).saturating_mul(r.into())) + // Minimum execution time: 2_322_000 picoseconds. + Weight::from_parts(1_492_190, 0) + // Standard Error: 3_923 + .saturating_add(Weight::from_parts(340_665, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_536_419, 0) - // Standard Error: 2_151 - .saturating_add(Weight::from_parts(176_722, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_979_817, 0) + // Standard Error: 1_972 + .saturating_add(Weight::from_parts(154_315, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_154_000 picoseconds. - Weight::from_parts(2_831_218, 0) - // Standard Error: 1_859 - .saturating_add(Weight::from_parts(170_795, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(2_877_230, 0) + // Standard Error: 1_753 + .saturating_add(Weight::from_parts(153_462, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(2_257_000, 0) - // Standard Error: 12_552 - .saturating_add(Weight::from_parts(1_890_934, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 11_649 + .saturating_add(Weight::from_parts(1_795_062, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_307_000, 0) - // Standard Error: 6_846 - .saturating_add(Weight::from_parts(1_121_975, 0).saturating_mul(r.into())) + // Minimum execution time: 2_303_000 picoseconds. + Weight::from_parts(2_366_000, 0) + // Standard Error: 7_436 + .saturating_add(Weight::from_parts(1_091_962, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_327_000, 0) - // Standard Error: 12_461 - .saturating_add(Weight::from_parts(1_833_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_346_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 11_197 + .saturating_add(Weight::from_parts(1_828_518, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_343_000, 0) - // Standard Error: 7_617 - .saturating_add(Weight::from_parts(1_119_136, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_384_000, 0) + // Standard Error: 7_307 + .saturating_add(Weight::from_parts(1_106_869, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_327_000, 0) - // Standard Error: 12_329 - .saturating_add(Weight::from_parts(1_835_082, 0).saturating_mul(r.into())) + // Minimum execution time: 2_286_000 picoseconds. + Weight::from_parts(2_343_000, 0) + // Standard Error: 10_932 + .saturating_add(Weight::from_parts(1_789_419, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_252_000, 0) - // Standard Error: 7_701 - .saturating_add(Weight::from_parts(1_124_368, 0).saturating_mul(r.into())) + // Minimum execution time: 2_214_000 picoseconds. + Weight::from_parts(2_283_000, 0) + // Standard Error: 7_556 + .saturating_add(Weight::from_parts(1_111_326, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(2_263_000, 0) - // Standard Error: 11_813 - .saturating_add(Weight::from_parts(1_875_008, 0).saturating_mul(r.into())) + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 10_995 + .saturating_add(Weight::from_parts(1_822_680, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_240_000, 0) - // Standard Error: 8_075 - .saturating_add(Weight::from_parts(1_160_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(2_334_000, 0) + // Standard Error: 6_944 + .saturating_add(Weight::from_parts(1_121_080, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_196_000 picoseconds. - Weight::from_parts(2_275_000, 0) - // Standard Error: 13_171 - .saturating_add(Weight::from_parts(1_950_456, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 11_873 + .saturating_add(Weight::from_parts(1_840_273, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_205_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 7_284 - .saturating_add(Weight::from_parts(1_178_320, 0).saturating_mul(r.into())) + // Minimum execution time: 2_265_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 7_972 + .saturating_add(Weight::from_parts(1_134_825, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_264_000 picoseconds. - Weight::from_parts(2_317_000, 0) - // Standard Error: 9_368 - .saturating_add(Weight::from_parts(1_868_546, 0).saturating_mul(r.into())) + // Minimum execution time: 2_269_000 picoseconds. + Weight::from_parts(2_355_000, 0) + // Standard Error: 11_547 + .saturating_add(Weight::from_parts(1_813_029, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_284_000 picoseconds. - Weight::from_parts(2_405_000, 0) - // Standard Error: 8_061 - .saturating_add(Weight::from_parts(1_197_559, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_349_000, 0) + // Standard Error: 6_487 + .saturating_add(Weight::from_parts(1_091_201, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { @@ -3587,378 +3583,378 @@ impl WeightInfo for () { // Measured: `0` // Estimated: `0` // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_300_000, 0) - // Standard Error: 11_834 - .saturating_add(Weight::from_parts(1_923_567, 0).saturating_mul(r.into())) + Weight::from_parts(2_329_000, 0) + // Standard Error: 12_018 + .saturating_add(Weight::from_parts(1_823_755, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_179_000 picoseconds. - Weight::from_parts(2_274_000, 0) - // Standard Error: 9_362 - .saturating_add(Weight::from_parts(1_190_357, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(2_359_000, 0) + // Standard Error: 7_325 + .saturating_add(Weight::from_parts(1_192_292, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 11_991 - .saturating_add(Weight::from_parts(1_870_585, 0).saturating_mul(r.into())) + // Minimum execution time: 2_352_000 picoseconds. + Weight::from_parts(2_386_000, 0) + // Standard Error: 10_009 + .saturating_add(Weight::from_parts(1_870_539, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_207_000 picoseconds. - Weight::from_parts(2_267_000, 0) - // Standard Error: 7_987 - .saturating_add(Weight::from_parts(1_127_255, 0).saturating_mul(r.into())) + // Minimum execution time: 2_315_000 picoseconds. + Weight::from_parts(2_382_000, 0) + // Standard Error: 7_109 + .saturating_add(Weight::from_parts(1_122_152, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_234_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 10_810 - .saturating_add(Weight::from_parts(1_837_668, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_337_000, 0) + // Standard Error: 11_700 + .saturating_add(Weight::from_parts(1_825_021, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_203_000 picoseconds. - Weight::from_parts(2_291_000, 0) - // Standard Error: 7_532 - .saturating_add(Weight::from_parts(1_128_887, 0).saturating_mul(r.into())) + // Minimum execution time: 2_357_000 picoseconds. + Weight::from_parts(2_407_000, 0) + // Standard Error: 7_769 + .saturating_add(Weight::from_parts(1_146_472, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 13_291 - .saturating_add(Weight::from_parts(1_912_800, 0).saturating_mul(r.into())) + // Minimum execution time: 2_196_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 9_908 + .saturating_add(Weight::from_parts(1_845_094, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_314_000, 0) - // Standard Error: 8_690 - .saturating_add(Weight::from_parts(1_153_175, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(2_382_000, 0) + // Standard Error: 9_519 + .saturating_add(Weight::from_parts(1_241_507, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_313_000, 0) - // Standard Error: 8_536 - .saturating_add(Weight::from_parts(1_274_613, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_323_000, 0) + // Standard Error: 7_921 + .saturating_add(Weight::from_parts(1_330_988, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_272_000, 0) - // Standard Error: 5_570 - .saturating_add(Weight::from_parts(643_298, 0).saturating_mul(r.into())) + // Minimum execution time: 2_203_000 picoseconds. + Weight::from_parts(2_262_000, 0) + // Standard Error: 4_732 + .saturating_add(Weight::from_parts(619_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(2_266_000, 0) - // Standard Error: 8_347 - .saturating_add(Weight::from_parts(1_274_115, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_318_000, 0) + // Standard Error: 8_121 + .saturating_add(Weight::from_parts(1_255_733, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_154_000 picoseconds. - Weight::from_parts(2_227_000, 0) - // Standard Error: 4_699 - .saturating_add(Weight::from_parts(628_921, 0).saturating_mul(r.into())) + // Minimum execution time: 2_332_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 5_698 + .saturating_add(Weight::from_parts(666_782, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_220_000 picoseconds. - Weight::from_parts(2_256_000, 0) - // Standard Error: 13_065 - .saturating_add(Weight::from_parts(1_893_638, 0).saturating_mul(r.into())) + // Minimum execution time: 2_269_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 10_724 + .saturating_add(Weight::from_parts(1_779_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 8_533 - .saturating_add(Weight::from_parts(1_231_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_239_000 picoseconds. + Weight::from_parts(2_377_000, 0) + // Standard Error: 8_303 + .saturating_add(Weight::from_parts(1_231_579, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_169_000 picoseconds. - Weight::from_parts(2_444_956, 0) - // Standard Error: 20_020 - .saturating_add(Weight::from_parts(2_735_228, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(3_881_473, 0) + // Standard Error: 22_336 + .saturating_add(Weight::from_parts(2_602_873, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_330_000, 0) - // Standard Error: 6_388 - .saturating_add(Weight::from_parts(2_443_190, 0).saturating_mul(r.into())) + // Minimum execution time: 2_366_000 picoseconds. + Weight::from_parts(971_800, 0) + // Standard Error: 9_516 + .saturating_add(Weight::from_parts(2_473_994, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_178_000 picoseconds. - Weight::from_parts(2_275_000, 0) - // Standard Error: 8_585 - .saturating_add(Weight::from_parts(2_921_612, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(3_150_808, 0) + // Standard Error: 24_239 + .saturating_add(Weight::from_parts(2_853_024, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 7_183 - .saturating_add(Weight::from_parts(2_537_552, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(1_149_774, 0) + // Standard Error: 13_355 + .saturating_add(Weight::from_parts(2_517_122, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(414_212, 0) - // Standard Error: 42_344 - .saturating_add(Weight::from_parts(9_454_771, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(1_527_824, 0) + // Standard Error: 31_972 + .saturating_add(Weight::from_parts(9_267_865, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(1_328_463, 0) - // Standard Error: 44_234 - .saturating_add(Weight::from_parts(7_539_740, 0).saturating_mul(r.into())) + // Minimum execution time: 2_323_000 picoseconds. + Weight::from_parts(988_781, 0) + // Standard Error: 44_193 + .saturating_add(Weight::from_parts(7_612_584, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_117_006, 0) - // Standard Error: 14_944 - .saturating_add(Weight::from_parts(2_960_667, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(2_334_729, 0) + // Standard Error: 15_965 + .saturating_add(Weight::from_parts(2_951_129, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_233_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 7_481 - .saturating_add(Weight::from_parts(2_538_984, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(1_116_651, 0) + // Standard Error: 17_134 + .saturating_add(Weight::from_parts(2_528_749, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_237_000 picoseconds. - Weight::from_parts(2_325_000, 0) - // Standard Error: 9_311 - .saturating_add(Weight::from_parts(1_303_917, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_268_000, 0) + // Standard Error: 8_575 + .saturating_add(Weight::from_parts(1_262_352, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 4_197 - .saturating_add(Weight::from_parts(607_955, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_338_000, 0) + // Standard Error: 4_378 + .saturating_add(Weight::from_parts(623_671, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(2_315_000, 0) - // Standard Error: 8_973 - .saturating_add(Weight::from_parts(1_276_071, 0).saturating_mul(r.into())) + // Minimum execution time: 2_335_000 picoseconds. + Weight::from_parts(2_380_000, 0) + // Standard Error: 8_320 + .saturating_add(Weight::from_parts(1_276_618, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_301_000, 0) - // Standard Error: 4_647 - .saturating_add(Weight::from_parts(634_889, 0).saturating_mul(r.into())) + // Minimum execution time: 2_330_000 picoseconds. + Weight::from_parts(2_374_000, 0) + // Standard Error: 4_039 + .saturating_add(Weight::from_parts(593_652, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_194_000 picoseconds. - Weight::from_parts(2_252_000, 0) - // Standard Error: 9_373 - .saturating_add(Weight::from_parts(1_262_774, 0).saturating_mul(r.into())) + // Minimum execution time: 2_220_000 picoseconds. + Weight::from_parts(2_325_000, 0) + // Standard Error: 8_112 + .saturating_add(Weight::from_parts(1_247_970, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 4_485 - .saturating_add(Weight::from_parts(593_561, 0).saturating_mul(r.into())) + // Minimum execution time: 2_280_000 picoseconds. + Weight::from_parts(2_353_000, 0) + // Standard Error: 4_344 + .saturating_add(Weight::from_parts(606_457, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 7_602 - .saturating_add(Weight::from_parts(1_053_865, 0).saturating_mul(r.into())) + // Minimum execution time: 2_234_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 7_296 + .saturating_add(Weight::from_parts(1_053_977, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_282_000, 0) - // Standard Error: 4_413 - .saturating_add(Weight::from_parts(573_275, 0).saturating_mul(r.into())) + // Minimum execution time: 2_342_000 picoseconds. + Weight::from_parts(75_359, 0) + // Standard Error: 6_197 + .saturating_add(Weight::from_parts(627_367, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_253_000 picoseconds. - Weight::from_parts(2_324_000, 0) - // Standard Error: 8_149 - .saturating_add(Weight::from_parts(1_098_821, 0).saturating_mul(r.into())) + // Minimum execution time: 2_281_000 picoseconds. + Weight::from_parts(2_367_000, 0) + // Standard Error: 6_750 + .saturating_add(Weight::from_parts(1_078_782, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_338_000, 0) - // Standard Error: 3_787 - .saturating_add(Weight::from_parts(561_596, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 4_413 + .saturating_add(Weight::from_parts(586_782, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_181_000 picoseconds. - Weight::from_parts(2_293_000, 0) - // Standard Error: 7_403 - .saturating_add(Weight::from_parts(1_093_703, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 9_421 + .saturating_add(Weight::from_parts(1_130_965, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_182_000 picoseconds. - Weight::from_parts(2_295_000, 0) - // Standard Error: 3_652 - .saturating_add(Weight::from_parts(563_961, 0).saturating_mul(r.into())) + // Minimum execution time: 2_344_000 picoseconds. + Weight::from_parts(2_438_000, 0) + // Standard Error: 5_975 + .saturating_add(Weight::from_parts(638_969, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 7_027 - .saturating_add(Weight::from_parts(1_052_281, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(2_356_000, 0) + // Standard Error: 8_189 + .saturating_add(Weight::from_parts(1_080_515, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 4_511 - .saturating_add(Weight::from_parts(584_911, 0).saturating_mul(r.into())) + // Minimum execution time: 2_253_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 3_500 + .saturating_add(Weight::from_parts(556_273, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_237_000 picoseconds. - Weight::from_parts(2_284_000, 0) - // Standard Error: 8_733 - .saturating_add(Weight::from_parts(1_138_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_215_000 picoseconds. + Weight::from_parts(2_333_000, 0) + // Standard Error: 7_954 + .saturating_add(Weight::from_parts(1_067_773, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_235_000 picoseconds. - Weight::from_parts(2_275_000, 0) - // Standard Error: 3_542 - .saturating_add(Weight::from_parts(541_237, 0).saturating_mul(r.into())) + // Minimum execution time: 2_183_000 picoseconds. + Weight::from_parts(2_223_000, 0) + // Standard Error: 3_658 + .saturating_add(Weight::from_parts(566_527, 0).saturating_mul(r.into())) } } diff --git a/runtime/vara/src/weights/pallet_gear_voucher.rs b/runtime/vara/src/weights/pallet_gear_voucher.rs index 0a2861d75da..9b536c8f873 100644 --- a/runtime/vara/src/weights/pallet_gear_voucher.rs +++ b/runtime/vara/src/weights/pallet_gear_voucher.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear_voucher //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -47,8 +47,8 @@ impl pallet_gear_voucher::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 28_419_000 picoseconds. - Weight::from_parts(29_106_000, 6196) + // Minimum execution time: 30_067_000 picoseconds. + Weight::from_parts(30_908_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -60,8 +60,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 28_419_000 picoseconds. - Weight::from_parts(29_106_000, 6196) + // Minimum execution time: 30_067_000 picoseconds. + Weight::from_parts(30_908_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/runtime/vara/src/weights/pallet_timestamp.rs b/runtime/vara/src/weights/pallet_timestamp.rs index 8ffb9e2c337..47a61b07806 100644 --- a/runtime/vara/src/weights/pallet_timestamp.rs +++ b/runtime/vara/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -48,8 +48,8 @@ impl pallet_timestamp::WeightInfo for SubstrateWeight pallet_timestamp::WeightInfo for SubstrateWeight pallet_utility::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_343_000 picoseconds. - Weight::from_parts(5_077_292, 0) - // Standard Error: 4_654 - .saturating_add(Weight::from_parts(4_019_596, 0).saturating_mul(c.into())) + // Minimum execution time: 5_350_000 picoseconds. + Weight::from_parts(8_163_155, 0) + // Standard Error: 2_074 + .saturating_add(Weight::from_parts(4_084_858, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_844_000 picoseconds. - Weight::from_parts(4_099_000, 0) + // Minimum execution time: 3_978_000 picoseconds. + Weight::from_parts(4_136_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_245_000 picoseconds. - Weight::from_parts(13_362_133, 0) - // Standard Error: 4_186 - .saturating_add(Weight::from_parts(4_185_912, 0).saturating_mul(c.into())) + // Minimum execution time: 5_406_000 picoseconds. + Weight::from_parts(9_180_867, 0) + // Standard Error: 2_030 + .saturating_add(Weight::from_parts(4_259_130, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_954_000 picoseconds. - Weight::from_parts(7_186_000, 0) + // Minimum execution time: 7_029_000 picoseconds. + Weight::from_parts(7_246_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_315_000 picoseconds. - Weight::from_parts(6_135_028, 0) - // Standard Error: 4_945 - .saturating_add(Weight::from_parts(4_023_158, 0).saturating_mul(c.into())) + // Minimum execution time: 5_457_000 picoseconds. + Weight::from_parts(8_377_232, 0) + // Standard Error: 2_856 + .saturating_add(Weight::from_parts(4_077_791, 0).saturating_mul(c.into())) } } @@ -100,43 +100,43 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_343_000 picoseconds. - Weight::from_parts(5_077_292, 0) - // Standard Error: 4_654 - .saturating_add(Weight::from_parts(4_019_596, 0).saturating_mul(c.into())) + // Minimum execution time: 5_350_000 picoseconds. + Weight::from_parts(8_163_155, 0) + // Standard Error: 2_074 + .saturating_add(Weight::from_parts(4_084_858, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_844_000 picoseconds. - Weight::from_parts(4_099_000, 0) + // Minimum execution time: 3_978_000 picoseconds. + Weight::from_parts(4_136_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_245_000 picoseconds. - Weight::from_parts(13_362_133, 0) - // Standard Error: 4_186 - .saturating_add(Weight::from_parts(4_185_912, 0).saturating_mul(c.into())) + // Minimum execution time: 5_406_000 picoseconds. + Weight::from_parts(9_180_867, 0) + // Standard Error: 2_030 + .saturating_add(Weight::from_parts(4_259_130, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_954_000 picoseconds. - Weight::from_parts(7_186_000, 0) + // Minimum execution time: 7_029_000 picoseconds. + Weight::from_parts(7_246_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_315_000 picoseconds. - Weight::from_parts(6_135_028, 0) - // Standard Error: 4_945 - .saturating_add(Weight::from_parts(4_023_158, 0).saturating_mul(c.into())) + // Minimum execution time: 5_457_000 picoseconds. + Weight::from_parts(8_377_232, 0) + // Standard Error: 2_856 + .saturating_add(Weight::from_parts(4_077_791, 0).saturating_mul(c.into())) } } diff --git a/utils/wasm-instrument/Cargo.toml b/utils/wasm-instrument/Cargo.toml index a66f280081a..60481ba5ed4 100644 --- a/utils/wasm-instrument/Cargo.toml +++ b/utils/wasm-instrument/Cargo.toml @@ -19,6 +19,7 @@ gear-core.workspace = true [features] default = ["std"] std = [ + "gear-backend-wasmi/std", "wasm-instrument/std", "gear-backend-wasmi/std", ] diff --git a/utils/wasm-instrument/src/lib.rs b/utils/wasm-instrument/src/lib.rs index ddb437b5f35..5bdb2dcf0f6 100644 --- a/utils/wasm-instrument/src/lib.rs +++ b/utils/wasm-instrument/src/lib.rs @@ -27,7 +27,7 @@ use wasm_instrument::{ gas_metering::{self, Rules}, parity_wasm::{ builder, - elements::{self, Instruction, ValueType}, + elements::{self, BlockType, ImportCountType, Instruction, Instructions, Local, ValueType}, }, }; @@ -41,7 +41,6 @@ pub mod rules; pub mod syscalls; pub const GLOBAL_NAME_GAS: &str = "gear_gas"; -pub const GLOBAL_NAME_ALLOWANCE: &str = "gear_allowance"; pub const GLOBAL_NAME_FLAGS: &str = "gear_flags"; /// '__gear_stack_end' export is inserted by wasm-proc or wasm-builder, @@ -57,9 +56,7 @@ pub fn inject( .import_section() .map(|section| { section.entries().iter().any(|entry| { - entry.module() == gas_module_name - && (entry.field() == SysCallName::OutOfGas.to_str() - || entry.field() == SysCallName::OutOfAllowance.to_str()) + entry.module() == gas_module_name && entry.field() == SysCallName::OutOfGas.to_str() }) }) .unwrap_or(false) @@ -70,9 +67,10 @@ pub fn inject( if module .export_section() .map(|section| { - section.entries().iter().any(|entry| { - entry.field() == GLOBAL_NAME_ALLOWANCE || entry.field() == GLOBAL_NAME_GAS - }) + section + .entries() + .iter() + .any(|entry| entry.field() == GLOBAL_NAME_GAS) }) .unwrap_or(false) { @@ -81,7 +79,7 @@ pub fn inject( let mut mbuilder = builder::from_module(module); - // fn out_of_...() -> (); + // fn out_of_gas() -> (); let import_sig = mbuilder.push_signature(builder::signature().build_sig()); mbuilder.push_import( @@ -93,25 +91,14 @@ pub fn inject( .build(), ); - mbuilder.push_import( - builder::import() - .module(gas_module_name) - .field(SysCallName::OutOfAllowance.to_str()) - .external() - .func(import_sig) - .build(), - ); - // back to plain module let module = mbuilder.build(); - let import_count = module.import_count(elements::ImportCountType::Function); - let out_of_gas_index = import_count as u32 - 2; - let out_of_allowance_index = import_count as u32 - 1; + let import_count = module.import_count(ImportCountType::Function); + let out_of_gas_index = import_count as u32 - 1; let gas_charge_index = module.functions_space(); let gas_index = module.globals_space() as u32; - let allowance_index = gas_index + 1; let mut mbuilder = builder::from_module(module); @@ -132,74 +119,39 @@ pub fn inject( .build(), ); - mbuilder.push_global( - builder::global() - .value_type() - .i64() - .init_expr(Instruction::I64Const(0)) - .mutable() - .build(), - ); - - mbuilder.push_export( - builder::export() - .field(GLOBAL_NAME_ALLOWANCE) - .internal() - .global(allowance_index) - .build(), - ); + // This const is introduced to avoid future errors in code if some other + // `I64Const` instructions appear in gas charge function body. + const GAS_CHARGE_COST_PLACEHOLDER: i64 = 1248163264128; let mut elements = vec![ - // check if there is enough gas + // I. Put global with value of current gas counter of any type. Instruction::GetGlobal(gas_index), - // total_gas_to_charge = gas_to_charge + cost_for_func - // { + // II. Calculating total gas to charge as sum of: + // - `gas_charge(..)` argument; + // - `gas_charge(..)` call cost. + // + // Setting the sum into local with index 1 with keeping it on stack. Instruction::GetLocal(0), Instruction::I64ExtendUI32, - Instruction::I64Const(i64::MAX), + Instruction::I64Const(GAS_CHARGE_COST_PLACEHOLDER), Instruction::I64Add, Instruction::TeeLocal(1), - // } - // if gas < total_gas_to_charge + // III. Validating left amount of gas. + // + // In case of requested value is bigger than actual gas counter value, + // than we call `out_of_gas()` that will terminate execution. Instruction::I64LtU, - Instruction::If(elements::BlockType::NoResult), + Instruction::If(BlockType::NoResult), Instruction::Call(out_of_gas_index), - Instruction::Unreachable, Instruction::End, - // update gas + // IV. Calculating new global value by subtraction. + // + // Result is stored back into global. Instruction::GetGlobal(gas_index), - // total_gas_to_charge - // { Instruction::GetLocal(1), - // } - // gas -= total_gas_to_charge - // { Instruction::I64Sub, Instruction::SetGlobal(gas_index), - // } - // check if there is enough gas allowance - Instruction::GetGlobal(allowance_index), - // total_gas_to_charge - // { - Instruction::GetLocal(1), - // } - // if allowance < total_gas_to_charge - Instruction::I64LtU, - Instruction::If(elements::BlockType::NoResult), - Instruction::Call(out_of_allowance_index), - Instruction::Unreachable, - Instruction::End, - // update gas allowance - Instruction::GetGlobal(allowance_index), - // total_gas_to_charge - // { - Instruction::GetLocal(1), - // } - // allowance -= total_gas_to_charge - // { - Instruction::I64Sub, - Instruction::SetGlobal(allowance_index), - // } + // V. Ending `gas_charge()` function. Instruction::End, ]; @@ -241,6 +193,7 @@ pub fn inject( let cost_local_var = rules.call_per_local_cost() as u64; let cost = cost_push_arg + cost_call + cost_local_var + cost_blocks; + // the cost is added to gas_to_charge which cannot // exceed u32::MAX value. This check ensures // there is no u64 overflow. @@ -249,12 +202,11 @@ pub fn inject( } // update cost for 'gas_charge' function itself - for instruction in elements + let cost_instr = elements .iter_mut() - .filter(|i| matches!(i, Instruction::I64Const(_))) - { - *instruction = Instruction::I64Const(cost as i64); - } + .find(|i| **i == Instruction::I64Const(GAS_CHARGE_COST_PLACEHOLDER)) + .expect("Const for cost of the fn not found"); + *cost_instr = Instruction::I64Const(cost as i64); // gas_charge function mbuilder.push_function( @@ -263,8 +215,8 @@ pub fn inject( .with_param(ValueType::I32) .build() .body() - .with_locals(vec![elements::Local::new(1, ValueType::I64)]) - .with_instructions(elements::Instructions::new(elements)) + .with_locals(vec![Local::new(1, ValueType::I64)]) + .with_instructions(Instructions::new(elements)) .build() .build(), ); @@ -272,5 +224,5 @@ pub fn inject( // back to plain module let module = mbuilder.build(); - gas_metering::post_injection_handler(module, rules, gas_charge_index, out_of_gas_index, 2) + gas_metering::post_injection_handler(module, rules, gas_charge_index, out_of_gas_index, 1) } diff --git a/utils/wasm-instrument/src/syscalls.rs b/utils/wasm-instrument/src/syscalls.rs index 1bc1e91382e..df7ffb3e966 100644 --- a/utils/wasm-instrument/src/syscalls.rs +++ b/utils/wasm-instrument/src/syscalls.rs @@ -93,7 +93,6 @@ pub enum SysCallName { Alloc, Free, OutOfGas, - OutOfAllowance, // Miscellaneous ReplyDeposit, @@ -122,7 +121,6 @@ impl SysCallName { SysCallName::GasAvailable => "gr_gas_available", SysCallName::Leave => "gr_leave", SysCallName::MessageId => "gr_message_id", - SysCallName::OutOfAllowance => "gr_out_of_allowance", SysCallName::OutOfGas => "gr_out_of_gas", SysCallName::PayProgramRent => "gr_pay_program_rent", SysCallName::ProgramId => "gr_program_id", diff --git a/utils/wasm-instrument/src/tests.rs b/utils/wasm-instrument/src/tests.rs index 4ed5a386d92..86d1cb9fd74 100644 --- a/utils/wasm-instrument/src/tests.rs +++ b/utils/wasm-instrument/src/tests.rs @@ -85,10 +85,10 @@ fn simple_grow() { let injected_module = inject(module, &ConstantCostRules::new(1, 10_000, 0), "env").unwrap(); - // two new imports (indexes 0 & 1), the original func (i = 2), so + // two new imports (index 0), the original func (i = 1), so // gas charge will occupy the next index. - let gas_charge_index = 3; - let grow_index = 4; + let gas_charge_index = 2; + let grow_index = 3; assert_eq!( get_function_body(&injected_module, 0).unwrap(), @@ -131,7 +131,7 @@ fn grow_no_gas_no_track() { let injected_module = inject(module, &ConstantCostRules::default(), "env").unwrap(); - let gas_charge_index = 3; + let gas_charge_index = 2; assert_eq!( get_function_body(&injected_module, 0).unwrap(), @@ -144,7 +144,7 @@ fn grow_no_gas_no_track() { ][..] ); - assert_eq!(injected_module.functions_space(), 4); + assert_eq!(injected_module.functions_space(), 3); let binary = serialize(injected_module).expect("serialization failed"); wasmparser::validate(&binary).unwrap(); @@ -178,7 +178,7 @@ fn duplicate_export() { (global (;0;) i32 (i32.const 42)) (memory 0 1) (global (;1;) (mut i32) (i32.const 0)) - (export "{GLOBAL_NAME_ALLOWANCE}" (global 0)) + (export "{GLOBAL_NAME_GAS}" (global 0)) )"# ); let module = parse_wat(&wat); @@ -211,7 +211,7 @@ fn call_index() { ) .unwrap(); - let empty_func_index = 2; + let empty_func_index = 1; let func_index = empty_func_index + 1; let gas_charge_index = func_index + 1; @@ -249,7 +249,7 @@ fn cost_overflow() { ) .unwrap(); - let empty_func_index = 2; + let empty_func_index = 1; let func_index = empty_func_index + 1; let gas_charge_index = func_index + 1; @@ -321,7 +321,7 @@ test_gas_counter_injection! { expected = r#" (module (func (result i32) - (call 3 (i32.const 1)) + (call 2 (i32.const 1)) (get_global 0))) "# } @@ -341,7 +341,7 @@ test_gas_counter_injection! { expected = r#" (module (func (result i32) - (call 3 (i32.const 6)) + (call 2 (i32.const 6)) (get_global 0) (block (get_global 0) @@ -370,16 +370,16 @@ test_gas_counter_injection! { expected = r#" (module (func (result i32) - (call 3 (i32.const 3)) + (call 2 (i32.const 3)) (get_global 0) (if (then - (call 3 (i32.const 3)) + (call 2 (i32.const 3)) (get_global 0) (get_global 0) (get_global 0)) (else - (call 3 (i32.const 2)) + (call 2 (i32.const 2)) (get_global 0) (get_global 0))) (get_global 0))) @@ -403,13 +403,13 @@ test_gas_counter_injection! { expected = r#" (module (func (result i32) - (call 3 (i32.const 6)) + (call 2 (i32.const 6)) (get_global 0) (block (get_global 0) (drop) (br 0) - (call 3 (i32.const 2)) + (call 2 (i32.const 2)) (get_global 0) (drop)) (get_global 0))) @@ -437,18 +437,18 @@ test_gas_counter_injection! { expected = r#" (module (func (result i32) - (call 3 (i32.const 5)) + (call 2 (i32.const 5)) (get_global 0) (block (get_global 0) (if (then - (call 3 (i32.const 4)) + (call 2 (i32.const 4)) (get_global 0) (get_global 0) (drop) (br_if 1))) - (call 3 (i32.const 2)) + (call 2 (i32.const 2)) (get_global 0) (drop)) (get_global 0))) @@ -479,18 +479,18 @@ test_gas_counter_injection! { expected = r#" (module (func (result i32) - (call 3 (i32.const 3)) + (call 2 (i32.const 3)) (get_global 0) (loop - (call 3 (i32.const 4)) + (call 2 (i32.const 4)) (get_global 0) (if (then - (call 3 (i32.const 2)) + (call 2 (i32.const 2)) (get_global 0) (br_if 0)) (else - (call 3 (i32.const 4)) + (call 2 (i32.const 4)) (get_global 0) (get_global 0) (drop) @@ -515,13 +515,13 @@ test_gas_counter_injection! { expected = r#" (module (func (result i32) - (call 3 (i32.const 2)) + (call 2 (i32.const 2)) (get_global 0) (if (then - (call 3 (i32.const 1)) + (call 2 (i32.const 1)) (return))) - (call 3 (i32.const 1)) + (call 2 (i32.const 1)) (get_global 0))) "# } @@ -544,18 +544,18 @@ test_gas_counter_injection! { expected = r#" (module (func (result i32) - (call 3 (i32.const 5)) + (call 2 (i32.const 5)) (get_global 0) (block (get_global 0) (if (then - (call 3 (i32.const 1)) + (call 2 (i32.const 1)) (br 1)) (else - (call 3 (i32.const 1)) + (call 2 (i32.const 1)) (br 0))) - (call 3 (i32.const 2)) + (call 2 (i32.const 2)) (get_global 0) (drop)) (get_global 0))) @@ -577,9 +577,9 @@ test_gas_counter_injection! { expected = r#" (module (func - (call 3 (i32.const 2)) + (call 2 (i32.const 2)) (loop - (call 3 (i32.const 1)) + (call 2 (i32.const 1)) (br 0) ) unreachable @@ -606,10 +606,10 @@ test_gas_counter_injection! { (module (func) (func - (call 4 (i32.const 3)) - (call 2) + (call 3 (i32.const 3)) + (call 1) (loop - (call 4 (i32.const 1)) + (call 3 (i32.const 1)) (br 0) ) unreachable diff --git a/utils/wasm-proc/src/main.rs b/utils/wasm-proc/src/main.rs index cd40816b637..2a536a941f1 100644 --- a/utils/wasm-proc/src/main.rs +++ b/utils/wasm-proc/src/main.rs @@ -21,7 +21,7 @@ use gear_wasm_builder::optimize::{self, OptType, Optimizer}; use parity_wasm::elements::External; use std::{collections::HashSet, fs, path::PathBuf}; -const RT_ALLOWED_IMPORTS: [&str; 62] = [ +const RT_ALLOWED_IMPORTS: [&str; 63] = [ // From `Allocator` (substrate/primitives/io/src/lib.rs) "ext_allocator_free_version_1", "ext_allocator_malloc_version_1", @@ -40,6 +40,7 @@ const RT_ALLOWED_IMPORTS: [&str; 62] = [ "ext_gear_ri_lazy_pages_status_version_1", "ext_gear_ri_write_accessed_pages_version_1", "ext_gear_ri_init_lazy_pages_version_1", + "ext_gear_ri_init_lazy_pages_version_2", "ext_gear_ri_init_lazy_pages_for_program_version_1", "ext_gear_ri_is_lazy_pages_enabled_version_1", "ext_gear_ri_mprotect_lazy_pages_version_1", From 6f7a21d3b12aacc6119de1fd71f4555e7dad0cdd Mon Sep 17 00:00:00 2001 From: Shamil <66209982+shamilsan@users.noreply.github.com> Date: Mon, 7 Aug 2023 09:57:17 +0300 Subject: [PATCH 027/165] fix(gtest): catch panic reply in RunResult (#3024) --- gtest/src/log.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/gtest/src/log.rs b/gtest/src/log.rs index e5f91babf86..66034e4146a 100644 --- a/gtest/src/log.rs +++ b/gtest/src/log.rs @@ -266,11 +266,9 @@ impl PartialEq for Log { } } - if matches!(self.reply_code, Some(c) if c.is_success()) { - if let Some(payload) = &self.payload { - if payload.inner() != other.payload.inner() { - return false; - } + if let Some(payload) = &self.payload { + if payload.inner() != other.payload.inner() { + return false; } } From 7deac8320ec08c268d487c9291d6f69fdd01f2aa Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:36:47 +0300 Subject: [PATCH 028/165] feat(core-processor): add extra fields into gwasm logs (#3012) --- core-processor/src/ext.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core-processor/src/ext.rs b/core-processor/src/ext.rs index be889902d78..607e7fa957e 100644 --- a/core-processor/src/ext.rs +++ b/core-processor/src/ext.rs @@ -763,7 +763,11 @@ impl Externalities for Ext { } fn debug(&self, data: &str) -> Result<(), Self::UnrecoverableError> { - log::debug!(target: "gwasm", "DEBUG: {}", data); + let program_id = self.program_id()?; + let message_id = self.message_id()?; + + log::debug!(target: "gwasm", "DEBUG: [handle({message_id:.2?})] {program_id:.2?}: {data}"); + Ok(()) } From 5b492a4997ba94bc68025c3ee533052e33f6a385 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:44:56 +0300 Subject: [PATCH 029/165] deps: combine dependabot's PRs (#3034) --- Cargo.lock | 110 +++++++++++++++++++--------------------- Cargo.toml | 6 +-- gsdk/api-gen/Cargo.toml | 2 +- 3 files changed, 56 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0223a2ecb38..a2ea2cce229 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -451,7 +451,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -462,7 +462,7 @@ checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -1105,7 +1105,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -1661,7 +1661,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -1678,7 +1678,7 @@ checksum = "81b2dab6991c7ab1572fea8cb049db819b1aeea1e2dac74c0869f244d9f21a7c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -1726,7 +1726,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -1748,7 +1748,7 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" dependencies = [ "darling_core 0.20.1", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -2117,7 +2117,7 @@ dependencies = [ "gear-wasm-builder", "gstd", "gtest", - "hex-literal 0.4.1", + "hex-literal", "parity-scale-codec", ] @@ -2127,7 +2127,7 @@ version = "0.1.0" dependencies = [ "gear-wasm-builder", "gstd", - "hex-literal 0.3.4", + "hex-literal", ] [[package]] @@ -2393,7 +2393,7 @@ checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -2539,7 +2539,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -2772,7 +2772,7 @@ checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -2813,7 +2813,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -2834,7 +2834,7 @@ dependencies = [ "darling 0.20.1", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -2864,9 +2864,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" dependencies = [ "errno-dragonfly", "libc", @@ -3511,7 +3511,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -3649,7 +3649,7 @@ dependencies = [ "gsdk", "gstd", "hex", - "hex-literal 0.3.4", + "hex-literal", "log", "parity-scale-codec", "rand 0.8.5", @@ -3669,7 +3669,7 @@ dependencies = [ "galloc", "gear-core-errors", "gsys", - "hex-literal 0.3.4", + "hex-literal", "parity-scale-codec", "static_assertions", ] @@ -3720,7 +3720,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -3842,7 +3842,7 @@ dependencies = [ "gear-utils", "gear-wasm-instrument", "hex", - "hex-literal 0.3.4", + "hex-literal", "log", "path-clean", "primitive-types", @@ -3860,7 +3860,7 @@ name = "gear-common-codegen" version = "0.1.0" dependencies = [ "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -4065,7 +4065,7 @@ dependencies = [ "gear-core-processor", "gear-runtime-common", "gear-runtime-primitives", - "hex-literal 0.3.4", + "hex-literal", "log", "pallet-authorship", "pallet-babe", @@ -4218,7 +4218,7 @@ dependencies = [ "gear-runtime-common", "gear-runtime-interface", "gear-runtime-primitives", - "hex-literal 0.3.4", + "hex-literal", "jsonrpsee", "log", "pallet-gear-rpc", @@ -4547,7 +4547,7 @@ dependencies = [ "proc-macro2", "quote", "scale-info", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -4609,7 +4609,7 @@ dependencies = [ "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "subxt-codegen", "subxt-metadata", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -4618,7 +4618,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -4646,7 +4646,7 @@ dependencies = [ "gstd", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", "trybuild", ] @@ -4789,12 +4789,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hex-literal" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" - [[package]] name = "hex-literal" version = "0.4.1" @@ -7303,7 +7297,7 @@ dependencies = [ "gear-common", "gear-core", "gear-wasm-instrument", - "hex-literal 0.3.4", + "hex-literal", "log", "pallet-authorship", "pallet-balances", @@ -7417,7 +7411,7 @@ version = "2.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -8136,7 +8130,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -8177,7 +8171,7 @@ checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -8835,7 +8829,7 @@ checksum = "68bf53dad9b6086826722cdc99140793afd9f62faa14a1ad07eb4f955e7a7216" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -10725,7 +10719,7 @@ checksum = "741e124f5485c7e60c03b043f79f320bff3527f4bbf12cf3831750dc46a0ec2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -10747,7 +10741,7 @@ checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -12348,7 +12342,7 @@ dependencies = [ "quote", "scale-info", "subxt-metadata", - "syn 2.0.25", + "syn 2.0.28", "thiserror", "tokio", ] @@ -12361,7 +12355,7 @@ dependencies = [ "darling 0.20.1", "proc-macro-error", "subxt-codegen", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -12389,9 +12383,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", @@ -12513,22 +12507,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35fc5b8971143ca348fa6df4f024d4d55264f3468c71ad1c2f365b0a4d58c42" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.43" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -12676,7 +12670,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -12843,7 +12837,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] @@ -13054,9 +13048,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04366e99ff743345622cd00af2af01d711dc2d1ef59250d7347698d21b546729" +checksum = "a84e0202ea606ba5ebee8507ab2bfbe89b98551ed9b8f0be198109275cff284b" dependencies = [ "basic-toml", "dissimilar", @@ -13257,7 +13251,7 @@ dependencies = [ "gear-core-processor", "gear-runtime-common", "gear-runtime-primitives", - "hex-literal 0.3.4", + "hex-literal", "log", "pallet-airdrop", "pallet-authority-discovery", @@ -13443,7 +13437,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", "wasm-bindgen-shared", ] @@ -13477,7 +13471,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -14930,7 +14924,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.28", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index c25e81c4dd8..3b118cf293b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -130,7 +130,7 @@ futures-timer = "3.0.2" futures-util = "0.3.28" hashbrown = "0.13.2" hex = { version = "0.4.3", default-features = false } -hex-literal = "0.3.4" +hex-literal = "0.4.1" jsonrpsee = { version = "^0.16" } lazy_static = "1.4.0" libc = { version = "0.2", default-features = false } @@ -171,8 +171,8 @@ static_assertions = "1" subxt = { version = "0.29.0", git = "https://github.com/gear-tech/subxt", branch = "v0.29.0" } subxt-metadata = { version = "0.29.0", git = "https://github.com/gear-tech/subxt", branch = "v0.29.0" } subxt-codegen = { version = "0.29.0", git = "https://github.com/gear-tech/subxt", branch = "v0.29.0" } -syn = "2.0.15" -thiserror = "1.0.40" +syn = "2.0.28" +thiserror = "1.0.44" tokio = { version = "1.27.0" } url = "2.3.1" wat = "1.0.69" diff --git a/gsdk/api-gen/Cargo.toml b/gsdk/api-gen/Cargo.toml index 64561bbdb5e..9cb41604efe 100644 --- a/gsdk/api-gen/Cargo.toml +++ b/gsdk/api-gen/Cargo.toml @@ -25,4 +25,4 @@ subxt-codegen.workspace = true # TODO: inherit from workspace # # use "2.0.15" because subxt-codegen-0.29.0 requires it. -syn = { version = "2.0.15", features = ["full", "parsing"] } +syn = { version = "2.0.28", features = ["full", "parsing"] } From 8bb3310b27190aee0daab3435e3143328d21b6b5 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Tue, 8 Aug 2023 03:02:34 +0300 Subject: [PATCH 030/165] refactor(wasm-gen): Introduce generators for gear entry points and sys-calls (#3022) --- utils/call-gen/src/lib.rs | 18 +- utils/call-gen/src/upload_code.rs | 15 +- utils/call-gen/src/upload_program.rs | 12 +- .../src/batch_pool/generators/batch.rs | 23 +- utils/node-loader/src/utils.rs | 28 +- utils/runtime-fuzzer/src/lib.rs | 26 +- utils/wasm-gen/src/config.rs | 7 +- utils/wasm-gen/src/config/syscalls.rs | 28 +- utils/wasm-gen/src/config/syscalls/param.rs | 47 +- utils/wasm-gen/src/generator.rs | 178 +++- utils/wasm-gen/src/generator/entry_points.rs | 250 +++++ utils/wasm-gen/src/generator/memory.rs | 19 +- utils/wasm-gen/src/generator/syscalls.rs | 77 ++ .../src/generator/syscalls/additional_data.rs | 261 +++++ .../src/generator/syscalls/imports.rs | 388 +++++++ .../src/generator/syscalls/invocator.rs | 399 ++++++++ utils/wasm-gen/src/lib.rs | 951 +----------------- utils/wasm-gen/src/memory.rs | 76 -- utils/wasm-gen/src/syscalls.rs | 83 -- utils/wasm-gen/src/tests.rs | 194 ++-- utils/wasm-gen/src/utils.rs | 199 ++-- utils/wasm-gen/src/wasm.rs | 7 +- utils/wasm-instrument/src/syscalls.rs | 2 +- 23 files changed, 1866 insertions(+), 1422 deletions(-) create mode 100644 utils/wasm-gen/src/generator/entry_points.rs create mode 100644 utils/wasm-gen/src/generator/syscalls.rs create mode 100644 utils/wasm-gen/src/generator/syscalls/additional_data.rs create mode 100644 utils/wasm-gen/src/generator/syscalls/imports.rs create mode 100644 utils/wasm-gen/src/generator/syscalls/invocator.rs delete mode 100644 utils/wasm-gen/src/memory.rs delete mode 100644 utils/wasm-gen/src/syscalls.rs diff --git a/utils/call-gen/src/lib.rs b/utils/call-gen/src/lib.rs index f57897ec4ee..6b066cd59b6 100644 --- a/utils/call-gen/src/lib.rs +++ b/utils/call-gen/src/lib.rs @@ -28,7 +28,6 @@ mod upload_program; pub use claim_value::ClaimValueArgs; pub use create_program::CreateProgramArgs; -use gear_core::ids::ProgramId; pub use rand_utils::{CallGenRng, CallGenRngCore}; pub use send_message::SendMessageArgs; pub use send_reply::SendReplyArgs; @@ -40,7 +39,7 @@ pub use upload_program::UploadProgramArgs; pub struct GearCallConversionError(pub &'static str); pub type Seed = u64; -pub type GearProgGenConfig = gear_wasm_gen::ConfigsBundle; +pub type GearWasmGenConfigsBundle = gear_wasm_gen::ConfigsBundle; /// This trait must be implemented for all argument types /// that are defined in [`GearCall`] variants. @@ -149,11 +148,9 @@ macro_rules! impl_named_call_args { /// can be used for send-calls. pub fn generate_gear_program( seed: Seed, - config: GearProgGenConfig, - programs: Vec, + config: GearWasmGenConfigsBundle, ) -> Vec { use arbitrary::Unstructured; - use gear_wasm_gen::gsys; let mut rng = Rng::seed_from_u64(seed); @@ -162,13 +159,6 @@ pub fn generate_gear_program( let mut u = Unstructured::new(&buf); - let addresses = programs - .iter() - .map(|pid| gsys::HashWithValue { - hash: pid.into_bytes(), - value: 0, - }) - .collect::>(); - - gear_wasm_gen::gen_gear_program_code(&mut u, config, &addresses) + gear_wasm_gen::generate_gear_program_code(&mut u, config) + .expect("failed generating gear program") } diff --git a/utils/call-gen/src/upload_code.rs b/utils/call-gen/src/upload_code.rs index 3cdfaaf84c3..35f52937fb9 100644 --- a/utils/call-gen/src/upload_code.rs +++ b/utils/call-gen/src/upload_code.rs @@ -19,9 +19,9 @@ //! Upload code args generator. use crate::{ - impl_convert_traits, CallGenRng, GearProgGenConfig, GeneratableCallArgs, NamedCallArgs, Seed, + impl_convert_traits, CallGenRng, GearWasmGenConfigsBundle, GeneratableCallArgs, NamedCallArgs, + Seed, }; -use gear_core::ids::ProgramId; /// Upload code args /// @@ -32,15 +32,12 @@ pub struct UploadCodeArgs(pub Vec); impl_convert_traits!(UploadCodeArgs, Vec, UploadCode, "upload_code"); impl GeneratableCallArgs for UploadCodeArgs { - type FuzzerArgs = (Vec, Seed); - type ConstArgs = (GearProgGenConfig,); + type FuzzerArgs = Seed; + type ConstArgs = (GearWasmGenConfigsBundle,); /// Generates `pallet_gear::Pallet::::upload_code` call arguments. - fn generate( - (existing_programs, code_seed): Self::FuzzerArgs, - (config,): Self::ConstArgs, - ) -> Self { - let code = crate::generate_gear_program::(code_seed, config, existing_programs); + fn generate(code_seed: Self::FuzzerArgs, (config,): Self::ConstArgs) -> Self { + let code = crate::generate_gear_program::(code_seed, config); let name = Self::name(); log::debug!("Generated `{name}` with code from seed = {code_seed}"); diff --git a/utils/call-gen/src/upload_program.rs b/utils/call-gen/src/upload_program.rs index 315e1343b17..3b9355b2364 100644 --- a/utils/call-gen/src/upload_program.rs +++ b/utils/call-gen/src/upload_program.rs @@ -19,9 +19,9 @@ //! Upload program args generator. use crate::{ - impl_convert_traits, CallGenRng, GearProgGenConfig, GeneratableCallArgs, NamedCallArgs, Seed, + impl_convert_traits, CallGenRng, GearWasmGenConfigsBundle, GeneratableCallArgs, NamedCallArgs, + Seed, }; -use gear_core::ids::ProgramId; // code, salt, payload, gas, value type UploadProgramArgsInner = (Vec, Vec, Vec, u64, u128); @@ -40,17 +40,17 @@ impl_convert_traits!( ); impl GeneratableCallArgs for UploadProgramArgs { - type FuzzerArgs = (Vec, Seed, Seed); - type ConstArgs = (u64, GearProgGenConfig); + type FuzzerArgs = (Seed, Seed); + type ConstArgs = (u64, GearWasmGenConfigsBundle); /// Generates `pallet_gear::Pallet::::upload_program` call arguments. fn generate( - (existing_programs, code_seed, rng_seed): Self::FuzzerArgs, + (code_seed, rng_seed): Self::FuzzerArgs, (gas_limit, config): Self::ConstArgs, ) -> Self { let mut rng = Rng::seed_from_u64(rng_seed); - let code = crate::generate_gear_program::(code_seed, config, existing_programs); + let code = crate::generate_gear_program::(code_seed, config); let mut salt = vec![0; rng.gen_range(1..=100)]; rng.fill_bytes(&mut salt); diff --git a/utils/node-loader/src/batch_pool/generators/batch.rs b/utils/node-loader/src/batch_pool/generators/batch.rs index 2a57dacebfa..f5cc4154806 100644 --- a/utils/node-loader/src/batch_pool/generators/batch.rs +++ b/utils/node-loader/src/batch_pool/generators/batch.rs @@ -11,7 +11,6 @@ use gear_call_gen::{ SendReplyArgs, UploadCodeArgs, UploadProgramArgs, }; use gear_utils::NonEmpty; -use gear_wasm_gen::ConfigsBundle; use std::iter; use tracing::instrument; @@ -33,7 +32,6 @@ impl RuntimeSettings { pub struct BatchGenerator { pub batch_gen_rng: Rng, pub batch_size: usize, - prog_gen_config: ConfigsBundle, code_seed_gen: Box, rt_settings: RuntimeSettings, } @@ -121,7 +119,6 @@ impl BatchGenerator { Self { batch_gen_rng, batch_size, - prog_gen_config: utils::get_config_with_seed_log(seed), code_seed_gen: seed::some_generator::(code_seed_type), rt_settings, } @@ -146,27 +143,23 @@ impl BatchGenerator { ) -> Batch { match batch_id { 0 => { - let existing_programs = context.programs.iter().copied().collect::>(); + let config = + utils::get_config_with_seed_log(seed, context.programs.iter().copied()); Self::gen_batch::( self.batch_size, seed, - |rng| { - ( - existing_programs.clone(), - self.code_seed_gen.next_u64(), - rng.next_u64(), - ) - }, - || (rt_settings.gas_limit, self.prog_gen_config.clone()), + |rng| (self.code_seed_gen.next_u64(), rng.next_u64()), + || (rt_settings.gas_limit, config.clone()), ) } 1 => { - let existing_programs = context.programs.iter().copied().collect::>(); + let config = + utils::get_config_with_seed_log(seed, context.programs.iter().copied()); Self::gen_batch::( self.batch_size, seed, - |_| (existing_programs.clone(), self.code_seed_gen.next_u64()), - || (self.prog_gen_config.clone(),), + |_| self.code_seed_gen.next_u64(), + || (config.clone(),), ) } 2 => match NonEmpty::from_vec(context.programs.iter().copied().collect()) { diff --git a/utils/node-loader/src/utils.rs b/utils/node-loader/src/utils.rs index 046b815644f..bd2d32b1ee2 100644 --- a/utils/node-loader/src/utils.rs +++ b/utils/node-loader/src/utils.rs @@ -5,6 +5,7 @@ use gclient::{Event, GearApi, GearEvent, WSAddress}; use gear_call_gen::Seed; use gear_core::ids::{MessageId, ProgramId}; use gear_core_errors::ReplyCode; +use gear_utils::NonEmpty; use gear_wasm_gen::{ ConfigsBundle, EntryPointsSet, GearWasmGeneratorConfigBuilder, SysCallsConfigBuilder, }; @@ -36,11 +37,7 @@ pub const WAITING_TX_FINALIZED_TIMEOUT_ERR_STR: &str = "Transaction finalization wait timeout is reached"; pub fn dump_with_seed(seed: u64) -> Result<()> { - let code = gear_call_gen::generate_gear_program::( - seed, - ConfigsBundle::default(), - Default::default(), - ); + let code = gear_call_gen::generate_gear_program::(seed, ConfigsBundle::default()); let mut file = File::create("out.wasm")?; file.write_all(&code)?; @@ -207,15 +204,24 @@ pub fn err_waited_or_succeed_batch( } /// Returns configs bundle with a gear wasm generator config, which logs `seed`. -pub fn get_config_with_seed_log(seed: Seed) -> ConfigsBundle { +pub fn get_config_with_seed_log( + seed: Seed, + existing_programs: impl Iterator, +) -> ConfigsBundle { + let sys_calls_config_builder = SysCallsConfigBuilder::new(Default::default()) + .with_log_info(format!("Gear program seed = '{seed}'")); + let sys_calls_config = if let Some(existing_programs) = NonEmpty::collect(existing_programs) { + sys_calls_config_builder + .with_data_offset_msg_dest(existing_programs) + .build() + } else { + sys_calls_config_builder.with_source_msg_dest().build() + }; + ConfigsBundle { gear_wasm_generator_config: GearWasmGeneratorConfigBuilder::new() .with_entry_points_config(EntryPointsSet::InitHandleHandleReply) - .with_sys_calls_config( - SysCallsConfigBuilder::new(Default::default()) - .with_log_info(format!("Gear program seed = '{seed}'")) - .build(), - ) + .with_sys_calls_config(sys_calls_config) .build(), ..Default::default() } diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index 44a69862ddd..ab67b11db2d 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -90,9 +90,8 @@ pub fn run(seed: u64) { } fn generate_gear_call(seed: u64, context: &ContextMutex) -> GearCall { - let config = fuzzer_config(seed); + let config = fuzzer_config(seed, context.lock().programs.clone()); let mut rand = Rng::seed_from_u64(seed); - let programs = context.lock().programs.clone(); // Use (0..G)^3 / G^2 to produce more values closer to default_gas_limit. let default_gas_limit = default_gas_limit(); @@ -100,7 +99,7 @@ fn generate_gear_call(seed: u64, context: &ContextMutex) -> Gea match rand.gen_range(0..=1) { 0 => UploadProgramArgs::generate::( - (programs, rand.next_u64(), rand.next_u64()), + (rand.next_u64(), rand.next_u64()), (gas_limit, config), ) .into(), @@ -110,7 +109,7 @@ fn generate_gear_call(seed: u64, context: &ContextMutex) -> Gea .into() } None => UploadProgramArgs::generate::( - (programs, rand.next_u64(), rand.next_u64()), + (rand.next_u64(), rand.next_u64()), (gas_limit, config), ) .into(), @@ -119,16 +118,23 @@ fn generate_gear_call(seed: u64, context: &ContextMutex) -> Gea } } -fn fuzzer_config(seed: u64) -> ConfigsBundle { +fn fuzzer_config(seed: u64, programs: Vec) -> ConfigsBundle { + let sys_calls_config_builder = SysCallsConfigBuilder::new(Default::default()) + .with_log_info(format!("Gear program seed = '{seed}'")); + let sys_calls_config = if let Some(programs) = NonEmpty::from_vec(programs) { + sys_calls_config_builder + .with_data_offset_msg_dest(programs) + .build() + } else { + sys_calls_config_builder.with_source_msg_dest().build() + }; + let generator_config = GearWasmGeneratorConfigBuilder::new() .with_entry_points_config(EntryPointsSet::InitHandleHandleReply) - .with_sys_calls_config( - SysCallsConfigBuilder::new(Default::default()) - .with_log_info(format!("Gear program seed = '{seed}'")) - .build(), - ) + .with_sys_calls_config(sys_calls_config) .with_recursions_removed(true) .build(); + let selectables_config = SelectableParams { call_indirect_enabled: false, }; diff --git a/utils/wasm-gen/src/config.rs b/utils/wasm-gen/src/config.rs index 936e7abf070..38af4bcb31c 100644 --- a/utils/wasm-gen/src/config.rs +++ b/utils/wasm-gen/src/config.rs @@ -41,7 +41,6 @@ //! }; //! let entry_points_set = EntryPointsSet::InitHandle; //! let sys_calls_config = SysCallsConfigBuilder::new(SysCallsInjectionAmounts::all_once()) -//! .with_unchecked_memory_access(true) //! .with_source_msg_dest() //! .with_log_info("I'm from wasm-gen".into()) //! .build(); @@ -71,9 +70,9 @@ //! } //! ``` -pub mod generator; -pub mod module; -pub mod syscalls; +mod generator; +mod module; +mod syscalls; pub use generator::*; pub use module::*; diff --git a/utils/wasm-gen/src/config/syscalls.rs b/utils/wasm-gen/src/config/syscalls.rs index 87ba58c7612..d79b95480f0 100644 --- a/utils/wasm-gen/src/config/syscalls.rs +++ b/utils/wasm-gen/src/config/syscalls.rs @@ -24,7 +24,7 @@ mod param; use gear_utils::NonEmpty; use gear_wasm_instrument::syscalls::SysCallName; -use gsys::HashWithValue; +use gsys::{Hash, HashWithValue}; use std::ops::RangeInclusive; pub use amount::*; @@ -38,23 +38,12 @@ impl SysCallsConfigBuilder { pub fn new(injection_amounts: SysCallsInjectionAmounts) -> Self { Self(SysCallsConfig { injection_amounts, - random_mem_access: false, params_config: SysCallsParamsConfig::default(), sending_message_destination: MessageDestination::default(), log_info: None, }) } - /// Define whether memory access is performed to random pointers. - /// - /// # Note: - /// To be removed in next refactoring iterations. - pub fn with_unchecked_memory_access(mut self, flag: bool) -> Self { - self.0.random_mem_access = flag; - - self - } - /// Set config for sys-calls params. pub fn with_params_config(mut self, params_config: SysCallsParamsConfig) -> Self { self.0.params_config = params_config; @@ -72,7 +61,12 @@ impl SysCallsConfigBuilder { /// Set whether `gr_send*` sys-calls must use some address from `addresses` collection /// as a message destination. - pub fn with_data_offset_msg_dest(mut self, addresses: NonEmpty) -> Self { + pub fn with_data_offset_msg_dest>(mut self, addresses: NonEmpty) -> Self { + let addresses = NonEmpty::collect(addresses.into_iter().map(|pid| HashWithValue { + hash: pid.into(), + value: 0, + })) + .expect("collected from non empty"); self.0.sending_message_destination = MessageDestination::ExistingAddresses(addresses); self @@ -108,9 +102,6 @@ impl SysCallsConfigBuilder { /// United config for all entities in sys-calls generator module. #[derive(Debug, Clone, Default)] pub struct SysCallsConfig { - // # Note: - // To be removed in next refactoring iterations - random_mem_access: bool, injection_amounts: SysCallsInjectionAmounts, params_config: SysCallsParamsConfig, sending_message_destination: MessageDestination, @@ -118,11 +109,6 @@ pub struct SysCallsConfig { } impl SysCallsConfig { - /// Get flag whether memory access should be to same random pointer or with random value. - pub fn random_mem_access(&self) -> bool { - self.random_mem_access - } - /// Get possible number of times (range) the sys-call can be injected in the wasm. pub fn injection_amounts(&self, name: SysCallName) -> RangeInclusive { self.injection_amounts.get(name) diff --git a/utils/wasm-gen/src/config/syscalls/param.rs b/utils/wasm-gen/src/config/syscalls/param.rs index b20c78721af..74b9981eace 100644 --- a/utils/wasm-gen/src/config/syscalls/param.rs +++ b/utils/wasm-gen/src/config/syscalls/param.rs @@ -21,54 +21,9 @@ //! Types here are used to create [`crate::SysCallsConfig`]. use arbitrary::{Result, Unstructured}; -use gear_wasm_instrument::{parity_wasm::elements::ValueType, syscalls::ParamType}; +use gear_wasm_instrument::syscalls::ParamType; use std::{collections::HashMap, ops::RangeInclusive}; -#[derive(Debug)] -pub(crate) enum ProcessedSysCallParams { - Alloc, - Value { - value_type: ValueType, - allowed_values: Option, - }, - MemoryArray, - MemoryPtrValue, -} - -pub(crate) fn process_sys_call_params( - params: &[ParamType], - params_config: &SysCallsParamsConfig, -) -> Vec { - let mut res = Vec::with_capacity(params.len()); - let mut skip_next_param = false; - for ¶m in params { - if skip_next_param { - skip_next_param = false; - continue; - } - let processed_param = match param { - ParamType::Alloc => ProcessedSysCallParams::Alloc, - ParamType::Ptr(maybe_idx) => maybe_idx - .map(|_| { - // skipping next as we don't need the following `Size` param, - // because it will be chosen in accordance to the wasm module - // memory pages config. - skip_next_param = true; - ProcessedSysCallParams::MemoryArray - }) - .unwrap_or(ProcessedSysCallParams::MemoryPtrValue), - _ => ProcessedSysCallParams::Value { - value_type: param.into(), - allowed_values: params_config.get_rule(¶m), - }, - }; - - res.push(processed_param); - } - - res -} - /// Sys-calls params config. /// /// This is basically a map, which creates a relationship between each kind of diff --git a/utils/wasm-gen/src/generator.rs b/utils/wasm-gen/src/generator.rs index a3dcda93c1a..17089fc2c28 100644 --- a/utils/wasm-gen/src/generator.rs +++ b/utils/wasm-gen/src/generator.rs @@ -17,14 +17,77 @@ // along with this program. If not, see . //! Generators entities used to generate a valid gear wasm module. +//! +//! Generally, all generators have same work-patterns: +//! 1. Every generator has a disabled version of itself. +//! 2. Almost all disabled generators can be converted to [`ModuleWithCallIndexes`], from which the wasm module can be retrieved. +//! 3. Every generator has a "main" function, after finishing which a transition to another generator is available (either directly or through disabled +//! version of the generator). +//! 4. Almost all are instantiated from the disabled generator worked on the previous generation step (see [`GearWasmGenerator::generate`]). This is how +//! generator form a state-machine. +//! +//! Transitions paths: +//! ```text +//! # Zero generators nesting level +//! GearWasmGenerator--->DisabledGearWasmGenerator--->ModuleWithCallIndexes--->WasmModule +//! +//! # First generators nesting level +//! GearWasmGenerator--->MemoryGenerator--->DisabledMemoryGenerator--->ModuleWithCallIndexes--->WasmModule +//! GearWasmGenerator--->EntryPointsGenerator--->DisabledEntryPointsGenerator--->ModuleWithCallIndexes--->WasmModule +//! +//! # Second generators nesting level +//! GearWasmGenerator--->MemoryGenerator--(DisabledMemoryGenerator, FrozenGearWasmGenerator)---\ +//! |--->GearWasmGenerator--->EntryPointsGenerator--->DisabledEntryPointsGenerator--->ModuleWithCallIndexes---> +//! +//! GearWasmGenerator--->EntryPointsGenerator--(DisabledEntryPointsGenerator, FrozenGearWasmGenerator)---\ +//! |--->GearWasmGenerator--->MemoryGenerator--->DisabledMemoryGenerator--->ModuleWithCallIndexes--->WasmModule +//! +//! # Third generators nesting level +//! GearWasmGenerator--->MemoryGenerator--(DisabledMemoryGenerator, FrozenGearWasmGenerator)---\ +//! |--->GearWasmGenerator--->EntryPointsGenerator--->DisabledEntryPointsGenerator--(MemoryImportGenerationProof, GearEntryPointGenerationProof)-->(syscalls-module-state-machine) +//! +//! GearWasmGenerator--->EntryPointsGenerator--(DisabledEntryPointsGenerator, FrozenGearWasmGenerator)---\ +//! |--->GearWasmGenerator--->MemoryGenerator--->DisabledMemoryGenerator--(MemoryImportGenerationProof, GearEntryPointGenerationProof)-->(syscalls-module-state-machine) +//! ``` +//! +//! State machine named `(syscalls-module-state-machine)` can be started only with having proof of work from `MemoryGenerator` and `EntryPointsGenerator`. +//! For more info about this state machine read docs of the [`syscalls`] mod. -use crate::{GearWasmGeneratorConfig, WasmModule}; +use crate::{utils, GearWasmGeneratorConfig, WasmModule}; use arbitrary::{Result, Unstructured}; use gear_wasm_instrument::parity_wasm::elements::Module; +mod entry_points; mod memory; +pub mod syscalls; +pub use entry_points::*; pub use memory::*; +pub use syscalls::*; + +/// Module and it's call indexes carrier. +/// +/// # Rationale: +/// Some of generators can be instantiated from "scratch", by just calling +/// "new" (or other instantiator function), which accepts params, that are +/// essential for the generator. `WasmModule` and `CallIndexes` have an implicit +/// relationship: newly added imports and functions can be included to the wasm, +/// but not in the call indexes (if we forgot to do that). Although, adding call indexes +/// is controlled in the generator, some other generator can be instantiated with wasm +/// module and call indexes being unrelated to each other. So this carrier is used to +/// control wasm module and call indexes value flow, so related values will always +/// be delivered together. +pub struct ModuleWithCallIndexes { + module: WasmModule, + call_indexes: CallIndexes, +} + +impl ModuleWithCallIndexes { + /// Convert into inner wasm module + pub fn into_wasm_module(self) -> WasmModule { + self.module + } +} /// General gear wasm generator, which works as a mediator /// controlling relations between various available in the @@ -33,6 +96,7 @@ pub struct GearWasmGenerator<'a> { unstructured: &'a mut Unstructured<'a>, module: WasmModule, config: GearWasmGeneratorConfig, + call_indexes: CallIndexes, } impl<'a> GearWasmGenerator<'a> { @@ -47,21 +111,36 @@ impl<'a> GearWasmGenerator<'a> { unstructured: &'a mut Unstructured<'a>, config: GearWasmGeneratorConfig, ) -> Self { + let call_indexes = CallIndexes::new(&module); + Self { unstructured, module, config, + call_indexes, } } /// Run all generators, while mediating between them. pub fn generate(self) -> Result { - let (disabled_mem_gen, frozen_gear_wasm_gen, _mem_imports_gen_proof) = + let (disabled_mem_gen, frozen_gear_wasm_gen, mem_imports_gen_proof) = self.generate_memory_export(); + let (disabled_ep_gen, frozen_gear_wasm_gen, ep_gen_proof) = + Self::from((disabled_mem_gen, frozen_gear_wasm_gen)).generate_entry_points()?; + let (disabled_syscalls_invocator, frozen_gear_wasm_gen) = + Self::from((disabled_ep_gen, frozen_gear_wasm_gen)) + .generate_sys_calls(mem_imports_gen_proof, ep_gen_proof)?; - Ok(Self::from((disabled_mem_gen, frozen_gear_wasm_gen)) - .module - .into_inner()) + let config = frozen_gear_wasm_gen.melt(); + let module = ModuleWithCallIndexes::from(disabled_syscalls_invocator) + .into_wasm_module() + .into_inner(); + + Ok(if config.remove_recursions { + utils::remove_recursion(module) + } else { + module + }) } /// Generate memory export using memory generator. @@ -79,12 +158,100 @@ impl<'a> GearWasmGenerator<'a> { (disabled_mem_gen, frozen_gear_wasm_gen, mem_import_gen_proof) } + /// Generate gear wasm gentry points using entry points generator. + pub fn generate_entry_points( + self, + ) -> Result<( + DisabledEntryPointsGenerator<'a>, + FrozenGearWasmGenerator<'a>, + GearEntryPointGenerationProof, + )> { + let (ep_gen, frozen_gear_wasm_gen): (EntryPointsGenerator, FrozenGearWasmGenerator) = + self.into(); + let (disabled_ep_gen, ep_gen_proof) = ep_gen.generate_entry_points()?; + + Ok((disabled_ep_gen, frozen_gear_wasm_gen, ep_gen_proof)) + } + + /// Generate sys-calls using sys-calls module generators. + pub fn generate_sys_calls( + self, + mem_import_gen_proof: MemoryImportGenerationProof, + ep_gen_proof: GearEntryPointGenerationProof, + ) -> Result<(DisabledSysCallsInvocator, FrozenGearWasmGenerator<'a>)> { + let sys_calls_imports_gen_instantiator = + SysCallsImportsGeneratorInstantiator::from((self, mem_import_gen_proof, ep_gen_proof)); + let (sys_calls_imports_gen, frozen_gear_wasm_gen) = + sys_calls_imports_gen_instantiator.into(); + let sys_calls_imports_gen_res = sys_calls_imports_gen.generate()?; + + let ad_injector = AdditionalDataInjector::from(sys_calls_imports_gen_res); + let data_injection_res = ad_injector.inject(); + + let sys_calls_invocator = SysCallsInvocator::from(data_injection_res); + let disabled_sys_calls_invocator = sys_calls_invocator.insert_invokes()?; + + Ok((disabled_sys_calls_invocator, frozen_gear_wasm_gen)) + } + /// Disable current generator. pub fn disable(self) -> DisabledGearWasmGenerator { DisabledGearWasmGenerator(self.module) } } +/// Index in call indexes collection. +type CallIndexesHandle = usize; + +/// Type used to manage (mainly, add and resolve) indexes +/// of the wasm module calls, which are, mostly, import functions +/// and internal functions. +struct CallIndexes { + inner: Vec, +} + +impl CallIndexes { + fn new(module: &WasmModule) -> Self { + let import_funcs = module.count_import_funcs(); + let code_funcs = module.count_code_funcs(); + let mut inner = Vec::with_capacity(import_funcs + code_funcs); + for i in 0..import_funcs { + inner.push(FunctionIndex::Import(i as u32)); + } + for i in 0..code_funcs { + inner.push(FunctionIndex::Func(i as u32)); + } + + Self { inner } + } + + pub(crate) fn get(&self, handle_idx: CallIndexesHandle) -> Option { + self.inner.get(handle_idx).copied() + } + + fn len(&self) -> usize { + self.inner.len() + } + + fn add_func(&mut self, func_idx: usize) { + self.inner.push(FunctionIndex::Func(func_idx as u32)); + } + + fn add_import(&mut self, import_idx: usize) { + self.inner.push(FunctionIndex::Import(import_idx as u32)); + } +} + +/// Index of the function/call in the wasm module. +/// +/// Enum variants give information on the type of the function: +/// it's an import or internal function. +#[derive(Debug, Clone, Copy)] +enum FunctionIndex { + Import(u32), + Func(u32), +} + /// Frozen gear wasm generator. /// /// Instantce of this generator signals, that some gear wasm generator @@ -93,6 +260,7 @@ impl<'a> GearWasmGenerator<'a> { /// to the gear wasm generator. So it mainly controls state machine flow. pub struct FrozenGearWasmGenerator<'a> { config: GearWasmGeneratorConfig, + call_indexes: Option, unstructured: Option<&'a mut Unstructured<'a>>, } diff --git a/utils/wasm-gen/src/generator/entry_points.rs b/utils/wasm-gen/src/generator/entry_points.rs new file mode 100644 index 00000000000..9b792226382 --- /dev/null +++ b/utils/wasm-gen/src/generator/entry_points.rs @@ -0,0 +1,250 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Gear wasm entry points generator module. + +use crate::{ + generator::{CallIndexes, FrozenGearWasmGenerator, GearWasmGenerator, ModuleWithCallIndexes}, + EntryPointsSet, WasmModule, +}; +use arbitrary::{Result, Unstructured}; +use gear_wasm_instrument::parity_wasm::{ + builder, + elements::{FunctionType, Instruction, Instructions, Type, ValueType}, +}; + +/// Gear wasm entry points generator. +/// +/// Inserts gear wasm required export functions depending on the config. +pub struct EntryPointsGenerator<'a> { + unstructured: &'a mut Unstructured<'a>, + module: WasmModule, + config: EntryPointsSet, + call_indexes: CallIndexes, +} + +impl<'a> From> for (EntryPointsGenerator<'a>, FrozenGearWasmGenerator<'a>) { + fn from(generator: GearWasmGenerator<'a>) -> Self { + let ep_generator = EntryPointsGenerator { + unstructured: generator.unstructured, + module: generator.module, + config: generator.config.entry_points_config, + call_indexes: generator.call_indexes, + }; + let frozen = FrozenGearWasmGenerator { + config: generator.config, + call_indexes: None, + unstructured: None, + }; + + (ep_generator, frozen) + } +} + +impl<'a> EntryPointsGenerator<'a> { + /// Instantiate a new gear wasm entry points generator. + pub fn new( + module_with_indexes: ModuleWithCallIndexes, + config: EntryPointsSet, + unstructured: &'a mut Unstructured<'a>, + ) -> Self { + let ModuleWithCallIndexes { + module, + call_indexes, + } = module_with_indexes; + + Self { + unstructured, + module, + config, + call_indexes, + } + } + + /// Disable current generator. + pub fn disable(self) -> DisabledEntryPointsGenerator<'a> { + DisabledEntryPointsGenerator { + unstructured: self.unstructured, + module: self.module, + call_indexes: self.call_indexes, + } + } + + /// Generates gear wasm entry points from the config, used to instantiate the generator. + /// + /// Returns disabled entry points generator and a proof that all entry points from config were generated. + pub fn generate_entry_points( + mut self, + ) -> Result<( + DisabledEntryPointsGenerator<'a>, + GearEntryPointGenerationProof, + )> { + if self.config.has_init() { + self.generate_export("init")?; + } + + if self.config.has_handle() { + self.generate_export("handle")?; + } + + if self.config.has_handle_reply() { + self.generate_export("handle_reply")?; + } + + let disabled = DisabledEntryPointsGenerator { + unstructured: self.unstructured, + module: self.module, + call_indexes: self.call_indexes, + }; + + Ok((disabled, GearEntryPointGenerationProof(()))) + } + + /// Generates an export function with a `name`. + /// + /// Actually generating a new export function doesn't mean generating it's body + /// from scratch. This function chooses random internal function and calls it + /// from the body of the newly generated export. + /// + /// # Note: + /// 1. The method is intended to generate just exports, not only gear entry points. + /// 2. If the generator was used to generate some export with a custom name (not gear entry point) + /// and then disabled, that export index can be retrieved from [`DisabledEntryPointsGenerator`], by + /// accessing the underlying `parity_wasm::module::Module` and iterating over it's export section. + pub fn generate_export(&mut self, name: &str) -> Result { + let last_func_idx = self.module.count_code_funcs() - 1; + let export_body_call_idx = self.unstructured.int_in_range(0..=last_func_idx)?; + + // New export func index is the last from function section. + let export_idx = last_func_idx + 1; + + // Get export body call signature + let export_body_call_func_type = self.module.with(|module| { + let func_type_ref = module + .function_section() + .expect("has at least one function by config") + .entries() + .get(export_body_call_idx) + .expect("call index is received from module") + .type_ref(); + + let Type::Function(func_type) = module + .type_section() + .expect("") + .types() + .get(func_type_ref as usize) + .cloned() + .expect("func exists, so type does"); + + (module, func_type) + }); + + let export_body_instructions = + self.generate_export_body(export_body_call_idx, export_body_call_func_type)?; + self.module.with(|module| { + let module = builder::from_module(module) + .function() + .body() + .with_instructions(Instructions::new(export_body_instructions)) + .build() + .signature() + .build() + .build() + .export() + .field(name) + .internal() + .func(export_idx as u32) + .build() + .build(); + + (module, ()) + }); + + self.call_indexes.add_func(export_idx); + + Ok(GearEntryPointGenerationProof(())) + } + + /// Generates body of the export function. + fn generate_export_body( + &mut self, + export_body_call_idx: usize, + export_body_call_func_type: FunctionType, + ) -> Result> { + let params = export_body_call_func_type.params(); + let results = export_body_call_func_type.results(); + // +2 for End and Call instructions. + let mut res = Vec::with_capacity(params.len() + results.len() + 2); + for param in params { + let instr = match param { + ValueType::I32 => Instruction::I32Const(self.unstructured.arbitrary()?), + ValueType::I64 => Instruction::I64Const(self.unstructured.arbitrary()?), + _ => panic!("EntryPointsGenerator::get_call_instruction: can't handle f32/f64"), + }; + res.push(instr); + } + res.push(Instruction::Call(export_body_call_idx as u32)); + res.extend(results.iter().map(|_| Instruction::Drop)); + res.push(Instruction::End); + + Ok(res) + } +} + +/// Proof that there was an instance of entry points generator and `EntryPointsGenerator::generate_export_entry_point` was called. +pub struct GearEntryPointGenerationProof(()); + +/// Disabled gear wasm entry points generator. +/// +/// Instance of this types signals that there was once active gear wasm +/// entry points generator, but it ended up it's work. +pub struct DisabledEntryPointsGenerator<'a> { + unstructured: &'a mut Unstructured<'a>, + module: WasmModule, + call_indexes: CallIndexes, +} + +impl<'a> From> for ModuleWithCallIndexes { + fn from(ep_gen: DisabledEntryPointsGenerator<'a>) -> Self { + ModuleWithCallIndexes { + module: ep_gen.module, + call_indexes: ep_gen.call_indexes, + } + } +} + +impl<'a> + From<( + DisabledEntryPointsGenerator<'a>, + FrozenGearWasmGenerator<'a>, + )> for GearWasmGenerator<'a> +{ + fn from( + (disabled_ep_gen, frozen_gear_wasm_gen): ( + DisabledEntryPointsGenerator<'a>, + FrozenGearWasmGenerator<'a>, + ), + ) -> Self { + GearWasmGenerator { + unstructured: disabled_ep_gen.unstructured, + module: disabled_ep_gen.module, + config: frozen_gear_wasm_gen.config, + call_indexes: disabled_ep_gen.call_indexes, + } + } +} diff --git a/utils/wasm-gen/src/generator/memory.rs b/utils/wasm-gen/src/generator/memory.rs index 0fa241406f0..41af193f330 100644 --- a/utils/wasm-gen/src/generator/memory.rs +++ b/utils/wasm-gen/src/generator/memory.rs @@ -19,7 +19,7 @@ //! Memory import generator module. use crate::{ - generator::{FrozenGearWasmGenerator, GearWasmGenerator}, + generator::{CallIndexes, FrozenGearWasmGenerator, GearWasmGenerator, ModuleWithCallIndexes}, MemoryPagesConfig, WasmModule, }; use gear_wasm_instrument::{ @@ -49,6 +49,7 @@ impl<'a> From> for (MemoryGenerator, FrozenGearWasmGenerat let frozen = FrozenGearWasmGenerator { config: generator.config, unstructured: Some(generator.unstructured), + call_indexes: Some(generator.call_indexes), }; (mem_generator, frozen) @@ -157,7 +158,18 @@ pub struct MemoryImportGenerationProof(()); /// /// Instance of this types signals that there was once active memory generator, /// but it ended up it's work. -pub struct DisabledMemoryGenerator(pub WasmModule); +pub struct DisabledMemoryGenerator(WasmModule); + +impl From for ModuleWithCallIndexes { + fn from(DisabledMemoryGenerator(module): DisabledMemoryGenerator) -> Self { + let call_indexes = CallIndexes::new(&module); + + ModuleWithCallIndexes { + module, + call_indexes, + } + } +} impl<'a> From<(DisabledMemoryGenerator, FrozenGearWasmGenerator<'a>)> for GearWasmGenerator<'a> { fn from( @@ -172,6 +184,9 @@ impl<'a> From<(DisabledMemoryGenerator, FrozenGearWasmGenerator<'a>)> for GearWa unstructured: frozen_gear_wasm_gen .unstructured .expect("internal error: counterfeit frozen gear wasm gen is used"), + call_indexes: frozen_gear_wasm_gen + .call_indexes + .expect("internal error: counterfeit frozen gear wasm gen is used"), } } } diff --git a/utils/wasm-gen/src/generator/syscalls.rs b/utils/wasm-gen/src/generator/syscalls.rs new file mode 100644 index 00000000000..67199ff2c43 --- /dev/null +++ b/utils/wasm-gen/src/generator/syscalls.rs @@ -0,0 +1,77 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Sys-calls generators entities. +//! +//! Generators from this module form a state machine: +//! ```text +//! # Zero sys-calls generators nesting level. +//! SysCallsImport--->DisabledSysCallsImport--->ModuleWithCallIndexes--->WasmModule +//! +//! # First sys-calls generators nesting level. +//! SysCallsImport--->DisabledSysCallsImport--(SysCallsImportsGenerationProof)-->AdditionalDataInjector---\ +//! |--->DisabledAdditionalDataInjector--->ModuleWithCallIndexes--->WasmModule +//! +//! # Third sys-calls generators nesting level +//! SysCallsImport--->DisabledSysCallsImport--(SysCallsImportsGenerationProof)-->AdditionalDataInjector---\ +//! |--->DisabledAdditionalDataInjector--(AddressesInjectionOutcome)-->SysCallsInvocator--->DisabledSysCallsInvocator--->ModuleWithCallIndexes--->WasmModule +//! ``` +//! Entities in curly brackets are those, which are required for the next transition. +//! Also all transitions require previous entity to be disabled. + +mod additional_data; +mod imports; +mod invocator; + +pub use additional_data::*; +pub use imports::*; +pub use invocator::*; + +use gear_wasm_instrument::syscalls::{SysCallName, SysCallSignature}; + +/// Type of invocable sys-call. +/// +/// Basically, there are 2 types of generated sys-calls: +/// 1. Those invocation of which is done regardless of validity of call context (`Loose`). +/// 2. Those which are invoked correctly with implenting all call context (`Precise`). +/// +/// Clarifying that, `gr_reservation_send` requires an existing reservation id, +/// which is pretty hard to predict beforehand with a generator. So this call context +/// is created from scratch - first `gr_reserve_gas` is called and then it's result +/// is used for the further `gr_reservation_send` call. Those are `Precise` sys-calls. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub(crate) enum InvocableSysCall { + Loose(SysCallName), + Precise(SysCallSignature), +} + +impl InvocableSysCall { + fn name(&self) -> Option { + match self { + InvocableSysCall::Loose(name) => Some(*name), + InvocableSysCall::Precise(_) => None, + } + } + + fn into_signature(self) -> SysCallSignature { + match self { + InvocableSysCall::Loose(name) => name.signature(), + InvocableSysCall::Precise(signature) => signature, + } + } +} diff --git a/utils/wasm-gen/src/generator/syscalls/additional_data.rs b/utils/wasm-gen/src/generator/syscalls/additional_data.rs new file mode 100644 index 00000000000..3489e163e9d --- /dev/null +++ b/utils/wasm-gen/src/generator/syscalls/additional_data.rs @@ -0,0 +1,261 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Additional data injector module. + +use crate::{ + generator::{ + CallIndexes, CallIndexesHandle, DisabledSysCallsImportsGenerator, ModuleWithCallIndexes, + SysCallsImportsGenerationProof, + }, + utils, EntryPointName, InvocableSysCall, MessageDestination, SysCallsConfig, WasmModule, +}; +use arbitrary::Unstructured; +use gear_wasm_instrument::{ + parity_wasm::{builder, elements::Instruction}, + syscalls::SysCallName, +}; +use std::{collections::HashMap, iter::Cycle, vec::IntoIter}; + +/// Cycled iterator over wasm module data offsets. +/// +/// By data offsets we mean pointers to the beginning of +/// each data entry in wasm module's data section. +/// +/// By implementation this type is not instantiated, when no +/// data is set to the wasm module. More precisely, if no +/// additional data was set to [`SysCallsConfig`]. +pub struct AddressesOffsets(Cycle>); + +impl AddressesOffsets { + /// Get the next offset. + pub fn next_offset(&mut self) -> u32 { + self.0 + .next() + .expect("offsets is created only from non empty vec") + } +} + +/// Additional data injector. +/// +/// Injects some additional data from provided config to wasm module data section. +/// The config, which contains additional data types and values is received from [`DisabledSysCallsImportsGenerator`]. +/// +/// The generator is instantiated only with having [`SysCallsImportsGenerationProof`], which gives a guarantee. that +/// if log info should be injected, than `gr_debug` sys-call import is generated. +pub struct AdditionalDataInjector<'a> { + unstructured: &'a mut Unstructured<'a>, + call_indexes: CallIndexes, + config: SysCallsConfig, + last_offset: u32, + module: WasmModule, + addresses_offsets: Vec, + sys_calls_imports: HashMap, +} + +impl<'a> + From<( + DisabledSysCallsImportsGenerator<'a>, + SysCallsImportsGenerationProof, + )> for AdditionalDataInjector<'a> +{ + fn from( + (disabled_gen, _sys_calls_gen_proof): ( + DisabledSysCallsImportsGenerator<'a>, + SysCallsImportsGenerationProof, + ), + ) -> Self { + Self { + unstructured: disabled_gen.unstructured, + config: disabled_gen.config, + last_offset: 0, + module: disabled_gen.module, + addresses_offsets: Vec::new(), + sys_calls_imports: disabled_gen.sys_calls_imports, + call_indexes: disabled_gen.call_indexes, + } + } +} + +impl<'a> AdditionalDataInjector<'a> { + /// Injects additional data from config to the wasm module. + /// + /// Returns disabled additional data injector and injection outcome. + pub fn inject( + mut self, + ) -> ( + DisabledAdditionalDataInjector<'a>, + AddressesInjectionOutcome, + ) { + let offsets = self.inject_addresses(); + self.inject_log_info_printing(); + + let disabled = DisabledAdditionalDataInjector { + module: self.module, + call_indexes: self.call_indexes, + sys_calls_imports: self.sys_calls_imports, + config: self.config, + unstructured: self.unstructured, + }; + let outcome = AddressesInjectionOutcome { offsets }; + + (disabled, outcome) + } + + /// Disable current generator. + pub fn disable(self) -> DisabledAdditionalDataInjector<'a> { + DisabledAdditionalDataInjector { + module: self.module, + call_indexes: self.call_indexes, + sys_calls_imports: self.sys_calls_imports, + config: self.config, + unstructured: self.unstructured, + } + } + + /// Injects addresses from config, if they were defined, into the data section. + /// + /// Returns `Some` with pointers to each address entry in the data section. + /// If no addresses were defined in the config, then returns `None`. + pub fn inject_addresses(&mut self) -> Option { + if !self.addresses_offsets.is_empty() { + return Some(AddressesOffsets( + self.addresses_offsets.clone().into_iter().cycle(), + )); + } + + let MessageDestination::ExistingAddresses(existing_addresses) = self.config.sending_message_destination() else { + return None; + }; + + for address in existing_addresses { + self.addresses_offsets.push(self.last_offset); + + let address_data_bytes = utils::hash_with_value_to_vec(address); + let data_len = address_data_bytes.len(); + self.module.with(|module| { + let module = builder::from_module(module) + .data() + .offset(Instruction::I32Const(self.last_offset as i32)) + .value(address_data_bytes) + .build() + .build(); + + (module, ()) + }); + + self.last_offset += data_len as u32; + } + + Some(AddressesOffsets( + self.addresses_offsets.clone().into_iter().cycle(), + )) + } + + /// Injects logging calls for the log info defined by the config. + /// + /// Basically, it inserts into any existing gear entry point `gr_debug` call with + /// a pointer to data section entry, which stores the log info. + /// + /// If no log info is defined in the config, then just returns without mutating wasm. + pub fn inject_log_info_printing(&mut self) { + let Some(log_info) = self.config.log_info() else { + return; + }; + let log_bytes = log_info.as_bytes().to_vec(); + + let export_idx = self + .module + .gear_entry_point(EntryPointName::Init) + .or_else(|| self.module.gear_entry_point(EntryPointName::Handle)) + .or_else(|| self.module.gear_entry_point(EntryPointName::HandleReply)) + // This generator is instantiated from SysCallsImportsGenerator, which can only be + // generated if entry points and memory import were generated. + .expect("impossible to have no gear export"); + + let debug_call_indexes_handle = self + .sys_calls_imports + .get(&InvocableSysCall::Loose(SysCallName::Debug)) + .map(|&(_, handle)| handle as u32) + .expect("impossible by configs generation to have log info printing without debug sys-call generated"); + + self.module.with(|module| { + let log_bytes_len = log_bytes.len() as u32; + let log_info_offset = self.last_offset; + + self.last_offset = log_info_offset + log_bytes_len; + + let mut module = builder::from_module(module) + .data() + .offset(Instruction::I32Const(log_info_offset as i32)) + .value(log_bytes) + .build() + .build(); + + module + .code_section_mut() + .expect("has at least one export") + .bodies_mut() + .get_mut(export_idx as usize) + .expect("index of existing export") + .code_mut() + .elements_mut() + .splice( + 0..0, + [ + Instruction::I32Const(log_info_offset as i32), + Instruction::I32Const(log_bytes_len as i32), + Instruction::Call(debug_call_indexes_handle), + ], + ); + + (module, ()) + }); + } +} + +/// Data injection outcome. +/// +/// Basically this type just carries inserted into data section +/// addresses offsets. +/// +/// There's design point of having this type, which is described in [`super::SysCallsInvocator`] docs. +pub struct AddressesInjectionOutcome { + pub(super) offsets: Option, +} + +/// Disabled additional data injector. +/// +/// Instance of this type signals that there was once active additional data injector, +/// but it ended up it's work. +pub struct DisabledAdditionalDataInjector<'a> { + pub(super) unstructured: &'a mut Unstructured<'a>, + pub(super) module: WasmModule, + pub(super) call_indexes: CallIndexes, + pub(super) sys_calls_imports: HashMap, + pub(super) config: SysCallsConfig, +} + +impl<'a> From> for ModuleWithCallIndexes { + fn from(additional_data_inj: DisabledAdditionalDataInjector<'a>) -> Self { + ModuleWithCallIndexes { + module: additional_data_inj.module, + call_indexes: additional_data_inj.call_indexes, + } + } +} diff --git a/utils/wasm-gen/src/generator/syscalls/imports.rs b/utils/wasm-gen/src/generator/syscalls/imports.rs new file mode 100644 index 00000000000..46d71c116ea --- /dev/null +++ b/utils/wasm-gen/src/generator/syscalls/imports.rs @@ -0,0 +1,388 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Sys-calls imports generator module. + +use crate::{ + generator::{ + CallIndexes, CallIndexesHandle, FrozenGearWasmGenerator, GearEntryPointGenerationProof, + GearWasmGenerator, MemoryImportGenerationProof, ModuleWithCallIndexes, + }, + wasm::{PageCount as WasmPageCount, WasmModule}, + InvocableSysCall, SysCallsConfig, +}; +use arbitrary::{Result, Unstructured}; +use gear_wasm_instrument::{ + parity_wasm::{ + builder, + elements::{BlockType, Instruction, Instructions}, + }, + syscalls::{ParamType, SysCallName, SysCallSignature}, +}; +use gsys::{ErrorWithHash, HashWithValue, Length}; +use std::{collections::HashMap, mem}; + +/// Gear sys-calls imports generator. +pub struct SysCallsImportsGenerator<'a> { + unstructured: &'a mut Unstructured<'a>, + call_indexes: CallIndexes, + module: WasmModule, + config: SysCallsConfig, + sys_calls_imports: HashMap, +} + +/// Sys-calls imports generator instantiator. +/// +/// Serves as a new type in order to create the generator from gear wasm generator and proofs. +pub struct SysCallsImportsGeneratorInstantiator<'a>( + ( + GearWasmGenerator<'a>, + MemoryImportGenerationProof, + GearEntryPointGenerationProof, + ), +); + +impl<'a> + From<( + GearWasmGenerator<'a>, + MemoryImportGenerationProof, + GearEntryPointGenerationProof, + )> for SysCallsImportsGeneratorInstantiator<'a> +{ + fn from( + inner: ( + GearWasmGenerator<'a>, + MemoryImportGenerationProof, + GearEntryPointGenerationProof, + ), + ) -> Self { + Self(inner) + } +} + +impl<'a> From> + for (SysCallsImportsGenerator<'a>, FrozenGearWasmGenerator<'a>) +{ + fn from(instantiator: SysCallsImportsGeneratorInstantiator<'a>) -> Self { + let SysCallsImportsGeneratorInstantiator(( + generator, + _mem_import_gen_proof, + _gen_ep_gen_proof, + )) = instantiator; + let sys_call_gen = SysCallsImportsGenerator { + unstructured: generator.unstructured, + call_indexes: generator.call_indexes, + module: generator.module, + config: generator.config.sys_calls_config.clone(), + sys_calls_imports: Default::default(), + }; + let frozen = FrozenGearWasmGenerator { + config: generator.config, + call_indexes: None, + unstructured: None, + }; + + (sys_call_gen, frozen) + } +} + +impl<'a> SysCallsImportsGenerator<'a> { + /// Instantiate a new gear sys-calls imports generator. + /// + /// The generator instantiations requires having type-level proof that the wasm module has memory import in it. + /// This proof could be gotten from memory generator. + pub fn new( + module_with_indexes: ModuleWithCallIndexes, + config: SysCallsConfig, + unstructured: &'a mut Unstructured<'a>, + _mem_import_gen_proof: MemoryImportGenerationProof, + _gen_ep_gen_proof: GearEntryPointGenerationProof, + ) -> Self { + let ModuleWithCallIndexes { + module, + call_indexes, + } = module_with_indexes; + + Self { + unstructured, + call_indexes, + module, + config, + sys_calls_imports: Default::default(), + } + } + + /// Disable current generator. + pub fn disable(self) -> DisabledSysCallsImportsGenerator<'a> { + DisabledSysCallsImportsGenerator { + unstructured: self.unstructured, + call_indexes: self.call_indexes, + module: self.module, + config: self.config, + sys_calls_imports: self.sys_calls_imports, + } + } + + /// Generates sys-calls imports and a function, that calls `gr_reservation_send` from config, + /// used to instantiate the generator. + /// + /// Returns disabled sys-calls imports generator and a proof that imports from config were generated. + pub fn generate( + mut self, + ) -> Result<( + DisabledSysCallsImportsGenerator<'a>, + SysCallsImportsGenerationProof, + )> { + let sys_calls_proof = self.generate_sys_calls_imports()?; + self.generate_send_from_reservation(); + + let disabled = DisabledSysCallsImportsGenerator { + unstructured: self.unstructured, + call_indexes: self.call_indexes, + module: self.module, + config: self.config, + sys_calls_imports: self.sys_calls_imports, + }; + + Ok((disabled, sys_calls_proof)) + } + + /// Generates sys-calls imports from config, used to instantiate the generator. + pub fn generate_sys_calls_imports(&mut self) -> Result { + for sys_call in SysCallName::instrumentable() { + let sys_call_generation_data = self.generate_sys_call_import(sys_call)?; + if let Some(sys_call_generation_data) = sys_call_generation_data { + self.sys_calls_imports + .insert(InvocableSysCall::Loose(sys_call), sys_call_generation_data); + } + } + + Ok(SysCallsImportsGenerationProof(())) + } + + /// Generate import of the gear sys-call defined by `sys_call` param. + /// + /// Returns [`Option`] which wraps the tuple of amount of sys-call further injections + /// and handle in the call indexes collection, if amount is not zero. Otherwise returns + /// None. + fn generate_sys_call_import( + &mut self, + sys_call: SysCallName, + ) -> Result> { + let sys_call_amount_range = self.config.injection_amounts(sys_call); + let sys_call_amount = self.unstructured.int_in_range(sys_call_amount_range)?; + + Ok((sys_call_amount != 0).then(|| { + let call_indexes_handle = self.insert_sys_call_import(sys_call); + (sys_call_amount, call_indexes_handle) + })) + } + + /// Inserts gear sys-call defined by the `sys_call` param. + fn insert_sys_call_import(&mut self, sys_call: SysCallName) -> CallIndexesHandle { + let sys_call_import_idx = self.module.count_import_funcs(); + + // Insert sys-call import to the module + self.module.with(|module| { + let mut module_builder = builder::from_module(module); + + // Build signature applicable for the parity-wasm for the sys call + let sys_call_signature = sys_call.signature().func_type(); + let signature_idx = module_builder.push_signature( + builder::signature() + .with_params(sys_call_signature.params().iter().copied()) + .with_results(sys_call_signature.results().iter().copied()) + .build_sig(), + ); + + // Create import entry with the built signature. + module_builder.push_import( + builder::import() + .module("env") + .external() + .func(signature_idx) + .field(sys_call.to_str()) + .build(), + ); + + (module_builder.build(), ()) + }); + + let call_indexes_handle = self.call_indexes.len(); + self.call_indexes.add_import(sys_call_import_idx); + + call_indexes_handle + } +} + +impl<'a> SysCallsImportsGenerator<'a> { + /// Generates a function which calls "properly" the `gr_reservation_send`. + fn generate_send_from_reservation(&mut self) { + let (reserve_gas_idx, reservation_send_idx) = { + let maybe_reserve_gas = self + .sys_calls_imports + .get(&InvocableSysCall::Loose(SysCallName::ReserveGas)) + .map(|&(_, call_indexes_handle)| call_indexes_handle); + let maybe_reservation_send = self + .sys_calls_imports + .get(&InvocableSysCall::Loose(SysCallName::ReservationSend)) + .map(|&(_, call_indexes_handle)| call_indexes_handle); + + match maybe_reserve_gas.zip(maybe_reservation_send) { + Some(indexes) => indexes, + None => return, + } + }; + + let send_from_reservation_signature = SysCallSignature { + params: vec![ + ParamType::Ptr(None), // Address of recipient and value (HashWithValue struct) + ParamType::Ptr(Some(2)), // Pointer to payload + ParamType::Size, // Size of the payload + ParamType::Delay, // Number of blocks to delay the sending for + ParamType::Gas, // Amount of gas to reserve + ParamType::Duration, // Duration of the reservation + ], + results: Default::default(), + }; + + let send_from_reservation_func_ty = send_from_reservation_signature.func_type(); + let func_signature = builder::signature() + .with_params(send_from_reservation_func_ty.params().iter().copied()) + .with_results(send_from_reservation_func_ty.results().iter().copied()) + .build_sig(); + + let memory_size_in_bytes = { + let initial_mem_size: WasmPageCount = self + .module + .initial_mem_size() + .expect("generator is instantiated with a mem import generation proof") + .into(); + initial_mem_size.memory_size() + }; + // subtract to be sure we are in memory boundaries. + let reserve_gas_result_ptr = memory_size_in_bytes.saturating_sub(100) as i32; + let rid_pid_value_ptr = reserve_gas_result_ptr + mem::size_of::() as i32; + let pid_value_ptr = reserve_gas_result_ptr + mem::size_of::() as i32; + let reservation_send_result_ptr = pid_value_ptr + mem::size_of::() as i32; + + let func_instructions = Instructions::new(vec![ + // Amount of gas to reserve + Instruction::GetLocal(4), + // Duration of the reservation + Instruction::GetLocal(5), + // Pointer to the LengthWithHash struct + Instruction::I32Const(reserve_gas_result_ptr), + Instruction::Call(reserve_gas_idx as u32), + // Pointer to the LengthWithHash struct + Instruction::I32Const(reserve_gas_result_ptr), + // Load LengthWithHash.length + Instruction::I32Load(2, 0), + // Check if LengthWithHash.length == 0 + Instruction::I32Eqz, + // If LengthWithHash.length == 0 + Instruction::If(BlockType::NoResult), + // Copy the HashWithValue struct (48 bytes) containing + // the recipient and value after the obtained reservation ID + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 0), + Instruction::I64Store(3, 0), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 8), + Instruction::I64Store(3, 8), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 16), + Instruction::I64Store(3, 16), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 24), + Instruction::I64Store(3, 24), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 32), + Instruction::I64Store(3, 32), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 40), + Instruction::I64Store(3, 40), + // Pointer to reservation ID, recipient ID and value + Instruction::I32Const(rid_pid_value_ptr), + // Pointer to payload + Instruction::GetLocal(1), + // Size of the payload + Instruction::GetLocal(2), + // Number of blocks to delay the sending for + Instruction::GetLocal(3), + // Pointer to the result of the reservation send + Instruction::I32Const(reservation_send_result_ptr), + Instruction::Call(reservation_send_idx as u32), + Instruction::End, + Instruction::End, + ]); + + let send_from_reservation_func_idx = self.module.with(|module| { + let mut module_builder = builder::from_module(module); + let idx = module_builder.push_function( + builder::function() + .with_signature(func_signature) + .body() + .with_instructions(func_instructions) + .build() + .build(), + ); + + (module_builder.build(), idx) + }); + + let call_indexes_handle = self.call_indexes.len(); + self.call_indexes + .add_func(send_from_reservation_func_idx.signature as usize); + + self.sys_calls_imports.insert( + InvocableSysCall::Precise(send_from_reservation_signature), + (1, call_indexes_handle), + ); + } +} + +/// Proof that there was an instance of sys-calls imports generator and `SysCallsImportsGenerator::generate_sys_calls_imports` was called. +pub struct SysCallsImportsGenerationProof(()); + +/// Disabled gear wasm sys-calls generator. +/// +/// Instance of this types signals that there was once active sys-calls generator, +/// but it ended up it's work. +pub struct DisabledSysCallsImportsGenerator<'a> { + pub(super) unstructured: &'a mut Unstructured<'a>, + pub(super) call_indexes: CallIndexes, + pub(super) module: WasmModule, + pub(super) config: SysCallsConfig, + pub(super) sys_calls_imports: HashMap, +} + +impl<'a> From> for ModuleWithCallIndexes { + fn from(disabled_sys_call_gen: DisabledSysCallsImportsGenerator<'a>) -> Self { + ModuleWithCallIndexes { + module: disabled_sys_call_gen.module, + call_indexes: disabled_sys_call_gen.call_indexes, + } + } +} diff --git a/utils/wasm-gen/src/generator/syscalls/invocator.rs b/utils/wasm-gen/src/generator/syscalls/invocator.rs new file mode 100644 index 00000000000..583f995af32 --- /dev/null +++ b/utils/wasm-gen/src/generator/syscalls/invocator.rs @@ -0,0 +1,399 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Sys-calls invocator module. + +use crate::{ + generator::{ + AddressesInjectionOutcome, AddressesOffsets, CallIndexes, CallIndexesHandle, + DisabledAdditionalDataInjector, FunctionIndex, ModuleWithCallIndexes, + }, + wasm::{PageCount as WasmPageCount, WasmModule}, + InvocableSysCall, SysCallParamAllowedValues, SysCallsConfig, SysCallsParamsConfig, +}; +use arbitrary::{Result, Unstructured}; +use gear_wasm_instrument::{ + parity_wasm::elements::{Instruction, Internal, ValueType}, + syscalls::{ParamType, SysCallName}, +}; +use std::{collections::HashMap, iter}; + +#[derive(Debug)] +pub(crate) enum ProcessedSysCallParams { + Alloc, + Value { + value_type: ValueType, + allowed_values: Option, + }, + MemoryArray, + MemoryPtrValue, +} + +pub(crate) fn process_sys_call_params( + params: &[ParamType], + params_config: &SysCallsParamsConfig, +) -> Vec { + let mut res = Vec::with_capacity(params.len()); + let mut skip_next_param = false; + for ¶m in params { + if skip_next_param { + skip_next_param = false; + continue; + } + let processed_param = match param { + ParamType::Alloc => ProcessedSysCallParams::Alloc, + ParamType::Ptr(maybe_idx) => maybe_idx + .map(|_| { + // skipping next as we don't need the following `Size` param, + // because it will be chosen in accordance to the wasm module + // memory pages config. + skip_next_param = true; + ProcessedSysCallParams::MemoryArray + }) + .unwrap_or(ProcessedSysCallParams::MemoryPtrValue), + _ => ProcessedSysCallParams::Value { + value_type: param.into(), + allowed_values: params_config.get_rule(¶m), + }, + }; + + res.push(processed_param); + } + + res +} + +/// Sys-calls invocator. +/// +/// Inserts sys-calls invokes randomly into internal functions. +/// +/// This type is instantiated from disable additional data injector and +/// data injection outcome ([`AddressesInjectionOutcome`]). The latter was introduced +/// to give additional guarantees for config and generators consistency. Otherwise, +/// if there wasn't any addresses injection outcome, which signals that there was a try to +/// inject addresses, sys-calls invocator could falsely set `gr_send*` call's destination param +/// to random value. For example, existing addresses could have been defined in the config, but +/// additional data injector was disabled, before injecting addresses from the config. As a result, +/// invocator would set un-intended by config values as messages destination. To avoid such +/// inconsistency the [`AddressesInjectionOutcome`] gives additional required guarantees. +pub struct SysCallsInvocator<'a> { + unstructured: &'a mut Unstructured<'a>, + call_indexes: CallIndexes, + module: WasmModule, + config: SysCallsConfig, + offsets: Option, + sys_call_imports: HashMap, +} + +impl<'a> + From<( + DisabledAdditionalDataInjector<'a>, + AddressesInjectionOutcome, + )> for SysCallsInvocator<'a> +{ + fn from( + (disabled_gen, outcome): ( + DisabledAdditionalDataInjector<'a>, + AddressesInjectionOutcome, + ), + ) -> Self { + Self { + unstructured: disabled_gen.unstructured, + call_indexes: disabled_gen.call_indexes, + module: disabled_gen.module, + config: disabled_gen.config, + offsets: outcome.offsets, + sys_call_imports: disabled_gen.sys_calls_imports, + } + } +} + +impl<'a> SysCallsInvocator<'a> { + /// Insert sys-calls invokes. + /// + /// The method builds instructions, which describe how each sys-call is called, and then + /// insert these instructions into any random function. In the end, all call indexes are resolved. + pub fn insert_invokes(mut self) -> Result { + for (invocable, (amount, call_indexes_handle)) in self.sys_call_imports.clone() { + let instructions = + self.build_sys_call_invoke_instructions(invocable, call_indexes_handle)?; + for instructions in iter::repeat(&instructions).take(amount as usize) { + self.insert_sys_call_instructions(instructions)?; + } + } + + self.resolves_calls_indexes(); + + Ok(DisabledSysCallsInvocator { + module: self.module, + call_indexes: self.call_indexes, + }) + } + + fn build_sys_call_invoke_instructions( + &mut self, + invocable: InvocableSysCall, + call_indexes_handle: usize, + ) -> Result> { + let name = invocable.name(); + let signature = invocable.into_signature(); + if self.is_not_send_sys_call(name) { + return self.build_call(&signature.params, &signature.results, call_indexes_handle); + } + + let mut call_without_destination_instrs = self.build_call( + &signature.params[1..], + &signature.results, + call_indexes_handle, + )?; + let res = if self.config.sending_message_destination().is_source() { + let gr_source_call_indexes_handle = self + .sys_call_imports + .get(&InvocableSysCall::Loose(SysCallName::Source)) + .map(|&(_, call_indexes_handle)| call_indexes_handle as u32) + .expect("by config if destination is source, then `gr_source` is generated"); + + let mut instructions = Vec::with_capacity(3 + call_without_destination_instrs.len()); + + let mem_size = self + .module + .initial_mem_size() + .map(Into::::into) + // To instantiate this generator, we must instantiate SysCallImportsGenerator, which can be + // instantiated only with memory import generation proof. + .expect("generator is instantiated with a memory import generation proof") + .memory_size(); + // Subtract a bit more so entities from `gsys` fit. + let upper_limit = mem_size.saturating_sub(100); + let offset = self.unstructured.int_in_range(0..=upper_limit)?; + + // call `gsys::gr_source` with a memory offset + instructions.push(Instruction::I32Const(offset as i32)); + instructions.push(Instruction::Call(gr_source_call_indexes_handle)); + // pass the offset as the first argument to the send-call + instructions.push(Instruction::I32Const(offset as i32)); + instructions.append(&mut call_without_destination_instrs); + + instructions + } else { + let mut instructions = Vec::with_capacity(1 + call_without_destination_instrs.len()); + + let address_offset = match self.offsets.as_mut() { + Some(offsets) => { + debug_assert!(self + .config + .sending_message_destination() + .is_existing_addresses()); + + offsets.next_offset() + } + None => { + debug_assert!(self.config.sending_message_destination().is_random()); + + self.unstructured.arbitrary()? + } + }; + + instructions.push(Instruction::I32Const(address_offset as i32)); + instructions.append(&mut call_without_destination_instrs); + + instructions + }; + + Ok(res) + } + + fn is_not_send_sys_call(&self, name: Option) -> bool { + ![ + Some(SysCallName::Send), + Some(SysCallName::SendWGas), + Some(SysCallName::SendInput), + Some(SysCallName::SendInputWGas), + None, + ] + .contains(&name) + } + + fn build_call( + &mut self, + params: &[ParamType], + results: &[ValueType], + call_indexes_handle: usize, + ) -> Result> { + let results = results.iter().map(|_| Instruction::Drop); + + let mem_size_pages = self + .module + .initial_mem_size() + // To instantiate this generator, we must instantiate SysCallImportsGenerator, which can be + // instantiated only with memory import generation proof. + .expect("generator is instantiated with a memory import generation proof"); + let mem_size = Into::::into(mem_size_pages).memory_size(); + + // + 1 for call instruction. + let mut instructions = Vec::with_capacity(params.len() * 2 + results.len() + 1); + for processed_param in process_sys_call_params(params, self.config.params_config()) { + match processed_param { + ProcessedSysCallParams::Alloc => { + let pages_to_alloc = self + .unstructured + .int_in_range(0..=mem_size_pages.saturating_sub(1))?; + instructions.push(Instruction::I32Const(pages_to_alloc as i32)); + } + ProcessedSysCallParams::Value { + value_type, + allowed_values, + } => { + let is_i32 = match value_type { + ValueType::I32 => true, + ValueType::I64 => false, + ValueType::F32 | ValueType::F64 => { + panic!("gear wasm must not have any floating nums") + } + }; + let instr = if let Some(allowed_values) = allowed_values { + if is_i32 { + Instruction::I32Const(allowed_values.get_i32(self.unstructured)?) + } else { + Instruction::I64Const(allowed_values.get_i64(self.unstructured)?) + } + } else if is_i32 { + Instruction::I32Const(self.unstructured.arbitrary()?) + } else { + Instruction::I64Const(self.unstructured.arbitrary()?) + }; + + instructions.push(instr); + } + ProcessedSysCallParams::MemoryArray => { + let upper_limit = mem_size.saturating_sub(1); + + let pointer_beyond = self.unstructured.int_in_range(0..=upper_limit)?; + let offset = self.unstructured.int_in_range(0..=pointer_beyond)?; + + instructions.push(Instruction::I32Const(offset as i32)); + instructions.push(Instruction::I32Const((pointer_beyond - offset) as i32)); + } + ProcessedSysCallParams::MemoryPtrValue => { + // Subtract a bit more so entities from `gsys` fit. + let upper_limit = mem_size.saturating_sub(100); + let offset = self.unstructured.int_in_range(0..=upper_limit)?; + + instructions.push(Instruction::I32Const(offset as i32)); + } + } + } + + instructions.push(Instruction::Call(call_indexes_handle as u32)); + instructions.extend(results); + + Ok(instructions) + } + + fn insert_sys_call_instructions(&mut self, instructions: &[Instruction]) -> Result<()> { + let last_funcs_idx = self.module.count_code_funcs() - 1; + let insert_into_func_no = self.unstructured.int_in_range(0..=last_funcs_idx)?; + + self.module.with(|mut module| { + let code = module + .code_section_mut() + .expect("has at least one function by config") + .bodies_mut()[insert_into_func_no] + .code_mut() + .elements_mut(); + + let res = self + .unstructured + .int_in_range(0..=code.len() - 1) + .map(|pos| { + code.splice(pos..pos, instructions.iter().cloned()); + }); + + (module, res) + }) + } + + fn resolves_calls_indexes(&mut self) { + let imports_num = self.module.count_import_funcs() as u32; + + self.module.with(|mut module| { + let each_func_instructions = module + .code_section_mut() + .expect("has at least 1 function by config") + .bodies_mut() + .iter_mut() + .flat_map(|body| body.code_mut().elements_mut().iter_mut()); + for instruction in each_func_instructions { + if let Instruction::Call(call_indexes_handle) = instruction { + let index_ty = self + .call_indexes + .get(*call_indexes_handle as usize) + .expect("getting by handle of existing call"); + match index_ty { + FunctionIndex::Func(idx) => *call_indexes_handle = idx + imports_num, + FunctionIndex::Import(idx) => *call_indexes_handle = idx, + } + } + } + + let export_funcs_call_indexes_handles = module + .export_section_mut() + // This generator is instantiated from SysCallsImportsGenerator, which can only be + // generated if entry points and memory import were generated. + .expect("has at least 1 export") + .entries_mut() + .iter_mut() + .filter_map(|export| match export.internal_mut() { + Internal::Function(call_indexes_handle) => Some(call_indexes_handle), + _ => None, + }); + + for export_call_indexes_handle in export_funcs_call_indexes_handles { + let FunctionIndex::Func(idx) = self.call_indexes + .get(*export_call_indexes_handle as usize) + .expect("getting by handle of existing call") else { + // Export can be to the import function by WASM specification, + // but we currently do not support this in wasm-gen. + panic!("Export cannot be to the import function"); + }; + + *export_call_indexes_handle = idx + imports_num; + } + + (module, ()) + }) + } +} + +/// Disabled sys-calls invocator. +/// +/// This type signals that sys-calls imports generation, additional data injection and +/// sys-calls invocation (with further call indexes resolution) is done. +pub struct DisabledSysCallsInvocator { + module: WasmModule, + call_indexes: CallIndexes, +} + +impl From for ModuleWithCallIndexes { + fn from(disabled_sys_calls_invocator: DisabledSysCallsInvocator) -> Self { + ModuleWithCallIndexes { + module: disabled_sys_calls_invocator.module, + call_indexes: disabled_sys_calls_invocator.call_indexes, + } + } +} diff --git a/utils/wasm-gen/src/lib.rs b/utils/wasm-gen/src/lib.rs index 51dcedfb77a..e2506955fa2 100644 --- a/utils/wasm-gen/src/lib.rs +++ b/utils/wasm-gen/src/lib.rs @@ -16,940 +16,55 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![allow(clippy::items_after_test_module)] - -use std::{ - collections::{BTreeMap, HashSet}, - iter::Cycle, - mem::size_of, -}; - -use arbitrary::Unstructured; -use gear_wasm_instrument::{ - parity_wasm::{ - self, builder, - elements::{ - BlockType, External, FunctionType, ImportCountType, Instruction, Instructions, - Internal, Module, Type, ValueType, - }, - }, - syscalls::{ParamType, SysCallName, SysCallSignature}, -}; -pub use gsys; -use gsys::{ErrorWithHash, HashWithValue, Length}; -use wasm_smith::{Module as ModuleSmith, SwarmConfig}; - -mod config; -pub use config::*; -mod generator; -pub use generator::*; - -mod syscalls; -use syscalls::{sys_calls_table, CallInfo, CallSignature}; +//! Wasm generator that can generate valid gear wasm programs. +//! +//! By gear wasm program we mean wasm modules that can be stored +//! and executed on the [gear](https://www.gear-tech.io/) runtime. +//! +//! This crate also re-exports `arbitrary` from internal module [`wasm_gen_arbitrary`] to make it easy generating arbitrary configs and wasm. +#![allow(clippy::items_after_test_module)] +pub mod wasm_gen_arbitrary { + //! `arbitrary` crate re-export. + pub use arbitrary::*; +} +pub mod config; +pub mod generator; #[cfg(test)] mod tests; +mod utils; +mod wasm; -pub mod utils; -pub mod wasm; -use wasm::PageCount as WasmPageCount; -pub use wasm::*; - -pub mod memory; -pub use memory::*; - -const MEMORY_VALUE_SIZE: u32 = 100; -const MEMORY_FIELD_NAME: &str = "memory"; - -#[derive(Clone, Copy, Debug)] -pub struct Ratio { - numerator: u32, - denominator: u32, -} - -impl Ratio { - pub fn get(&self, u: &mut Unstructured) -> bool { - if self.numerator == 0 { - false - } else { - u.ratio(self.numerator, self.denominator).unwrap() - } - } -} - -impl From<(u32, u32)> for Ratio { - fn from((numerator, denominator): (u32, u32)) -> Self { - Self { - numerator, - denominator, - } - } -} - -impl Ratio { - pub fn mult>(&self, x: T) -> usize { - (T::into(x) * self.numerator as usize) / self.denominator as usize - } -} - -// Module and an optional index of gr_debug syscall. -struct ModuleWithDebug { - module: Module, - debug_syscall_index: Option, - last_offset: u32, -} - -impl From for ModuleWithDebug { - fn from(data: ModuleBuilderWithData) -> Self { - let module = data.module_builder.build(); - Self { - module, - debug_syscall_index: None, - last_offset: data.last_offset, - } - } -} - -impl From<(Module, Option, u32)> for ModuleWithDebug { - fn from((module, debug_syscall_index, last_offset): (Module, Option, u32)) -> Self { - Self { - module, - debug_syscall_index, - last_offset, - } - } -} - -pub fn gen_wasm_smith_module(u: &mut Unstructured, config: SwarmConfig) -> ModuleSmith { - loop { - if let Ok(module) = ModuleSmith::new(config.clone(), u) { - return module; - } - } -} - -fn build_checked_call( - u: &mut Unstructured, - results: &[ValueType], - params_rules: &[ProcessedSysCallParams], - func_no: u32, - memory_pages: WasmPageCount, - unchecked_memory: bool, -) -> Vec { - let mut code = Vec::with_capacity(params_rules.len() * 2 + 1 + results.len()); - for parameter in params_rules { - match parameter { - ProcessedSysCallParams::Value { - value_type, - allowed_values, - } => { - let is_i32 = match value_type { - ValueType::I32 => true, - ValueType::I64 => false, - ValueType::F32 | ValueType::F64 => { - panic!("gear wasm must not have any floating nums") - } - }; - let instr = if let Some(allowed_values) = allowed_values { - if is_i32 { - Instruction::I32Const(allowed_values.get_i32(u).unwrap()) - } else { - Instruction::I64Const(allowed_values.get_i64(u).unwrap()) - } - } else if is_i32 { - Instruction::I32Const(u.arbitrary().unwrap()) - } else { - Instruction::I64Const(u.arbitrary().unwrap()) - }; - code.push(instr); - } - ProcessedSysCallParams::MemoryArray => { - if unchecked_memory { - code.push(Instruction::I32Const( - u.arbitrary() - .expect("Unstructured::arbitrary failed for MemoryArray"), - )); - code.push(Instruction::I32Const( - u.arbitrary() - .expect("Unstructured::arbitrary failed for MemoryArray"), - )); - } else { - let memory_size = memory_pages.memory_size(); - let upper_limit = memory_size.saturating_sub(1); - - let pointer_beyond = u - .int_in_range(0..=upper_limit) - .expect("Unstructured::int_in_range failed for MemoryArray"); - let offset = u - .int_in_range(0..=pointer_beyond) - .expect("Unstructured::int_in_range failed for MemoryArray"); - - code.push(Instruction::I32Const(offset as i32)); - code.push(Instruction::I32Const((pointer_beyond - offset) as i32)); - } - } - ProcessedSysCallParams::MemoryPtrValue => { - if unchecked_memory { - code.push(Instruction::I32Const( - u.arbitrary() - .expect("Unstructured::arbitrary failed for MemoryValue"), - )); - } else { - let memory_size = memory_pages.memory_size(); - // Subtract a bit more so entities from gsys fit. - let upper_limit = memory_size.saturating_sub(MEMORY_VALUE_SIZE); - let offset = u - .int_in_range(0..=upper_limit) - .expect("Unstructured::int_in_range failed for MemoryValue"); - - code.push(Instruction::I32Const(offset as i32)); - } - } - ProcessedSysCallParams::Alloc => { - if unchecked_memory { - code.push(Instruction::I32Const( - u.arbitrary() - .expect("Unstructured::arbitrary failed for Alloc"), - )); - } else { - let pages_to_alloc = u - .int_in_range(0..=memory_pages.raw().saturating_sub(1)) - .expect("Unstructured::int_in_range failed for Alloc"); - - code.push(Instruction::I32Const(pages_to_alloc as i32)); - } - } - } - } - - code.push(Instruction::Call(func_no)); - code.extend(results.iter().map(|_| Instruction::Drop)); - code -} - -fn make_call_instructions_vec( - u: &mut Unstructured, - params: &[ValueType], - results: &[ValueType], - func_no: u32, -) -> Vec { - let mut code = Vec::with_capacity(params.len() + 1 + results.len()); - for val in params { - let instr = match val { - ValueType::I32 => Instruction::I32Const( - u.arbitrary() - .expect("Unstructured::arbitrary failed for I32"), - ), - ValueType::I64 => Instruction::I64Const( - u.arbitrary() - .expect("Unstructured::arbitrary failed for I64"), - ), - _ => panic!("Cannot handle f32/f64"), - }; - code.push(instr); - } - code.push(Instruction::Call(func_no)); - code.extend(results.iter().map(|_| Instruction::Drop)); - - code -} - -#[derive(Debug, Clone, Copy)] -enum FuncIdx { - Import(u32), - Func(u32), -} +pub use config::*; +pub use generator::*; +pub use wasm::WasmModule; +pub use wasm_gen_arbitrary::*; -fn get_func_type(module: &Module, func_idx: FuncIdx) -> FunctionType { - match func_idx { - FuncIdx::Import(idx) => { - let type_no = if let External::Function(type_no) = - module.import_section().unwrap().entries()[idx as usize].external() - { - *type_no as usize - } else { - panic!("Import func index must be for import function"); - }; - let Type::Function(func_type) = &module.type_section().unwrap().types()[type_no]; - func_type.clone() - } - FuncIdx::Func(idx) => { - let func = module.function_section().unwrap().entries()[idx as usize]; - let Type::Function(func_type) = - &module.type_section().unwrap().types()[func.type_ref() as usize]; - func_type.clone() - } - } -} +use gear_wasm_instrument::parity_wasm::{self, elements::Module}; -struct WasmGen<'a> { +/// Generate gear program as raw bytes. +pub fn generate_gear_program_code<'a>( u: &'a mut Unstructured<'a>, - config: GearWasmGeneratorConfig, - calls_indexes: Vec, -} - -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] -enum CallName { - System(SysCallName), - SendFromReservation, -} - -impl From for CallName { - fn from(value: SysCallName) -> Self { - Self::System(value) - } -} - -#[derive(Debug)] -struct CallData { - info: CallInfo, - call_amount: usize, - call_index: u32, // Index in the `WasmGen::calls_indexes` - call_body_index: Option, // Index of generated body in a code section -} - -impl<'a> WasmGen<'a> { - fn initial_calls_indexes(module: &Module) -> Vec { - let mut calls_indexes = Vec::new(); - let import_funcs_num = module - .import_section() - .map(|imps| imps.functions() as u32) - .unwrap_or(0); - let code_funcs_num = module - .function_section() - .map(|funcs| funcs.entries().len() as u32) - .unwrap_or(0); - for i in 0..import_funcs_num { - calls_indexes.push(FuncIdx::Import(i)); - } - for i in 0..code_funcs_num { - calls_indexes.push(FuncIdx::Func(i)); - } - calls_indexes - } - - pub fn new( - module: &Module, - u: &'a mut Unstructured<'a>, - config: GearWasmGeneratorConfig, - ) -> Self { - let calls_indexes = Self::initial_calls_indexes(module); - Self { - u, - config, - calls_indexes, - } - } - - /// Inserts `instructions` into funcs satisfying the `insert_into_func_filter` - /// predicate which takes function body index in the `module` code section. - fn insert_instructions_into_functions( - &mut self, - mut module: Module, - insert_into_func_filter: impl FnOnce(usize) -> bool, - instructions: &[Instruction], - ) -> Module { - let funcs_num = module.code_section().unwrap().bodies().len(); - let insert_into_func_no = self.u.int_in_range(0..=funcs_num - 1).unwrap(); - if !insert_into_func_filter(insert_into_func_no) { - return module; - } - let code = module.code_section_mut().unwrap().bodies_mut()[insert_into_func_no] - .code_mut() - .elements_mut(); - - let pos = self.u.int_in_range(0..=code.len() - 1).unwrap(); - code.splice(pos..pos, instructions.iter().cloned()); - module - } - - pub fn gen_export_func_which_call_func_no( - &mut self, - mut module: Module, - name: &str, - func_no: u32, - ) -> Module { - let funcs_len = module - .function_section() - .map(|funcs| funcs.entries().len() as u32) - .expect("unreachable until functions section is not empty"); - let func_type = get_func_type(&module, FuncIdx::Func(func_no)); - - let mut instructions = - make_call_instructions_vec(self.u, func_type.params(), func_type.results(), func_no); - instructions.push(Instruction::End); - - module = builder::from_module(module) - .function() - .body() - .with_instructions(Instructions::new(instructions)) - .build() - .signature() - .build() - .build() - .export() - .field(name) - .internal() - .func(funcs_len) - .build() - .build(); - - let init_function_no = module.function_section().unwrap().entries().len() as u32 - 1; - self.calls_indexes.push(FuncIdx::Func(init_function_no)); - - module - } - - pub fn gen_handle(&mut self, module: Module) -> (Module, bool) { - if !self.config.entry_points_config.has_handle() { - return (module, false); - } - - let funcs_len = module - .function_section() - .map(|funcs| funcs.entries().len() as u32) - .expect("unreachable until functions section is not empty"); - - let func_no = self.u.int_in_range(0..=funcs_len - 1).unwrap(); - ( - self.gen_export_func_which_call_func_no(module, "handle", func_no), - true, - ) - } - - pub fn gen_handle_reply(&mut self, module: Module) -> (Module, bool) { - if !self.config.entry_points_config.has_handle_reply() { - return (module, false); - } - - let funcs_len = module - .function_section() - .map(|funcs| funcs.entries().len() as u32) - .expect("unreachable until functions section is not empty"); - - let func_no = self.u.int_in_range(0..=funcs_len - 1).unwrap(); - ( - self.gen_export_func_which_call_func_no(module, "handle_reply", func_no), - true, - ) - } - - pub fn gen_init(&mut self, module: Module) -> (Module, bool) { - if !self.config.entry_points_config.has_init() { - return (module, false); - } - - let funcs_len = module - .function_section() - .map(|funcs| funcs.entries().len() as u32) - .expect("unreachable until functions section is not empty"); - - let func_no = self.u.int_in_range(0..=funcs_len - 1).unwrap(); - ( - self.gen_export_func_which_call_func_no(module, "init", func_no), - true, - ) - } - - fn insert_calls( - &mut self, - builder: ModuleBuilderWithData, - call_data: &BTreeMap, - memory_pages: WasmPageCount, - ) -> ModuleWithDebug { - let ModuleBuilderWithData { - module_builder: builder, - offsets, - last_offset, - } = builder; - - let mut module = builder.build(); - - let source_call_index = call_data - .get(&CallName::System(SysCallName::Source)) - .map(|value| value.call_index); - let debug_call_index = call_data - .get(&CallName::System(SysCallName::Debug)) - .map(|value| value.call_index); - let generated_call_body_indexes: HashSet> = call_data - .values() - .map(|call_data| call_data.call_body_index) - .collect(); - - let mut offsets = offsets.into_iter().cycle(); - - // generate call instructions for syscalls and insert them somewhere into the code - for (name, data) in call_data { - let instructions = self.build_call_instructions( - name, - data, - memory_pages, - source_call_index, - &mut offsets, - ); - for _ in 0..data.call_amount { - module = self.insert_instructions_into_functions( - module, - |func_body_idx| { - !generated_call_body_indexes.contains(&Some(func_body_idx as u32)) - }, - &instructions, - ); - } - } - - (module, debug_call_index, last_offset).into() - } - - fn gen_syscall_imports(&mut self, module: Module) -> (Module, BTreeMap) { - let code_size = module.code_section().map_or(0, |code_section| { - code_section - .bodies() - .iter() - .map(|b| b.code().elements().len()) - .sum() - }); - let mut syscall_data = BTreeMap::default(); - if code_size == 0 { - return (module, syscall_data); - } - let import_count = module.import_count(ImportCountType::Function); - let mut module_builder = builder::from_module(module); - let sys_calls_table = sys_calls_table(self.config.sys_calls_config.params_config()); - for (i, (name, info, sys_call_amount)) in sys_calls_table - .into_iter() - .filter_map(|(name, info)| { - let frequency = self.config.sys_calls_config.injection_amounts(name); - let sys_call_amount = self.u.int_in_range(frequency).unwrap() as usize; - (sys_call_amount != 0).then_some((name, info, sys_call_amount)) - }) - .enumerate() - { - let signature_index = { - let func_type = info.func_type(); - let mut signature_builder = builder::signature(); - for parameter in func_type.params() { - signature_builder = signature_builder.with_param(*parameter); - } - - for result in func_type.results() { - signature_builder = signature_builder.with_result(*result); - } - - module_builder.push_signature(signature_builder.build_sig()) - }; - - // make import - module_builder.push_import( - builder::import() - .module("env") - .external() - .func(signature_index) - .field(name.to_str()) - .build(), - ); - - let call_index = self.calls_indexes.len() as u32; - - self.calls_indexes - .push(FuncIdx::Import((import_count + i) as u32)); - syscall_data.insert( - name.into(), - CallData { - info, - call_amount: sys_call_amount, - call_index, - call_body_index: None, - }, - ); - } - (module_builder.build(), syscall_data) - } - - fn gen_send_from_reservation( - &mut self, - module: Module, - call_data: &BTreeMap, - memory_pages: WasmPageCount, - ) -> (Module, Option) { - let reserve_gas_call_data = call_data.get(&CallName::System(SysCallName::ReserveGas)); - let reservation_send_call_data = - call_data.get(&CallName::System(SysCallName::ReservationSend)); - let (Some(reserve_gas_call_data), Some(reservation_send_call_data)) = - (reserve_gas_call_data, reservation_send_call_data) else { - return (module, None); - }; - let send_from_reservation_signature = SysCallSignature { - params: vec![ - ParamType::Ptr(None), // Address of recipient and value (HashWithValue struct) - ParamType::Ptr(Some(1)), // Pointer to payload - ParamType::Size, // Size of the payload - ParamType::Delay, // Number of blocks to delay the sending for - ParamType::Gas, // Amount of gas to reserve - ParamType::Duration, // Duration of the reservation - ], - results: Default::default(), - }; - let send_from_reservation_call_info = CallInfo::new( - CallSignature::Custom(send_from_reservation_signature), - self.config.sys_calls_config.params_config(), - ); - - let func_type = send_from_reservation_call_info.func_type(); - - let func_signature = builder::signature() - .with_params(func_type.params().iter().copied()) - .with_results(func_type.results().iter().copied()) - .build_sig(); - - let memory_size_in_bytes = memory_pages.memory_size(); - let reserve_gas_result_ptr = memory_size_in_bytes.saturating_sub(MEMORY_VALUE_SIZE) as i32; // Pointer to the LengthWithHash struct - let rid_pid_value_ptr = reserve_gas_result_ptr + size_of::() as i32; - let pid_value_ptr = reserve_gas_result_ptr + size_of::() as i32; - let reservation_send_result_ptr = pid_value_ptr + size_of::() as i32; - - let func_instructions = Instructions::new(vec![ - Instruction::GetLocal(4), // Amount of gas to reserve - Instruction::GetLocal(5), // Duration of the reservation - Instruction::I32Const(reserve_gas_result_ptr), // Pointer to the LengthWithHash struct - Instruction::Call(reserve_gas_call_data.call_index), - Instruction::I32Const(reserve_gas_result_ptr), // Pointer to the LengthWithHash struct - Instruction::I32Load(2, 0), // Load LengthWithHash.length - Instruction::I32Eqz, // Check if LengthWithHash.length == 0 - Instruction::If(BlockType::NoResult), // If LengthWithHash.length == 0 - Instruction::I32Const(pid_value_ptr), // Copy the HashWithValue struct (48 bytes) containing the recipient and value after the obtained reservation ID - Instruction::GetLocal(0), - Instruction::I64Load(3, 0), - Instruction::I64Store(3, 0), - Instruction::I32Const(pid_value_ptr), - Instruction::GetLocal(0), - Instruction::I64Load(3, 8), - Instruction::I64Store(3, 8), - Instruction::I32Const(pid_value_ptr), - Instruction::GetLocal(0), - Instruction::I64Load(3, 16), - Instruction::I64Store(3, 16), - Instruction::I32Const(pid_value_ptr), - Instruction::GetLocal(0), - Instruction::I64Load(3, 24), - Instruction::I64Store(3, 24), - Instruction::I32Const(pid_value_ptr), - Instruction::GetLocal(0), - Instruction::I64Load(3, 32), - Instruction::I64Store(3, 32), - Instruction::I32Const(pid_value_ptr), - Instruction::GetLocal(0), - Instruction::I64Load(3, 40), - Instruction::I64Store(3, 40), - Instruction::I32Const(rid_pid_value_ptr), // Pointer to reservation ID, recipient ID and value - Instruction::GetLocal(1), // Pointer to payload - Instruction::GetLocal(2), // Size of the payload - Instruction::GetLocal(3), // Number of blocks to delay the sending for - Instruction::I32Const(reservation_send_result_ptr), // Pointer to the result of the reservation send - Instruction::Call(reservation_send_call_data.call_index), - Instruction::End, - Instruction::End, - ]); - - let mut module_builder = builder::from_module(module); - - let func_location = module_builder.push_function( - builder::function() - .with_signature(func_signature) - .body() - .with_instructions(func_instructions) - .build() - .build(), - ); - - let call_idx = self.calls_indexes.len() as u32; - - self.calls_indexes - .push(FuncIdx::Func(func_location.signature)); - - ( - module_builder.build(), - Some(CallData { - info: send_from_reservation_call_info, - // Could be generated from Unstructured based on code size, - // but apparently this level os randomness suffices - call_amount: reservation_send_call_data.call_amount, - call_index: call_idx, - call_body_index: Some(func_location.body), - }), - ) - } - - fn build_call_instructions>( - &mut self, - name: &CallName, - data: &CallData, - memory_pages: WasmPageCount, - source_call_index: Option, - offsets: &mut Cycle, - ) -> Vec { - let info = &data.info; - if ![ - CallName::System(SysCallName::Send), - CallName::System(SysCallName::SendWGas), - CallName::System(SysCallName::SendInput), - CallName::System(SysCallName::SendInputWGas), - CallName::SendFromReservation, - ] - .contains(name) - { - return build_checked_call( - self.u, - &info.results, - &info.parameter_rules, - data.call_index, - memory_pages, - self.config.sys_calls_config.random_mem_access(), - ); - } - - let mut remaining_instructions = build_checked_call( - self.u, - &info.results, - &info.parameter_rules[1..], - data.call_index, - memory_pages, - self.config.sys_calls_config.random_mem_access(), - ); - - if let Some(source_call_index) = source_call_index { - if self - .config - .sys_calls_config - .sending_message_destination() - .is_source() - { - let mut instructions = Vec::with_capacity(3 + remaining_instructions.len()); - - let memory_size = memory_pages.memory_size(); - let upper_limit = memory_size.saturating_sub(MEMORY_VALUE_SIZE); - let offset = self - .u - .int_in_range(0..=upper_limit) - .expect("build_call_instructions: Unstructured::int_in_range failed"); - - // call msg::source (gr_source) with a memory offset - instructions.push(Instruction::I32Const(offset as i32)); - instructions.push(Instruction::Call(source_call_index)); - // pass the offset as the first argument to the send-call - instructions.push(Instruction::I32Const(offset as i32)); - instructions.append(&mut remaining_instructions); - - return instructions; - } - } - - let address_offset = offsets.next().unwrap_or_else(|| { - self.u - .arbitrary() - .expect("build_call_instructions: Unstructured::arbitrary failed") - }) as i32; - let mut instructions = Vec::with_capacity(1 + remaining_instructions.len()); - instructions.push(Instruction::I32Const(address_offset)); - instructions.append(&mut remaining_instructions); - - instructions - } - - pub fn make_print_test_info(&mut self, result: ModuleWithDebug) -> Module { - let Some(text) = self.config.sys_calls_config.log_info() else { - return result.module; - }; - - let ModuleWithDebug { - mut module, - debug_syscall_index, - last_offset, - } = result; - - if let External::Memory(mem_type) = module - .import_section() - .unwrap() - .entries() - .iter() - .find(|section| section.field() == MEMORY_FIELD_NAME) - .unwrap() - .external() - { - if mem_type.limits().initial() == 0 { - return module; - } - } - - let mut init_func_no = None; - if let Some(export_section) = module.export_section() { - for export in export_section.entries().iter() { - if export.field() == "init" { - init_func_no = if let Internal::Function(func_no) = export.internal() { - Some(*func_no) - } else { - panic!("init export is not a func, very strange -_-"); - } - } - } - } - if init_func_no.is_none() { - return module; - } - - let bytes = text.as_bytes(); - module = builder::from_module(module) - .data() - .offset(Instruction::I32Const(last_offset as i32)) - .value(bytes.to_vec()) - .build() - .build(); - - let init_code = module.code_section_mut().unwrap().bodies_mut() - [init_func_no.unwrap() as usize] - .code_mut() - .elements_mut(); - let print_code = [ - Instruction::I32Const(last_offset as i32), - Instruction::I32Const(bytes.len() as i32), - Instruction::Call(debug_syscall_index.expect("debug data specified so do the call")), - ]; - - init_code.splice(0..0, print_code); - - module - } - - pub fn resolves_calls_indexes(self, mut module: Module) -> Module { - if module.code_section().is_none() { - return module; - } - - let Self { - calls_indexes, - config, - .. - } = self; - - let import_funcs_num = module - .import_section() - .map(|imp| imp.functions() as u32) - .unwrap_or(0); - - for instr in module - .code_section_mut() - .unwrap() - .bodies_mut() - .iter_mut() - .flat_map(|body| body.code_mut().elements_mut().iter_mut()) - { - if let Instruction::Call(func_no) = instr { - let index = calls_indexes[*func_no as usize]; - match index { - FuncIdx::Func(no) => *func_no = no + import_funcs_num, - FuncIdx::Import(no) => *func_no = no, - } - } - } - - let mut empty_export_section = Default::default(); - for func_no in module - .export_section_mut() - .unwrap_or(&mut empty_export_section) - .entries_mut() - .iter_mut() - .filter_map(|export| { - if let Internal::Function(func_no) = export.internal_mut() { - Some(func_no) - } else { - None - } - }) - { - if let FuncIdx::Func(code_func_no) = calls_indexes[*func_no as usize] { - *func_no = import_funcs_num + code_func_no; - } else { - // TODO: export can be to the import function by WASM specification, - // but we currently do not support this in wasm-gen. - panic!("Export cannot be to the import function"); - } - } + config: ConfigsBundle, +) -> Result> { + let module = generate_gear_program_module(u, config)?; - match config.remove_recursions { - true => utils::remove_recursion(module), - false => module, - } - } + Ok(parity_wasm::serialize(module).expect("unable to serialize pw module")) } -pub fn gen_gear_program_module<'a>( +/// Generate gear program as [`parity_wasm::elements::Module`](https://docs.rs/parity-wasm/latest/parity_wasm/elements/struct.Module.html) +pub fn generate_gear_program_module<'a>( u: &'a mut Unstructured<'a>, config: ConfigsBundle, - addresses: &[HashWithValue], -) -> Module { +) -> Result { let ConfigsBundle { gear_wasm_generator_config, module_selectables_config, } = config; - let (module, memory_pages) = { - // Create wasm module config. - let arbitrary_params = u.arbitrary::().unwrap(); - let wasm_module = WasmModule::generate_with_config( - (module_selectables_config, arbitrary_params).into(), - u, - ) - .unwrap(); - - // Instantiate memory generator and generate memory import - let mem_config = gear_wasm_generator_config.memory_config; - let (DisabledMemoryGenerator(wasm_module), _mem_import_gen_proof) = - MemoryGenerator::new(wasm_module, mem_config).generate_memory(); - - let memory_pages = wasm_module - .initial_mem_size() - .expect("proof of import memory generation exists") - .into(); - (wasm_module.into_inner(), memory_pages) - }; - - let mut gen = WasmGen::new(&module, u, gear_wasm_generator_config); - let (module, has_init) = gen.gen_init(module); - if !has_init { - return gen.resolves_calls_indexes(module); - } - - let (module, _has_handle) = gen.gen_handle(module); - - let (module, _has_handle_reply) = gen.gen_handle_reply(module); - - let (module, mut syscall_data) = gen.gen_syscall_imports(module); + let arbitrary_params = u.arbitrary::()?; + let wasm_module = + WasmModule::generate_with_config((module_selectables_config, arbitrary_params).into(), u)?; - let (module, send_from_reservation_call_data) = - gen.gen_send_from_reservation(module, &syscall_data, memory_pages); - if let Some(send_from_reservation_call_data) = send_from_reservation_call_data { - syscall_data.insert( - CallName::SendFromReservation, - send_from_reservation_call_data, - ); - } - - let module = gen.insert_calls( - ModuleBuilderWithData::new(addresses, module, memory_pages), - &syscall_data, - memory_pages, - ); - - let module = gen.make_print_test_info(module); - - gen.resolves_calls_indexes(module) -} - -pub fn gen_gear_program_code<'a>( - u: &'a mut Unstructured<'a>, - config: ConfigsBundle, - addresses: &[HashWithValue], -) -> Vec { - let module = gen_gear_program_module(u, config, addresses); - parity_wasm::serialize(module).unwrap() + GearWasmGenerator::new_with_config(wasm_module, u, gear_wasm_generator_config).generate() } diff --git a/utils/wasm-gen/src/memory.rs b/utils/wasm-gen/src/memory.rs deleted file mode 100644 index b5c14e464ca..00000000000 --- a/utils/wasm-gen/src/memory.rs +++ /dev/null @@ -1,76 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use super::*; -use gear_wasm_instrument::parity_wasm::{ - builder::{self, ModuleBuilder}, - elements::Instruction, -}; -use gsys::HashWithValue; -use std::{mem, slice}; - -pub struct ModuleBuilderWithData { - pub module_builder: ModuleBuilder, - pub offsets: Vec, - pub last_offset: u32, -} - -impl ModuleBuilderWithData { - pub fn new(addresses: &[HashWithValue], module: Module, memory_pages: WasmPageCount) -> Self { - let module_builder = builder::from_module(module); - if memory_pages == 0.into() { - return Self { - module_builder, - offsets: vec![], - last_offset: 0, - }; - }; - - let (module_builder, offsets, last_offset) = - Self::inject_addresses(addresses, module_builder); - Self { - module_builder, - offsets, - last_offset, - } - } - - fn inject_addresses( - addresses: &[HashWithValue], - module_builder: ModuleBuilder, - ) -> (ModuleBuilder, Vec, u32) { - let size = mem::size_of::(); - addresses.iter().fold( - (module_builder, Vec::with_capacity(addresses.len()), 0u32), - |(module_builder, mut offsets, last_offset), address| { - offsets.push(last_offset); - let slice = unsafe { - slice::from_raw_parts(address as *const HashWithValue as *const u8, size) - }; - let len = slice.len(); - let module_builder = module_builder - .data() - .offset(Instruction::I32Const(last_offset as i32)) - .value(slice.to_vec()) - .build(); - - (module_builder, offsets, last_offset + len as u32) - }, - ) - } -} diff --git a/utils/wasm-gen/src/syscalls.rs b/utils/wasm-gen/src/syscalls.rs deleted file mode 100644 index b19a087d675..00000000000 --- a/utils/wasm-gen/src/syscalls.rs +++ /dev/null @@ -1,83 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use std::collections::BTreeMap; - -use gear_wasm_instrument::{ - parity_wasm::elements::{FunctionType, ValueType}, - syscalls::{SysCallName, SysCallSignature}, -}; - -use crate::config::{process_sys_call_params, ProcessedSysCallParams, SysCallsParamsConfig}; - -/// Syscall function info and config. -#[derive(Debug)] -pub struct CallInfo { - /// Syscall signature params. - pub params: Vec, - /// Syscall signature results. - pub results: Vec, - /// Syscall allowed input values. - pub(crate) parameter_rules: Vec, -} - -impl CallInfo { - pub fn new(call_signature: CallSignature, params_config: &SysCallsParamsConfig) -> Self { - let signature = call_signature.signature(); - Self { - params: signature.params.iter().copied().map(Into::into).collect(), - results: signature.results.to_vec(), - parameter_rules: process_sys_call_params(&signature.params, params_config), - } - } - - pub fn func_type(&self) -> FunctionType { - FunctionType::new(self.params.clone(), self.results.clone()) - } -} - -pub enum CallSignature { - // Derivable signature from `SysCallName` type. - Standard(SysCallName), - // Custom sys-call signature. - Custom(SysCallSignature), -} - -impl CallSignature { - fn signature(&self) -> SysCallSignature { - match self { - CallSignature::Standard(name) => name.signature(), - CallSignature::Custom(signature) => signature.clone(), - } - } -} - -/// Make syscalls table for given config. -pub(crate) fn sys_calls_table( - params_config: &SysCallsParamsConfig, -) -> BTreeMap { - SysCallName::instrumentable() - .into_iter() - .map(|name| { - ( - name, - CallInfo::new(CallSignature::Standard(name), params_config), - ) - }) - .collect() -} diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index 8f5862463d1..2144d0b26b2 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -16,80 +16,59 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::mem; - -use crate::{ - gen_gear_program_code, memory::ModuleBuilderWithData, utils, ConfigsBundle, - GearWasmGeneratorConfigBuilder, ModuleWithDebug, SysCallsConfigBuilder, -}; +use super::*; use arbitrary::Unstructured; +use gear_utils::NonEmpty; use gear_wasm_instrument::parity_wasm::{ self, - elements::{self, External}, + elements::{Instruction, Module}, }; use rand::{rngs::SmallRng, RngCore, SeedableRng}; +use std::mem; -#[allow(unused)] -use indicatif::ProgressIterator; - -const MODULES_AMOUNT: usize = 100; -const UNSTRUCTURED_SIZE: usize = 1000000; +const UNSTRUCTURED_SIZE: usize = 1_000_000; #[test] -fn gen_wasm_normal() { +fn check_default_configuration_fuzz() { let mut rng = SmallRng::seed_from_u64(1234); - for _ in 0..MODULES_AMOUNT { - let mut buf = vec![0; UNSTRUCTURED_SIZE]; - rng.fill_bytes(&mut buf); - let mut u = Unstructured::new(&buf); - let code = gen_gear_program_code(&mut u, ConfigsBundle::default(), &[]); - let _wat = wasmprinter::print_bytes(code).unwrap(); - } -} -#[test] -fn gen_wasm_valid() { - let mut rng = SmallRng::seed_from_u64(33333); - let gear_wasm_generator_config = GearWasmGeneratorConfigBuilder::new() - .with_sys_calls_config( - SysCallsConfigBuilder::new(Default::default()) - .with_log_info("HEY GEAR".into()) - .build(), - ) - .build(); - let config = ConfigsBundle { - gear_wasm_generator_config, - ..Default::default() - }; - for _ in 0..MODULES_AMOUNT { + for _ in 0..100 { let mut buf = vec![0; UNSTRUCTURED_SIZE]; rng.fill_bytes(&mut buf); let mut u = Unstructured::new(&buf); - let code = gen_gear_program_code(&mut u, config.clone(), &[]); - let _wat = wasmprinter::print_bytes(&code).unwrap(); - wasmparser::validate(&code).unwrap(); + + let module = generate_gear_program_module(&mut u, ConfigsBundle::default()); + assert!(module.is_ok()); + assert!(module.expect("checked").into_bytes().is_ok()); } } #[test] fn remove_trivial_recursions() { - let wat = r#" + let wat1 = r#" (module (func (;0;) call 0 ) )"#; - let wasm = wat::parse_str(wat).unwrap(); - let module: elements::Module = parity_wasm::deserialize_buffer(&wasm).unwrap(); - let module = utils::remove_recursion(module); - let wasm = parity_wasm::serialize(module).unwrap(); - wasmparser::validate(&wasm).unwrap(); + let wasm_bytes = wat::parse_str(wat1).expect("invalid wat"); + let module = + parity_wasm::deserialize_buffer::(&wasm_bytes).expect("invalid wasm bytes"); + let no_recursions_module = utils::remove_recursion(module); - let wat = wasmprinter::print_bytes(&wasm).unwrap(); + let wasm_bytes = no_recursions_module + .into_bytes() + .expect("invalid pw module"); + assert!(wasmparser::validate(&wasm_bytes).is_ok()); + + let wat = wasmprinter::print_bytes(&wasm_bytes).expect("failed printing bytes"); println!("wat = {wat}"); +} - let wat = r#" +#[test] +fn remove_multiple_recursions() { + let wat2 = r#" (module (func (;0;) (result i64) call 1 @@ -103,20 +82,23 @@ fn remove_trivial_recursions() { ) )"#; - let wasm = wat::parse_str(wat).unwrap(); - let module: elements::Module = parity_wasm::deserialize_buffer(&wasm).unwrap(); + let wasm_bytes = wat::parse_str(wat2).expect("invalid wat"); + let module = + parity_wasm::deserialize_buffer::(&wasm_bytes).expect("invalid wasm bytes"); utils::find_recursion(&module, |path, call| { println!("path = {path:?}, call = {call}"); }); - let module = utils::remove_recursion(module); - utils::find_recursion(&module, |_path, _call| { + let no_recursions_module = utils::remove_recursion(module); + utils::find_recursion(&no_recursions_module, |_, _| { unreachable!("there should be no recursions") }); - let wasm = parity_wasm::serialize(module).unwrap(); - wasmparser::validate(&wasm).unwrap(); + let wasm_bytes = no_recursions_module + .into_bytes() + .expect("invalid pw module"); + assert!(wasmparser::validate(&wasm_bytes).is_ok()); - let wat = wasmprinter::print_bytes(&wasm).unwrap(); + let wat = wasmprinter::print_bytes(&wasm_bytes).expect("failed printing bytes"); println!("wat = {wat}"); } @@ -143,60 +125,62 @@ fn remove_trivial_recursions() { #[test] fn injecting_addresses_works() { - use gsys::HashWithValue; - let mut rng = SmallRng::seed_from_u64(1234); - let mut buf = vec![0; UNSTRUCTURED_SIZE]; rng.fill_bytes(&mut buf); let mut u = Unstructured::new(&buf); - let code = gen_gear_program_code(&mut u, ConfigsBundle::default(), &[]); - - let module: elements::Module = parity_wasm::deserialize_buffer(&code).unwrap(); - let memory_pages = module - .import_section() - .map_or(0u32, |import_section| { - for entry in import_section.entries() { - if let External::Memory(memory) = entry.external() { - return memory.limits().initial(); - } - } - - 0u32 - }) - .into(); - let builder = ModuleBuilderWithData::new(&[], module.clone(), memory_pages); - { - let module: ModuleWithDebug = builder.into(); - - assert_eq!(module.last_offset, 0); - assert!(module - .module - .data_section() - .map_or(true, |s| s.entries().is_empty())); - } - let addresses = [ - HashWithValue { - hash: Default::default(), - value: 0, - }, - HashWithValue { - hash: [1; 32], - value: 1, - }, - ]; - let builder = ModuleBuilderWithData::new(&addresses, module, memory_pages); - let module = ModuleWithDebug::from(builder); - - let size = mem::size_of::() as u32; - assert_eq!(module.last_offset, 2 * size); - - let data_section = module.module.data_section().unwrap(); - let segments = data_section.entries(); - assert_eq!(segments.len(), 2); - - let code = parity_wasm::serialize(module.module).unwrap(); - let wat = wasmprinter::print_bytes(code).unwrap(); - println!("wat = {wat}"); + let addresses = NonEmpty::from_vec(vec![[0; 32], [1; 32]]).expect("vec wasn't empty"); + let config = GearWasmGeneratorConfigBuilder::new() + .with_sys_calls_config( + SysCallsConfigBuilder::new(Default::default()) + .with_data_offset_msg_dest(addresses) + .build(), + ) + .build(); + let wasm_module = GearWasmGenerator::new_with_config( + WasmModule::generate(&mut u).expect("failed module generation"), + &mut u, + config, + ) + .generate() + .expect("failed gear-wasm generation"); + + let data_sections_entries_num = wasm_module + .data_section() + .expect("additional data was inserted") + .entries() + .len(); + // 2 addresses in the upper `addresses`. + assert_eq!(data_sections_entries_num, 2); + + let size = mem::size_of::() as i32; + let entries = wasm_module + .data_section() + .expect("additional data was inserted") + .entries(); + + let first_addr_offset = entries + .get(0) + .and_then(|segment| segment.offset().as_ref()) + .map(|expr| &expr.code()[0]) + .expect("checked"); + let Instruction::I32Const(ptr) = first_addr_offset else { + panic!("invalid instruction in init expression") + }; + // No additional data, except for addresses. + // First entry set to the 0 offset. + assert_eq!(ptr, &0); + + let second_addr_offset = entries + .get(1) + .and_then(|segment| segment.offset().as_ref()) + .map(|expr| &expr.code()[0]) + .expect("checked"); + let Instruction::I32Const(ptr) = second_addr_offset else { + panic!("invalid instruction in init expression") + }; + // No additional data, except for addresses. + // First entry set to the 0 offset. + assert_eq!(ptr, &size); } diff --git a/utils/wasm-gen/src/utils.rs b/utils/wasm-gen/src/utils.rs index 74f77b55782..c89440967a6 100644 --- a/utils/wasm-gen/src/utils.rs +++ b/utils/wasm-gen/src/utils.rs @@ -20,7 +20,11 @@ use gear_wasm_instrument::parity_wasm::{ builder, elements::{self, FuncBody, ImportCountType, Instruction, Module, Type, ValueType}, }; -use std::collections::{BTreeMap, BTreeSet}; +use gsys::HashWithValue; +use std::{ + collections::{BTreeMap, BTreeSet}, + mem, slice, +}; const PREALLOCATE: usize = 1_000; @@ -29,95 +33,6 @@ enum Color { Black, } -/// Find possible call recursions in `module`. Calls `callback` with -/// functions indexes chain and an index creating a recursion. -/// -/// Used algorithm is based on Depth-First Search (DFS) algorithm for -/// loops detection in graphs. -pub fn find_recursion(module: &Module, mut callback: Callback) -where - Callback: FnMut(&[usize], usize), -{ - let function_bodies = match module.code_section() { - Some(s) if !s.bodies().is_empty() => s.bodies(), - _ => return, - }; - - let import_count = module.import_count(ImportCountType::Function); - - let mut colored_list = Vec::>::with_capacity(function_bodies.len()); - let mut path = Vec::with_capacity(PREALLOCATE); - - for i in 0..function_bodies.len() { - let call_index = import_count + i; - let call_colored = colored_list - .iter() - .any(|colored| colored.contains_key(&call_index)); - - if call_colored { - continue; - } - - let mut colored = Default::default(); - find_recursion_impl( - call_index, - import_count, - function_bodies, - &mut colored, - &mut path, - &mut callback, - ); - colored_list.push(colored); - } -} - -fn find_recursion_impl( - call_index: usize, - import_count: usize, - function_bodies: &[FuncBody], - colored: &mut BTreeMap, - path: &mut Vec, - callback: &mut Callback, -) where - Callback: FnMut(&[usize], usize), -{ - path.push(call_index); - colored.insert(call_index, Color::Grey); - - let body_index = call_index - import_count; - let body = &function_bodies[body_index]; - let instructions = body.code(); - for instruction in instructions.elements() { - let called_index = match instruction { - Instruction::Call(i) => *i as usize, - _ => continue, - }; - - // imported function maybe called there - if called_index < import_count { - continue; - } - - if colored.get(&called_index).is_none() { - find_recursion_impl( - called_index, - import_count, - function_bodies, - colored, - path, - callback, - ); - } - - if matches!(colored.get(&called_index), Some(Color::Grey)) { - callback(path, called_index); - } - } - - colored.insert(call_index, Color::Black); - path.pop(); -} - /// Remove call recursions in `module` by using mock functions. pub fn remove_recursion(module: Module) -> Module { if module.code_section().is_none() { @@ -210,3 +125,107 @@ pub fn remove_recursion(module: Module) -> Module { module } + +/// Find possible call recursions in `module`. Calls `callback` with +/// functions indexes chain and an index creating a recursion. +/// +/// Used algorithm is based on Depth-First Search (DFS) algorithm for +/// loops detection in graphs. +pub fn find_recursion(module: &Module, mut callback: Callback) +where + Callback: FnMut(&[usize], usize), +{ + let function_bodies = match module.code_section() { + Some(s) if !s.bodies().is_empty() => s.bodies(), + _ => return, + }; + + let import_count = module.import_count(ImportCountType::Function); + + let mut colored_list = Vec::>::with_capacity(function_bodies.len()); + let mut path = Vec::with_capacity(PREALLOCATE); + + for i in 0..function_bodies.len() { + let call_index = import_count + i; + let call_colored = colored_list + .iter() + .any(|colored| colored.contains_key(&call_index)); + + if call_colored { + continue; + } + + let mut colored = Default::default(); + find_recursion_impl( + call_index, + import_count, + function_bodies, + &mut colored, + &mut path, + &mut callback, + ); + colored_list.push(colored); + } +} + +fn find_recursion_impl( + call_index: usize, + import_count: usize, + function_bodies: &[FuncBody], + colored: &mut BTreeMap, + path: &mut Vec, + callback: &mut Callback, +) where + Callback: FnMut(&[usize], usize), +{ + path.push(call_index); + colored.insert(call_index, Color::Grey); + + let body_index = call_index - import_count; + let body = &function_bodies[body_index]; + let instructions = body.code(); + for instruction in instructions.elements() { + let called_index = match instruction { + Instruction::Call(i) => *i as usize, + _ => continue, + }; + + // imported function maybe called there + if called_index < import_count { + continue; + } + + if colored.get(&called_index).is_none() { + find_recursion_impl( + called_index, + import_count, + function_bodies, + colored, + path, + callback, + ); + } + + if matches!(colored.get(&called_index), Some(Color::Grey)) { + callback(path, called_index); + } + } + + colored.insert(call_index, Color::Black); + path.pop(); +} + +pub(crate) fn hash_with_value_to_vec(hash_with_value: &HashWithValue) -> Vec { + let address_data_size = mem::size_of::(); + let address_data_slice = unsafe { + // # Safety: + // The `unsafe` block constructs raw bytes vector of an existing rust struct + // received by reference. + slice::from_raw_parts( + hash_with_value as *const HashWithValue as *const u8, + address_data_size, + ) + }; + + address_data_slice.to_vec() +} diff --git a/utils/wasm-gen/src/wasm.rs b/utils/wasm-gen/src/wasm.rs index e5dd420a033..c236a59bc99 100644 --- a/utils/wasm-gen/src/wasm.rs +++ b/utils/wasm-gen/src/wasm.rs @@ -152,7 +152,7 @@ impl From for Page { /// New-type to represent WASM memory pages count. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] -pub struct PageCount(u32); +pub(crate) struct PageCount(u32); impl From for PageCount { fn from(value: u32) -> Self { @@ -165,9 +165,4 @@ impl PageCount { pub(crate) fn memory_size(&self) -> u32 { self.0 * PAGE_SIZE } - - /// Get WASM memory pages count as a number. - pub(crate) fn raw(&self) -> u32 { - self.0 - } } diff --git a/utils/wasm-instrument/src/syscalls.rs b/utils/wasm-instrument/src/syscalls.rs index df7ffb3e966..d38557f0ac2 100644 --- a/utils/wasm-instrument/src/syscalls.rs +++ b/utils/wasm-instrument/src/syscalls.rs @@ -372,7 +372,7 @@ impl From for ValueType { } /// Syscall signature. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct SysCallSignature { pub params: Vec, pub results: Vec, From 8f0cf046d21e535e33bc37238d367fec1cff750f Mon Sep 17 00:00:00 2001 From: Georgy Shepelev Date: Tue, 8 Aug 2023 14:51:47 +0300 Subject: [PATCH 031/165] refactoring(sandbox): Add logging for call to wasmer::Instance::new (#3040) --- sandbox/host/src/sandbox/wasmer_backend.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sandbox/host/src/sandbox/wasmer_backend.rs b/sandbox/host/src/sandbox/wasmer_backend.rs index 27c92864aef..3bea2d8505b 100644 --- a/sandbox/host/src/sandbox/wasmer_backend.rs +++ b/sandbox/host/src/sandbox/wasmer_backend.rs @@ -257,13 +257,17 @@ pub fn instantiate( } let instance = SandboxContextStore::using(sandbox_context, || { - wasmer::Instance::new(&module, &import_object).map_err(|error| match error { - wasmer::InstantiationError::Link(_) => InstantiationError::Instantiation, - wasmer::InstantiationError::Start(_) => InstantiationError::StartTrapped, - wasmer::InstantiationError::HostEnvInitialization(_) => { - InstantiationError::EnvironmentDefinitionCorrupted + wasmer::Instance::new(&module, &import_object).map_err(|error| { + log::trace!("Failed to call wasmer::Instance::new: {error:?}"); + + match error { + wasmer::InstantiationError::Link(_) => InstantiationError::Instantiation, + wasmer::InstantiationError::Start(_) => InstantiationError::StartTrapped, + wasmer::InstantiationError::HostEnvInitialization(_) => { + InstantiationError::EnvironmentDefinitionCorrupted + } + wasmer::InstantiationError::CpuFeature(_) => InstantiationError::CpuFeature, } - wasmer::InstantiationError::CpuFeature(_) => InstantiationError::CpuFeature, }) })?; From b68c27b5b0717f02c7e03cfc24b0263f59c3e486 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Tue, 8 Aug 2023 17:49:36 +0300 Subject: [PATCH 032/165] refactor(wasm-gen): Avoid inserting sys-calls into custom `send_from_reservation` function (#3036) --- utils/wasm-gen/src/generator.rs | 27 ++++++++++++++++++- .../src/generator/syscalls/invocator.rs | 25 +++++++++++------ 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/utils/wasm-gen/src/generator.rs b/utils/wasm-gen/src/generator.rs index 17089fc2c28..9848ba1b8ee 100644 --- a/utils/wasm-gen/src/generator.rs +++ b/utils/wasm-gen/src/generator.rs @@ -56,6 +56,7 @@ use crate::{utils, GearWasmGeneratorConfig, WasmModule}; use arbitrary::{Result, Unstructured}; use gear_wasm_instrument::parity_wasm::elements::Module; +use std::collections::HashSet; mod entry_points; mod memory; @@ -208,6 +209,20 @@ type CallIndexesHandle = usize; /// and internal functions. struct CallIndexes { inner: Vec, + /// Indexes of wasm-module functions which were newly generated. + /// + /// These are indexes of functions which aren't generated from + /// `wasm-smith` but from the current crate generators. All gear + /// entry points ([`EntryPointsGenerator`]) and custom reservation send + /// function (generated in [`SysCallsImportsGenerator`]) are considered + /// to be "custom" functions. + /// + /// Separating "pre-defined" functions from newly generated ones is important + /// when sys-calls invocator inserts calls of generated sys-calls. For example, + /// calls must not be inserted in the custom function, which perofrms `gr_reservation_send`, + /// not to pollute it's internal instructions structure which is defined such that + /// semantically correct `gr_reservation_send` call is performed. + custom_funcs: HashSet, } impl CallIndexes { @@ -222,19 +237,29 @@ impl CallIndexes { inner.push(FunctionIndex::Func(i as u32)); } - Self { inner } + Self { + inner, + custom_funcs: HashSet::new(), + } } pub(crate) fn get(&self, handle_idx: CallIndexesHandle) -> Option { self.inner.get(handle_idx).copied() } + fn is_custom_func(&self, idx: usize) -> bool { + self.custom_funcs.contains(&idx) + } + fn len(&self) -> usize { self.inner.len() } fn add_func(&mut self, func_idx: usize) { self.inner.push(FunctionIndex::Func(func_idx as u32)); + let is_new = self.custom_funcs.insert(func_idx); + + debug_assert!(is_new, "same inner index is used"); } fn add_import(&mut self, import_idx: usize) { diff --git a/utils/wasm-gen/src/generator/syscalls/invocator.rs b/utils/wasm-gen/src/generator/syscalls/invocator.rs index 583f995af32..23e5d07868c 100644 --- a/utils/wasm-gen/src/generator/syscalls/invocator.rs +++ b/utils/wasm-gen/src/generator/syscalls/invocator.rs @@ -148,7 +148,7 @@ impl<'a> SysCallsInvocator<'a> { fn build_sys_call_invoke_instructions( &mut self, invocable: InvocableSysCall, - call_indexes_handle: usize, + call_indexes_handle: CallIndexesHandle, ) -> Result> { let name = invocable.name(); let signature = invocable.into_signature(); @@ -233,7 +233,7 @@ impl<'a> SysCallsInvocator<'a> { &mut self, params: &[ParamType], results: &[ValueType], - call_indexes_handle: usize, + call_indexes_handle: CallIndexesHandle, ) -> Result> { let results = results.iter().map(|_| Instruction::Drop); @@ -309,6 +309,12 @@ impl<'a> SysCallsInvocator<'a> { let last_funcs_idx = self.module.count_code_funcs() - 1; let insert_into_func_no = self.unstructured.int_in_range(0..=last_funcs_idx)?; + // Do not insert into custom newly generated function, but only into pre-defined + // internal functions. + if self.call_indexes.is_custom_func(insert_into_func_no) { + return Ok(()); + } + self.module.with(|mut module| { let code = module .code_section_mut() @@ -317,12 +323,15 @@ impl<'a> SysCallsInvocator<'a> { .code_mut() .elements_mut(); - let res = self - .unstructured - .int_in_range(0..=code.len() - 1) - .map(|pos| { - code.splice(pos..pos, instructions.iter().cloned()); - }); + // The end of insertion range is second-to-last index, as the last + // index is defined for `Instruction::End` of the function body. + // But if there's only one instruction in the function, then `0` + // index is used as an insertion point. + let last = if code.len() > 1 { code.len() - 2 } else { 0 }; + + let res = self.unstructured.int_in_range(0..=last).map(|pos| { + code.splice(pos..pos, instructions.iter().cloned()); + }); (module, res) }) From fdb21befac6b7dcd1b07f1cc035058c0cdfe870d Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Tue, 8 Aug 2023 23:06:08 +0800 Subject: [PATCH 033/165] ci(PR): introduce new workflow PR (#2959) --- .github/workflows/CI.yaml | 379 ++---------------------------------- .github/workflows/PR.yml | 60 ++++++ .github/workflows/build.yml | 294 ++++++++++++++++++++++++++++ .github/workflows/check.yml | 89 +++++++++ 4 files changed, 454 insertions(+), 368 deletions(-) create mode 100644 .github/workflows/PR.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 45c0fe3cfa7..54dcca031c4 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -5,13 +5,9 @@ on: - cron: "0 3 * * *" push: branches: [master, vara-stage-1, vara-stage-2, vara-stage-3] - pull_request: - branches: [master, vara-stage-1, vara-stage-2, vara-stage-3] - types: [labeled, synchronize] - workflow_dispatch: -concurrency: +concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -37,7 +33,7 @@ jobs: # if: ${{ ! contains(github.event.pull_request.labels.*.name, 'A4-insubstantial') }} # run: ./scripts/check-spec.sh - prepair: + cache: runs-on: ubuntu-latest outputs: sccache_path: ${{ steps.sccache.outputs.sccache_path }} @@ -52,208 +48,17 @@ jobs: echo "sccache_path=$sccache_path" >> $GITHUB_OUTPUT check: - # needs: spec_version - needs: [prepair, check-commit-message] - runs-on: [kuberunner, github-runner-01] - env: - RUSTUP_HOME: /tmp/rustup_home - RUSTC_WRAPPER: sccache - SCCACHE_DIR: ${{ needs.prepair.outputs.sccache_path }} - steps: - - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 - - - name: "Install: Set cargo path" - run: echo "/tmp/cargo/bin" >> $GITHUB_PATH - - - name: "Install: Rust toolchain" - uses: dsherret/rust-toolchain-file@v1 - - - name: "Check formatting: Gear" - run: ./scripts/gear.sh format gear --check - - - name: "Check formatting: Doc" - run: ./scripts/gear.sh format doc --check - - - name: "Check clippy: Gear" - run: ./scripts/gear.sh clippy gear --all-targets --all-features --locked - - - name: "Check clippy: Examples" - run: ./scripts/gear.sh clippy examples --all-targets --locked - - - name: "Test: Doc tests" - run: ./scripts/gear.sh test doc - - - name: "Test: Changes in gsdk generated code" - run: | - GENERATED_CODE="gsdk/src/metadata/generated.rs" - ./scripts/update-gsdk-metadata.sh - if [[ $(git diff --stat $GENERATED_CODE) != '' ]]; then - echo "Changes found in the gsdk generated code ($GENERATED_CODE). Please update it following the instructions in \`gsdk/HOW-TO-UPDATE.md\`." - git --no-pager diff $GENERATED_CODE - exit 1 - fi - - - run: sccache --show-stats + needs: [cache] + uses: ./.github/workflows/check.yml + with: + cache: ${{ needs.cache.outputs.sccache_path }} build: - # needs: spec_version - needs: [prepair, check-commit-message, check-labels] - runs-on: [kuberunner, github-runner-02] - env: - LLVM_PROFILE_FILE: "gear-%p-%m.profraw" - RUSTUP_HOME: /tmp/rustup_home - RUSTC_WRAPPER: sccache - SCCACHE_DIR: ${{ needs.prepair.outputs.sccache_path }} - steps: - - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 - - - name: "Install: Set cargo path" - run: echo "/tmp/cargo/bin" >> $GITHUB_PATH - - - name: "Install: Rust toolchain" - uses: dsherret/rust-toolchain-file@v1 - - - name: "Show: Versioning" - run: ./scripts/gear.sh show - - - name: "Install: grcov" - run: | - curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-musl.tar.bz2 | tar jxf - - ./grcov --version - - - name: "Install: rust-covfix" - run: | - curl -L https://github.com/gear-tech/rust-covfix/releases/download/deploy/rust-covfix-linux-x86_64.tar.xz | tar Jxf - - mv rust-covfix-linux-x86_64/rust-covfix ./ - ./rust-covfix --version - - - name: "ACTIONS: Setup environment variable" - if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') - run: echo "RUSTFLAGS=-Cinstrument-coverage" >> $GITHUB_ENV - - - name: "Buid: Init" - run: ./scripts/gear.sh init cargo - - - name: "Build: Gear" - run: ./scripts/gear.sh build gear --locked --release - - - name: "Build fuzzer" - run: ./scripts/gear.sh build fuzz --locked --release - - - name: "Check: Gear runtime imports" - run: ./target/release/wasm-proc --check-runtime-imports target/release/wbuild/gear-runtime/gear_runtime.compact.wasm - - - name: "Check: Vara runtime imports" - run: ./target/release/wasm-proc --check-runtime-imports target/release/wbuild/vara-runtime/vara_runtime.compact.wasm - - - name: "Test: Gear pallet tests with lazy pages" - run: ./scripts/gear.sh test pallet --features lazy-pages --release --locked - - - name: "Test: Gear workspace" - run: ./scripts/gear.sh test gear --exclude gclient --exclude gcli --exclude gsdk --features pallet-gear-debug/lazy-pages --release --locked - - - name: "Test: gsdk tests" - run: ./scripts/gear.sh test gsdk --release - - - name: "Test: `gcli`" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./scripts/gear.sh test gcli --release --locked --retries 3 - - - name: "Test: Client tests" - run: ./scripts/gear.sh test client --release - - - name: "Test: Runtime benchmarks and benchmark tests work" - run: | - cargo build -p gear-cli --release --features=runtime-benchmarks,runtime-benchmarks-checkers - # check that perf benchmarks works. `--steps=20` need to test, that benchmarks works for different input number. - ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 - # check that check/test benchmarks works - ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_all" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --extra - # check also lazy-pages benchmarks tests for native runtime - ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_lazy_pages_all" --execution=native --heap-pages=4096 --extra - - - name: "Test: Sys-calls Wasmi integrity" - run: ./scripts/gear.sh test syscalls --release - - - name: "Test: `try-runtime` feature tests" - run: | - cargo test -p "pallet-*" --features try-runtime --release --locked - - - name: "Test: Try runtime migrations" - run: | - cargo build -p gear-cli --features try-runtime --release --locked - ./target/release/gear try-runtime --runtime ./target/release/wbuild/gear-runtime/gear_runtime.wasm on-runtime-upgrade --checks live --uri wss://rpc-private-testnet.gear-tech.io:443 - env: - RUST_LOG: info - - - name: "Coverage: Aggregate" - if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') - run: >- - ./grcov . --binary-path ./target/release/ -s . -t lcov --branch --ignore-not-existing - --ignore "/*" - --ignore "examples/*" - --ignore "utils/*" - --ignore "target/*" - --ignore "node/*" - --ignore "program/*" - --ignore "pallets/gear/src/migration.rs" - --ignore "pallets/gear/src/weights.rs" - --ignore "pallets/gear-debug/src/weights.rs" - --ignore "pallets/gear-messenger/src/migration.rs" - --ignore "pallets/gear-program/src/migration.rs" - --ignore "pallets/gear-program/src/weights/*" - --ignore "pallets/usage/src/weights.rs" - --ignore "pallets/usage/src/migration.rs" - --ignore "runtime/*" - --ignore "gcore/*" - --ignore "gstd/*" - --ignore "galloc/*" - --ignore "gtest/*" - --ignore "gclient/*" - -o ./lcov.info - - - name: "Coverage: Fix report" - if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') - run: ./rust-covfix -o lcov.info lcov.info - - - name: "Coverage: Publish" - if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') - uses: codecov/codecov-action@v3 - with: - file: ./lcov.info - - - name: "Build: Production binaries" - if: github.event_name == 'push' - run: cargo build -p gear-cli -F cli --profile production - - - name: Prepare artifacts - if: github.event_name == 'push' - run: | - mkdir -p artifact - cd target/wasm32-unknown-unknown/release - tar czvf ../../../artifact/examples.tar.gz *.wasm - cd ../../.. - cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm artifact/ - cp target/production/wbuild/gear-runtime/gear_runtime.compact.wasm artifact/ - cp target/production/wbuild/gear-runtime/gear_runtime.wasm artifact/ - cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm artifact/ - cp target/production/wbuild/vara-runtime/vara_runtime.compact.wasm artifact/ - cp target/production/wbuild/vara-runtime/vara_runtime.wasm artifact/ - cp target/production/gear artifact/ - cp target/release/wasm-proc artifact/ - strip artifact/gear || true - strip artifact/wasm-proc || true - - - name: Upload artifacts - if: github.event_name == 'push' - uses: actions/upload-artifact@v3 - with: - path: artifact - - - run: sccache --show-stats + needs: [cache] + uses: ./.github/workflows/build.yml + with: + cache: ${{ needs.cache.outputs.sccache_path }} + macos: true build-win-native: if: ${{ github.ref == 'refs/heads/master' }} @@ -337,123 +142,6 @@ jobs: --features=lazy-pages --release - build-win-cross: - needs: [prepair, check-commit-message, check-labels] - runs-on: [kuberunner, github-runner-03] - env: - XWIN_ARCH: x86_64 - RUSTUP_HOME: /tmp/rustup_home - WINEDEBUG: fixme-all - steps: - - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 - - - name: "Install: Set cargo path" - run: echo "/tmp/cargo/bin" >> $GITHUB_PATH - - - name: "Install: Rust toolchain" - uses: dsherret/rust-toolchain-file@v1 - - - name: "Install: MSVC target" - run: rustup target add x86_64-pc-windows-msvc - - - name: "Install: cargo config" - run: cp ./.github/build-win-cross/config.toml ${CARGO_HOME:-~/.cargo}/config.toml - - - name: "Show: Versioning" - run: ./scripts/gear.sh show - - - name: "Install: Wine" - run: | - wineboot - winetricks win10 - - - name: "Install: LLVM" - run: | - sudo ./.github/build-win-cross/update-alternatives-clang.sh 12 100 - - - name: "Install: binaryen" - run: | - sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/binaryen-$BINARYEN_VERSION-x86_64-linux.tar.gz -O - | sudo tar -xz -C . - sudo cp binaryen-$BINARYEN_VERSION/bin/wasm-opt /usr/bin/ - - - name: "Install: cargo-xwin" - run: | - curl -L https://github.com/rust-cross/cargo-xwin/releases/download/v0.14.0/cargo-xwin-v0.14.0.x86_64-unknown-linux-musl.tar.gz | tar zxf - - mv ./cargo-xwin ${CARGO_HOME:-~/.cargo}/bin/ - - - name: "Build: Node" - run: ./scripts/gear.sh build node --release --locked - env: - CARGO_BUILD_TARGET: x86_64-pc-windows-msvc - - # These tests randomly stops responding - - #- name: "Test: Client tests" - # run: | - # cp ./target/x86_64-pc-windows-msvc/release/gear.exe ./target/release/ - # ./scripts/gear.sh test client - # env: - # CARGO_BUILD_TARGET: x86_64-pc-windows-msvc - - - name: "Test: Lazy pages" - run: >- - cargo xwin test - -p "pallet-*" - -p gear-lazy-pages - -p gear-runtime-interface - --features=lazy-pages - --release - env: - CARGO_BUILD_TARGET: x86_64-pc-windows-msvc - - - run: sccache --show-stats - - build-macos-x86: - if: ${{ always() && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E2-forcemacos')) }} - needs: build - runs-on: macos-latest - env: - RUSTUP_HOME: /tmp/rustup_home - steps: - - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 - - - name: "ACTIONS: Setup caching" - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: "Install: protobuf" - run: brew install protobuf - - - name: "Install: Rust toolchain" - uses: dsherret/rust-toolchain-file@v1 - - - name: "Install: cargo-nextest" - run: curl -LsSf https://get.nexte.st/latest/mac | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin - - - name: "Build: Node" - run: >- - cargo build - -p gear-cli --features=lazy-pages - - - name: "Test: Lazy pages" - run: >- - cargo nextest run - -p "pallet-*" - -p gear-lazy-pages - -p gear-runtime-interface - --features=lazy-pages - upload: if: github.event_name == 'push' && github.ref_name == 'master' runs-on: ubuntu-latest @@ -482,48 +170,3 @@ jobs: draft: false fail_on_unmatched_files: true files: artifact/* - - check-fuzzer: - needs: [prepair] - runs-on: [kuberunner, github-runner-01] - env: - RUSTUP_HOME: /tmp/rustup_home - RUSTC_WRAPPER: sccache - SCCACHE_DIR: ${{ needs.prepair.outputs.sccache_path }} - steps: - - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 - - - name: "Install: Set cargo path" - run: echo "/tmp/cargo/bin" >> $GITHUB_PATH - - - name: "Install: Rust toolchain" - uses: dsherret/rust-toolchain-file@v1 - - - name: Install cargo-fuzz - run: cargo install cargo-fuzz - - - name: "Check fuzzer with mutation test" - run: ./scripts/check-fuzzer.sh - - - run: sccache --show-stats - - check-commit-message: - runs-on: ubuntu-latest - outputs: - commit-message: ${{ steps.commit_message.outputs.commitMsg }} - steps: - - name: Get repo - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} - - name: Print head git commit message - id: commit_message - run: echo "commitMsg=$(git show -s --format=%s)" >> $GITHUB_OUTPUT - - check-labels: - runs-on: ubuntu-latest - if: contains(github.event.pull_request.labels.*.name, 'A0-pleasereview') || contains(github.event.pull_request.labels.*.name, 'A2-mergeoncegreen') || github.event_name == 'push' - steps: - - name: Build Condition Passed! - run: echo "bebop" diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml new file mode 100644 index 00000000000..767f6dc3f33 --- /dev/null +++ b/.github/workflows/PR.yml @@ -0,0 +1,60 @@ +name: PR + +on: + pull_request: + branches: [master, vara-stage-1, vara-stage-2, vara-stage-3] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_INCREMENTAL: 0 + CARGO_TERM_COLOR: always + RUST_BACKTRACE: short + TERM: xterm-256color + BINARYEN_VERSION: version_111 + +jobs: + status: + runs-on: ubuntu-latest + outputs: + cache: ${{ steps.check-commit-message.outputs.cache }} + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + + - name: Check Commit Message + id: check-commit-message + run: | + MESSAGE=$(git show -s --format=%s) + CACHE=true + if [[ $MESSAGE == *"[skip-cache]"* ]]; then + CACHE="" + fi + + echo "cache: ${CACHE}" + echo "cache=${CACHE}" >> $GITHUB_OUTPUT + + - name: Set sccache path + if: ${{ steps.check-commit-message.outputs.cache }} + run: | + sccache_path="/mnt/sccache/$(echo ${GITHUB_REF#refs/heads/} | tr / _)" + echo "cache=$sccache_path" >> $GITHUB_OUTPUT + + check: + needs: status + uses: ./.github/workflows/check.yml + with: + cache: ${{ needs.status.outputs.cache }} + + build: + needs: status + if: >- + contains(github.event.pull_request.labels.*.name, 'A0-pleasereview') + || contains(github.event.pull_request.labels.*.name, 'A2-mergeoncegreen') + uses: ./.github/workflows/build.yml + with: + cache: ${{ needs.status.outputs.cache }} + macos: ${{ contains(github.event.pull_request.labels.*.name, 'E2-forcemacos') }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..2577a48204e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,294 @@ +name: Build + +on: + workflow_call: + inputs: + cache: + type: string + required: true + macos: + type: boolean + default: false + +env: + CARGO_INCREMENTAL: 0 + CARGO_TERM_COLOR: always + RUST_BACKTRACE: short + TERM: xterm-256color + BINARYEN_VERSION: version_111 + +jobs: + linux: + runs-on: [kuberunner, github-runner-02] + env: + LLVM_PROFILE_FILE: "gear-%p-%m.profraw" + RUSTUP_HOME: /tmp/rustup_home + RUSTC_WRAPPER: sccache + SCCACHE_DIR: ${{ inputs.cache }} + steps: + - name: "ACTIONS: Checkout" + uses: actions/checkout@v3 + + - name: "Install: Set cargo path" + run: echo "/tmp/cargo/bin" >> $GITHUB_PATH + + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: "Show: Versioning" + run: ./scripts/gear.sh show + + - name: "Install: grcov" + run: | + curl -L https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-musl.tar.bz2 | tar jxf - + ./grcov --version + + - name: "Install: rust-covfix" + run: | + curl -L https://github.com/gear-tech/rust-covfix/releases/download/deploy/rust-covfix-linux-x86_64.tar.xz | tar Jxf - + mv rust-covfix-linux-x86_64/rust-covfix ./ + ./rust-covfix --version + + - name: "ACTIONS: Setup environment variable" + if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') + run: echo "RUSTFLAGS=-Cinstrument-coverage" >> $GITHUB_ENV + + - name: "Buid: Init" + run: ./scripts/gear.sh init cargo + + - name: "Build: Gear" + run: ./scripts/gear.sh build gear --locked --release + + - name: "Build fuzzer" + run: ./scripts/gear.sh build fuzz --locked --release + + - name: "Check: Gear runtime imports" + run: ./target/release/wasm-proc --check-runtime-imports target/release/wbuild/gear-runtime/gear_runtime.compact.wasm + + - name: "Check: Vara runtime imports" + run: ./target/release/wasm-proc --check-runtime-imports target/release/wbuild/vara-runtime/vara_runtime.compact.wasm + + - name: "Test: Gear pallet tests with lazy pages" + run: ./scripts/gear.sh test pallet --features lazy-pages --release --locked + + - name: "Test: Gear workspace" + run: ./scripts/gear.sh test gear --exclude gclient --exclude gcli --exclude gsdk --features pallet-gear-debug/lazy-pages --release --locked + + - name: "Test: gsdk tests" + run: ./scripts/gear.sh test gsdk --release + + - name: "Test: `gcli`" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./scripts/gear.sh test gcli --release --locked --retries 3 + + - name: "Test: Client tests" + run: ./scripts/gear.sh test client --release + + - name: "Test: Runtime benchmarks and benchmark tests work" + run: | + cargo build -p gear-cli --release --features=runtime-benchmarks,runtime-benchmarks-checkers + # check that perf benchmarks works. `--steps=20` need to test, that benchmarks works for different input number. + ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 + # check that check/test benchmarks works + ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_all" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --extra + # check also lazy-pages benchmarks tests for native runtime + ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_lazy_pages_all" --execution=native --heap-pages=4096 --extra + + - name: "Test: Sys-calls Wasmi integrity" + run: ./scripts/gear.sh test syscalls --release + + - name: "Test: `try-runtime` feature tests" + run: | + cargo test -p "pallet-*" --features try-runtime --release --locked + + - name: "Test: Try runtime migrations" + run: | + cargo build -p gear-cli --features try-runtime --release --locked + ./target/release/gear try-runtime --runtime ./target/release/wbuild/gear-runtime/gear_runtime.wasm on-runtime-upgrade --checks live --uri wss://rpc-private-testnet.gear-tech.io:443 + env: + RUST_LOG: info + + - name: "Coverage: Aggregate" + if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') + run: >- + ./grcov . --binary-path ./target/release/ -s . -t lcov --branch --ignore-not-existing + --ignore "/*" + --ignore "examples/*" + --ignore "utils/*" + --ignore "target/*" + --ignore "node/*" + --ignore "program/*" + --ignore "pallets/gear/src/migration.rs" + --ignore "pallets/gear/src/weights.rs" + --ignore "pallets/gear-debug/src/weights.rs" + --ignore "pallets/gear-messenger/src/migration.rs" + --ignore "pallets/gear-program/src/migration.rs" + --ignore "pallets/gear-program/src/weights/*" + --ignore "pallets/usage/src/weights.rs" + --ignore "pallets/usage/src/migration.rs" + --ignore "runtime/*" + --ignore "gcore/*" + --ignore "gstd/*" + --ignore "galloc/*" + --ignore "gtest/*" + --ignore "gclient/*" + -o ./lcov.info + + - name: "Coverage: Fix report" + if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') + run: ./rust-covfix -o lcov.info lcov.info + + - name: "Coverage: Publish" + if: github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'E0-forcecoverage') + uses: codecov/codecov-action@v3 + with: + file: ./lcov.info + + - name: "Build: Production binaries" + if: github.event_name == 'push' + run: cargo build -p gear-cli -F cli --profile production + + - name: Prepare artifacts + if: github.event_name == 'push' + run: | + mkdir -p artifact + cd target/wasm32-unknown-unknown/release + tar czvf ../../../artifact/examples.tar.gz *.wasm + cd ../../.. + cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm artifact/ + cp target/production/wbuild/gear-runtime/gear_runtime.compact.wasm artifact/ + cp target/production/wbuild/gear-runtime/gear_runtime.wasm artifact/ + cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm artifact/ + cp target/production/wbuild/vara-runtime/vara_runtime.compact.wasm artifact/ + cp target/production/wbuild/vara-runtime/vara_runtime.wasm artifact/ + cp target/production/gear artifact/ + cp target/release/wasm-proc artifact/ + strip artifact/gear || true + strip artifact/wasm-proc || true + + - name: Upload artifacts + if: github.event_name == 'push' + uses: actions/upload-artifact@v3 + with: + path: artifact + + - run: sccache --show-stats + + win-cross: + runs-on: [kuberunner, github-runner-03] + env: + XWIN_ARCH: x86_64 + RUSTUP_HOME: /tmp/rustup_home + WINEDEBUG: fixme-all + CARGO_INCREMENTAL: 0 + CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse + steps: + - name: "ACTIONS: Checkout" + uses: actions/checkout@v3 + + - name: "Install: Set cargo path" + run: echo "/tmp/cargo/bin" >> $GITHUB_PATH + + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: "Install: MSVC target" + run: rustup target add x86_64-pc-windows-msvc + + - name: "Install: cargo config" + run: cp ./.github/build-win-cross/config.toml ${CARGO_HOME:-~/.cargo}/config.toml + + - name: "Show: Versioning" + run: ./scripts/gear.sh show + + - name: "Install: Wine" + run: | + wineboot + winetricks win10 + + - name: "Install: LLVM" + run: | + sudo ./.github/build-win-cross/update-alternatives-clang.sh 12 100 + + - name: "Install: binaryen" + run: | + sudo wget -c https://github.com/WebAssembly/binaryen/releases/download/$BINARYEN_VERSION/binaryen-$BINARYEN_VERSION-x86_64-linux.tar.gz -O - | sudo tar -xz -C . + sudo cp binaryen-$BINARYEN_VERSION/bin/wasm-opt /usr/bin/ + + - name: "Install: cargo-xwin" + run: | + curl -L https://github.com/rust-cross/cargo-xwin/releases/download/v0.14.0/cargo-xwin-v0.14.0.x86_64-unknown-linux-musl.tar.gz | tar zxf - + mv ./cargo-xwin ${CARGO_HOME:-~/.cargo}/bin/ + + - name: "Build: Node" + run: ./scripts/gear.sh build node --release --locked + env: + CARGO_BUILD_TARGET: x86_64-pc-windows-msvc + + # These tests randomly stops responding + + #- name: "Test: Client tests" + # run: | + # cp ./target/x86_64-pc-windows-msvc/release/gear.exe ./target/release/ + # ./scripts/gear.sh test client + # env: + # CARGO_BUILD_TARGET: x86_64-pc-windows-msvc + + - name: "Test: Lazy pages" + run: >- + cargo xwin test + -p "pallet-*" + -p gear-lazy-pages + -p gear-runtime-interface + --features=lazy-pages + --release + env: + CARGO_BUILD_TARGET: x86_64-pc-windows-msvc + + - run: sccache --show-stats + + macos-x86: + if: ${{ always() && inputs.macos }} + needs: linux + runs-on: macos-latest + env: + RUSTUP_HOME: /tmp/rustup_home + steps: + - name: "ACTIONS: Checkout" + uses: actions/checkout@v3 + + - name: "ACTIONS: Setup caching" + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: "Install: protobuf" + run: brew install protobuf + + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: "Install: cargo-nextest" + run: curl -LsSf https://get.nexte.st/latest/mac | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin + + - name: "Build: Node" + run: >- + cargo build + -p gear-cli --features=lazy-pages + + - name: "Test: Lazy pages" + run: >- + cargo nextest run + -p "pallet-*" + -p gear-lazy-pages + -p gear-runtime-interface + --features=lazy-pages diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 00000000000..30f8c0f27f6 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,89 @@ +name: Check + +on: + workflow_call: + inputs: + cache: + type: string + required: true + +env: + CARGO_INCREMENTAL: 0 + CARGO_TERM_COLOR: always + RUST_BACKTRACE: short + TERM: xterm-256color + BINARYEN_VERSION: version_111 + +jobs: + linux: + runs-on: [kuberunner, github-runner-01] + env: + RUSTUP_HOME: /tmp/rustup_home + RUSTC_WRAPPER: sccache + SCCACHE_DIR: ${{ inputs.cache }} + steps: + - name: "ACTIONS: Checkout" + uses: actions/checkout@v3 + + - name: "Install: Set cargo path" + run: echo "/tmp/cargo/bin" >> $GITHUB_PATH + + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: "Check formatting: Gear" + run: ./scripts/gear.sh format gear --check + + - name: "Check formatting: Doc" + run: ./scripts/gear.sh format doc --check + + - name: "Check clippy: Gear" + run: ./scripts/gear.sh clippy gear --all-targets --all-features --locked + + - name: "Check clippy: Examples" + run: ./scripts/gear.sh clippy examples --all-targets --locked + + - name: "Test: Doc tests" + run: ./scripts/gear.sh test doc + + - name: "Test: Changes in gsdk generated code" + run: | + GENERATED_CODE="gsdk/src/metadata/generated.rs" + ./scripts/update-gsdk-metadata.sh + if [[ $(git diff --stat $GENERATED_CODE) != '' ]]; then + echo "Changes found in the gsdk generated code ($GENERATED_CODE). Please update it following the instructions in \`gsdk/HOW-TO-UPDATE.md\`." + git --no-pager diff $GENERATED_CODE + exit 1 + fi + + - run: sccache --show-stats + + fuzzer: + runs-on: [kuberunner, github-runner-01] + env: + RUSTUP_HOME: /tmp/rustup_home + RUSTC_WRAPPER: sccache + SCCACHE_DIR: ${{ inputs.cache }} + steps: + - name: Cancel Previous Runs + if: ${{ github.event_name == 'pull_request' }} + uses: styfle/cancel-workflow-action@0.11.0 + with: + access_token: ${{ github.token }} + + - name: "ACTIONS: Checkout" + uses: actions/checkout@v3 + + - name: "Install: Set cargo path" + run: echo "/tmp/cargo/bin" >> $GITHUB_PATH + + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: Install cargo-fuzz + run: cargo install cargo-fuzz + + - name: "Check fuzzer with mutation test" + run: ./scripts/check-fuzzer.sh + + - run: sccache --show-stats From 22845b4e2c0d32f0cc1550778540606c7deb00fc Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Wed, 9 Aug 2023 12:19:24 +0300 Subject: [PATCH 034/165] feat(wasm-gen): Introduce config for always valid gear wasm generation (#3039) --- Cargo.lock | 1 + utils/call-gen/src/claim_value.rs | 11 +- utils/call-gen/src/create_program.rs | 11 +- utils/call-gen/src/lib.rs | 14 ++- utils/call-gen/src/send_message.rs | 11 +- utils/call-gen/src/send_reply.rs | 11 +- utils/call-gen/src/upload_code.rs | 9 +- utils/call-gen/src/upload_program.rs | 8 +- .../src/batch_pool/generators/batch.rs | 12 +- utils/node-loader/src/utils.rs | 32 ++---- utils/runtime-fuzzer/src/lib.rs | 48 +++----- utils/wasm-gen/Cargo.toml | 1 + utils/wasm-gen/src/config.rs | 107 ++++++++++++++++-- utils/wasm-gen/src/config/generator.rs | 8 +- utils/wasm-gen/src/config/module.rs | 28 ++--- utils/wasm-gen/src/generator/memory.rs | 6 +- .../src/generator/syscalls/additional_data.rs | 6 +- utils/wasm-gen/src/lib.rs | 11 +- utils/wasm-gen/src/tests.rs | 50 +++++--- utils/wasm-gen/src/wasm.rs | 45 ++++++-- 20 files changed, 277 insertions(+), 153 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a2ea2cce229..f0f2a59d877 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4341,6 +4341,7 @@ name = "gear-wasm-gen" version = "0.1.0" dependencies = [ "arbitrary", + "gear-core", "gear-utils", "gear-wasm-instrument", "gsys", diff --git a/utils/call-gen/src/claim_value.rs b/utils/call-gen/src/claim_value.rs index c2f24cffd9b..6719b729e3e 100644 --- a/utils/call-gen/src/claim_value.rs +++ b/utils/call-gen/src/claim_value.rs @@ -18,7 +18,10 @@ //! Claim value args generator. -use crate::{impl_convert_traits, CallGenRng, GeneratableCallArgs, NamedCallArgs, Seed}; +use crate::{ + impl_convert_traits, CallGenRng, GearWasmGenConfigsBundle, GeneratableCallArgs, NamedCallArgs, + Seed, +}; use gear_core::ids::MessageId; use gear_utils::{NonEmpty, RingGet}; @@ -32,12 +35,12 @@ impl_convert_traits!(ClaimValueArgs, MessageId, ClaimValue, "claim_value"); impl GeneratableCallArgs for ClaimValueArgs { type FuzzerArgs = (NonEmpty, Seed); - type ConstArgs = (); + type ConstArgs = (); /// Generates `pallet_gear::Pallet::::claim_value` call arguments. - fn generate( + fn generate( (mailbox, rng_seed): Self::FuzzerArgs, - _: Self::ConstArgs, + _: Self::ConstArgs<()>, ) -> Self { let mut rng = Rng::seed_from_u64(rng_seed); diff --git a/utils/call-gen/src/create_program.rs b/utils/call-gen/src/create_program.rs index f3a1dc15d5a..5fffd84aac6 100644 --- a/utils/call-gen/src/create_program.rs +++ b/utils/call-gen/src/create_program.rs @@ -18,7 +18,10 @@ //! Create program call generator. -use crate::{impl_convert_traits, CallGenRng, GeneratableCallArgs, NamedCallArgs, Seed}; +use crate::{ + impl_convert_traits, CallGenRng, GearWasmGenConfigsBundle, GeneratableCallArgs, NamedCallArgs, + Seed, +}; use gear_core::ids::CodeId; use gear_utils::{NonEmpty, RingGet}; @@ -40,12 +43,12 @@ impl_convert_traits!( impl GeneratableCallArgs for CreateProgramArgs { type FuzzerArgs = (NonEmpty, Seed); - type ConstArgs = (u64,); + type ConstArgs = (u64,); /// Generates `pallet_gear::Pallet::::create_program` call arguments. - fn generate( + fn generate( (existing_codes, rng_seed): Self::FuzzerArgs, - (gas_limit,): Self::ConstArgs, + (gas_limit,): Self::ConstArgs<()>, ) -> Self { let mut rng = Rng::seed_from_u64(rng_seed); diff --git a/utils/call-gen/src/lib.rs b/utils/call-gen/src/lib.rs index 6b066cd59b6..0c9bc536724 100644 --- a/utils/call-gen/src/lib.rs +++ b/utils/call-gen/src/lib.rs @@ -34,12 +34,13 @@ pub use send_reply::SendReplyArgs; pub use upload_code::UploadCodeArgs; pub use upload_program::UploadProgramArgs; +pub(crate) use gear_wasm_gen::ConfigsBundle as GearWasmGenConfigsBundle; + #[derive(Debug, Clone, thiserror::Error)] #[error("Can't convert to gear call {0:?} call")] pub struct GearCallConversionError(pub &'static str); pub type Seed = u64; -pub type GearWasmGenConfigsBundle = gear_wasm_gen::ConfigsBundle; /// This trait must be implemented for all argument types /// that are defined in [`GearCall`] variants. @@ -71,10 +72,13 @@ pub trait GeneratableCallArgs { type FuzzerArgs; /// Describes arguments of the test environment, /// that are taken from the it's configuration. - type ConstArgs; + type ConstArgs; /// Generates random arguments for [`GearCall`] variant. - fn generate(_: Self::FuzzerArgs, _: Self::ConstArgs) -> Self; + fn generate( + _: Self::FuzzerArgs, + _: Self::ConstArgs, + ) -> Self; } /// Describes type that can tell for which `gear` call it carries arguments. @@ -146,9 +150,9 @@ macro_rules! impl_named_call_args { /// Function generates WASM-binary of a Gear program with the /// specified `seed`. `programs` may specify addresses which /// can be used for send-calls. -pub fn generate_gear_program( +pub fn generate_gear_program( seed: Seed, - config: GearWasmGenConfigsBundle, + config: C, ) -> Vec { use arbitrary::Unstructured; diff --git a/utils/call-gen/src/send_message.rs b/utils/call-gen/src/send_message.rs index ba40be55a95..302885c32a0 100644 --- a/utils/call-gen/src/send_message.rs +++ b/utils/call-gen/src/send_message.rs @@ -18,7 +18,10 @@ //! Send message args generator. -use crate::{impl_convert_traits, CallGenRng, GeneratableCallArgs, NamedCallArgs, Seed}; +use crate::{ + impl_convert_traits, CallGenRng, GearWasmGenConfigsBundle, GeneratableCallArgs, NamedCallArgs, + Seed, +}; use gear_core::ids::ProgramId; use gear_utils::{NonEmpty, RingGet}; @@ -40,12 +43,12 @@ impl_convert_traits!( impl GeneratableCallArgs for SendMessageArgs { type FuzzerArgs = (NonEmpty, Seed); - type ConstArgs = (u64,); + type ConstArgs = (u64,); /// Generates `pallet_gear::Pallet::::send_message` call arguments. - fn generate( + fn generate( (existing_programs, rng_seed): Self::FuzzerArgs, - (gas_limit,): Self::ConstArgs, + (gas_limit,): Self::ConstArgs<()>, ) -> Self { let mut rng = Rng::seed_from_u64(rng_seed); diff --git a/utils/call-gen/src/send_reply.rs b/utils/call-gen/src/send_reply.rs index dec28c48004..6d604352a91 100644 --- a/utils/call-gen/src/send_reply.rs +++ b/utils/call-gen/src/send_reply.rs @@ -18,7 +18,10 @@ //! Send reply args generator. -use crate::{impl_convert_traits, CallGenRng, GeneratableCallArgs, NamedCallArgs, Seed}; +use crate::{ + impl_convert_traits, CallGenRng, GearWasmGenConfigsBundle, GeneratableCallArgs, NamedCallArgs, + Seed, +}; use gear_core::ids::MessageId; use gear_utils::{NonEmpty, RingGet}; @@ -35,12 +38,12 @@ impl_convert_traits!(SendReplyArgs, SendReplyArgsInner, SendReply, "send_reply") impl GeneratableCallArgs for SendReplyArgs { type FuzzerArgs = (NonEmpty, Seed); - type ConstArgs = (u64,); + type ConstArgs = (u64,); /// Generates `pallet_gear::Pallet::::send_reply` call arguments. - fn generate( + fn generate( (mailbox, rng_seed): Self::FuzzerArgs, - (gas_limit,): Self::ConstArgs, + (gas_limit,): Self::ConstArgs<()>, ) -> Self { let mut rng = Rng::seed_from_u64(rng_seed); diff --git a/utils/call-gen/src/upload_code.rs b/utils/call-gen/src/upload_code.rs index 35f52937fb9..4245cf4e59b 100644 --- a/utils/call-gen/src/upload_code.rs +++ b/utils/call-gen/src/upload_code.rs @@ -33,11 +33,14 @@ impl_convert_traits!(UploadCodeArgs, Vec, UploadCode, "upload_code"); impl GeneratableCallArgs for UploadCodeArgs { type FuzzerArgs = Seed; - type ConstArgs = (GearWasmGenConfigsBundle,); + type ConstArgs = (C,); /// Generates `pallet_gear::Pallet::::upload_code` call arguments. - fn generate(code_seed: Self::FuzzerArgs, (config,): Self::ConstArgs) -> Self { - let code = crate::generate_gear_program::(code_seed, config); + fn generate( + code_seed: Self::FuzzerArgs, + (config,): Self::ConstArgs, + ) -> Self { + let code = crate::generate_gear_program::(code_seed, config); let name = Self::name(); log::debug!("Generated `{name}` with code from seed = {code_seed}"); diff --git a/utils/call-gen/src/upload_program.rs b/utils/call-gen/src/upload_program.rs index 3b9355b2364..7bf28e06384 100644 --- a/utils/call-gen/src/upload_program.rs +++ b/utils/call-gen/src/upload_program.rs @@ -41,16 +41,16 @@ impl_convert_traits!( impl GeneratableCallArgs for UploadProgramArgs { type FuzzerArgs = (Seed, Seed); - type ConstArgs = (u64, GearWasmGenConfigsBundle); + type ConstArgs = (u64, C); /// Generates `pallet_gear::Pallet::::upload_program` call arguments. - fn generate( + fn generate( (code_seed, rng_seed): Self::FuzzerArgs, - (gas_limit, config): Self::ConstArgs, + (gas_limit, config): Self::ConstArgs, ) -> Self { let mut rng = Rng::seed_from_u64(rng_seed); - let code = crate::generate_gear_program::(code_seed, config); + let code = crate::generate_gear_program::(code_seed, config); let mut salt = vec![0; rng.gen_range(1..=100)]; rng.fill_bytes(&mut salt); diff --git a/utils/node-loader/src/batch_pool/generators/batch.rs b/utils/node-loader/src/batch_pool/generators/batch.rs index f5cc4154806..b6da95141ed 100644 --- a/utils/node-loader/src/batch_pool/generators/batch.rs +++ b/utils/node-loader/src/batch_pool/generators/batch.rs @@ -10,7 +10,9 @@ use gear_call_gen::{ CallArgs, CallGenRng, CallGenRngCore, ClaimValueArgs, CreateProgramArgs, SendMessageArgs, SendReplyArgs, UploadCodeArgs, UploadProgramArgs, }; +use gear_core::ids::ProgramId; use gear_utils::NonEmpty; +use gear_wasm_gen::ValidGearWasmConfigsBundle; use std::iter; use tracing::instrument; @@ -143,8 +145,7 @@ impl BatchGenerator { ) -> Batch { match batch_id { 0 => { - let config = - utils::get_config_with_seed_log(seed, context.programs.iter().copied()); + let config = utils::get_wasm_gen_config(seed, context.programs.iter().copied()); Self::gen_batch::( self.batch_size, seed, @@ -153,8 +154,7 @@ impl BatchGenerator { ) } 1 => { - let config = - utils::get_config_with_seed_log(seed, context.programs.iter().copied()); + let config = utils::get_wasm_gen_config(seed, context.programs.iter().copied()); Self::gen_batch::( self.batch_size, seed, @@ -206,7 +206,7 @@ impl BatchGenerator { fn gen_batch< T: CallArgs, FuzzerArgsFn: FnMut(&mut Rng) -> T::FuzzerArgs, - ConstArgsFn: Fn() -> T::ConstArgs, + ConstArgsFn: Fn() -> T::ConstArgs>, >( batch_size: usize, seed: Seed, @@ -225,7 +225,7 @@ impl BatchGenerator { generator_for = T::name(), call_id = i ) - .in_scope(|| T::generate::(fuzzer_args, const_args_fn())) + .in_scope(|| T::generate::(fuzzer_args, const_args_fn())) }) .collect(); diff --git a/utils/node-loader/src/utils.rs b/utils/node-loader/src/utils.rs index bd2d32b1ee2..72f2c3ad2a2 100644 --- a/utils/node-loader/src/utils.rs +++ b/utils/node-loader/src/utils.rs @@ -6,9 +6,7 @@ use gear_call_gen::Seed; use gear_core::ids::{MessageId, ProgramId}; use gear_core_errors::ReplyCode; use gear_utils::NonEmpty; -use gear_wasm_gen::{ - ConfigsBundle, EntryPointsSet, GearWasmGeneratorConfigBuilder, SysCallsConfigBuilder, -}; +use gear_wasm_gen::{EntryPointsSet, ValidGearWasmConfigsBundle}; use gsdk::metadata::runtime_types::{ gear_common::event::DispatchStatus as GenDispatchStatus, gear_core::{ @@ -37,7 +35,10 @@ pub const WAITING_TX_FINALIZED_TIMEOUT_ERR_STR: &str = "Transaction finalization wait timeout is reached"; pub fn dump_with_seed(seed: u64) -> Result<()> { - let code = gear_call_gen::generate_gear_program::(seed, ConfigsBundle::default()); + let code = gear_call_gen::generate_gear_program::( + seed, + ValidGearWasmConfigsBundle::default(), + ); let mut file = File::create("out.wasm")?; file.write_all(&code)?; @@ -204,25 +205,14 @@ pub fn err_waited_or_succeed_batch( } /// Returns configs bundle with a gear wasm generator config, which logs `seed`. -pub fn get_config_with_seed_log( +pub fn get_wasm_gen_config( seed: Seed, existing_programs: impl Iterator, -) -> ConfigsBundle { - let sys_calls_config_builder = SysCallsConfigBuilder::new(Default::default()) - .with_log_info(format!("Gear program seed = '{seed}'")); - let sys_calls_config = if let Some(existing_programs) = NonEmpty::collect(existing_programs) { - sys_calls_config_builder - .with_data_offset_msg_dest(existing_programs) - .build() - } else { - sys_calls_config_builder.with_source_msg_dest().build() - }; - - ConfigsBundle { - gear_wasm_generator_config: GearWasmGeneratorConfigBuilder::new() - .with_entry_points_config(EntryPointsSet::InitHandleHandleReply) - .with_sys_calls_config(sys_calls_config) - .build(), +) -> ValidGearWasmConfigsBundle { + ValidGearWasmConfigsBundle { + log_info: Some(format!("Gear program seed = '{seed}'")), + existing_addresses: NonEmpty::collect(existing_programs), + entry_points_set: EntryPointsSet::InitHandleHandleReply, ..Default::default() } } diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index ab67b11db2d..c7098717bf9 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -26,10 +26,7 @@ use gear_common::event::ProgramChangeKind; use gear_core::ids::ProgramId; use gear_runtime::{AccountId, Gear, Runtime, RuntimeEvent, RuntimeOrigin, System}; use gear_utils::NonEmpty; -use gear_wasm_gen::{ - ConfigsBundle, EntryPointsSet, GearWasmGeneratorConfigBuilder, SelectableParams, - SysCallsConfigBuilder, -}; +use gear_wasm_gen::{EntryPointsSet, ValidGearWasmConfigsBundle}; use once_cell::sync::OnceCell; use pallet_balances::Pallet as BalancesPallet; use pallet_gear::Event; @@ -98,17 +95,18 @@ fn generate_gear_call(seed: u64, context: &ContextMutex) -> Gea let gas_limit = rand.gen_range(0..=default_gas_limit).pow(3) / default_gas_limit.pow(2); match rand.gen_range(0..=1) { - 0 => UploadProgramArgs::generate::( + 0 => UploadProgramArgs::generate::( (rand.next_u64(), rand.next_u64()), (gas_limit, config), ) .into(), 1 => match NonEmpty::from_vec(context.lock().programs.clone()) { - Some(existing_programs) => { - SendMessageArgs::generate::((existing_programs, rand.next_u64()), (gas_limit,)) - .into() - } - None => UploadProgramArgs::generate::( + Some(existing_programs) => SendMessageArgs::generate::( + (existing_programs, rand.next_u64()), + (gas_limit,), + ) + .into(), + None => UploadProgramArgs::generate::( (rand.next_u64(), rand.next_u64()), (gas_limit, config), ) @@ -118,30 +116,14 @@ fn generate_gear_call(seed: u64, context: &ContextMutex) -> Gea } } -fn fuzzer_config(seed: u64, programs: Vec) -> ConfigsBundle { - let sys_calls_config_builder = SysCallsConfigBuilder::new(Default::default()) - .with_log_info(format!("Gear program seed = '{seed}'")); - let sys_calls_config = if let Some(programs) = NonEmpty::from_vec(programs) { - sys_calls_config_builder - .with_data_offset_msg_dest(programs) - .build() - } else { - sys_calls_config_builder.with_source_msg_dest().build() - }; - - let generator_config = GearWasmGeneratorConfigBuilder::new() - .with_entry_points_config(EntryPointsSet::InitHandleHandleReply) - .with_sys_calls_config(sys_calls_config) - .with_recursions_removed(true) - .build(); - - let selectables_config = SelectableParams { +fn fuzzer_config(seed: u64, programs: Vec) -> ValidGearWasmConfigsBundle { + ValidGearWasmConfigsBundle { + log_info: Some(format!("Gear program seed = '{seed}'")), + existing_addresses: NonEmpty::from_vec(programs), + entry_points_set: EntryPointsSet::HandleHandleReply, + remove_recursion: true, call_indirect_enabled: false, - }; - - ConfigsBundle { - gear_wasm_generator_config: generator_config, - module_selectables_config: selectables_config, + ..Default::default() } } diff --git a/utils/wasm-gen/Cargo.toml b/utils/wasm-gen/Cargo.toml index e0365b4c6dd..e838c59592e 100644 --- a/utils/wasm-gen/Cargo.toml +++ b/utils/wasm-gen/Cargo.toml @@ -19,3 +19,4 @@ wasmparser.workspace = true wat.workspace = true indicatif.workspace = true proptest.workspace = true +gear-core.workspace = true diff --git a/utils/wasm-gen/src/config.rs b/utils/wasm-gen/src/config.rs index 38af4bcb31c..10967dd04f7 100644 --- a/utils/wasm-gen/src/config.rs +++ b/utils/wasm-gen/src/config.rs @@ -37,7 +37,7 @@ //! let memory_pages_config = MemoryPagesConfig { //! initial_size: 128, //! upper_limit: None, -//! stack_end: Some(64), +//! stack_end_page: Some(64), //! }; //! let entry_points_set = EntryPointsSet::InitHandle; //! let sys_calls_config = SysCallsConfigBuilder::new(SysCallsInjectionAmounts::all_once()) @@ -69,6 +69,15 @@ //! WasmModuleConfig::arbitrary(u) //! } //! ``` +//! +//! These types of configs instatiations are helpful if you want to call generators +//! manually with some special (maybe not) generators state transition flow. However, +//! for the simplest usage with crate's main generation functions (like +//! [`crate::generate_gear_program_code`] or [`crate::generate_gear_program_module`]) +//! you'd need a configs bundle - type which implements [`ConfigsBundle`]. +//! +//! There's a pre-defined one - [`ValidGearWasmConfigsBundle`], usage of which will result +//! in generation of valid (always) gear-wasm module. mod generator; mod module; @@ -78,13 +87,91 @@ pub use generator::*; pub use module::*; pub use syscalls::*; -/// United config for using the crate. -/// -/// Uses [`SelectableParams`] instead of the [`WasmModuleConfig`], because -/// the former one provides all required from the crate user configurations -/// and all the other configurations are generated internally. -#[derive(Debug, Clone, Default)] -pub struct ConfigsBundle { - pub gear_wasm_generator_config: GearWasmGeneratorConfig, - pub module_selectables_config: SelectableParams, +use gear_utils::NonEmpty; +use gsys::Hash; + +/// Trait which describes a type that stores and manages data for generating +/// [`GearWasmGeneratorConfig`] and [`SelectableParams`], which are both used +/// by [`crate::generate_gear_program_code`] and [`crate::generate_gear_program_module`] +/// to generate a gear wasm. +pub trait ConfigsBundle { + /// Convert a "bundle" type into configs required for gear wasm creation + /// from [`crate::generate_gear_program_code`] and [`crate::generate_gear_program_module`]. + fn into_parts(self) -> (GearWasmGeneratorConfig, SelectableParams); +} + +/// Mock implementation. +impl ConfigsBundle for () { + fn into_parts(self) -> (GearWasmGeneratorConfig, SelectableParams) { + unimplemented!("Mock") + } +} + +/// Set of configurational data which is used to generate always +/// valid gear-wasm using generators of the current crate. +#[derive(Debug, Clone)] +pub struct ValidGearWasmConfigsBundle { + /// Externalities to be logged. + pub log_info: Option, + /// Set of existing addresses, which will be used as message destinations. + /// + /// If is `None`, then `gr_source` result will be used as a message destination. + pub existing_addresses: Option>, + /// Flag which signals whether recursions must be removed. + pub remove_recursion: bool, + /// Flag which signals whether `call_indirect` instruction must not be used + /// during wasm generation. + pub call_indirect_enabled: bool, + /// Injection amount ranges for each sys-call. + pub injection_amounts: SysCallsInjectionAmounts, + /// Config of gear wasm call entry-points (exports). + pub entry_points_set: EntryPointsSet, +} + +impl Default for ValidGearWasmConfigsBundle { + fn default() -> Self { + Self { + log_info: Some("Valid config".into()), + existing_addresses: None, + remove_recursion: false, + call_indirect_enabled: true, + injection_amounts: SysCallsInjectionAmounts::all_once(), + entry_points_set: Default::default(), + } + } +} + +impl> ConfigsBundle for ValidGearWasmConfigsBundle { + fn into_parts(self) -> (GearWasmGeneratorConfig, SelectableParams) { + let ValidGearWasmConfigsBundle { + log_info, + existing_addresses, + remove_recursion, + call_indirect_enabled, + injection_amounts, + entry_points_set, + } = self; + + let selectable_params = SelectableParams { + call_indirect_enabled, + }; + + let mut sys_calls_config_builder = SysCallsConfigBuilder::new(injection_amounts); + if let Some(log_info) = log_info { + sys_calls_config_builder = sys_calls_config_builder.with_log_info(log_info); + } + if let Some(addresses) = existing_addresses { + sys_calls_config_builder = + sys_calls_config_builder.with_data_offset_msg_dest(addresses); + } else { + sys_calls_config_builder = sys_calls_config_builder.with_source_msg_dest(); + } + let gear_wasm_generator_config = GearWasmGeneratorConfigBuilder::new() + .with_recursions_removed(remove_recursion) + .with_sys_calls_config(sys_calls_config_builder.build()) + .with_entry_points_config(entry_points_set) + .build(); + + (gear_wasm_generator_config, selectable_params) + } } diff --git a/utils/wasm-gen/src/config/generator.rs b/utils/wasm-gen/src/config/generator.rs index 675a1607cd6..0fe84d53605 100644 --- a/utils/wasm-gen/src/config/generator.rs +++ b/utils/wasm-gen/src/config/generator.rs @@ -88,16 +88,16 @@ pub struct MemoryPagesConfig { pub initial_size: u32, /// Optional memory maximum. pub upper_limit: Option, - /// Optional stack end. - pub stack_end: Option, + /// Optional stack end page. + pub stack_end_page: Option, } impl Default for MemoryPagesConfig { fn default() -> Self { Self { - initial_size: Self::MAX_VALUE / 2 + 1, + initial_size: Self::MAX_VALUE / 2 + 5, upper_limit: Some(Self::MAX_VALUE), - stack_end: None, + stack_end_page: Some(Self::MAX_VALUE / 2), } } } diff --git a/utils/wasm-gen/src/config/module.rs b/utils/wasm-gen/src/config/module.rs index a077a7eabee..f72aca66281 100644 --- a/utils/wasm-gen/src/config/module.rs +++ b/utils/wasm-gen/src/config/module.rs @@ -76,6 +76,10 @@ impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { allowed_instructions, memory_grow_enabled, min_funcs, + max_data_segments, + min_data_segments, + max_types, + min_types, } = ConstantParams::default(); let SelectableParams { @@ -88,7 +92,6 @@ impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { export_everything, max_aliases, max_components, - max_data_segments, max_element_segments, max_elements, max_globals, @@ -97,17 +100,14 @@ impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { max_nesting_depth, max_tags, max_type_size, - max_types, max_values, memory_max_size_required, memory_offset_choices, - min_data_segments, min_element_segments, min_elements, min_globals, min_tables, min_tags, - min_types, min_uleb_size, threads_enabled, max_table_elements, @@ -185,7 +185,6 @@ pub struct ArbitraryParams { export_everything: bool, max_aliases: usize, max_components: usize, - max_data_segments: usize, max_element_segments: usize, max_elements: usize, max_globals: usize, @@ -194,17 +193,14 @@ pub struct ArbitraryParams { max_nesting_depth: usize, max_tags: usize, max_type_size: u32, - max_types: usize, max_values: usize, memory_max_size_required: bool, memory_offset_choices: (u32, u32, u32), - min_data_segments: usize, min_element_segments: usize, min_elements: usize, min_globals: usize, min_tables: u32, min_tags: usize, - min_types: usize, min_uleb_size: u8, threads_enabled: bool, max_table_elements: u32, @@ -221,7 +217,6 @@ impl Arbitrary<'_> for ArbitraryParams { export_everything, max_aliases, max_components, - max_data_segments, max_element_segments, max_elements, max_globals, @@ -230,17 +225,14 @@ impl Arbitrary<'_> for ArbitraryParams { max_nesting_depth, max_tags, max_type_size, - max_types, max_values, memory_max_size_required, memory_offset_choices, - min_data_segments, min_element_segments, min_elements, min_globals, min_tables, min_tags, - min_types, min_uleb_size, threads_enabled, max_table_elements, @@ -255,7 +247,6 @@ impl Arbitrary<'_> for ArbitraryParams { export_everything, max_aliases, max_components, - max_data_segments, max_element_segments, max_elements, max_globals, @@ -264,17 +255,14 @@ impl Arbitrary<'_> for ArbitraryParams { max_nesting_depth, max_tags, max_type_size, - max_types, max_values, memory_max_size_required, memory_offset_choices, - min_data_segments, min_element_segments, min_elements, min_globals, min_tables, min_tags, - min_types, min_uleb_size, threads_enabled, max_table_elements, @@ -292,14 +280,17 @@ pub struct ConstantParams { allow_start_export: bool, bulk_memory_enabled: bool, exceptions_enabled: bool, + max_data_segments: usize, max_exports: usize, max_imports: usize, + max_types: usize, max_instructions: usize, max_memories: usize, min_memories: u32, max_tables: usize, memory64_enabled: bool, min_exports: usize, + min_data_segments: usize, max_funcs: usize, min_imports: usize, multi_value_enabled: bool, @@ -312,6 +303,7 @@ pub struct ConstantParams { allowed_instructions: InstructionKinds, memory_grow_enabled: bool, min_funcs: usize, + min_types: usize, } impl Default for ConstantParams { @@ -343,6 +335,10 @@ impl Default for ConstantParams { max_instructions: 100_000, min_funcs: 15, max_funcs: 100, + max_data_segments: 0, + min_data_segments: 0, + max_types: 100, + min_types: 5, } } } diff --git a/utils/wasm-gen/src/generator/memory.rs b/utils/wasm-gen/src/generator/memory.rs index 41af193f330..54280ff85fc 100644 --- a/utils/wasm-gen/src/generator/memory.rs +++ b/utils/wasm-gen/src/generator/memory.rs @@ -20,6 +20,7 @@ use crate::{ generator::{CallIndexes, FrozenGearWasmGenerator, GearWasmGenerator, ModuleWithCallIndexes}, + wasm::WASM_PAGE_SIZE, MemoryPagesConfig, WasmModule, }; use gear_wasm_instrument::{ @@ -81,7 +82,7 @@ impl MemoryGenerator { MemoryPagesConfig { initial_size, upper_limit, - stack_end, + stack_end_page, }, } = self; @@ -97,7 +98,8 @@ impl MemoryGenerator { .build(); // Define optional stack-end - if let Some(stack_end) = stack_end { + if let Some(stack_end_page) = stack_end_page { + let stack_end = stack_end_page * WASM_PAGE_SIZE; module = builder::from_module(module) .global() .value_type() diff --git a/utils/wasm-gen/src/generator/syscalls/additional_data.rs b/utils/wasm-gen/src/generator/syscalls/additional_data.rs index 3489e163e9d..8e14ce676cc 100644 --- a/utils/wasm-gen/src/generator/syscalls/additional_data.rs +++ b/utils/wasm-gen/src/generator/syscalls/additional_data.rs @@ -80,10 +80,14 @@ impl<'a> SysCallsImportsGenerationProof, ), ) -> Self { + let data_offset = disabled_gen + .module + .get_stack_end_offset() + .unwrap_or_default(); Self { unstructured: disabled_gen.unstructured, config: disabled_gen.config, - last_offset: 0, + last_offset: data_offset as u32, module: disabled_gen.module, addresses_offsets: Vec::new(), sys_calls_imports: disabled_gen.sys_calls_imports, diff --git a/utils/wasm-gen/src/lib.rs b/utils/wasm-gen/src/lib.rs index e2506955fa2..d72e58dc512 100644 --- a/utils/wasm-gen/src/lib.rs +++ b/utils/wasm-gen/src/lib.rs @@ -45,9 +45,9 @@ use gear_wasm_instrument::parity_wasm::{self, elements::Module}; /// Generate gear program as raw bytes. pub fn generate_gear_program_code<'a>( u: &'a mut Unstructured<'a>, - config: ConfigsBundle, + configs_bundle: impl ConfigsBundle, ) -> Result> { - let module = generate_gear_program_module(u, config)?; + let module = generate_gear_program_module(u, configs_bundle)?; Ok(parity_wasm::serialize(module).expect("unable to serialize pw module")) } @@ -55,12 +55,9 @@ pub fn generate_gear_program_code<'a>( /// Generate gear program as [`parity_wasm::elements::Module`](https://docs.rs/parity-wasm/latest/parity_wasm/elements/struct.Module.html) pub fn generate_gear_program_module<'a>( u: &'a mut Unstructured<'a>, - config: ConfigsBundle, + configs_bundle: impl ConfigsBundle, ) -> Result { - let ConfigsBundle { - gear_wasm_generator_config, - module_selectables_config, - } = config; + let (gear_wasm_generator_config, module_selectables_config) = configs_bundle.into_parts(); let arbitrary_params = u.arbitrary::()?; let wasm_module = diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index 2144d0b26b2..a962649a224 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -16,33 +16,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use crate::wasm::WASM_PAGE_SIZE; + use super::*; use arbitrary::Unstructured; +use gear_core::code::Code; use gear_utils::NonEmpty; use gear_wasm_instrument::parity_wasm::{ self, elements::{Instruction, Module}, }; +use proptest::prelude::*; use rand::{rngs::SmallRng, RngCore, SeedableRng}; use std::mem; const UNSTRUCTURED_SIZE: usize = 1_000_000; -#[test] -fn check_default_configuration_fuzz() { - let mut rng = SmallRng::seed_from_u64(1234); - - for _ in 0..100 { - let mut buf = vec![0; UNSTRUCTURED_SIZE]; - rng.fill_bytes(&mut buf); - let mut u = Unstructured::new(&buf); - - let module = generate_gear_program_module(&mut u, ConfigsBundle::default()); - assert!(module.is_ok()); - assert!(module.expect("checked").into_bytes().is_ok()); - } -} - #[test] fn remove_trivial_recursions() { let wat1 = r#" @@ -130,8 +119,14 @@ fn injecting_addresses_works() { rng.fill_bytes(&mut buf); let mut u = Unstructured::new(&buf); + let stack_end_page = 16; let addresses = NonEmpty::from_vec(vec![[0; 32], [1; 32]]).expect("vec wasn't empty"); let config = GearWasmGeneratorConfigBuilder::new() + .with_memory_config(MemoryPagesConfig { + initial_size: 17, + upper_limit: None, + stack_end_page: Some(stack_end_page), + }) .with_sys_calls_config( SysCallsConfigBuilder::new(Default::default()) .with_data_offset_msg_dest(addresses) @@ -170,7 +165,7 @@ fn injecting_addresses_works() { }; // No additional data, except for addresses. // First entry set to the 0 offset. - assert_eq!(ptr, &0); + assert_eq!(*ptr, (stack_end_page * WASM_PAGE_SIZE) as i32); let second_addr_offset = entries .get(1) @@ -182,5 +177,26 @@ fn injecting_addresses_works() { }; // No additional data, except for addresses. // First entry set to the 0 offset. - assert_eq!(ptr, &size); + assert_eq!(*ptr, size + (stack_end_page * WASM_PAGE_SIZE) as i32); +} + +proptest! { + #![proptest_config(ProptestConfig::with_cases(100))] + #[test] + // Test that valid config always generates a valid gear wasm. + fn test_valid_config(buf in prop::collection::vec(any::(), UNSTRUCTURED_SIZE)) { + use gear_wasm_instrument::wasm_instrument::gas_metering::ConstantCostRules; + let mut u = Unstructured::new(&buf); + let configs_bundle: ValidGearWasmConfigsBundle = ValidGearWasmConfigsBundle { + log_info: Some("Some data".into()), + entry_points_set: EntryPointsSet::InitHandleHandleReply, + ..Default::default() + }; + + let raw_code = generate_gear_program_code(&mut u, configs_bundle) + .expect("failed generating wasm"); + + let code_res = Code::try_new(raw_code, 1, |_| ConstantCostRules::default(), None); + assert!(code_res.is_ok()); + } } diff --git a/utils/wasm-gen/src/wasm.rs b/utils/wasm-gen/src/wasm.rs index c236a59bc99..2e058681033 100644 --- a/utils/wasm-gen/src/wasm.rs +++ b/utils/wasm-gen/src/wasm.rs @@ -19,9 +19,12 @@ use crate::{config::WasmModuleConfig, EntryPointName}; use arbitrary::{Arbitrary, Result, Unstructured}; use core::mem; -use gear_wasm_instrument::parity_wasm::{ - self, - elements::{External, Internal, Module}, +use gear_wasm_instrument::{ + parity_wasm::{ + self, + elements::{External, Instruction, Internal, Module}, + }, + STACK_END_EXPORT_NAME, }; use wasm_smith::Module as WasmSmithModule; @@ -52,9 +55,9 @@ impl WasmModule { config: WasmModuleConfig, u: &mut Unstructured<'_>, ) -> Result { - let mut pw_module = Self::generate_wasm_smith_module(config.clone(), u)?; - while pw_module.function_section().is_none() { - pw_module = Self::generate_wasm_smith_module(config.clone(), u)?; + let pw_module = Self::generate_wasm_smith_module(config, u)?; + if pw_module.function_section().is_none() { + panic!("WasmModule::generate_with_config: `wasm-smith` config doesn't guarantee having function section!"); } Ok(Self(pw_module)) @@ -89,6 +92,32 @@ impl WasmModule { }) } + pub fn get_stack_end_offset(&self) -> Option { + let stack_end_global_index = self + .0 + .export_section()? + .entries() + .iter() + .find(|export| export.field() == STACK_END_EXPORT_NAME) + .and_then(|export_entry| match export_entry.internal() { + Internal::Global(idx) => Some(*idx), + _ => None, + })?; + + let stack_end_init_expr = self + .0 + .global_section()? + .entries() + .get(stack_end_global_index as usize)? + .init_expr() + .code(); + + match (&stack_end_init_expr[0], &stack_end_init_expr[1]) { + (Instruction::I32Const(offset), Instruction::End) => Some(*offset), + _ => None, + } + } + /// Gets the export function index of the gear entry point. pub fn gear_entry_point(&self, ep: EntryPointName) -> Option { self.0.export_section().and_then(|export_section| { @@ -138,7 +167,7 @@ impl WasmModule { } /// WASM page has size of 64KiBs (65_536 bytes) -pub(crate) const PAGE_SIZE: u32 = 0x10000; +pub(crate) const WASM_PAGE_SIZE: u32 = 0x10000; /// Struct for indexing WASM memory page. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] @@ -163,6 +192,6 @@ impl From for PageCount { impl PageCount { /// Calculate WASM memory size for this pages count. pub(crate) fn memory_size(&self) -> u32 { - self.0 * PAGE_SIZE + self.0 * WASM_PAGE_SIZE } } From e3705f49196800cc6a23d5b083c4175b4f2970d0 Mon Sep 17 00:00:00 2001 From: Fluid <90795031+fluiderson@users.noreply.github.com> Date: Wed, 9 Aug 2023 12:24:17 +0300 Subject: [PATCH 035/165] fix(gstd): log the panic message for the debugging convenience (#3045) --- gstd/src/common/handlers.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/gstd/src/common/handlers.rs b/gstd/src/common/handlers.rs index 3789bb533b7..64006c4cc41 100644 --- a/gstd/src/common/handlers.rs +++ b/gstd/src/common/handlers.rs @@ -76,5 +76,6 @@ pub fn panic(panic_info: &PanicInfo) -> ! { _ => ext::panic("no info"), }; + crate::debug!("panic occurred: {msg}"); ext::panic(&msg) } From 620e3a50df10d9942b53fe1df23e494cda2a7d54 Mon Sep 17 00:00:00 2001 From: Gregory Sobol Date: Wed, 9 Aug 2023 17:43:11 +0300 Subject: [PATCH 036/165] fix calc gas: enable process queue before calculation (#3043) --- pallets/gear/src/lib.rs | 74 ++++++++++++++++++--------------- pallets/gear/src/runtime_api.rs | 9 +--- 2 files changed, 41 insertions(+), 42 deletions(-) diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 2b32daed045..0b9d03d6cfd 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -770,11 +770,13 @@ pub mod pallet { log::debug!("\n===== CALCULATE GAS INFO =====\n"); log::debug!("\n--- FIRST TRY ---\n"); - let GasInfo { - min_limit, waited, .. - } = Self::run_with_ext_copy(|| { - let initial_gas = BlockGasLimitOf::::get(); - Self::calculate_gas_info_impl( + let calc_gas = |initial_gas| { + // `calculate_gas_info_impl` may change `GasAllowanceOf` and `QueueProcessingOf`. + // We don't wanna this behavior in tests, so restore old gas allowance value + // after gas calculation. + let gas_allowance = GasAllowanceOf::::get(); + let queue_processing = QueueProcessingOf::::allowed(); + let res = Self::calculate_gas_info_impl( source, kind.clone(), initial_gas, @@ -782,8 +784,20 @@ pub mod pallet { value, allow_other_panics, allow_skip_zero_replies, - ) - .map_err(|e| { + ); + GasAllowanceOf::::put(gas_allowance); + if queue_processing { + QueueProcessingOf::::allow(); + } else { + QueueProcessingOf::::deny(); + } + res + }; + + let GasInfo { + min_limit, waited, .. + } = Self::run_with_ext_copy(|| { + calc_gas(BlockGasLimitOf::::get()).map_err(|e| { String::from_utf8(e) .unwrap_or_else(|_| String::from("Failed to parse error to string")) }) @@ -792,33 +806,25 @@ pub mod pallet { log::debug!("\n--- SECOND TRY ---\n"); let res = Self::run_with_ext_copy(|| { - Self::calculate_gas_info_impl( - source, - kind, - min_limit, - payload, - value, - allow_other_panics, - allow_skip_zero_replies, - ) - .map( - |GasInfo { - reserved, - burned, - may_be_returned, - .. - }| GasInfo { - min_limit, - reserved, - burned, - may_be_returned, - waited, - }, - ) - .map_err(|e| { - String::from_utf8(e) - .unwrap_or_else(|_| String::from("Failed to parse error to string")) - }) + calc_gas(min_limit) + .map( + |GasInfo { + reserved, + burned, + may_be_returned, + .. + }| GasInfo { + min_limit, + reserved, + burned, + may_be_returned, + waited, + }, + ) + .map_err(|e| { + String::from_utf8(e) + .unwrap_or_else(|_| String::from("Failed to parse error to string")) + }) }); log::debug!("\n==============================\n"); diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index b3efd92ede1..27ce6adb85f 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -107,15 +107,8 @@ where let mut ext_manager = ExtManager::::default(); - // Gas calculation info should not depend on the current block gas allowance. - // We set it to 'block gas limit" * RUNTIME_API_BLOCK_LIMITS_COUNT for the calculation purposes with a subsequent restore. - // This is done in order to avoid abusing running node. If one wants to check - // executions exceeding the set threshold, they can build their own node with that - // parameter set to a higher value. - let gas_allowance = GasAllowanceOf::::get(); GasAllowanceOf::::put(BlockGasLimitOf::::get() * RUNTIME_API_BLOCK_LIMITS_COUNT); - // Restore gas allowance. - let _guard = scopeguard::guard((), |_| GasAllowanceOf::::put(gas_allowance)); + QueueProcessingOf::::allow(); loop { if QueueProcessingOf::::denied() { From 2cf69d6021098450987ec4e1fd8983b9216f60ca Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Thu, 10 Aug 2023 18:09:10 +0800 Subject: [PATCH 037/165] ci(build): remove sccache status in win-cross (#3046) --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2577a48204e..40c838c53b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -246,8 +246,6 @@ jobs: env: CARGO_BUILD_TARGET: x86_64-pc-windows-msvc - - run: sccache --show-stats - macos-x86: if: ${{ always() && inputs.macos }} needs: linux From 062a9005a811eaddcff1fa09f83103b587cf4be1 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Thu, 10 Aug 2023 22:37:40 +0800 Subject: [PATCH 038/165] feat(gsdk): introduce events API (#2979) --- Cargo.lock | 2 +- common/src/paused_program_storage.rs | 5 +- core/src/code.rs | 3 +- examples/constructor/src/call.rs | 44 ++++++-- gclient/src/api/calls.rs | 6 +- gclient/src/api/listener/iterator.rs | 2 +- gclient/src/api/listener/subscription.rs | 4 +- gclient/src/api/rpc.rs | 2 +- gmeta/codegen/src/lib.rs | 4 +- gsdk/src/api.rs | 115 +++++++++++++++++++ gsdk/src/lib.rs | 134 +++++++++-------------- gsdk/src/result.rs | 2 +- gsdk/src/rpc.rs | 6 +- gsdk/src/signer/calls.rs | 25 ++--- gsdk/src/signer/rpc.rs | 4 +- gsdk/src/signer/utils.rs | 4 +- gsdk/src/storage.rs | 11 +- gsdk/src/subscription.rs | 84 ++++++++++++++ gsdk/src/types.rs | 104 ------------------ node/service/src/rpc/runtime_info.rs | 11 +- pallets/gear-debug/src/tests.rs | 21 ++-- pallets/gear/src/manager/task.rs | 5 +- pallets/gear/src/runtime_api.rs | 7 +- utils/validator-checks/Cargo.toml | 2 +- utils/validator-checks/src/listener.rs | 5 +- utils/wasm-builder/src/stack_end.rs | 6 +- 26 files changed, 362 insertions(+), 256 deletions(-) create mode 100644 gsdk/src/api.rs create mode 100644 gsdk/src/subscription.rs delete mode 100644 gsdk/src/types.rs diff --git a/Cargo.lock b/Cargo.lock index f0f2a59d877..290dbcc7f11 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4300,7 +4300,7 @@ version = "0.1.0" dependencies = [ "clap 4.3.19", "env_logger", - "futures-util", + "futures", "gsdk", "log", "parity-scale-codec", diff --git a/common/src/paused_program_storage.rs b/common/src/paused_program_storage.rs index 19e9275999c..8ff2ba57ef3 100644 --- a/common/src/paused_program_storage.rs +++ b/common/src/paused_program_storage.rs @@ -240,7 +240,8 @@ pub trait PausedProgramStorage: super::ProgramStorage { None => return Err(Self::InternalError::resume_session_not_found().into()), }; - let Some((_block_number, hash)) = Self::PausedProgramMap::get(&session.program_id) else { + let Some((_block_number, hash)) = Self::PausedProgramMap::get(&session.program_id) + else { let result = ResumeResult { end_block: session.end_block, info: None, @@ -250,7 +251,7 @@ pub trait PausedProgramStorage: super::ProgramStorage { Self::SessionMemoryPages::remove(session_id); *maybe_session = None; - return Ok(result) + return Ok(result); }; if !Self::CodeStorage::exists(session.code_hash) { diff --git a/core/src/code.rs b/core/src/code.rs index c45d0f228c7..1069659c8c7 100644 --- a/core/src/code.rs +++ b/core/src/code.rs @@ -127,7 +127,8 @@ fn get_global_init_const_i32(module: &Module, global_index: u32) -> Result Result<(), CodeError> { - let Some(&stack_end_global_index) = get_export_global_index(module, STACK_END_EXPORT_NAME) else { + let Some(&stack_end_global_index) = get_export_global_index(module, STACK_END_EXPORT_NAME) + else { return Ok(()); }; let stack_end_offset = get_global_init_const_i32(module, stack_end_global_index)?; diff --git a/examples/constructor/src/call.rs b/examples/constructor/src/call.rs index 3c768ea91da..c3264e5ac90 100644 --- a/examples/constructor/src/call.rs +++ b/examples/constructor/src/call.rs @@ -59,7 +59,9 @@ mod wasm { // TODO: expand to be able store mid and pid separately. fn create_program(self) -> Option> { - let Self::CreateProgram(code_id, salt, payload, gas_limit, value, delay) = self else { unreachable!() }; + let Self::CreateProgram(code_id, salt, payload, gas_limit, value, delay) = self else { + unreachable!() + }; let code_id = code_id.value().into(); let salt = salt.value(); @@ -86,7 +88,9 @@ mod wasm { } fn reply_deposit(self) -> Option> { - let Self::ReplyDeposit(message_id, gas_limit) = self else { unreachable!() }; + let Self::ReplyDeposit(message_id, gas_limit) = self else { + unreachable!() + }; let message_id = message_id.value().into(); let gas_limit = gas_limit.value(); @@ -129,13 +133,17 @@ mod wasm { } fn store(self, previous: Option) -> Option> { - let Self::Store(key) = self.clone() else { unreachable!() }; + let Self::Store(key) = self.clone() else { + unreachable!() + }; self.store_impl(key, previous, false) } fn store_vec(self, previous: Option) -> Option> { - let Self::StoreVec(key) = self.clone() else { unreachable!() }; + let Self::StoreVec(key) = self.clone() else { + unreachable!() + }; self.store_impl(key, previous, true) } @@ -157,7 +165,9 @@ mod wasm { } fn panic(self) -> ! { - let Self::Panic(msg) = self else { unreachable!() }; + let Self::Panic(msg) = self else { + unreachable!() + }; if let Some(msg) = msg { panic!("{msg}"); @@ -167,7 +177,9 @@ mod wasm { } fn send(self) -> Option> { - let Self::Send(destination, payload, gas_limit, value, delay) = self else { unreachable!() }; + let Self::Send(destination, payload, gas_limit, value, delay) = self else { + unreachable!() + }; let destination = destination.value().into(); let payload = payload.value(); @@ -192,7 +204,9 @@ mod wasm { } fn reply(self) -> Option> { - let Self::Reply(payload, gas_limit, value) = self else { unreachable!() }; + let Self::Reply(payload, gas_limit, value) = self else { + unreachable!() + }; let payload = payload.value(); let value = value.value(); @@ -209,7 +223,9 @@ mod wasm { } fn exit(self) -> ! { - let Self::Exit(inheritor) = self else { unreachable!() }; + let Self::Exit(inheritor) = self else { + unreachable!() + }; let inheritor = inheritor.value().into(); @@ -217,7 +233,9 @@ mod wasm { } fn bytes_eq(self) -> Option> { - let Self::BytesEq(left, right) = self else { unreachable!() }; + let Self::BytesEq(left, right) = self else { + unreachable!() + }; let left = left.value(); let right = right.value(); @@ -226,7 +244,9 @@ mod wasm { } fn if_else(self, previous: Option) -> Option> { - let Self::IfElse(flag, true_call, false_call) = self else { unreachable!() }; + let Self::IfElse(flag, true_call, false_call) = self else { + unreachable!() + }; let flag = flag.value(); @@ -262,7 +282,9 @@ mod wasm { } fn wake(self) -> Option> { - let Self::Wake(message_id) = self else { unreachable!() }; + let Self::Wake(message_id) = self else { + unreachable!() + }; let message_id = message_id.value().into(); diff --git a/gclient/src/api/calls.rs b/gclient/src/api/calls.rs index f8b95e77360..a912d4a73e6 100644 --- a/gclient/src/api/calls.rs +++ b/gclient/src/api/calls.rs @@ -49,7 +49,7 @@ use gsdk::{ utility::Event as UtilityEvent, Convert, Event, }, - types, Error as GsdkError, + Error as GsdkError, GearGasNode, GearGasNodeId, }; use hex::ToHex; use parity_scale_codec::{Decode, Encode}; @@ -306,7 +306,7 @@ impl GearApi { .gpages_at(src_program_id, &src_program, src_block_hash) .await?; - let src_program_reserved_gas_node_ids: Vec = src_program + let src_program_reserved_gas_node_ids: Vec = src_program .gas_reservation_map .iter() .map(|gr| gr.0.into()) @@ -321,7 +321,7 @@ impl GearApi { let mut src_program_reserved_gas_total = 0u64; let mut accounts_with_reserved_funds = HashSet::new(); for gas_node in &src_program_reserved_gas_nodes { - if let types::GearGasNode::Reserved { + if let GearGasNode::Reserved { id, value, lock, .. } = &gas_node.1 { diff --git a/gclient/src/api/listener/iterator.rs b/gclient/src/api/listener/iterator.rs index 982e218f10a..8e42252fc75 100644 --- a/gclient/src/api/listener/iterator.rs +++ b/gclient/src/api/listener/iterator.rs @@ -23,7 +23,7 @@ use gsdk::{ config::GearConfig, ext::sp_core::H256, metadata::{gear::Event as GearEvent, Event}, - types::Blocks, + Blocks, }; use subxt::events::Events; diff --git a/gclient/src/api/listener/subscription.rs b/gclient/src/api/listener/subscription.rs index 5dbeadc4017..9b50614c90d 100644 --- a/gclient/src/api/listener/subscription.rs +++ b/gclient/src/api/listener/subscription.rs @@ -19,10 +19,10 @@ use super::EventProcessor; use crate::{Error, Result}; use async_trait::async_trait; -use gsdk::metadata::{gear_runtime::RuntimeEvent, Event}; +use gsdk::Event; #[async_trait(?Send)] -impl + Clone> EventProcessor for I { +impl + Clone> EventProcessor for I { fn not_waited() -> Error { Error::EventNotFoundInIterator } diff --git a/gclient/src/api/rpc.rs b/gclient/src/api/rpc.rs index 630b8830624..5f0e67ec612 100644 --- a/gclient/src/api/rpc.rs +++ b/gclient/src/api/rpc.rs @@ -19,7 +19,7 @@ use crate::{api::Result, GearApi}; use gear_core::ids::{CodeId, MessageId, ProgramId}; -use gsdk::{ext::sp_core::H256, types::GasInfo}; +use gsdk::{ext::sp_core::H256, GasInfo}; use parity_scale_codec::{Decode, Encode}; use std::path::Path; diff --git a/gmeta/codegen/src/lib.rs b/gmeta/codegen/src/lib.rs index 489d3499a78..e971c8616de 100644 --- a/gmeta/codegen/src/lib.rs +++ b/gmeta/codegen/src/lib.rs @@ -191,7 +191,7 @@ fn process(module: ItemMod) -> Result { let Some((_, items)) = module.content else { return error( module_span, - "`#[metawasm]` doesn't work with modules without a body" + "`#[metawasm]` doesn't work with modules without a body", ); }; @@ -252,7 +252,7 @@ fn process(module: ItemMod) -> Result { let Item::Fn(function) = potential_function else { return error( potential_function, - "rest of items in a module with `#[metawasm]` must be functions" + "rest of items in a module with `#[metawasm]` must be functions", ); }; diff --git a/gsdk/src/api.rs b/gsdk/src/api.rs new file mode 100644 index 00000000000..6826e76d276 --- /dev/null +++ b/gsdk/src/api.rs @@ -0,0 +1,115 @@ +// This file is part of Gear. +// +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{client::RpcClient, config::GearConfig, signer::Signer, Blocks, Events, Result}; +use core::ops::{Deref, DerefMut}; +use std::sync::Arc; +use subxt::OnlineClient; + +/// Gear api wrapper. +#[derive(Clone)] +pub struct Api { + /// How many times we'll retry when rpc requests failed. + pub retry: u16, + client: OnlineClient, +} + +impl Api { + /// Create new API client. + pub async fn new(url: Option<&str>) -> Result { + Self::new_with_timeout(url, None).await + } + + /// Create new API client with timeout. + pub async fn new_with_timeout(url: Option<&str>, timeout: Option) -> Result { + Ok(Self { + // Retry our failed RPC requests for 5 times by default. + retry: 5, + client: OnlineClient::from_rpc_client(Arc::new(RpcClient::new(url, timeout).await?)) + .await?, + }) + } + + /// Setup retry times and return the API instance. + pub fn with_retry(mut self, retry: u16) -> Self { + self.retry = retry; + self + } + + /// Subscribe all blocks + /// + /// + /// ```ignore + /// let api = Api::new(None).await?; + /// let blocks = api.blocks().await?; + /// + /// while let Ok(block) = blocks.next().await { + /// // ... + /// } + /// ``` + pub async fn blocks(&self) -> Result { + Ok(self.client.blocks().subscribe_all().await?.into()) + } + + /// Subscribe finalized blocks + /// + /// Same as `blocks` but only finalized blocks. + pub async fn finalized_blocks(&self) -> Result { + Ok(self.client.blocks().subscribe_finalized().await?.into()) + } + + /// Subscribe all events. + /// + /// ```ignore + /// let api = Api::new(None).await?; + /// let events = api.events().await?; + /// + /// while let Ok(evs) = events.next().await { + /// // ... + /// } + /// ``` + pub async fn events(&self) -> Result { + Ok(self.client.blocks().subscribe_all().await?.into()) + } + + /// Subscribe finalized events + /// + /// Same as `events` but only finalized events. + pub async fn finalized_events(&self) -> Result { + Ok(self.client.blocks().subscribe_finalized().await?.into()) + } + + /// New signer from api + pub fn signer(self, suri: &str, passwd: Option<&str>) -> Result { + Signer::new(self, suri, passwd) + } +} + +impl Deref for Api { + type Target = OnlineClient; + + fn deref(&self) -> &Self::Target { + &self.client + } +} + +impl DerefMut for Api { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.client + } +} diff --git a/gsdk/src/lib.rs b/gsdk/src/lib.rs index c479ae28c6a..1bbf37d138f 100644 --- a/gsdk/src/lib.rs +++ b/gsdk/src/lib.rs @@ -17,17 +17,32 @@ // along with this program. If not, see . //! Gear api -use client::RpcClient; -use config::GearConfig; -use core::ops::{Deref, DerefMut}; -pub use result::{Error, Result}; -pub use signer::PairSigner; -use signer::Signer; -use std::sync::Arc; +pub use crate::{ + api::Api, + metadata::Event, + result::{Error, Result}, + signer::PairSigner, + subscription::{Blocks, Events}, +}; +use crate::{ + config::GearConfig, + metadata::runtime_types::gear_common::{ + gas_provider::node::{GasNode, GasNodeId}, + ActiveProgram, + }, +}; +use gear_core::ids::{MessageId, ReservationId}; +use parity_scale_codec::{Decode, Encode}; +use serde::{Deserialize, Serialize}; +use sp_runtime::AccountId32; +use std::collections::HashMap; pub use subxt::dynamic::Value; -use subxt::OnlineClient; -pub mod testing; +use subxt::{ + tx::{TxInBlock as SubxtTxInBlock, TxStatus as SubxtTxStatus}, + OnlineClient, +}; +mod api; mod client; pub mod config; mod constants; @@ -37,8 +52,10 @@ pub mod result; mod rpc; pub mod signer; mod storage; -pub mod types; +pub mod subscription; +pub mod testing; mod utils; + pub mod ext { pub use sp_core; pub use sp_runtime::{self, codec, scale_info}; @@ -51,84 +68,41 @@ pub mod gp { }; } +/// Block number type pub type BlockNumber = u32; -/// Gear api wrapper. -#[derive(Clone)] -pub struct Api { - /// How many times we'll retry when rpc requests failed. - pub retry: u16, - client: OnlineClient, +/// Information of gas +#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, Serialize, Deserialize)] +pub struct GasInfo { + /// Represents minimum gas limit required for execution. + pub min_limit: u64, + /// Gas amount that we reserve for some other on-chain interactions. + pub reserved: u64, + /// Contains number of gas burned during message processing. + pub burned: u64, } -impl Api { - /// Create new API client. - pub async fn new(url: Option<&str>) -> Result { - Self::new_with_timeout(url, None).await - } +/// Gear gas node id. +pub type GearGasNodeId = GasNodeId; - /// Create new API client with timeout. - pub async fn new_with_timeout(url: Option<&str>, timeout: Option) -> Result { - Ok(Self { - // Retry our failed RPC requests for 5 times by default. - retry: 5, - client: OnlineClient::from_rpc_client(Arc::new(RpcClient::new(url, timeout).await?)) - .await?, - }) - } +/// Gear gas node. +pub type GearGasNode = GasNode; - /// Setup retry times and return the API instance. - pub fn with_retry(mut self, retry: u16) -> Self { - self.retry = retry; - self - } +/// Gear pages. +pub type GearPages = HashMap>; - /// Subscribe all blocks - /// - /// # Parse events from blocks - /// - /// ```ignore - /// use gsdk::metadata::{Event, system}; - /// - /// let api = Api::new(None).await?; - /// let mut blocks = api.blocks().await?; - /// - /// while let Some(Ok(events)) = blocks.next_events().await { - /// for event in events { - /// let ev = event.as_root_event::(); - /// - /// // Match events here. - /// matches!(ev, Event::System(system::Event::ExtrinsicSuccess(_))); - /// } - /// } - /// ``` - pub async fn blocks(&self) -> Result { - Ok(types::Blocks(self.client.blocks().subscribe_all().await?)) - } +/// Transaction in block. +pub type TxInBlock = SubxtTxInBlock>; - /// Subscribe finalized blocks - pub async fn finalized_blocks(&self) -> Result { - Ok(types::Blocks( - self.client.blocks().subscribe_finalized().await?, - )) - } +/// Transaction in block with result wrapper. +pub type TxInBlockResult = Result; - /// New signer from api - pub fn signer(self, suri: &str, passwd: Option<&str>) -> Result { - Signer::new(self, suri, passwd) - } -} - -impl Deref for Api { - type Target = OnlineClient; - - fn deref(&self) -> &Self::Target { - &self.client - } -} +/// Transaction status. +pub type TxStatus = SubxtTxStatus>; -impl DerefMut for Api { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.client - } +/// Gear Program +#[derive(Debug, Decode)] +pub enum Program { + Active(ActiveProgram), + Terminated, } diff --git a/gsdk/src/result.rs b/gsdk/src/result.rs index a430c382e69..a70041e23bb 100644 --- a/gsdk/src/result.rs +++ b/gsdk/src/result.rs @@ -17,7 +17,7 @@ // along with this program. If not, see . //! GSdk Results -use crate::types::TxStatus; +use crate::TxStatus; use sp_core::H256; /// Transaction Errors diff --git a/gsdk/src/rpc.rs b/gsdk/src/rpc.rs index f704242e788..12c7d4d7948 100644 --- a/gsdk/src/rpc.rs +++ b/gsdk/src/rpc.rs @@ -16,9 +16,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -//! gear api rpc methods -#![allow(clippy::too_many_arguments)] -use crate::{result::Result, types::GasInfo, Api}; +//! Gear API RPC methods + +use crate::{result::Result, Api, GasInfo}; use gear_core::ids::{CodeId, MessageId, ProgramId}; use sp_core::H256; use subxt::rpc::rpc_params; diff --git a/gsdk/src/signer/calls.rs b/gsdk/src/signer/calls.rs index 901a41a928e..80479d3306f 100644 --- a/gsdk/src/signer/calls.rs +++ b/gsdk/src/signer/calls.rs @@ -33,9 +33,8 @@ use crate::{ Event, }, signer::Signer, - types::{self, InBlock, TxStatus}, utils::storage_address_bytes, - Api, BlockNumber, Error, + Api, BlockNumber, Error, GearGasNode, GearGasNodeId, GearPages, Result, TxInBlock, TxStatus, }; use anyhow::anyhow; use gear_core::{ @@ -61,7 +60,7 @@ type EventsResult = Result, Error>; // pallet-balances impl Signer { /// `pallet_balances::transfer` - pub async fn transfer(&self, dest: impl Into, value: u128) -> InBlock { + pub async fn transfer(&self, dest: impl Into, value: u128) -> Result { self.run_tx( BalancesCall::Transfer, vec![ @@ -83,7 +82,7 @@ impl Signer { payload: Vec, gas_limit: u64, value: u128, - ) -> InBlock { + ) -> Result { self.run_tx( GearCall::CreateProgram, vec![ @@ -98,7 +97,7 @@ impl Signer { } /// `pallet_gear::claim_value` - pub async fn claim_value(&self, message_id: MessageId) -> InBlock { + pub async fn claim_value(&self, message_id: MessageId) -> Result { self.run_tx(GearCall::ClaimValue, vec![Value::from_bytes(message_id)]) .await } @@ -110,7 +109,7 @@ impl Signer { payload: Vec, gas_limit: u64, value: u128, - ) -> InBlock { + ) -> Result { self.run_tx( GearCall::SendMessage, vec![ @@ -130,7 +129,7 @@ impl Signer { payload: Vec, gas_limit: u64, value: u128, - ) -> InBlock { + ) -> Result { self.run_tx( GearCall::SendReply, vec![ @@ -144,7 +143,7 @@ impl Signer { } /// `pallet_gear::upload_code` - pub async fn upload_code(&self, code: Vec) -> InBlock { + pub async fn upload_code(&self, code: Vec) -> Result { self.run_tx(GearCall::UploadCode, vec![Value::from_bytes(code)]) .await } @@ -157,7 +156,7 @@ impl Signer { payload: Vec, gas_limit: u64, value: u128, - ) -> InBlock { + ) -> Result { self.run_tx( GearCall::UploadProgram, vec![ @@ -175,7 +174,7 @@ impl Signer { // pallet-utility impl Signer { /// `pallet_utility::force_batch` - pub async fn force_batch(&self, calls: Vec) -> InBlock { + pub async fn force_batch(&self, calls: Vec) -> Result { self.run_tx( UtilityCall::ForceBatch, vec![calls.into_iter().map(Value::from).collect::>()], @@ -261,7 +260,7 @@ impl Signer { /// Writes Gear gas nodes into storage at their ids. pub async fn set_gas_nodes( &self, - gas_nodes: &impl AsRef<[(types::GearGasNodeId, types::GearGasNode)]>, + gas_nodes: &impl AsRef<[(GearGasNodeId, GearGasNode)]>, ) -> EventsResult { let gas_nodes = gas_nodes.as_ref(); let mut gas_nodes_to_set = Vec::with_capacity(gas_nodes.len()); @@ -297,7 +296,7 @@ impl Signer { pub async fn set_gpages( &self, program_id: ProgramId, - program_pages: &types::GearPages, + program_pages: &GearPages, ) -> EventsResult { let mut program_pages_to_set = Vec::with_capacity(program_pages.len()); for program_page in program_pages { @@ -376,7 +375,7 @@ impl Signer { } /// Listen transaction process and print logs. - pub async fn process<'a>(&self, tx: DynamicPayload) -> InBlock { + pub async fn process<'a>(&self, tx: DynamicPayload) -> Result { use subxt::tx::TxStatus::*; let before = self.balance().await?; diff --git a/gsdk/src/signer/rpc.rs b/gsdk/src/signer/rpc.rs index a3bf58404cd..6fa642be1c1 100644 --- a/gsdk/src/signer/rpc.rs +++ b/gsdk/src/signer/rpc.rs @@ -17,8 +17,8 @@ // along with this program. If not, see . //! RPC calls with signer -#![allow(clippy::too_many_arguments)] -use crate::{result::Result, signer::Signer, types::GasInfo}; + +use crate::{result::Result, signer::Signer, GasInfo}; use gear_core::ids::{CodeId, MessageId, ProgramId}; use sp_core::H256; diff --git a/gsdk/src/signer/utils.rs b/gsdk/src/signer/utils.rs index 954231b6f31..e815cf92efc 100644 --- a/gsdk/src/signer/utils.rs +++ b/gsdk/src/signer/utils.rs @@ -19,7 +19,7 @@ //! Utils use crate::{ - config::GearConfig, metadata::CallInfo, result::Result, signer::Signer, types::InBlock, Error, + config::GearConfig, metadata::CallInfo, result::Result, signer::Signer, Error, TxInBlock, }; use scale_value::Composite; use subxt::blocks::ExtrinsicEvents; @@ -83,7 +83,7 @@ impl Signer { &self, call: Call, fields: impl Into>, - ) -> InBlock { + ) -> Result { let tx = subxt::dynamic::tx(Call::PALLET, call.call_name(), fields.into()); self.process(tx).await diff --git a/gsdk/src/storage.rs b/gsdk/src/storage.rs index 780dd747dc7..974787f026e 100644 --- a/gsdk/src/storage.rs +++ b/gsdk/src/storage.rs @@ -32,9 +32,8 @@ use crate::{ }, }, result::{Error, Result}, - types, utils::storage_address_bytes, - Api, BlockNumber, + Api, BlockNumber, GearGasNode, GearGasNodeId, GearPages, }; use anyhow::anyhow; use gear_core::ids::*; @@ -108,7 +107,7 @@ impl Api { } /// Get program pages from program id. - pub async fn program_pages(&self, pid: ProgramId) -> Result { + pub async fn program_pages(&self, pid: ProgramId) -> Result { let program = self.gprog(pid).await?; self.gpages(pid, &program).await } @@ -183,9 +182,9 @@ impl Api { #[storage_fetch] pub async fn gas_nodes_at( &self, - gas_node_ids: &impl AsRef<[types::GearGasNodeId]>, + gas_node_ids: &impl AsRef<[GearGasNodeId]>, block_hash: Option, - ) -> Result> { + ) -> Result> { let gas_node_ids = gas_node_ids.as_ref(); let mut gas_nodes = Vec::with_capacity(gas_node_ids.len()); @@ -299,7 +298,7 @@ impl Api { program_id: ProgramId, program: &ActiveProgram, block_hash: Option, - ) -> Result { + ) -> Result { let mut pages = HashMap::new(); for page in &program.pages_with_data { diff --git a/gsdk/src/subscription.rs b/gsdk/src/subscription.rs new file mode 100644 index 00000000000..2d0d18f72fb --- /dev/null +++ b/gsdk/src/subscription.rs @@ -0,0 +1,84 @@ +// This file is part of Gear. +// +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Subscription implementation. + +use crate::{config::GearConfig, metadata::Event}; +use futures::{Stream, StreamExt}; +use std::{marker::Unpin, pin::Pin, result::Result as StdResult, task::Poll}; +use subxt::{blocks::Block, events::Events as SubxtEvents, Error, OnlineClient}; + +type SubxtBlock = Block>; +type BlockSubscription = Pin> + Send>>; + +/// Subscription of finalized blocks. +pub struct Blocks(BlockSubscription); + +impl Unpin for Blocks {} + +impl Stream for Blocks { + type Item = StdResult; + + fn poll_next( + mut self: Pin<&mut Self>, + cx: &mut std::task::Context<'_>, + ) -> Poll> { + let res = futures::ready!(self.0.poll_next_unpin(cx)); + + Poll::Ready(res) + } +} + +impl Blocks { + /// Wait for the next block from the subscription. + pub async fn next_events(&mut self) -> Option, Error>> { + if let Some(block) = StreamExt::next(self).await { + Some(block.ok()?.events().await) + } else { + None + } + } +} + +impl From for Blocks { + fn from(sub: BlockSubscription) -> Self { + Self(sub) + } +} + +/// Subscription of events. +pub struct Events(Blocks); + +impl Events { + /// Wait for the next events from the subscription. + pub async fn next(&mut self) -> Option, Error>> { + self.0.next_events().await.map(|r| { + r.and_then(|es| { + es.iter() + .map(|ev| ev.and_then(|e| e.as_root_event::())) + .collect::, Error>>() + }) + }) + } +} + +impl From for Events { + fn from(sub: BlockSubscription) -> Self { + Self(sub.into()) + } +} diff --git a/gsdk/src/types.rs b/gsdk/src/types.rs deleted file mode 100644 index ffedb789b53..00000000000 --- a/gsdk/src/types.rs +++ /dev/null @@ -1,104 +0,0 @@ -// This file is part of Gear. -// -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Shared types -use crate::{ - config::GearConfig, - metadata::runtime_types::gear_common::{ - gas_provider::node::{GasNode, GasNodeId}, - ActiveProgram, - }, - result::Result, - BlockNumber, -}; -use futures::{Stream, StreamExt}; -use gear_core::ids::*; -use parity_scale_codec::{Decode, Encode}; -use serde::{Deserialize, Serialize}; -use sp_runtime::AccountId32; -use std::{collections::HashMap, marker::Unpin, pin::Pin, result::Result as StdResult, task::Poll}; -use subxt::{ - blocks::Block, - events::Events, - tx::{self, TxInBlock}, - Error, OnlineClient, -}; - -type SubxtBlock = Block>; - -/// Subscription of finalized blocks. -pub struct Blocks(pub Pin> + Send>>); - -impl Unpin for Blocks {} - -impl Stream for Blocks { - type Item = StdResult>, Error>; - - fn poll_next( - mut self: Pin<&mut Self>, - cx: &mut std::task::Context<'_>, - ) -> Poll> { - let res = futures::ready!(self.0.poll_next_unpin(cx)); - - Poll::Ready(res) - } -} - -impl Blocks { - /// Wait for the next item from the subscription. - pub async fn next_events(&mut self) -> Option, Error>> { - if let Some(block) = StreamExt::next(self).await { - Some(block.ok()?.events().await) - } else { - None - } - } -} - -/// Information of gas -#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, Serialize, Deserialize)] -pub struct GasInfo { - /// Represents minimum gas limit required for execution. - pub min_limit: u64, - /// Gas amount that we reserve for some other on-chain interactions. - pub reserved: u64, - /// Contains number of gas burned during message processing. - pub burned: u64, -} - -/// Gear gas node id. -pub type GearGasNodeId = GasNodeId; - -/// Gear gas node. -pub type GearGasNode = GasNode; - -/// Gear pages. -pub type GearPages = HashMap>; - -/// Transaction in block. -pub type InBlock = Result>>; - -/// Transaction status. -pub type TxStatus = tx::TxStatus>; - -/// Gear Program -#[derive(Debug, Decode)] -pub enum Program { - Active(ActiveProgram), - Terminated, -} diff --git a/node/service/src/rpc/runtime_info.rs b/node/service/src/rpc/runtime_info.rs index e5350a5738a..d7d02c8b96a 100644 --- a/node/service/src/rpc/runtime_info.rs +++ b/node/service/src/rpc/runtime_info.rs @@ -71,13 +71,20 @@ where &sp_storage::StorageKey(sp_core::storage::well_known_keys::CODE.into()), ) .map_err(map_err_into_rpc_err)?; - let Some(wasm_blob_data) = wasm_blob_data else { return Err(rpc_err("Unable to find WASM blob in storage", None)); }; + let Some(wasm_blob_data) = wasm_blob_data else { + return Err(rpc_err("Unable to find WASM blob in storage", None)); + }; let wasm_runtime_blob = RuntimeBlob::uncompress_if_needed(&wasm_blob_data.0).map_err(map_err_into_rpc_err)?; let wasm_blob_version = wasm_runtime_blob.custom_section_contents("wasm_blob_version"); - let Some(wasm_blob_version) = wasm_blob_version else { return Err(rpc_err("Unable to find WASM blob version in WASM blob", None)); }; + let Some(wasm_blob_version) = wasm_blob_version else { + return Err(rpc_err( + "Unable to find WASM blob version in WASM blob", + None, + )); + }; let wasm_blob_version = String::from_utf8(wasm_blob_version.into()).map_err(map_err_into_rpc_err)?; diff --git a/pallets/gear-debug/src/tests.rs b/pallets/gear-debug/src/tests.rs index 644bf47ddb7..2fb9e2fca10 100644 --- a/pallets/gear-debug/src/tests.rs +++ b/pallets/gear-debug/src/tests.rs @@ -104,16 +104,21 @@ fn vec() { let program_details = &snapshot.programs[0]; assert_eq!(program_details.id, vec_id); - let crate::ProgramState::Active(ref program_info) = program_details.state else { panic!("Inactive program") }; + let crate::ProgramState::Active(ref program_info) = program_details.state else { + panic!("Inactive program") + }; assert_eq!(program_info.code_hash, code_id.into_origin()); - let pages = program_info.persistent_pages.keys().fold(BTreeSet::new(), |mut set, page| { - let page = page.to_page::().raw(); - if page >= static_pages { - set.insert(page); - } - set - }); + let pages = program_info + .persistent_pages + .keys() + .fold(BTreeSet::new(), |mut set, page| { + let page = page.to_page::().raw(); + if page >= static_pages { + set.insert(page); + } + set + }); let pages = pages.into_iter().collect::>(); assert_eq!(pages, vec![17, 18]); diff --git a/pallets/gear/src/manager/task.rs b/pallets/gear/src/manager/task.rs index 5f27762f3d1..75cda3d6b78 100644 --- a/pallets/gear/src/manager/task.rs +++ b/pallets/gear/src/manager/task.rs @@ -51,8 +51,9 @@ where let Some(init_message_id) = program.is_uninitialized() else { // pause initialized program - let gas_reservation_map = ProgramStorageOf::::pause_program(program_id, Pallet::::block_number()) - .unwrap_or_else(|e| unreachable!("Failed to pause program: {:?}", e)); + let gas_reservation_map = + ProgramStorageOf::::pause_program(program_id, Pallet::::block_number()) + .unwrap_or_else(|e| unreachable!("Failed to pause program: {:?}", e)); // clean wait list from the messages let reason = MessageWokenSystemReason::ProgramGotInitialized.into_reason(); diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index 27ce6adb85f..d7a259c4b10 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -117,8 +117,11 @@ where ); } - let Some(queued_dispatch) = QueueOf::::dequeue() - .map_err(|_| b"MQ storage corrupted".to_vec())? else { break; }; + let Some(queued_dispatch) = + QueueOf::::dequeue().map_err(|_| b"MQ storage corrupted".to_vec())? + else { + break; + }; let actor_id = queued_dispatch.destination(); diff --git a/utils/validator-checks/Cargo.toml b/utils/validator-checks/Cargo.toml index dc991c8ab55..346637e4353 100644 --- a/utils/validator-checks/Cargo.toml +++ b/utils/validator-checks/Cargo.toml @@ -12,7 +12,7 @@ gsdk.workspace = true clap = { workspace = true, features = ["derive"] } subxt.workspace = true thiserror.workspace = true -futures-util.workspace = true +futures.workspace = true log.workspace = true env_logger.workspace = true tokio = { workspace = true, features = [ "full" ] } diff --git a/utils/validator-checks/src/listener.rs b/utils/validator-checks/src/listener.rs index ae004684f02..edb3d1a0091 100644 --- a/utils/validator-checks/src/listener.rs +++ b/utils/validator-checks/src/listener.rs @@ -4,14 +4,13 @@ use crate::{ cmd::Opt, result::{Error, Result}, }; -use futures_util::StreamExt; +use futures::StreamExt; use gsdk::{ ext::{ sp_core::crypto::{PublicError, Ss58Codec}, sp_runtime::AccountId32, }, - types::Blocks, - Api, + Api, Blocks, }; use std::{result::Result as StdResult, time::Instant}; diff --git a/utils/wasm-builder/src/stack_end.rs b/utils/wasm-builder/src/stack_end.rs index 0a0490161dc..529ec48fd52 100644 --- a/utils/wasm-builder/src/stack_end.rs +++ b/utils/wasm-builder/src/stack_end.rs @@ -109,9 +109,9 @@ pub fn insert_start_call_in_export_funcs(module: &mut Module) -> Result<(), &'st .ok_or("Cannot find export section")? .entries() .iter() - .find(|export| export.field() == export_name) else - { - continue + .find(|export| export.field() == export_name) + else { + continue; }; let index = match export.internal() { From 412549d1eed0e49bb41d8bf589a70d2cbd1fbaab Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Fri, 11 Aug 2023 02:47:35 +0800 Subject: [PATCH 039/165] chore(wasm-instrument): replace wasm-instrument with gwasm-instrument (#3054) --- Cargo.lock | 27 +++++++++++++++++---------- Cargo.toml | 14 ++++++++++++-- utils/wasm-instrument/Cargo.toml | 4 ++-- utils/wasm-instrument/src/lib.rs | 4 ++-- utils/wasm-instrument/src/rules.rs | 2 +- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 290dbcc7f11..022a331ce7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4310,6 +4310,12 @@ dependencies = [ "tokio", ] +[[package]] +name = "gear-wasm" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f745ed9eb163f4509f01d5564e37db52ec43dd23569bafdba597a5f1e4c125c9" + [[package]] name = "gear-wasm-builder" version = "0.1.2" @@ -4362,7 +4368,7 @@ dependencies = [ "gear-backend-common", "gear-backend-wasmi", "gear-core", - "wasm-instrument 0.2.1", + "gwasm-instrument", "wasmparser-nostd 0.100.1", "wat", ] @@ -4682,6 +4688,15 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "gwasm-instrument" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcb127cb43d375de7cdacffd0e4e1c746e52381d11a0465909ae6fbecb99c6c3" +dependencies = [ + "gear-wasm", +] + [[package]] name = "h2" version = "0.3.20" @@ -9735,7 +9750,7 @@ dependencies = [ "sp-maybe-compressed-blob", "sp-wasm-interface 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "thiserror", - "wasm-instrument 0.3.0", + "wasm-instrument", "wasmi 0.13.2", ] @@ -13509,14 +13524,6 @@ dependencies = [ "parity-wasm 0.45.0", ] -[[package]] -name = "wasm-instrument" -version = "0.2.1" -source = "git+https://github.com/gear-tech/wasm-instrument.git?branch=gear-stable#756a8b92dab5a5fa841226eebbaf215812262e3b" -dependencies = [ - "parity-wasm 0.45.0", -] - [[package]] name = "wasm-instrument" version = "0.3.0" diff --git a/Cargo.toml b/Cargo.toml index 3b118cf293b..62364bafda1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -183,6 +183,18 @@ which = "4.4.0" winapi = "0.3.9" paste = "1.0" +# Published deps +# +# fork of `parity-wasm` with sign-ext enabled by default. +# +# https://github.com/gear-tech/parity-wasm/tree/v0.45.0-sign-ext +# gear-wasm = "0.45.0" +# +# fork of `wasm-instrument` +# +# https://github.com/gear-tech/wasm-instrument/tree/v0.2.1-sign-ext +gwasm-instrument = { version = "0.2.1", default-features = false } + # Internal deps authorship = { package = "gear-authorship", path = "node/authorship" } common = { package = "gear-common", path = "common", default-features = false } @@ -240,8 +252,6 @@ service = { package = "gear-service", path = "node/service", default-features = testing = { package = "gear-node-testing", path = "node/testing" } vara-runtime = { path = "runtime/vara" } wasm-smith = { version = "0.11.4", git = "https://github.com/gear-tech/wasm-tools.git", branch = "gear-stable" } -wasm-instrument = { version = "0.2.1", git = "https://github.com/gear-tech/wasm-instrument.git", branch = "gear-stable", default-features = false } - validator-set = { package = 'substrate-validator-set', git = 'https://github.com/gear-tech/substrate-validator-set.git', branch = 'gear-polkadot-v0.9.41-canary-no-sandbox', default-features = false } # Substrate deps diff --git a/utils/wasm-instrument/Cargo.toml b/utils/wasm-instrument/Cargo.toml index 60481ba5ed4..d887f347280 100644 --- a/utils/wasm-instrument/Cargo.toml +++ b/utils/wasm-instrument/Cargo.toml @@ -6,7 +6,7 @@ edition.workspace = true license.workspace = true [dependencies] -wasm-instrument = { workspace = true, features = ["sign_ext"] } +gwasm-instrument = { workspace = true, features = ["sign_ext"] } enum-iterator.workspace = true [dev-dependencies] @@ -20,6 +20,6 @@ gear-core.workspace = true default = ["std"] std = [ "gear-backend-wasmi/std", - "wasm-instrument/std", "gear-backend-wasmi/std", + "gwasm-instrument/std", ] diff --git a/utils/wasm-instrument/src/lib.rs b/utils/wasm-instrument/src/lib.rs index 5bdb2dcf0f6..f3c04017d87 100644 --- a/utils/wasm-instrument/src/lib.rs +++ b/utils/wasm-instrument/src/lib.rs @@ -23,7 +23,7 @@ extern crate alloc; use alloc::vec; -use wasm_instrument::{ +use gwasm_instrument::{ gas_metering::{self, Rules}, parity_wasm::{ builder, @@ -32,7 +32,7 @@ use wasm_instrument::{ }; use crate::syscalls::SysCallName; -pub use wasm_instrument::{self, parity_wasm}; +pub use gwasm_instrument::{self as wasm_instrument, parity_wasm}; #[cfg(test)] mod tests; diff --git a/utils/wasm-instrument/src/rules.rs b/utils/wasm-instrument/src/rules.rs index 8037061dc08..5b8132e635e 100644 --- a/utils/wasm-instrument/src/rules.rs +++ b/utils/wasm-instrument/src/rules.rs @@ -1,5 +1,5 @@ use core::num::NonZeroU32; -use wasm_instrument::{ +use gwasm_instrument::{ gas_metering::{MemoryGrowCost, Rules}, parity_wasm::elements::{self, Instruction}, }; From d684d0d21406f7f48bb7db20222179f33cfc8006 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:36:01 +0800 Subject: [PATCH 040/165] ci(build): make workflow build dispatchable (#3049) --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40c838c53b4..56712d14826 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,7 @@ on: macos: type: boolean default: false + workflow_dispatch: env: CARGO_INCREMENTAL: 0 From 8262b28865ce03a0d8d14d033b0516405cb26e34 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:44:31 +0300 Subject: [PATCH 041/165] chore(ci): remove missing label in `combined-dependabot.yml` (#3066) --- .github/workflows/combined-dependabot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/combined-dependabot.yml b/.github/workflows/combined-dependabot.yml index 06f0d0f4db8..822fbb5c237 100644 --- a/.github/workflows/combined-dependabot.yml +++ b/.github/workflows/combined-dependabot.yml @@ -137,7 +137,7 @@ jobs: mergeFailedPRs.push(prString); } } - + console.log('Creating combined PR'); const combinedPRsString = combinedPRs.join('\n'); let body = '✅ This PR was created by the Combine PRs action by combining the following PRs:\n' + combinedPRsString; @@ -161,7 +161,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: pull.number, - labels: [ "A4-insubstantial", "E1-forcewindows", "E2-forcemacos" ] + labels: [ "A4-insubstantial", "E2-forcemacos" ] }); } catch (e) { console.log("Failed to add labels:", e); From c32c72c4b97d96009e25b7c7ae84c26ba41bd83b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 13 Aug 2023 12:49:14 +0300 Subject: [PATCH 042/165] deps: combine dependabot's PRs (#3065) --- Cargo.lock | 64 +++++++++++++++++++++++++++++++----------------------- Cargo.toml | 6 ++--- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 022a331ce7e..87e614fc2c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -188,6 +188,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -1062,9 +1068,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.19" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" dependencies = [ "clap_builder", "clap_derive 4.3.12", @@ -1073,9 +1079,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.19" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" dependencies = [ "anstream", "anstyle", @@ -1938,7 +1944,7 @@ dependencies = [ "gear-wasm-builder", "gmeta", "gstd", - "hashbrown 0.13.2", + "hashbrown 0.14.0", "rand 0.8.5", "statrs", "tokio", @@ -3128,7 +3134,7 @@ dependencies = [ "Inflector", "array-bytes", "chrono", - "clap 4.3.19", + "clap 4.3.21", "comfy-table", "frame-benchmarking", "frame-support", @@ -3583,7 +3589,7 @@ version = "0.2.2" dependencies = [ "anyhow", "base64 0.21.2", - "clap 4.3.19", + "clap 4.3.21", "color-eyre", "demo-messager", "demo-new-meta", @@ -3773,7 +3779,7 @@ dependencies = [ name = "gear-bags-thresholds" version = "1.0.0" dependencies = [ - "clap 4.3.19", + "clap 4.3.21", "generate-bags", "vara-runtime", ] @@ -3797,7 +3803,7 @@ dependencies = [ name = "gear-cli" version = "0.2.2" dependencies = [ - "clap 4.3.19", + "clap 4.3.21", "frame-benchmarking", "frame-benchmarking-cli", "frame-system", @@ -3873,7 +3879,7 @@ dependencies = [ "env_logger", "gear-core-errors", "gear-wasm-instrument", - "hashbrown 0.13.2", + "hashbrown 0.14.0", "hex", "log", "parity-scale-codec", @@ -3955,7 +3961,7 @@ version = "0.2.2" dependencies = [ "anyhow", "arbitrary", - "clap 4.3.19", + "clap 4.3.21", "dyn-clonable", "futures", "futures-timer", @@ -4024,7 +4030,7 @@ dependencies = [ name = "gear-replay-cli" version = "1.0.0" dependencies = [ - "clap 4.3.19", + "clap 4.3.21", "frame-remote-externalities", "frame-system", "gear-runtime", @@ -4298,7 +4304,7 @@ dependencies = [ name = "gear-validator-checks" version = "0.1.0" dependencies = [ - "clap 4.3.19", + "clap 4.3.21", "env_logger", "futures", "gsdk", @@ -4377,7 +4383,7 @@ dependencies = [ name = "gear-weight-diff" version = "1.0.0" dependencies = [ - "clap 4.3.19", + "clap 4.3.21", "frame-support", "gear-runtime", "indexmap 2.0.0", @@ -4638,7 +4644,7 @@ dependencies = [ "gcore", "gear-core-errors", "gstd-codegen", - "hashbrown 0.13.2", + "hashbrown 0.14.0", "hex", "parity-scale-codec", "primitive-types", @@ -4777,6 +4783,10 @@ name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +dependencies = [ + "ahash 0.8.3", + "allocator-api2", +] [[package]] name = "heck" @@ -5125,9 +5135,9 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "indicatif" -version = "0.17.5" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff8cc23a7393a397ed1d7f56e6365cba772aba9f9912ab968b03043c395d057" +checksum = "0b297dc40733f23a0e52728a58fa9489a5b7638a324932de16b41adc3ef80730" dependencies = [ "console", "instant", @@ -7438,7 +7448,7 @@ dependencies = [ "frame-system", "gear-common", "gear-core", - "hashbrown 0.13.2", + "hashbrown 0.14.0", "log", "pallet-authorship", "pallet-balances", @@ -8931,7 +8941,7 @@ dependencies = [ name = "regression-analysis" version = "0.1.0" dependencies = [ - "clap 4.3.19", + "clap 4.3.21", "frame-support", "gear-runtime", "junit-common", @@ -9132,7 +9142,7 @@ version = "0.1.0" dependencies = [ "anyhow", "arbitrary", - "clap 4.3.19", + "clap 4.3.21", "frame-support", "frame-system", "gear-call-gen", @@ -9450,7 +9460,7 @@ source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0 dependencies = [ "array-bytes", "chrono", - "clap 4.3.19", + "clap 4.3.21", "fdlimit", "futures", "libp2p", @@ -10228,7 +10238,7 @@ name = "sc-storage-monitor" version = "0.1.0" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" dependencies = [ - "clap 4.3.19", + "clap 4.3.21", "fs4", "futures", "log", @@ -10553,9 +10563,9 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scratch" @@ -13031,7 +13041,7 @@ version = "0.10.0-dev" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" dependencies = [ "async-trait", - "clap 4.3.19", + "clap 4.3.21", "frame-remote-externalities", "frame-try-runtime", "hex", @@ -13519,7 +13529,7 @@ dependencies = [ name = "wasm-info" version = "0.1.0" dependencies = [ - "clap 4.3.19", + "clap 4.3.21", "hex", "parity-wasm 0.45.0", ] @@ -13577,7 +13587,7 @@ dependencies = [ name = "wasm-proc" version = "0.1.0" dependencies = [ - "clap 4.3.19", + "clap 4.3.21", "env_logger", "gear-wasm-builder", "log", diff --git a/Cargo.toml b/Cargo.toml index 62364bafda1..7ae9636eada 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -114,7 +114,7 @@ async-trait = "0.1.68" base64 = "0.21.0" blake2-rfc = { version = "0.2.18", default-features = false } bs58 = { version = "0.4.0", default-features = false } -clap = { version = "4.3.19" } +clap = { version = "4.3.21" } codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false } color-eyre = "0.6.2" colored = "2.0.0" @@ -128,7 +128,7 @@ env_logger = "0.10" futures = { version = "0.3", default-features = false } futures-timer = "3.0.2" futures-util = "0.3.28" -hashbrown = "0.13.2" +hashbrown = "0.14.0" hex = { version = "0.4.3", default-features = false } hex-literal = "0.4.1" jsonrpsee = { version = "^0.16" } @@ -443,7 +443,7 @@ page_size = { version = "0.5", default-features = false } # pall pathdiff = { version = "0.2.1", default-features = false } # utils/wasm-builder rand_pcg = "0.3.1" # pallets/gear schnorrkel = "0.9.1" # gcli -scopeguard = { version = "1.1.0", default-features = false } # pallets/gear +scopeguard = { version = "1.2.0", default-features = false } # pallets/gear tabled = "0.10.0" # utils/regression-analysis thousands = "0.2.0" # utils/regression-analysis toml = "0.7.3" # utils/wasm-builder From 6be76fa477739f820729e89f22c848deb26a9c40 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Sun, 13 Aug 2023 17:04:12 +0300 Subject: [PATCH 043/165] test(wasm-gen): Make deterministic wasm generation (#3044) --- utils/wasm-gen/src/generator/syscalls.rs | 25 ++++++------ .../src/generator/syscalls/additional_data.rs | 6 +-- .../src/generator/syscalls/imports.rs | 27 ++++--------- .../src/generator/syscalls/invocator.rs | 22 +++++------ utils/wasm-gen/src/tests.rs | 38 ++++++++----------- utils/wasm-instrument/src/syscalls.rs | 6 +-- 6 files changed, 54 insertions(+), 70 deletions(-) diff --git a/utils/wasm-gen/src/generator/syscalls.rs b/utils/wasm-gen/src/generator/syscalls.rs index 67199ff2c43..3a636fa054b 100644 --- a/utils/wasm-gen/src/generator/syscalls.rs +++ b/utils/wasm-gen/src/generator/syscalls.rs @@ -42,7 +42,7 @@ pub use additional_data::*; pub use imports::*; pub use invocator::*; -use gear_wasm_instrument::syscalls::{SysCallName, SysCallSignature}; +use gear_wasm_instrument::syscalls::{ParamType, SysCallName, SysCallSignature}; /// Type of invocable sys-call. /// @@ -54,24 +54,27 @@ use gear_wasm_instrument::syscalls::{SysCallName, SysCallSignature}; /// which is pretty hard to predict beforehand with a generator. So this call context /// is created from scratch - first `gr_reserve_gas` is called and then it's result /// is used for the further `gr_reservation_send` call. Those are `Precise` sys-calls. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub(crate) enum InvocableSysCall { Loose(SysCallName), - Precise(SysCallSignature), + Precise(SysCallName), } impl InvocableSysCall { - fn name(&self) -> Option { - match self { - InvocableSysCall::Loose(name) => Some(*name), - InvocableSysCall::Precise(_) => None, - } - } - fn into_signature(self) -> SysCallSignature { match self { InvocableSysCall::Loose(name) => name.signature(), - InvocableSysCall::Precise(signature) => signature, + InvocableSysCall::Precise(name) => match name { + SysCallName::ReservationSend => SysCallSignature::gr([ + ParamType::Ptr(None), // Address of recipient and value (HashWithValue struct) + ParamType::Ptr(Some(2)), // Pointer to payload + ParamType::Size, // Size of the payload + ParamType::Delay, // Number of blocks to delay the sending for + ParamType::Gas, // Amount of gas to reserve + ParamType::Duration, // Duration of the reservation + ]), + _ => unimplemented!(), + }, } } } diff --git a/utils/wasm-gen/src/generator/syscalls/additional_data.rs b/utils/wasm-gen/src/generator/syscalls/additional_data.rs index 8e14ce676cc..3a8492a3e9c 100644 --- a/utils/wasm-gen/src/generator/syscalls/additional_data.rs +++ b/utils/wasm-gen/src/generator/syscalls/additional_data.rs @@ -30,7 +30,7 @@ use gear_wasm_instrument::{ parity_wasm::{builder, elements::Instruction}, syscalls::SysCallName, }; -use std::{collections::HashMap, iter::Cycle, vec::IntoIter}; +use std::{collections::BTreeMap, iter::Cycle, vec::IntoIter}; /// Cycled iterator over wasm module data offsets. /// @@ -65,7 +65,7 @@ pub struct AdditionalDataInjector<'a> { last_offset: u32, module: WasmModule, addresses_offsets: Vec, - sys_calls_imports: HashMap, + sys_calls_imports: BTreeMap, } impl<'a> @@ -251,7 +251,7 @@ pub struct DisabledAdditionalDataInjector<'a> { pub(super) unstructured: &'a mut Unstructured<'a>, pub(super) module: WasmModule, pub(super) call_indexes: CallIndexes, - pub(super) sys_calls_imports: HashMap, + pub(super) sys_calls_imports: BTreeMap, pub(super) config: SysCallsConfig, } diff --git a/utils/wasm-gen/src/generator/syscalls/imports.rs b/utils/wasm-gen/src/generator/syscalls/imports.rs index 46d71c116ea..feab1e3dbc2 100644 --- a/utils/wasm-gen/src/generator/syscalls/imports.rs +++ b/utils/wasm-gen/src/generator/syscalls/imports.rs @@ -32,10 +32,10 @@ use gear_wasm_instrument::{ builder, elements::{BlockType, Instruction, Instructions}, }, - syscalls::{ParamType, SysCallName, SysCallSignature}, + syscalls::SysCallName, }; use gsys::{ErrorWithHash, HashWithValue, Length}; -use std::{collections::HashMap, mem}; +use std::{collections::BTreeMap, mem}; /// Gear sys-calls imports generator. pub struct SysCallsImportsGenerator<'a> { @@ -43,7 +43,7 @@ pub struct SysCallsImportsGenerator<'a> { call_indexes: CallIndexes, module: WasmModule, config: SysCallsConfig, - sys_calls_imports: HashMap, + sys_calls_imports: BTreeMap, } /// Sys-calls imports generator instantiator. @@ -249,17 +249,8 @@ impl<'a> SysCallsImportsGenerator<'a> { } }; - let send_from_reservation_signature = SysCallSignature { - params: vec![ - ParamType::Ptr(None), // Address of recipient and value (HashWithValue struct) - ParamType::Ptr(Some(2)), // Pointer to payload - ParamType::Size, // Size of the payload - ParamType::Delay, // Number of blocks to delay the sending for - ParamType::Gas, // Amount of gas to reserve - ParamType::Duration, // Duration of the reservation - ], - results: Default::default(), - }; + let invocable_sys_call = InvocableSysCall::Precise(SysCallName::ReservationSend); + let send_from_reservation_signature = invocable_sys_call.into_signature(); let send_from_reservation_func_ty = send_from_reservation_signature.func_type(); let func_signature = builder::signature() @@ -356,10 +347,8 @@ impl<'a> SysCallsImportsGenerator<'a> { self.call_indexes .add_func(send_from_reservation_func_idx.signature as usize); - self.sys_calls_imports.insert( - InvocableSysCall::Precise(send_from_reservation_signature), - (1, call_indexes_handle), - ); + self.sys_calls_imports + .insert(invocable_sys_call, (1, call_indexes_handle)); } } @@ -375,7 +364,7 @@ pub struct DisabledSysCallsImportsGenerator<'a> { pub(super) call_indexes: CallIndexes, pub(super) module: WasmModule, pub(super) config: SysCallsConfig, - pub(super) sys_calls_imports: HashMap, + pub(super) sys_calls_imports: BTreeMap, } impl<'a> From> for ModuleWithCallIndexes { diff --git a/utils/wasm-gen/src/generator/syscalls/invocator.rs b/utils/wasm-gen/src/generator/syscalls/invocator.rs index 23e5d07868c..b24cc9563a4 100644 --- a/utils/wasm-gen/src/generator/syscalls/invocator.rs +++ b/utils/wasm-gen/src/generator/syscalls/invocator.rs @@ -31,7 +31,7 @@ use gear_wasm_instrument::{ parity_wasm::elements::{Instruction, Internal, ValueType}, syscalls::{ParamType, SysCallName}, }; -use std::{collections::HashMap, iter}; +use std::{collections::BTreeMap, iter}; #[derive(Debug)] pub(crate) enum ProcessedSysCallParams { @@ -97,7 +97,7 @@ pub struct SysCallsInvocator<'a> { module: WasmModule, config: SysCallsConfig, offsets: Option, - sys_call_imports: HashMap, + sys_call_imports: BTreeMap, } impl<'a> @@ -150,9 +150,8 @@ impl<'a> SysCallsInvocator<'a> { invocable: InvocableSysCall, call_indexes_handle: CallIndexesHandle, ) -> Result> { - let name = invocable.name(); let signature = invocable.into_signature(); - if self.is_not_send_sys_call(name) { + if self.is_not_send_sys_call(invocable) { return self.build_call(&signature.params, &signature.results, call_indexes_handle); } @@ -218,15 +217,16 @@ impl<'a> SysCallsInvocator<'a> { Ok(res) } - fn is_not_send_sys_call(&self, name: Option) -> bool { + fn is_not_send_sys_call(&self, sys_call: InvocableSysCall) -> bool { + use InvocableSysCall::*; ![ - Some(SysCallName::Send), - Some(SysCallName::SendWGas), - Some(SysCallName::SendInput), - Some(SysCallName::SendInputWGas), - None, + Loose(SysCallName::Send), + Loose(SysCallName::SendWGas), + Loose(SysCallName::SendInput), + Loose(SysCallName::SendInputWGas), + Precise(SysCallName::ReservationSend), ] - .contains(&name) + .contains(&sys_call) } fn build_call( diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index a962649a224..a722388e69e 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -91,27 +91,6 @@ fn remove_multiple_recursions() { println!("wat = {wat}"); } -// TODO issue #3015 -// proptest! { -// #![proptest_config(ProptestConfig::with_cases(100))] -// #[test] -// fn test_gen_reproduction(seed in 0..u64::MAX) { -// let mut rng = SmallRng::seed_from_u64(seed); -// let mut buf = vec![0; 100_000]; -// rng.fill_bytes(&mut buf); - -// let mut u = Unstructured::new(&buf); -// let mut u2 = Unstructured::new(&buf); - -// let gear_config = ConfigsBundle::default(); - -// let first = gen_gear_program_code(&mut u, gear_config.clone(), &[]); -// let second = gen_gear_program_code(&mut u2, gear_config, &[]); - -// assert!(first == second); -// } -// } - #[test] fn injecting_addresses_works() { let mut rng = SmallRng::seed_from_u64(1234); @@ -185,7 +164,7 @@ proptest! { #[test] // Test that valid config always generates a valid gear wasm. fn test_valid_config(buf in prop::collection::vec(any::(), UNSTRUCTURED_SIZE)) { - use gear_wasm_instrument::wasm_instrument::gas_metering::ConstantCostRules; + use gear_wasm_instrument::rules::CustomConstantCostRules; let mut u = Unstructured::new(&buf); let configs_bundle: ValidGearWasmConfigsBundle = ValidGearWasmConfigsBundle { log_info: Some("Some data".into()), @@ -196,7 +175,20 @@ proptest! { let raw_code = generate_gear_program_code(&mut u, configs_bundle) .expect("failed generating wasm"); - let code_res = Code::try_new(raw_code, 1, |_| ConstantCostRules::default(), None); + let code_res = Code::try_new(raw_code, 1, |_| CustomConstantCostRules::default(), None); assert!(code_res.is_ok()); } + + #[test] + fn test_reproduction(buf in prop::collection::vec(any::(), UNSTRUCTURED_SIZE)) { + let mut u = Unstructured::new(&buf); + let mut u2 = Unstructured::new(&buf); + + let gear_config = ValidGearWasmConfigsBundle::<[u8; 32]>::default(); + + let first = generate_gear_program_code(&mut u, gear_config.clone()).expect("failed wasm generation"); + let second = generate_gear_program_code(&mut u2, gear_config).expect("failed wasm generation"); + + assert_eq!(first, second); + } } diff --git a/utils/wasm-instrument/src/syscalls.rs b/utils/wasm-instrument/src/syscalls.rs index d38557f0ac2..44f679e726a 100644 --- a/utils/wasm-instrument/src/syscalls.rs +++ b/utils/wasm-instrument/src/syscalls.rs @@ -349,7 +349,7 @@ impl SysCallName { /// optional index of the memory array size parameter. So if current sys-call /// doesn't accept any memory array as an argument, then pointer parameter will /// be `Ptr(None)`. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)] pub enum ParamType { Size, // i32 buffers size in memory Ptr(Option), // i32 pointer @@ -379,14 +379,14 @@ pub struct SysCallSignature { } impl SysCallSignature { - fn gr(params: [ParamType; N]) -> Self { + pub fn gr(params: [ParamType; N]) -> Self { Self { params: params.to_vec(), results: Default::default(), } } - fn system( + pub fn system( params: [ParamType; N], results: [ValueType; M], ) -> Self { From 7789d8ea66aa0c9556b73cbc9b991f088764a7a3 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:43:46 +0300 Subject: [PATCH 044/165] feat: use `alloca` for stack allocations (#2975) --- Cargo.lock | 8 +++ Cargo.toml | 1 + gcore/Cargo.toml | 1 + gcore/src/lib.rs | 2 +- gcore/src/msg.rs | 16 ++++- gcore/src/stack_buffer.rs | 55 ---------------- gstd/src/msg/encoded.rs | 25 +++++-- stack-buffer/Cargo.toml | 13 ++++ stack-buffer/alloca/README.md | 15 +++++ stack-buffer/alloca/alloca.c | 16 +++++ stack-buffer/alloca/libcalloca.a | Bin 0 -> 420 bytes stack-buffer/build.rs | 34 ++++++++++ stack-buffer/src/lib.rs | 110 +++++++++++++++++++++++++++++++ 13 files changed, 233 insertions(+), 63 deletions(-) delete mode 100644 gcore/src/stack_buffer.rs create mode 100644 stack-buffer/Cargo.toml create mode 100644 stack-buffer/alloca/README.md create mode 100644 stack-buffer/alloca/alloca.c create mode 100644 stack-buffer/alloca/libcalloca.a create mode 100644 stack-buffer/build.rs create mode 100644 stack-buffer/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 87e614fc2c0..57de5edb3da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3674,6 +3674,7 @@ version = "0.2.2" dependencies = [ "galloc", "gear-core-errors", + "gear-stack-buffer", "gsys", "hex-literal", "parity-scale-codec", @@ -4286,6 +4287,13 @@ dependencies = [ "vara-runtime", ] +[[package]] +name = "gear-stack-buffer" +version = "0.2.2" +dependencies = [ + "cc", +] + [[package]] name = "gear-utils" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 7ae9636eada..27e38b07ee1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -229,6 +229,7 @@ gear-sandbox = { path = "sandbox/sandbox", default-features = false } gear-sandbox-env = { path = "sandbox/env", default-features = false } gear-sandbox-host = { path = "sandbox/host" } gear-service = { path = "node/service", default-features = false } +gear-stack-buffer = { path = "stack-buffer" } gear-utils = { path = "utils/utils" } gear-wasm-builder = { path = "utils/wasm-builder", default-features = false } gear-wasm-gen = { path = "utils/wasm-gen" } diff --git a/gcore/Cargo.toml b/gcore/Cargo.toml index 5693f14552f..dff1d9db8bf 100644 --- a/gcore/Cargo.toml +++ b/gcore/Cargo.toml @@ -8,6 +8,7 @@ license.workspace = true [dependencies] gsys.workspace = true gear-core-errors.workspace = true +gear-stack-buffer.workspace = true codec = { workspace = true, optional = true } static_assertions.workspace = true diff --git a/gcore/src/lib.rs b/gcore/src/lib.rs index 161fe14dd39..385e3851f0e 100644 --- a/gcore/src/lib.rs +++ b/gcore/src/lib.rs @@ -67,7 +67,7 @@ pub mod errors; pub mod exec; pub mod msg; pub mod prog; -pub mod stack_buffer; +pub extern crate gear_stack_buffer as stack_buffer; mod general; pub use general::*; diff --git a/gcore/src/msg.rs b/gcore/src/msg.rs index 5b201976c6c..64045dee779 100644 --- a/gcore/src/msg.rs +++ b/gcore/src/msg.rs @@ -190,10 +190,22 @@ pub fn with_read_on_stack(f: impl FnOnce(Result<&mut [u8]>) -> T) -> T { let mut len = 0u32; if size > 0 { - unsafe { gsys::gr_read(0, size as u32, buffer.as_mut_ptr(), &mut len as *mut u32) } + unsafe { + gsys::gr_read( + 0, + size as u32, + buffer.as_mut_ptr() as *mut u8, + &mut len as *mut u32, + ) + } } - f(SyscallError(len).into_result().map(|_| buffer)) + // SAFETY: same as `MaybeUninit::slice_assume_init_mut(&mut buffer[..size])`. + // It takes the slice `&mut buffer[..size]` and says that it was + // previously initialized with the `gr_read` system call. + f(SyscallError(len) + .into_result() + .map(|_| unsafe { &mut *(&mut buffer[..size] as *mut _ as *mut [u8]) })) }) } diff --git a/gcore/src/stack_buffer.rs b/gcore/src/stack_buffer.rs deleted file mode 100644 index ef4f2ccb563..00000000000 --- a/gcore/src/stack_buffer.rs +++ /dev/null @@ -1,55 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Stack allocations utils. - -use alloc::vec; - -fn with_byte_array(size: usize, f: impl FnOnce(&mut [u8]) -> T) -> T { - let mut buffer = [0u8; N]; - let sub_buffer = &mut buffer[0..size]; - f(sub_buffer) -} - -/// Calls function `f` with provided byte buffer allocated on stack. -/// ### IMPORTANT -/// If buffer size is too big (currently bigger than 0x4000 bytes), -/// then allocation will be on heap. -/// If buffer is small enough to be allocated on stack, then real allocated -/// buffer size will be `size` aligned to upper power of 2. -pub fn with_byte_buffer(size: usize, f: impl FnOnce(&mut [u8]) -> T) -> T { - // TODO: consider to return error in case of heap allocation #2881 - match size { - size if size <= 0x1 => with_byte_array::<_, 0x1>(size, f), - size if size <= 0x2 => with_byte_array::<_, 0x2>(size, f), - size if size <= 0x4 => with_byte_array::<_, 0x4>(size, f), - size if size <= 0x8 => with_byte_array::<_, 0x8>(size, f), - size if size <= 0x10 => with_byte_array::<_, 0x10>(size, f), - size if size <= 0x20 => with_byte_array::<_, 0x20>(size, f), - size if size <= 0x40 => with_byte_array::<_, 0x40>(size, f), - size if size <= 0x80 => with_byte_array::<_, 0x80>(size, f), - size if size <= 0x100 => with_byte_array::<_, 0x100>(size, f), - size if size <= 0x200 => with_byte_array::<_, 0x200>(size, f), - size if size <= 0x400 => with_byte_array::<_, 0x400>(size, f), - size if size <= 0x800 => with_byte_array::<_, 0x800>(size, f), - size if size <= 0x1000 => with_byte_array::<_, 0x1000>(size, f), - size if size <= 0x2000 => with_byte_array::<_, 0x2000>(size, f), - size if size <= 0x4000 => with_byte_array::<_, 0x4000>(size, f), - _ => f(vec![0; size].as_mut_slice()), - } -} diff --git a/gstd/src/msg/encoded.rs b/gstd/src/msg/encoded.rs index 20853c792fc..283663499e8 100644 --- a/gstd/src/msg/encoded.rs +++ b/gstd/src/msg/encoded.rs @@ -24,7 +24,11 @@ use crate::{ async_runtime::signals, errors::{Error, IntoResult, Result}, msg::{utils, CodecMessageFuture, MessageFuture}, - prelude::{convert::AsRef, ops::RangeBounds}, + prelude::{ + convert::AsRef, + mem::{transmute, MaybeUninit}, + ops::RangeBounds, + }, ActorId, MessageId, ReservationId, }; use gstd_codegen::wait_for_reply; @@ -131,7 +135,7 @@ pub fn reply(payload: E, value: u128) -> Result { /// Buffer size for encoding is at least `E::max_encoded_len()`. pub fn reply_on_stack(payload: E, value: u128) -> Result { struct ExternalBufferOutput<'a> { - buffer: &'a mut [u8], + buffer: &'a mut [MaybeUninit], offset: usize, } @@ -140,9 +144,15 @@ pub fn reply_on_stack(payload: E, value: u128) -> Res const ERROR_LOG: &str = "Unexpected encoding behavior: too large input bytes size"; let end_offset = self.offset.checked_add(bytes.len()).expect(ERROR_LOG); if end_offset > self.buffer.len() { - panic!("{}", ERROR_LOG); + panic!("{ERROR_LOG}"); } - self.buffer[self.offset..end_offset].copy_from_slice(bytes); + // SAFETY: same as + // `MaybeUninit::write_slice(&mut self.buffer[self.offset..end_offset], bytes)`. + // This code transmutes `bytes: &[T]` to `bytes: &[MaybeUninit]`. These types + // can be safely transmuted since they have the same layout. Then `bytes: + // &[MaybeUninit]` is written to uninitialized memory via `copy_from_slice`. + let this = &mut self.buffer[self.offset..end_offset]; + this.copy_from_slice(unsafe { transmute(bytes) }); self.offset = end_offset; } } @@ -151,7 +161,12 @@ pub fn reply_on_stack(payload: E, value: u128) -> Res let mut output = ExternalBufferOutput { buffer, offset: 0 }; payload.encode_to(&mut output); let ExternalBufferOutput { buffer, offset } = output; - super::reply_bytes(&buffer[..offset], value) + // SAFETY: same as `MaybeUninit::slice_assume_init_ref(&buffer[..offset])`. + // `ExternalBufferOutput` writes data to uninitialized memory. So we can take + // slice `&buffer[..offset]` and say that it was initialized earlier + // because the buffer from `0` to `offset` was initialized. + let payload = unsafe { &*(&buffer[..offset] as *const _ as *const [u8]) }; + super::reply_bytes(payload, value) }) } diff --git a/stack-buffer/Cargo.toml b/stack-buffer/Cargo.toml new file mode 100644 index 00000000000..df253031675 --- /dev/null +++ b/stack-buffer/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "gear-stack-buffer" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true + +[build-dependencies] +cc = { version = "1.0", optional = true } + +[features] +compile-alloca = ["cc"] +stack-clash-protection = [] diff --git a/stack-buffer/alloca/README.md b/stack-buffer/alloca/README.md new file mode 100644 index 00000000000..21e1d10bfc9 --- /dev/null +++ b/stack-buffer/alloca/README.md @@ -0,0 +1,15 @@ +### What is alloca? + +This library allows to allocate N bytes on the stack and then pass uninitialized memory to rust code. + +### Contents of this directory + +- [`alloca.c`](alloca.c) - library source code +- [`libcalloca.a`](libcalloca.a) - pre-built static library for the `wasm32-unknown-unknown` target + +### Compiling vs pre-built library + +Compilation should not happen in the general case. Because this dependency is used in gcore and gstd, we use a pre-built +library to not require the clang compiler. + +However, if for some reason you want to compile the C library at build time, use the `compile-alloca` feature. diff --git a/stack-buffer/alloca/alloca.c b/stack-buffer/alloca/alloca.c new file mode 100644 index 00000000000..e180ea829c8 --- /dev/null +++ b/stack-buffer/alloca/alloca.c @@ -0,0 +1,16 @@ +#include +#include + +#ifdef _MSC_VER +#include +#endif + +void c_with_alloca(size_t size, void (*callback)(uint8_t *, void *), void* data) { +#ifdef _MSC_VER + uint8_t *buffer = _alloca(size); +#else + uint8_t buffer[size]; +#endif + + return callback(&buffer[0], data); +} diff --git a/stack-buffer/alloca/libcalloca.a b/stack-buffer/alloca/libcalloca.a new file mode 100644 index 0000000000000000000000000000000000000000..6901b64aab7bc6a0f27f5cb06411f440261fd097 GIT binary patch literal 420 zcmYk2u};G<5QguZs)0}x7`uf66KZIoFd?K0n3?uslHkz_+TZ zfXuA2EMZ3Ki~Jg5SwcR!l*W-1OwmLnsag?$HO@8TOPZyT)IwP$8r-KelJiIjuIYUt zxsFmvH49>aS>5<*o<(rJn|Oj)?$@eZ=t$ Result<(), Box> { + let alloca_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?).join("alloca"); + + if env::var("TARGET")? == "wasm32-unknown-unknown" { + println!("cargo:rustc-link-lib=static=calloca"); + println!("cargo:rustc-link-search=native={}", alloca_dir.display()); + } + + Ok(()) +} + +#[cfg(feature = "compile-alloca")] +fn main() -> Result<(), Box> { + let alloca_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR")?).join("alloca"); + + let mut builder = cc::Build::new(); + + #[cfg(feature = "stack-clash-protection")] + builder.flag_if_supported("-fstack-clash-protection"); + + if option_env!("CC") == Some("clang") { + builder.flag("-flto"); + } + + builder + .file(alloca_dir.join("alloca.c")) + .opt_level(2) + .compile("calloca"); + + Ok(()) +} diff --git a/stack-buffer/src/lib.rs b/stack-buffer/src/lib.rs new file mode 100644 index 00000000000..a278f406462 --- /dev/null +++ b/stack-buffer/src/lib.rs @@ -0,0 +1,110 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Stack allocations utils. + +#![no_std] + +extern crate alloc; + +use alloc::vec::Vec; +use core::{ + ffi::c_void, + mem::{ManuallyDrop, MaybeUninit}, + slice, +}; + +/// The maximum buffer size that can be allocated on the stack. +/// This is currently limited to 64 KiB. +pub const MAX_BUFFER_SIZE: usize = 64 * 1024; + +/// A closure data type that is used in the native library to pass +/// a pointer to allocated stack memory. +type Callback = unsafe extern "C" fn(ptr: *mut MaybeUninit, data: *mut c_void); + +#[cfg(any(feature = "compile-alloca", target_arch = "wasm32"))] +extern "C" { + /// Function from the native library that manipulates the stack pointer directly. + /// Can be used to dynamically allocate stack space. + fn c_with_alloca(size: usize, callback: Callback, data: *mut c_void); +} + +/// This is a polyfill function that is used when the native library is unavailable. +/// The maximum size that can be allocated on the stack is limited +/// by the [`MAX_BUFFER_SIZE`] constant. +#[cfg(not(any(feature = "compile-alloca", target_arch = "wasm32")))] +unsafe extern "C" fn c_with_alloca(_size: usize, callback: Callback, data: *mut c_void) { + // Same as `MaybeUninit::uninit_array()`. + // Create an uninitialized array of `MaybeUninit`. The `assume_init` is + // safe because the type we are claiming to have initialized here is a + // bunch of `MaybeUninit`s, which do not require initialization. + let mut buffer = MaybeUninit::<[MaybeUninit; MAX_BUFFER_SIZE]>::uninit().assume_init(); + callback(buffer.as_mut_ptr(), data); +} + +/// Helper function to create a trampoline between C and Rust code. +#[inline(always)] +fn get_trampoline)>(_closure: &F) -> Callback { + trampoline:: +} + +/// A function that serves as a trampoline between C and Rust code. +/// It is mainly used to switch from `fn()` to `FnOnce()`, +/// which allows local variables to be captured. +unsafe extern "C" fn trampoline)>( + ptr: *mut MaybeUninit, + data: *mut c_void, +) { + // This code gets `*mut ManuallyDrop`, then takes ownership of the `F` function + // and executes it with a pointer to the allocated stack memory. + let f = ManuallyDrop::take(&mut *(data as *mut ManuallyDrop)); + f(ptr); +} + +/// This is a higher-level function for dynamically allocating space on the stack. +fn with_alloca(size: usize, f: impl FnOnce(&mut [MaybeUninit]) -> T) -> T { + let mut ret = MaybeUninit::uninit(); + + let closure = |ptr| { + let slice = unsafe { slice::from_raw_parts_mut(ptr, size) }; + ret.write(f(slice)); + }; + + // The `closure` variable is passed as `*mut ManuallyDrop` to the trampoline function. + let trampoline = get_trampoline(&closure); + let mut closure_data = ManuallyDrop::new(closure); + + unsafe { + c_with_alloca(size, trampoline, &mut closure_data as *mut _ as *mut c_void); + ret.assume_init() + } +} + +/// Calls function `f` with provided uninitialized byte buffer allocated on stack. +/// ### IMPORTANT +/// If buffer size is too big (currently bigger than 0x10000 bytes), +/// then allocation will be on heap. +/// If buffer is small enough to be allocated on stack, then real allocated +/// buffer size will be `size` aligned to 16 bytes. +pub fn with_byte_buffer(size: usize, f: impl FnOnce(&mut [MaybeUninit]) -> T) -> T { + if size <= MAX_BUFFER_SIZE { + with_alloca(size, f) + } else { + f(Vec::with_capacity(size).spare_capacity_mut()) + } +} From ace0c453ee8aafb6c5ae1249ab8a127b8e7d3bc9 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:44:51 +0300 Subject: [PATCH 045/165] refactor(gstd): split `prog::create_program` into two functions (#3050) --- examples/constructor/src/call.rs | 4 +- examples/program-factory/src/lib.rs | 13 ++- examples/program-generator/src/lib.rs | 9 +- examples/sys-calls/src/lib.rs | 10 +- gstd/src/msg/async.rs | 6 +- gstd/src/prog/basic.rs | 137 ++++++++++++++++++++++++++ gstd/src/prog/encoded.rs | 83 ++++++++++++++++ gstd/src/prog/generator.rs | 82 ++++++++++++--- gstd/src/prog/mod.rs | 125 ++--------------------- gtest/src/system.rs | 2 +- 10 files changed, 323 insertions(+), 148 deletions(-) create mode 100644 gstd/src/prog/basic.rs create mode 100644 gstd/src/prog/encoded.rs diff --git a/examples/constructor/src/call.rs b/examples/constructor/src/call.rs index c3264e5ac90..999a040222b 100644 --- a/examples/constructor/src/call.rs +++ b/examples/constructor/src/call.rs @@ -70,7 +70,7 @@ mod wasm { let delay = delay.value(); let res = if let Some(gas_limit) = gas_limit { - prog::create_program_with_gas_delayed( + prog::create_program_bytes_with_gas_delayed( code_id, salt, payload, @@ -79,7 +79,7 @@ mod wasm { delay, ) } else { - prog::create_program_delayed(code_id, salt, payload, value, delay) + prog::create_program_bytes_delayed(code_id, salt, payload, value, delay) }; let (_message_id, program_id) = res.expect("Failed to create program"); diff --git a/examples/program-factory/src/lib.rs b/examples/program-factory/src/lib.rs index 8e3f6db7467..2cb14dfee0e 100644 --- a/examples/program-factory/src/lib.rs +++ b/examples/program-factory/src/lib.rs @@ -65,7 +65,7 @@ mod wasm { match msg::load().expect("provided invalid payload") { CreateProgram::Default => { let submitted_code = CHILD_CODE_HASH.into(); - let (_message_id, new_program_id) = prog::create_program_with_gas( + let (_message_id, new_program_id) = prog::create_program_bytes_with_gas( submitted_code, unsafe { COUNTER.to_le_bytes() }, [], @@ -80,9 +80,14 @@ mod wasm { CreateProgram::Custom(custom_child_data) => { for (code_hash, salt, gas_limit) in custom_child_data { let submitted_code = code_hash.into(); - let (_message_id, new_program_id) = - prog::create_program_with_gas(submitted_code, &salt, [], gas_limit, 0) - .unwrap(); + let (_message_id, new_program_id) = prog::create_program_bytes_with_gas( + submitted_code, + &salt, + [], + gas_limit, + 0, + ) + .unwrap(); msg::send_bytes(new_program_id, [], 0).expect("Failed to send message"); } } diff --git a/examples/program-generator/src/lib.rs b/examples/program-generator/src/lib.rs index abe4a46991e..b3aa2869011 100644 --- a/examples/program-generator/src/lib.rs +++ b/examples/program-generator/src/lib.rs @@ -57,8 +57,13 @@ mod wasm { hex_literal::hex!("abf3746e72a6e8740bd9e12b879fbdd59e052cb390f116454e9116c22021ae4a") .into(); - ProgramGenerator::create_program_with_gas(submitted_code, b"payload", 10_000_000_000, 0) - .unwrap(); + ProgramGenerator::create_program_bytes_with_gas( + submitted_code, + b"payload", + 10_000_000_000, + 0, + ) + .unwrap(); check_salt_uniqueness(); } diff --git a/examples/sys-calls/src/lib.rs b/examples/sys-calls/src/lib.rs index 49601408e14..84740b82462 100644 --- a/examples/sys-calls/src/lib.rs +++ b/examples/sys-calls/src/lib.rs @@ -147,7 +147,7 @@ mod wasm { Kind::CreateProgram(salt, gas_opt, (expected_mid, expected_pid)) => { let salt = salt.to_le_bytes(); let res = match gas_opt { - Some(gas) => prog::create_program_with_gas_delayed( + Some(gas) => prog::create_program_bytes_with_gas_delayed( unsafe { CODE_ID }, salt, "payload", @@ -155,7 +155,13 @@ mod wasm { 0, 0, ), - None => prog::create_program_delayed(unsafe { CODE_ID }, salt, "payload", 0, 0), + None => prog::create_program_bytes_delayed( + unsafe { CODE_ID }, + salt, + "payload", + 0, + 0, + ), }; let (actual_mid, actual_pid) = res.expect("internal error: create program failed"); let actual_mid: [u8; 32] = actual_mid.into(); diff --git a/gstd/src/msg/async.rs b/gstd/src/msg/async.rs index 8c2655cf5cd..fcf62633072 100644 --- a/gstd/src/msg/async.rs +++ b/gstd/src/msg/async.rs @@ -146,7 +146,7 @@ impl_futures!( /// async fn main() { /// # let code_id = CodeId::new([0; 32]); /// let future: CodecCreateProgramFuture = -/// prog::create_program_for_reply_as(code_id, b"salt", b"PING", 0, 0) +/// prog::create_program_bytes_for_reply_as(code_id, b"salt", b"PING", 0, 0) /// .expect("Unable to create a program"); /// let (prog_id, reply): (ActorId, InitReply) = future.await.expect("Unable to get a reply"); /// let field: String = reply.field; @@ -228,7 +228,7 @@ impl_futures!( /// Async functions that relate to creating programs wait for a reply from the /// program's init function. These functions have the suffix` _for_reply`, such -/// as [`crate::prog::create_program_for_reply`]. +/// as [`crate::prog::create_program_bytes_for_reply`]. /// /// To get the reply payload (in bytes), one should use `.await` syntax. After /// calling a corresponding async function, the program interrupts its execution @@ -252,7 +252,7 @@ impl_futures!( /// async fn main() { /// # let code_id = CodeId::new([0; 32]); /// let future: CreateProgramFuture = -/// prog::create_program_for_reply(code_id, b"salt", b"PING", 0, 0) +/// prog::create_program_bytes_for_reply(code_id, b"salt", b"PING", 0, 0) /// .expect("Unable to create a program"); /// let (prog_id, reply): (ActorId, Vec) = future.await.expect("Unable to get a reply"); /// } diff --git a/gstd/src/prog/basic.rs b/gstd/src/prog/basic.rs new file mode 100644 index 00000000000..8f7bfc52fe4 --- /dev/null +++ b/gstd/src/prog/basic.rs @@ -0,0 +1,137 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{ + async_runtime::signals, + common::errors::Result, + msg::{CodecCreateProgramFuture, CreateProgramFuture}, + prelude::convert::AsRef, + ActorId, CodeId, MessageId, +}; +use gstd_codegen::wait_create_program_for_reply; +use scale_info::scale::Decode; + +/// Create a new program from the already existing on-chain code identified by +/// [`CodeId`]. +/// +/// The function returns an initial message identifier and a newly created +/// program identifier. +/// +/// The first argument is the code identifier (see [`CodeId`] for details). The +/// second argument is an arbitrary byte sequence (also known as `salt`) that +/// allows the creation of multiple programs from the same code. The third and +/// last arguments are the initialization message's payload and value to be +/// transferred to the newly created program. +/// +/// # Examples +/// +/// Create a new program from the provided code identifier: +/// +/// ``` +/// use gstd::{msg, prog, CodeId}; +/// +/// #[no_mangle] +/// extern "C" fn handle() { +/// let code_id: CodeId = msg::load().expect("Unable to load"); +/// let (init_message_id, new_program_id) = +/// prog::create_program_bytes(code_id, "salt", b"INIT", 0) +/// .expect("Unable to create a program"); +/// msg::send_bytes(new_program_id, b"PING", 0).expect("Unable to send"); +/// } +/// ``` +#[wait_create_program_for_reply] +pub fn create_program_bytes( + code_id: CodeId, + salt: impl AsRef<[u8]>, + payload: impl AsRef<[u8]>, + value: u128, +) -> Result<(MessageId, ActorId)> { + create_program_bytes_delayed(code_id, salt, payload, value, 0) +} + +/// Same as [`create_program_bytes`], but creates a new program after the +/// `delay` expressed in block count. +/// +/// # Examples +/// +/// Create a new program from the provided code identifier after 100 blocks and +/// send a message to it after 200 blocks: +/// +/// ``` +/// use gstd::{msg, prog, CodeId}; +/// +/// #[no_mangle] +/// extern "C" fn handle() { +/// let code_id: CodeId = msg::load().expect("Unable to load"); +/// let (init_message_id, new_program_id) = +/// prog::create_program_bytes_delayed(code_id, "salt", b"INIT", 0, 100) +/// .expect("Unable to create a program"); +/// msg::send_bytes_delayed(new_program_id, b"PING", 0, 200).expect("Unable to send"); +/// } +/// ``` +pub fn create_program_bytes_delayed( + code_id: CodeId, + salt: impl AsRef<[u8]>, + payload: impl AsRef<[u8]>, + value: u128, + delay: u32, +) -> Result<(MessageId, ActorId)> { + let (message_id, program_id) = gcore::prog::create_program_delayed( + code_id.into(), + salt.as_ref(), + payload.as_ref(), + value, + delay, + )?; + + Ok((message_id.into(), program_id.into())) +} + +/// Same as [`create_program_bytes`], but with an explicit gas limit. +#[wait_create_program_for_reply] +pub fn create_program_bytes_with_gas( + code_id: CodeId, + salt: impl AsRef<[u8]>, + payload: impl AsRef<[u8]>, + gas_limit: u64, + value: u128, +) -> Result<(MessageId, ActorId)> { + create_program_bytes_with_gas_delayed(code_id, salt, payload, gas_limit, value, 0) +} + +/// Same as [`create_program_bytes_with_gas`], but creates a new program after +/// the `delay` expressed in block count. +pub fn create_program_bytes_with_gas_delayed( + code_id: CodeId, + salt: impl AsRef<[u8]>, + payload: impl AsRef<[u8]>, + gas_limit: u64, + value: u128, + delay: u32, +) -> Result<(MessageId, ActorId)> { + let (message_id, program_id) = gcore::prog::create_program_with_gas_delayed( + code_id.into(), + salt.as_ref(), + payload.as_ref(), + gas_limit, + value, + delay, + )?; + + Ok((message_id.into(), program_id.into())) +} diff --git a/gstd/src/prog/encoded.rs b/gstd/src/prog/encoded.rs new file mode 100644 index 00000000000..0f85589c783 --- /dev/null +++ b/gstd/src/prog/encoded.rs @@ -0,0 +1,83 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{ + async_runtime::signals, + common::errors::Result, + msg::{CodecCreateProgramFuture, CreateProgramFuture}, + prelude::convert::AsRef, + ActorId, CodeId, MessageId, +}; +use gstd_codegen::wait_create_program_for_reply; +use scale_info::scale::{Decode, Encode}; + +/// Same as [`create_program_bytes`](super::create_program_bytes), but allows +/// initialize program with the encodable payload. +#[wait_create_program_for_reply] +pub fn create_program( + code_id: CodeId, + salt: impl AsRef<[u8]>, + payload: E, + value: u128, +) -> Result<(MessageId, ActorId)> { + super::create_program_bytes(code_id, salt, payload.encode(), value) +} + +/// Same as [`create_program`], but creates a new program after the `delay` +/// expressed in block count. +pub fn create_program_delayed( + code_id: CodeId, + salt: impl AsRef<[u8]>, + payload: E, + value: u128, + delay: u32, +) -> Result<(MessageId, ActorId)> { + super::create_program_bytes_delayed(code_id, salt, payload.encode(), value, delay) +} + +/// Same as [`create_program`], but with an explicit gas limit. +#[wait_create_program_for_reply] +pub fn create_program_with_gas( + code_id: CodeId, + salt: impl AsRef<[u8]>, + payload: E, + gas_limit: u64, + value: u128, +) -> Result<(MessageId, ActorId)> { + super::create_program_bytes_with_gas(code_id, salt, payload.encode(), gas_limit, value) +} + +/// Same as [`create_program_with_gas`], but creates a new program after the +/// `delay` expressed in block count. +pub fn create_program_with_gas_delayed( + code_id: CodeId, + salt: impl AsRef<[u8]>, + payload: E, + gas_limit: u64, + value: u128, + delay: u32, +) -> Result<(MessageId, ActorId)> { + super::create_program_bytes_with_gas_delayed( + code_id, + salt, + payload.encode(), + gas_limit, + value, + delay, + ) +} diff --git a/gstd/src/prog/generator.rs b/gstd/src/prog/generator.rs index fd950ade242..70cd40eb940 100644 --- a/gstd/src/prog/generator.rs +++ b/gstd/src/prog/generator.rs @@ -26,7 +26,7 @@ use crate::{ prog, ActorId, CodeId, MessageId, }; use gstd_codegen::wait_create_program_for_reply; -use scale_info::scale::{alloc::vec::Vec, Decode}; +use scale_info::scale::{alloc::vec::Vec, Decode, Encode}; /// Helper to create programs without setting the salt manually. pub struct ProgramGenerator(u64); @@ -86,53 +86,53 @@ impl ProgramGenerator { /// extern "C" fn handle() { /// let code_id: CodeId = msg::load().expect("Unable to load"); /// let (init_message_id, new_program_id) = - /// ProgramGenerator::create_program(code_id, b"INIT", 0) + /// ProgramGenerator::create_program_bytes(code_id, b"INIT", 0) /// .expect("Unable to create a program"); /// msg::send_bytes(new_program_id, b"PING", 0).expect("Unable to send"); /// } /// ``` #[wait_create_program_for_reply(Self)] - pub fn create_program( + pub fn create_program_bytes( code_id: CodeId, payload: impl AsRef<[u8]>, value: u128, ) -> Result<(MessageId, ActorId)> { - Self::create_program_delayed(code_id, payload, value, 0) + Self::create_program_bytes_delayed(code_id, payload, value, 0) } - /// Same as [`create_program`](Self::create_program), but creates a new - /// program after the `delay` expressed in block count. - pub fn create_program_delayed( + /// Same as [`create_program_bytes`](Self::create_program_bytes), but + /// creates a new program after the `delay` expressed in block count. + pub fn create_program_bytes_delayed( code_id: CodeId, payload: impl AsRef<[u8]>, value: u128, delay: u32, ) -> Result<(MessageId, ActorId)> { - prog::create_program_delayed(code_id, Self::get_salt(), payload, value, delay) + prog::create_program_bytes_delayed(code_id, Self::get_salt(), payload, value, delay) } - /// Same as [`create_program`](Self::create_program), but with an explicit - /// gas limit. + /// Same as [`create_program_bytes`](Self::create_program_bytes), but with + /// an explicit gas limit. #[wait_create_program_for_reply(Self)] - pub fn create_program_with_gas( + pub fn create_program_bytes_with_gas( code_id: CodeId, payload: impl AsRef<[u8]>, gas_limit: u64, value: u128, ) -> Result<(MessageId, ActorId)> { - Self::create_program_with_gas_delayed(code_id, payload, gas_limit, value, 0) + Self::create_program_bytes_with_gas_delayed(code_id, payload, gas_limit, value, 0) } - /// Same as [`create_program_with_gas`](Self::create_program_with_gas), but + /// Same as [`create_program_bytes_with_gas`](Self::create_program_bytes_with_gas), but /// creates a new program after the `delay` expressed in block count. - pub fn create_program_with_gas_delayed( + pub fn create_program_bytes_with_gas_delayed( code_id: CodeId, payload: impl AsRef<[u8]>, gas_limit: u64, value: u128, delay: u32, ) -> Result<(MessageId, ActorId)> { - prog::create_program_with_gas_delayed( + prog::create_program_bytes_with_gas_delayed( code_id, Self::get_salt(), payload, @@ -141,4 +141,56 @@ impl ProgramGenerator { delay, ) } + + /// Same as [`create_program_bytes`](Self::create_program_bytes), but allows + /// initialize program with the encodable payload. + #[wait_create_program_for_reply(Self)] + pub fn create_program( + code_id: CodeId, + payload: E, + value: u128, + ) -> Result<(MessageId, ActorId)> { + Self::create_program_bytes(code_id, payload.encode(), value) + } + + /// Same as [`create_program`](Self::create_program), but creates a new + /// program after the `delay` expressed in block count. + pub fn create_program_delayed( + code_id: CodeId, + payload: E, + value: u128, + delay: u32, + ) -> Result<(MessageId, ActorId)> { + Self::create_program_bytes_delayed(code_id, payload.encode(), value, delay) + } + + /// Same as [`create_program`](Self::create_program), but with an explicit + /// gas limit. + #[wait_create_program_for_reply(Self)] + pub fn create_program_with_gas( + code_id: CodeId, + payload: E, + gas_limit: u64, + value: u128, + ) -> Result<(MessageId, ActorId)> { + Self::create_program_bytes_with_gas(code_id, payload.encode(), gas_limit, value) + } + + /// Same as [`create_program_with_gas`](Self::create_program_with_gas), but + /// creates a new program after the `delay` expressed in block count. + pub fn create_program_with_gas_delayed( + code_id: CodeId, + payload: E, + gas_limit: u64, + value: u128, + delay: u32, + ) -> Result<(MessageId, ActorId)> { + Self::create_program_bytes_with_gas_delayed( + code_id, + payload.encode(), + gas_limit, + value, + delay, + ) + } } diff --git a/gstd/src/prog/mod.rs b/gstd/src/prog/mod.rs index 0d65e65e58b..c9adedf76bc 100644 --- a/gstd/src/prog/mod.rs +++ b/gstd/src/prog/mod.rs @@ -24,7 +24,8 @@ //! actor can produce multiple derived actors with different input data. //! //! Firstly you need to upload a Wasm code of the future program(s) by calling -//! `gear.uploadCode` extrinsic to obtain the corresponding [`CodeId`]. +//! `gear.uploadCode` extrinsic to obtain the corresponding +//! [`CodeId`](crate::CodeId). //! //! You must also provide a unique byte sequence to create multiple program //! instances from the same code. This sequence is often referenced as _salt_. @@ -35,124 +36,10 @@ //! function. mod generator; - pub use generator::ProgramGenerator; -use crate::{ - async_runtime::signals, - common::errors::Result, - msg::{CodecCreateProgramFuture, CreateProgramFuture}, - prelude::convert::AsRef, - ActorId, CodeId, MessageId, -}; -use gstd_codegen::wait_create_program_for_reply; -use scale_info::scale::Decode; - -/// Create a new program from the already existing on-chain code identified by -/// [`CodeId`]. -/// -/// The function returns an initial message identifier and a newly created -/// program identifier. -/// -/// The first argument is the code identifier (see [`CodeId`] for details). The -/// second argument is an arbitrary byte sequence (also known as `salt`) that -/// allows the creation of multiple programs from the same code. The third and -/// last arguments are the initialization message's payload and value to be -/// transferred to the newly created program. -/// -/// # Examples -/// -/// Create a new program from the provided code identifier: -/// -/// ``` -/// use gstd::{msg, prog, CodeId}; -/// -/// #[no_mangle] -/// extern "C" fn handle() { -/// let code_id: CodeId = msg::load().expect("Unable to load"); -/// let (init_message_id, new_program_id) = -/// prog::create_program(code_id, "salt", b"INIT", 0).expect("Unable to create a program"); -/// msg::send_bytes(new_program_id, b"PING", 0).expect("Unable to send"); -/// } -/// ``` -#[wait_create_program_for_reply] -pub fn create_program( - code_id: CodeId, - salt: impl AsRef<[u8]>, - payload: impl AsRef<[u8]>, - value: u128, -) -> Result<(MessageId, ActorId)> { - create_program_delayed(code_id, salt, payload, value, 0) -} - -/// Same as [`create_program`], but creates a new program after the `delay` -/// expressed in block count. -/// -/// # Examples -/// -/// Create a new program from the provided code identifier after 100 blocks and -/// send a message to it after 200 blocks: -/// -/// ``` -/// use gstd::{msg, prog, CodeId}; -/// -/// #[no_mangle] -/// extern "C" fn handle() { -/// let code_id: CodeId = msg::load().expect("Unable to load"); -/// let (init_message_id, new_program_id) = -/// prog::create_program_delayed(code_id, "salt", b"INIT", 0, 100) -/// .expect("Unable to create a program"); -/// msg::send_bytes_delayed(new_program_id, b"PING", 0, 200).expect("Unable to send"); -/// } -/// ``` -pub fn create_program_delayed( - code_id: CodeId, - salt: impl AsRef<[u8]>, - payload: impl AsRef<[u8]>, - value: u128, - delay: u32, -) -> Result<(MessageId, ActorId)> { - let (message_id, program_id) = gcore::prog::create_program_delayed( - code_id.into(), - salt.as_ref(), - payload.as_ref(), - value, - delay, - )?; - - Ok((message_id.into(), program_id.into())) -} - -/// Same as [`create_program`], but with an explicit gas limit. -#[wait_create_program_for_reply] -pub fn create_program_with_gas( - code_id: CodeId, - salt: impl AsRef<[u8]>, - payload: impl AsRef<[u8]>, - gas_limit: u64, - value: u128, -) -> Result<(MessageId, ActorId)> { - create_program_with_gas_delayed(code_id, salt, payload, gas_limit, value, 0) -} - -/// Same as [`create_program_with_gas`], but creates a new program after the -/// `delay` expressed in block count. -pub fn create_program_with_gas_delayed( - code_id: CodeId, - salt: impl AsRef<[u8]>, - payload: impl AsRef<[u8]>, - gas_limit: u64, - value: u128, - delay: u32, -) -> Result<(MessageId, ActorId)> { - let (message_id, program_id) = gcore::prog::create_program_with_gas_delayed( - code_id.into(), - salt.as_ref(), - payload.as_ref(), - gas_limit, - value, - delay, - )?; +mod basic; +pub use basic::*; - Ok((message_id.into(), program_id.into())) -} +mod encoded; +pub use encoded::*; diff --git a/gtest/src/system.rs b/gtest/src/system.rs index 76d53f2d276..869f8a49994 100644 --- a/gtest/src/system.rs +++ b/gtest/src/system.rs @@ -129,7 +129,7 @@ impl System { /// /// This method is mainly used for providing a proper program from program /// creation logic. In order to successfully create a new program with - /// `gstd::prog::create_program_with_gas` function, developer should + /// `gstd::prog::create_program_bytes_with_gas` function, developer should /// provide to the function "child's" code hash. Code for that code hash /// must be in storage at the time of the function call. So this method /// stores the code in storage. From b527d8bf5d8373111ae252f820c11b8de5b7273e Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Tue, 15 Aug 2023 11:09:25 +0500 Subject: [PATCH 046/165] feat(manifest): complete the manifest of all published libraries (#3041) --- Cargo.lock | 26 +++++++++++++------------- Cargo.toml | 2 ++ common/Cargo.toml | 7 ++++++- common/codegen/Cargo.toml | 7 ++++++- core-backend/codegen/Cargo.toml | 7 ++++++- core-backend/common/Cargo.toml | 7 ++++++- core-backend/wasmi/Cargo.toml | 7 ++++++- core-errors/Cargo.toml | 5 ++++- core-processor/Cargo.toml | 7 ++++++- core/Cargo.toml | 7 ++++++- gcli/Cargo.toml | 12 ++++++------ gclient/Cargo.toml | 5 ++++- gmeta/Cargo.toml | 7 +++++++ gmeta/codegen/Cargo.toml | 9 ++++++++- gsdk/Cargo.toml | 12 +++++++----- gsdk/codegen/Cargo.toml | 7 ++++++- gsys/Cargo.toml | 5 +++++ utils/wasm-instrument/Cargo.toml | 7 ++++++- 18 files changed, 110 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 57de5edb3da..292826cf063 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3624,7 +3624,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.1.0" +version = "0.2.2" dependencies = [ "anyhow", "async-trait", @@ -3723,7 +3723,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.1.0" +version = "0.2.2" dependencies = [ "proc-macro2", "quote", @@ -3732,7 +3732,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.1.0" +version = "0.2.2" dependencies = [ "blake2-rfc", "derive_more", @@ -3764,7 +3764,7 @@ dependencies = [ [[package]] name = "gear-backend-wasmi" -version = "0.1.0" +version = "0.2.2" dependencies = [ "derive_more", "gear-backend-common", @@ -3836,7 +3836,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.1.0" +version = "0.2.2" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3864,7 +3864,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.1.0" +version = "0.2.2" dependencies = [ "quote", "syn 2.0.28", @@ -3872,7 +3872,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.1.0" +version = "0.2.2" dependencies = [ "blake2-rfc", "derive_more", @@ -3893,7 +3893,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.1.0" +version = "0.2.2" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3902,7 +3902,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.1.0" +version = "0.2.2" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -4376,7 +4376,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.1.0" +version = "0.2.2" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4560,7 +4560,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.1.0" +version = "0.2.2" dependencies = [ "gmeta", "gstd", @@ -4584,7 +4584,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.1.0" +version = "0.2.2" dependencies = [ "anyhow", "base64 0.21.2", @@ -4635,7 +4635,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.1.0" +version = "0.2.2" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 27e38b07ee1..4e1bd8ad0be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,8 @@ version = "0.2.2" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" +homepage = "https://www.gear-tech.io" +repository = "https://github.com/gear-tech/gear" [workspace] resolver = "2" diff --git a/common/Cargo.toml b/common/Cargo.toml index 880fa0c6a29..31adea61585 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -1,9 +1,14 @@ [package] name = "gear-common" -version = "0.1.0" +description = "Gear common library for the runtime" +keywords = ["gear", "wasm"] +categories = ["wasm"] +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] primitive-types = { workspace = true, features = ["scale-info"] } diff --git a/common/codegen/Cargo.toml b/common/codegen/Cargo.toml index aaa2272dbc2..709c8ca1ca4 100644 --- a/common/codegen/Cargo.toml +++ b/common/codegen/Cargo.toml @@ -1,9 +1,14 @@ [package] name = "gear-common-codegen" -version = "0.1.0" +description = "Code generation library for the Gear common library" +keywords = ["gear", "wasm", "codegen"] +categories = ["wasm"] +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [lib] proc-macro = true diff --git a/core-backend/codegen/Cargo.toml b/core-backend/codegen/Cargo.toml index ac4cf2603b2..a6f54390cd4 100644 --- a/core-backend/codegen/Cargo.toml +++ b/core-backend/codegen/Cargo.toml @@ -1,9 +1,14 @@ [package] name = "gear-backend-codegen" -version = "0.1.0" +description = "Code generation library for gear-core-backend" +keywords = ["gear", "wasm", "codegen"] +categories = ["wasm"] +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [lib] proc-macro = true diff --git a/core-backend/common/Cargo.toml b/core-backend/common/Cargo.toml index 76c33ec6920..50a477d2917 100644 --- a/core-backend/common/Cargo.toml +++ b/core-backend/common/Cargo.toml @@ -1,9 +1,14 @@ [package] name = "gear-backend-common" -version = "0.1.0" +description = "Common library for gear-core-backend" +keywords = ["gear", "wasm", "codegen"] +categories = ["wasm"] +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gear-core.workspace = true diff --git a/core-backend/wasmi/Cargo.toml b/core-backend/wasmi/Cargo.toml index 26f290cd35c..6faac3dd2bc 100644 --- a/core-backend/wasmi/Cargo.toml +++ b/core-backend/wasmi/Cargo.toml @@ -1,9 +1,14 @@ [package] name = "gear-backend-wasmi" -version = "0.1.0" +description = "Wasmi executor for the gear-backend" +keywords = ["gear", "wasm", "wasm-executor"] +categories = ["wasm"] +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gear-core.workspace = true diff --git a/core-errors/Cargo.toml b/core-errors/Cargo.toml index be9b1a07c8e..aea6cfdb4d4 100644 --- a/core-errors/Cargo.toml +++ b/core-errors/Cargo.toml @@ -1,9 +1,12 @@ [package] name = "gear-core-errors" -version = "0.1.0" +description = "Shared errors for Gear core libraries" +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] scale-info = { workspace = true, features = ["derive"], optional = true } diff --git a/core-processor/Cargo.toml b/core-processor/Cargo.toml index e693f279a51..752712d7895 100644 --- a/core-processor/Cargo.toml +++ b/core-processor/Cargo.toml @@ -1,9 +1,14 @@ [package] name = "gear-core-processor" -version = "0.1.0" +description = "The core processor for Gear programs" +keywords = ["gear", "wasm"] +categories = ["wasm"] +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gear-core.workspace = true diff --git a/core/Cargo.toml b/core/Cargo.toml index e430f73d697..84fbdf344d5 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,9 +1,14 @@ [package] name = "gear-core" -version = "0.1.0" +description = "Gear core library" +keywords = ["gear", "wasm"] +categories = ["wasm"] +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gear-core-errors = { workspace = true, features = ["codec"] } diff --git a/gcli/Cargo.toml b/gcli/Cargo.toml index 6237b0951eb..c9f00737360 100644 --- a/gcli/Cargo.toml +++ b/gcli/Cargo.toml @@ -1,15 +1,15 @@ [package] name = "gcli" +description = "Gear program CLI" +keywords = ["gear", "cli", "wasm"] +categories = ["command-line-interface", "command-line-utilities", "wasm"] +documentation = "https://docs.rs/gcli" version.workspace = true authors.workspace = true edition.workspace = true -description = "gear program cli" -repository = "https://github.com/gear-tech/gear/tree/master/program" license.workspace = true -documentation = "https://docs.rs/gear-program" -homepage = "https://github.com/gear-tech/gear/tree/master/program" -keywords = ["gear", "cli", "wasm"] -readme = "./README.md" +homepage.workspace = true +repository.workspace = true [[bin]] path = "bin/gcli.rs" diff --git a/gclient/Cargo.toml b/gclient/Cargo.toml index 10d3f74388b..3c0829285d7 100644 --- a/gclient/Cargo.toml +++ b/gclient/Cargo.toml @@ -1,9 +1,12 @@ [package] name = "gclient" -version = "0.1.0" +description = "API client for Gear node in Rust" +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gear-utils.workspace = true diff --git a/gmeta/Cargo.toml b/gmeta/Cargo.toml index 62dcb394c06..7f79855f0cf 100644 --- a/gmeta/Cargo.toml +++ b/gmeta/Cargo.toml @@ -1,7 +1,14 @@ [package] name = "gmeta" +description = "Metadata library for Gear programs" +keywords = ["gear", "wasm"] +categories = ["wasm"] version.workspace = true +authors.workspace = true edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] scale-info.workspace = true diff --git a/gmeta/codegen/Cargo.toml b/gmeta/codegen/Cargo.toml index 239283e2cea..b9be9f6f321 100644 --- a/gmeta/codegen/Cargo.toml +++ b/gmeta/codegen/Cargo.toml @@ -1,7 +1,14 @@ [package] name = "gmeta-codegen" -version = "0.1.0" +description = "Code generation library for the metadata of Gear program" +keywords = ["gear", "wasm", "codegen"] +categories = ["wasm"] +version.workspace = true +authors.workspace = true edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [lib] proc-macro = true diff --git a/gsdk/Cargo.toml b/gsdk/Cargo.toml index 8e5765b45c5..d823fcd42d9 100644 --- a/gsdk/Cargo.toml +++ b/gsdk/Cargo.toml @@ -1,12 +1,14 @@ [package] name = "gsdk" -version = "0.1.0" -edition.workspace = true +keywords = ["gear", "api", "sdk"] +categories = ["wasm", "api-bindings"] +description = "Rust SDK of the Gear network" +version.workspace = true authors.workspace = true -description = "Gear network rust sdk." +edition.workspace = true license.workspace = true -homepage = "https://github.com/gear-tech/gear/tree/master/gsdk" -readme = "./README.md" +homepage.workspace = true +repository.workspace = true [dependencies] anyhow.workspace = true diff --git a/gsdk/codegen/Cargo.toml b/gsdk/codegen/Cargo.toml index 51f31abc8a9..5d6fda229d1 100644 --- a/gsdk/codegen/Cargo.toml +++ b/gsdk/codegen/Cargo.toml @@ -1,9 +1,14 @@ [package] name = "gsdk-codegen" -version = "0.1.0" +description = "Code generation library for the Rust SDK of Gear network" +keywords = ["gear", "sdk", "codegen"] +categories = ["api-bindings"] +version.workspace = true edition.workspace = true authors.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [lib] proc-macro = true diff --git a/gsys/Cargo.toml b/gsys/Cargo.toml index 9fe39bc7386..16038648459 100644 --- a/gsys/Cargo.toml +++ b/gsys/Cargo.toml @@ -1,6 +1,11 @@ [package] name = "gsys" +description = "System calls of Gear program" +keywords = ["gear", "wasm"] +categories = ["wasm", "api-bindings"] version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true diff --git a/utils/wasm-instrument/Cargo.toml b/utils/wasm-instrument/Cargo.toml index d887f347280..a87373ba580 100644 --- a/utils/wasm-instrument/Cargo.toml +++ b/utils/wasm-instrument/Cargo.toml @@ -1,9 +1,14 @@ [package] name = "gear-wasm-instrument" -version = "0.1.0" +description = "Wasm instrument library for Gear programs" +keywords = ["gear", "wasm"] +categories = ["wasm"] +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gwasm-instrument = { workspace = true, features = ["sign_ext"] } From 77b9548689a3fc89a2d729947f54c66b0e8df39d Mon Sep 17 00:00:00 2001 From: Georgy Shepelev Date: Tue, 15 Aug 2023 10:02:57 +0300 Subject: [PATCH 047/165] refactor(sandbox-host): Process wasm-globals on wasmer side (#2969) --- Cargo.lock | 2 + core-backend/codegen/src/host.rs | 4 +- core-backend/common/src/funcs.rs | 209 +- core-backend/common/src/runtime.rs | 10 +- core-backend/sandbox/Cargo.toml | 1 + core-backend/sandbox/src/env.rs | 151 +- core-backend/sandbox/src/runtime.rs | 63 +- core-backend/wasmi/src/funcs_tree.rs | 9 +- core-backend/wasmi/src/runtime.rs | 13 +- pallets/gear/src/weights.rs | 2874 ++++++++-------- runtime-interface/src/gear_sandbox/detail.rs | 4 +- runtime-interface/src/gear_sandbox/mod.rs | 30 +- runtime/gear/src/weights/frame_system.rs | 78 +- runtime/gear/src/weights/pallet_balances.rs | 58 +- runtime/gear/src/weights/pallet_gear.rs | 2874 ++++++++-------- .../gear/src/weights/pallet_gear_voucher.rs | 10 +- runtime/gear/src/weights/pallet_timestamp.rs | 18 +- runtime/gear/src/weights/pallet_utility.rs | 66 +- runtime/vara/src/tests.rs | 2 +- runtime/vara/src/weights/frame_system.rs | 78 +- runtime/vara/src/weights/pallet_airdrop.rs | 28 +- runtime/vara/src/weights/pallet_balances.rs | 58 +- runtime/vara/src/weights/pallet_gear.rs | 2882 ++++++++--------- .../vara/src/weights/pallet_gear_voucher.rs | 10 +- runtime/vara/src/weights/pallet_timestamp.rs | 18 +- runtime/vara/src/weights/pallet_utility.rs | 66 +- sandbox/env/Cargo.toml | 2 + sandbox/env/src/lib.rs | 27 +- sandbox/host/src/sandbox.rs | 4 +- sandbox/host/src/sandbox/wasmer_backend.rs | 168 +- sandbox/sandbox/src/embedded_executor.rs | 53 +- sandbox/sandbox/src/host_executor.rs | 41 +- sandbox/sandbox/src/lib.rs | 44 +- utils/wasm-instrument/src/lib.rs | 1 + utils/wasm-proc/src/main.rs | 3 +- 35 files changed, 5121 insertions(+), 4838 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 292826cf063..6f1eac910fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3756,6 +3756,7 @@ dependencies = [ "gear-core", "gear-core-errors", "gear-sandbox", + "gear-sandbox-env", "gear-wasm-instrument", "gsys", "log", @@ -4188,6 +4189,7 @@ dependencies = [ "parity-scale-codec", "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-wasm-interface 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", ] [[package]] diff --git a/core-backend/codegen/src/host.rs b/core-backend/codegen/src/host.rs index e19eab19dbb..dd241427d31 100644 --- a/core-backend/codegen/src/host.rs +++ b/core-backend/codegen/src/host.rs @@ -122,14 +122,14 @@ impl HostFn { let run: Expr = match self.meta.call_type { CallType::Any => { parse_quote! { - ctx.run_any(#cost, |ctx| { + ctx.run_any(gas, #cost, |ctx| { #inner_block }) } } CallType::Fallible => { parse_quote! { - ctx.run_fallible::<_, _, #err>(err_mid_ptr, #cost, |ctx| { + ctx.run_fallible::<_, _, #err>(gas, err_mid_ptr, #cost, |ctx| { #inner_block }) } diff --git a/core-backend/common/src/funcs.rs b/core-backend/common/src/funcs.rs index 25958775ea4..31efa8b0d73 100644 --- a/core-backend/common/src/funcs.rs +++ b/core-backend/common/src/funcs.rs @@ -77,14 +77,17 @@ where .map_err(RunFallibleError::FallibleExt) } + // TODO #3037 + #[allow(clippy::too_many_arguments)] #[host(fallible, wgas, cost = RuntimeCosts::Send(len))] pub fn send( ctx: &mut R, + gas: u64, pid_value_ptr: u32, payload_ptr: u32, len: u32, delay: u32, - ) -> Result<(), R::Error> { + ) -> Result<(u64, ()), R::Error> { let read_hash_val = ctx.register_read_as(pid_value_ptr); let read_payload = ctx.register_read(payload_ptr, len); let HashWithValue { @@ -101,10 +104,11 @@ where #[host(fallible, wgas, cost = RuntimeCosts::SendCommit)] pub fn send_commit( ctx: &mut R, + gas: u64, handle: u32, pid_value_ptr: u32, delay: u32, - ) -> Result<(), R::Error> { + ) -> Result<(u64, ()), R::Error> { let read_pid_value = ctx.register_read_as(pid_value_ptr); let HashWithValue { hash: destination, @@ -121,12 +125,18 @@ where } #[host(fallible, cost = RuntimeCosts::SendInit, err = ErrorWithHandle)] - pub fn send_init(ctx: &mut R) -> Result<(), R::Error> { + pub fn send_init(ctx: &mut R, gas: u64) -> Result<(u64, ()), R::Error> { ctx.ext_mut().send_init().map_err(Into::into) } #[host(fallible, cost = RuntimeCosts::SendPush(len), err = ErrorBytes)] - pub fn send_push(ctx: &mut R, handle: u32, payload_ptr: u32, len: u32) -> Result<(), R::Error> { + pub fn send_push( + ctx: &mut R, + gas: u64, + handle: u32, + payload_ptr: u32, + len: u32, + ) -> Result<(u64, ()), R::Error> { let read_payload = ctx.register_read(payload_ptr, len); let payload = ctx.read(read_payload)?; @@ -138,11 +148,12 @@ where #[host(fallible, cost = RuntimeCosts::ReservationSend(len))] pub fn reservation_send( ctx: &mut R, + gas: u64, rid_pid_value_ptr: u32, payload_ptr: u32, len: u32, delay: u32, - ) -> Result<(), R::Error> { + ) -> Result<(u64, ()), R::Error> { let read_rid_pid_value = ctx.register_read_as(rid_pid_value_ptr); let read_payload = ctx.register_read(payload_ptr, len); let TwoHashesWithValue { @@ -164,10 +175,11 @@ where #[host(fallible, cost = RuntimeCosts::ReservationSendCommit)] pub fn reservation_send_commit( ctx: &mut R, + gas: u64, handle: u32, rid_pid_value_ptr: u32, delay: u32, - ) -> Result<(), R::Error> { + ) -> Result<(u64, ()), R::Error> { let read_rid_pid_value = ctx.register_read_as(rid_pid_value_ptr); let TwoHashesWithValue { hash1: reservation_id, @@ -186,7 +198,13 @@ where } #[host(fallible, cost = RuntimeCosts::Read, err = ErrorBytes)] - pub fn read(ctx: &mut R, at: u32, len: u32, buffer_ptr: u32) -> Result<(), R::Error> { + pub fn read( + ctx: &mut R, + gas: u64, + at: u32, + len: u32, + buffer_ptr: u32, + ) -> Result<(u64, ()), R::Error> { let payload_lock = ctx.ext_mut().lock_payload(at, len)?; payload_lock .drop_with::(|payload_access| { @@ -201,7 +219,7 @@ where } #[host(cost = RuntimeCosts::Size)] - pub fn size(ctx: &mut R, size_ptr: u32) -> Result<(), R::Error> { + pub fn size(ctx: &mut R, gas: u64, size_ptr: u32) -> Result<(u64, ()), R::Error> { let size = ctx.ext_mut().size()? as u32; let write_size = ctx.register_write_as(size_ptr); @@ -210,14 +228,14 @@ where } #[host(cost = RuntimeCosts::Exit)] - pub fn exit(ctx: &mut R, inheritor_id_ptr: u32) -> Result<(), R::Error> { + pub fn exit(ctx: &mut R, gas: u64, inheritor_id_ptr: u32) -> Result<(u64, ()), R::Error> { let read_inheritor_id = ctx.register_read_decoded(inheritor_id_ptr); let inheritor_id = ctx.read_decoded(read_inheritor_id)?; Err(ActorTerminationReason::Exit(inheritor_id).into()) } #[host(fallible, cost = RuntimeCosts::ReplyCode, err = ErrorWithReplyCode)] - pub fn reply_code(ctx: &mut R) -> Result<(), R::Error> { + pub fn reply_code(ctx: &mut R, gas: u64) -> Result<(u64, ()), R::Error> { ctx.ext_mut() .reply_code() .map(ReplyCode::to_bytes) @@ -226,7 +244,7 @@ where // TODO: write proper benchmark #2825 #[host(fallible, cost = RuntimeCosts::ReplyCode, err = ErrorWithSignalCode)] - pub fn signal_code(ctx: &mut R) -> Result<(), R::Error> { + pub fn signal_code(ctx: &mut R, gas: u64) -> Result<(u64, ()), R::Error> { ctx.ext_mut() .signal_code() .map(SignalCode::to_u32) @@ -234,7 +252,7 @@ where } #[host(cost = RuntimeCosts::Alloc(pages))] - pub fn alloc(ctx: &mut R, pages: u32) -> Result { + pub fn alloc(ctx: &mut R, gas: u64, pages: u32) -> Result<(u64, u32), R::Error> { let res = ctx.alloc(pages); let res = ctx.process_alloc_func_result(res)?; @@ -252,7 +270,7 @@ where } #[host(cost = RuntimeCosts::Free)] - pub fn free(ctx: &mut R, page_no: u32) -> Result { + pub fn free(ctx: &mut R, gas: u64, page_no: u32) -> Result<(u64, i32), R::Error> { let page = WasmPage::new(page_no).map_err(|_| { UndefinedTerminationReason::Actor(ActorTerminationReason::Trap( TrapExplanation::Unknown, @@ -275,7 +293,7 @@ where } #[host(cost = RuntimeCosts::BlockHeight)] - pub fn block_height(ctx: &mut R, height_ptr: u32) -> Result<(), R::Error> { + pub fn block_height(ctx: &mut R, gas: u64, height_ptr: u32) -> Result<(u64, ()), R::Error> { let height = ctx.ext_mut().block_height()?; let write_height = ctx.register_write_as(height_ptr); @@ -284,7 +302,11 @@ where } #[host(cost = RuntimeCosts::BlockTimestamp)] - pub fn block_timestamp(ctx: &mut R, timestamp_ptr: u32) -> Result<(), R::Error> { + pub fn block_timestamp( + ctx: &mut R, + gas: u64, + timestamp_ptr: u32, + ) -> Result<(u64, ()), R::Error> { let timestamp = ctx.ext_mut().block_timestamp()?; let write_timestamp = ctx.register_write_as(timestamp_ptr); @@ -293,7 +315,12 @@ where } #[host(cost = RuntimeCosts::Random)] - pub fn random(ctx: &mut R, subject_ptr: u32, bn_random_ptr: u32) -> Result<(), R::Error> { + pub fn random( + ctx: &mut R, + gas: u64, + subject_ptr: u32, + bn_random_ptr: u32, + ) -> Result<(u64, ()), R::Error> { let read_subject = ctx.register_read_decoded(subject_ptr); let write_bn_random = ctx.register_write_as(bn_random_ptr); @@ -310,7 +337,13 @@ where } #[host(fallible, wgas, cost = RuntimeCosts::Reply(len))] - pub fn reply(ctx: &mut R, payload_ptr: u32, len: u32, value_ptr: u32) -> Result<(), R::Error> { + pub fn reply( + ctx: &mut R, + gas: u64, + payload_ptr: u32, + len: u32, + value_ptr: u32, + ) -> Result<(u64, ()), R::Error> { let read_payload = ctx.register_read(payload_ptr, len); let value = Self::register_and_read_value(ctx, value_ptr)?; let payload = Self::read_message_payload(ctx, read_payload)?; @@ -321,7 +354,7 @@ where } #[host(fallible, wgas, cost = RuntimeCosts::ReplyCommit)] - pub fn reply_commit(ctx: &mut R, value_ptr: u32) -> Result<(), R::Error> { + pub fn reply_commit(ctx: &mut R, gas: u64, value_ptr: u32) -> Result<(u64, ()), R::Error> { let value = Self::register_and_read_value(ctx, value_ptr)?; ctx.ext_mut() @@ -332,10 +365,11 @@ where #[host(fallible, cost = RuntimeCosts::ReservationReply(len))] pub fn reservation_reply( ctx: &mut R, + gas: u64, rid_value_ptr: u32, payload_ptr: u32, len: u32, - ) -> Result<(), R::Error> { + ) -> Result<(u64, ()), R::Error> { let read_rid_value = ctx.register_read_as(rid_value_ptr); let read_payload = ctx.register_read(payload_ptr, len); let HashWithValue { @@ -350,7 +384,11 @@ where } #[host(fallible, cost = RuntimeCosts::ReservationReplyCommit)] - pub fn reservation_reply_commit(ctx: &mut R, rid_value_ptr: u32) -> Result<(), R::Error> { + pub fn reservation_reply_commit( + ctx: &mut R, + gas: u64, + rid_value_ptr: u32, + ) -> Result<(u64, ()), R::Error> { let read_rid_value = ctx.register_read_as(rid_value_ptr); let HashWithValue { hash: reservation_id, @@ -366,18 +404,23 @@ where } #[host(fallible, cost = RuntimeCosts::ReplyTo)] - pub fn reply_to(ctx: &mut R) -> Result<(), R::Error> { + pub fn reply_to(ctx: &mut R, gas: u64) -> Result<(u64, ()), R::Error> { ctx.ext_mut().reply_to().map_err(Into::into) } // TODO: write proper benchmark #2825 #[host(fallible, cost = RuntimeCosts::SignalFrom)] - pub fn signal_from(ctx: &mut R) -> Result<(), R::Error> { + pub fn signal_from(ctx: &mut R, gas: u64) -> Result<(u64, ()), R::Error> { ctx.ext_mut().signal_from().map_err(Into::into) } #[host(fallible, cost = RuntimeCosts::ReplyPush(len), err = ErrorBytes)] - pub fn reply_push(ctx: &mut R, payload_ptr: u32, len: u32) -> Result<(), R::Error> { + pub fn reply_push( + ctx: &mut R, + gas: u64, + payload_ptr: u32, + len: u32, + ) -> Result<(u64, ()), R::Error> { let read_payload = ctx.register_read(payload_ptr, len); let payload = ctx.read(read_payload)?; @@ -385,7 +428,13 @@ where } #[host(fallible, wgas, cost = RuntimeCosts::ReplyInput)] - pub fn reply_input(ctx: &mut R, offset: u32, len: u32, value_ptr: u32) -> Result<(), R::Error> { + pub fn reply_input( + ctx: &mut R, + gas: u64, + offset: u32, + len: u32, + value_ptr: u32, + ) -> Result<(u64, ()), R::Error> { // Charge for `len` is inside `reply_push_input` let value = Self::register_and_read_value(ctx, value_ptr)?; @@ -399,20 +448,27 @@ where } #[host(fallible, cost = RuntimeCosts::ReplyPushInput, err = ErrorBytes)] - pub fn reply_push_input(ctx: &mut R, offset: u32, len: u32) -> Result<(), R::Error> { + pub fn reply_push_input( + ctx: &mut R, + gas: u64, + offset: u32, + len: u32, + ) -> Result<(u64, ()), R::Error> { ctx.ext_mut() .reply_push_input(offset, len) .map_err(Into::into) } + #[allow(clippy::too_many_arguments)] #[host(fallible, wgas, cost = RuntimeCosts::SendInput)] pub fn send_input( ctx: &mut R, + gas: u64, pid_value_ptr: u32, offset: u32, len: u32, delay: u32, - ) -> Result<(), R::Error> { + ) -> Result<(u64, ()), R::Error> { // Charge for `len` inside `send_push_input` let read_pid_value = ctx.register_read_as(pid_value_ptr); let HashWithValue { @@ -436,17 +492,23 @@ where #[host(fallible, cost = RuntimeCosts::SendPushInput, err = ErrorBytes)] pub fn send_push_input( ctx: &mut R, + gas: u64, handle: u32, offset: u32, len: u32, - ) -> Result<(), R::Error> { + ) -> Result<(u64, ()), R::Error> { ctx.ext_mut() .send_push_input(handle, offset, len) .map_err(Into::into) } #[host(cost = RuntimeCosts::Debug(data_len))] - pub fn debug(ctx: &mut R, data_ptr: u32, data_len: u32) -> Result<(), R::Error> { + pub fn debug( + ctx: &mut R, + gas: u64, + data_ptr: u32, + data_len: u32, + ) -> Result<(u64, ()), R::Error> { let read_data = ctx.register_read(data_ptr, data_len); let data: RuntimeBuffer = ctx .read(read_data)? @@ -465,7 +527,12 @@ where } #[host(cost = RuntimeCosts::Null)] - pub fn panic(ctx: &mut R, data_ptr: u32, data_len: u32) -> Result<(), R::Error> { + pub fn panic( + ctx: &mut R, + gas: u64, + data_ptr: u32, + data_len: u32, + ) -> Result<(u64, ()), R::Error> { let read_data = ctx.register_read(data_ptr, data_len); let data = ctx.read(read_data).unwrap_or_default(); @@ -475,27 +542,43 @@ where } #[host(cost = RuntimeCosts::Null)] - pub fn oom_panic(ctx: &mut R) -> Result<(), R::Error> { + pub fn oom_panic(ctx: &mut R, gas: u64) -> Result<(u64, ()), R::Error> { Err(ActorTerminationReason::Trap(TrapExplanation::ProgramAllocOutOfBounds).into()) } #[host(fallible, cost = RuntimeCosts::ReserveGas)] - pub fn reserve_gas(ctx: &mut R, gas: u64, duration: u32) -> Result<(), R::Error> { - ctx.ext_mut().reserve_gas(gas, duration).map_err(Into::into) + pub fn reserve_gas( + ctx: &mut R, + gas: u64, + gas_value: u64, + duration: u32, + ) -> Result<(u64, ()), R::Error> { + ctx.ext_mut() + .reserve_gas(gas_value, duration) + .map_err(Into::into) } #[host(fallible, cost = RuntimeCosts::ReplyDeposit, err = ErrorBytes)] - pub fn reply_deposit(ctx: &mut R, message_id_ptr: u32, gas: u64) -> Result<(), R::Error> { + pub fn reply_deposit( + ctx: &mut R, + gas: u64, + message_id_ptr: u32, + gas_value: u64, + ) -> Result<(u64, ()), R::Error> { let read_message_id = ctx.register_read_decoded(message_id_ptr); let message_id = ctx.read_decoded(read_message_id)?; ctx.ext_mut() - .reply_deposit(message_id, gas) + .reply_deposit(message_id, gas_value) .map_err(Into::into) } #[host(fallible, cost = RuntimeCosts::UnreserveGas, err = ErrorWithGas)] - pub fn unreserve_gas(ctx: &mut R, reservation_id_ptr: u32) -> Result<(), R::Error> { + pub fn unreserve_gas( + ctx: &mut R, + gas: u64, + reservation_id_ptr: u32, + ) -> Result<(u64, ()), R::Error> { let read_reservation_id = ctx.register_read_decoded(reservation_id_ptr); let reservation_id = ctx.read_decoded(read_reservation_id)?; @@ -505,21 +588,27 @@ where } #[host(fallible, cost = RuntimeCosts::SystemReserveGas, err = ErrorBytes)] - pub fn system_reserve_gas(ctx: &mut R, gas: u64) -> Result<(), R::Error> { - ctx.ext_mut().system_reserve_gas(gas).map_err(Into::into) + pub fn system_reserve_gas( + ctx: &mut R, + gas: u64, + gas_value: u64, + ) -> Result<(u64, ()), R::Error> { + ctx.ext_mut() + .system_reserve_gas(gas_value) + .map_err(Into::into) } #[host(cost = RuntimeCosts::GasAvailable)] - pub fn gas_available(ctx: &mut R, gas_ptr: u32) -> Result<(), R::Error> { - let gas = ctx.ext_mut().gas_available()?; + pub fn gas_available(ctx: &mut R, gas: u64, gas_ptr: u32) -> Result<(u64, ()), R::Error> { + let gas_available = ctx.ext_mut().gas_available()?; let write_gas = ctx.register_write_as(gas_ptr); - ctx.write_as(write_gas, gas.to_le_bytes()) + ctx.write_as(write_gas, gas_available.to_le_bytes()) .map_err(Into::into) } #[host(cost = RuntimeCosts::MsgId)] - pub fn message_id(ctx: &mut R, message_id_ptr: u32) -> Result<(), R::Error> { + pub fn message_id(ctx: &mut R, gas: u64, message_id_ptr: u32) -> Result<(u64, ()), R::Error> { let message_id = ctx.ext_mut().message_id()?; let write_message_id = ctx.register_write_as(message_id_ptr); @@ -528,7 +617,7 @@ where } #[host(cost = RuntimeCosts::ProgramId)] - pub fn program_id(ctx: &mut R, program_id_ptr: u32) -> Result<(), R::Error> { + pub fn program_id(ctx: &mut R, gas: u64, program_id_ptr: u32) -> Result<(u64, ()), R::Error> { let program_id = ctx.ext_mut().program_id()?; let write_program_id = ctx.register_write_as(program_id_ptr); @@ -537,7 +626,11 @@ where } #[host(fallible, cost = RuntimeCosts::PayProgramRent, err = ErrorWithBlockNumberAndValue)] - pub fn pay_program_rent(ctx: &mut R, rent_pid_ptr: u32) -> Result<(), R::Error> { + pub fn pay_program_rent( + ctx: &mut R, + gas: u64, + rent_pid_ptr: u32, + ) -> Result<(u64, ()), R::Error> { let read_rent_pid = ctx.register_read_as(rent_pid_ptr); let HashWithValue { @@ -551,7 +644,7 @@ where } #[host(cost = RuntimeCosts::Source)] - pub fn source(ctx: &mut R, source_ptr: u32) -> Result<(), R::Error> { + pub fn source(ctx: &mut R, gas: u64, source_ptr: u32) -> Result<(u64, ()), R::Error> { let source = ctx.ext_mut().source()?; let write_source = ctx.register_write_as(source_ptr); @@ -560,7 +653,7 @@ where } #[host(cost = RuntimeCosts::Value)] - pub fn value(ctx: &mut R, value_ptr: u32) -> Result<(), R::Error> { + pub fn value(ctx: &mut R, gas: u64, value_ptr: u32) -> Result<(u64, ()), R::Error> { let value = ctx.ext_mut().value()?; let write_value = ctx.register_write_as(value_ptr); @@ -569,7 +662,7 @@ where } #[host(cost = RuntimeCosts::ValueAvailable)] - pub fn value_available(ctx: &mut R, value_ptr: u32) -> Result<(), R::Error> { + pub fn value_available(ctx: &mut R, gas: u64, value_ptr: u32) -> Result<(u64, ()), R::Error> { let value_available = ctx.ext_mut().value_available()?; let write_value = ctx.register_write_as(value_ptr); @@ -578,24 +671,24 @@ where } #[host(cost = RuntimeCosts::Leave)] - pub fn leave(ctx: &mut R) -> Result<(), R::Error> { + pub fn leave(ctx: &mut R, gas: u64) -> Result<(u64, ()), R::Error> { Err(ActorTerminationReason::Leave.into()) } #[host(cost = RuntimeCosts::Wait)] - pub fn wait(ctx: &mut R) -> Result<(), R::Error> { + pub fn wait(ctx: &mut R, gas: u64) -> Result<(u64, ()), R::Error> { ctx.ext_mut().wait()?; Err(ActorTerminationReason::Wait(None, MessageWaitedType::Wait).into()) } #[host(cost = RuntimeCosts::WaitFor)] - pub fn wait_for(ctx: &mut R, duration: u32) -> Result<(), R::Error> { + pub fn wait_for(ctx: &mut R, gas: u64, duration: u32) -> Result<(u64, ()), R::Error> { ctx.ext_mut().wait_for(duration)?; Err(ActorTerminationReason::Wait(Some(duration), MessageWaitedType::WaitFor).into()) } #[host(cost = RuntimeCosts::WaitUpTo)] - pub fn wait_up_to(ctx: &mut R, duration: u32) -> Result<(), R::Error> { + pub fn wait_up_to(ctx: &mut R, gas: u64, duration: u32) -> Result<(u64, ()), R::Error> { let waited_type = if ctx.ext_mut().wait_up_to(duration)? { MessageWaitedType::WaitUpToFull } else { @@ -605,7 +698,12 @@ where } #[host(fallible, cost = RuntimeCosts::Wake, err = ErrorBytes)] - pub fn wake(ctx: &mut R, message_id_ptr: u32, delay: u32) -> Result<(), R::Error> { + pub fn wake( + ctx: &mut R, + gas: u64, + message_id_ptr: u32, + delay: u32, + ) -> Result<(u64, ()), R::Error> { let read_message_id = ctx.register_read_decoded(message_id_ptr); let message_id = ctx.read_decoded(read_message_id)?; @@ -616,13 +714,14 @@ where #[host(fallible, wgas, cost = RuntimeCosts::CreateProgram(payload_len, salt_len), err = ErrorWithTwoHashes)] pub fn create_program( ctx: &mut R, + gas: u64, cid_value_ptr: u32, salt_ptr: u32, salt_len: u32, payload_ptr: u32, payload_len: u32, delay: u32, - ) -> Result<(), R::Error> { + ) -> Result<(u64, ()), R::Error> { let read_cid_value = ctx.register_read_as(cid_value_ptr); let read_salt = ctx.register_read(salt_ptr, salt_len); let read_payload = ctx.register_read(payload_ptr, payload_len); @@ -638,15 +737,15 @@ where .map_err(Into::into) } - pub fn forbidden(ctx: &mut R) -> Result<(), R::Error> { + pub fn forbidden(ctx: &mut R, gas: u64) -> Result<(u64, ()), R::Error> { syscall_trace!("forbidden"); - ctx.run_any(RuntimeCosts::Null, |_| { + ctx.run_any(gas, RuntimeCosts::Null, |_| { Err(ActorTerminationReason::Trap(TrapExplanation::ForbiddenFunction).into()) }) } - pub fn out_of_gas(ctx: &mut R) -> Result<(), R::Error> { + pub fn out_of_gas(ctx: &mut R, _gas: u64) -> Result<(u64, ()), R::Error> { syscall_trace!("out_of_gas"); let ext = ctx.ext_mut(); diff --git a/core-backend/common/src/runtime.rs b/core-backend/common/src/runtime.rs index 64f59471aa4..308d3a1db53 100644 --- a/core-backend/common/src/runtime.rs +++ b/core-backend/common/src/runtime.rs @@ -50,16 +50,22 @@ pub trait Runtime: fn ext_mut(&mut self) -> &mut Ext; - fn run_any(&mut self, cost: RuntimeCosts, f: F) -> Result + fn run_any( + &mut self, + gas: u64, + cost: RuntimeCosts, + f: F, + ) -> Result<(u64, T), Self::Error> where F: FnOnce(&mut Self) -> Result; fn run_fallible( &mut self, + gas: u64, res_ptr: u32, cost: RuntimeCosts, f: F, - ) -> Result<(), Self::Error> + ) -> Result<(u64, ()), Self::Error> where F: FnOnce(&mut Self) -> Result, R: From> + Sized; diff --git a/core-backend/sandbox/Cargo.toml b/core-backend/sandbox/Cargo.toml index 4d9b264c6d3..9c0e6e710ef 100644 --- a/core-backend/sandbox/Cargo.toml +++ b/core-backend/sandbox/Cargo.toml @@ -13,6 +13,7 @@ gsys ={ workspace = true } gear-wasm-instrument.workspace = true gear-sandbox.workspace = true +gear-sandbox-env.workspace = true # Use max_level_debug feature to remove tracing in sys-calls by default. log.workspace = true derive_more.workspace = true diff --git a/core-backend/sandbox/src/env.rs b/core-backend/sandbox/src/env.rs index 42375e9f5f8..efb2691e6a8 100644 --- a/core-backend/sandbox/src/env.rs +++ b/core-backend/sandbox/src/env.rs @@ -38,9 +38,10 @@ use gear_core::{ }; use gear_sandbox::{ default_executor::{EnvironmentDefinitionBuilder, Instance, Memory as DefaultExecutorMemory}, - HostError, HostFuncType, InstanceGlobals, ReturnValue, SandboxEnvironmentBuilder, - SandboxInstance, SandboxMemory, Value, + HostError, HostFuncType, IntoValue, ReturnValue, SandboxEnvironmentBuilder, SandboxInstance, + SandboxMemory, Value, }; +use gear_sandbox_env::WasmReturnValue; use gear_wasm_instrument::{ syscalls::SysCallName::{self, *}, GLOBAL_NAME_GAS, STACK_END_EXPORT_NAME, @@ -93,16 +94,24 @@ impl TryFrom for u64 { macro_rules! wrap_common_func_internal_ret{ ($func:path, $($arg_no:expr),*) => { - |ctx, args| -> Result { - $func(ctx, $(SandboxValue(args[$arg_no]).try_into()?,)*).map(|ret| Into::::into(ret).0.into()) + |ctx, args: &[Value]| -> Result { + $func(ctx, $(SandboxValue(args[$arg_no]).try_into()?,)*) + .map(|(gas, r)| WasmReturnValue { + gas: gas as i64, + inner: r.into_value().into(), + }) } } } macro_rules! wrap_common_func_internal_no_ret{ ($func:path, $($arg_no:expr),*) => { - |ctx, _args| -> Result { - $func(ctx, $(SandboxValue(_args[$arg_no]).try_into()?,)*).map(|_| ReturnValue::Unit) + |ctx, _args: &[Value]| -> Result { + $func(ctx, $(SandboxValue(_args[$arg_no]).try_into()?,)*) + .map(|(gas, _)| WasmReturnValue { + gas: gas as i64, + inner: ReturnValue::Unit, + }) } } } @@ -118,6 +127,8 @@ macro_rules! wrap_common_func { ($func:path, (6) -> ()) => { wrap_common_func_internal_no_ret!($func, 0, 1, 2, 3, 4, 5) }; ($func:path, (7) -> ()) => { wrap_common_func_internal_no_ret!($func, 0, 1, 2, 3, 4, 5, 6) }; ($func:path, (8) -> ()) => { wrap_common_func_internal_no_ret!($func, 0, 1, 2, 3, 4, 5, 6, 7) }; + ($func:path, (9) -> ()) => { wrap_common_func_internal_no_ret!($func, 0, 1, 2, 3, 4, 5, 6, 7, 8) }; + ($func:path, (10) -> ()) => { wrap_common_func_internal_no_ret!($func, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9) }; ($func:path, () -> (1)) => { wrap_common_func_internal_ret!($func,) }; ($func:path, (1) -> (1)) => { wrap_common_func_internal_ret!($func, 0) }; @@ -127,6 +138,8 @@ macro_rules! wrap_common_func { ($func:path, (5) -> (1)) => { wrap_common_func_internal_ret!($func, 0, 1, 2, 3, 4) }; ($func:path, (6) -> (1)) => { wrap_common_func_internal_ret!($func, 0, 1, 2, 3, 4, 5) }; ($func:path, (7) -> (1)) => { wrap_common_func_internal_ret!($func, 0, 1, 2, 3, 4, 5, 6) }; + ($func:path, (8) -> (1)) => { wrap_common_func_internal_ret!($func, 0, 1, 2, 3, 4, 5, 6, 7) }; + ($func:path, (9) -> (1)) => { wrap_common_func_internal_ret!($func, 0, 1, 2, 3, 4, 5, 6, 7, 8) }; } #[derive(Debug, derive_more::Display)] @@ -171,7 +184,7 @@ where self.env_def_builder.add_host_func( "env", name.to_str(), - wrap_common_func!(FuncsHandler::forbidden, () -> ()), + wrap_common_func!(FuncsHandler::forbidden, (1) -> ()), ); } else { self.env_def_builder.add_host_func("env", name.to_str(), f); @@ -203,62 +216,62 @@ where { #[rustfmt::skip] fn bind_funcs(builder: &mut EnvBuilder) { - builder.add_func(BlockHeight, wrap_common_func!(FuncsHandler::block_height, (1) -> ())); - builder.add_func(BlockTimestamp,wrap_common_func!(FuncsHandler::block_timestamp, (1) -> ())); - builder.add_func(CreateProgram, wrap_common_func!(FuncsHandler::create_program, (7) -> ())); - builder.add_func(CreateProgramWGas, wrap_common_func!(FuncsHandler::create_program_wgas, (8) -> ())); - builder.add_func(Debug, wrap_common_func!(FuncsHandler::debug, (2) -> ())); - builder.add_func(Panic, wrap_common_func!(FuncsHandler::panic, (2) -> ())); - builder.add_func(OomPanic, wrap_common_func!(FuncsHandler::oom_panic, () -> ())); - builder.add_func(Exit, wrap_common_func!(FuncsHandler::exit, (1) -> ())); - builder.add_func(ReplyCode, wrap_common_func!(FuncsHandler::reply_code, (1) -> ())); - builder.add_func(SignalCode, wrap_common_func!(FuncsHandler::signal_code, (1) -> ())); - builder.add_func(ReserveGas, wrap_common_func!(FuncsHandler::reserve_gas, (3) -> ())); - builder.add_func(ReplyDeposit, wrap_common_func!(FuncsHandler::reply_deposit, (3) -> ())); - builder.add_func(UnreserveGas, wrap_common_func!(FuncsHandler::unreserve_gas, (2) -> ())); - builder.add_func(GasAvailable, wrap_common_func!(FuncsHandler::gas_available, (1) -> ())); - builder.add_func(Leave, wrap_common_func!(FuncsHandler::leave, () -> ())); - builder.add_func(MessageId, wrap_common_func!(FuncsHandler::message_id, (1) -> ())); - builder.add_func(PayProgramRent, wrap_common_func!(FuncsHandler::pay_program_rent, (2) -> ())); - builder.add_func(ProgramId, wrap_common_func!(FuncsHandler::program_id, (1) -> ())); - builder.add_func(Random, wrap_common_func!(FuncsHandler::random, (2) -> ())); - builder.add_func(Read, wrap_common_func!(FuncsHandler::read, (4) -> ())); - builder.add_func(Reply, wrap_common_func!(FuncsHandler::reply, (4) -> ())); - builder.add_func(ReplyCommit, wrap_common_func!(FuncsHandler::reply_commit, (2) -> ())); - builder.add_func(ReplyCommitWGas, wrap_common_func!(FuncsHandler::reply_commit_wgas, (3) -> ())); - builder.add_func(ReplyPush, wrap_common_func!(FuncsHandler::reply_push, (3) -> ())); - builder.add_func(ReplyTo, wrap_common_func!(FuncsHandler::reply_to, (1) -> ())); - builder.add_func(SignalFrom, wrap_common_func!(FuncsHandler::signal_from, (1) -> ())); - builder.add_func(ReplyWGas, wrap_common_func!(FuncsHandler::reply_wgas, (5) -> ())); - builder.add_func(ReplyInput, wrap_common_func!(FuncsHandler::reply_input, (4) -> ())); - builder.add_func(ReplyPushInput, wrap_common_func!(FuncsHandler::reply_push_input, (3) -> ())); - builder.add_func(ReplyInputWGas, wrap_common_func!(FuncsHandler::reply_input_wgas, (5) -> ())); - builder.add_func(Send, wrap_common_func!(FuncsHandler::send, (5) -> ())); - builder.add_func(SendCommit, wrap_common_func!(FuncsHandler::send_commit, (4) -> ())); - builder.add_func(SendCommitWGas, wrap_common_func!(FuncsHandler::send_commit_wgas, (5) -> ())); - builder.add_func(SendInit, wrap_common_func!(FuncsHandler::send_init, (1) -> ())); - builder.add_func(SendPush, wrap_common_func!(FuncsHandler::send_push, (4) -> ())); - builder.add_func(SendWGas, wrap_common_func!(FuncsHandler::send_wgas, (6) -> ())); - builder.add_func(SendInput, wrap_common_func!(FuncsHandler::send_input, (5) -> ())); - builder.add_func(SendPushInput, wrap_common_func!(FuncsHandler::send_push_input, (4) -> ())); - builder.add_func(SendInputWGas, wrap_common_func!(FuncsHandler::send_input_wgas, (6) -> ())); - builder.add_func(Size, wrap_common_func!(FuncsHandler::size, (1) -> ())); - builder.add_func(Source, wrap_common_func!(FuncsHandler::source, (1) -> ())); - builder.add_func(Value, wrap_common_func!(FuncsHandler::value, (1) -> ())); - builder.add_func(ValueAvailable, wrap_common_func!(FuncsHandler::value_available, (1) -> ())); - builder.add_func(Wait, wrap_common_func!(FuncsHandler::wait, () -> ())); - builder.add_func(WaitFor, wrap_common_func!(FuncsHandler::wait_for, (1) -> ())); - builder.add_func(WaitUpTo, wrap_common_func!(FuncsHandler::wait_up_to, (1) -> ())); - builder.add_func(Wake, wrap_common_func!(FuncsHandler::wake, (3) -> ())); - builder.add_func(SystemReserveGas, wrap_common_func!(FuncsHandler::system_reserve_gas, (2) -> ())); - builder.add_func(ReservationReply, wrap_common_func!(FuncsHandler::reservation_reply, (4) -> ())); - builder.add_func(ReservationReplyCommit, wrap_common_func!(FuncsHandler::reservation_reply_commit, (2) -> ())); - builder.add_func(ReservationSend, wrap_common_func!(FuncsHandler::reservation_send, (5) -> ())); - builder.add_func(ReservationSendCommit, wrap_common_func!(FuncsHandler::reservation_send_commit, (4) -> ())); - builder.add_func(OutOfGas, wrap_common_func!(FuncsHandler::out_of_gas, () -> ())); - - builder.add_func(Alloc, wrap_common_func!(FuncsHandler::alloc, (1) -> (1))); - builder.add_func(Free, wrap_common_func!(FuncsHandler::free, (1) -> (1))); + builder.add_func(BlockHeight, wrap_common_func!(FuncsHandler::block_height, (2) -> ())); + builder.add_func(BlockTimestamp,wrap_common_func!(FuncsHandler::block_timestamp, (2) -> ())); + builder.add_func(CreateProgram, wrap_common_func!(FuncsHandler::create_program, (8) -> ())); + builder.add_func(CreateProgramWGas, wrap_common_func!(FuncsHandler::create_program_wgas, (9) -> ())); + builder.add_func(Debug, wrap_common_func!(FuncsHandler::debug, (3) -> ())); + builder.add_func(Panic, wrap_common_func!(FuncsHandler::panic, (3) -> ())); + builder.add_func(OomPanic, wrap_common_func!(FuncsHandler::oom_panic, (1) -> ())); + builder.add_func(Exit, wrap_common_func!(FuncsHandler::exit, (2) -> ())); + builder.add_func(ReplyCode, wrap_common_func!(FuncsHandler::reply_code, (2) -> ())); + builder.add_func(SignalCode, wrap_common_func!(FuncsHandler::signal_code, (2) -> ())); + builder.add_func(ReserveGas, wrap_common_func!(FuncsHandler::reserve_gas, (4) -> ())); + builder.add_func(ReplyDeposit, wrap_common_func!(FuncsHandler::reply_deposit, (4) -> ())); + builder.add_func(UnreserveGas, wrap_common_func!(FuncsHandler::unreserve_gas, (3) -> ())); + builder.add_func(GasAvailable, wrap_common_func!(FuncsHandler::gas_available, (2) -> ())); + builder.add_func(Leave, wrap_common_func!(FuncsHandler::leave, (1) -> ())); + builder.add_func(MessageId, wrap_common_func!(FuncsHandler::message_id, (2) -> ())); + builder.add_func(PayProgramRent, wrap_common_func!(FuncsHandler::pay_program_rent, (3) -> ())); + builder.add_func(ProgramId, wrap_common_func!(FuncsHandler::program_id, (2) -> ())); + builder.add_func(Random, wrap_common_func!(FuncsHandler::random, (3) -> ())); + builder.add_func(Read, wrap_common_func!(FuncsHandler::read, (5) -> ())); + builder.add_func(Reply, wrap_common_func!(FuncsHandler::reply, (5) -> ())); + builder.add_func(ReplyCommit, wrap_common_func!(FuncsHandler::reply_commit, (3) -> ())); + builder.add_func(ReplyCommitWGas, wrap_common_func!(FuncsHandler::reply_commit_wgas, (4) -> ())); + builder.add_func(ReplyPush, wrap_common_func!(FuncsHandler::reply_push, (4) -> ())); + builder.add_func(ReplyTo, wrap_common_func!(FuncsHandler::reply_to, (2) -> ())); + builder.add_func(SignalFrom, wrap_common_func!(FuncsHandler::signal_from, (2) -> ())); + builder.add_func(ReplyWGas, wrap_common_func!(FuncsHandler::reply_wgas, (6) -> ())); + builder.add_func(ReplyInput, wrap_common_func!(FuncsHandler::reply_input, (5) -> ())); + builder.add_func(ReplyPushInput, wrap_common_func!(FuncsHandler::reply_push_input, (4) -> ())); + builder.add_func(ReplyInputWGas, wrap_common_func!(FuncsHandler::reply_input_wgas, (6) -> ())); + builder.add_func(Send, wrap_common_func!(FuncsHandler::send, (6) -> ())); + builder.add_func(SendCommit, wrap_common_func!(FuncsHandler::send_commit, (5) -> ())); + builder.add_func(SendCommitWGas, wrap_common_func!(FuncsHandler::send_commit_wgas, (6) -> ())); + builder.add_func(SendInit, wrap_common_func!(FuncsHandler::send_init, (2) -> ())); + builder.add_func(SendPush, wrap_common_func!(FuncsHandler::send_push, (5) -> ())); + builder.add_func(SendWGas, wrap_common_func!(FuncsHandler::send_wgas, (7) -> ())); + builder.add_func(SendInput, wrap_common_func!(FuncsHandler::send_input, (6) -> ())); + builder.add_func(SendPushInput, wrap_common_func!(FuncsHandler::send_push_input, (5) -> ())); + builder.add_func(SendInputWGas, wrap_common_func!(FuncsHandler::send_input_wgas, (7) -> ())); + builder.add_func(Size, wrap_common_func!(FuncsHandler::size, (2) -> ())); + builder.add_func(Source, wrap_common_func!(FuncsHandler::source, (2) -> ())); + builder.add_func(Value, wrap_common_func!(FuncsHandler::value, (2) -> ())); + builder.add_func(ValueAvailable, wrap_common_func!(FuncsHandler::value_available, (2) -> ())); + builder.add_func(Wait, wrap_common_func!(FuncsHandler::wait, (1) -> ())); + builder.add_func(WaitFor, wrap_common_func!(FuncsHandler::wait_for, (2) -> ())); + builder.add_func(WaitUpTo, wrap_common_func!(FuncsHandler::wait_up_to, (2) -> ())); + builder.add_func(Wake, wrap_common_func!(FuncsHandler::wake, (4) -> ())); + builder.add_func(SystemReserveGas, wrap_common_func!(FuncsHandler::system_reserve_gas, (3) -> ())); + builder.add_func(ReservationReply, wrap_common_func!(FuncsHandler::reservation_reply, (5) -> ())); + builder.add_func(ReservationReplyCommit, wrap_common_func!(FuncsHandler::reservation_reply_commit, (3) -> ())); + builder.add_func(ReservationSend, wrap_common_func!(FuncsHandler::reservation_send, (6) -> ())); + builder.add_func(ReservationSendCommit, wrap_common_func!(FuncsHandler::reservation_send_commit, (5) -> ())); + builder.add_func(OutOfGas, wrap_common_func!(FuncsHandler::out_of_gas, (1) -> ())); + + builder.add_func(Alloc, wrap_common_func!(FuncsHandler::alloc, (2) -> (1))); + builder.add_func(Free, wrap_common_func!(FuncsHandler::free, (2) -> (1))); } } @@ -324,7 +337,6 @@ where let mut runtime = Runtime { ext, memory: MemoryWrap::new(memory), - globals: Default::default(), memory_manager: Default::default(), termination_reason: ActorTerminationReason::Success.into(), }; @@ -367,15 +379,9 @@ where .and_then(|global| global.as_i32()) .map(|global| global as u32); - runtime.globals = instance - .instance_globals() - .ok_or(System(GlobalsNotSupported))?; - let gas = runtime.ext.define_current_counter(); - // Setting initial value of global. - runtime - .globals + instance .set_global_val(GLOBAL_NAME_GAS, Value::I64(gas as i64)) .map_err(|_| System(WrongInjectedGas))?; @@ -405,8 +411,7 @@ where .unwrap_or(Ok(ReturnValue::Unit)); // Fetching global value. - let gas = runtime - .globals + let gas = instance .get_global_val(GLOBAL_NAME_GAS) .and_then(runtime::as_u64) .ok_or(System(WrongInjectedGas))?; diff --git a/core-backend/sandbox/src/runtime.rs b/core-backend/sandbox/src/runtime.rs index 62d5bbcf91f..1e2573239b4 100644 --- a/core-backend/sandbox/src/runtime.rs +++ b/core-backend/sandbox/src/runtime.rs @@ -30,8 +30,7 @@ use gear_backend_common::{ BackendExternalities, BackendState, BackendTermination, UndefinedTerminationReason, }; use gear_core::{costs::RuntimeCosts, pages::WasmPage}; -use gear_sandbox::{HostError, InstanceGlobals, Value}; -use gear_wasm_instrument::GLOBAL_NAME_GAS; +use gear_sandbox::{HostError, Value}; pub(crate) fn as_i64(v: Value) -> Option { match v { @@ -48,7 +47,6 @@ pub(crate) struct Runtime { pub ext: Ext, pub memory: MemoryWrap, pub termination_reason: UndefinedTerminationReason, - pub globals: gear_sandbox::default_executor::InstanceGlobals, // TODO: make wrapper around runtime and move memory_manager there (issue #2067) pub memory_manager: MemoryAccessManager, } @@ -64,28 +62,37 @@ impl CommonRuntime for Runtime { HostError } - fn run_any(&mut self, cost: RuntimeCosts, f: F) -> Result + fn run_any(&mut self, gas: u64, cost: RuntimeCosts, f: F) -> Result<(u64, T), Self::Error> where F: FnOnce(&mut Self) -> Result, { - self.with_globals_update(|ctx| { - ctx.prepare_run(); - ctx.ext.charge_gas_runtime(cost)?; - f(ctx) - }) + self.prepare_run(gas); + + let run = || { + self.ext.charge_gas_runtime(cost)?; + f(self) + }; + + run() + .map_err(|err| { + self.set_termination_reason(err); + HostError + }) + .map(|r| (self.ext.define_current_counter(), r)) } fn run_fallible( &mut self, + gas: u64, res_ptr: u32, cost: RuntimeCosts, f: F, - ) -> Result<(), Self::Error> + ) -> Result<(u64, ()), Self::Error> where F: FnOnce(&mut Self) -> Result, R: From> + Sized, { - self.run_any(cost, |ctx| { + self.run_any(gas, cost, |ctx| { let res = f(ctx); let res = ctx.process_fallible_func_result(res)?; @@ -94,7 +101,6 @@ impl CommonRuntime for Runtime { ctx.write_as(write_res, R::from(res)).map_err(Into::into) }) - .map(|_| ()) } fn alloc(&mut self, pages: u32) -> Result::AllocError> { @@ -104,43 +110,12 @@ impl CommonRuntime for Runtime { impl Runtime { // Cleans `memory_manager`, updates ext counters based on globals. - fn prepare_run(&mut self) { + fn prepare_run(&mut self, gas: u64) { self.memory_manager = Default::default(); - let gas = self - .globals - .get_global_val(GLOBAL_NAME_GAS) - .and_then(as_u64) - .unwrap_or_else(|| unreachable!("Globals must be checked during env creation")); - self.ext.decrease_current_counter_to(gas); } - // Updates globals after execution. - fn update_globals(&mut self) { - let gas = self.ext.define_current_counter(); - - self.globals - .set_global_val(GLOBAL_NAME_GAS, Value::I64(gas as i64)) - .unwrap_or_else(|e| { - unreachable!("Globals must be checked during env creation: {:?}", e) - }); - } - - fn with_globals_update(&mut self, f: F) -> Result - where - F: FnOnce(&mut Self) -> Result, - { - let result = f(self).map_err(|err| { - self.set_termination_reason(err); - HostError - }); - - self.update_globals(); - - result - } - fn with_memory(&mut self, f: F) -> Result where F: FnOnce( diff --git a/core-backend/wasmi/src/funcs_tree.rs b/core-backend/wasmi/src/funcs_tree.rs index ac0d6d2e9f9..dba1ef58a79 100644 --- a/core-backend/wasmi/src/funcs_tree.rs +++ b/core-backend/wasmi/src/funcs_tree.rs @@ -46,7 +46,9 @@ macro_rules! wrap_common_func_internal_ret { let func = move |caller: Caller<'_, HostState>, $($arg_name,)*| -> Result<(_, ), Trap> { let mut ctx = CallerWrap::prepare(caller, forbidden, memory)?; - $func(&mut ctx, $($arg_name,)*).map(|ret| (ret,)) + // Zero-value argument is an unused gas value for wasmi backend as well + // as the first element of the result tuple. + $func(&mut ctx, 0, $($arg_name,)*).map(|(_, r)| (r,)) }; Func::wrap(store, func) } @@ -59,7 +61,10 @@ macro_rules! wrap_common_func_internal_no_ret { let func = move |caller: Caller<'_, HostState>, $($arg_name,)*| -> Result<(), Trap> { let mut ctx = CallerWrap::prepare(caller, forbidden, memory)?; - $func(&mut ctx, $($arg_name,)*) + // Zero-value argument is an unused gas value for wasmi backend as well + // as the first element of the result tuple. + $func(&mut ctx, 0, $($arg_name,)*) + .map(|(_, r)| r) }; Func::wrap(store, func) } diff --git a/core-backend/wasmi/src/runtime.rs b/core-backend/wasmi/src/runtime.rs index 2c702561542..da154a83905 100644 --- a/core-backend/wasmi/src/runtime.rs +++ b/core-backend/wasmi/src/runtime.rs @@ -80,28 +80,35 @@ impl<'a, Ext: BackendExternalities + 'static> Runtime for CallerWrap<'a, Ex } #[track_caller] - fn run_any(&mut self, cost: RuntimeCosts, f: F) -> Result + fn run_any( + &mut self, + _gas: u64, + cost: RuntimeCosts, + f: F, + ) -> Result<(u64, T), Self::Error> where F: FnOnce(&mut Self) -> Result, { self.with_globals_update(|ctx| { ctx.host_state_mut().ext.charge_gas_runtime(cost)?; - f(ctx) + f(ctx).map(|r| (0, r)) }) } #[track_caller] fn run_fallible( &mut self, + gas: u64, res_ptr: u32, cost: RuntimeCosts, f: F, - ) -> Result<(), Self::Error> + ) -> Result<(u64, ()), Self::Error> where F: FnOnce(&mut Self) -> Result, R: From> + Sized, { self.run_any( + gas, cost, |ctx: &mut Self| -> Result<_, UndefinedTerminationReason> { let res = f(ctx); diff --git a/pallets/gear/src/weights.rs b/pallets/gear/src/weights.rs index 7a7a7a774c7..ccc5aa6d48e 100644 --- a/pallets/gear/src/weights.rs +++ b/pallets/gear/src/weights.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -246,10 +246,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 965_000 picoseconds. - Weight::from_parts(1_020_000, 0) - // Standard Error: 753 - .saturating_add(Weight::from_parts(247_354, 0).saturating_mul(c.into())) + // Minimum execution time: 954_000 picoseconds. + Weight::from_parts(1_004_000, 0) + // Standard Error: 802 + .saturating_add(Weight::from_parts(249_956, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -257,10 +257,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_780_000 picoseconds. - Weight::from_parts(2_874_000, 3506) - // Standard Error: 924 - .saturating_add(Weight::from_parts(674_078, 0).saturating_mul(c.into())) + // Minimum execution time: 2_808_000 picoseconds. + Weight::from_parts(2_895_000, 3506) + // Standard Error: 1_086 + .saturating_add(Weight::from_parts(680_150, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -269,17 +269,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 51_392_000 picoseconds. - Weight::from_parts(63_325_658, 0) - // Standard Error: 13_432 - .saturating_add(Weight::from_parts(2_671_521, 0).saturating_mul(c.into())) + // Minimum execution time: 52_458_000 picoseconds. + Weight::from_parts(84_558_500, 0) + // Standard Error: 7_412 + .saturating_add(Weight::from_parts(2_377_997, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 85_039_000 picoseconds. - Weight::from_parts(86_523_000, 42236) + // Minimum execution time: 81_302_000 picoseconds. + Weight::from_parts(83_307_000, 42236) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -287,8 +287,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 54_302_000 picoseconds. - Weight::from_parts(56_159_000, 21261) + // Minimum execution time: 52_219_000 picoseconds. + Weight::from_parts(53_704_000, 21261) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -296,8 +296,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 29_099_000 picoseconds. - Weight::from_parts(30_610_000, 17070) + // Minimum execution time: 28_408_000 picoseconds. + Weight::from_parts(29_714_000, 17070) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -306,10 +306,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_259_000 picoseconds. - Weight::from_parts(6_228_584, 7640) - // Standard Error: 37_556 - .saturating_add(Weight::from_parts(16_519_610, 0).saturating_mul(c.into())) + // Minimum execution time: 7_918_000 picoseconds. + Weight::from_parts(6_745_647, 7640) + // Standard Error: 37_300 + .saturating_add(Weight::from_parts(13_885_473, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -318,10 +318,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1297 + c * (16389 ±0)` // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 70_699_000 picoseconds. - Weight::from_parts(71_447_000, 40898) - // Standard Error: 139_719 - .saturating_add(Weight::from_parts(54_319_486, 0).saturating_mul(c.into())) + // Minimum execution time: 68_486_000 picoseconds. + Weight::from_parts(69_079_000, 40898) + // Standard Error: 164_982 + .saturating_add(Weight::from_parts(55_774_264, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -332,10 +332,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 60_906_000 picoseconds. - Weight::from_parts(18_999_485, 4990) - // Standard Error: 57_215 - .saturating_add(Weight::from_parts(53_057_311, 0).saturating_mul(c.into())) + // Minimum execution time: 61_635_000 picoseconds. + Weight::from_parts(64_537_590, 4990) + // Standard Error: 40_298 + .saturating_add(Weight::from_parts(52_820_238, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -344,10 +344,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `671` // Estimated: `38638` - // Minimum execution time: 65_623_000 picoseconds. - Weight::from_parts(88_392_610, 38638) + // Minimum execution time: 63_344_000 picoseconds. + Weight::from_parts(76_968_021, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_635, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_598, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -357,12 +357,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 11_247_503_000 picoseconds. - Weight::from_parts(302_469_923, 34312) - // Standard Error: 147_459 - .saturating_add(Weight::from_parts(54_400_528, 0).saturating_mul(c.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(2_571, 0).saturating_mul(s.into())) + // Minimum execution time: 10_980_969_000 picoseconds. + Weight::from_parts(301_891_685, 34312) + // Standard Error: 164_203 + .saturating_add(Weight::from_parts(54_383_779, 0).saturating_mul(c.into())) + // Standard Error: 9 + .saturating_add(Weight::from_parts(2_548, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)) } @@ -371,10 +371,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 56_802_000 picoseconds. - Weight::from_parts(33_250_791, 23853) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) + // Minimum execution time: 53_732_000 picoseconds. + Weight::from_parts(35_204_611, 23853) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_021, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -383,10 +383,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `451` // Estimated: `27177` - // Minimum execution time: 59_487_000 picoseconds. - Weight::from_parts(37_481_444, 27177) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) + // Minimum execution time: 57_078_000 picoseconds. + Weight::from_parts(37_366_780, 27177) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } @@ -395,10 +395,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 86_239_000 picoseconds. - Weight::from_parts(32_106_516, 42227) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(p.into())) + // Minimum execution time: 82_297_000 picoseconds. + Weight::from_parts(62_302_593, 42227) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_042, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -407,10 +407,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1081` // Estimated: `45757` - // Minimum execution time: 98_413_000 picoseconds. - Weight::from_parts(52_381_439, 45757) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(p.into())) + // Minimum execution time: 93_602_000 picoseconds. + Weight::from_parts(69_941_334, 45757) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_057, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } @@ -419,8 +419,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 302_634_000 picoseconds. - Weight::from_parts(320_223_637, 74319) + // Minimum execution time: 298_083_000 picoseconds. + Weight::from_parts(314_192_353, 74319) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -429,10 +429,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 315_859_000 picoseconds. - Weight::from_parts(328_138_594, 74319) - // Standard Error: 1_557 - .saturating_add(Weight::from_parts(8_014, 0).saturating_mul(q.into())) + // Minimum execution time: 312_856_000 picoseconds. + Weight::from_parts(326_607_586, 74319) + // Standard Error: 1_507 + .saturating_add(Weight::from_parts(723, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -441,10 +441,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_804_000 picoseconds. - Weight::from_parts(46_226_000, 3899) - // Standard Error: 51_090 - .saturating_add(Weight::from_parts(51_940_069, 0).saturating_mul(c.into())) + // Minimum execution time: 45_478_000 picoseconds. + Weight::from_parts(45_769_000, 3899) + // Standard Error: 42_221 + .saturating_add(Weight::from_parts(51_492_007, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -454,630 +454,630 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_872_000 picoseconds. - Weight::from_parts(82_358_000, 0) - // Standard Error: 3_946_533 - .saturating_add(Weight::from_parts(617_270_552, 0).saturating_mul(r.into())) + // Minimum execution time: 85_248_000 picoseconds. + Weight::from_parts(87_224_000, 0) + // Standard Error: 4_031_043 + .saturating_add(Weight::from_parts(559_145_890, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 365_182_000 picoseconds. - Weight::from_parts(292_523_651, 0) - // Standard Error: 7_087 - .saturating_add(Weight::from_parts(31_059_002, 0).saturating_mul(p.into())) + // Minimum execution time: 304_310_000 picoseconds. + Weight::from_parts(240_640_662, 0) + // Standard Error: 7_875 + .saturating_add(Weight::from_parts(30_931_778, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 196_771_000 picoseconds. - Weight::from_parts(219_836_156, 0) - // Standard Error: 406_704 - .saturating_add(Weight::from_parts(120_742_843, 0).saturating_mul(r.into())) + // Minimum execution time: 144_728_000 picoseconds. + Weight::from_parts(127_694_995, 0) + // Standard Error: 344_021 + .saturating_add(Weight::from_parts(63_008_235, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_043_000 picoseconds. - Weight::from_parts(92_117_781, 0) - // Standard Error: 7_334 - .saturating_add(Weight::from_parts(3_640_301, 0).saturating_mul(r.into())) + // Minimum execution time: 85_763_000 picoseconds. + Weight::from_parts(93_302_515, 0) + // Standard Error: 3_873 + .saturating_add(Weight::from_parts(2_723_217, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 146_803_000 picoseconds. - Weight::from_parts(168_908_676, 0) - // Standard Error: 28_070 - .saturating_add(Weight::from_parts(3_989_643, 0).saturating_mul(r.into())) + // Minimum execution time: 134_987_000 picoseconds. + Weight::from_parts(141_052_149, 0) + // Standard Error: 29_498 + .saturating_add(Weight::from_parts(3_252_053, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_421_000 picoseconds. - Weight::from_parts(109_902_108, 0) - // Standard Error: 458_197 - .saturating_add(Weight::from_parts(186_560_355, 0).saturating_mul(r.into())) + // Minimum execution time: 82_532_000 picoseconds. + Weight::from_parts(111_956_884, 0) + // Standard Error: 420_651 + .saturating_add(Weight::from_parts(124_761_103, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_173_000 picoseconds. - Weight::from_parts(81_703_608, 0) - // Standard Error: 318_823 - .saturating_add(Weight::from_parts(183_602_076, 0).saturating_mul(r.into())) + // Minimum execution time: 82_442_000 picoseconds. + Weight::from_parts(76_262_730, 0) + // Standard Error: 310_067 + .saturating_add(Weight::from_parts(115_334_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_999_000 picoseconds. - Weight::from_parts(81_002_605, 0) - // Standard Error: 269_075 - .saturating_add(Weight::from_parts(183_154_106, 0).saturating_mul(r.into())) + // Minimum execution time: 82_322_000 picoseconds. + Weight::from_parts(71_153_919, 0) + // Standard Error: 293_317 + .saturating_add(Weight::from_parts(115_508_333, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_306_000 picoseconds. - Weight::from_parts(79_166_166, 0) - // Standard Error: 332_502 - .saturating_add(Weight::from_parts(182_666_522, 0).saturating_mul(r.into())) + // Minimum execution time: 82_586_000 picoseconds. + Weight::from_parts(73_401_225, 0) + // Standard Error: 306_089 + .saturating_add(Weight::from_parts(115_530_298, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_459_000 picoseconds. - Weight::from_parts(80_301_392, 0) - // Standard Error: 340_598 - .saturating_add(Weight::from_parts(184_099_120, 0).saturating_mul(r.into())) + // Minimum execution time: 86_537_000 picoseconds. + Weight::from_parts(80_327_682, 0) + // Standard Error: 275_679 + .saturating_add(Weight::from_parts(114_024_859, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_140_000 picoseconds. - Weight::from_parts(72_987_262, 0) - // Standard Error: 388_909 - .saturating_add(Weight::from_parts(186_920_851, 0).saturating_mul(r.into())) + // Minimum execution time: 84_226_000 picoseconds. + Weight::from_parts(74_308_323, 0) + // Standard Error: 291_460 + .saturating_add(Weight::from_parts(115_396_428, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_336_000 picoseconds. - Weight::from_parts(79_078_269, 0) - // Standard Error: 276_322 - .saturating_add(Weight::from_parts(182_690_178, 0).saturating_mul(r.into())) + // Minimum execution time: 81_250_000 picoseconds. + Weight::from_parts(74_761_588, 0) + // Standard Error: 317_797 + .saturating_add(Weight::from_parts(115_173_001, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_201_000 picoseconds. - Weight::from_parts(79_459_558, 0) - // Standard Error: 357_406 - .saturating_add(Weight::from_parts(182_989_857, 0).saturating_mul(r.into())) + // Minimum execution time: 85_673_000 picoseconds. + Weight::from_parts(70_907_772, 0) + // Standard Error: 347_682 + .saturating_add(Weight::from_parts(118_189_625, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 709_298_000 picoseconds. - Weight::from_parts(792_701_124, 0) - // Standard Error: 581_476 - .saturating_add(Weight::from_parts(264_833_637, 0).saturating_mul(r.into())) + // Minimum execution time: 700_530_000 picoseconds. + Weight::from_parts(774_384_678, 0) + // Standard Error: 512_748 + .saturating_add(Weight::from_parts(194_331_468, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 958_553_000 picoseconds. - Weight::from_parts(1_002_082_000, 0) - // Standard Error: 51_056 - .saturating_add(Weight::from_parts(13_349_580, 0).saturating_mul(n.into())) + // Minimum execution time: 866_889_000 picoseconds. + Weight::from_parts(872_993_000, 0) + // Standard Error: 59_048 + .saturating_add(Weight::from_parts(13_399_620, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_092_000 picoseconds. - Weight::from_parts(70_460_333, 0) - // Standard Error: 322_779 - .saturating_add(Weight::from_parts(182_652_206, 0).saturating_mul(r.into())) + // Minimum execution time: 85_291_000 picoseconds. + Weight::from_parts(75_543_485, 0) + // Standard Error: 320_701 + .saturating_add(Weight::from_parts(115_757_456, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_315_000 picoseconds. - Weight::from_parts(77_285_940, 0) - // Standard Error: 310_862 - .saturating_add(Weight::from_parts(183_154_588, 0).saturating_mul(r.into())) + // Minimum execution time: 83_780_000 picoseconds. + Weight::from_parts(68_090_338, 0) + // Standard Error: 330_050 + .saturating_add(Weight::from_parts(117_803_137, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_813_000 picoseconds. - Weight::from_parts(83_631_977, 0) - // Standard Error: 426_894 - .saturating_add(Weight::from_parts(250_044_040, 0).saturating_mul(n.into())) + // Minimum execution time: 84_394_000 picoseconds. + Weight::from_parts(88_472_912, 0) + // Standard Error: 340_524 + .saturating_add(Weight::from_parts(190_044_477, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_342_000 picoseconds. - Weight::from_parts(88_861_000, 0) - // Standard Error: 4_034_065 - .saturating_add(Weight::from_parts(1_070_363_129, 0).saturating_mul(r.into())) + // Minimum execution time: 83_081_000 picoseconds. + Weight::from_parts(85_006_000, 0) + // Standard Error: 3_456_961 + .saturating_add(Weight::from_parts(860_188_117, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_887_000 picoseconds. - Weight::from_parts(154_402_402, 0) - // Standard Error: 504_137 - .saturating_add(Weight::from_parts(389_538_545, 0).saturating_mul(r.into())) + // Minimum execution time: 81_490_000 picoseconds. + Weight::from_parts(136_619_765, 0) + // Standard Error: 439_674 + .saturating_add(Weight::from_parts(308_552_304, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 467_573_000 picoseconds. - Weight::from_parts(471_685_000, 0) - // Standard Error: 64_140 - .saturating_add(Weight::from_parts(22_109_126, 0).saturating_mul(n.into())) + // Minimum execution time: 386_929_000 picoseconds. + Weight::from_parts(393_325_000, 0) + // Standard Error: 61_932 + .saturating_add(Weight::from_parts(21_101_790, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_853_000 picoseconds. - Weight::from_parts(152_053_498, 0) - // Standard Error: 538_330 - .saturating_add(Weight::from_parts(397_711_575, 0).saturating_mul(r.into())) + // Minimum execution time: 84_625_000 picoseconds. + Weight::from_parts(162_584_483, 0) + // Standard Error: 494_553 + .saturating_add(Weight::from_parts(313_684_139, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 471_875_000 picoseconds. - Weight::from_parts(475_692_000, 0) - // Standard Error: 57_997 - .saturating_add(Weight::from_parts(21_385_701, 0).saturating_mul(n.into())) + // Minimum execution time: 390_932_000 picoseconds. + Weight::from_parts(393_883_000, 0) + // Standard Error: 68_646 + .saturating_add(Weight::from_parts(21_188_381, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 716_684_000 picoseconds. - Weight::from_parts(781_328_373, 0) - // Standard Error: 479_933 - .saturating_add(Weight::from_parts(411_727_995, 0).saturating_mul(r.into())) + // Minimum execution time: 708_623_000 picoseconds. + Weight::from_parts(781_094_266, 0) + // Standard Error: 460_683 + .saturating_add(Weight::from_parts(328_993_362, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 746_421_000 picoseconds. - Weight::from_parts(889_163_923, 0) - // Standard Error: 621_967 - .saturating_add(Weight::from_parts(412_763_026, 0).saturating_mul(r.into())) + // Minimum execution time: 710_228_000 picoseconds. + Weight::from_parts(774_190_634, 0) + // Standard Error: 483_646 + .saturating_add(Weight::from_parts(330_057_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_961_000 picoseconds. - Weight::from_parts(86_031_226, 0) - // Standard Error: 355_690 - .saturating_add(Weight::from_parts(191_347_968, 0).saturating_mul(r.into())) + // Minimum execution time: 83_510_000 picoseconds. + Weight::from_parts(64_097_635, 0) + // Standard Error: 358_570 + .saturating_add(Weight::from_parts(126_095_109, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_797_807_000 picoseconds. - Weight::from_parts(3_948_397_472, 0) - // Standard Error: 396_090 - .saturating_add(Weight::from_parts(284_341_649, 0).saturating_mul(r.into())) + // Minimum execution time: 2_430_098_000 picoseconds. + Weight::from_parts(2_605_278_898, 0) + // Standard Error: 439_185 + .saturating_add(Weight::from_parts(217_479_981, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 485_799_000 picoseconds. - Weight::from_parts(486_862_000, 0) - // Standard Error: 47_704 - .saturating_add(Weight::from_parts(31_360_292, 0).saturating_mul(n.into())) + // Minimum execution time: 358_553_000 picoseconds. + Weight::from_parts(364_183_000, 0) + // Standard Error: 51_397 + .saturating_add(Weight::from_parts(30_914_040, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_842_120_000 picoseconds. - Weight::from_parts(3_943_431_716, 0) - // Standard Error: 766_406 - .saturating_add(Weight::from_parts(339_379_953, 0).saturating_mul(r.into())) + // Minimum execution time: 2_464_581_000 picoseconds. + Weight::from_parts(2_580_044_243, 0) + // Standard Error: 461_216 + .saturating_add(Weight::from_parts(272_575_116, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_828_327_000 picoseconds. - Weight::from_parts(3_976_283_101, 0) - // Standard Error: 768_169 - .saturating_add(Weight::from_parts(353_252_083, 0).saturating_mul(r.into())) + // Minimum execution time: 2_438_114_000 picoseconds. + Weight::from_parts(2_597_881_615, 0) + // Standard Error: 400_982 + .saturating_add(Weight::from_parts(275_718_502, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 256_679_000 picoseconds. - Weight::from_parts(330_245_572, 0) - // Standard Error: 519_345 - .saturating_add(Weight::from_parts(404_879_225, 0).saturating_mul(r.into())) + // Minimum execution time: 244_206_000 picoseconds. + Weight::from_parts(321_175_021, 0) + // Standard Error: 460_445 + .saturating_add(Weight::from_parts(322_059_081, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 640_004_000 picoseconds. - Weight::from_parts(646_769_000, 0) - // Standard Error: 55_122 - .saturating_add(Weight::from_parts(21_616_125, 0).saturating_mul(n.into())) + // Minimum execution time: 559_346_000 picoseconds. + Weight::from_parts(571_004_000, 0) + // Standard Error: 59_840 + .saturating_add(Weight::from_parts(21_370_093, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_981_155_000 picoseconds. - Weight::from_parts(4_086_072_221, 0) - // Standard Error: 1_076_069 - .saturating_add(Weight::from_parts(362_989_310, 0).saturating_mul(r.into())) + // Minimum execution time: 2_620_633_000 picoseconds. + Weight::from_parts(2_741_869_292, 0) + // Standard Error: 620_120 + .saturating_add(Weight::from_parts(289_781_719, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_145_000 picoseconds. - Weight::from_parts(88_260_563, 0) - // Standard Error: 277_576 - .saturating_add(Weight::from_parts(20_209_036, 0).saturating_mul(r.into())) + // Minimum execution time: 83_438_000 picoseconds. + Weight::from_parts(86_817_816, 0) + // Standard Error: 234_731 + .saturating_add(Weight::from_parts(19_849_283, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_930_000 picoseconds. - Weight::from_parts(90_280_376, 0) - // Standard Error: 1_072 - .saturating_add(Weight::from_parts(427_777, 0).saturating_mul(n.into())) + // Minimum execution time: 105_002_000 picoseconds. + Weight::from_parts(88_114_999, 0) + // Standard Error: 1_128 + .saturating_add(Weight::from_parts(427_426, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_156_000 picoseconds. - Weight::from_parts(89_778_763, 0) - // Standard Error: 365_767 - .saturating_add(Weight::from_parts(24_157_936, 0).saturating_mul(r.into())) + // Minimum execution time: 82_436_000 picoseconds. + Weight::from_parts(88_440_285, 0) + // Standard Error: 277_544 + .saturating_add(Weight::from_parts(17_399_914, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_315_000 picoseconds. - Weight::from_parts(94_894_394, 0) - // Standard Error: 993 - .saturating_add(Weight::from_parts(426_364, 0).saturating_mul(n.into())) + // Minimum execution time: 103_800_000 picoseconds. + Weight::from_parts(89_756_983, 0) + // Standard Error: 907 + .saturating_add(Weight::from_parts(428_998, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_595_000 picoseconds. - Weight::from_parts(86_259_504, 0) - // Standard Error: 284_882 - .saturating_add(Weight::from_parts(25_873_595, 0).saturating_mul(r.into())) + // Minimum execution time: 81_754_000 picoseconds. + Weight::from_parts(87_296_014, 0) + // Standard Error: 336_747 + .saturating_add(Weight::from_parts(20_299_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_771_000 picoseconds. - Weight::from_parts(85_313_802, 0) - // Standard Error: 265_474 - .saturating_add(Weight::from_parts(25_863_597, 0).saturating_mul(r.into())) + // Minimum execution time: 81_952_000 picoseconds. + Weight::from_parts(86_840_575, 0) + // Standard Error: 272_708 + .saturating_add(Weight::from_parts(19_217_524, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_396_000 picoseconds. - Weight::from_parts(126_819_617, 0) - // Standard Error: 518_749 - .saturating_add(Weight::from_parts(272_821_836, 0).saturating_mul(r.into())) + // Minimum execution time: 85_498_000 picoseconds. + Weight::from_parts(126_431_779, 0) + // Standard Error: 460_480 + .saturating_add(Weight::from_parts(198_940_536, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_266_000 picoseconds. - Weight::from_parts(100_843_000, 0) - // Standard Error: 2_828 - .saturating_add(Weight::from_parts(662_117, 0).saturating_mul(n.into())) + // Minimum execution time: 96_862_000 picoseconds. + Weight::from_parts(98_611_000, 0) + // Standard Error: 2_677 + .saturating_add(Weight::from_parts(662_266, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_150_000 picoseconds. - Weight::from_parts(754_398_128, 0) - // Standard Error: 5_119_788 - .saturating_add(Weight::from_parts(7_037_071, 0).saturating_mul(r.into())) + // Minimum execution time: 698_914_000 picoseconds. + Weight::from_parts(718_405_100, 0) + // Standard Error: 1_891_960 + .saturating_add(Weight::from_parts(24_867_800, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 712_091_000 picoseconds. - Weight::from_parts(751_999_544, 0) - // Standard Error: 4_003_265 - .saturating_add(Weight::from_parts(43_818_555, 0).saturating_mul(r.into())) + // Minimum execution time: 699_975_000 picoseconds. + Weight::from_parts(718_806_789, 0) + // Standard Error: 1_919_531 + .saturating_add(Weight::from_parts(51_192_710, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_234_000 picoseconds. - Weight::from_parts(96_192_773, 0) - // Standard Error: 271_871 - .saturating_add(Weight::from_parts(13_338_726, 0).saturating_mul(r.into())) + // Minimum execution time: 95_002_000 picoseconds. + Weight::from_parts(99_331_989, 0) + // Standard Error: 287_602 + .saturating_add(Weight::from_parts(9_719_710, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 108_190_000 picoseconds. - Weight::from_parts(92_525_926, 0) - // Standard Error: 1_134 - .saturating_add(Weight::from_parts(433_806, 0).saturating_mul(n.into())) + // Minimum execution time: 102_501_000 picoseconds. + Weight::from_parts(87_026_327, 0) + // Standard Error: 1_214 + .saturating_add(Weight::from_parts(429_134, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_297_000 picoseconds. - Weight::from_parts(98_054_616, 0) - // Standard Error: 394_791 - .saturating_add(Weight::from_parts(7_680_683, 0).saturating_mul(r.into())) + // Minimum execution time: 93_228_000 picoseconds. + Weight::from_parts(97_923_691, 0) + // Standard Error: 288_469 + .saturating_add(Weight::from_parts(9_669_908, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 106_932_000 picoseconds. - Weight::from_parts(91_150_785, 0) - // Standard Error: 1_067 - .saturating_add(Weight::from_parts(424_570, 0).saturating_mul(n.into())) + // Minimum execution time: 100_908_000 picoseconds. + Weight::from_parts(87_613_705, 0) + // Standard Error: 1_237 + .saturating_add(Weight::from_parts(431_412, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_591_000 picoseconds. - Weight::from_parts(79_590_461, 0) - // Standard Error: 360_038 - .saturating_add(Weight::from_parts(185_313_242, 0).saturating_mul(r.into())) + // Minimum execution time: 84_385_000 picoseconds. + Weight::from_parts(74_453_057, 0) + // Standard Error: 309_931 + .saturating_add(Weight::from_parts(117_172_527, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_379_000 picoseconds. - Weight::from_parts(82_304_672, 0) - // Standard Error: 371_508 - .saturating_add(Weight::from_parts(184_895_719, 0).saturating_mul(r.into())) + // Minimum execution time: 82_437_000 picoseconds. + Weight::from_parts(78_951_443, 0) + // Standard Error: 294_227 + .saturating_add(Weight::from_parts(116_066_384, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_906_000 picoseconds. - Weight::from_parts(784_837_322, 0) - // Standard Error: 485_874 - .saturating_add(Weight::from_parts(198_529_306, 0).saturating_mul(r.into())) + // Minimum execution time: 704_954_000 picoseconds. + Weight::from_parts(752_735_182, 0) + // Standard Error: 455_998 + .saturating_add(Weight::from_parts(135_154_607, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 735_164_000 picoseconds. - Weight::from_parts(760_829_418, 0) - // Standard Error: 2_049 - .saturating_add(Weight::from_parts(164_862, 0).saturating_mul(n.into())) + // Minimum execution time: 724_451_000 picoseconds. + Weight::from_parts(738_722_668, 0) + // Standard Error: 1_014 + .saturating_add(Weight::from_parts(154_329, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_467_125_000 picoseconds. - Weight::from_parts(4_668_343_697, 0) - // Standard Error: 529_569 - .saturating_add(Weight::from_parts(214_709_155, 0).saturating_mul(r.into())) + // Minimum execution time: 3_092_586_000 picoseconds. + Weight::from_parts(3_231_311_035, 0) + // Standard Error: 506_742 + .saturating_add(Weight::from_parts(159_545_582, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_716_693_000 picoseconds. - Weight::from_parts(4_810_590_943, 0) - // Standard Error: 12_440 - .saturating_add(Weight::from_parts(13_814_475, 0).saturating_mul(n.into())) + // Minimum execution time: 3_299_872_000 picoseconds. + Weight::from_parts(3_317_022_894, 0) + // Standard Error: 8_542 + .saturating_add(Weight::from_parts(13_645_472, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_721_000 picoseconds. - Weight::from_parts(95_360_878, 0) - // Standard Error: 488_163 - .saturating_add(Weight::from_parts(198_923_476, 0).saturating_mul(r.into())) + // Minimum execution time: 85_966_000 picoseconds. + Weight::from_parts(106_319_310, 0) + // Standard Error: 424_534 + .saturating_add(Weight::from_parts(139_885_203, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 189_069_000 picoseconds. - Weight::from_parts(191_834_000, 0) - // Standard Error: 53_942 - .saturating_add(Weight::from_parts(26_059_121, 0).saturating_mul(n.into())) + // Minimum execution time: 142_910_000 picoseconds. + Weight::from_parts(144_843_000, 0) + // Standard Error: 54_401 + .saturating_add(Weight::from_parts(25_535_472, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_023_000 picoseconds. - Weight::from_parts(70_919_161, 0) - // Standard Error: 442_134 - .saturating_add(Weight::from_parts(186_467_769, 0).saturating_mul(r.into())) + // Minimum execution time: 82_117_000 picoseconds. + Weight::from_parts(80_202_149, 0) + // Standard Error: 296_880 + .saturating_add(Weight::from_parts(114_586_990, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_187_000 picoseconds. - Weight::from_parts(86_256_124, 0) - // Standard Error: 333_120 - .saturating_add(Weight::from_parts(27_182_075, 0).saturating_mul(r.into())) + // Minimum execution time: 81_802_000 picoseconds. + Weight::from_parts(85_064_295, 0) + // Standard Error: 248_874 + .saturating_add(Weight::from_parts(27_314_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_373_000 picoseconds. - Weight::from_parts(83_957_387, 0) - // Standard Error: 258_914 - .saturating_add(Weight::from_parts(14_637_112, 0).saturating_mul(r.into())) + // Minimum execution time: 82_854_000 picoseconds. + Weight::from_parts(86_180_314, 0) + // Standard Error: 239_162 + .saturating_add(Weight::from_parts(16_391_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_886_000 picoseconds. - Weight::from_parts(86_536_767, 0) - // Standard Error: 237_087 - .saturating_add(Weight::from_parts(15_456_732, 0).saturating_mul(r.into())) + // Minimum execution time: 80_883_000 picoseconds. + Weight::from_parts(87_058_214, 0) + // Standard Error: 256_392 + .saturating_add(Weight::from_parts(13_333_285, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_962_000 picoseconds. - Weight::from_parts(87_038_165, 0) - // Standard Error: 267_652 - .saturating_add(Weight::from_parts(14_141_234, 0).saturating_mul(r.into())) + // Minimum execution time: 81_417_000 picoseconds. + Weight::from_parts(85_403_451, 0) + // Standard Error: 249_767 + .saturating_add(Weight::from_parts(14_474_948, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_976_000 picoseconds. - Weight::from_parts(87_105_967, 0) - // Standard Error: 237_581 - .saturating_add(Weight::from_parts(13_365_932, 0).saturating_mul(r.into())) + // Minimum execution time: 84_020_000 picoseconds. + Weight::from_parts(88_080_622, 0) + // Standard Error: 253_221 + .saturating_add(Weight::from_parts(11_403_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_585_000 picoseconds. - Weight::from_parts(203_512_831, 0) - // Standard Error: 393_346 - .saturating_add(Weight::from_parts(283_538_921, 0).saturating_mul(r.into())) + // Minimum execution time: 138_317_000 picoseconds. + Weight::from_parts(187_894_162, 0) + // Standard Error: 376_519 + .saturating_add(Weight::from_parts(209_723_429, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_330_000 picoseconds. - Weight::from_parts(158_669_516, 0) - // Standard Error: 440_421 - .saturating_add(Weight::from_parts(473_163_025, 0).saturating_mul(r.into())) + // Minimum execution time: 93_047_000 picoseconds. + Weight::from_parts(151_715_771, 0) + // Standard Error: 425_606 + .saturating_add(Weight::from_parts(396_733_544, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1085,22 +1085,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_492_772_000 picoseconds. - Weight::from_parts(43_692_998_000, 0) - // Standard Error: 263_249 - .saturating_add(Weight::from_parts(8_169_821, 0).saturating_mul(p.into())) - // Standard Error: 263_236 - .saturating_add(Weight::from_parts(180_732_778, 0).saturating_mul(s.into())) + // Minimum execution time: 45_923_081_000 picoseconds. + Weight::from_parts(45_981_736_000, 0) + // Standard Error: 274_662 + .saturating_add(Weight::from_parts(6_858_186, 0).saturating_mul(p.into())) + // Standard Error: 274_649 + .saturating_add(Weight::from_parts(177_291_831, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_189_000 picoseconds. - Weight::from_parts(158_677_248, 0) - // Standard Error: 452_648 - .saturating_add(Weight::from_parts(478_043_506, 0).saturating_mul(r.into())) + // Minimum execution time: 95_680_000 picoseconds. + Weight::from_parts(157_350_147, 0) + // Standard Error: 440_994 + .saturating_add(Weight::from_parts(402_511_567, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1108,32 +1108,32 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_613_488_000 picoseconds. - Weight::from_parts(43_758_304_000, 0) - // Standard Error: 268_412 - .saturating_add(Weight::from_parts(7_987_894, 0).saturating_mul(p.into())) - // Standard Error: 268_399 - .saturating_add(Weight::from_parts(180_769_004, 0).saturating_mul(s.into())) + // Minimum execution time: 42_842_395_000 picoseconds. + Weight::from_parts(42_890_931_000, 0) + // Standard Error: 264_187 + .saturating_add(Weight::from_parts(7_896_879, 0).saturating_mul(p.into())) + // Standard Error: 264_174 + .saturating_add(Weight::from_parts(178_082_248, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_210_000 picoseconds. - Weight::from_parts(99_996_695, 0) - // Standard Error: 31_808 - .saturating_add(Weight::from_parts(3_523_987, 0).saturating_mul(r.into())) + // Minimum execution time: 82_272_000 picoseconds. + Weight::from_parts(100_008_395, 0) + // Standard Error: 36_430 + .saturating_add(Weight::from_parts(2_544_223, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 82_940_000 picoseconds. - Weight::from_parts(123_540_441, 1131) - // Standard Error: 7_143 - .saturating_add(Weight::from_parts(11_789_871, 0).saturating_mul(p.into())) + // Minimum execution time: 83_139_000 picoseconds. + Weight::from_parts(122_967_835, 1131) + // Standard Error: 6_454 + .saturating_add(Weight::from_parts(11_784_103, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1142,10 +1142,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_752_000 picoseconds. - Weight::from_parts(84_858_000, 1131) - // Standard Error: 48_161 - .saturating_add(Weight::from_parts(36_181_117, 0).saturating_mul(p.into())) + // Minimum execution time: 83_229_000 picoseconds. + Weight::from_parts(83_885_000, 1131) + // Standard Error: 37_558 + .saturating_add(Weight::from_parts(35_503_677, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1154,10 +1154,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_125_138_000 picoseconds. - Weight::from_parts(5_869_525_563, 5069931) - // Standard Error: 46_521 - .saturating_add(Weight::from_parts(36_899_111, 0).saturating_mul(p.into())) + // Minimum execution time: 6_139_187_000 picoseconds. + Weight::from_parts(5_806_599_304, 5069931) + // Standard Error: 75_881 + .saturating_add(Weight::from_parts(36_513_688, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1165,10 +1165,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_516_000 picoseconds. - Weight::from_parts(83_470_000, 1939) - // Standard Error: 29_769 - .saturating_add(Weight::from_parts(46_665_657, 0).saturating_mul(p.into())) + // Minimum execution time: 82_177_000 picoseconds. + Weight::from_parts(83_595_000, 1939) + // Standard Error: 45_778 + .saturating_add(Weight::from_parts(47_155_630, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1177,10 +1177,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_344_000 picoseconds. - Weight::from_parts(94_873_151, 1131) - // Standard Error: 55_429 - .saturating_add(Weight::from_parts(35_724_871, 0).saturating_mul(p.into())) + // Minimum execution time: 90_231_000 picoseconds. + Weight::from_parts(95_944_378, 1131) + // Standard Error: 61_821 + .saturating_add(Weight::from_parts(35_941_066, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1189,10 +1189,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 735_393_000 picoseconds. - Weight::from_parts(754_062_397, 1496) - // Standard Error: 166_437 - .saturating_add(Weight::from_parts(43_966_900, 0).saturating_mul(p.into())) + // Minimum execution time: 734_006_000 picoseconds. + Weight::from_parts(717_384_508, 1496) + // Standard Error: 375_292 + .saturating_add(Weight::from_parts(47_930_581, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1201,10 +1201,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_124_371_000 picoseconds. - Weight::from_parts(1_147_901_415, 317931) - // Standard Error: 145_342 - .saturating_add(Weight::from_parts(43_795_511, 0).saturating_mul(p.into())) + // Minimum execution time: 1_121_849_000 picoseconds. + Weight::from_parts(1_147_558_033, 317931) + // Standard Error: 373_146 + .saturating_add(Weight::from_parts(45_393_418, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1212,885 +1212,885 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_510_000 picoseconds. - Weight::from_parts(1_448_006, 0) - // Standard Error: 9_868 - .saturating_add(Weight::from_parts(24_061_691, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_220_392, 0) + // Standard Error: 8_848 + .saturating_add(Weight::from_parts(24_205_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_991_000 picoseconds. - Weight::from_parts(4_151_991_287, 0) - // Standard Error: 60_683 - .saturating_add(Weight::from_parts(4_818_799, 0).saturating_mul(r.into())) + // Minimum execution time: 4_352_664_000 picoseconds. + Weight::from_parts(4_153_366_897, 0) + // Standard Error: 60_193 + .saturating_add(Weight::from_parts(4_722_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_341_162_000 picoseconds. - Weight::from_parts(4_200_807_294, 0) - // Standard Error: 51_442 - .saturating_add(Weight::from_parts(4_527_839, 0).saturating_mul(r.into())) + // Minimum execution time: 4_357_649_000 picoseconds. + Weight::from_parts(4_256_499_798, 0) + // Standard Error: 57_942 + .saturating_add(Weight::from_parts(4_200_870, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_322_767_000 picoseconds. - Weight::from_parts(11_038_976_057, 0) - // Standard Error: 150_113 - .saturating_add(Weight::from_parts(10_655_640, 0).saturating_mul(r.into())) + // Minimum execution time: 10_269_998_000 picoseconds. + Weight::from_parts(11_525_100_351, 0) + // Standard Error: 204_230 + .saturating_add(Weight::from_parts(8_423_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_367_826_000 picoseconds. - Weight::from_parts(11_310_983_745, 0) - // Standard Error: 145_202 - .saturating_add(Weight::from_parts(7_541_832, 0).saturating_mul(r.into())) + // Minimum execution time: 10_204_810_000 picoseconds. + Weight::from_parts(10_982_673_143, 0) + // Standard Error: 145_327 + .saturating_add(Weight::from_parts(9_198_033, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_251_000 picoseconds. - Weight::from_parts(2_304_000, 0) - // Standard Error: 8_520 - .saturating_add(Weight::from_parts(3_798_413, 0).saturating_mul(r.into())) + // Minimum execution time: 2_074_000 picoseconds. + Weight::from_parts(2_108_000, 0) + // Standard Error: 9_031 + .saturating_add(Weight::from_parts(3_829_182, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(573_722, 0) - // Standard Error: 11_642 - .saturating_add(Weight::from_parts(3_174_691, 0).saturating_mul(r.into())) + // Minimum execution time: 2_020_000 picoseconds. + Weight::from_parts(2_118_000, 0) + // Standard Error: 5_295 + .saturating_add(Weight::from_parts(2_980_329, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(3_155_512, 0) - // Standard Error: 1_212 - .saturating_add(Weight::from_parts(1_586_585, 0).saturating_mul(r.into())) + // Minimum execution time: 2_032_000 picoseconds. + Weight::from_parts(3_411_359, 0) + // Standard Error: 1_146 + .saturating_add(Weight::from_parts(1_563_906, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_160_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 8_627 - .saturating_add(Weight::from_parts(2_929_529, 0).saturating_mul(r.into())) + // Minimum execution time: 2_096_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 8_349 + .saturating_add(Weight::from_parts(2_904_673, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(1_609_241, 0) - // Standard Error: 19_812 - .saturating_add(Weight::from_parts(5_162_833, 0).saturating_mul(r.into())) + // Minimum execution time: 2_128_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 8_100 + .saturating_add(Weight::from_parts(5_229_400, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_892_000 picoseconds. - Weight::from_parts(5_316_811, 0) - // Standard Error: 1_578 - .saturating_add(Weight::from_parts(163_377, 0).saturating_mul(e.into())) + // Minimum execution time: 6_838_000 picoseconds. + Weight::from_parts(5_309_346, 0) + // Standard Error: 2_580 + .saturating_add(Weight::from_parts(129_982, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_304_000 picoseconds. - Weight::from_parts(4_554_683, 0) - // Standard Error: 7_319 - .saturating_add(Weight::from_parts(2_595_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(3_593_285, 0) + // Standard Error: 6_648 + .saturating_add(Weight::from_parts(2_597_926, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_595_958 - - 2_422_191, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_597_926 - + 2_429_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_273_000 picoseconds. - Weight::from_parts(5_046_075, 0) - // Standard Error: 13_702 - .saturating_add(Weight::from_parts(2_422_191, 0).saturating_mul(r.into())) + // Minimum execution time: 2_086_000 picoseconds. + Weight::from_parts(3_972_773, 0) + // Standard Error: 12_538 + .saturating_add(Weight::from_parts(2_429_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_684_000 picoseconds. - Weight::from_parts(17_324_871, 0) - // Standard Error: 38_532 - .saturating_add(Weight::from_parts(10_260_872, 0).saturating_mul(r.into())) + // Minimum execution time: 2_591_000 picoseconds. + Weight::from_parts(12_798_134, 0) + // Standard Error: 23_023 + .saturating_add(Weight::from_parts(9_786_464, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_206_000 picoseconds. - Weight::from_parts(2_634_425, 0) - // Standard Error: 5_954 - .saturating_add(Weight::from_parts(1_275_538, 0).saturating_mul(p.into())) + // Minimum execution time: 12_274_000 picoseconds. + Weight::from_parts(1_706_188, 0) + // Standard Error: 6_199 + .saturating_add(Weight::from_parts(1_212_443, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_288_000 picoseconds. - Weight::from_parts(5_570_870, 0) + // Minimum execution time: 5_221_000 picoseconds. + Weight::from_parts(5_538_574, 0) // Standard Error: 12 - .saturating_add(Weight::from_parts(61, 0).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(12, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_203_000 picoseconds. - Weight::from_parts(1_788_159, 0) - // Standard Error: 3_152 - .saturating_add(Weight::from_parts(267_842, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(1_785_103, 0) + // Standard Error: 2_948 + .saturating_add(Weight::from_parts(249_981, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_164_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 4_611 - .saturating_add(Weight::from_parts(721_127, 0).saturating_mul(r.into())) + // Minimum execution time: 2_123_000 picoseconds. + Weight::from_parts(2_187_000, 0) + // Standard Error: 5_664 + .saturating_add(Weight::from_parts(719_187, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_347_000, 0) - // Standard Error: 5_971 - .saturating_add(Weight::from_parts(742_209, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_214_000, 0) + // Standard Error: 5_625 + .saturating_add(Weight::from_parts(709_067, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_406_000 picoseconds. - Weight::from_parts(2_894_577, 0) - // Standard Error: 8_027 - .saturating_add(Weight::from_parts(801_493, 0).saturating_mul(r.into())) + // Minimum execution time: 6_168_000 picoseconds. + Weight::from_parts(2_290_203, 0) + // Standard Error: 8_984 + .saturating_add(Weight::from_parts(761_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_345_000 picoseconds. - Weight::from_parts(31_295, 0) - // Standard Error: 10_231 - .saturating_add(Weight::from_parts(1_543_569, 0).saturating_mul(r.into())) + // Minimum execution time: 6_249_000 picoseconds. + Weight::from_parts(6_302_000, 0) + // Standard Error: 8_682 + .saturating_add(Weight::from_parts(1_329_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_937_000 picoseconds. - Weight::from_parts(62_049, 0) - // Standard Error: 12_087 - .saturating_add(Weight::from_parts(7_172_920, 0).saturating_mul(r.into())) + // Minimum execution time: 3_791_000 picoseconds. + Weight::from_parts(3_929_000, 0) + // Standard Error: 9_270 + .saturating_add(Weight::from_parts(6_742_685, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_262_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 6_042 - .saturating_add(Weight::from_parts(3_394_526, 0).saturating_mul(r.into())) + // Minimum execution time: 2_113_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 6_734 + .saturating_add(Weight::from_parts(3_327_207, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 5_891 - .saturating_add(Weight::from_parts(3_138_523, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_141_000, 0) + // Standard Error: 6_506 + .saturating_add(Weight::from_parts(3_061_891, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_277_000, 0) - // Standard Error: 8_196 - .saturating_add(Weight::from_parts(3_167_033, 0).saturating_mul(r.into())) + // Minimum execution time: 2_108_000 picoseconds. + Weight::from_parts(2_141_000, 0) + // Standard Error: 6_738 + .saturating_add(Weight::from_parts(3_101_844, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 5_536 - .saturating_add(Weight::from_parts(2_668_164, 0).saturating_mul(r.into())) + // Minimum execution time: 2_138_000 picoseconds. + Weight::from_parts(2_155_000, 0) + // Standard Error: 4_379 + .saturating_add(Weight::from_parts(2_613_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(45_432, 0) - // Standard Error: 6_223 - .saturating_add(Weight::from_parts(645_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_046_000 picoseconds. + Weight::from_parts(2_127_000, 0) + // Standard Error: 3_513 + .saturating_add(Weight::from_parts(525_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(1_301_007, 0) - // Standard Error: 4_929 - .saturating_add(Weight::from_parts(446_280, 0).saturating_mul(r.into())) + // Minimum execution time: 2_127_000 picoseconds. + Weight::from_parts(1_669_179, 0) + // Standard Error: 2_817 + .saturating_add(Weight::from_parts(367_599, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_205_000, 0) - // Standard Error: 10_412 - .saturating_add(Weight::from_parts(1_894_722, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 11_816 + .saturating_add(Weight::from_parts(1_810_781, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_257_000, 0) - // Standard Error: 7_708 - .saturating_add(Weight::from_parts(1_162_246, 0).saturating_mul(r.into())) + // Minimum execution time: 2_087_000 picoseconds. + Weight::from_parts(2_194_000, 0) + // Standard Error: 7_361 + .saturating_add(Weight::from_parts(1_130_773, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(1_682_106, 0) - // Standard Error: 3_839 - .saturating_add(Weight::from_parts(384_381, 0).saturating_mul(r.into())) + // Minimum execution time: 2_061_000 picoseconds. + Weight::from_parts(1_850_477, 0) + // Standard Error: 2_695 + .saturating_add(Weight::from_parts(318_827, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(1_669_708, 0) - // Standard Error: 3_126 - .saturating_add(Weight::from_parts(384_474, 0).saturating_mul(r.into())) + // Minimum execution time: 2_115_000 picoseconds. + Weight::from_parts(1_764_589, 0) + // Standard Error: 2_923 + .saturating_add(Weight::from_parts(329_840, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_291_000, 0) - // Standard Error: 4_476 - .saturating_add(Weight::from_parts(497_277, 0).saturating_mul(r.into())) + // Minimum execution time: 2_109_000 picoseconds. + Weight::from_parts(859_995, 0) + // Standard Error: 4_546 + .saturating_add(Weight::from_parts(467_944, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_217_000 picoseconds. - Weight::from_parts(2_287_000, 0) - // Standard Error: 4_107 - .saturating_add(Weight::from_parts(524_095, 0).saturating_mul(r.into())) + // Minimum execution time: 2_010_000 picoseconds. + Weight::from_parts(2_081_000, 0) + // Standard Error: 3_959 + .saturating_add(Weight::from_parts(472_947, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_233_000, 0) - // Standard Error: 3_690 - .saturating_add(Weight::from_parts(501_277, 0).saturating_mul(r.into())) + // Minimum execution time: 2_105_000 picoseconds. + Weight::from_parts(1_247_124, 0) + // Standard Error: 4_390 + .saturating_add(Weight::from_parts(436_907, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_132_000 picoseconds. - Weight::from_parts(1_082_506, 0) - // Standard Error: 5_421 - .saturating_add(Weight::from_parts(400_448, 0).saturating_mul(r.into())) + // Minimum execution time: 2_140_000 picoseconds. + Weight::from_parts(2_251_532, 0) + // Standard Error: 2_995 + .saturating_add(Weight::from_parts(280_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(3_085_764, 0) - // Standard Error: 1_912 - .saturating_add(Weight::from_parts(162_384, 0).saturating_mul(r.into())) + // Minimum execution time: 2_119_000 picoseconds. + Weight::from_parts(2_808_547, 0) + // Standard Error: 1_453 + .saturating_add(Weight::from_parts(143_409, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_849_158, 0) - // Standard Error: 1_635 - .saturating_add(Weight::from_parts(153_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_043_000 picoseconds. + Weight::from_parts(2_639_820, 0) + // Standard Error: 1_638 + .saturating_add(Weight::from_parts(159_792, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_315_000, 0) - // Standard Error: 11_776 - .saturating_add(Weight::from_parts(1_779_477, 0).saturating_mul(r.into())) + // Minimum execution time: 2_128_000 picoseconds. + Weight::from_parts(2_166_000, 0) + // Standard Error: 11_777 + .saturating_add(Weight::from_parts(1_709_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 8_815 - .saturating_add(Weight::from_parts(1_197_093, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(2_136_000, 0) + // Standard Error: 7_491 + .saturating_add(Weight::from_parts(1_105_807, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 9_983 - .saturating_add(Weight::from_parts(1_838_257, 0).saturating_mul(r.into())) + // Minimum execution time: 2_088_000 picoseconds. + Weight::from_parts(2_171_000, 0) + // Standard Error: 11_841 + .saturating_add(Weight::from_parts(1_785_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 7_749 - .saturating_add(Weight::from_parts(1_165_862, 0).saturating_mul(r.into())) + // Minimum execution time: 2_042_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 7_479 + .saturating_add(Weight::from_parts(1_086_144, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_172_000 picoseconds. - Weight::from_parts(2_246_000, 0) - // Standard Error: 11_426 - .saturating_add(Weight::from_parts(1_828_814, 0).saturating_mul(r.into())) + // Minimum execution time: 2_109_000 picoseconds. + Weight::from_parts(2_151_000, 0) + // Standard Error: 13_111 + .saturating_add(Weight::from_parts(1_829_000, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_187_000 picoseconds. - Weight::from_parts(2_245_000, 0) - // Standard Error: 7_973 - .saturating_add(Weight::from_parts(1_145_613, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_153_000, 0) + // Standard Error: 7_632 + .saturating_add(Weight::from_parts(1_102_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_273_000, 0) - // Standard Error: 10_995 - .saturating_add(Weight::from_parts(1_789_814, 0).saturating_mul(r.into())) + // Minimum execution time: 2_155_000 picoseconds. + Weight::from_parts(2_231_000, 0) + // Standard Error: 11_689 + .saturating_add(Weight::from_parts(1_768_866, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_252_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_207_539, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_163_000, 0) + // Standard Error: 7_348 + .saturating_add(Weight::from_parts(1_057_058, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_219_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 10_576 - .saturating_add(Weight::from_parts(1_855_075, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_142_000, 0) + // Standard Error: 12_173 + .saturating_add(Weight::from_parts(1_786_184, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_199_000 picoseconds. - Weight::from_parts(2_265_000, 0) - // Standard Error: 7_405 - .saturating_add(Weight::from_parts(1_180_265, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_206_000, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(1_066_057, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_285_000, 0) - // Standard Error: 10_994 - .saturating_add(Weight::from_parts(1_835_344, 0).saturating_mul(r.into())) + // Minimum execution time: 2_090_000 picoseconds. + Weight::from_parts(2_175_000, 0) + // Standard Error: 11_967 + .saturating_add(Weight::from_parts(1_782_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(2_277_000, 0) - // Standard Error: 7_826 - .saturating_add(Weight::from_parts(1_163_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_091_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 7_205 + .saturating_add(Weight::from_parts(1_048_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(2_217_000, 0) - // Standard Error: 11_374 - .saturating_add(Weight::from_parts(1_910_004, 0).saturating_mul(r.into())) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 12_228 + .saturating_add(Weight::from_parts(1_792_751, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_303_000, 0) - // Standard Error: 8_971 - .saturating_add(Weight::from_parts(1_182_859, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_186_000, 0) + // Standard Error: 7_822 + .saturating_add(Weight::from_parts(1_052_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_284_000, 0) - // Standard Error: 12_177 - .saturating_add(Weight::from_parts(1_866_465, 0).saturating_mul(r.into())) + // Minimum execution time: 2_055_000 picoseconds. + Weight::from_parts(2_135_000, 0) + // Standard Error: 12_011 + .saturating_add(Weight::from_parts(1_789_504, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_468_000 picoseconds. - Weight::from_parts(2_638_000, 0) - // Standard Error: 7_738 - .saturating_add(Weight::from_parts(1_119_369, 0).saturating_mul(r.into())) + // Minimum execution time: 2_447_000 picoseconds. + Weight::from_parts(2_540_000, 0) + // Standard Error: 7_696 + .saturating_add(Weight::from_parts(1_062_612, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_191_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 10_340 - .saturating_add(Weight::from_parts(1_831_738, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_107_000, 0) + // Standard Error: 12_070 + .saturating_add(Weight::from_parts(1_771_498, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 6_924 - .saturating_add(Weight::from_parts(1_210_933, 0).saturating_mul(r.into())) + // Minimum execution time: 2_123_000 picoseconds. + Weight::from_parts(2_156_000, 0) + // Standard Error: 7_108 + .saturating_add(Weight::from_parts(1_072_471, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_325_000, 0) - // Standard Error: 9_907 - .saturating_add(Weight::from_parts(1_822_715, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_145_000, 0) + // Standard Error: 11_990 + .saturating_add(Weight::from_parts(1_786_273, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 7_927 - .saturating_add(Weight::from_parts(1_168_287, 0).saturating_mul(r.into())) + // Minimum execution time: 2_059_000 picoseconds. + Weight::from_parts(2_122_000, 0) + // Standard Error: 7_164 + .saturating_add(Weight::from_parts(1_070_909, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 8_768 - .saturating_add(Weight::from_parts(1_295_617, 0).saturating_mul(r.into())) + // Minimum execution time: 2_065_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 7_265 + .saturating_add(Weight::from_parts(1_152_228, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 6_314 - .saturating_add(Weight::from_parts(658_832, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_160_000, 0) + // Standard Error: 5_101 + .saturating_add(Weight::from_parts(578_660, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 9_261 - .saturating_add(Weight::from_parts(1_348_699, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_184_000, 0) + // Standard Error: 9_299 + .saturating_add(Weight::from_parts(1_257_633, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 5_457 - .saturating_add(Weight::from_parts(671_846, 0).saturating_mul(r.into())) + // Minimum execution time: 2_119_000 picoseconds. + Weight::from_parts(2_262_000, 0) + // Standard Error: 3_957 + .saturating_add(Weight::from_parts(557_957, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_241_000, 0) - // Standard Error: 11_567 - .saturating_add(Weight::from_parts(1_835_171, 0).saturating_mul(r.into())) + // Minimum execution time: 2_045_000 picoseconds. + Weight::from_parts(2_157_000, 0) + // Standard Error: 10_839 + .saturating_add(Weight::from_parts(1_686_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_196_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 7_436 - .saturating_add(Weight::from_parts(1_171_019, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_250_000, 0) + // Standard Error: 7_276 + .saturating_add(Weight::from_parts(1_096_252, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(6_299_544, 0) - // Standard Error: 28_028 - .saturating_add(Weight::from_parts(2_500_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(1_434_170, 0) + // Standard Error: 21_965 + .saturating_add(Weight::from_parts(2_633_663, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_576_178, 0) - // Standard Error: 12_042 - .saturating_add(Weight::from_parts(2_335_953, 0).saturating_mul(r.into())) + // Minimum execution time: 2_098_000 picoseconds. + Weight::from_parts(2_122_681, 0) + // Standard Error: 10_815 + .saturating_add(Weight::from_parts(2_335_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(8_638_891, 0) - // Standard Error: 32_649 - .saturating_add(Weight::from_parts(2_462_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(145_632, 0) + // Standard Error: 12_320 + .saturating_add(Weight::from_parts(2_992_427, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_731_170, 0) - // Standard Error: 19_116 - .saturating_add(Weight::from_parts(2_437_473, 0).saturating_mul(r.into())) + // Minimum execution time: 2_142_000 picoseconds. + Weight::from_parts(2_180_000, 0) + // Standard Error: 4_944 + .saturating_add(Weight::from_parts(2_466_854, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_261_000 picoseconds. - Weight::from_parts(1_535_146, 0) - // Standard Error: 30_575 - .saturating_add(Weight::from_parts(9_634_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_143_000 picoseconds. + Weight::from_parts(2_204_000, 0) + // Standard Error: 14_500 + .saturating_add(Weight::from_parts(9_530_241, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_209_000 picoseconds. - Weight::from_parts(5_244_298, 0) - // Standard Error: 48_615 - .saturating_add(Weight::from_parts(7_381_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_132_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 22_303 + .saturating_add(Weight::from_parts(7_508_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_260_000 picoseconds. - Weight::from_parts(8_453_159, 0) - // Standard Error: 30_530 - .saturating_add(Weight::from_parts(2_541_459, 0).saturating_mul(r.into())) + // Minimum execution time: 2_133_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 5_407 + .saturating_add(Weight::from_parts(2_948_013, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(5_507_917, 0) - // Standard Error: 21_457 - .saturating_add(Weight::from_parts(2_217_886, 0).saturating_mul(r.into())) + // Minimum execution time: 2_124_000 picoseconds. + Weight::from_parts(2_150_000, 0) + // Standard Error: 6_372 + .saturating_add(Weight::from_parts(2_362_416, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 9_253 - .saturating_add(Weight::from_parts(1_354_282, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 7_670 + .saturating_add(Weight::from_parts(1_174_342, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 3_908 - .saturating_add(Weight::from_parts(589_876, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_109_000, 0) + // Standard Error: 3_988 + .saturating_add(Weight::from_parts(566_949, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_265_000, 0) - // Standard Error: 9_943 - .saturating_add(Weight::from_parts(1_308_630, 0).saturating_mul(r.into())) + // Minimum execution time: 2_049_000 picoseconds. + Weight::from_parts(2_117_000, 0) + // Standard Error: 8_393 + .saturating_add(Weight::from_parts(1_160_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_273_000, 0) - // Standard Error: 5_843 - .saturating_add(Weight::from_parts(653_388, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_152_000, 0) + // Standard Error: 4_769 + .saturating_add(Weight::from_parts(585_265, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_228_000 picoseconds. - Weight::from_parts(2_293_000, 0) - // Standard Error: 9_157 - .saturating_add(Weight::from_parts(1_290_731, 0).saturating_mul(r.into())) + // Minimum execution time: 2_115_000 picoseconds. + Weight::from_parts(2_170_000, 0) + // Standard Error: 7_943 + .saturating_add(Weight::from_parts(1_185_174, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 4_020 - .saturating_add(Weight::from_parts(618_071, 0).saturating_mul(r.into())) + // Minimum execution time: 2_139_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 4_608 + .saturating_add(Weight::from_parts(563_329, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_239_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 7_192 - .saturating_add(Weight::from_parts(1_061_312, 0).saturating_mul(r.into())) + // Minimum execution time: 2_144_000 picoseconds. + Weight::from_parts(2_178_000, 0) + // Standard Error: 6_727 + .saturating_add(Weight::from_parts(1_000_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_245_000, 0) - // Standard Error: 3_756 - .saturating_add(Weight::from_parts(568_744, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_212_000, 0) + // Standard Error: 3_536 + .saturating_add(Weight::from_parts(504_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(2_324_000, 0) - // Standard Error: 7_917 - .saturating_add(Weight::from_parts(1_106_132, 0).saturating_mul(r.into())) + // Minimum execution time: 2_167_000 picoseconds. + Weight::from_parts(2_218_000, 0) + // Standard Error: 7_170 + .saturating_add(Weight::from_parts(966_365, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_205_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 4_617 - .saturating_add(Weight::from_parts(599_461, 0).saturating_mul(r.into())) + // Minimum execution time: 2_149_000 picoseconds. + Weight::from_parts(140_768, 0) + // Standard Error: 5_221 + .saturating_add(Weight::from_parts(551_550, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_215_000 picoseconds. - Weight::from_parts(2_346_000, 0) - // Standard Error: 7_501 - .saturating_add(Weight::from_parts(1_125_645, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 7_621 + .saturating_add(Weight::from_parts(997_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 5_262 - .saturating_add(Weight::from_parts(624_680, 0).saturating_mul(r.into())) + // Minimum execution time: 2_069_000 picoseconds. + Weight::from_parts(2_106_000, 0) + // Standard Error: 3_980 + .saturating_add(Weight::from_parts(537_014, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 7_879 - .saturating_add(Weight::from_parts(1_068_877, 0).saturating_mul(r.into())) + // Minimum execution time: 2_097_000 picoseconds. + Weight::from_parts(2_191_000, 0) + // Standard Error: 9_419 + .saturating_add(Weight::from_parts(1_050_292, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 4_124 - .saturating_add(Weight::from_parts(567_690, 0).saturating_mul(r.into())) + // Minimum execution time: 2_051_000 picoseconds. + Weight::from_parts(2_118_000, 0) + // Standard Error: 4_228 + .saturating_add(Weight::from_parts(529_158, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 8_516 - .saturating_add(Weight::from_parts(1_174_764, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_116_000, 0) + // Standard Error: 7_792 + .saturating_add(Weight::from_parts(1_027_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_171_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 4_901 - .saturating_add(Weight::from_parts(628_068, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 4_450 + .saturating_add(Weight::from_parts(534_724, 0).saturating_mul(r.into())) } } @@ -2115,10 +2115,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 965_000 picoseconds. - Weight::from_parts(1_020_000, 0) - // Standard Error: 753 - .saturating_add(Weight::from_parts(247_354, 0).saturating_mul(c.into())) + // Minimum execution time: 954_000 picoseconds. + Weight::from_parts(1_004_000, 0) + // Standard Error: 802 + .saturating_add(Weight::from_parts(249_956, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -2126,10 +2126,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_780_000 picoseconds. - Weight::from_parts(2_874_000, 3506) - // Standard Error: 924 - .saturating_add(Weight::from_parts(674_078, 0).saturating_mul(c.into())) + // Minimum execution time: 2_808_000 picoseconds. + Weight::from_parts(2_895_000, 3506) + // Standard Error: 1_086 + .saturating_add(Weight::from_parts(680_150, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2138,17 +2138,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 51_392_000 picoseconds. - Weight::from_parts(63_325_658, 0) - // Standard Error: 13_432 - .saturating_add(Weight::from_parts(2_671_521, 0).saturating_mul(c.into())) + // Minimum execution time: 52_458_000 picoseconds. + Weight::from_parts(84_558_500, 0) + // Standard Error: 7_412 + .saturating_add(Weight::from_parts(2_377_997, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 85_039_000 picoseconds. - Weight::from_parts(86_523_000, 42236) + // Minimum execution time: 81_302_000 picoseconds. + Weight::from_parts(83_307_000, 42236) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2156,8 +2156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 54_302_000 picoseconds. - Weight::from_parts(56_159_000, 21261) + // Minimum execution time: 52_219_000 picoseconds. + Weight::from_parts(53_704_000, 21261) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2165,8 +2165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 29_099_000 picoseconds. - Weight::from_parts(30_610_000, 17070) + // Minimum execution time: 28_408_000 picoseconds. + Weight::from_parts(29_714_000, 17070) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2175,10 +2175,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_259_000 picoseconds. - Weight::from_parts(6_228_584, 7640) - // Standard Error: 37_556 - .saturating_add(Weight::from_parts(16_519_610, 0).saturating_mul(c.into())) + // Minimum execution time: 7_918_000 picoseconds. + Weight::from_parts(6_745_647, 7640) + // Standard Error: 37_300 + .saturating_add(Weight::from_parts(13_885_473, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -2187,10 +2187,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1297 + c * (16389 ±0)` // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 70_699_000 picoseconds. - Weight::from_parts(71_447_000, 40898) - // Standard Error: 139_719 - .saturating_add(Weight::from_parts(54_319_486, 0).saturating_mul(c.into())) + // Minimum execution time: 68_486_000 picoseconds. + Weight::from_parts(69_079_000, 40898) + // Standard Error: 164_982 + .saturating_add(Weight::from_parts(55_774_264, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2201,10 +2201,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 60_906_000 picoseconds. - Weight::from_parts(18_999_485, 4990) - // Standard Error: 57_215 - .saturating_add(Weight::from_parts(53_057_311, 0).saturating_mul(c.into())) + // Minimum execution time: 61_635_000 picoseconds. + Weight::from_parts(64_537_590, 4990) + // Standard Error: 40_298 + .saturating_add(Weight::from_parts(52_820_238, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2213,10 +2213,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `671` // Estimated: `38638` - // Minimum execution time: 65_623_000 picoseconds. - Weight::from_parts(88_392_610, 38638) + // Minimum execution time: 63_344_000 picoseconds. + Weight::from_parts(76_968_021, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_635, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_598, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2226,12 +2226,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 11_247_503_000 picoseconds. - Weight::from_parts(302_469_923, 34312) - // Standard Error: 147_459 - .saturating_add(Weight::from_parts(54_400_528, 0).saturating_mul(c.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(2_571, 0).saturating_mul(s.into())) + // Minimum execution time: 10_980_969_000 picoseconds. + Weight::from_parts(301_891_685, 34312) + // Standard Error: 164_203 + .saturating_add(Weight::from_parts(54_383_779, 0).saturating_mul(c.into())) + // Standard Error: 9 + .saturating_add(Weight::from_parts(2_548, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } @@ -2240,10 +2240,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 56_802_000 picoseconds. - Weight::from_parts(33_250_791, 23853) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) + // Minimum execution time: 53_732_000 picoseconds. + Weight::from_parts(35_204_611, 23853) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_021, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -2252,10 +2252,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `451` // Estimated: `27177` - // Minimum execution time: 59_487_000 picoseconds. - Weight::from_parts(37_481_444, 27177) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) + // Minimum execution time: 57_078_000 picoseconds. + Weight::from_parts(37_366_780, 27177) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } @@ -2264,10 +2264,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 86_239_000 picoseconds. - Weight::from_parts(32_106_516, 42227) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(p.into())) + // Minimum execution time: 82_297_000 picoseconds. + Weight::from_parts(62_302_593, 42227) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_042, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2276,10 +2276,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1081` // Estimated: `45757` - // Minimum execution time: 98_413_000 picoseconds. - Weight::from_parts(52_381_439, 45757) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(p.into())) + // Minimum execution time: 93_602_000 picoseconds. + Weight::from_parts(69_941_334, 45757) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_057, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(11_u64)) } @@ -2288,8 +2288,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 302_634_000 picoseconds. - Weight::from_parts(320_223_637, 74319) + // Minimum execution time: 298_083_000 picoseconds. + Weight::from_parts(314_192_353, 74319) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2298,10 +2298,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 315_859_000 picoseconds. - Weight::from_parts(328_138_594, 74319) - // Standard Error: 1_557 - .saturating_add(Weight::from_parts(8_014, 0).saturating_mul(q.into())) + // Minimum execution time: 312_856_000 picoseconds. + Weight::from_parts(326_607_586, 74319) + // Standard Error: 1_507 + .saturating_add(Weight::from_parts(723, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2310,10 +2310,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_804_000 picoseconds. - Weight::from_parts(46_226_000, 3899) - // Standard Error: 51_090 - .saturating_add(Weight::from_parts(51_940_069, 0).saturating_mul(c.into())) + // Minimum execution time: 45_478_000 picoseconds. + Weight::from_parts(45_769_000, 3899) + // Standard Error: 42_221 + .saturating_add(Weight::from_parts(51_492_007, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2323,630 +2323,630 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_872_000 picoseconds. - Weight::from_parts(82_358_000, 0) - // Standard Error: 3_946_533 - .saturating_add(Weight::from_parts(617_270_552, 0).saturating_mul(r.into())) + // Minimum execution time: 85_248_000 picoseconds. + Weight::from_parts(87_224_000, 0) + // Standard Error: 4_031_043 + .saturating_add(Weight::from_parts(559_145_890, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 365_182_000 picoseconds. - Weight::from_parts(292_523_651, 0) - // Standard Error: 7_087 - .saturating_add(Weight::from_parts(31_059_002, 0).saturating_mul(p.into())) + // Minimum execution time: 304_310_000 picoseconds. + Weight::from_parts(240_640_662, 0) + // Standard Error: 7_875 + .saturating_add(Weight::from_parts(30_931_778, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 196_771_000 picoseconds. - Weight::from_parts(219_836_156, 0) - // Standard Error: 406_704 - .saturating_add(Weight::from_parts(120_742_843, 0).saturating_mul(r.into())) + // Minimum execution time: 144_728_000 picoseconds. + Weight::from_parts(127_694_995, 0) + // Standard Error: 344_021 + .saturating_add(Weight::from_parts(63_008_235, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_043_000 picoseconds. - Weight::from_parts(92_117_781, 0) - // Standard Error: 7_334 - .saturating_add(Weight::from_parts(3_640_301, 0).saturating_mul(r.into())) + // Minimum execution time: 85_763_000 picoseconds. + Weight::from_parts(93_302_515, 0) + // Standard Error: 3_873 + .saturating_add(Weight::from_parts(2_723_217, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 146_803_000 picoseconds. - Weight::from_parts(168_908_676, 0) - // Standard Error: 28_070 - .saturating_add(Weight::from_parts(3_989_643, 0).saturating_mul(r.into())) + // Minimum execution time: 134_987_000 picoseconds. + Weight::from_parts(141_052_149, 0) + // Standard Error: 29_498 + .saturating_add(Weight::from_parts(3_252_053, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_421_000 picoseconds. - Weight::from_parts(109_902_108, 0) - // Standard Error: 458_197 - .saturating_add(Weight::from_parts(186_560_355, 0).saturating_mul(r.into())) + // Minimum execution time: 82_532_000 picoseconds. + Weight::from_parts(111_956_884, 0) + // Standard Error: 420_651 + .saturating_add(Weight::from_parts(124_761_103, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_173_000 picoseconds. - Weight::from_parts(81_703_608, 0) - // Standard Error: 318_823 - .saturating_add(Weight::from_parts(183_602_076, 0).saturating_mul(r.into())) + // Minimum execution time: 82_442_000 picoseconds. + Weight::from_parts(76_262_730, 0) + // Standard Error: 310_067 + .saturating_add(Weight::from_parts(115_334_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_999_000 picoseconds. - Weight::from_parts(81_002_605, 0) - // Standard Error: 269_075 - .saturating_add(Weight::from_parts(183_154_106, 0).saturating_mul(r.into())) + // Minimum execution time: 82_322_000 picoseconds. + Weight::from_parts(71_153_919, 0) + // Standard Error: 293_317 + .saturating_add(Weight::from_parts(115_508_333, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_306_000 picoseconds. - Weight::from_parts(79_166_166, 0) - // Standard Error: 332_502 - .saturating_add(Weight::from_parts(182_666_522, 0).saturating_mul(r.into())) + // Minimum execution time: 82_586_000 picoseconds. + Weight::from_parts(73_401_225, 0) + // Standard Error: 306_089 + .saturating_add(Weight::from_parts(115_530_298, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_459_000 picoseconds. - Weight::from_parts(80_301_392, 0) - // Standard Error: 340_598 - .saturating_add(Weight::from_parts(184_099_120, 0).saturating_mul(r.into())) + // Minimum execution time: 86_537_000 picoseconds. + Weight::from_parts(80_327_682, 0) + // Standard Error: 275_679 + .saturating_add(Weight::from_parts(114_024_859, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_140_000 picoseconds. - Weight::from_parts(72_987_262, 0) - // Standard Error: 388_909 - .saturating_add(Weight::from_parts(186_920_851, 0).saturating_mul(r.into())) + // Minimum execution time: 84_226_000 picoseconds. + Weight::from_parts(74_308_323, 0) + // Standard Error: 291_460 + .saturating_add(Weight::from_parts(115_396_428, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_336_000 picoseconds. - Weight::from_parts(79_078_269, 0) - // Standard Error: 276_322 - .saturating_add(Weight::from_parts(182_690_178, 0).saturating_mul(r.into())) + // Minimum execution time: 81_250_000 picoseconds. + Weight::from_parts(74_761_588, 0) + // Standard Error: 317_797 + .saturating_add(Weight::from_parts(115_173_001, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_201_000 picoseconds. - Weight::from_parts(79_459_558, 0) - // Standard Error: 357_406 - .saturating_add(Weight::from_parts(182_989_857, 0).saturating_mul(r.into())) + // Minimum execution time: 85_673_000 picoseconds. + Weight::from_parts(70_907_772, 0) + // Standard Error: 347_682 + .saturating_add(Weight::from_parts(118_189_625, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 709_298_000 picoseconds. - Weight::from_parts(792_701_124, 0) - // Standard Error: 581_476 - .saturating_add(Weight::from_parts(264_833_637, 0).saturating_mul(r.into())) + // Minimum execution time: 700_530_000 picoseconds. + Weight::from_parts(774_384_678, 0) + // Standard Error: 512_748 + .saturating_add(Weight::from_parts(194_331_468, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 958_553_000 picoseconds. - Weight::from_parts(1_002_082_000, 0) - // Standard Error: 51_056 - .saturating_add(Weight::from_parts(13_349_580, 0).saturating_mul(n.into())) + // Minimum execution time: 866_889_000 picoseconds. + Weight::from_parts(872_993_000, 0) + // Standard Error: 59_048 + .saturating_add(Weight::from_parts(13_399_620, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_092_000 picoseconds. - Weight::from_parts(70_460_333, 0) - // Standard Error: 322_779 - .saturating_add(Weight::from_parts(182_652_206, 0).saturating_mul(r.into())) + // Minimum execution time: 85_291_000 picoseconds. + Weight::from_parts(75_543_485, 0) + // Standard Error: 320_701 + .saturating_add(Weight::from_parts(115_757_456, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_315_000 picoseconds. - Weight::from_parts(77_285_940, 0) - // Standard Error: 310_862 - .saturating_add(Weight::from_parts(183_154_588, 0).saturating_mul(r.into())) + // Minimum execution time: 83_780_000 picoseconds. + Weight::from_parts(68_090_338, 0) + // Standard Error: 330_050 + .saturating_add(Weight::from_parts(117_803_137, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_813_000 picoseconds. - Weight::from_parts(83_631_977, 0) - // Standard Error: 426_894 - .saturating_add(Weight::from_parts(250_044_040, 0).saturating_mul(n.into())) + // Minimum execution time: 84_394_000 picoseconds. + Weight::from_parts(88_472_912, 0) + // Standard Error: 340_524 + .saturating_add(Weight::from_parts(190_044_477, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_342_000 picoseconds. - Weight::from_parts(88_861_000, 0) - // Standard Error: 4_034_065 - .saturating_add(Weight::from_parts(1_070_363_129, 0).saturating_mul(r.into())) + // Minimum execution time: 83_081_000 picoseconds. + Weight::from_parts(85_006_000, 0) + // Standard Error: 3_456_961 + .saturating_add(Weight::from_parts(860_188_117, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_887_000 picoseconds. - Weight::from_parts(154_402_402, 0) - // Standard Error: 504_137 - .saturating_add(Weight::from_parts(389_538_545, 0).saturating_mul(r.into())) + // Minimum execution time: 81_490_000 picoseconds. + Weight::from_parts(136_619_765, 0) + // Standard Error: 439_674 + .saturating_add(Weight::from_parts(308_552_304, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 467_573_000 picoseconds. - Weight::from_parts(471_685_000, 0) - // Standard Error: 64_140 - .saturating_add(Weight::from_parts(22_109_126, 0).saturating_mul(n.into())) + // Minimum execution time: 386_929_000 picoseconds. + Weight::from_parts(393_325_000, 0) + // Standard Error: 61_932 + .saturating_add(Weight::from_parts(21_101_790, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_853_000 picoseconds. - Weight::from_parts(152_053_498, 0) - // Standard Error: 538_330 - .saturating_add(Weight::from_parts(397_711_575, 0).saturating_mul(r.into())) + // Minimum execution time: 84_625_000 picoseconds. + Weight::from_parts(162_584_483, 0) + // Standard Error: 494_553 + .saturating_add(Weight::from_parts(313_684_139, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 471_875_000 picoseconds. - Weight::from_parts(475_692_000, 0) - // Standard Error: 57_997 - .saturating_add(Weight::from_parts(21_385_701, 0).saturating_mul(n.into())) + // Minimum execution time: 390_932_000 picoseconds. + Weight::from_parts(393_883_000, 0) + // Standard Error: 68_646 + .saturating_add(Weight::from_parts(21_188_381, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 716_684_000 picoseconds. - Weight::from_parts(781_328_373, 0) - // Standard Error: 479_933 - .saturating_add(Weight::from_parts(411_727_995, 0).saturating_mul(r.into())) + // Minimum execution time: 708_623_000 picoseconds. + Weight::from_parts(781_094_266, 0) + // Standard Error: 460_683 + .saturating_add(Weight::from_parts(328_993_362, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 746_421_000 picoseconds. - Weight::from_parts(889_163_923, 0) - // Standard Error: 621_967 - .saturating_add(Weight::from_parts(412_763_026, 0).saturating_mul(r.into())) + // Minimum execution time: 710_228_000 picoseconds. + Weight::from_parts(774_190_634, 0) + // Standard Error: 483_646 + .saturating_add(Weight::from_parts(330_057_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_961_000 picoseconds. - Weight::from_parts(86_031_226, 0) - // Standard Error: 355_690 - .saturating_add(Weight::from_parts(191_347_968, 0).saturating_mul(r.into())) + // Minimum execution time: 83_510_000 picoseconds. + Weight::from_parts(64_097_635, 0) + // Standard Error: 358_570 + .saturating_add(Weight::from_parts(126_095_109, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_797_807_000 picoseconds. - Weight::from_parts(3_948_397_472, 0) - // Standard Error: 396_090 - .saturating_add(Weight::from_parts(284_341_649, 0).saturating_mul(r.into())) + // Minimum execution time: 2_430_098_000 picoseconds. + Weight::from_parts(2_605_278_898, 0) + // Standard Error: 439_185 + .saturating_add(Weight::from_parts(217_479_981, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 485_799_000 picoseconds. - Weight::from_parts(486_862_000, 0) - // Standard Error: 47_704 - .saturating_add(Weight::from_parts(31_360_292, 0).saturating_mul(n.into())) + // Minimum execution time: 358_553_000 picoseconds. + Weight::from_parts(364_183_000, 0) + // Standard Error: 51_397 + .saturating_add(Weight::from_parts(30_914_040, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_842_120_000 picoseconds. - Weight::from_parts(3_943_431_716, 0) - // Standard Error: 766_406 - .saturating_add(Weight::from_parts(339_379_953, 0).saturating_mul(r.into())) + // Minimum execution time: 2_464_581_000 picoseconds. + Weight::from_parts(2_580_044_243, 0) + // Standard Error: 461_216 + .saturating_add(Weight::from_parts(272_575_116, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_828_327_000 picoseconds. - Weight::from_parts(3_976_283_101, 0) - // Standard Error: 768_169 - .saturating_add(Weight::from_parts(353_252_083, 0).saturating_mul(r.into())) + // Minimum execution time: 2_438_114_000 picoseconds. + Weight::from_parts(2_597_881_615, 0) + // Standard Error: 400_982 + .saturating_add(Weight::from_parts(275_718_502, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 256_679_000 picoseconds. - Weight::from_parts(330_245_572, 0) - // Standard Error: 519_345 - .saturating_add(Weight::from_parts(404_879_225, 0).saturating_mul(r.into())) + // Minimum execution time: 244_206_000 picoseconds. + Weight::from_parts(321_175_021, 0) + // Standard Error: 460_445 + .saturating_add(Weight::from_parts(322_059_081, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 640_004_000 picoseconds. - Weight::from_parts(646_769_000, 0) - // Standard Error: 55_122 - .saturating_add(Weight::from_parts(21_616_125, 0).saturating_mul(n.into())) + // Minimum execution time: 559_346_000 picoseconds. + Weight::from_parts(571_004_000, 0) + // Standard Error: 59_840 + .saturating_add(Weight::from_parts(21_370_093, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_981_155_000 picoseconds. - Weight::from_parts(4_086_072_221, 0) - // Standard Error: 1_076_069 - .saturating_add(Weight::from_parts(362_989_310, 0).saturating_mul(r.into())) + // Minimum execution time: 2_620_633_000 picoseconds. + Weight::from_parts(2_741_869_292, 0) + // Standard Error: 620_120 + .saturating_add(Weight::from_parts(289_781_719, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_145_000 picoseconds. - Weight::from_parts(88_260_563, 0) - // Standard Error: 277_576 - .saturating_add(Weight::from_parts(20_209_036, 0).saturating_mul(r.into())) + // Minimum execution time: 83_438_000 picoseconds. + Weight::from_parts(86_817_816, 0) + // Standard Error: 234_731 + .saturating_add(Weight::from_parts(19_849_283, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_930_000 picoseconds. - Weight::from_parts(90_280_376, 0) - // Standard Error: 1_072 - .saturating_add(Weight::from_parts(427_777, 0).saturating_mul(n.into())) + // Minimum execution time: 105_002_000 picoseconds. + Weight::from_parts(88_114_999, 0) + // Standard Error: 1_128 + .saturating_add(Weight::from_parts(427_426, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_156_000 picoseconds. - Weight::from_parts(89_778_763, 0) - // Standard Error: 365_767 - .saturating_add(Weight::from_parts(24_157_936, 0).saturating_mul(r.into())) + // Minimum execution time: 82_436_000 picoseconds. + Weight::from_parts(88_440_285, 0) + // Standard Error: 277_544 + .saturating_add(Weight::from_parts(17_399_914, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_315_000 picoseconds. - Weight::from_parts(94_894_394, 0) - // Standard Error: 993 - .saturating_add(Weight::from_parts(426_364, 0).saturating_mul(n.into())) + // Minimum execution time: 103_800_000 picoseconds. + Weight::from_parts(89_756_983, 0) + // Standard Error: 907 + .saturating_add(Weight::from_parts(428_998, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_595_000 picoseconds. - Weight::from_parts(86_259_504, 0) - // Standard Error: 284_882 - .saturating_add(Weight::from_parts(25_873_595, 0).saturating_mul(r.into())) + // Minimum execution time: 81_754_000 picoseconds. + Weight::from_parts(87_296_014, 0) + // Standard Error: 336_747 + .saturating_add(Weight::from_parts(20_299_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_771_000 picoseconds. - Weight::from_parts(85_313_802, 0) - // Standard Error: 265_474 - .saturating_add(Weight::from_parts(25_863_597, 0).saturating_mul(r.into())) + // Minimum execution time: 81_952_000 picoseconds. + Weight::from_parts(86_840_575, 0) + // Standard Error: 272_708 + .saturating_add(Weight::from_parts(19_217_524, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_396_000 picoseconds. - Weight::from_parts(126_819_617, 0) - // Standard Error: 518_749 - .saturating_add(Weight::from_parts(272_821_836, 0).saturating_mul(r.into())) + // Minimum execution time: 85_498_000 picoseconds. + Weight::from_parts(126_431_779, 0) + // Standard Error: 460_480 + .saturating_add(Weight::from_parts(198_940_536, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_266_000 picoseconds. - Weight::from_parts(100_843_000, 0) - // Standard Error: 2_828 - .saturating_add(Weight::from_parts(662_117, 0).saturating_mul(n.into())) + // Minimum execution time: 96_862_000 picoseconds. + Weight::from_parts(98_611_000, 0) + // Standard Error: 2_677 + .saturating_add(Weight::from_parts(662_266, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_150_000 picoseconds. - Weight::from_parts(754_398_128, 0) - // Standard Error: 5_119_788 - .saturating_add(Weight::from_parts(7_037_071, 0).saturating_mul(r.into())) + // Minimum execution time: 698_914_000 picoseconds. + Weight::from_parts(718_405_100, 0) + // Standard Error: 1_891_960 + .saturating_add(Weight::from_parts(24_867_800, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 712_091_000 picoseconds. - Weight::from_parts(751_999_544, 0) - // Standard Error: 4_003_265 - .saturating_add(Weight::from_parts(43_818_555, 0).saturating_mul(r.into())) + // Minimum execution time: 699_975_000 picoseconds. + Weight::from_parts(718_806_789, 0) + // Standard Error: 1_919_531 + .saturating_add(Weight::from_parts(51_192_710, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_234_000 picoseconds. - Weight::from_parts(96_192_773, 0) - // Standard Error: 271_871 - .saturating_add(Weight::from_parts(13_338_726, 0).saturating_mul(r.into())) + // Minimum execution time: 95_002_000 picoseconds. + Weight::from_parts(99_331_989, 0) + // Standard Error: 287_602 + .saturating_add(Weight::from_parts(9_719_710, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 108_190_000 picoseconds. - Weight::from_parts(92_525_926, 0) - // Standard Error: 1_134 - .saturating_add(Weight::from_parts(433_806, 0).saturating_mul(n.into())) + // Minimum execution time: 102_501_000 picoseconds. + Weight::from_parts(87_026_327, 0) + // Standard Error: 1_214 + .saturating_add(Weight::from_parts(429_134, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_297_000 picoseconds. - Weight::from_parts(98_054_616, 0) - // Standard Error: 394_791 - .saturating_add(Weight::from_parts(7_680_683, 0).saturating_mul(r.into())) + // Minimum execution time: 93_228_000 picoseconds. + Weight::from_parts(97_923_691, 0) + // Standard Error: 288_469 + .saturating_add(Weight::from_parts(9_669_908, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 106_932_000 picoseconds. - Weight::from_parts(91_150_785, 0) - // Standard Error: 1_067 - .saturating_add(Weight::from_parts(424_570, 0).saturating_mul(n.into())) + // Minimum execution time: 100_908_000 picoseconds. + Weight::from_parts(87_613_705, 0) + // Standard Error: 1_237 + .saturating_add(Weight::from_parts(431_412, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_591_000 picoseconds. - Weight::from_parts(79_590_461, 0) - // Standard Error: 360_038 - .saturating_add(Weight::from_parts(185_313_242, 0).saturating_mul(r.into())) + // Minimum execution time: 84_385_000 picoseconds. + Weight::from_parts(74_453_057, 0) + // Standard Error: 309_931 + .saturating_add(Weight::from_parts(117_172_527, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_379_000 picoseconds. - Weight::from_parts(82_304_672, 0) - // Standard Error: 371_508 - .saturating_add(Weight::from_parts(184_895_719, 0).saturating_mul(r.into())) + // Minimum execution time: 82_437_000 picoseconds. + Weight::from_parts(78_951_443, 0) + // Standard Error: 294_227 + .saturating_add(Weight::from_parts(116_066_384, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_906_000 picoseconds. - Weight::from_parts(784_837_322, 0) - // Standard Error: 485_874 - .saturating_add(Weight::from_parts(198_529_306, 0).saturating_mul(r.into())) + // Minimum execution time: 704_954_000 picoseconds. + Weight::from_parts(752_735_182, 0) + // Standard Error: 455_998 + .saturating_add(Weight::from_parts(135_154_607, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 735_164_000 picoseconds. - Weight::from_parts(760_829_418, 0) - // Standard Error: 2_049 - .saturating_add(Weight::from_parts(164_862, 0).saturating_mul(n.into())) + // Minimum execution time: 724_451_000 picoseconds. + Weight::from_parts(738_722_668, 0) + // Standard Error: 1_014 + .saturating_add(Weight::from_parts(154_329, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_467_125_000 picoseconds. - Weight::from_parts(4_668_343_697, 0) - // Standard Error: 529_569 - .saturating_add(Weight::from_parts(214_709_155, 0).saturating_mul(r.into())) + // Minimum execution time: 3_092_586_000 picoseconds. + Weight::from_parts(3_231_311_035, 0) + // Standard Error: 506_742 + .saturating_add(Weight::from_parts(159_545_582, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_716_693_000 picoseconds. - Weight::from_parts(4_810_590_943, 0) - // Standard Error: 12_440 - .saturating_add(Weight::from_parts(13_814_475, 0).saturating_mul(n.into())) + // Minimum execution time: 3_299_872_000 picoseconds. + Weight::from_parts(3_317_022_894, 0) + // Standard Error: 8_542 + .saturating_add(Weight::from_parts(13_645_472, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_721_000 picoseconds. - Weight::from_parts(95_360_878, 0) - // Standard Error: 488_163 - .saturating_add(Weight::from_parts(198_923_476, 0).saturating_mul(r.into())) + // Minimum execution time: 85_966_000 picoseconds. + Weight::from_parts(106_319_310, 0) + // Standard Error: 424_534 + .saturating_add(Weight::from_parts(139_885_203, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 189_069_000 picoseconds. - Weight::from_parts(191_834_000, 0) - // Standard Error: 53_942 - .saturating_add(Weight::from_parts(26_059_121, 0).saturating_mul(n.into())) + // Minimum execution time: 142_910_000 picoseconds. + Weight::from_parts(144_843_000, 0) + // Standard Error: 54_401 + .saturating_add(Weight::from_parts(25_535_472, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_023_000 picoseconds. - Weight::from_parts(70_919_161, 0) - // Standard Error: 442_134 - .saturating_add(Weight::from_parts(186_467_769, 0).saturating_mul(r.into())) + // Minimum execution time: 82_117_000 picoseconds. + Weight::from_parts(80_202_149, 0) + // Standard Error: 296_880 + .saturating_add(Weight::from_parts(114_586_990, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_187_000 picoseconds. - Weight::from_parts(86_256_124, 0) - // Standard Error: 333_120 - .saturating_add(Weight::from_parts(27_182_075, 0).saturating_mul(r.into())) + // Minimum execution time: 81_802_000 picoseconds. + Weight::from_parts(85_064_295, 0) + // Standard Error: 248_874 + .saturating_add(Weight::from_parts(27_314_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_373_000 picoseconds. - Weight::from_parts(83_957_387, 0) - // Standard Error: 258_914 - .saturating_add(Weight::from_parts(14_637_112, 0).saturating_mul(r.into())) + // Minimum execution time: 82_854_000 picoseconds. + Weight::from_parts(86_180_314, 0) + // Standard Error: 239_162 + .saturating_add(Weight::from_parts(16_391_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_886_000 picoseconds. - Weight::from_parts(86_536_767, 0) - // Standard Error: 237_087 - .saturating_add(Weight::from_parts(15_456_732, 0).saturating_mul(r.into())) + // Minimum execution time: 80_883_000 picoseconds. + Weight::from_parts(87_058_214, 0) + // Standard Error: 256_392 + .saturating_add(Weight::from_parts(13_333_285, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_962_000 picoseconds. - Weight::from_parts(87_038_165, 0) - // Standard Error: 267_652 - .saturating_add(Weight::from_parts(14_141_234, 0).saturating_mul(r.into())) + // Minimum execution time: 81_417_000 picoseconds. + Weight::from_parts(85_403_451, 0) + // Standard Error: 249_767 + .saturating_add(Weight::from_parts(14_474_948, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_976_000 picoseconds. - Weight::from_parts(87_105_967, 0) - // Standard Error: 237_581 - .saturating_add(Weight::from_parts(13_365_932, 0).saturating_mul(r.into())) + // Minimum execution time: 84_020_000 picoseconds. + Weight::from_parts(88_080_622, 0) + // Standard Error: 253_221 + .saturating_add(Weight::from_parts(11_403_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_585_000 picoseconds. - Weight::from_parts(203_512_831, 0) - // Standard Error: 393_346 - .saturating_add(Weight::from_parts(283_538_921, 0).saturating_mul(r.into())) + // Minimum execution time: 138_317_000 picoseconds. + Weight::from_parts(187_894_162, 0) + // Standard Error: 376_519 + .saturating_add(Weight::from_parts(209_723_429, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_330_000 picoseconds. - Weight::from_parts(158_669_516, 0) - // Standard Error: 440_421 - .saturating_add(Weight::from_parts(473_163_025, 0).saturating_mul(r.into())) + // Minimum execution time: 93_047_000 picoseconds. + Weight::from_parts(151_715_771, 0) + // Standard Error: 425_606 + .saturating_add(Weight::from_parts(396_733_544, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2954,22 +2954,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_492_772_000 picoseconds. - Weight::from_parts(43_692_998_000, 0) - // Standard Error: 263_249 - .saturating_add(Weight::from_parts(8_169_821, 0).saturating_mul(p.into())) - // Standard Error: 263_236 - .saturating_add(Weight::from_parts(180_732_778, 0).saturating_mul(s.into())) + // Minimum execution time: 45_923_081_000 picoseconds. + Weight::from_parts(45_981_736_000, 0) + // Standard Error: 274_662 + .saturating_add(Weight::from_parts(6_858_186, 0).saturating_mul(p.into())) + // Standard Error: 274_649 + .saturating_add(Weight::from_parts(177_291_831, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_189_000 picoseconds. - Weight::from_parts(158_677_248, 0) - // Standard Error: 452_648 - .saturating_add(Weight::from_parts(478_043_506, 0).saturating_mul(r.into())) + // Minimum execution time: 95_680_000 picoseconds. + Weight::from_parts(157_350_147, 0) + // Standard Error: 440_994 + .saturating_add(Weight::from_parts(402_511_567, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2977,32 +2977,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_613_488_000 picoseconds. - Weight::from_parts(43_758_304_000, 0) - // Standard Error: 268_412 - .saturating_add(Weight::from_parts(7_987_894, 0).saturating_mul(p.into())) - // Standard Error: 268_399 - .saturating_add(Weight::from_parts(180_769_004, 0).saturating_mul(s.into())) + // Minimum execution time: 42_842_395_000 picoseconds. + Weight::from_parts(42_890_931_000, 0) + // Standard Error: 264_187 + .saturating_add(Weight::from_parts(7_896_879, 0).saturating_mul(p.into())) + // Standard Error: 264_174 + .saturating_add(Weight::from_parts(178_082_248, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_210_000 picoseconds. - Weight::from_parts(99_996_695, 0) - // Standard Error: 31_808 - .saturating_add(Weight::from_parts(3_523_987, 0).saturating_mul(r.into())) + // Minimum execution time: 82_272_000 picoseconds. + Weight::from_parts(100_008_395, 0) + // Standard Error: 36_430 + .saturating_add(Weight::from_parts(2_544_223, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 82_940_000 picoseconds. - Weight::from_parts(123_540_441, 1131) - // Standard Error: 7_143 - .saturating_add(Weight::from_parts(11_789_871, 0).saturating_mul(p.into())) + // Minimum execution time: 83_139_000 picoseconds. + Weight::from_parts(122_967_835, 1131) + // Standard Error: 6_454 + .saturating_add(Weight::from_parts(11_784_103, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3011,10 +3011,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_752_000 picoseconds. - Weight::from_parts(84_858_000, 1131) - // Standard Error: 48_161 - .saturating_add(Weight::from_parts(36_181_117, 0).saturating_mul(p.into())) + // Minimum execution time: 83_229_000 picoseconds. + Weight::from_parts(83_885_000, 1131) + // Standard Error: 37_558 + .saturating_add(Weight::from_parts(35_503_677, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3023,10 +3023,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_125_138_000 picoseconds. - Weight::from_parts(5_869_525_563, 5069931) - // Standard Error: 46_521 - .saturating_add(Weight::from_parts(36_899_111, 0).saturating_mul(p.into())) + // Minimum execution time: 6_139_187_000 picoseconds. + Weight::from_parts(5_806_599_304, 5069931) + // Standard Error: 75_881 + .saturating_add(Weight::from_parts(36_513_688, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -3034,10 +3034,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_516_000 picoseconds. - Weight::from_parts(83_470_000, 1939) - // Standard Error: 29_769 - .saturating_add(Weight::from_parts(46_665_657, 0).saturating_mul(p.into())) + // Minimum execution time: 82_177_000 picoseconds. + Weight::from_parts(83_595_000, 1939) + // Standard Error: 45_778 + .saturating_add(Weight::from_parts(47_155_630, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -3046,10 +3046,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_344_000 picoseconds. - Weight::from_parts(94_873_151, 1131) - // Standard Error: 55_429 - .saturating_add(Weight::from_parts(35_724_871, 0).saturating_mul(p.into())) + // Minimum execution time: 90_231_000 picoseconds. + Weight::from_parts(95_944_378, 1131) + // Standard Error: 61_821 + .saturating_add(Weight::from_parts(35_941_066, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3058,10 +3058,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 735_393_000 picoseconds. - Weight::from_parts(754_062_397, 1496) - // Standard Error: 166_437 - .saturating_add(Weight::from_parts(43_966_900, 0).saturating_mul(p.into())) + // Minimum execution time: 734_006_000 picoseconds. + Weight::from_parts(717_384_508, 1496) + // Standard Error: 375_292 + .saturating_add(Weight::from_parts(47_930_581, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3070,10 +3070,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_124_371_000 picoseconds. - Weight::from_parts(1_147_901_415, 317931) - // Standard Error: 145_342 - .saturating_add(Weight::from_parts(43_795_511, 0).saturating_mul(p.into())) + // Minimum execution time: 1_121_849_000 picoseconds. + Weight::from_parts(1_147_558_033, 317931) + // Standard Error: 373_146 + .saturating_add(Weight::from_parts(45_393_418, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3081,884 +3081,884 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_510_000 picoseconds. - Weight::from_parts(1_448_006, 0) - // Standard Error: 9_868 - .saturating_add(Weight::from_parts(24_061_691, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_220_392, 0) + // Standard Error: 8_848 + .saturating_add(Weight::from_parts(24_205_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_991_000 picoseconds. - Weight::from_parts(4_151_991_287, 0) - // Standard Error: 60_683 - .saturating_add(Weight::from_parts(4_818_799, 0).saturating_mul(r.into())) + // Minimum execution time: 4_352_664_000 picoseconds. + Weight::from_parts(4_153_366_897, 0) + // Standard Error: 60_193 + .saturating_add(Weight::from_parts(4_722_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_341_162_000 picoseconds. - Weight::from_parts(4_200_807_294, 0) - // Standard Error: 51_442 - .saturating_add(Weight::from_parts(4_527_839, 0).saturating_mul(r.into())) + // Minimum execution time: 4_357_649_000 picoseconds. + Weight::from_parts(4_256_499_798, 0) + // Standard Error: 57_942 + .saturating_add(Weight::from_parts(4_200_870, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_322_767_000 picoseconds. - Weight::from_parts(11_038_976_057, 0) - // Standard Error: 150_113 - .saturating_add(Weight::from_parts(10_655_640, 0).saturating_mul(r.into())) + // Minimum execution time: 10_269_998_000 picoseconds. + Weight::from_parts(11_525_100_351, 0) + // Standard Error: 204_230 + .saturating_add(Weight::from_parts(8_423_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_367_826_000 picoseconds. - Weight::from_parts(11_310_983_745, 0) - // Standard Error: 145_202 - .saturating_add(Weight::from_parts(7_541_832, 0).saturating_mul(r.into())) + // Minimum execution time: 10_204_810_000 picoseconds. + Weight::from_parts(10_982_673_143, 0) + // Standard Error: 145_327 + .saturating_add(Weight::from_parts(9_198_033, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_251_000 picoseconds. - Weight::from_parts(2_304_000, 0) - // Standard Error: 8_520 - .saturating_add(Weight::from_parts(3_798_413, 0).saturating_mul(r.into())) + // Minimum execution time: 2_074_000 picoseconds. + Weight::from_parts(2_108_000, 0) + // Standard Error: 9_031 + .saturating_add(Weight::from_parts(3_829_182, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(573_722, 0) - // Standard Error: 11_642 - .saturating_add(Weight::from_parts(3_174_691, 0).saturating_mul(r.into())) + // Minimum execution time: 2_020_000 picoseconds. + Weight::from_parts(2_118_000, 0) + // Standard Error: 5_295 + .saturating_add(Weight::from_parts(2_980_329, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(3_155_512, 0) - // Standard Error: 1_212 - .saturating_add(Weight::from_parts(1_586_585, 0).saturating_mul(r.into())) + // Minimum execution time: 2_032_000 picoseconds. + Weight::from_parts(3_411_359, 0) + // Standard Error: 1_146 + .saturating_add(Weight::from_parts(1_563_906, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_160_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 8_627 - .saturating_add(Weight::from_parts(2_929_529, 0).saturating_mul(r.into())) + // Minimum execution time: 2_096_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 8_349 + .saturating_add(Weight::from_parts(2_904_673, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(1_609_241, 0) - // Standard Error: 19_812 - .saturating_add(Weight::from_parts(5_162_833, 0).saturating_mul(r.into())) + // Minimum execution time: 2_128_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 8_100 + .saturating_add(Weight::from_parts(5_229_400, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_892_000 picoseconds. - Weight::from_parts(5_316_811, 0) - // Standard Error: 1_578 - .saturating_add(Weight::from_parts(163_377, 0).saturating_mul(e.into())) + // Minimum execution time: 6_838_000 picoseconds. + Weight::from_parts(5_309_346, 0) + // Standard Error: 2_580 + .saturating_add(Weight::from_parts(129_982, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_304_000 picoseconds. - Weight::from_parts(4_554_683, 0) - // Standard Error: 7_319 - .saturating_add(Weight::from_parts(2_595_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(3_593_285, 0) + // Standard Error: 6_648 + .saturating_add(Weight::from_parts(2_597_926, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_595_958 - - 2_422_191, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_597_926 - + 2_429_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_273_000 picoseconds. - Weight::from_parts(5_046_075, 0) - // Standard Error: 13_702 - .saturating_add(Weight::from_parts(2_422_191, 0).saturating_mul(r.into())) + // Minimum execution time: 2_086_000 picoseconds. + Weight::from_parts(3_972_773, 0) + // Standard Error: 12_538 + .saturating_add(Weight::from_parts(2_429_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_684_000 picoseconds. - Weight::from_parts(17_324_871, 0) - // Standard Error: 38_532 - .saturating_add(Weight::from_parts(10_260_872, 0).saturating_mul(r.into())) + // Minimum execution time: 2_591_000 picoseconds. + Weight::from_parts(12_798_134, 0) + // Standard Error: 23_023 + .saturating_add(Weight::from_parts(9_786_464, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_206_000 picoseconds. - Weight::from_parts(2_634_425, 0) - // Standard Error: 5_954 - .saturating_add(Weight::from_parts(1_275_538, 0).saturating_mul(p.into())) + // Minimum execution time: 12_274_000 picoseconds. + Weight::from_parts(1_706_188, 0) + // Standard Error: 6_199 + .saturating_add(Weight::from_parts(1_212_443, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_288_000 picoseconds. - Weight::from_parts(5_570_870, 0) + // Minimum execution time: 5_221_000 picoseconds. + Weight::from_parts(5_538_574, 0) // Standard Error: 12 - .saturating_add(Weight::from_parts(61, 0).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(12, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_203_000 picoseconds. - Weight::from_parts(1_788_159, 0) - // Standard Error: 3_152 - .saturating_add(Weight::from_parts(267_842, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(1_785_103, 0) + // Standard Error: 2_948 + .saturating_add(Weight::from_parts(249_981, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_164_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 4_611 - .saturating_add(Weight::from_parts(721_127, 0).saturating_mul(r.into())) + // Minimum execution time: 2_123_000 picoseconds. + Weight::from_parts(2_187_000, 0) + // Standard Error: 5_664 + .saturating_add(Weight::from_parts(719_187, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_347_000, 0) - // Standard Error: 5_971 - .saturating_add(Weight::from_parts(742_209, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_214_000, 0) + // Standard Error: 5_625 + .saturating_add(Weight::from_parts(709_067, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_406_000 picoseconds. - Weight::from_parts(2_894_577, 0) - // Standard Error: 8_027 - .saturating_add(Weight::from_parts(801_493, 0).saturating_mul(r.into())) + // Minimum execution time: 6_168_000 picoseconds. + Weight::from_parts(2_290_203, 0) + // Standard Error: 8_984 + .saturating_add(Weight::from_parts(761_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_345_000 picoseconds. - Weight::from_parts(31_295, 0) - // Standard Error: 10_231 - .saturating_add(Weight::from_parts(1_543_569, 0).saturating_mul(r.into())) + // Minimum execution time: 6_249_000 picoseconds. + Weight::from_parts(6_302_000, 0) + // Standard Error: 8_682 + .saturating_add(Weight::from_parts(1_329_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_937_000 picoseconds. - Weight::from_parts(62_049, 0) - // Standard Error: 12_087 - .saturating_add(Weight::from_parts(7_172_920, 0).saturating_mul(r.into())) + // Minimum execution time: 3_791_000 picoseconds. + Weight::from_parts(3_929_000, 0) + // Standard Error: 9_270 + .saturating_add(Weight::from_parts(6_742_685, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_262_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 6_042 - .saturating_add(Weight::from_parts(3_394_526, 0).saturating_mul(r.into())) + // Minimum execution time: 2_113_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 6_734 + .saturating_add(Weight::from_parts(3_327_207, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 5_891 - .saturating_add(Weight::from_parts(3_138_523, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_141_000, 0) + // Standard Error: 6_506 + .saturating_add(Weight::from_parts(3_061_891, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_277_000, 0) - // Standard Error: 8_196 - .saturating_add(Weight::from_parts(3_167_033, 0).saturating_mul(r.into())) + // Minimum execution time: 2_108_000 picoseconds. + Weight::from_parts(2_141_000, 0) + // Standard Error: 6_738 + .saturating_add(Weight::from_parts(3_101_844, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 5_536 - .saturating_add(Weight::from_parts(2_668_164, 0).saturating_mul(r.into())) + // Minimum execution time: 2_138_000 picoseconds. + Weight::from_parts(2_155_000, 0) + // Standard Error: 4_379 + .saturating_add(Weight::from_parts(2_613_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(45_432, 0) - // Standard Error: 6_223 - .saturating_add(Weight::from_parts(645_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_046_000 picoseconds. + Weight::from_parts(2_127_000, 0) + // Standard Error: 3_513 + .saturating_add(Weight::from_parts(525_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(1_301_007, 0) - // Standard Error: 4_929 - .saturating_add(Weight::from_parts(446_280, 0).saturating_mul(r.into())) + // Minimum execution time: 2_127_000 picoseconds. + Weight::from_parts(1_669_179, 0) + // Standard Error: 2_817 + .saturating_add(Weight::from_parts(367_599, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_205_000, 0) - // Standard Error: 10_412 - .saturating_add(Weight::from_parts(1_894_722, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 11_816 + .saturating_add(Weight::from_parts(1_810_781, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_257_000, 0) - // Standard Error: 7_708 - .saturating_add(Weight::from_parts(1_162_246, 0).saturating_mul(r.into())) + // Minimum execution time: 2_087_000 picoseconds. + Weight::from_parts(2_194_000, 0) + // Standard Error: 7_361 + .saturating_add(Weight::from_parts(1_130_773, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(1_682_106, 0) - // Standard Error: 3_839 - .saturating_add(Weight::from_parts(384_381, 0).saturating_mul(r.into())) + // Minimum execution time: 2_061_000 picoseconds. + Weight::from_parts(1_850_477, 0) + // Standard Error: 2_695 + .saturating_add(Weight::from_parts(318_827, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(1_669_708, 0) - // Standard Error: 3_126 - .saturating_add(Weight::from_parts(384_474, 0).saturating_mul(r.into())) + // Minimum execution time: 2_115_000 picoseconds. + Weight::from_parts(1_764_589, 0) + // Standard Error: 2_923 + .saturating_add(Weight::from_parts(329_840, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_291_000, 0) - // Standard Error: 4_476 - .saturating_add(Weight::from_parts(497_277, 0).saturating_mul(r.into())) + // Minimum execution time: 2_109_000 picoseconds. + Weight::from_parts(859_995, 0) + // Standard Error: 4_546 + .saturating_add(Weight::from_parts(467_944, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_217_000 picoseconds. - Weight::from_parts(2_287_000, 0) - // Standard Error: 4_107 - .saturating_add(Weight::from_parts(524_095, 0).saturating_mul(r.into())) + // Minimum execution time: 2_010_000 picoseconds. + Weight::from_parts(2_081_000, 0) + // Standard Error: 3_959 + .saturating_add(Weight::from_parts(472_947, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_233_000, 0) - // Standard Error: 3_690 - .saturating_add(Weight::from_parts(501_277, 0).saturating_mul(r.into())) + // Minimum execution time: 2_105_000 picoseconds. + Weight::from_parts(1_247_124, 0) + // Standard Error: 4_390 + .saturating_add(Weight::from_parts(436_907, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_132_000 picoseconds. - Weight::from_parts(1_082_506, 0) - // Standard Error: 5_421 - .saturating_add(Weight::from_parts(400_448, 0).saturating_mul(r.into())) + // Minimum execution time: 2_140_000 picoseconds. + Weight::from_parts(2_251_532, 0) + // Standard Error: 2_995 + .saturating_add(Weight::from_parts(280_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(3_085_764, 0) - // Standard Error: 1_912 - .saturating_add(Weight::from_parts(162_384, 0).saturating_mul(r.into())) + // Minimum execution time: 2_119_000 picoseconds. + Weight::from_parts(2_808_547, 0) + // Standard Error: 1_453 + .saturating_add(Weight::from_parts(143_409, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_849_158, 0) - // Standard Error: 1_635 - .saturating_add(Weight::from_parts(153_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_043_000 picoseconds. + Weight::from_parts(2_639_820, 0) + // Standard Error: 1_638 + .saturating_add(Weight::from_parts(159_792, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_315_000, 0) - // Standard Error: 11_776 - .saturating_add(Weight::from_parts(1_779_477, 0).saturating_mul(r.into())) + // Minimum execution time: 2_128_000 picoseconds. + Weight::from_parts(2_166_000, 0) + // Standard Error: 11_777 + .saturating_add(Weight::from_parts(1_709_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 8_815 - .saturating_add(Weight::from_parts(1_197_093, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(2_136_000, 0) + // Standard Error: 7_491 + .saturating_add(Weight::from_parts(1_105_807, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 9_983 - .saturating_add(Weight::from_parts(1_838_257, 0).saturating_mul(r.into())) + // Minimum execution time: 2_088_000 picoseconds. + Weight::from_parts(2_171_000, 0) + // Standard Error: 11_841 + .saturating_add(Weight::from_parts(1_785_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 7_749 - .saturating_add(Weight::from_parts(1_165_862, 0).saturating_mul(r.into())) + // Minimum execution time: 2_042_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 7_479 + .saturating_add(Weight::from_parts(1_086_144, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_172_000 picoseconds. - Weight::from_parts(2_246_000, 0) - // Standard Error: 11_426 - .saturating_add(Weight::from_parts(1_828_814, 0).saturating_mul(r.into())) + // Minimum execution time: 2_109_000 picoseconds. + Weight::from_parts(2_151_000, 0) + // Standard Error: 13_111 + .saturating_add(Weight::from_parts(1_829_000, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_187_000 picoseconds. - Weight::from_parts(2_245_000, 0) - // Standard Error: 7_973 - .saturating_add(Weight::from_parts(1_145_613, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_153_000, 0) + // Standard Error: 7_632 + .saturating_add(Weight::from_parts(1_102_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_273_000, 0) - // Standard Error: 10_995 - .saturating_add(Weight::from_parts(1_789_814, 0).saturating_mul(r.into())) + // Minimum execution time: 2_155_000 picoseconds. + Weight::from_parts(2_231_000, 0) + // Standard Error: 11_689 + .saturating_add(Weight::from_parts(1_768_866, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_252_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_207_539, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_163_000, 0) + // Standard Error: 7_348 + .saturating_add(Weight::from_parts(1_057_058, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_219_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 10_576 - .saturating_add(Weight::from_parts(1_855_075, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_142_000, 0) + // Standard Error: 12_173 + .saturating_add(Weight::from_parts(1_786_184, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_199_000 picoseconds. - Weight::from_parts(2_265_000, 0) - // Standard Error: 7_405 - .saturating_add(Weight::from_parts(1_180_265, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_206_000, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(1_066_057, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_285_000, 0) - // Standard Error: 10_994 - .saturating_add(Weight::from_parts(1_835_344, 0).saturating_mul(r.into())) + // Minimum execution time: 2_090_000 picoseconds. + Weight::from_parts(2_175_000, 0) + // Standard Error: 11_967 + .saturating_add(Weight::from_parts(1_782_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(2_277_000, 0) - // Standard Error: 7_826 - .saturating_add(Weight::from_parts(1_163_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_091_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 7_205 + .saturating_add(Weight::from_parts(1_048_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(2_217_000, 0) - // Standard Error: 11_374 - .saturating_add(Weight::from_parts(1_910_004, 0).saturating_mul(r.into())) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 12_228 + .saturating_add(Weight::from_parts(1_792_751, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_303_000, 0) - // Standard Error: 8_971 - .saturating_add(Weight::from_parts(1_182_859, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_186_000, 0) + // Standard Error: 7_822 + .saturating_add(Weight::from_parts(1_052_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_284_000, 0) - // Standard Error: 12_177 - .saturating_add(Weight::from_parts(1_866_465, 0).saturating_mul(r.into())) + // Minimum execution time: 2_055_000 picoseconds. + Weight::from_parts(2_135_000, 0) + // Standard Error: 12_011 + .saturating_add(Weight::from_parts(1_789_504, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_468_000 picoseconds. - Weight::from_parts(2_638_000, 0) - // Standard Error: 7_738 - .saturating_add(Weight::from_parts(1_119_369, 0).saturating_mul(r.into())) + // Minimum execution time: 2_447_000 picoseconds. + Weight::from_parts(2_540_000, 0) + // Standard Error: 7_696 + .saturating_add(Weight::from_parts(1_062_612, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_191_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 10_340 - .saturating_add(Weight::from_parts(1_831_738, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_107_000, 0) + // Standard Error: 12_070 + .saturating_add(Weight::from_parts(1_771_498, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 6_924 - .saturating_add(Weight::from_parts(1_210_933, 0).saturating_mul(r.into())) + // Minimum execution time: 2_123_000 picoseconds. + Weight::from_parts(2_156_000, 0) + // Standard Error: 7_108 + .saturating_add(Weight::from_parts(1_072_471, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_325_000, 0) - // Standard Error: 9_907 - .saturating_add(Weight::from_parts(1_822_715, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_145_000, 0) + // Standard Error: 11_990 + .saturating_add(Weight::from_parts(1_786_273, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 7_927 - .saturating_add(Weight::from_parts(1_168_287, 0).saturating_mul(r.into())) + // Minimum execution time: 2_059_000 picoseconds. + Weight::from_parts(2_122_000, 0) + // Standard Error: 7_164 + .saturating_add(Weight::from_parts(1_070_909, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 8_768 - .saturating_add(Weight::from_parts(1_295_617, 0).saturating_mul(r.into())) + // Minimum execution time: 2_065_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 7_265 + .saturating_add(Weight::from_parts(1_152_228, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 6_314 - .saturating_add(Weight::from_parts(658_832, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_160_000, 0) + // Standard Error: 5_101 + .saturating_add(Weight::from_parts(578_660, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 9_261 - .saturating_add(Weight::from_parts(1_348_699, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_184_000, 0) + // Standard Error: 9_299 + .saturating_add(Weight::from_parts(1_257_633, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 5_457 - .saturating_add(Weight::from_parts(671_846, 0).saturating_mul(r.into())) + // Minimum execution time: 2_119_000 picoseconds. + Weight::from_parts(2_262_000, 0) + // Standard Error: 3_957 + .saturating_add(Weight::from_parts(557_957, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_241_000, 0) - // Standard Error: 11_567 - .saturating_add(Weight::from_parts(1_835_171, 0).saturating_mul(r.into())) + // Minimum execution time: 2_045_000 picoseconds. + Weight::from_parts(2_157_000, 0) + // Standard Error: 10_839 + .saturating_add(Weight::from_parts(1_686_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_196_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 7_436 - .saturating_add(Weight::from_parts(1_171_019, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_250_000, 0) + // Standard Error: 7_276 + .saturating_add(Weight::from_parts(1_096_252, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(6_299_544, 0) - // Standard Error: 28_028 - .saturating_add(Weight::from_parts(2_500_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(1_434_170, 0) + // Standard Error: 21_965 + .saturating_add(Weight::from_parts(2_633_663, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_576_178, 0) - // Standard Error: 12_042 - .saturating_add(Weight::from_parts(2_335_953, 0).saturating_mul(r.into())) + // Minimum execution time: 2_098_000 picoseconds. + Weight::from_parts(2_122_681, 0) + // Standard Error: 10_815 + .saturating_add(Weight::from_parts(2_335_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(8_638_891, 0) - // Standard Error: 32_649 - .saturating_add(Weight::from_parts(2_462_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(145_632, 0) + // Standard Error: 12_320 + .saturating_add(Weight::from_parts(2_992_427, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_731_170, 0) - // Standard Error: 19_116 - .saturating_add(Weight::from_parts(2_437_473, 0).saturating_mul(r.into())) + // Minimum execution time: 2_142_000 picoseconds. + Weight::from_parts(2_180_000, 0) + // Standard Error: 4_944 + .saturating_add(Weight::from_parts(2_466_854, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_261_000 picoseconds. - Weight::from_parts(1_535_146, 0) - // Standard Error: 30_575 - .saturating_add(Weight::from_parts(9_634_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_143_000 picoseconds. + Weight::from_parts(2_204_000, 0) + // Standard Error: 14_500 + .saturating_add(Weight::from_parts(9_530_241, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_209_000 picoseconds. - Weight::from_parts(5_244_298, 0) - // Standard Error: 48_615 - .saturating_add(Weight::from_parts(7_381_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_132_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 22_303 + .saturating_add(Weight::from_parts(7_508_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_260_000 picoseconds. - Weight::from_parts(8_453_159, 0) - // Standard Error: 30_530 - .saturating_add(Weight::from_parts(2_541_459, 0).saturating_mul(r.into())) + // Minimum execution time: 2_133_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 5_407 + .saturating_add(Weight::from_parts(2_948_013, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(5_507_917, 0) - // Standard Error: 21_457 - .saturating_add(Weight::from_parts(2_217_886, 0).saturating_mul(r.into())) + // Minimum execution time: 2_124_000 picoseconds. + Weight::from_parts(2_150_000, 0) + // Standard Error: 6_372 + .saturating_add(Weight::from_parts(2_362_416, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 9_253 - .saturating_add(Weight::from_parts(1_354_282, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 7_670 + .saturating_add(Weight::from_parts(1_174_342, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 3_908 - .saturating_add(Weight::from_parts(589_876, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_109_000, 0) + // Standard Error: 3_988 + .saturating_add(Weight::from_parts(566_949, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_265_000, 0) - // Standard Error: 9_943 - .saturating_add(Weight::from_parts(1_308_630, 0).saturating_mul(r.into())) + // Minimum execution time: 2_049_000 picoseconds. + Weight::from_parts(2_117_000, 0) + // Standard Error: 8_393 + .saturating_add(Weight::from_parts(1_160_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_273_000, 0) - // Standard Error: 5_843 - .saturating_add(Weight::from_parts(653_388, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_152_000, 0) + // Standard Error: 4_769 + .saturating_add(Weight::from_parts(585_265, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_228_000 picoseconds. - Weight::from_parts(2_293_000, 0) - // Standard Error: 9_157 - .saturating_add(Weight::from_parts(1_290_731, 0).saturating_mul(r.into())) + // Minimum execution time: 2_115_000 picoseconds. + Weight::from_parts(2_170_000, 0) + // Standard Error: 7_943 + .saturating_add(Weight::from_parts(1_185_174, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 4_020 - .saturating_add(Weight::from_parts(618_071, 0).saturating_mul(r.into())) + // Minimum execution time: 2_139_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 4_608 + .saturating_add(Weight::from_parts(563_329, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_239_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 7_192 - .saturating_add(Weight::from_parts(1_061_312, 0).saturating_mul(r.into())) + // Minimum execution time: 2_144_000 picoseconds. + Weight::from_parts(2_178_000, 0) + // Standard Error: 6_727 + .saturating_add(Weight::from_parts(1_000_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_245_000, 0) - // Standard Error: 3_756 - .saturating_add(Weight::from_parts(568_744, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_212_000, 0) + // Standard Error: 3_536 + .saturating_add(Weight::from_parts(504_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(2_324_000, 0) - // Standard Error: 7_917 - .saturating_add(Weight::from_parts(1_106_132, 0).saturating_mul(r.into())) + // Minimum execution time: 2_167_000 picoseconds. + Weight::from_parts(2_218_000, 0) + // Standard Error: 7_170 + .saturating_add(Weight::from_parts(966_365, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_205_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 4_617 - .saturating_add(Weight::from_parts(599_461, 0).saturating_mul(r.into())) + // Minimum execution time: 2_149_000 picoseconds. + Weight::from_parts(140_768, 0) + // Standard Error: 5_221 + .saturating_add(Weight::from_parts(551_550, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_215_000 picoseconds. - Weight::from_parts(2_346_000, 0) - // Standard Error: 7_501 - .saturating_add(Weight::from_parts(1_125_645, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 7_621 + .saturating_add(Weight::from_parts(997_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 5_262 - .saturating_add(Weight::from_parts(624_680, 0).saturating_mul(r.into())) + // Minimum execution time: 2_069_000 picoseconds. + Weight::from_parts(2_106_000, 0) + // Standard Error: 3_980 + .saturating_add(Weight::from_parts(537_014, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 7_879 - .saturating_add(Weight::from_parts(1_068_877, 0).saturating_mul(r.into())) + // Minimum execution time: 2_097_000 picoseconds. + Weight::from_parts(2_191_000, 0) + // Standard Error: 9_419 + .saturating_add(Weight::from_parts(1_050_292, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 4_124 - .saturating_add(Weight::from_parts(567_690, 0).saturating_mul(r.into())) + // Minimum execution time: 2_051_000 picoseconds. + Weight::from_parts(2_118_000, 0) + // Standard Error: 4_228 + .saturating_add(Weight::from_parts(529_158, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 8_516 - .saturating_add(Weight::from_parts(1_174_764, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_116_000, 0) + // Standard Error: 7_792 + .saturating_add(Weight::from_parts(1_027_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_171_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 4_901 - .saturating_add(Weight::from_parts(628_068, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 4_450 + .saturating_add(Weight::from_parts(534_724, 0).saturating_mul(r.into())) } } diff --git a/runtime-interface/src/gear_sandbox/detail.rs b/runtime-interface/src/gear_sandbox/detail.rs index 33cd6697b87..da4a7933a92 100644 --- a/runtime-interface/src/gear_sandbox/detail.rs +++ b/runtime-interface/src/gear_sandbox/detail.rs @@ -19,7 +19,7 @@ use core::cell::RefCell; use codec::{Decode, Encode}; -use gear_sandbox_host::sandbox as sandbox_env; +use gear_sandbox_host::sandbox::{self as sandbox_env, env::Instantiate}; use sp_wasm_interface::{ util, wasmtime::{AsContext, AsContextMut, Func, Val}, @@ -232,6 +232,7 @@ pub fn instantiate( wasm_code: &[u8], raw_env_def: &[u8], state_ptr: Pointer, + version: Instantiate, ) -> u32 { let mut method_result = u32::MAX; @@ -271,6 +272,7 @@ pub fn instantiate( let result = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { SANDBOXES.with(|sandboxes| { sandboxes.borrow_mut().get(store_data_key).instantiate( + version, wasm_code, guest_env, &mut SandboxContext { diff --git a/runtime-interface/src/gear_sandbox/mod.rs b/runtime-interface/src/gear_sandbox/mod.rs index c4abfaf080b..4a4148061e7 100644 --- a/runtime-interface/src/gear_sandbox/mod.rs +++ b/runtime-interface/src/gear_sandbox/mod.rs @@ -18,6 +18,8 @@ //! Runtime interface for gear node +#[cfg(feature = "std")] +use gear_sandbox_host::sandbox::env::Instantiate; use sp_runtime_interface::{runtime_interface, Pointer}; use sp_wasm_interface::HostPointer; @@ -38,7 +40,33 @@ pub trait Sandbox { raw_env_def: &[u8], state_ptr: Pointer, ) -> u32 { - detail::instantiate(*self, dispatch_thunk_id, wasm_code, raw_env_def, state_ptr) + detail::instantiate( + *self, + dispatch_thunk_id, + wasm_code, + raw_env_def, + state_ptr, + Instantiate::Version1, + ) + } + + /// Instantiate a new sandbox instance with the given `wasm_code`. + #[version(2)] + fn instantiate( + &mut self, + dispatch_thunk_id: u32, + wasm_code: &[u8], + raw_env_def: &[u8], + state_ptr: Pointer, + ) -> u32 { + detail::instantiate( + *self, + dispatch_thunk_id, + wasm_code, + raw_env_def, + state_ptr, + Instantiate::Version2, + ) } /// Invoke `function` in the sandbox with `sandbox_idx`. diff --git a/runtime/gear/src/weights/frame_system.rs b/runtime/gear/src/weights/frame_system.rs index 57bbef7223e..7c2e30e83c0 100644 --- a/runtime/gear/src/weights/frame_system.rs +++ b/runtime/gear/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_652_000 picoseconds. - Weight::from_parts(1_044_833, 0) + // Minimum execution time: 1_580_000 picoseconds. + Weight::from_parts(959_849, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) } @@ -63,17 +63,17 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_078_000 picoseconds. - Weight::from_parts(6_338_000, 0) + // Minimum execution time: 6_178_000 picoseconds. + Weight::from_parts(6_296_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_433, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_429, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_023_000 picoseconds. - Weight::from_parts(3_268_000, 1485) + // Minimum execution time: 3_133_000 picoseconds. + Weight::from_parts(3_263_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -82,10 +82,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_662_000 picoseconds. - Weight::from_parts(1_751_000, 0) - // Standard Error: 965 - .saturating_add(Weight::from_parts(690_953, 0).saturating_mul(i.into())) + // Minimum execution time: 1_505_000 picoseconds. + Weight::from_parts(1_600_000, 0) + // Standard Error: 1_014 + .saturating_add(Weight::from_parts(700_338, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -93,10 +93,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_656_000 picoseconds. - Weight::from_parts(1_676_000, 0) - // Standard Error: 886 - .saturating_add(Weight::from_parts(524_369, 0).saturating_mul(i.into())) + // Minimum execution time: 1_547_000 picoseconds. + Weight::from_parts(1_605_000, 0) + // Standard Error: 807 + .saturating_add(Weight::from_parts(534_871, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -104,10 +104,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `64 + p * (69 ±0)` // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 3_381_000 picoseconds. - Weight::from_parts(3_523_000, 66) - // Standard Error: 1_488 - .saturating_add(Weight::from_parts(1_108_252, 0).saturating_mul(p.into())) + // Minimum execution time: 3_117_000 picoseconds. + Weight::from_parts(3_239_000, 66) + // Standard Error: 1_390 + .saturating_add(Weight::from_parts(1_127_503, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -121,8 +121,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_652_000 picoseconds. - Weight::from_parts(1_044_833, 0) + // Minimum execution time: 1_580_000 picoseconds. + Weight::from_parts(959_849, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) } @@ -131,17 +131,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_078_000 picoseconds. - Weight::from_parts(6_338_000, 0) + // Minimum execution time: 6_178_000 picoseconds. + Weight::from_parts(6_296_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_433, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_429, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_023_000 picoseconds. - Weight::from_parts(3_268_000, 1485) + // Minimum execution time: 3_133_000 picoseconds. + Weight::from_parts(3_263_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -150,10 +150,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_662_000 picoseconds. - Weight::from_parts(1_751_000, 0) - // Standard Error: 965 - .saturating_add(Weight::from_parts(690_953, 0).saturating_mul(i.into())) + // Minimum execution time: 1_505_000 picoseconds. + Weight::from_parts(1_600_000, 0) + // Standard Error: 1_014 + .saturating_add(Weight::from_parts(700_338, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -161,10 +161,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_656_000 picoseconds. - Weight::from_parts(1_676_000, 0) - // Standard Error: 886 - .saturating_add(Weight::from_parts(524_369, 0).saturating_mul(i.into())) + // Minimum execution time: 1_547_000 picoseconds. + Weight::from_parts(1_605_000, 0) + // Standard Error: 807 + .saturating_add(Weight::from_parts(534_871, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -172,10 +172,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `64 + p * (69 ±0)` // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 3_381_000 picoseconds. - Weight::from_parts(3_523_000, 66) - // Standard Error: 1_488 - .saturating_add(Weight::from_parts(1_108_252, 0).saturating_mul(p.into())) + // Minimum execution time: 3_117_000 picoseconds. + Weight::from_parts(3_239_000, 66) + // Standard Error: 1_390 + .saturating_add(Weight::from_parts(1_127_503, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/runtime/gear/src/weights/pallet_balances.rs b/runtime/gear/src/weights/pallet_balances.rs index 8c7c2852b75..7ac58bc3721 100644 --- a/runtime/gear/src/weights/pallet_balances.rs +++ b/runtime/gear/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_661_000 picoseconds. - Weight::from_parts(32_358_000, 3593) + // Minimum execution time: 29_782_000 picoseconds. + Weight::from_parts(30_295_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -62,8 +62,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 23_643_000 picoseconds. - Weight::from_parts(23_917_000, 3593) + // Minimum execution time: 21_396_000 picoseconds. + Weight::from_parts(21_806_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -71,8 +71,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 13_269_000 picoseconds. - Weight::from_parts(13_533_000, 3593) + // Minimum execution time: 12_457_000 picoseconds. + Weight::from_parts(12_779_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +80,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_877_000 picoseconds. - Weight::from_parts(16_512_000, 3593) + // Minimum execution time: 15_473_000 picoseconds. + Weight::from_parts(15_990_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -89,8 +89,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 33_754_000 picoseconds. - Weight::from_parts(34_473_000, 6196) + // Minimum execution time: 31_071_000 picoseconds. + Weight::from_parts(31_836_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -98,8 +98,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_975_000 picoseconds. - Weight::from_parts(30_556_000, 3593) + // Minimum execution time: 27_464_000 picoseconds. + Weight::from_parts(28_112_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,8 +107,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_611_000 picoseconds. - Weight::from_parts(13_043_000, 3593) + // Minimum execution time: 11_587_000 picoseconds. + Weight::from_parts(12_013_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +120,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_661_000 picoseconds. - Weight::from_parts(32_358_000, 3593) + // Minimum execution time: 29_782_000 picoseconds. + Weight::from_parts(30_295_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -129,8 +129,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 23_643_000 picoseconds. - Weight::from_parts(23_917_000, 3593) + // Minimum execution time: 21_396_000 picoseconds. + Weight::from_parts(21_806_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 13_269_000 picoseconds. - Weight::from_parts(13_533_000, 3593) + // Minimum execution time: 12_457_000 picoseconds. + Weight::from_parts(12_779_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -147,8 +147,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_877_000 picoseconds. - Weight::from_parts(16_512_000, 3593) + // Minimum execution time: 15_473_000 picoseconds. + Weight::from_parts(15_990_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -156,8 +156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 33_754_000 picoseconds. - Weight::from_parts(34_473_000, 6196) + // Minimum execution time: 31_071_000 picoseconds. + Weight::from_parts(31_836_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -165,8 +165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_975_000 picoseconds. - Weight::from_parts(30_556_000, 3593) + // Minimum execution time: 27_464_000 picoseconds. + Weight::from_parts(28_112_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -174,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_611_000 picoseconds. - Weight::from_parts(13_043_000, 3593) + // Minimum execution time: 11_587_000 picoseconds. + Weight::from_parts(12_013_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/runtime/gear/src/weights/pallet_gear.rs b/runtime/gear/src/weights/pallet_gear.rs index 210fc7cd252..f4429240be6 100644 --- a/runtime/gear/src/weights/pallet_gear.rs +++ b/runtime/gear/src/weights/pallet_gear.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -246,10 +246,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 965_000 picoseconds. - Weight::from_parts(1_020_000, 0) - // Standard Error: 753 - .saturating_add(Weight::from_parts(247_354, 0).saturating_mul(c.into())) + // Minimum execution time: 954_000 picoseconds. + Weight::from_parts(1_004_000, 0) + // Standard Error: 802 + .saturating_add(Weight::from_parts(249_956, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -257,10 +257,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_780_000 picoseconds. - Weight::from_parts(2_874_000, 3506) - // Standard Error: 924 - .saturating_add(Weight::from_parts(674_078, 0).saturating_mul(c.into())) + // Minimum execution time: 2_808_000 picoseconds. + Weight::from_parts(2_895_000, 3506) + // Standard Error: 1_086 + .saturating_add(Weight::from_parts(680_150, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -269,17 +269,17 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 51_392_000 picoseconds. - Weight::from_parts(63_325_658, 0) - // Standard Error: 13_432 - .saturating_add(Weight::from_parts(2_671_521, 0).saturating_mul(c.into())) + // Minimum execution time: 52_458_000 picoseconds. + Weight::from_parts(84_558_500, 0) + // Standard Error: 7_412 + .saturating_add(Weight::from_parts(2_377_997, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 85_039_000 picoseconds. - Weight::from_parts(86_523_000, 42236) + // Minimum execution time: 81_302_000 picoseconds. + Weight::from_parts(83_307_000, 42236) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -287,8 +287,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 54_302_000 picoseconds. - Weight::from_parts(56_159_000, 21261) + // Minimum execution time: 52_219_000 picoseconds. + Weight::from_parts(53_704_000, 21261) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -296,8 +296,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 29_099_000 picoseconds. - Weight::from_parts(30_610_000, 17070) + // Minimum execution time: 28_408_000 picoseconds. + Weight::from_parts(29_714_000, 17070) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -306,10 +306,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_259_000 picoseconds. - Weight::from_parts(6_228_584, 7640) - // Standard Error: 37_556 - .saturating_add(Weight::from_parts(16_519_610, 0).saturating_mul(c.into())) + // Minimum execution time: 7_918_000 picoseconds. + Weight::from_parts(6_745_647, 7640) + // Standard Error: 37_300 + .saturating_add(Weight::from_parts(13_885_473, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -318,10 +318,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1297 + c * (16389 ±0)` // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 70_699_000 picoseconds. - Weight::from_parts(71_447_000, 40898) - // Standard Error: 139_719 - .saturating_add(Weight::from_parts(54_319_486, 0).saturating_mul(c.into())) + // Minimum execution time: 68_486_000 picoseconds. + Weight::from_parts(69_079_000, 40898) + // Standard Error: 164_982 + .saturating_add(Weight::from_parts(55_774_264, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -332,10 +332,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 60_906_000 picoseconds. - Weight::from_parts(18_999_485, 4990) - // Standard Error: 57_215 - .saturating_add(Weight::from_parts(53_057_311, 0).saturating_mul(c.into())) + // Minimum execution time: 61_635_000 picoseconds. + Weight::from_parts(64_537_590, 4990) + // Standard Error: 40_298 + .saturating_add(Weight::from_parts(52_820_238, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -344,10 +344,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `671` // Estimated: `38638` - // Minimum execution time: 65_623_000 picoseconds. - Weight::from_parts(88_392_610, 38638) + // Minimum execution time: 63_344_000 picoseconds. + Weight::from_parts(76_968_021, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_635, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_598, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -357,12 +357,12 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 11_247_503_000 picoseconds. - Weight::from_parts(302_469_923, 34312) - // Standard Error: 147_459 - .saturating_add(Weight::from_parts(54_400_528, 0).saturating_mul(c.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(2_571, 0).saturating_mul(s.into())) + // Minimum execution time: 10_980_969_000 picoseconds. + Weight::from_parts(301_891_685, 34312) + // Standard Error: 164_203 + .saturating_add(Weight::from_parts(54_383_779, 0).saturating_mul(c.into())) + // Standard Error: 9 + .saturating_add(Weight::from_parts(2_548, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)) } @@ -371,10 +371,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 56_802_000 picoseconds. - Weight::from_parts(33_250_791, 23853) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) + // Minimum execution time: 53_732_000 picoseconds. + Weight::from_parts(35_204_611, 23853) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_021, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -383,10 +383,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `451` // Estimated: `27177` - // Minimum execution time: 59_487_000 picoseconds. - Weight::from_parts(37_481_444, 27177) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) + // Minimum execution time: 57_078_000 picoseconds. + Weight::from_parts(37_366_780, 27177) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } @@ -395,10 +395,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 86_239_000 picoseconds. - Weight::from_parts(32_106_516, 42227) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(p.into())) + // Minimum execution time: 82_297_000 picoseconds. + Weight::from_parts(62_302_593, 42227) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_042, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -407,10 +407,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1081` // Estimated: `45757` - // Minimum execution time: 98_413_000 picoseconds. - Weight::from_parts(52_381_439, 45757) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(p.into())) + // Minimum execution time: 93_602_000 picoseconds. + Weight::from_parts(69_941_334, 45757) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_057, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } @@ -419,8 +419,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 302_634_000 picoseconds. - Weight::from_parts(320_223_637, 74319) + // Minimum execution time: 298_083_000 picoseconds. + Weight::from_parts(314_192_353, 74319) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -429,10 +429,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 315_859_000 picoseconds. - Weight::from_parts(328_138_594, 74319) - // Standard Error: 1_557 - .saturating_add(Weight::from_parts(8_014, 0).saturating_mul(q.into())) + // Minimum execution time: 312_856_000 picoseconds. + Weight::from_parts(326_607_586, 74319) + // Standard Error: 1_507 + .saturating_add(Weight::from_parts(723, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -441,10 +441,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_804_000 picoseconds. - Weight::from_parts(46_226_000, 3899) - // Standard Error: 51_090 - .saturating_add(Weight::from_parts(51_940_069, 0).saturating_mul(c.into())) + // Minimum execution time: 45_478_000 picoseconds. + Weight::from_parts(45_769_000, 3899) + // Standard Error: 42_221 + .saturating_add(Weight::from_parts(51_492_007, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -454,630 +454,630 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_872_000 picoseconds. - Weight::from_parts(82_358_000, 0) - // Standard Error: 3_946_533 - .saturating_add(Weight::from_parts(617_270_552, 0).saturating_mul(r.into())) + // Minimum execution time: 85_248_000 picoseconds. + Weight::from_parts(87_224_000, 0) + // Standard Error: 4_031_043 + .saturating_add(Weight::from_parts(559_145_890, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 365_182_000 picoseconds. - Weight::from_parts(292_523_651, 0) - // Standard Error: 7_087 - .saturating_add(Weight::from_parts(31_059_002, 0).saturating_mul(p.into())) + // Minimum execution time: 304_310_000 picoseconds. + Weight::from_parts(240_640_662, 0) + // Standard Error: 7_875 + .saturating_add(Weight::from_parts(30_931_778, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 196_771_000 picoseconds. - Weight::from_parts(219_836_156, 0) - // Standard Error: 406_704 - .saturating_add(Weight::from_parts(120_742_843, 0).saturating_mul(r.into())) + // Minimum execution time: 144_728_000 picoseconds. + Weight::from_parts(127_694_995, 0) + // Standard Error: 344_021 + .saturating_add(Weight::from_parts(63_008_235, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_043_000 picoseconds. - Weight::from_parts(92_117_781, 0) - // Standard Error: 7_334 - .saturating_add(Weight::from_parts(3_640_301, 0).saturating_mul(r.into())) + // Minimum execution time: 85_763_000 picoseconds. + Weight::from_parts(93_302_515, 0) + // Standard Error: 3_873 + .saturating_add(Weight::from_parts(2_723_217, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 146_803_000 picoseconds. - Weight::from_parts(168_908_676, 0) - // Standard Error: 28_070 - .saturating_add(Weight::from_parts(3_989_643, 0).saturating_mul(r.into())) + // Minimum execution time: 134_987_000 picoseconds. + Weight::from_parts(141_052_149, 0) + // Standard Error: 29_498 + .saturating_add(Weight::from_parts(3_252_053, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_421_000 picoseconds. - Weight::from_parts(109_902_108, 0) - // Standard Error: 458_197 - .saturating_add(Weight::from_parts(186_560_355, 0).saturating_mul(r.into())) + // Minimum execution time: 82_532_000 picoseconds. + Weight::from_parts(111_956_884, 0) + // Standard Error: 420_651 + .saturating_add(Weight::from_parts(124_761_103, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_173_000 picoseconds. - Weight::from_parts(81_703_608, 0) - // Standard Error: 318_823 - .saturating_add(Weight::from_parts(183_602_076, 0).saturating_mul(r.into())) + // Minimum execution time: 82_442_000 picoseconds. + Weight::from_parts(76_262_730, 0) + // Standard Error: 310_067 + .saturating_add(Weight::from_parts(115_334_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_999_000 picoseconds. - Weight::from_parts(81_002_605, 0) - // Standard Error: 269_075 - .saturating_add(Weight::from_parts(183_154_106, 0).saturating_mul(r.into())) + // Minimum execution time: 82_322_000 picoseconds. + Weight::from_parts(71_153_919, 0) + // Standard Error: 293_317 + .saturating_add(Weight::from_parts(115_508_333, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_306_000 picoseconds. - Weight::from_parts(79_166_166, 0) - // Standard Error: 332_502 - .saturating_add(Weight::from_parts(182_666_522, 0).saturating_mul(r.into())) + // Minimum execution time: 82_586_000 picoseconds. + Weight::from_parts(73_401_225, 0) + // Standard Error: 306_089 + .saturating_add(Weight::from_parts(115_530_298, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_459_000 picoseconds. - Weight::from_parts(80_301_392, 0) - // Standard Error: 340_598 - .saturating_add(Weight::from_parts(184_099_120, 0).saturating_mul(r.into())) + // Minimum execution time: 86_537_000 picoseconds. + Weight::from_parts(80_327_682, 0) + // Standard Error: 275_679 + .saturating_add(Weight::from_parts(114_024_859, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_140_000 picoseconds. - Weight::from_parts(72_987_262, 0) - // Standard Error: 388_909 - .saturating_add(Weight::from_parts(186_920_851, 0).saturating_mul(r.into())) + // Minimum execution time: 84_226_000 picoseconds. + Weight::from_parts(74_308_323, 0) + // Standard Error: 291_460 + .saturating_add(Weight::from_parts(115_396_428, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_336_000 picoseconds. - Weight::from_parts(79_078_269, 0) - // Standard Error: 276_322 - .saturating_add(Weight::from_parts(182_690_178, 0).saturating_mul(r.into())) + // Minimum execution time: 81_250_000 picoseconds. + Weight::from_parts(74_761_588, 0) + // Standard Error: 317_797 + .saturating_add(Weight::from_parts(115_173_001, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_201_000 picoseconds. - Weight::from_parts(79_459_558, 0) - // Standard Error: 357_406 - .saturating_add(Weight::from_parts(182_989_857, 0).saturating_mul(r.into())) + // Minimum execution time: 85_673_000 picoseconds. + Weight::from_parts(70_907_772, 0) + // Standard Error: 347_682 + .saturating_add(Weight::from_parts(118_189_625, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 709_298_000 picoseconds. - Weight::from_parts(792_701_124, 0) - // Standard Error: 581_476 - .saturating_add(Weight::from_parts(264_833_637, 0).saturating_mul(r.into())) + // Minimum execution time: 700_530_000 picoseconds. + Weight::from_parts(774_384_678, 0) + // Standard Error: 512_748 + .saturating_add(Weight::from_parts(194_331_468, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 958_553_000 picoseconds. - Weight::from_parts(1_002_082_000, 0) - // Standard Error: 51_056 - .saturating_add(Weight::from_parts(13_349_580, 0).saturating_mul(n.into())) + // Minimum execution time: 866_889_000 picoseconds. + Weight::from_parts(872_993_000, 0) + // Standard Error: 59_048 + .saturating_add(Weight::from_parts(13_399_620, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_092_000 picoseconds. - Weight::from_parts(70_460_333, 0) - // Standard Error: 322_779 - .saturating_add(Weight::from_parts(182_652_206, 0).saturating_mul(r.into())) + // Minimum execution time: 85_291_000 picoseconds. + Weight::from_parts(75_543_485, 0) + // Standard Error: 320_701 + .saturating_add(Weight::from_parts(115_757_456, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_315_000 picoseconds. - Weight::from_parts(77_285_940, 0) - // Standard Error: 310_862 - .saturating_add(Weight::from_parts(183_154_588, 0).saturating_mul(r.into())) + // Minimum execution time: 83_780_000 picoseconds. + Weight::from_parts(68_090_338, 0) + // Standard Error: 330_050 + .saturating_add(Weight::from_parts(117_803_137, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_813_000 picoseconds. - Weight::from_parts(83_631_977, 0) - // Standard Error: 426_894 - .saturating_add(Weight::from_parts(250_044_040, 0).saturating_mul(n.into())) + // Minimum execution time: 84_394_000 picoseconds. + Weight::from_parts(88_472_912, 0) + // Standard Error: 340_524 + .saturating_add(Weight::from_parts(190_044_477, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_342_000 picoseconds. - Weight::from_parts(88_861_000, 0) - // Standard Error: 4_034_065 - .saturating_add(Weight::from_parts(1_070_363_129, 0).saturating_mul(r.into())) + // Minimum execution time: 83_081_000 picoseconds. + Weight::from_parts(85_006_000, 0) + // Standard Error: 3_456_961 + .saturating_add(Weight::from_parts(860_188_117, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_887_000 picoseconds. - Weight::from_parts(154_402_402, 0) - // Standard Error: 504_137 - .saturating_add(Weight::from_parts(389_538_545, 0).saturating_mul(r.into())) + // Minimum execution time: 81_490_000 picoseconds. + Weight::from_parts(136_619_765, 0) + // Standard Error: 439_674 + .saturating_add(Weight::from_parts(308_552_304, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 467_573_000 picoseconds. - Weight::from_parts(471_685_000, 0) - // Standard Error: 64_140 - .saturating_add(Weight::from_parts(22_109_126, 0).saturating_mul(n.into())) + // Minimum execution time: 386_929_000 picoseconds. + Weight::from_parts(393_325_000, 0) + // Standard Error: 61_932 + .saturating_add(Weight::from_parts(21_101_790, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_853_000 picoseconds. - Weight::from_parts(152_053_498, 0) - // Standard Error: 538_330 - .saturating_add(Weight::from_parts(397_711_575, 0).saturating_mul(r.into())) + // Minimum execution time: 84_625_000 picoseconds. + Weight::from_parts(162_584_483, 0) + // Standard Error: 494_553 + .saturating_add(Weight::from_parts(313_684_139, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 471_875_000 picoseconds. - Weight::from_parts(475_692_000, 0) - // Standard Error: 57_997 - .saturating_add(Weight::from_parts(21_385_701, 0).saturating_mul(n.into())) + // Minimum execution time: 390_932_000 picoseconds. + Weight::from_parts(393_883_000, 0) + // Standard Error: 68_646 + .saturating_add(Weight::from_parts(21_188_381, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 716_684_000 picoseconds. - Weight::from_parts(781_328_373, 0) - // Standard Error: 479_933 - .saturating_add(Weight::from_parts(411_727_995, 0).saturating_mul(r.into())) + // Minimum execution time: 708_623_000 picoseconds. + Weight::from_parts(781_094_266, 0) + // Standard Error: 460_683 + .saturating_add(Weight::from_parts(328_993_362, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 746_421_000 picoseconds. - Weight::from_parts(889_163_923, 0) - // Standard Error: 621_967 - .saturating_add(Weight::from_parts(412_763_026, 0).saturating_mul(r.into())) + // Minimum execution time: 710_228_000 picoseconds. + Weight::from_parts(774_190_634, 0) + // Standard Error: 483_646 + .saturating_add(Weight::from_parts(330_057_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_961_000 picoseconds. - Weight::from_parts(86_031_226, 0) - // Standard Error: 355_690 - .saturating_add(Weight::from_parts(191_347_968, 0).saturating_mul(r.into())) + // Minimum execution time: 83_510_000 picoseconds. + Weight::from_parts(64_097_635, 0) + // Standard Error: 358_570 + .saturating_add(Weight::from_parts(126_095_109, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_797_807_000 picoseconds. - Weight::from_parts(3_948_397_472, 0) - // Standard Error: 396_090 - .saturating_add(Weight::from_parts(284_341_649, 0).saturating_mul(r.into())) + // Minimum execution time: 2_430_098_000 picoseconds. + Weight::from_parts(2_605_278_898, 0) + // Standard Error: 439_185 + .saturating_add(Weight::from_parts(217_479_981, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 485_799_000 picoseconds. - Weight::from_parts(486_862_000, 0) - // Standard Error: 47_704 - .saturating_add(Weight::from_parts(31_360_292, 0).saturating_mul(n.into())) + // Minimum execution time: 358_553_000 picoseconds. + Weight::from_parts(364_183_000, 0) + // Standard Error: 51_397 + .saturating_add(Weight::from_parts(30_914_040, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_842_120_000 picoseconds. - Weight::from_parts(3_943_431_716, 0) - // Standard Error: 766_406 - .saturating_add(Weight::from_parts(339_379_953, 0).saturating_mul(r.into())) + // Minimum execution time: 2_464_581_000 picoseconds. + Weight::from_parts(2_580_044_243, 0) + // Standard Error: 461_216 + .saturating_add(Weight::from_parts(272_575_116, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_828_327_000 picoseconds. - Weight::from_parts(3_976_283_101, 0) - // Standard Error: 768_169 - .saturating_add(Weight::from_parts(353_252_083, 0).saturating_mul(r.into())) + // Minimum execution time: 2_438_114_000 picoseconds. + Weight::from_parts(2_597_881_615, 0) + // Standard Error: 400_982 + .saturating_add(Weight::from_parts(275_718_502, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 256_679_000 picoseconds. - Weight::from_parts(330_245_572, 0) - // Standard Error: 519_345 - .saturating_add(Weight::from_parts(404_879_225, 0).saturating_mul(r.into())) + // Minimum execution time: 244_206_000 picoseconds. + Weight::from_parts(321_175_021, 0) + // Standard Error: 460_445 + .saturating_add(Weight::from_parts(322_059_081, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 640_004_000 picoseconds. - Weight::from_parts(646_769_000, 0) - // Standard Error: 55_122 - .saturating_add(Weight::from_parts(21_616_125, 0).saturating_mul(n.into())) + // Minimum execution time: 559_346_000 picoseconds. + Weight::from_parts(571_004_000, 0) + // Standard Error: 59_840 + .saturating_add(Weight::from_parts(21_370_093, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_981_155_000 picoseconds. - Weight::from_parts(4_086_072_221, 0) - // Standard Error: 1_076_069 - .saturating_add(Weight::from_parts(362_989_310, 0).saturating_mul(r.into())) + // Minimum execution time: 2_620_633_000 picoseconds. + Weight::from_parts(2_741_869_292, 0) + // Standard Error: 620_120 + .saturating_add(Weight::from_parts(289_781_719, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_145_000 picoseconds. - Weight::from_parts(88_260_563, 0) - // Standard Error: 277_576 - .saturating_add(Weight::from_parts(20_209_036, 0).saturating_mul(r.into())) + // Minimum execution time: 83_438_000 picoseconds. + Weight::from_parts(86_817_816, 0) + // Standard Error: 234_731 + .saturating_add(Weight::from_parts(19_849_283, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_930_000 picoseconds. - Weight::from_parts(90_280_376, 0) - // Standard Error: 1_072 - .saturating_add(Weight::from_parts(427_777, 0).saturating_mul(n.into())) + // Minimum execution time: 105_002_000 picoseconds. + Weight::from_parts(88_114_999, 0) + // Standard Error: 1_128 + .saturating_add(Weight::from_parts(427_426, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_156_000 picoseconds. - Weight::from_parts(89_778_763, 0) - // Standard Error: 365_767 - .saturating_add(Weight::from_parts(24_157_936, 0).saturating_mul(r.into())) + // Minimum execution time: 82_436_000 picoseconds. + Weight::from_parts(88_440_285, 0) + // Standard Error: 277_544 + .saturating_add(Weight::from_parts(17_399_914, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_315_000 picoseconds. - Weight::from_parts(94_894_394, 0) - // Standard Error: 993 - .saturating_add(Weight::from_parts(426_364, 0).saturating_mul(n.into())) + // Minimum execution time: 103_800_000 picoseconds. + Weight::from_parts(89_756_983, 0) + // Standard Error: 907 + .saturating_add(Weight::from_parts(428_998, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_595_000 picoseconds. - Weight::from_parts(86_259_504, 0) - // Standard Error: 284_882 - .saturating_add(Weight::from_parts(25_873_595, 0).saturating_mul(r.into())) + // Minimum execution time: 81_754_000 picoseconds. + Weight::from_parts(87_296_014, 0) + // Standard Error: 336_747 + .saturating_add(Weight::from_parts(20_299_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_771_000 picoseconds. - Weight::from_parts(85_313_802, 0) - // Standard Error: 265_474 - .saturating_add(Weight::from_parts(25_863_597, 0).saturating_mul(r.into())) + // Minimum execution time: 81_952_000 picoseconds. + Weight::from_parts(86_840_575, 0) + // Standard Error: 272_708 + .saturating_add(Weight::from_parts(19_217_524, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_396_000 picoseconds. - Weight::from_parts(126_819_617, 0) - // Standard Error: 518_749 - .saturating_add(Weight::from_parts(272_821_836, 0).saturating_mul(r.into())) + // Minimum execution time: 85_498_000 picoseconds. + Weight::from_parts(126_431_779, 0) + // Standard Error: 460_480 + .saturating_add(Weight::from_parts(198_940_536, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_266_000 picoseconds. - Weight::from_parts(100_843_000, 0) - // Standard Error: 2_828 - .saturating_add(Weight::from_parts(662_117, 0).saturating_mul(n.into())) + // Minimum execution time: 96_862_000 picoseconds. + Weight::from_parts(98_611_000, 0) + // Standard Error: 2_677 + .saturating_add(Weight::from_parts(662_266, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_150_000 picoseconds. - Weight::from_parts(754_398_128, 0) - // Standard Error: 5_119_788 - .saturating_add(Weight::from_parts(7_037_071, 0).saturating_mul(r.into())) + // Minimum execution time: 698_914_000 picoseconds. + Weight::from_parts(718_405_100, 0) + // Standard Error: 1_891_960 + .saturating_add(Weight::from_parts(24_867_800, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 712_091_000 picoseconds. - Weight::from_parts(751_999_544, 0) - // Standard Error: 4_003_265 - .saturating_add(Weight::from_parts(43_818_555, 0).saturating_mul(r.into())) + // Minimum execution time: 699_975_000 picoseconds. + Weight::from_parts(718_806_789, 0) + // Standard Error: 1_919_531 + .saturating_add(Weight::from_parts(51_192_710, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_234_000 picoseconds. - Weight::from_parts(96_192_773, 0) - // Standard Error: 271_871 - .saturating_add(Weight::from_parts(13_338_726, 0).saturating_mul(r.into())) + // Minimum execution time: 95_002_000 picoseconds. + Weight::from_parts(99_331_989, 0) + // Standard Error: 287_602 + .saturating_add(Weight::from_parts(9_719_710, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 108_190_000 picoseconds. - Weight::from_parts(92_525_926, 0) - // Standard Error: 1_134 - .saturating_add(Weight::from_parts(433_806, 0).saturating_mul(n.into())) + // Minimum execution time: 102_501_000 picoseconds. + Weight::from_parts(87_026_327, 0) + // Standard Error: 1_214 + .saturating_add(Weight::from_parts(429_134, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_297_000 picoseconds. - Weight::from_parts(98_054_616, 0) - // Standard Error: 394_791 - .saturating_add(Weight::from_parts(7_680_683, 0).saturating_mul(r.into())) + // Minimum execution time: 93_228_000 picoseconds. + Weight::from_parts(97_923_691, 0) + // Standard Error: 288_469 + .saturating_add(Weight::from_parts(9_669_908, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 106_932_000 picoseconds. - Weight::from_parts(91_150_785, 0) - // Standard Error: 1_067 - .saturating_add(Weight::from_parts(424_570, 0).saturating_mul(n.into())) + // Minimum execution time: 100_908_000 picoseconds. + Weight::from_parts(87_613_705, 0) + // Standard Error: 1_237 + .saturating_add(Weight::from_parts(431_412, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_591_000 picoseconds. - Weight::from_parts(79_590_461, 0) - // Standard Error: 360_038 - .saturating_add(Weight::from_parts(185_313_242, 0).saturating_mul(r.into())) + // Minimum execution time: 84_385_000 picoseconds. + Weight::from_parts(74_453_057, 0) + // Standard Error: 309_931 + .saturating_add(Weight::from_parts(117_172_527, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_379_000 picoseconds. - Weight::from_parts(82_304_672, 0) - // Standard Error: 371_508 - .saturating_add(Weight::from_parts(184_895_719, 0).saturating_mul(r.into())) + // Minimum execution time: 82_437_000 picoseconds. + Weight::from_parts(78_951_443, 0) + // Standard Error: 294_227 + .saturating_add(Weight::from_parts(116_066_384, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_906_000 picoseconds. - Weight::from_parts(784_837_322, 0) - // Standard Error: 485_874 - .saturating_add(Weight::from_parts(198_529_306, 0).saturating_mul(r.into())) + // Minimum execution time: 704_954_000 picoseconds. + Weight::from_parts(752_735_182, 0) + // Standard Error: 455_998 + .saturating_add(Weight::from_parts(135_154_607, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 735_164_000 picoseconds. - Weight::from_parts(760_829_418, 0) - // Standard Error: 2_049 - .saturating_add(Weight::from_parts(164_862, 0).saturating_mul(n.into())) + // Minimum execution time: 724_451_000 picoseconds. + Weight::from_parts(738_722_668, 0) + // Standard Error: 1_014 + .saturating_add(Weight::from_parts(154_329, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_467_125_000 picoseconds. - Weight::from_parts(4_668_343_697, 0) - // Standard Error: 529_569 - .saturating_add(Weight::from_parts(214_709_155, 0).saturating_mul(r.into())) + // Minimum execution time: 3_092_586_000 picoseconds. + Weight::from_parts(3_231_311_035, 0) + // Standard Error: 506_742 + .saturating_add(Weight::from_parts(159_545_582, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_716_693_000 picoseconds. - Weight::from_parts(4_810_590_943, 0) - // Standard Error: 12_440 - .saturating_add(Weight::from_parts(13_814_475, 0).saturating_mul(n.into())) + // Minimum execution time: 3_299_872_000 picoseconds. + Weight::from_parts(3_317_022_894, 0) + // Standard Error: 8_542 + .saturating_add(Weight::from_parts(13_645_472, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_721_000 picoseconds. - Weight::from_parts(95_360_878, 0) - // Standard Error: 488_163 - .saturating_add(Weight::from_parts(198_923_476, 0).saturating_mul(r.into())) + // Minimum execution time: 85_966_000 picoseconds. + Weight::from_parts(106_319_310, 0) + // Standard Error: 424_534 + .saturating_add(Weight::from_parts(139_885_203, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 189_069_000 picoseconds. - Weight::from_parts(191_834_000, 0) - // Standard Error: 53_942 - .saturating_add(Weight::from_parts(26_059_121, 0).saturating_mul(n.into())) + // Minimum execution time: 142_910_000 picoseconds. + Weight::from_parts(144_843_000, 0) + // Standard Error: 54_401 + .saturating_add(Weight::from_parts(25_535_472, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_023_000 picoseconds. - Weight::from_parts(70_919_161, 0) - // Standard Error: 442_134 - .saturating_add(Weight::from_parts(186_467_769, 0).saturating_mul(r.into())) + // Minimum execution time: 82_117_000 picoseconds. + Weight::from_parts(80_202_149, 0) + // Standard Error: 296_880 + .saturating_add(Weight::from_parts(114_586_990, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_187_000 picoseconds. - Weight::from_parts(86_256_124, 0) - // Standard Error: 333_120 - .saturating_add(Weight::from_parts(27_182_075, 0).saturating_mul(r.into())) + // Minimum execution time: 81_802_000 picoseconds. + Weight::from_parts(85_064_295, 0) + // Standard Error: 248_874 + .saturating_add(Weight::from_parts(27_314_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_373_000 picoseconds. - Weight::from_parts(83_957_387, 0) - // Standard Error: 258_914 - .saturating_add(Weight::from_parts(14_637_112, 0).saturating_mul(r.into())) + // Minimum execution time: 82_854_000 picoseconds. + Weight::from_parts(86_180_314, 0) + // Standard Error: 239_162 + .saturating_add(Weight::from_parts(16_391_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_886_000 picoseconds. - Weight::from_parts(86_536_767, 0) - // Standard Error: 237_087 - .saturating_add(Weight::from_parts(15_456_732, 0).saturating_mul(r.into())) + // Minimum execution time: 80_883_000 picoseconds. + Weight::from_parts(87_058_214, 0) + // Standard Error: 256_392 + .saturating_add(Weight::from_parts(13_333_285, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_962_000 picoseconds. - Weight::from_parts(87_038_165, 0) - // Standard Error: 267_652 - .saturating_add(Weight::from_parts(14_141_234, 0).saturating_mul(r.into())) + // Minimum execution time: 81_417_000 picoseconds. + Weight::from_parts(85_403_451, 0) + // Standard Error: 249_767 + .saturating_add(Weight::from_parts(14_474_948, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_976_000 picoseconds. - Weight::from_parts(87_105_967, 0) - // Standard Error: 237_581 - .saturating_add(Weight::from_parts(13_365_932, 0).saturating_mul(r.into())) + // Minimum execution time: 84_020_000 picoseconds. + Weight::from_parts(88_080_622, 0) + // Standard Error: 253_221 + .saturating_add(Weight::from_parts(11_403_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_585_000 picoseconds. - Weight::from_parts(203_512_831, 0) - // Standard Error: 393_346 - .saturating_add(Weight::from_parts(283_538_921, 0).saturating_mul(r.into())) + // Minimum execution time: 138_317_000 picoseconds. + Weight::from_parts(187_894_162, 0) + // Standard Error: 376_519 + .saturating_add(Weight::from_parts(209_723_429, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_330_000 picoseconds. - Weight::from_parts(158_669_516, 0) - // Standard Error: 440_421 - .saturating_add(Weight::from_parts(473_163_025, 0).saturating_mul(r.into())) + // Minimum execution time: 93_047_000 picoseconds. + Weight::from_parts(151_715_771, 0) + // Standard Error: 425_606 + .saturating_add(Weight::from_parts(396_733_544, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1085,22 +1085,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_492_772_000 picoseconds. - Weight::from_parts(43_692_998_000, 0) - // Standard Error: 263_249 - .saturating_add(Weight::from_parts(8_169_821, 0).saturating_mul(p.into())) - // Standard Error: 263_236 - .saturating_add(Weight::from_parts(180_732_778, 0).saturating_mul(s.into())) + // Minimum execution time: 45_923_081_000 picoseconds. + Weight::from_parts(45_981_736_000, 0) + // Standard Error: 274_662 + .saturating_add(Weight::from_parts(6_858_186, 0).saturating_mul(p.into())) + // Standard Error: 274_649 + .saturating_add(Weight::from_parts(177_291_831, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_189_000 picoseconds. - Weight::from_parts(158_677_248, 0) - // Standard Error: 452_648 - .saturating_add(Weight::from_parts(478_043_506, 0).saturating_mul(r.into())) + // Minimum execution time: 95_680_000 picoseconds. + Weight::from_parts(157_350_147, 0) + // Standard Error: 440_994 + .saturating_add(Weight::from_parts(402_511_567, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1108,32 +1108,32 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_613_488_000 picoseconds. - Weight::from_parts(43_758_304_000, 0) - // Standard Error: 268_412 - .saturating_add(Weight::from_parts(7_987_894, 0).saturating_mul(p.into())) - // Standard Error: 268_399 - .saturating_add(Weight::from_parts(180_769_004, 0).saturating_mul(s.into())) + // Minimum execution time: 42_842_395_000 picoseconds. + Weight::from_parts(42_890_931_000, 0) + // Standard Error: 264_187 + .saturating_add(Weight::from_parts(7_896_879, 0).saturating_mul(p.into())) + // Standard Error: 264_174 + .saturating_add(Weight::from_parts(178_082_248, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_210_000 picoseconds. - Weight::from_parts(99_996_695, 0) - // Standard Error: 31_808 - .saturating_add(Weight::from_parts(3_523_987, 0).saturating_mul(r.into())) + // Minimum execution time: 82_272_000 picoseconds. + Weight::from_parts(100_008_395, 0) + // Standard Error: 36_430 + .saturating_add(Weight::from_parts(2_544_223, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 82_940_000 picoseconds. - Weight::from_parts(123_540_441, 1131) - // Standard Error: 7_143 - .saturating_add(Weight::from_parts(11_789_871, 0).saturating_mul(p.into())) + // Minimum execution time: 83_139_000 picoseconds. + Weight::from_parts(122_967_835, 1131) + // Standard Error: 6_454 + .saturating_add(Weight::from_parts(11_784_103, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1142,10 +1142,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_752_000 picoseconds. - Weight::from_parts(84_858_000, 1131) - // Standard Error: 48_161 - .saturating_add(Weight::from_parts(36_181_117, 0).saturating_mul(p.into())) + // Minimum execution time: 83_229_000 picoseconds. + Weight::from_parts(83_885_000, 1131) + // Standard Error: 37_558 + .saturating_add(Weight::from_parts(35_503_677, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1154,10 +1154,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_125_138_000 picoseconds. - Weight::from_parts(5_869_525_563, 5069931) - // Standard Error: 46_521 - .saturating_add(Weight::from_parts(36_899_111, 0).saturating_mul(p.into())) + // Minimum execution time: 6_139_187_000 picoseconds. + Weight::from_parts(5_806_599_304, 5069931) + // Standard Error: 75_881 + .saturating_add(Weight::from_parts(36_513_688, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1165,10 +1165,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_516_000 picoseconds. - Weight::from_parts(83_470_000, 1939) - // Standard Error: 29_769 - .saturating_add(Weight::from_parts(46_665_657, 0).saturating_mul(p.into())) + // Minimum execution time: 82_177_000 picoseconds. + Weight::from_parts(83_595_000, 1939) + // Standard Error: 45_778 + .saturating_add(Weight::from_parts(47_155_630, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1177,10 +1177,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_344_000 picoseconds. - Weight::from_parts(94_873_151, 1131) - // Standard Error: 55_429 - .saturating_add(Weight::from_parts(35_724_871, 0).saturating_mul(p.into())) + // Minimum execution time: 90_231_000 picoseconds. + Weight::from_parts(95_944_378, 1131) + // Standard Error: 61_821 + .saturating_add(Weight::from_parts(35_941_066, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1189,10 +1189,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 735_393_000 picoseconds. - Weight::from_parts(754_062_397, 1496) - // Standard Error: 166_437 - .saturating_add(Weight::from_parts(43_966_900, 0).saturating_mul(p.into())) + // Minimum execution time: 734_006_000 picoseconds. + Weight::from_parts(717_384_508, 1496) + // Standard Error: 375_292 + .saturating_add(Weight::from_parts(47_930_581, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1201,10 +1201,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_124_371_000 picoseconds. - Weight::from_parts(1_147_901_415, 317931) - // Standard Error: 145_342 - .saturating_add(Weight::from_parts(43_795_511, 0).saturating_mul(p.into())) + // Minimum execution time: 1_121_849_000 picoseconds. + Weight::from_parts(1_147_558_033, 317931) + // Standard Error: 373_146 + .saturating_add(Weight::from_parts(45_393_418, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1212,885 +1212,885 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_510_000 picoseconds. - Weight::from_parts(1_448_006, 0) - // Standard Error: 9_868 - .saturating_add(Weight::from_parts(24_061_691, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_220_392, 0) + // Standard Error: 8_848 + .saturating_add(Weight::from_parts(24_205_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_991_000 picoseconds. - Weight::from_parts(4_151_991_287, 0) - // Standard Error: 60_683 - .saturating_add(Weight::from_parts(4_818_799, 0).saturating_mul(r.into())) + // Minimum execution time: 4_352_664_000 picoseconds. + Weight::from_parts(4_153_366_897, 0) + // Standard Error: 60_193 + .saturating_add(Weight::from_parts(4_722_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_341_162_000 picoseconds. - Weight::from_parts(4_200_807_294, 0) - // Standard Error: 51_442 - .saturating_add(Weight::from_parts(4_527_839, 0).saturating_mul(r.into())) + // Minimum execution time: 4_357_649_000 picoseconds. + Weight::from_parts(4_256_499_798, 0) + // Standard Error: 57_942 + .saturating_add(Weight::from_parts(4_200_870, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_322_767_000 picoseconds. - Weight::from_parts(11_038_976_057, 0) - // Standard Error: 150_113 - .saturating_add(Weight::from_parts(10_655_640, 0).saturating_mul(r.into())) + // Minimum execution time: 10_269_998_000 picoseconds. + Weight::from_parts(11_525_100_351, 0) + // Standard Error: 204_230 + .saturating_add(Weight::from_parts(8_423_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_367_826_000 picoseconds. - Weight::from_parts(11_310_983_745, 0) - // Standard Error: 145_202 - .saturating_add(Weight::from_parts(7_541_832, 0).saturating_mul(r.into())) + // Minimum execution time: 10_204_810_000 picoseconds. + Weight::from_parts(10_982_673_143, 0) + // Standard Error: 145_327 + .saturating_add(Weight::from_parts(9_198_033, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_251_000 picoseconds. - Weight::from_parts(2_304_000, 0) - // Standard Error: 8_520 - .saturating_add(Weight::from_parts(3_798_413, 0).saturating_mul(r.into())) + // Minimum execution time: 2_074_000 picoseconds. + Weight::from_parts(2_108_000, 0) + // Standard Error: 9_031 + .saturating_add(Weight::from_parts(3_829_182, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(573_722, 0) - // Standard Error: 11_642 - .saturating_add(Weight::from_parts(3_174_691, 0).saturating_mul(r.into())) + // Minimum execution time: 2_020_000 picoseconds. + Weight::from_parts(2_118_000, 0) + // Standard Error: 5_295 + .saturating_add(Weight::from_parts(2_980_329, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(3_155_512, 0) - // Standard Error: 1_212 - .saturating_add(Weight::from_parts(1_586_585, 0).saturating_mul(r.into())) + // Minimum execution time: 2_032_000 picoseconds. + Weight::from_parts(3_411_359, 0) + // Standard Error: 1_146 + .saturating_add(Weight::from_parts(1_563_906, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_160_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 8_627 - .saturating_add(Weight::from_parts(2_929_529, 0).saturating_mul(r.into())) + // Minimum execution time: 2_096_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 8_349 + .saturating_add(Weight::from_parts(2_904_673, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(1_609_241, 0) - // Standard Error: 19_812 - .saturating_add(Weight::from_parts(5_162_833, 0).saturating_mul(r.into())) + // Minimum execution time: 2_128_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 8_100 + .saturating_add(Weight::from_parts(5_229_400, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_892_000 picoseconds. - Weight::from_parts(5_316_811, 0) - // Standard Error: 1_578 - .saturating_add(Weight::from_parts(163_377, 0).saturating_mul(e.into())) + // Minimum execution time: 6_838_000 picoseconds. + Weight::from_parts(5_309_346, 0) + // Standard Error: 2_580 + .saturating_add(Weight::from_parts(129_982, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_304_000 picoseconds. - Weight::from_parts(4_554_683, 0) - // Standard Error: 7_319 - .saturating_add(Weight::from_parts(2_595_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(3_593_285, 0) + // Standard Error: 6_648 + .saturating_add(Weight::from_parts(2_597_926, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_595_958 - - 2_422_191, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_597_926 - + 2_429_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_273_000 picoseconds. - Weight::from_parts(5_046_075, 0) - // Standard Error: 13_702 - .saturating_add(Weight::from_parts(2_422_191, 0).saturating_mul(r.into())) + // Minimum execution time: 2_086_000 picoseconds. + Weight::from_parts(3_972_773, 0) + // Standard Error: 12_538 + .saturating_add(Weight::from_parts(2_429_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_684_000 picoseconds. - Weight::from_parts(17_324_871, 0) - // Standard Error: 38_532 - .saturating_add(Weight::from_parts(10_260_872, 0).saturating_mul(r.into())) + // Minimum execution time: 2_591_000 picoseconds. + Weight::from_parts(12_798_134, 0) + // Standard Error: 23_023 + .saturating_add(Weight::from_parts(9_786_464, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_206_000 picoseconds. - Weight::from_parts(2_634_425, 0) - // Standard Error: 5_954 - .saturating_add(Weight::from_parts(1_275_538, 0).saturating_mul(p.into())) + // Minimum execution time: 12_274_000 picoseconds. + Weight::from_parts(1_706_188, 0) + // Standard Error: 6_199 + .saturating_add(Weight::from_parts(1_212_443, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_288_000 picoseconds. - Weight::from_parts(5_570_870, 0) + // Minimum execution time: 5_221_000 picoseconds. + Weight::from_parts(5_538_574, 0) // Standard Error: 12 - .saturating_add(Weight::from_parts(61, 0).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(12, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_203_000 picoseconds. - Weight::from_parts(1_788_159, 0) - // Standard Error: 3_152 - .saturating_add(Weight::from_parts(267_842, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(1_785_103, 0) + // Standard Error: 2_948 + .saturating_add(Weight::from_parts(249_981, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_164_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 4_611 - .saturating_add(Weight::from_parts(721_127, 0).saturating_mul(r.into())) + // Minimum execution time: 2_123_000 picoseconds. + Weight::from_parts(2_187_000, 0) + // Standard Error: 5_664 + .saturating_add(Weight::from_parts(719_187, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_347_000, 0) - // Standard Error: 5_971 - .saturating_add(Weight::from_parts(742_209, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_214_000, 0) + // Standard Error: 5_625 + .saturating_add(Weight::from_parts(709_067, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_406_000 picoseconds. - Weight::from_parts(2_894_577, 0) - // Standard Error: 8_027 - .saturating_add(Weight::from_parts(801_493, 0).saturating_mul(r.into())) + // Minimum execution time: 6_168_000 picoseconds. + Weight::from_parts(2_290_203, 0) + // Standard Error: 8_984 + .saturating_add(Weight::from_parts(761_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_345_000 picoseconds. - Weight::from_parts(31_295, 0) - // Standard Error: 10_231 - .saturating_add(Weight::from_parts(1_543_569, 0).saturating_mul(r.into())) + // Minimum execution time: 6_249_000 picoseconds. + Weight::from_parts(6_302_000, 0) + // Standard Error: 8_682 + .saturating_add(Weight::from_parts(1_329_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_937_000 picoseconds. - Weight::from_parts(62_049, 0) - // Standard Error: 12_087 - .saturating_add(Weight::from_parts(7_172_920, 0).saturating_mul(r.into())) + // Minimum execution time: 3_791_000 picoseconds. + Weight::from_parts(3_929_000, 0) + // Standard Error: 9_270 + .saturating_add(Weight::from_parts(6_742_685, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_262_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 6_042 - .saturating_add(Weight::from_parts(3_394_526, 0).saturating_mul(r.into())) + // Minimum execution time: 2_113_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 6_734 + .saturating_add(Weight::from_parts(3_327_207, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 5_891 - .saturating_add(Weight::from_parts(3_138_523, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_141_000, 0) + // Standard Error: 6_506 + .saturating_add(Weight::from_parts(3_061_891, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_277_000, 0) - // Standard Error: 8_196 - .saturating_add(Weight::from_parts(3_167_033, 0).saturating_mul(r.into())) + // Minimum execution time: 2_108_000 picoseconds. + Weight::from_parts(2_141_000, 0) + // Standard Error: 6_738 + .saturating_add(Weight::from_parts(3_101_844, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 5_536 - .saturating_add(Weight::from_parts(2_668_164, 0).saturating_mul(r.into())) + // Minimum execution time: 2_138_000 picoseconds. + Weight::from_parts(2_155_000, 0) + // Standard Error: 4_379 + .saturating_add(Weight::from_parts(2_613_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(45_432, 0) - // Standard Error: 6_223 - .saturating_add(Weight::from_parts(645_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_046_000 picoseconds. + Weight::from_parts(2_127_000, 0) + // Standard Error: 3_513 + .saturating_add(Weight::from_parts(525_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(1_301_007, 0) - // Standard Error: 4_929 - .saturating_add(Weight::from_parts(446_280, 0).saturating_mul(r.into())) + // Minimum execution time: 2_127_000 picoseconds. + Weight::from_parts(1_669_179, 0) + // Standard Error: 2_817 + .saturating_add(Weight::from_parts(367_599, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_205_000, 0) - // Standard Error: 10_412 - .saturating_add(Weight::from_parts(1_894_722, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 11_816 + .saturating_add(Weight::from_parts(1_810_781, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_257_000, 0) - // Standard Error: 7_708 - .saturating_add(Weight::from_parts(1_162_246, 0).saturating_mul(r.into())) + // Minimum execution time: 2_087_000 picoseconds. + Weight::from_parts(2_194_000, 0) + // Standard Error: 7_361 + .saturating_add(Weight::from_parts(1_130_773, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(1_682_106, 0) - // Standard Error: 3_839 - .saturating_add(Weight::from_parts(384_381, 0).saturating_mul(r.into())) + // Minimum execution time: 2_061_000 picoseconds. + Weight::from_parts(1_850_477, 0) + // Standard Error: 2_695 + .saturating_add(Weight::from_parts(318_827, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(1_669_708, 0) - // Standard Error: 3_126 - .saturating_add(Weight::from_parts(384_474, 0).saturating_mul(r.into())) + // Minimum execution time: 2_115_000 picoseconds. + Weight::from_parts(1_764_589, 0) + // Standard Error: 2_923 + .saturating_add(Weight::from_parts(329_840, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_291_000, 0) - // Standard Error: 4_476 - .saturating_add(Weight::from_parts(497_277, 0).saturating_mul(r.into())) + // Minimum execution time: 2_109_000 picoseconds. + Weight::from_parts(859_995, 0) + // Standard Error: 4_546 + .saturating_add(Weight::from_parts(467_944, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_217_000 picoseconds. - Weight::from_parts(2_287_000, 0) - // Standard Error: 4_107 - .saturating_add(Weight::from_parts(524_095, 0).saturating_mul(r.into())) + // Minimum execution time: 2_010_000 picoseconds. + Weight::from_parts(2_081_000, 0) + // Standard Error: 3_959 + .saturating_add(Weight::from_parts(472_947, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_233_000, 0) - // Standard Error: 3_690 - .saturating_add(Weight::from_parts(501_277, 0).saturating_mul(r.into())) + // Minimum execution time: 2_105_000 picoseconds. + Weight::from_parts(1_247_124, 0) + // Standard Error: 4_390 + .saturating_add(Weight::from_parts(436_907, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_132_000 picoseconds. - Weight::from_parts(1_082_506, 0) - // Standard Error: 5_421 - .saturating_add(Weight::from_parts(400_448, 0).saturating_mul(r.into())) + // Minimum execution time: 2_140_000 picoseconds. + Weight::from_parts(2_251_532, 0) + // Standard Error: 2_995 + .saturating_add(Weight::from_parts(280_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(3_085_764, 0) - // Standard Error: 1_912 - .saturating_add(Weight::from_parts(162_384, 0).saturating_mul(r.into())) + // Minimum execution time: 2_119_000 picoseconds. + Weight::from_parts(2_808_547, 0) + // Standard Error: 1_453 + .saturating_add(Weight::from_parts(143_409, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_849_158, 0) - // Standard Error: 1_635 - .saturating_add(Weight::from_parts(153_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_043_000 picoseconds. + Weight::from_parts(2_639_820, 0) + // Standard Error: 1_638 + .saturating_add(Weight::from_parts(159_792, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_315_000, 0) - // Standard Error: 11_776 - .saturating_add(Weight::from_parts(1_779_477, 0).saturating_mul(r.into())) + // Minimum execution time: 2_128_000 picoseconds. + Weight::from_parts(2_166_000, 0) + // Standard Error: 11_777 + .saturating_add(Weight::from_parts(1_709_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 8_815 - .saturating_add(Weight::from_parts(1_197_093, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(2_136_000, 0) + // Standard Error: 7_491 + .saturating_add(Weight::from_parts(1_105_807, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 9_983 - .saturating_add(Weight::from_parts(1_838_257, 0).saturating_mul(r.into())) + // Minimum execution time: 2_088_000 picoseconds. + Weight::from_parts(2_171_000, 0) + // Standard Error: 11_841 + .saturating_add(Weight::from_parts(1_785_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 7_749 - .saturating_add(Weight::from_parts(1_165_862, 0).saturating_mul(r.into())) + // Minimum execution time: 2_042_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 7_479 + .saturating_add(Weight::from_parts(1_086_144, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_172_000 picoseconds. - Weight::from_parts(2_246_000, 0) - // Standard Error: 11_426 - .saturating_add(Weight::from_parts(1_828_814, 0).saturating_mul(r.into())) + // Minimum execution time: 2_109_000 picoseconds. + Weight::from_parts(2_151_000, 0) + // Standard Error: 13_111 + .saturating_add(Weight::from_parts(1_829_000, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_187_000 picoseconds. - Weight::from_parts(2_245_000, 0) - // Standard Error: 7_973 - .saturating_add(Weight::from_parts(1_145_613, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_153_000, 0) + // Standard Error: 7_632 + .saturating_add(Weight::from_parts(1_102_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_273_000, 0) - // Standard Error: 10_995 - .saturating_add(Weight::from_parts(1_789_814, 0).saturating_mul(r.into())) + // Minimum execution time: 2_155_000 picoseconds. + Weight::from_parts(2_231_000, 0) + // Standard Error: 11_689 + .saturating_add(Weight::from_parts(1_768_866, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_252_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_207_539, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_163_000, 0) + // Standard Error: 7_348 + .saturating_add(Weight::from_parts(1_057_058, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_219_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 10_576 - .saturating_add(Weight::from_parts(1_855_075, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_142_000, 0) + // Standard Error: 12_173 + .saturating_add(Weight::from_parts(1_786_184, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_199_000 picoseconds. - Weight::from_parts(2_265_000, 0) - // Standard Error: 7_405 - .saturating_add(Weight::from_parts(1_180_265, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_206_000, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(1_066_057, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_285_000, 0) - // Standard Error: 10_994 - .saturating_add(Weight::from_parts(1_835_344, 0).saturating_mul(r.into())) + // Minimum execution time: 2_090_000 picoseconds. + Weight::from_parts(2_175_000, 0) + // Standard Error: 11_967 + .saturating_add(Weight::from_parts(1_782_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(2_277_000, 0) - // Standard Error: 7_826 - .saturating_add(Weight::from_parts(1_163_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_091_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 7_205 + .saturating_add(Weight::from_parts(1_048_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(2_217_000, 0) - // Standard Error: 11_374 - .saturating_add(Weight::from_parts(1_910_004, 0).saturating_mul(r.into())) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 12_228 + .saturating_add(Weight::from_parts(1_792_751, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_303_000, 0) - // Standard Error: 8_971 - .saturating_add(Weight::from_parts(1_182_859, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_186_000, 0) + // Standard Error: 7_822 + .saturating_add(Weight::from_parts(1_052_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_284_000, 0) - // Standard Error: 12_177 - .saturating_add(Weight::from_parts(1_866_465, 0).saturating_mul(r.into())) + // Minimum execution time: 2_055_000 picoseconds. + Weight::from_parts(2_135_000, 0) + // Standard Error: 12_011 + .saturating_add(Weight::from_parts(1_789_504, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_468_000 picoseconds. - Weight::from_parts(2_638_000, 0) - // Standard Error: 7_738 - .saturating_add(Weight::from_parts(1_119_369, 0).saturating_mul(r.into())) + // Minimum execution time: 2_447_000 picoseconds. + Weight::from_parts(2_540_000, 0) + // Standard Error: 7_696 + .saturating_add(Weight::from_parts(1_062_612, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_191_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 10_340 - .saturating_add(Weight::from_parts(1_831_738, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_107_000, 0) + // Standard Error: 12_070 + .saturating_add(Weight::from_parts(1_771_498, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 6_924 - .saturating_add(Weight::from_parts(1_210_933, 0).saturating_mul(r.into())) + // Minimum execution time: 2_123_000 picoseconds. + Weight::from_parts(2_156_000, 0) + // Standard Error: 7_108 + .saturating_add(Weight::from_parts(1_072_471, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_325_000, 0) - // Standard Error: 9_907 - .saturating_add(Weight::from_parts(1_822_715, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_145_000, 0) + // Standard Error: 11_990 + .saturating_add(Weight::from_parts(1_786_273, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 7_927 - .saturating_add(Weight::from_parts(1_168_287, 0).saturating_mul(r.into())) + // Minimum execution time: 2_059_000 picoseconds. + Weight::from_parts(2_122_000, 0) + // Standard Error: 7_164 + .saturating_add(Weight::from_parts(1_070_909, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 8_768 - .saturating_add(Weight::from_parts(1_295_617, 0).saturating_mul(r.into())) + // Minimum execution time: 2_065_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 7_265 + .saturating_add(Weight::from_parts(1_152_228, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 6_314 - .saturating_add(Weight::from_parts(658_832, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_160_000, 0) + // Standard Error: 5_101 + .saturating_add(Weight::from_parts(578_660, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 9_261 - .saturating_add(Weight::from_parts(1_348_699, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_184_000, 0) + // Standard Error: 9_299 + .saturating_add(Weight::from_parts(1_257_633, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 5_457 - .saturating_add(Weight::from_parts(671_846, 0).saturating_mul(r.into())) + // Minimum execution time: 2_119_000 picoseconds. + Weight::from_parts(2_262_000, 0) + // Standard Error: 3_957 + .saturating_add(Weight::from_parts(557_957, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_241_000, 0) - // Standard Error: 11_567 - .saturating_add(Weight::from_parts(1_835_171, 0).saturating_mul(r.into())) + // Minimum execution time: 2_045_000 picoseconds. + Weight::from_parts(2_157_000, 0) + // Standard Error: 10_839 + .saturating_add(Weight::from_parts(1_686_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_196_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 7_436 - .saturating_add(Weight::from_parts(1_171_019, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_250_000, 0) + // Standard Error: 7_276 + .saturating_add(Weight::from_parts(1_096_252, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(6_299_544, 0) - // Standard Error: 28_028 - .saturating_add(Weight::from_parts(2_500_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(1_434_170, 0) + // Standard Error: 21_965 + .saturating_add(Weight::from_parts(2_633_663, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_576_178, 0) - // Standard Error: 12_042 - .saturating_add(Weight::from_parts(2_335_953, 0).saturating_mul(r.into())) + // Minimum execution time: 2_098_000 picoseconds. + Weight::from_parts(2_122_681, 0) + // Standard Error: 10_815 + .saturating_add(Weight::from_parts(2_335_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(8_638_891, 0) - // Standard Error: 32_649 - .saturating_add(Weight::from_parts(2_462_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(145_632, 0) + // Standard Error: 12_320 + .saturating_add(Weight::from_parts(2_992_427, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_731_170, 0) - // Standard Error: 19_116 - .saturating_add(Weight::from_parts(2_437_473, 0).saturating_mul(r.into())) + // Minimum execution time: 2_142_000 picoseconds. + Weight::from_parts(2_180_000, 0) + // Standard Error: 4_944 + .saturating_add(Weight::from_parts(2_466_854, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_261_000 picoseconds. - Weight::from_parts(1_535_146, 0) - // Standard Error: 30_575 - .saturating_add(Weight::from_parts(9_634_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_143_000 picoseconds. + Weight::from_parts(2_204_000, 0) + // Standard Error: 14_500 + .saturating_add(Weight::from_parts(9_530_241, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_209_000 picoseconds. - Weight::from_parts(5_244_298, 0) - // Standard Error: 48_615 - .saturating_add(Weight::from_parts(7_381_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_132_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 22_303 + .saturating_add(Weight::from_parts(7_508_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_260_000 picoseconds. - Weight::from_parts(8_453_159, 0) - // Standard Error: 30_530 - .saturating_add(Weight::from_parts(2_541_459, 0).saturating_mul(r.into())) + // Minimum execution time: 2_133_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 5_407 + .saturating_add(Weight::from_parts(2_948_013, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(5_507_917, 0) - // Standard Error: 21_457 - .saturating_add(Weight::from_parts(2_217_886, 0).saturating_mul(r.into())) + // Minimum execution time: 2_124_000 picoseconds. + Weight::from_parts(2_150_000, 0) + // Standard Error: 6_372 + .saturating_add(Weight::from_parts(2_362_416, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 9_253 - .saturating_add(Weight::from_parts(1_354_282, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 7_670 + .saturating_add(Weight::from_parts(1_174_342, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 3_908 - .saturating_add(Weight::from_parts(589_876, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_109_000, 0) + // Standard Error: 3_988 + .saturating_add(Weight::from_parts(566_949, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_265_000, 0) - // Standard Error: 9_943 - .saturating_add(Weight::from_parts(1_308_630, 0).saturating_mul(r.into())) + // Minimum execution time: 2_049_000 picoseconds. + Weight::from_parts(2_117_000, 0) + // Standard Error: 8_393 + .saturating_add(Weight::from_parts(1_160_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_273_000, 0) - // Standard Error: 5_843 - .saturating_add(Weight::from_parts(653_388, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_152_000, 0) + // Standard Error: 4_769 + .saturating_add(Weight::from_parts(585_265, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_228_000 picoseconds. - Weight::from_parts(2_293_000, 0) - // Standard Error: 9_157 - .saturating_add(Weight::from_parts(1_290_731, 0).saturating_mul(r.into())) + // Minimum execution time: 2_115_000 picoseconds. + Weight::from_parts(2_170_000, 0) + // Standard Error: 7_943 + .saturating_add(Weight::from_parts(1_185_174, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 4_020 - .saturating_add(Weight::from_parts(618_071, 0).saturating_mul(r.into())) + // Minimum execution time: 2_139_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 4_608 + .saturating_add(Weight::from_parts(563_329, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_239_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 7_192 - .saturating_add(Weight::from_parts(1_061_312, 0).saturating_mul(r.into())) + // Minimum execution time: 2_144_000 picoseconds. + Weight::from_parts(2_178_000, 0) + // Standard Error: 6_727 + .saturating_add(Weight::from_parts(1_000_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_245_000, 0) - // Standard Error: 3_756 - .saturating_add(Weight::from_parts(568_744, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_212_000, 0) + // Standard Error: 3_536 + .saturating_add(Weight::from_parts(504_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(2_324_000, 0) - // Standard Error: 7_917 - .saturating_add(Weight::from_parts(1_106_132, 0).saturating_mul(r.into())) + // Minimum execution time: 2_167_000 picoseconds. + Weight::from_parts(2_218_000, 0) + // Standard Error: 7_170 + .saturating_add(Weight::from_parts(966_365, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_205_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 4_617 - .saturating_add(Weight::from_parts(599_461, 0).saturating_mul(r.into())) + // Minimum execution time: 2_149_000 picoseconds. + Weight::from_parts(140_768, 0) + // Standard Error: 5_221 + .saturating_add(Weight::from_parts(551_550, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_215_000 picoseconds. - Weight::from_parts(2_346_000, 0) - // Standard Error: 7_501 - .saturating_add(Weight::from_parts(1_125_645, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 7_621 + .saturating_add(Weight::from_parts(997_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 5_262 - .saturating_add(Weight::from_parts(624_680, 0).saturating_mul(r.into())) + // Minimum execution time: 2_069_000 picoseconds. + Weight::from_parts(2_106_000, 0) + // Standard Error: 3_980 + .saturating_add(Weight::from_parts(537_014, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 7_879 - .saturating_add(Weight::from_parts(1_068_877, 0).saturating_mul(r.into())) + // Minimum execution time: 2_097_000 picoseconds. + Weight::from_parts(2_191_000, 0) + // Standard Error: 9_419 + .saturating_add(Weight::from_parts(1_050_292, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 4_124 - .saturating_add(Weight::from_parts(567_690, 0).saturating_mul(r.into())) + // Minimum execution time: 2_051_000 picoseconds. + Weight::from_parts(2_118_000, 0) + // Standard Error: 4_228 + .saturating_add(Weight::from_parts(529_158, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 8_516 - .saturating_add(Weight::from_parts(1_174_764, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_116_000, 0) + // Standard Error: 7_792 + .saturating_add(Weight::from_parts(1_027_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_171_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 4_901 - .saturating_add(Weight::from_parts(628_068, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 4_450 + .saturating_add(Weight::from_parts(534_724, 0).saturating_mul(r.into())) } } @@ -2115,10 +2115,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 965_000 picoseconds. - Weight::from_parts(1_020_000, 0) - // Standard Error: 753 - .saturating_add(Weight::from_parts(247_354, 0).saturating_mul(c.into())) + // Minimum execution time: 954_000 picoseconds. + Weight::from_parts(1_004_000, 0) + // Standard Error: 802 + .saturating_add(Weight::from_parts(249_956, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -2126,10 +2126,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_780_000 picoseconds. - Weight::from_parts(2_874_000, 3506) - // Standard Error: 924 - .saturating_add(Weight::from_parts(674_078, 0).saturating_mul(c.into())) + // Minimum execution time: 2_808_000 picoseconds. + Weight::from_parts(2_895_000, 3506) + // Standard Error: 1_086 + .saturating_add(Weight::from_parts(680_150, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2138,17 +2138,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 51_392_000 picoseconds. - Weight::from_parts(63_325_658, 0) - // Standard Error: 13_432 - .saturating_add(Weight::from_parts(2_671_521, 0).saturating_mul(c.into())) + // Minimum execution time: 52_458_000 picoseconds. + Weight::from_parts(84_558_500, 0) + // Standard Error: 7_412 + .saturating_add(Weight::from_parts(2_377_997, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 85_039_000 picoseconds. - Weight::from_parts(86_523_000, 42236) + // Minimum execution time: 81_302_000 picoseconds. + Weight::from_parts(83_307_000, 42236) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2156,8 +2156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 54_302_000 picoseconds. - Weight::from_parts(56_159_000, 21261) + // Minimum execution time: 52_219_000 picoseconds. + Weight::from_parts(53_704_000, 21261) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2165,8 +2165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 29_099_000 picoseconds. - Weight::from_parts(30_610_000, 17070) + // Minimum execution time: 28_408_000 picoseconds. + Weight::from_parts(29_714_000, 17070) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2175,10 +2175,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_259_000 picoseconds. - Weight::from_parts(6_228_584, 7640) - // Standard Error: 37_556 - .saturating_add(Weight::from_parts(16_519_610, 0).saturating_mul(c.into())) + // Minimum execution time: 7_918_000 picoseconds. + Weight::from_parts(6_745_647, 7640) + // Standard Error: 37_300 + .saturating_add(Weight::from_parts(13_885_473, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -2187,10 +2187,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1297 + c * (16389 ±0)` // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 70_699_000 picoseconds. - Weight::from_parts(71_447_000, 40898) - // Standard Error: 139_719 - .saturating_add(Weight::from_parts(54_319_486, 0).saturating_mul(c.into())) + // Minimum execution time: 68_486_000 picoseconds. + Weight::from_parts(69_079_000, 40898) + // Standard Error: 164_982 + .saturating_add(Weight::from_parts(55_774_264, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2201,10 +2201,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 60_906_000 picoseconds. - Weight::from_parts(18_999_485, 4990) - // Standard Error: 57_215 - .saturating_add(Weight::from_parts(53_057_311, 0).saturating_mul(c.into())) + // Minimum execution time: 61_635_000 picoseconds. + Weight::from_parts(64_537_590, 4990) + // Standard Error: 40_298 + .saturating_add(Weight::from_parts(52_820_238, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2213,10 +2213,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `671` // Estimated: `38638` - // Minimum execution time: 65_623_000 picoseconds. - Weight::from_parts(88_392_610, 38638) + // Minimum execution time: 63_344_000 picoseconds. + Weight::from_parts(76_968_021, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_635, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_598, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2226,12 +2226,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 11_247_503_000 picoseconds. - Weight::from_parts(302_469_923, 34312) - // Standard Error: 147_459 - .saturating_add(Weight::from_parts(54_400_528, 0).saturating_mul(c.into())) - // Standard Error: 8 - .saturating_add(Weight::from_parts(2_571, 0).saturating_mul(s.into())) + // Minimum execution time: 10_980_969_000 picoseconds. + Weight::from_parts(301_891_685, 34312) + // Standard Error: 164_203 + .saturating_add(Weight::from_parts(54_383_779, 0).saturating_mul(c.into())) + // Standard Error: 9 + .saturating_add(Weight::from_parts(2_548, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } @@ -2240,10 +2240,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 56_802_000 picoseconds. - Weight::from_parts(33_250_791, 23853) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) + // Minimum execution time: 53_732_000 picoseconds. + Weight::from_parts(35_204_611, 23853) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_021, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -2252,10 +2252,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `451` // Estimated: `27177` - // Minimum execution time: 59_487_000 picoseconds. - Weight::from_parts(37_481_444, 27177) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_182, 0).saturating_mul(p.into())) + // Minimum execution time: 57_078_000 picoseconds. + Weight::from_parts(37_366_780, 27177) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } @@ -2264,10 +2264,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 86_239_000 picoseconds. - Weight::from_parts(32_106_516, 42227) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_249, 0).saturating_mul(p.into())) + // Minimum execution time: 82_297_000 picoseconds. + Weight::from_parts(62_302_593, 42227) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_042, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2276,10 +2276,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1081` // Estimated: `45757` - // Minimum execution time: 98_413_000 picoseconds. - Weight::from_parts(52_381_439, 45757) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_252, 0).saturating_mul(p.into())) + // Minimum execution time: 93_602_000 picoseconds. + Weight::from_parts(69_941_334, 45757) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_057, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(11_u64)) } @@ -2288,8 +2288,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 302_634_000 picoseconds. - Weight::from_parts(320_223_637, 74319) + // Minimum execution time: 298_083_000 picoseconds. + Weight::from_parts(314_192_353, 74319) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2298,10 +2298,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 315_859_000 picoseconds. - Weight::from_parts(328_138_594, 74319) - // Standard Error: 1_557 - .saturating_add(Weight::from_parts(8_014, 0).saturating_mul(q.into())) + // Minimum execution time: 312_856_000 picoseconds. + Weight::from_parts(326_607_586, 74319) + // Standard Error: 1_507 + .saturating_add(Weight::from_parts(723, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2310,10 +2310,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_804_000 picoseconds. - Weight::from_parts(46_226_000, 3899) - // Standard Error: 51_090 - .saturating_add(Weight::from_parts(51_940_069, 0).saturating_mul(c.into())) + // Minimum execution time: 45_478_000 picoseconds. + Weight::from_parts(45_769_000, 3899) + // Standard Error: 42_221 + .saturating_add(Weight::from_parts(51_492_007, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2323,630 +2323,630 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_872_000 picoseconds. - Weight::from_parts(82_358_000, 0) - // Standard Error: 3_946_533 - .saturating_add(Weight::from_parts(617_270_552, 0).saturating_mul(r.into())) + // Minimum execution time: 85_248_000 picoseconds. + Weight::from_parts(87_224_000, 0) + // Standard Error: 4_031_043 + .saturating_add(Weight::from_parts(559_145_890, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 365_182_000 picoseconds. - Weight::from_parts(292_523_651, 0) - // Standard Error: 7_087 - .saturating_add(Weight::from_parts(31_059_002, 0).saturating_mul(p.into())) + // Minimum execution time: 304_310_000 picoseconds. + Weight::from_parts(240_640_662, 0) + // Standard Error: 7_875 + .saturating_add(Weight::from_parts(30_931_778, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 196_771_000 picoseconds. - Weight::from_parts(219_836_156, 0) - // Standard Error: 406_704 - .saturating_add(Weight::from_parts(120_742_843, 0).saturating_mul(r.into())) + // Minimum execution time: 144_728_000 picoseconds. + Weight::from_parts(127_694_995, 0) + // Standard Error: 344_021 + .saturating_add(Weight::from_parts(63_008_235, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_043_000 picoseconds. - Weight::from_parts(92_117_781, 0) - // Standard Error: 7_334 - .saturating_add(Weight::from_parts(3_640_301, 0).saturating_mul(r.into())) + // Minimum execution time: 85_763_000 picoseconds. + Weight::from_parts(93_302_515, 0) + // Standard Error: 3_873 + .saturating_add(Weight::from_parts(2_723_217, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 146_803_000 picoseconds. - Weight::from_parts(168_908_676, 0) - // Standard Error: 28_070 - .saturating_add(Weight::from_parts(3_989_643, 0).saturating_mul(r.into())) + // Minimum execution time: 134_987_000 picoseconds. + Weight::from_parts(141_052_149, 0) + // Standard Error: 29_498 + .saturating_add(Weight::from_parts(3_252_053, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_421_000 picoseconds. - Weight::from_parts(109_902_108, 0) - // Standard Error: 458_197 - .saturating_add(Weight::from_parts(186_560_355, 0).saturating_mul(r.into())) + // Minimum execution time: 82_532_000 picoseconds. + Weight::from_parts(111_956_884, 0) + // Standard Error: 420_651 + .saturating_add(Weight::from_parts(124_761_103, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_173_000 picoseconds. - Weight::from_parts(81_703_608, 0) - // Standard Error: 318_823 - .saturating_add(Weight::from_parts(183_602_076, 0).saturating_mul(r.into())) + // Minimum execution time: 82_442_000 picoseconds. + Weight::from_parts(76_262_730, 0) + // Standard Error: 310_067 + .saturating_add(Weight::from_parts(115_334_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_999_000 picoseconds. - Weight::from_parts(81_002_605, 0) - // Standard Error: 269_075 - .saturating_add(Weight::from_parts(183_154_106, 0).saturating_mul(r.into())) + // Minimum execution time: 82_322_000 picoseconds. + Weight::from_parts(71_153_919, 0) + // Standard Error: 293_317 + .saturating_add(Weight::from_parts(115_508_333, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_306_000 picoseconds. - Weight::from_parts(79_166_166, 0) - // Standard Error: 332_502 - .saturating_add(Weight::from_parts(182_666_522, 0).saturating_mul(r.into())) + // Minimum execution time: 82_586_000 picoseconds. + Weight::from_parts(73_401_225, 0) + // Standard Error: 306_089 + .saturating_add(Weight::from_parts(115_530_298, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_459_000 picoseconds. - Weight::from_parts(80_301_392, 0) - // Standard Error: 340_598 - .saturating_add(Weight::from_parts(184_099_120, 0).saturating_mul(r.into())) + // Minimum execution time: 86_537_000 picoseconds. + Weight::from_parts(80_327_682, 0) + // Standard Error: 275_679 + .saturating_add(Weight::from_parts(114_024_859, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_140_000 picoseconds. - Weight::from_parts(72_987_262, 0) - // Standard Error: 388_909 - .saturating_add(Weight::from_parts(186_920_851, 0).saturating_mul(r.into())) + // Minimum execution time: 84_226_000 picoseconds. + Weight::from_parts(74_308_323, 0) + // Standard Error: 291_460 + .saturating_add(Weight::from_parts(115_396_428, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_336_000 picoseconds. - Weight::from_parts(79_078_269, 0) - // Standard Error: 276_322 - .saturating_add(Weight::from_parts(182_690_178, 0).saturating_mul(r.into())) + // Minimum execution time: 81_250_000 picoseconds. + Weight::from_parts(74_761_588, 0) + // Standard Error: 317_797 + .saturating_add(Weight::from_parts(115_173_001, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_201_000 picoseconds. - Weight::from_parts(79_459_558, 0) - // Standard Error: 357_406 - .saturating_add(Weight::from_parts(182_989_857, 0).saturating_mul(r.into())) + // Minimum execution time: 85_673_000 picoseconds. + Weight::from_parts(70_907_772, 0) + // Standard Error: 347_682 + .saturating_add(Weight::from_parts(118_189_625, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 709_298_000 picoseconds. - Weight::from_parts(792_701_124, 0) - // Standard Error: 581_476 - .saturating_add(Weight::from_parts(264_833_637, 0).saturating_mul(r.into())) + // Minimum execution time: 700_530_000 picoseconds. + Weight::from_parts(774_384_678, 0) + // Standard Error: 512_748 + .saturating_add(Weight::from_parts(194_331_468, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 958_553_000 picoseconds. - Weight::from_parts(1_002_082_000, 0) - // Standard Error: 51_056 - .saturating_add(Weight::from_parts(13_349_580, 0).saturating_mul(n.into())) + // Minimum execution time: 866_889_000 picoseconds. + Weight::from_parts(872_993_000, 0) + // Standard Error: 59_048 + .saturating_add(Weight::from_parts(13_399_620, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_092_000 picoseconds. - Weight::from_parts(70_460_333, 0) - // Standard Error: 322_779 - .saturating_add(Weight::from_parts(182_652_206, 0).saturating_mul(r.into())) + // Minimum execution time: 85_291_000 picoseconds. + Weight::from_parts(75_543_485, 0) + // Standard Error: 320_701 + .saturating_add(Weight::from_parts(115_757_456, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_315_000 picoseconds. - Weight::from_parts(77_285_940, 0) - // Standard Error: 310_862 - .saturating_add(Weight::from_parts(183_154_588, 0).saturating_mul(r.into())) + // Minimum execution time: 83_780_000 picoseconds. + Weight::from_parts(68_090_338, 0) + // Standard Error: 330_050 + .saturating_add(Weight::from_parts(117_803_137, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_813_000 picoseconds. - Weight::from_parts(83_631_977, 0) - // Standard Error: 426_894 - .saturating_add(Weight::from_parts(250_044_040, 0).saturating_mul(n.into())) + // Minimum execution time: 84_394_000 picoseconds. + Weight::from_parts(88_472_912, 0) + // Standard Error: 340_524 + .saturating_add(Weight::from_parts(190_044_477, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_342_000 picoseconds. - Weight::from_parts(88_861_000, 0) - // Standard Error: 4_034_065 - .saturating_add(Weight::from_parts(1_070_363_129, 0).saturating_mul(r.into())) + // Minimum execution time: 83_081_000 picoseconds. + Weight::from_parts(85_006_000, 0) + // Standard Error: 3_456_961 + .saturating_add(Weight::from_parts(860_188_117, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_887_000 picoseconds. - Weight::from_parts(154_402_402, 0) - // Standard Error: 504_137 - .saturating_add(Weight::from_parts(389_538_545, 0).saturating_mul(r.into())) + // Minimum execution time: 81_490_000 picoseconds. + Weight::from_parts(136_619_765, 0) + // Standard Error: 439_674 + .saturating_add(Weight::from_parts(308_552_304, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 467_573_000 picoseconds. - Weight::from_parts(471_685_000, 0) - // Standard Error: 64_140 - .saturating_add(Weight::from_parts(22_109_126, 0).saturating_mul(n.into())) + // Minimum execution time: 386_929_000 picoseconds. + Weight::from_parts(393_325_000, 0) + // Standard Error: 61_932 + .saturating_add(Weight::from_parts(21_101_790, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_853_000 picoseconds. - Weight::from_parts(152_053_498, 0) - // Standard Error: 538_330 - .saturating_add(Weight::from_parts(397_711_575, 0).saturating_mul(r.into())) + // Minimum execution time: 84_625_000 picoseconds. + Weight::from_parts(162_584_483, 0) + // Standard Error: 494_553 + .saturating_add(Weight::from_parts(313_684_139, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 471_875_000 picoseconds. - Weight::from_parts(475_692_000, 0) - // Standard Error: 57_997 - .saturating_add(Weight::from_parts(21_385_701, 0).saturating_mul(n.into())) + // Minimum execution time: 390_932_000 picoseconds. + Weight::from_parts(393_883_000, 0) + // Standard Error: 68_646 + .saturating_add(Weight::from_parts(21_188_381, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 716_684_000 picoseconds. - Weight::from_parts(781_328_373, 0) - // Standard Error: 479_933 - .saturating_add(Weight::from_parts(411_727_995, 0).saturating_mul(r.into())) + // Minimum execution time: 708_623_000 picoseconds. + Weight::from_parts(781_094_266, 0) + // Standard Error: 460_683 + .saturating_add(Weight::from_parts(328_993_362, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 746_421_000 picoseconds. - Weight::from_parts(889_163_923, 0) - // Standard Error: 621_967 - .saturating_add(Weight::from_parts(412_763_026, 0).saturating_mul(r.into())) + // Minimum execution time: 710_228_000 picoseconds. + Weight::from_parts(774_190_634, 0) + // Standard Error: 483_646 + .saturating_add(Weight::from_parts(330_057_876, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_961_000 picoseconds. - Weight::from_parts(86_031_226, 0) - // Standard Error: 355_690 - .saturating_add(Weight::from_parts(191_347_968, 0).saturating_mul(r.into())) + // Minimum execution time: 83_510_000 picoseconds. + Weight::from_parts(64_097_635, 0) + // Standard Error: 358_570 + .saturating_add(Weight::from_parts(126_095_109, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_797_807_000 picoseconds. - Weight::from_parts(3_948_397_472, 0) - // Standard Error: 396_090 - .saturating_add(Weight::from_parts(284_341_649, 0).saturating_mul(r.into())) + // Minimum execution time: 2_430_098_000 picoseconds. + Weight::from_parts(2_605_278_898, 0) + // Standard Error: 439_185 + .saturating_add(Weight::from_parts(217_479_981, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 485_799_000 picoseconds. - Weight::from_parts(486_862_000, 0) - // Standard Error: 47_704 - .saturating_add(Weight::from_parts(31_360_292, 0).saturating_mul(n.into())) + // Minimum execution time: 358_553_000 picoseconds. + Weight::from_parts(364_183_000, 0) + // Standard Error: 51_397 + .saturating_add(Weight::from_parts(30_914_040, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_842_120_000 picoseconds. - Weight::from_parts(3_943_431_716, 0) - // Standard Error: 766_406 - .saturating_add(Weight::from_parts(339_379_953, 0).saturating_mul(r.into())) + // Minimum execution time: 2_464_581_000 picoseconds. + Weight::from_parts(2_580_044_243, 0) + // Standard Error: 461_216 + .saturating_add(Weight::from_parts(272_575_116, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_828_327_000 picoseconds. - Weight::from_parts(3_976_283_101, 0) - // Standard Error: 768_169 - .saturating_add(Weight::from_parts(353_252_083, 0).saturating_mul(r.into())) + // Minimum execution time: 2_438_114_000 picoseconds. + Weight::from_parts(2_597_881_615, 0) + // Standard Error: 400_982 + .saturating_add(Weight::from_parts(275_718_502, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 256_679_000 picoseconds. - Weight::from_parts(330_245_572, 0) - // Standard Error: 519_345 - .saturating_add(Weight::from_parts(404_879_225, 0).saturating_mul(r.into())) + // Minimum execution time: 244_206_000 picoseconds. + Weight::from_parts(321_175_021, 0) + // Standard Error: 460_445 + .saturating_add(Weight::from_parts(322_059_081, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 640_004_000 picoseconds. - Weight::from_parts(646_769_000, 0) - // Standard Error: 55_122 - .saturating_add(Weight::from_parts(21_616_125, 0).saturating_mul(n.into())) + // Minimum execution time: 559_346_000 picoseconds. + Weight::from_parts(571_004_000, 0) + // Standard Error: 59_840 + .saturating_add(Weight::from_parts(21_370_093, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_981_155_000 picoseconds. - Weight::from_parts(4_086_072_221, 0) - // Standard Error: 1_076_069 - .saturating_add(Weight::from_parts(362_989_310, 0).saturating_mul(r.into())) + // Minimum execution time: 2_620_633_000 picoseconds. + Weight::from_parts(2_741_869_292, 0) + // Standard Error: 620_120 + .saturating_add(Weight::from_parts(289_781_719, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_145_000 picoseconds. - Weight::from_parts(88_260_563, 0) - // Standard Error: 277_576 - .saturating_add(Weight::from_parts(20_209_036, 0).saturating_mul(r.into())) + // Minimum execution time: 83_438_000 picoseconds. + Weight::from_parts(86_817_816, 0) + // Standard Error: 234_731 + .saturating_add(Weight::from_parts(19_849_283, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_930_000 picoseconds. - Weight::from_parts(90_280_376, 0) - // Standard Error: 1_072 - .saturating_add(Weight::from_parts(427_777, 0).saturating_mul(n.into())) + // Minimum execution time: 105_002_000 picoseconds. + Weight::from_parts(88_114_999, 0) + // Standard Error: 1_128 + .saturating_add(Weight::from_parts(427_426, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_156_000 picoseconds. - Weight::from_parts(89_778_763, 0) - // Standard Error: 365_767 - .saturating_add(Weight::from_parts(24_157_936, 0).saturating_mul(r.into())) + // Minimum execution time: 82_436_000 picoseconds. + Weight::from_parts(88_440_285, 0) + // Standard Error: 277_544 + .saturating_add(Weight::from_parts(17_399_914, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_315_000 picoseconds. - Weight::from_parts(94_894_394, 0) - // Standard Error: 993 - .saturating_add(Weight::from_parts(426_364, 0).saturating_mul(n.into())) + // Minimum execution time: 103_800_000 picoseconds. + Weight::from_parts(89_756_983, 0) + // Standard Error: 907 + .saturating_add(Weight::from_parts(428_998, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_595_000 picoseconds. - Weight::from_parts(86_259_504, 0) - // Standard Error: 284_882 - .saturating_add(Weight::from_parts(25_873_595, 0).saturating_mul(r.into())) + // Minimum execution time: 81_754_000 picoseconds. + Weight::from_parts(87_296_014, 0) + // Standard Error: 336_747 + .saturating_add(Weight::from_parts(20_299_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_771_000 picoseconds. - Weight::from_parts(85_313_802, 0) - // Standard Error: 265_474 - .saturating_add(Weight::from_parts(25_863_597, 0).saturating_mul(r.into())) + // Minimum execution time: 81_952_000 picoseconds. + Weight::from_parts(86_840_575, 0) + // Standard Error: 272_708 + .saturating_add(Weight::from_parts(19_217_524, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_396_000 picoseconds. - Weight::from_parts(126_819_617, 0) - // Standard Error: 518_749 - .saturating_add(Weight::from_parts(272_821_836, 0).saturating_mul(r.into())) + // Minimum execution time: 85_498_000 picoseconds. + Weight::from_parts(126_431_779, 0) + // Standard Error: 460_480 + .saturating_add(Weight::from_parts(198_940_536, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_266_000 picoseconds. - Weight::from_parts(100_843_000, 0) - // Standard Error: 2_828 - .saturating_add(Weight::from_parts(662_117, 0).saturating_mul(n.into())) + // Minimum execution time: 96_862_000 picoseconds. + Weight::from_parts(98_611_000, 0) + // Standard Error: 2_677 + .saturating_add(Weight::from_parts(662_266, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_150_000 picoseconds. - Weight::from_parts(754_398_128, 0) - // Standard Error: 5_119_788 - .saturating_add(Weight::from_parts(7_037_071, 0).saturating_mul(r.into())) + // Minimum execution time: 698_914_000 picoseconds. + Weight::from_parts(718_405_100, 0) + // Standard Error: 1_891_960 + .saturating_add(Weight::from_parts(24_867_800, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 712_091_000 picoseconds. - Weight::from_parts(751_999_544, 0) - // Standard Error: 4_003_265 - .saturating_add(Weight::from_parts(43_818_555, 0).saturating_mul(r.into())) + // Minimum execution time: 699_975_000 picoseconds. + Weight::from_parts(718_806_789, 0) + // Standard Error: 1_919_531 + .saturating_add(Weight::from_parts(51_192_710, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_234_000 picoseconds. - Weight::from_parts(96_192_773, 0) - // Standard Error: 271_871 - .saturating_add(Weight::from_parts(13_338_726, 0).saturating_mul(r.into())) + // Minimum execution time: 95_002_000 picoseconds. + Weight::from_parts(99_331_989, 0) + // Standard Error: 287_602 + .saturating_add(Weight::from_parts(9_719_710, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 108_190_000 picoseconds. - Weight::from_parts(92_525_926, 0) - // Standard Error: 1_134 - .saturating_add(Weight::from_parts(433_806, 0).saturating_mul(n.into())) + // Minimum execution time: 102_501_000 picoseconds. + Weight::from_parts(87_026_327, 0) + // Standard Error: 1_214 + .saturating_add(Weight::from_parts(429_134, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_297_000 picoseconds. - Weight::from_parts(98_054_616, 0) - // Standard Error: 394_791 - .saturating_add(Weight::from_parts(7_680_683, 0).saturating_mul(r.into())) + // Minimum execution time: 93_228_000 picoseconds. + Weight::from_parts(97_923_691, 0) + // Standard Error: 288_469 + .saturating_add(Weight::from_parts(9_669_908, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 106_932_000 picoseconds. - Weight::from_parts(91_150_785, 0) - // Standard Error: 1_067 - .saturating_add(Weight::from_parts(424_570, 0).saturating_mul(n.into())) + // Minimum execution time: 100_908_000 picoseconds. + Weight::from_parts(87_613_705, 0) + // Standard Error: 1_237 + .saturating_add(Weight::from_parts(431_412, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_591_000 picoseconds. - Weight::from_parts(79_590_461, 0) - // Standard Error: 360_038 - .saturating_add(Weight::from_parts(185_313_242, 0).saturating_mul(r.into())) + // Minimum execution time: 84_385_000 picoseconds. + Weight::from_parts(74_453_057, 0) + // Standard Error: 309_931 + .saturating_add(Weight::from_parts(117_172_527, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_379_000 picoseconds. - Weight::from_parts(82_304_672, 0) - // Standard Error: 371_508 - .saturating_add(Weight::from_parts(184_895_719, 0).saturating_mul(r.into())) + // Minimum execution time: 82_437_000 picoseconds. + Weight::from_parts(78_951_443, 0) + // Standard Error: 294_227 + .saturating_add(Weight::from_parts(116_066_384, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_906_000 picoseconds. - Weight::from_parts(784_837_322, 0) - // Standard Error: 485_874 - .saturating_add(Weight::from_parts(198_529_306, 0).saturating_mul(r.into())) + // Minimum execution time: 704_954_000 picoseconds. + Weight::from_parts(752_735_182, 0) + // Standard Error: 455_998 + .saturating_add(Weight::from_parts(135_154_607, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 735_164_000 picoseconds. - Weight::from_parts(760_829_418, 0) - // Standard Error: 2_049 - .saturating_add(Weight::from_parts(164_862, 0).saturating_mul(n.into())) + // Minimum execution time: 724_451_000 picoseconds. + Weight::from_parts(738_722_668, 0) + // Standard Error: 1_014 + .saturating_add(Weight::from_parts(154_329, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_467_125_000 picoseconds. - Weight::from_parts(4_668_343_697, 0) - // Standard Error: 529_569 - .saturating_add(Weight::from_parts(214_709_155, 0).saturating_mul(r.into())) + // Minimum execution time: 3_092_586_000 picoseconds. + Weight::from_parts(3_231_311_035, 0) + // Standard Error: 506_742 + .saturating_add(Weight::from_parts(159_545_582, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_716_693_000 picoseconds. - Weight::from_parts(4_810_590_943, 0) - // Standard Error: 12_440 - .saturating_add(Weight::from_parts(13_814_475, 0).saturating_mul(n.into())) + // Minimum execution time: 3_299_872_000 picoseconds. + Weight::from_parts(3_317_022_894, 0) + // Standard Error: 8_542 + .saturating_add(Weight::from_parts(13_645_472, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_721_000 picoseconds. - Weight::from_parts(95_360_878, 0) - // Standard Error: 488_163 - .saturating_add(Weight::from_parts(198_923_476, 0).saturating_mul(r.into())) + // Minimum execution time: 85_966_000 picoseconds. + Weight::from_parts(106_319_310, 0) + // Standard Error: 424_534 + .saturating_add(Weight::from_parts(139_885_203, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 189_069_000 picoseconds. - Weight::from_parts(191_834_000, 0) - // Standard Error: 53_942 - .saturating_add(Weight::from_parts(26_059_121, 0).saturating_mul(n.into())) + // Minimum execution time: 142_910_000 picoseconds. + Weight::from_parts(144_843_000, 0) + // Standard Error: 54_401 + .saturating_add(Weight::from_parts(25_535_472, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_023_000 picoseconds. - Weight::from_parts(70_919_161, 0) - // Standard Error: 442_134 - .saturating_add(Weight::from_parts(186_467_769, 0).saturating_mul(r.into())) + // Minimum execution time: 82_117_000 picoseconds. + Weight::from_parts(80_202_149, 0) + // Standard Error: 296_880 + .saturating_add(Weight::from_parts(114_586_990, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_187_000 picoseconds. - Weight::from_parts(86_256_124, 0) - // Standard Error: 333_120 - .saturating_add(Weight::from_parts(27_182_075, 0).saturating_mul(r.into())) + // Minimum execution time: 81_802_000 picoseconds. + Weight::from_parts(85_064_295, 0) + // Standard Error: 248_874 + .saturating_add(Weight::from_parts(27_314_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_373_000 picoseconds. - Weight::from_parts(83_957_387, 0) - // Standard Error: 258_914 - .saturating_add(Weight::from_parts(14_637_112, 0).saturating_mul(r.into())) + // Minimum execution time: 82_854_000 picoseconds. + Weight::from_parts(86_180_314, 0) + // Standard Error: 239_162 + .saturating_add(Weight::from_parts(16_391_885, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_886_000 picoseconds. - Weight::from_parts(86_536_767, 0) - // Standard Error: 237_087 - .saturating_add(Weight::from_parts(15_456_732, 0).saturating_mul(r.into())) + // Minimum execution time: 80_883_000 picoseconds. + Weight::from_parts(87_058_214, 0) + // Standard Error: 256_392 + .saturating_add(Weight::from_parts(13_333_285, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_962_000 picoseconds. - Weight::from_parts(87_038_165, 0) - // Standard Error: 267_652 - .saturating_add(Weight::from_parts(14_141_234, 0).saturating_mul(r.into())) + // Minimum execution time: 81_417_000 picoseconds. + Weight::from_parts(85_403_451, 0) + // Standard Error: 249_767 + .saturating_add(Weight::from_parts(14_474_948, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_976_000 picoseconds. - Weight::from_parts(87_105_967, 0) - // Standard Error: 237_581 - .saturating_add(Weight::from_parts(13_365_932, 0).saturating_mul(r.into())) + // Minimum execution time: 84_020_000 picoseconds. + Weight::from_parts(88_080_622, 0) + // Standard Error: 253_221 + .saturating_add(Weight::from_parts(11_403_277, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_585_000 picoseconds. - Weight::from_parts(203_512_831, 0) - // Standard Error: 393_346 - .saturating_add(Weight::from_parts(283_538_921, 0).saturating_mul(r.into())) + // Minimum execution time: 138_317_000 picoseconds. + Weight::from_parts(187_894_162, 0) + // Standard Error: 376_519 + .saturating_add(Weight::from_parts(209_723_429, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_330_000 picoseconds. - Weight::from_parts(158_669_516, 0) - // Standard Error: 440_421 - .saturating_add(Weight::from_parts(473_163_025, 0).saturating_mul(r.into())) + // Minimum execution time: 93_047_000 picoseconds. + Weight::from_parts(151_715_771, 0) + // Standard Error: 425_606 + .saturating_add(Weight::from_parts(396_733_544, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2954,22 +2954,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_492_772_000 picoseconds. - Weight::from_parts(43_692_998_000, 0) - // Standard Error: 263_249 - .saturating_add(Weight::from_parts(8_169_821, 0).saturating_mul(p.into())) - // Standard Error: 263_236 - .saturating_add(Weight::from_parts(180_732_778, 0).saturating_mul(s.into())) + // Minimum execution time: 45_923_081_000 picoseconds. + Weight::from_parts(45_981_736_000, 0) + // Standard Error: 274_662 + .saturating_add(Weight::from_parts(6_858_186, 0).saturating_mul(p.into())) + // Standard Error: 274_649 + .saturating_add(Weight::from_parts(177_291_831, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_189_000 picoseconds. - Weight::from_parts(158_677_248, 0) - // Standard Error: 452_648 - .saturating_add(Weight::from_parts(478_043_506, 0).saturating_mul(r.into())) + // Minimum execution time: 95_680_000 picoseconds. + Weight::from_parts(157_350_147, 0) + // Standard Error: 440_994 + .saturating_add(Weight::from_parts(402_511_567, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2977,32 +2977,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_613_488_000 picoseconds. - Weight::from_parts(43_758_304_000, 0) - // Standard Error: 268_412 - .saturating_add(Weight::from_parts(7_987_894, 0).saturating_mul(p.into())) - // Standard Error: 268_399 - .saturating_add(Weight::from_parts(180_769_004, 0).saturating_mul(s.into())) + // Minimum execution time: 42_842_395_000 picoseconds. + Weight::from_parts(42_890_931_000, 0) + // Standard Error: 264_187 + .saturating_add(Weight::from_parts(7_896_879, 0).saturating_mul(p.into())) + // Standard Error: 264_174 + .saturating_add(Weight::from_parts(178_082_248, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_210_000 picoseconds. - Weight::from_parts(99_996_695, 0) - // Standard Error: 31_808 - .saturating_add(Weight::from_parts(3_523_987, 0).saturating_mul(r.into())) + // Minimum execution time: 82_272_000 picoseconds. + Weight::from_parts(100_008_395, 0) + // Standard Error: 36_430 + .saturating_add(Weight::from_parts(2_544_223, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 82_940_000 picoseconds. - Weight::from_parts(123_540_441, 1131) - // Standard Error: 7_143 - .saturating_add(Weight::from_parts(11_789_871, 0).saturating_mul(p.into())) + // Minimum execution time: 83_139_000 picoseconds. + Weight::from_parts(122_967_835, 1131) + // Standard Error: 6_454 + .saturating_add(Weight::from_parts(11_784_103, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3011,10 +3011,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_752_000 picoseconds. - Weight::from_parts(84_858_000, 1131) - // Standard Error: 48_161 - .saturating_add(Weight::from_parts(36_181_117, 0).saturating_mul(p.into())) + // Minimum execution time: 83_229_000 picoseconds. + Weight::from_parts(83_885_000, 1131) + // Standard Error: 37_558 + .saturating_add(Weight::from_parts(35_503_677, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3023,10 +3023,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_125_138_000 picoseconds. - Weight::from_parts(5_869_525_563, 5069931) - // Standard Error: 46_521 - .saturating_add(Weight::from_parts(36_899_111, 0).saturating_mul(p.into())) + // Minimum execution time: 6_139_187_000 picoseconds. + Weight::from_parts(5_806_599_304, 5069931) + // Standard Error: 75_881 + .saturating_add(Weight::from_parts(36_513_688, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -3034,10 +3034,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_516_000 picoseconds. - Weight::from_parts(83_470_000, 1939) - // Standard Error: 29_769 - .saturating_add(Weight::from_parts(46_665_657, 0).saturating_mul(p.into())) + // Minimum execution time: 82_177_000 picoseconds. + Weight::from_parts(83_595_000, 1939) + // Standard Error: 45_778 + .saturating_add(Weight::from_parts(47_155_630, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -3046,10 +3046,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_344_000 picoseconds. - Weight::from_parts(94_873_151, 1131) - // Standard Error: 55_429 - .saturating_add(Weight::from_parts(35_724_871, 0).saturating_mul(p.into())) + // Minimum execution time: 90_231_000 picoseconds. + Weight::from_parts(95_944_378, 1131) + // Standard Error: 61_821 + .saturating_add(Weight::from_parts(35_941_066, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3058,10 +3058,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 735_393_000 picoseconds. - Weight::from_parts(754_062_397, 1496) - // Standard Error: 166_437 - .saturating_add(Weight::from_parts(43_966_900, 0).saturating_mul(p.into())) + // Minimum execution time: 734_006_000 picoseconds. + Weight::from_parts(717_384_508, 1496) + // Standard Error: 375_292 + .saturating_add(Weight::from_parts(47_930_581, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3070,10 +3070,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_124_371_000 picoseconds. - Weight::from_parts(1_147_901_415, 317931) - // Standard Error: 145_342 - .saturating_add(Weight::from_parts(43_795_511, 0).saturating_mul(p.into())) + // Minimum execution time: 1_121_849_000 picoseconds. + Weight::from_parts(1_147_558_033, 317931) + // Standard Error: 373_146 + .saturating_add(Weight::from_parts(45_393_418, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3081,884 +3081,884 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_510_000 picoseconds. - Weight::from_parts(1_448_006, 0) - // Standard Error: 9_868 - .saturating_add(Weight::from_parts(24_061_691, 0).saturating_mul(r.into())) + // Minimum execution time: 2_162_000 picoseconds. + Weight::from_parts(2_220_392, 0) + // Standard Error: 8_848 + .saturating_add(Weight::from_parts(24_205_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_991_000 picoseconds. - Weight::from_parts(4_151_991_287, 0) - // Standard Error: 60_683 - .saturating_add(Weight::from_parts(4_818_799, 0).saturating_mul(r.into())) + // Minimum execution time: 4_352_664_000 picoseconds. + Weight::from_parts(4_153_366_897, 0) + // Standard Error: 60_193 + .saturating_add(Weight::from_parts(4_722_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_341_162_000 picoseconds. - Weight::from_parts(4_200_807_294, 0) - // Standard Error: 51_442 - .saturating_add(Weight::from_parts(4_527_839, 0).saturating_mul(r.into())) + // Minimum execution time: 4_357_649_000 picoseconds. + Weight::from_parts(4_256_499_798, 0) + // Standard Error: 57_942 + .saturating_add(Weight::from_parts(4_200_870, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_322_767_000 picoseconds. - Weight::from_parts(11_038_976_057, 0) - // Standard Error: 150_113 - .saturating_add(Weight::from_parts(10_655_640, 0).saturating_mul(r.into())) + // Minimum execution time: 10_269_998_000 picoseconds. + Weight::from_parts(11_525_100_351, 0) + // Standard Error: 204_230 + .saturating_add(Weight::from_parts(8_423_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_367_826_000 picoseconds. - Weight::from_parts(11_310_983_745, 0) - // Standard Error: 145_202 - .saturating_add(Weight::from_parts(7_541_832, 0).saturating_mul(r.into())) + // Minimum execution time: 10_204_810_000 picoseconds. + Weight::from_parts(10_982_673_143, 0) + // Standard Error: 145_327 + .saturating_add(Weight::from_parts(9_198_033, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_251_000 picoseconds. - Weight::from_parts(2_304_000, 0) - // Standard Error: 8_520 - .saturating_add(Weight::from_parts(3_798_413, 0).saturating_mul(r.into())) + // Minimum execution time: 2_074_000 picoseconds. + Weight::from_parts(2_108_000, 0) + // Standard Error: 9_031 + .saturating_add(Weight::from_parts(3_829_182, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(573_722, 0) - // Standard Error: 11_642 - .saturating_add(Weight::from_parts(3_174_691, 0).saturating_mul(r.into())) + // Minimum execution time: 2_020_000 picoseconds. + Weight::from_parts(2_118_000, 0) + // Standard Error: 5_295 + .saturating_add(Weight::from_parts(2_980_329, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(3_155_512, 0) - // Standard Error: 1_212 - .saturating_add(Weight::from_parts(1_586_585, 0).saturating_mul(r.into())) + // Minimum execution time: 2_032_000 picoseconds. + Weight::from_parts(3_411_359, 0) + // Standard Error: 1_146 + .saturating_add(Weight::from_parts(1_563_906, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_160_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 8_627 - .saturating_add(Weight::from_parts(2_929_529, 0).saturating_mul(r.into())) + // Minimum execution time: 2_096_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 8_349 + .saturating_add(Weight::from_parts(2_904_673, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(1_609_241, 0) - // Standard Error: 19_812 - .saturating_add(Weight::from_parts(5_162_833, 0).saturating_mul(r.into())) + // Minimum execution time: 2_128_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 8_100 + .saturating_add(Weight::from_parts(5_229_400, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_892_000 picoseconds. - Weight::from_parts(5_316_811, 0) - // Standard Error: 1_578 - .saturating_add(Weight::from_parts(163_377, 0).saturating_mul(e.into())) + // Minimum execution time: 6_838_000 picoseconds. + Weight::from_parts(5_309_346, 0) + // Standard Error: 2_580 + .saturating_add(Weight::from_parts(129_982, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_304_000 picoseconds. - Weight::from_parts(4_554_683, 0) - // Standard Error: 7_319 - .saturating_add(Weight::from_parts(2_595_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(3_593_285, 0) + // Standard Error: 6_648 + .saturating_add(Weight::from_parts(2_597_926, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_595_958 - - 2_422_191, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_597_926 - + 2_429_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_273_000 picoseconds. - Weight::from_parts(5_046_075, 0) - // Standard Error: 13_702 - .saturating_add(Weight::from_parts(2_422_191, 0).saturating_mul(r.into())) + // Minimum execution time: 2_086_000 picoseconds. + Weight::from_parts(3_972_773, 0) + // Standard Error: 12_538 + .saturating_add(Weight::from_parts(2_429_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_684_000 picoseconds. - Weight::from_parts(17_324_871, 0) - // Standard Error: 38_532 - .saturating_add(Weight::from_parts(10_260_872, 0).saturating_mul(r.into())) + // Minimum execution time: 2_591_000 picoseconds. + Weight::from_parts(12_798_134, 0) + // Standard Error: 23_023 + .saturating_add(Weight::from_parts(9_786_464, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_206_000 picoseconds. - Weight::from_parts(2_634_425, 0) - // Standard Error: 5_954 - .saturating_add(Weight::from_parts(1_275_538, 0).saturating_mul(p.into())) + // Minimum execution time: 12_274_000 picoseconds. + Weight::from_parts(1_706_188, 0) + // Standard Error: 6_199 + .saturating_add(Weight::from_parts(1_212_443, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_288_000 picoseconds. - Weight::from_parts(5_570_870, 0) + // Minimum execution time: 5_221_000 picoseconds. + Weight::from_parts(5_538_574, 0) // Standard Error: 12 - .saturating_add(Weight::from_parts(61, 0).saturating_mul(l.into())) + .saturating_add(Weight::from_parts(12, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_203_000 picoseconds. - Weight::from_parts(1_788_159, 0) - // Standard Error: 3_152 - .saturating_add(Weight::from_parts(267_842, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(1_785_103, 0) + // Standard Error: 2_948 + .saturating_add(Weight::from_parts(249_981, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_164_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 4_611 - .saturating_add(Weight::from_parts(721_127, 0).saturating_mul(r.into())) + // Minimum execution time: 2_123_000 picoseconds. + Weight::from_parts(2_187_000, 0) + // Standard Error: 5_664 + .saturating_add(Weight::from_parts(719_187, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_347_000, 0) - // Standard Error: 5_971 - .saturating_add(Weight::from_parts(742_209, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_214_000, 0) + // Standard Error: 5_625 + .saturating_add(Weight::from_parts(709_067, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_406_000 picoseconds. - Weight::from_parts(2_894_577, 0) - // Standard Error: 8_027 - .saturating_add(Weight::from_parts(801_493, 0).saturating_mul(r.into())) + // Minimum execution time: 6_168_000 picoseconds. + Weight::from_parts(2_290_203, 0) + // Standard Error: 8_984 + .saturating_add(Weight::from_parts(761_843, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_345_000 picoseconds. - Weight::from_parts(31_295, 0) - // Standard Error: 10_231 - .saturating_add(Weight::from_parts(1_543_569, 0).saturating_mul(r.into())) + // Minimum execution time: 6_249_000 picoseconds. + Weight::from_parts(6_302_000, 0) + // Standard Error: 8_682 + .saturating_add(Weight::from_parts(1_329_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_937_000 picoseconds. - Weight::from_parts(62_049, 0) - // Standard Error: 12_087 - .saturating_add(Weight::from_parts(7_172_920, 0).saturating_mul(r.into())) + // Minimum execution time: 3_791_000 picoseconds. + Weight::from_parts(3_929_000, 0) + // Standard Error: 9_270 + .saturating_add(Weight::from_parts(6_742_685, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_262_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 6_042 - .saturating_add(Weight::from_parts(3_394_526, 0).saturating_mul(r.into())) + // Minimum execution time: 2_113_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 6_734 + .saturating_add(Weight::from_parts(3_327_207, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_151_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 5_891 - .saturating_add(Weight::from_parts(3_138_523, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_141_000, 0) + // Standard Error: 6_506 + .saturating_add(Weight::from_parts(3_061_891, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_277_000, 0) - // Standard Error: 8_196 - .saturating_add(Weight::from_parts(3_167_033, 0).saturating_mul(r.into())) + // Minimum execution time: 2_108_000 picoseconds. + Weight::from_parts(2_141_000, 0) + // Standard Error: 6_738 + .saturating_add(Weight::from_parts(3_101_844, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 5_536 - .saturating_add(Weight::from_parts(2_668_164, 0).saturating_mul(r.into())) + // Minimum execution time: 2_138_000 picoseconds. + Weight::from_parts(2_155_000, 0) + // Standard Error: 4_379 + .saturating_add(Weight::from_parts(2_613_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(45_432, 0) - // Standard Error: 6_223 - .saturating_add(Weight::from_parts(645_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_046_000 picoseconds. + Weight::from_parts(2_127_000, 0) + // Standard Error: 3_513 + .saturating_add(Weight::from_parts(525_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(1_301_007, 0) - // Standard Error: 4_929 - .saturating_add(Weight::from_parts(446_280, 0).saturating_mul(r.into())) + // Minimum execution time: 2_127_000 picoseconds. + Weight::from_parts(1_669_179, 0) + // Standard Error: 2_817 + .saturating_add(Weight::from_parts(367_599, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_205_000, 0) - // Standard Error: 10_412 - .saturating_add(Weight::from_parts(1_894_722, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 11_816 + .saturating_add(Weight::from_parts(1_810_781, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_257_000, 0) - // Standard Error: 7_708 - .saturating_add(Weight::from_parts(1_162_246, 0).saturating_mul(r.into())) + // Minimum execution time: 2_087_000 picoseconds. + Weight::from_parts(2_194_000, 0) + // Standard Error: 7_361 + .saturating_add(Weight::from_parts(1_130_773, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(1_682_106, 0) - // Standard Error: 3_839 - .saturating_add(Weight::from_parts(384_381, 0).saturating_mul(r.into())) + // Minimum execution time: 2_061_000 picoseconds. + Weight::from_parts(1_850_477, 0) + // Standard Error: 2_695 + .saturating_add(Weight::from_parts(318_827, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(1_669_708, 0) - // Standard Error: 3_126 - .saturating_add(Weight::from_parts(384_474, 0).saturating_mul(r.into())) + // Minimum execution time: 2_115_000 picoseconds. + Weight::from_parts(1_764_589, 0) + // Standard Error: 2_923 + .saturating_add(Weight::from_parts(329_840, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_291_000, 0) - // Standard Error: 4_476 - .saturating_add(Weight::from_parts(497_277, 0).saturating_mul(r.into())) + // Minimum execution time: 2_109_000 picoseconds. + Weight::from_parts(859_995, 0) + // Standard Error: 4_546 + .saturating_add(Weight::from_parts(467_944, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_217_000 picoseconds. - Weight::from_parts(2_287_000, 0) - // Standard Error: 4_107 - .saturating_add(Weight::from_parts(524_095, 0).saturating_mul(r.into())) + // Minimum execution time: 2_010_000 picoseconds. + Weight::from_parts(2_081_000, 0) + // Standard Error: 3_959 + .saturating_add(Weight::from_parts(472_947, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_233_000, 0) - // Standard Error: 3_690 - .saturating_add(Weight::from_parts(501_277, 0).saturating_mul(r.into())) + // Minimum execution time: 2_105_000 picoseconds. + Weight::from_parts(1_247_124, 0) + // Standard Error: 4_390 + .saturating_add(Weight::from_parts(436_907, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_132_000 picoseconds. - Weight::from_parts(1_082_506, 0) - // Standard Error: 5_421 - .saturating_add(Weight::from_parts(400_448, 0).saturating_mul(r.into())) + // Minimum execution time: 2_140_000 picoseconds. + Weight::from_parts(2_251_532, 0) + // Standard Error: 2_995 + .saturating_add(Weight::from_parts(280_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(3_085_764, 0) - // Standard Error: 1_912 - .saturating_add(Weight::from_parts(162_384, 0).saturating_mul(r.into())) + // Minimum execution time: 2_119_000 picoseconds. + Weight::from_parts(2_808_547, 0) + // Standard Error: 1_453 + .saturating_add(Weight::from_parts(143_409, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_849_158, 0) - // Standard Error: 1_635 - .saturating_add(Weight::from_parts(153_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_043_000 picoseconds. + Weight::from_parts(2_639_820, 0) + // Standard Error: 1_638 + .saturating_add(Weight::from_parts(159_792, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_315_000, 0) - // Standard Error: 11_776 - .saturating_add(Weight::from_parts(1_779_477, 0).saturating_mul(r.into())) + // Minimum execution time: 2_128_000 picoseconds. + Weight::from_parts(2_166_000, 0) + // Standard Error: 11_777 + .saturating_add(Weight::from_parts(1_709_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 8_815 - .saturating_add(Weight::from_parts(1_197_093, 0).saturating_mul(r.into())) + // Minimum execution time: 2_100_000 picoseconds. + Weight::from_parts(2_136_000, 0) + // Standard Error: 7_491 + .saturating_add(Weight::from_parts(1_105_807, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_190_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 9_983 - .saturating_add(Weight::from_parts(1_838_257, 0).saturating_mul(r.into())) + // Minimum execution time: 2_088_000 picoseconds. + Weight::from_parts(2_171_000, 0) + // Standard Error: 11_841 + .saturating_add(Weight::from_parts(1_785_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 7_749 - .saturating_add(Weight::from_parts(1_165_862, 0).saturating_mul(r.into())) + // Minimum execution time: 2_042_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 7_479 + .saturating_add(Weight::from_parts(1_086_144, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_172_000 picoseconds. - Weight::from_parts(2_246_000, 0) - // Standard Error: 11_426 - .saturating_add(Weight::from_parts(1_828_814, 0).saturating_mul(r.into())) + // Minimum execution time: 2_109_000 picoseconds. + Weight::from_parts(2_151_000, 0) + // Standard Error: 13_111 + .saturating_add(Weight::from_parts(1_829_000, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_187_000 picoseconds. - Weight::from_parts(2_245_000, 0) - // Standard Error: 7_973 - .saturating_add(Weight::from_parts(1_145_613, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_153_000, 0) + // Standard Error: 7_632 + .saturating_add(Weight::from_parts(1_102_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_273_000, 0) - // Standard Error: 10_995 - .saturating_add(Weight::from_parts(1_789_814, 0).saturating_mul(r.into())) + // Minimum execution time: 2_155_000 picoseconds. + Weight::from_parts(2_231_000, 0) + // Standard Error: 11_689 + .saturating_add(Weight::from_parts(1_768_866, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_252_000, 0) - // Standard Error: 7_454 - .saturating_add(Weight::from_parts(1_207_539, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_163_000, 0) + // Standard Error: 7_348 + .saturating_add(Weight::from_parts(1_057_058, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_219_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 10_576 - .saturating_add(Weight::from_parts(1_855_075, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_142_000, 0) + // Standard Error: 12_173 + .saturating_add(Weight::from_parts(1_786_184, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_199_000 picoseconds. - Weight::from_parts(2_265_000, 0) - // Standard Error: 7_405 - .saturating_add(Weight::from_parts(1_180_265, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_206_000, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(1_066_057, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_285_000, 0) - // Standard Error: 10_994 - .saturating_add(Weight::from_parts(1_835_344, 0).saturating_mul(r.into())) + // Minimum execution time: 2_090_000 picoseconds. + Weight::from_parts(2_175_000, 0) + // Standard Error: 11_967 + .saturating_add(Weight::from_parts(1_782_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(2_277_000, 0) - // Standard Error: 7_826 - .saturating_add(Weight::from_parts(1_163_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_091_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 7_205 + .saturating_add(Weight::from_parts(1_048_140, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(2_217_000, 0) - // Standard Error: 11_374 - .saturating_add(Weight::from_parts(1_910_004, 0).saturating_mul(r.into())) + // Minimum execution time: 2_164_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 12_228 + .saturating_add(Weight::from_parts(1_792_751, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_303_000, 0) - // Standard Error: 8_971 - .saturating_add(Weight::from_parts(1_182_859, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_186_000, 0) + // Standard Error: 7_822 + .saturating_add(Weight::from_parts(1_052_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_284_000, 0) - // Standard Error: 12_177 - .saturating_add(Weight::from_parts(1_866_465, 0).saturating_mul(r.into())) + // Minimum execution time: 2_055_000 picoseconds. + Weight::from_parts(2_135_000, 0) + // Standard Error: 12_011 + .saturating_add(Weight::from_parts(1_789_504, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_468_000 picoseconds. - Weight::from_parts(2_638_000, 0) - // Standard Error: 7_738 - .saturating_add(Weight::from_parts(1_119_369, 0).saturating_mul(r.into())) + // Minimum execution time: 2_447_000 picoseconds. + Weight::from_parts(2_540_000, 0) + // Standard Error: 7_696 + .saturating_add(Weight::from_parts(1_062_612, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_191_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 10_340 - .saturating_add(Weight::from_parts(1_831_738, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_107_000, 0) + // Standard Error: 12_070 + .saturating_add(Weight::from_parts(1_771_498, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 6_924 - .saturating_add(Weight::from_parts(1_210_933, 0).saturating_mul(r.into())) + // Minimum execution time: 2_123_000 picoseconds. + Weight::from_parts(2_156_000, 0) + // Standard Error: 7_108 + .saturating_add(Weight::from_parts(1_072_471, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_325_000, 0) - // Standard Error: 9_907 - .saturating_add(Weight::from_parts(1_822_715, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_145_000, 0) + // Standard Error: 11_990 + .saturating_add(Weight::from_parts(1_786_273, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 7_927 - .saturating_add(Weight::from_parts(1_168_287, 0).saturating_mul(r.into())) + // Minimum execution time: 2_059_000 picoseconds. + Weight::from_parts(2_122_000, 0) + // Standard Error: 7_164 + .saturating_add(Weight::from_parts(1_070_909, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 8_768 - .saturating_add(Weight::from_parts(1_295_617, 0).saturating_mul(r.into())) + // Minimum execution time: 2_065_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 7_265 + .saturating_add(Weight::from_parts(1_152_228, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 6_314 - .saturating_add(Weight::from_parts(658_832, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_160_000, 0) + // Standard Error: 5_101 + .saturating_add(Weight::from_parts(578_660, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 9_261 - .saturating_add(Weight::from_parts(1_348_699, 0).saturating_mul(r.into())) + // Minimum execution time: 2_130_000 picoseconds. + Weight::from_parts(2_184_000, 0) + // Standard Error: 9_299 + .saturating_add(Weight::from_parts(1_257_633, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 5_457 - .saturating_add(Weight::from_parts(671_846, 0).saturating_mul(r.into())) + // Minimum execution time: 2_119_000 picoseconds. + Weight::from_parts(2_262_000, 0) + // Standard Error: 3_957 + .saturating_add(Weight::from_parts(557_957, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_241_000, 0) - // Standard Error: 11_567 - .saturating_add(Weight::from_parts(1_835_171, 0).saturating_mul(r.into())) + // Minimum execution time: 2_045_000 picoseconds. + Weight::from_parts(2_157_000, 0) + // Standard Error: 10_839 + .saturating_add(Weight::from_parts(1_686_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_196_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 7_436 - .saturating_add(Weight::from_parts(1_171_019, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_250_000, 0) + // Standard Error: 7_276 + .saturating_add(Weight::from_parts(1_096_252, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_195_000 picoseconds. - Weight::from_parts(6_299_544, 0) - // Standard Error: 28_028 - .saturating_add(Weight::from_parts(2_500_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(1_434_170, 0) + // Standard Error: 21_965 + .saturating_add(Weight::from_parts(2_633_663, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_249_000 picoseconds. - Weight::from_parts(2_576_178, 0) - // Standard Error: 12_042 - .saturating_add(Weight::from_parts(2_335_953, 0).saturating_mul(r.into())) + // Minimum execution time: 2_098_000 picoseconds. + Weight::from_parts(2_122_681, 0) + // Standard Error: 10_815 + .saturating_add(Weight::from_parts(2_335_842, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(8_638_891, 0) - // Standard Error: 32_649 - .saturating_add(Weight::from_parts(2_462_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(145_632, 0) + // Standard Error: 12_320 + .saturating_add(Weight::from_parts(2_992_427, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_731_170, 0) - // Standard Error: 19_116 - .saturating_add(Weight::from_parts(2_437_473, 0).saturating_mul(r.into())) + // Minimum execution time: 2_142_000 picoseconds. + Weight::from_parts(2_180_000, 0) + // Standard Error: 4_944 + .saturating_add(Weight::from_parts(2_466_854, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_261_000 picoseconds. - Weight::from_parts(1_535_146, 0) - // Standard Error: 30_575 - .saturating_add(Weight::from_parts(9_634_377, 0).saturating_mul(r.into())) + // Minimum execution time: 2_143_000 picoseconds. + Weight::from_parts(2_204_000, 0) + // Standard Error: 14_500 + .saturating_add(Weight::from_parts(9_530_241, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_209_000 picoseconds. - Weight::from_parts(5_244_298, 0) - // Standard Error: 48_615 - .saturating_add(Weight::from_parts(7_381_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_132_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 22_303 + .saturating_add(Weight::from_parts(7_508_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_260_000 picoseconds. - Weight::from_parts(8_453_159, 0) - // Standard Error: 30_530 - .saturating_add(Weight::from_parts(2_541_459, 0).saturating_mul(r.into())) + // Minimum execution time: 2_133_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 5_407 + .saturating_add(Weight::from_parts(2_948_013, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(5_507_917, 0) - // Standard Error: 21_457 - .saturating_add(Weight::from_parts(2_217_886, 0).saturating_mul(r.into())) + // Minimum execution time: 2_124_000 picoseconds. + Weight::from_parts(2_150_000, 0) + // Standard Error: 6_372 + .saturating_add(Weight::from_parts(2_362_416, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 9_253 - .saturating_add(Weight::from_parts(1_354_282, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 7_670 + .saturating_add(Weight::from_parts(1_174_342, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_170_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 3_908 - .saturating_add(Weight::from_parts(589_876, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_109_000, 0) + // Standard Error: 3_988 + .saturating_add(Weight::from_parts(566_949, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_265_000, 0) - // Standard Error: 9_943 - .saturating_add(Weight::from_parts(1_308_630, 0).saturating_mul(r.into())) + // Minimum execution time: 2_049_000 picoseconds. + Weight::from_parts(2_117_000, 0) + // Standard Error: 8_393 + .saturating_add(Weight::from_parts(1_160_794, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_273_000, 0) - // Standard Error: 5_843 - .saturating_add(Weight::from_parts(653_388, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_152_000, 0) + // Standard Error: 4_769 + .saturating_add(Weight::from_parts(585_265, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_228_000 picoseconds. - Weight::from_parts(2_293_000, 0) - // Standard Error: 9_157 - .saturating_add(Weight::from_parts(1_290_731, 0).saturating_mul(r.into())) + // Minimum execution time: 2_115_000 picoseconds. + Weight::from_parts(2_170_000, 0) + // Standard Error: 7_943 + .saturating_add(Weight::from_parts(1_185_174, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 4_020 - .saturating_add(Weight::from_parts(618_071, 0).saturating_mul(r.into())) + // Minimum execution time: 2_139_000 picoseconds. + Weight::from_parts(2_183_000, 0) + // Standard Error: 4_608 + .saturating_add(Weight::from_parts(563_329, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_239_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 7_192 - .saturating_add(Weight::from_parts(1_061_312, 0).saturating_mul(r.into())) + // Minimum execution time: 2_144_000 picoseconds. + Weight::from_parts(2_178_000, 0) + // Standard Error: 6_727 + .saturating_add(Weight::from_parts(1_000_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_245_000, 0) - // Standard Error: 3_756 - .saturating_add(Weight::from_parts(568_744, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(2_212_000, 0) + // Standard Error: 3_536 + .saturating_add(Weight::from_parts(504_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(2_324_000, 0) - // Standard Error: 7_917 - .saturating_add(Weight::from_parts(1_106_132, 0).saturating_mul(r.into())) + // Minimum execution time: 2_167_000 picoseconds. + Weight::from_parts(2_218_000, 0) + // Standard Error: 7_170 + .saturating_add(Weight::from_parts(966_365, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_205_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 4_617 - .saturating_add(Weight::from_parts(599_461, 0).saturating_mul(r.into())) + // Minimum execution time: 2_149_000 picoseconds. + Weight::from_parts(140_768, 0) + // Standard Error: 5_221 + .saturating_add(Weight::from_parts(551_550, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_215_000 picoseconds. - Weight::from_parts(2_346_000, 0) - // Standard Error: 7_501 - .saturating_add(Weight::from_parts(1_125_645, 0).saturating_mul(r.into())) + // Minimum execution time: 2_122_000 picoseconds. + Weight::from_parts(2_159_000, 0) + // Standard Error: 7_621 + .saturating_add(Weight::from_parts(997_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 5_262 - .saturating_add(Weight::from_parts(624_680, 0).saturating_mul(r.into())) + // Minimum execution time: 2_069_000 picoseconds. + Weight::from_parts(2_106_000, 0) + // Standard Error: 3_980 + .saturating_add(Weight::from_parts(537_014, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 7_879 - .saturating_add(Weight::from_parts(1_068_877, 0).saturating_mul(r.into())) + // Minimum execution time: 2_097_000 picoseconds. + Weight::from_parts(2_191_000, 0) + // Standard Error: 9_419 + .saturating_add(Weight::from_parts(1_050_292, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(2_288_000, 0) - // Standard Error: 4_124 - .saturating_add(Weight::from_parts(567_690, 0).saturating_mul(r.into())) + // Minimum execution time: 2_051_000 picoseconds. + Weight::from_parts(2_118_000, 0) + // Standard Error: 4_228 + .saturating_add(Weight::from_parts(529_158, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 8_516 - .saturating_add(Weight::from_parts(1_174_764, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_116_000, 0) + // Standard Error: 7_792 + .saturating_add(Weight::from_parts(1_027_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_171_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 4_901 - .saturating_add(Weight::from_parts(628_068, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 4_450 + .saturating_add(Weight::from_parts(534_724, 0).saturating_mul(r.into())) } } diff --git a/runtime/gear/src/weights/pallet_gear_voucher.rs b/runtime/gear/src/weights/pallet_gear_voucher.rs index 9ce90d81e6b..d7bf678ab76 100644 --- a/runtime/gear/src/weights/pallet_gear_voucher.rs +++ b/runtime/gear/src/weights/pallet_gear_voucher.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear_voucher //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -47,8 +47,8 @@ impl pallet_gear_voucher::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 28_703_000 picoseconds. - Weight::from_parts(29_520_000, 6196) + // Minimum execution time: 26_245_000 picoseconds. + Weight::from_parts(26_820_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -60,8 +60,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 28_703_000 picoseconds. - Weight::from_parts(29_520_000, 6196) + // Minimum execution time: 26_245_000 picoseconds. + Weight::from_parts(26_820_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/runtime/gear/src/weights/pallet_timestamp.rs b/runtime/gear/src/weights/pallet_timestamp.rs index bddda071d0f..63568a7b1ca 100644 --- a/runtime/gear/src/weights/pallet_timestamp.rs +++ b/runtime/gear/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -48,8 +48,8 @@ impl pallet_timestamp::WeightInfo for SubstrateWeight pallet_timestamp::WeightInfo for SubstrateWeight pallet_utility::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_618_000 picoseconds. - Weight::from_parts(13_560_220, 0) - // Standard Error: 5_243 - .saturating_add(Weight::from_parts(3_938_406, 0).saturating_mul(c.into())) + // Minimum execution time: 5_492_000 picoseconds. + Weight::from_parts(16_501_612, 0) + // Standard Error: 5_305 + .saturating_add(Weight::from_parts(3_940_106, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_826_000 picoseconds. - Weight::from_parts(4_114_000, 0) + // Minimum execution time: 3_541_000 picoseconds. + Weight::from_parts(3_734_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_376_000 picoseconds. - Weight::from_parts(4_303_245, 0) - // Standard Error: 7_216 - .saturating_add(Weight::from_parts(4_194_979, 0).saturating_mul(c.into())) + // Minimum execution time: 5_273_000 picoseconds. + Weight::from_parts(19_870_279, 0) + // Standard Error: 3_599 + .saturating_add(Weight::from_parts(4_086_216, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_307_000 picoseconds. - Weight::from_parts(7_643_000, 0) + // Minimum execution time: 6_999_000 picoseconds. + Weight::from_parts(7_200_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_123_000 picoseconds. - Weight::from_parts(5_780_504, 0) - // Standard Error: 7_424 - .saturating_add(Weight::from_parts(3_988_181, 0).saturating_mul(c.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(11_706_819, 0) + // Standard Error: 4_999 + .saturating_add(Weight::from_parts(3_962_138, 0).saturating_mul(c.into())) } } @@ -100,43 +100,43 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_618_000 picoseconds. - Weight::from_parts(13_560_220, 0) - // Standard Error: 5_243 - .saturating_add(Weight::from_parts(3_938_406, 0).saturating_mul(c.into())) + // Minimum execution time: 5_492_000 picoseconds. + Weight::from_parts(16_501_612, 0) + // Standard Error: 5_305 + .saturating_add(Weight::from_parts(3_940_106, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_826_000 picoseconds. - Weight::from_parts(4_114_000, 0) + // Minimum execution time: 3_541_000 picoseconds. + Weight::from_parts(3_734_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_376_000 picoseconds. - Weight::from_parts(4_303_245, 0) - // Standard Error: 7_216 - .saturating_add(Weight::from_parts(4_194_979, 0).saturating_mul(c.into())) + // Minimum execution time: 5_273_000 picoseconds. + Weight::from_parts(19_870_279, 0) + // Standard Error: 3_599 + .saturating_add(Weight::from_parts(4_086_216, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_307_000 picoseconds. - Weight::from_parts(7_643_000, 0) + // Minimum execution time: 6_999_000 picoseconds. + Weight::from_parts(7_200_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_123_000 picoseconds. - Weight::from_parts(5_780_504, 0) - // Standard Error: 7_424 - .saturating_add(Weight::from_parts(3_988_181, 0).saturating_mul(c.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(11_706_819, 0) + // Standard Error: 4_999 + .saturating_add(Weight::from_parts(3_962_138, 0).saturating_mul(c.into())) } } diff --git a/runtime/vara/src/tests.rs b/runtime/vara/src/tests.rs index 1151b53d08e..e74dec9b53b 100644 --- a/runtime/vara/src/tests.rs +++ b/runtime/vara/src/tests.rs @@ -31,7 +31,7 @@ fn instruction_weights_heuristics_test() { version: 0, _phantom: core::marker::PhantomData, - i64const: 150, + i64const: 160, i64load: 7_000, i32load: 8_000, i64store: 29_000, diff --git a/runtime/vara/src/weights/frame_system.rs b/runtime/vara/src/weights/frame_system.rs index d2c4cc19e52..3592fb36d2d 100644 --- a/runtime/vara/src/weights/frame_system.rs +++ b/runtime/vara/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_545_000 picoseconds. - Weight::from_parts(1_316_572, 0) + // Minimum execution time: 1_503_000 picoseconds. + Weight::from_parts(1_491_824, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(459, 0).saturating_mul(b.into())) } @@ -63,17 +63,17 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_923_000 picoseconds. - Weight::from_parts(6_124_000, 0) + // Minimum execution time: 5_709_000 picoseconds. + Weight::from_parts(5_959_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_437, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_440, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_063_000 picoseconds. - Weight::from_parts(3_389_000, 1485) + // Minimum execution time: 2_908_000 picoseconds. + Weight::from_parts(3_176_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -82,10 +82,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_641_000 picoseconds. - Weight::from_parts(1_707_000, 0) - // Standard Error: 959 - .saturating_add(Weight::from_parts(686_028, 0).saturating_mul(i.into())) + // Minimum execution time: 1_503_000 picoseconds. + Weight::from_parts(1_602_000, 0) + // Standard Error: 1_020 + .saturating_add(Weight::from_parts(676_199, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -93,10 +93,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_644_000 picoseconds. - Weight::from_parts(1_678_000, 0) - // Standard Error: 747 - .saturating_add(Weight::from_parts(524_085, 0).saturating_mul(i.into())) + // Minimum execution time: 1_477_000 picoseconds. + Weight::from_parts(1_606_000, 0) + // Standard Error: 751 + .saturating_add(Weight::from_parts(523_999, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -104,10 +104,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `82 + p * (69 ±0)` // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 3_294_000 picoseconds. - Weight::from_parts(3_471_000, 83) - // Standard Error: 1_159 - .saturating_add(Weight::from_parts(1_110_583, 0).saturating_mul(p.into())) + // Minimum execution time: 3_270_000 picoseconds. + Weight::from_parts(3_354_000, 83) + // Standard Error: 1_375 + .saturating_add(Weight::from_parts(1_112_948, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -121,8 +121,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_545_000 picoseconds. - Weight::from_parts(1_316_572, 0) + // Minimum execution time: 1_503_000 picoseconds. + Weight::from_parts(1_491_824, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(459, 0).saturating_mul(b.into())) } @@ -131,17 +131,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_923_000 picoseconds. - Weight::from_parts(6_124_000, 0) + // Minimum execution time: 5_709_000 picoseconds. + Weight::from_parts(5_959_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_437, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_440, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_063_000 picoseconds. - Weight::from_parts(3_389_000, 1485) + // Minimum execution time: 2_908_000 picoseconds. + Weight::from_parts(3_176_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -150,10 +150,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_641_000 picoseconds. - Weight::from_parts(1_707_000, 0) - // Standard Error: 959 - .saturating_add(Weight::from_parts(686_028, 0).saturating_mul(i.into())) + // Minimum execution time: 1_503_000 picoseconds. + Weight::from_parts(1_602_000, 0) + // Standard Error: 1_020 + .saturating_add(Weight::from_parts(676_199, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -161,10 +161,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_644_000 picoseconds. - Weight::from_parts(1_678_000, 0) - // Standard Error: 747 - .saturating_add(Weight::from_parts(524_085, 0).saturating_mul(i.into())) + // Minimum execution time: 1_477_000 picoseconds. + Weight::from_parts(1_606_000, 0) + // Standard Error: 751 + .saturating_add(Weight::from_parts(523_999, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -172,10 +172,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `82 + p * (69 ±0)` // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 3_294_000 picoseconds. - Weight::from_parts(3_471_000, 83) - // Standard Error: 1_159 - .saturating_add(Weight::from_parts(1_110_583, 0).saturating_mul(p.into())) + // Minimum execution time: 3_270_000 picoseconds. + Weight::from_parts(3_354_000, 83) + // Standard Error: 1_375 + .saturating_add(Weight::from_parts(1_112_948, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/runtime/vara/src/weights/pallet_airdrop.rs b/runtime/vara/src/weights/pallet_airdrop.rs index 62ae1a74e8d..86ac421788d 100644 --- a/runtime/vara/src/weights/pallet_airdrop.rs +++ b/runtime/vara/src/weights/pallet_airdrop.rs @@ -19,13 +19,13 @@ //! Autogenerated weights for pallet_airdrop //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_airdrop --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallet_airdrop.rs --template=.maintain/frame-weight-template.hbs +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_airdrop --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_airdrop.rs --template=.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -49,20 +49,18 @@ impl pallet_airdrop::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 25_027_000 picoseconds. - Weight::from_parts(25_985_030, 6196) + // Minimum execution time: 24_965_000 picoseconds. + Weight::from_parts(26_088_278, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { + fn transfer_vested(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `550` // Estimated: `15482` - // Minimum execution time: 65_271_000 picoseconds. - Weight::from_parts(67_109_074, 15482) - // Standard Error: 328 - .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) + // Minimum execution time: 65_471_000 picoseconds. + Weight::from_parts(67_416_608, 15482) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -75,20 +73,18 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 25_027_000 picoseconds. - Weight::from_parts(25_985_030, 6196) + // Minimum execution time: 24_965_000 picoseconds. + Weight::from_parts(26_088_278, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { + fn transfer_vested(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `550` // Estimated: `15482` - // Minimum execution time: 65_271_000 picoseconds. - Weight::from_parts(67_109_074, 15482) - // Standard Error: 328 - .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) + // Minimum execution time: 65_471_000 picoseconds. + Weight::from_parts(67_416_608, 15482) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } diff --git a/runtime/vara/src/weights/pallet_balances.rs b/runtime/vara/src/weights/pallet_balances.rs index 7c5d3c9d263..a9486cc0e2e 100644 --- a/runtime/vara/src/weights/pallet_balances.rs +++ b/runtime/vara/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_720_000 picoseconds. - Weight::from_parts(32_331_000, 3593) + // Minimum execution time: 29_934_000 picoseconds. + Weight::from_parts(30_505_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -62,8 +62,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 23_027_000 picoseconds. - Weight::from_parts(23_472_000, 3593) + // Minimum execution time: 21_441_000 picoseconds. + Weight::from_parts(22_000_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -71,8 +71,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_856_000 picoseconds. - Weight::from_parts(13_281_000, 3593) + // Minimum execution time: 12_250_000 picoseconds. + Weight::from_parts(12_703_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +80,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_656_000 picoseconds. - Weight::from_parts(16_124_000, 3593) + // Minimum execution time: 15_163_000 picoseconds. + Weight::from_parts(15_565_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -89,8 +89,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 33_238_000 picoseconds. - Weight::from_parts(33_914_000, 6196) + // Minimum execution time: 31_518_000 picoseconds. + Weight::from_parts(31_923_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -98,8 +98,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_167_000 picoseconds. - Weight::from_parts(29_692_000, 3593) + // Minimum execution time: 27_693_000 picoseconds. + Weight::from_parts(28_166_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,8 +107,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_557_000 picoseconds. - Weight::from_parts(12_942_000, 3593) + // Minimum execution time: 11_670_000 picoseconds. + Weight::from_parts(12_112_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +120,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 31_720_000 picoseconds. - Weight::from_parts(32_331_000, 3593) + // Minimum execution time: 29_934_000 picoseconds. + Weight::from_parts(30_505_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -129,8 +129,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 23_027_000 picoseconds. - Weight::from_parts(23_472_000, 3593) + // Minimum execution time: 21_441_000 picoseconds. + Weight::from_parts(22_000_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_856_000 picoseconds. - Weight::from_parts(13_281_000, 3593) + // Minimum execution time: 12_250_000 picoseconds. + Weight::from_parts(12_703_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -147,8 +147,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_656_000 picoseconds. - Weight::from_parts(16_124_000, 3593) + // Minimum execution time: 15_163_000 picoseconds. + Weight::from_parts(15_565_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -156,8 +156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 33_238_000 picoseconds. - Weight::from_parts(33_914_000, 6196) + // Minimum execution time: 31_518_000 picoseconds. + Weight::from_parts(31_923_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -165,8 +165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_167_000 picoseconds. - Weight::from_parts(29_692_000, 3593) + // Minimum execution time: 27_693_000 picoseconds. + Weight::from_parts(28_166_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -174,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_557_000 picoseconds. - Weight::from_parts(12_942_000, 3593) + // Minimum execution time: 11_670_000 picoseconds. + Weight::from_parts(12_112_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/runtime/vara/src/weights/pallet_gear.rs b/runtime/vara/src/weights/pallet_gear.rs index 89a72918825..5ad37564e7b 100644 --- a/runtime/vara/src/weights/pallet_gear.rs +++ b/runtime/vara/src/weights/pallet_gear.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -246,10 +246,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_003_000 picoseconds. - Weight::from_parts(1_051_000, 0) - // Standard Error: 968 - .saturating_add(Weight::from_parts(212_482, 0).saturating_mul(c.into())) + // Minimum execution time: 1_017_000 picoseconds. + Weight::from_parts(1_119_000, 0) + // Standard Error: 761 + .saturating_add(Weight::from_parts(209_074, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -257,10 +257,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `113 + c * (1024 ±0)` // Estimated: `3577 + c * (1024 ±0)` - // Minimum execution time: 3_267_000 picoseconds. - Weight::from_parts(3_316_000, 3577) - // Standard Error: 1_072 - .saturating_add(Weight::from_parts(688_242, 0).saturating_mul(c.into())) + // Minimum execution time: 3_299_000 picoseconds. + Weight::from_parts(3_409_000, 3577) + // Standard Error: 809 + .saturating_add(Weight::from_parts(667_635, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -269,17 +269,17 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 53_248_000 picoseconds. - Weight::from_parts(71_345_881, 0) - // Standard Error: 10_707 - .saturating_add(Weight::from_parts(2_548_249, 0).saturating_mul(c.into())) + // Minimum execution time: 50_278_000 picoseconds. + Weight::from_parts(73_427_731, 0) + // Standard Error: 6_473 + .saturating_add(Weight::from_parts(2_331_768, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1050` // Estimated: `42875` - // Minimum execution time: 84_992_000 picoseconds. - Weight::from_parts(88_176_000, 42875) + // Minimum execution time: 81_857_000 picoseconds. + Weight::from_parts(83_494_000, 42875) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -287,8 +287,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `958` // Estimated: `21477` - // Minimum execution time: 56_951_000 picoseconds. - Weight::from_parts(58_755_000, 21477) + // Minimum execution time: 53_880_000 picoseconds. + Weight::from_parts(55_703_000, 21477) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -296,8 +296,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `605` // Estimated: `17354` - // Minimum execution time: 30_483_000 picoseconds. - Weight::from_parts(31_174_000, 17354) + // Minimum execution time: 28_976_000 picoseconds. + Weight::from_parts(30_055_000, 17354) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -306,10 +306,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_269_000 picoseconds. - Weight::from_parts(7_343_300, 7640) - // Standard Error: 45_015 - .saturating_add(Weight::from_parts(15_758_869, 0).saturating_mul(c.into())) + // Minimum execution time: 7_954_000 picoseconds. + Weight::from_parts(9_206_629, 7640) + // Standard Error: 40_915 + .saturating_add(Weight::from_parts(13_218_946, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -318,10 +318,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1439 + c * (16389 ±0)` // Estimated: `42034 + c * (131112 ±0)` - // Minimum execution time: 70_643_000 picoseconds. - Weight::from_parts(71_487_000, 42034) - // Standard Error: 217_960 - .saturating_add(Weight::from_parts(56_304_860, 0).saturating_mul(c.into())) + // Minimum execution time: 69_036_000 picoseconds. + Weight::from_parts(70_072_000, 42034) + // Standard Error: 149_794 + .saturating_add(Weight::from_parts(52_674_750, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -332,10 +332,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `80` // Estimated: `5270` - // Minimum execution time: 63_871_000 picoseconds. - Weight::from_parts(31_431_372, 5270) - // Standard Error: 58_224 - .saturating_add(Weight::from_parts(52_560_364, 0).saturating_mul(c.into())) + // Minimum execution time: 61_042_000 picoseconds. + Weight::from_parts(42_647_149, 5270) + // Standard Error: 41_151 + .saturating_add(Weight::from_parts(51_906_843, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -344,10 +344,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `742` // Estimated: `39419` - // Minimum execution time: 65_988_000 picoseconds. - Weight::from_parts(102_441_114, 39419) - // Standard Error: 1 - .saturating_add(Weight::from_parts(2_612, 0).saturating_mul(s.into())) + // Minimum execution time: 62_956_000 picoseconds. + Weight::from_parts(74_593_794, 39419) + // Standard Error: 0 + .saturating_add(Weight::from_parts(2_594, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -357,12 +357,12 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `306` // Estimated: `35235` - // Minimum execution time: 11_021_135_000 picoseconds. - Weight::from_parts(397_699_856, 35235) - // Standard Error: 169_994 - .saturating_add(Weight::from_parts(52_665_060, 0).saturating_mul(c.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(2_533, 0).saturating_mul(s.into())) + // Minimum execution time: 10_939_548_000 picoseconds. + Weight::from_parts(505_483_291, 35235) + // Standard Error: 158_935 + .saturating_add(Weight::from_parts(51_999_053, 0).saturating_mul(c.into())) + // Standard Error: 9 + .saturating_add(Weight::from_parts(2_500, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)) } @@ -371,10 +371,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `349` // Estimated: `23860` - // Minimum execution time: 57_013_000 picoseconds. - Weight::from_parts(35_413_717, 23860) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_158, 0).saturating_mul(p.into())) + // Minimum execution time: 54_714_000 picoseconds. + Weight::from_parts(39_682_905, 23860) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_012, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -383,10 +383,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `452` // Estimated: `27184` - // Minimum execution time: 60_180_000 picoseconds. - Weight::from_parts(33_390_466, 27184) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_167, 0).saturating_mul(p.into())) + // Minimum execution time: 56_333_000 picoseconds. + Weight::from_parts(38_749_450, 27184) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(10_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) } @@ -395,10 +395,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1049` // Estimated: `42866` - // Minimum execution time: 87_446_000 picoseconds. - Weight::from_parts(69_330_706, 42866) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_174, 0).saturating_mul(p.into())) + // Minimum execution time: 82_073_000 picoseconds. + Weight::from_parts(66_860_069, 42866) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -407,20 +407,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1152` // Estimated: `46396` - // Minimum execution time: 97_152_000 picoseconds. - Weight::from_parts(77_891_346, 46396) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_170, 0).saturating_mul(p.into())) + // Minimum execution time: 92_361_000 picoseconds. + Weight::from_parts(69_850_521, 46396) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_052, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(14_u64)) .saturating_add(T::DbWeight::get().writes(11_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(_q: u32, ) -> Weight { + fn initial_allocation(q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85981` - // Minimum execution time: 323_882_000 picoseconds. - Weight::from_parts(336_539_045, 85981) + // Minimum execution time: 316_122_000 picoseconds. + Weight::from_parts(330_387_653, 85981) + // Standard Error: 1_030 + .saturating_add(Weight::from_parts(2_167, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().writes(23_u64)) } @@ -429,8 +431,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85905` - // Minimum execution time: 336_406_000 picoseconds. - Weight::from_parts(353_807_338, 85905) + // Minimum execution time: 327_296_000 picoseconds. + Weight::from_parts(344_778_587, 85905) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().writes(23_u64)) } @@ -439,10 +441,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_464_000 picoseconds. - Weight::from_parts(45_831_000, 3899) - // Standard Error: 36_617 - .saturating_add(Weight::from_parts(51_273_892, 0).saturating_mul(c.into())) + // Minimum execution time: 45_031_000 picoseconds. + Weight::from_parts(45_572_000, 3899) + // Standard Error: 24_669 + .saturating_add(Weight::from_parts(50_090_777, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -452,630 +454,630 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_254_000 picoseconds. - Weight::from_parts(86_749_000, 0) - // Standard Error: 3_967_638 - .saturating_add(Weight::from_parts(617_894_062, 0).saturating_mul(r.into())) + // Minimum execution time: 83_663_000 picoseconds. + Weight::from_parts(84_983_000, 0) + // Standard Error: 4_066_232 + .saturating_add(Weight::from_parts(564_447_416, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 366_392_000 picoseconds. - Weight::from_parts(294_624_660, 0) - // Standard Error: 10_067 - .saturating_add(Weight::from_parts(30_802_641, 0).saturating_mul(p.into())) + // Minimum execution time: 311_448_000 picoseconds. + Weight::from_parts(245_631_815, 0) + // Standard Error: 7_937 + .saturating_add(Weight::from_parts(30_896_737, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 199_070_000 picoseconds. - Weight::from_parts(213_938_845, 0) - // Standard Error: 343_895 - .saturating_add(Weight::from_parts(120_152_478, 0).saturating_mul(r.into())) + // Minimum execution time: 149_067_000 picoseconds. + Weight::from_parts(130_181_921, 0) + // Standard Error: 294_281 + .saturating_add(Weight::from_parts(60_998_326, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_714_000 picoseconds. - Weight::from_parts(96_261_609, 0) - // Standard Error: 3_991 - .saturating_add(Weight::from_parts(3_567_375, 0).saturating_mul(r.into())) + // Minimum execution time: 87_222_000 picoseconds. + Weight::from_parts(94_195_714, 0) + // Standard Error: 3_616 + .saturating_add(Weight::from_parts(2_672_494, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_882_000 picoseconds. - Weight::from_parts(221_553_985, 0) - // Standard Error: 29_743 - .saturating_add(Weight::from_parts(3_602_987, 0).saturating_mul(r.into())) + // Minimum execution time: 139_429_000 picoseconds. + Weight::from_parts(171_049_360, 0) + // Standard Error: 31_588 + .saturating_add(Weight::from_parts(2_923_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_497_000 picoseconds. - Weight::from_parts(118_603_695, 0) - // Standard Error: 431_810 - .saturating_add(Weight::from_parts(177_456_338, 0).saturating_mul(r.into())) + // Minimum execution time: 86_992_000 picoseconds. + Weight::from_parts(115_936_976, 0) + // Standard Error: 414_340 + .saturating_add(Weight::from_parts(116_785_346, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_831_000 picoseconds. - Weight::from_parts(88_005_607, 0) - // Standard Error: 244_708 - .saturating_add(Weight::from_parts(175_744_834, 0).saturating_mul(r.into())) + // Minimum execution time: 87_790_000 picoseconds. + Weight::from_parts(90_746_200, 0) + // Standard Error: 270_835 + .saturating_add(Weight::from_parts(107_416_174, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_145_000 picoseconds. - Weight::from_parts(86_969_872, 0) - // Standard Error: 302_008 - .saturating_add(Weight::from_parts(180_744_297, 0).saturating_mul(r.into())) + // Minimum execution time: 84_210_000 picoseconds. + Weight::from_parts(91_082_335, 0) + // Standard Error: 211_867 + .saturating_add(Weight::from_parts(104_318_383, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_337_000 picoseconds. - Weight::from_parts(80_268_581, 0) - // Standard Error: 290_578 - .saturating_add(Weight::from_parts(180_541_423, 0).saturating_mul(r.into())) + // Minimum execution time: 84_806_000 picoseconds. + Weight::from_parts(85_438_969, 0) + // Standard Error: 248_652 + .saturating_add(Weight::from_parts(105_330_427, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_327_000 picoseconds. - Weight::from_parts(84_307_332, 0) - // Standard Error: 316_639 - .saturating_add(Weight::from_parts(179_561_839, 0).saturating_mul(r.into())) + // Minimum execution time: 84_654_000 picoseconds. + Weight::from_parts(82_257_210, 0) + // Standard Error: 336_548 + .saturating_add(Weight::from_parts(106_454_200, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_300_000 picoseconds. - Weight::from_parts(70_645_226, 0) - // Standard Error: 320_673 - .saturating_add(Weight::from_parts(182_342_085, 0).saturating_mul(r.into())) + // Minimum execution time: 84_452_000 picoseconds. + Weight::from_parts(82_661_045, 0) + // Standard Error: 286_452 + .saturating_add(Weight::from_parts(105_467_642, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_250_000 picoseconds. - Weight::from_parts(81_902_510, 0) - // Standard Error: 273_253 - .saturating_add(Weight::from_parts(180_582_426, 0).saturating_mul(r.into())) + // Minimum execution time: 84_893_000 picoseconds. + Weight::from_parts(81_216_834, 0) + // Standard Error: 315_266 + .saturating_add(Weight::from_parts(107_016_702, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_232_000 picoseconds. - Weight::from_parts(87_259_581, 0) - // Standard Error: 294_035 - .saturating_add(Weight::from_parts(175_294_464, 0).saturating_mul(r.into())) + // Minimum execution time: 85_282_000 picoseconds. + Weight::from_parts(82_548_887, 0) + // Standard Error: 341_172 + .saturating_add(Weight::from_parts(105_504_622, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 595_636_000 picoseconds. - Weight::from_parts(656_136_663, 0) - // Standard Error: 485_302 - .saturating_add(Weight::from_parts(261_855_478, 0).saturating_mul(r.into())) + // Minimum execution time: 556_352_000 picoseconds. + Weight::from_parts(607_493_748, 0) + // Standard Error: 448_674 + .saturating_add(Weight::from_parts(184_670_390, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 850_360_000 picoseconds. - Weight::from_parts(903_367_000, 0) - // Standard Error: 55_203 - .saturating_add(Weight::from_parts(13_094_816, 0).saturating_mul(n.into())) + // Minimum execution time: 714_496_000 picoseconds. + Weight::from_parts(722_520_000, 0) + // Standard Error: 46_538 + .saturating_add(Weight::from_parts(13_033_234, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_957_000 picoseconds. - Weight::from_parts(87_586_547, 0) - // Standard Error: 323_063 - .saturating_add(Weight::from_parts(174_117_671, 0).saturating_mul(r.into())) + // Minimum execution time: 85_627_000 picoseconds. + Weight::from_parts(85_563_243, 0) + // Standard Error: 311_752 + .saturating_add(Weight::from_parts(105_877_332, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_008_000 picoseconds. - Weight::from_parts(78_303_076, 0) - // Standard Error: 299_495 - .saturating_add(Weight::from_parts(175_222_715, 0).saturating_mul(r.into())) + // Minimum execution time: 86_852_000 picoseconds. + Weight::from_parts(84_860_381, 0) + // Standard Error: 321_988 + .saturating_add(Weight::from_parts(105_008_310, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_234_000 picoseconds. - Weight::from_parts(103_801_859, 0) - // Standard Error: 382_198 - .saturating_add(Weight::from_parts(245_171_881, 0).saturating_mul(n.into())) + // Minimum execution time: 84_396_000 picoseconds. + Weight::from_parts(89_972_413, 0) + // Standard Error: 338_324 + .saturating_add(Weight::from_parts(184_316_536, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_211_000 picoseconds. - Weight::from_parts(87_766_000, 0) - // Standard Error: 4_237_435 - .saturating_add(Weight::from_parts(1_076_031_771, 0).saturating_mul(r.into())) + // Minimum execution time: 89_385_000 picoseconds. + Weight::from_parts(90_760_000, 0) + // Standard Error: 4_378_367 + .saturating_add(Weight::from_parts(914_427_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_722_000 picoseconds. - Weight::from_parts(144_011_827, 0) - // Standard Error: 476_324 - .saturating_add(Weight::from_parts(387_231_993, 0).saturating_mul(r.into())) + // Minimum execution time: 86_060_000 picoseconds. + Weight::from_parts(138_647_807, 0) + // Standard Error: 449_220 + .saturating_add(Weight::from_parts(301_188_566, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 461_434_000 picoseconds. - Weight::from_parts(469_780_000, 0) - // Standard Error: 61_125 - .saturating_add(Weight::from_parts(21_613_603, 0).saturating_mul(n.into())) + // Minimum execution time: 391_797_000 picoseconds. + Weight::from_parts(394_943_000, 0) + // Standard Error: 58_663 + .saturating_add(Weight::from_parts(21_187_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_818_000 picoseconds. - Weight::from_parts(149_809_757, 0) - // Standard Error: 456_443 - .saturating_add(Weight::from_parts(395_488_333, 0).saturating_mul(r.into())) + // Minimum execution time: 85_418_000 picoseconds. + Weight::from_parts(149_848_797, 0) + // Standard Error: 459_492 + .saturating_add(Weight::from_parts(308_230_219, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 479_154_000 picoseconds. - Weight::from_parts(483_278_000, 0) - // Standard Error: 67_159 - .saturating_add(Weight::from_parts(21_947_194, 0).saturating_mul(n.into())) + // Minimum execution time: 390_635_000 picoseconds. + Weight::from_parts(395_782_000, 0) + // Standard Error: 61_326 + .saturating_add(Weight::from_parts(20_818_419, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 567_500_000 picoseconds. - Weight::from_parts(693_644_323, 0) - // Standard Error: 568_410 - .saturating_add(Weight::from_parts(412_109_027, 0).saturating_mul(r.into())) + // Minimum execution time: 561_280_000 picoseconds. + Weight::from_parts(634_390_717, 0) + // Standard Error: 473_236 + .saturating_add(Weight::from_parts(316_661_157, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 575_808_000 picoseconds. - Weight::from_parts(724_736_213, 0) - // Standard Error: 602_935 - .saturating_add(Weight::from_parts(412_885_093, 0).saturating_mul(r.into())) + // Minimum execution time: 559_804_000 picoseconds. + Weight::from_parts(650_695_494, 0) + // Standard Error: 489_218 + .saturating_add(Weight::from_parts(321_789_584, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_691_000 picoseconds. - Weight::from_parts(74_497_929, 0) - // Standard Error: 328_672 - .saturating_add(Weight::from_parts(197_295_056, 0).saturating_mul(r.into())) + // Minimum execution time: 86_345_000 picoseconds. + Weight::from_parts(74_080_057, 0) + // Standard Error: 328_119 + .saturating_add(Weight::from_parts(116_742_827, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_899_275_000 picoseconds. - Weight::from_parts(4_052_914_766, 0) - // Standard Error: 433_071 - .saturating_add(Weight::from_parts(279_414_467, 0).saturating_mul(r.into())) + // Minimum execution time: 2_307_192_000 picoseconds. + Weight::from_parts(2_419_334_440, 0) + // Standard Error: 484_032 + .saturating_add(Weight::from_parts(211_293_866, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 481_093_000 picoseconds. - Weight::from_parts(489_651_000, 0) - // Standard Error: 58_131 - .saturating_add(Weight::from_parts(29_725_779, 0).saturating_mul(n.into())) + // Minimum execution time: 346_160_000 picoseconds. + Weight::from_parts(348_777_000, 0) + // Standard Error: 58_661 + .saturating_add(Weight::from_parts(29_434_095, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_898_930_000 picoseconds. - Weight::from_parts(4_051_051_643, 0) - // Standard Error: 422_685 - .saturating_add(Weight::from_parts(335_909_883, 0).saturating_mul(r.into())) + // Minimum execution time: 2_292_607_000 picoseconds. + Weight::from_parts(2_434_102_108, 0) + // Standard Error: 502_502 + .saturating_add(Weight::from_parts(264_859_383, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_889_863_000 picoseconds. - Weight::from_parts(4_037_859_582, 0) - // Standard Error: 492_684 - .saturating_add(Weight::from_parts(354_039_027, 0).saturating_mul(r.into())) + // Minimum execution time: 2_289_426_000 picoseconds. + Weight::from_parts(2_437_443_919, 0) + // Standard Error: 471_320 + .saturating_add(Weight::from_parts(268_510_540, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 254_292_000 picoseconds. - Weight::from_parts(299_243_857, 0) - // Standard Error: 453_209 - .saturating_add(Weight::from_parts(402_577_817, 0).saturating_mul(r.into())) + // Minimum execution time: 242_827_000 picoseconds. + Weight::from_parts(291_906_943, 0) + // Standard Error: 419_132 + .saturating_add(Weight::from_parts(316_375_969, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 654_055_000 picoseconds. - Weight::from_parts(663_310_000, 0) - // Standard Error: 60_031 - .saturating_add(Weight::from_parts(21_652_831, 0).saturating_mul(n.into())) + // Minimum execution time: 554_876_000 picoseconds. + Weight::from_parts(559_277_000, 0) + // Standard Error: 59_610 + .saturating_add(Weight::from_parts(21_490_976, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_054_583_000 picoseconds. - Weight::from_parts(4_192_801_478, 0) - // Standard Error: 494_878 - .saturating_add(Weight::from_parts(356_698_705, 0).saturating_mul(r.into())) + // Minimum execution time: 2_443_317_000 picoseconds. + Weight::from_parts(2_625_227_536, 0) + // Standard Error: 511_289 + .saturating_add(Weight::from_parts(283_117_268, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_037_000 picoseconds. - Weight::from_parts(88_828_036, 0) - // Standard Error: 335_490 - .saturating_add(Weight::from_parts(26_597_063, 0).saturating_mul(r.into())) + // Minimum execution time: 85_099_000 picoseconds. + Weight::from_parts(88_574_604, 0) + // Standard Error: 274_173 + .saturating_add(Weight::from_parts(20_834_495, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 108_733_000 picoseconds. - Weight::from_parts(93_898_943, 0) - // Standard Error: 1_151 - .saturating_add(Weight::from_parts(428_904, 0).saturating_mul(n.into())) + // Minimum execution time: 102_246_000 picoseconds. + Weight::from_parts(90_382_254, 0) + // Standard Error: 1_257 + .saturating_add(Weight::from_parts(428_781, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_569_000 picoseconds. - Weight::from_parts(89_213_638, 0) - // Standard Error: 317_917 - .saturating_add(Weight::from_parts(22_797_961, 0).saturating_mul(r.into())) + // Minimum execution time: 86_454_000 picoseconds. + Weight::from_parts(90_235_951, 0) + // Standard Error: 256_364 + .saturating_add(Weight::from_parts(14_555_548, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_164_000 picoseconds. - Weight::from_parts(95_571_505, 0) - // Standard Error: 1_085 - .saturating_add(Weight::from_parts(425_025, 0).saturating_mul(n.into())) + // Minimum execution time: 104_189_000 picoseconds. + Weight::from_parts(91_177_961, 0) + // Standard Error: 1_127 + .saturating_add(Weight::from_parts(424_751, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_844_000 picoseconds. - Weight::from_parts(88_247_426, 0) - // Standard Error: 280_700 - .saturating_add(Weight::from_parts(17_706_873, 0).saturating_mul(r.into())) + // Minimum execution time: 84_893_000 picoseconds. + Weight::from_parts(88_684_789, 0) + // Standard Error: 287_468 + .saturating_add(Weight::from_parts(16_661_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_987_000 picoseconds. - Weight::from_parts(87_544_514, 0) - // Standard Error: 269_120 - .saturating_add(Weight::from_parts(21_098_185, 0).saturating_mul(r.into())) + // Minimum execution time: 84_534_000 picoseconds. + Weight::from_parts(88_923_020, 0) + // Standard Error: 249_896 + .saturating_add(Weight::from_parts(19_208_979, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_012_000 picoseconds. - Weight::from_parts(115_149_368, 0) - // Standard Error: 328_818 - .saturating_add(Weight::from_parts(265_684_350, 0).saturating_mul(r.into())) + // Minimum execution time: 85_229_000 picoseconds. + Weight::from_parts(120_908_395, 0) + // Standard Error: 327_109 + .saturating_add(Weight::from_parts(190_143_835, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_890_000 picoseconds. - Weight::from_parts(102_844_000, 0) - // Standard Error: 2_931 - .saturating_add(Weight::from_parts(635_797, 0).saturating_mul(n.into())) + // Minimum execution time: 98_549_000 picoseconds. + Weight::from_parts(100_553_000, 0) + // Standard Error: 2_727 + .saturating_add(Weight::from_parts(616_949, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 563_182_000 picoseconds. - Weight::from_parts(640_794_146, 0) - // Standard Error: 7_497_207 - .saturating_add(Weight::from_parts(15_239_053, 0).saturating_mul(r.into())) + // Minimum execution time: 553_918_000 picoseconds. + Weight::from_parts(572_988_848, 0) + // Standard Error: 2_210_952 + .saturating_add(Weight::from_parts(30_333_551, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 560_481_000 picoseconds. - Weight::from_parts(593_427_573, 0) - // Standard Error: 3_203_142 - .saturating_add(Weight::from_parts(25_969_526, 0).saturating_mul(r.into())) + // Minimum execution time: 552_664_000 picoseconds. + Weight::from_parts(571_824_067, 0) + // Standard Error: 1_981_598 + .saturating_add(Weight::from_parts(28_343_432, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_574_000 picoseconds. - Weight::from_parts(97_280_140, 0) - // Standard Error: 268_694 - .saturating_add(Weight::from_parts(12_092_859, 0).saturating_mul(r.into())) + // Minimum execution time: 96_114_000 picoseconds. + Weight::from_parts(99_799_695, 0) + // Standard Error: 263_342 + .saturating_add(Weight::from_parts(5_959_704, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_631_000 picoseconds. - Weight::from_parts(94_175_255, 0) - // Standard Error: 1_213 - .saturating_add(Weight::from_parts(427_553, 0).saturating_mul(n.into())) + // Minimum execution time: 104_595_000 picoseconds. + Weight::from_parts(94_900_895, 0) + // Standard Error: 1_221 + .saturating_add(Weight::from_parts(425_729, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_505_000 picoseconds. - Weight::from_parts(100_109_459, 0) - // Standard Error: 279_145 - .saturating_add(Weight::from_parts(8_335_840, 0).saturating_mul(r.into())) + // Minimum execution time: 94_123_000 picoseconds. + Weight::from_parts(99_068_002, 0) + // Standard Error: 278_340 + .saturating_add(Weight::from_parts(6_056_397, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_015_000 picoseconds. - Weight::from_parts(96_000_128, 0) - // Standard Error: 1_363 - .saturating_add(Weight::from_parts(423_685, 0).saturating_mul(n.into())) + // Minimum execution time: 106_148_000 picoseconds. + Weight::from_parts(93_583_351, 0) + // Standard Error: 1_048 + .saturating_add(Weight::from_parts(420_112, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_784_000 picoseconds. - Weight::from_parts(84_956_444, 0) - // Standard Error: 285_268 - .saturating_add(Weight::from_parts(178_346_410, 0).saturating_mul(r.into())) + // Minimum execution time: 83_951_000 picoseconds. + Weight::from_parts(80_983_069, 0) + // Standard Error: 260_297 + .saturating_add(Weight::from_parts(114_164_207, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_915_000 picoseconds. - Weight::from_parts(78_586_027, 0) - // Standard Error: 254_710 - .saturating_add(Weight::from_parts(178_243_954, 0).saturating_mul(r.into())) + // Minimum execution time: 88_991_000 picoseconds. + Weight::from_parts(83_808_552, 0) + // Standard Error: 291_596 + .saturating_add(Weight::from_parts(107_977_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 557_380_000 picoseconds. - Weight::from_parts(633_253_100, 0) - // Standard Error: 538_762 - .saturating_add(Weight::from_parts(195_061_580, 0).saturating_mul(r.into())) + // Minimum execution time: 555_192_000 picoseconds. + Weight::from_parts(637_741_196, 0) + // Standard Error: 498_770 + .saturating_add(Weight::from_parts(126_311_515, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 597_682_000 picoseconds. - Weight::from_parts(661_897_574, 0) - // Standard Error: 3_826 - .saturating_add(Weight::from_parts(136_457, 0).saturating_mul(n.into())) + // Minimum execution time: 567_642_000 picoseconds. + Weight::from_parts(587_862_774, 0) + // Standard Error: 1_100 + .saturating_add(Weight::from_parts(120_318, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_454_821_000 picoseconds. - Weight::from_parts(4_682_125_339, 0) - // Standard Error: 520_741 - .saturating_add(Weight::from_parts(206_155_172, 0).saturating_mul(r.into())) + // Minimum execution time: 2_764_152_000 picoseconds. + Weight::from_parts(2_885_803_691, 0) + // Standard Error: 562_616 + .saturating_add(Weight::from_parts(154_883_526, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_637_831_000 picoseconds. - Weight::from_parts(4_748_853_254, 0) - // Standard Error: 16_010 - .saturating_add(Weight::from_parts(12_276_105, 0).saturating_mul(n.into())) + // Minimum execution time: 2_942_765_000 picoseconds. + Weight::from_parts(2_852_597_513, 0) + // Standard Error: 14_069 + .saturating_add(Weight::from_parts(12_388_759, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_447_000 picoseconds. - Weight::from_parts(111_081_974, 0) - // Standard Error: 422_093 - .saturating_add(Weight::from_parts(195_515_962, 0).saturating_mul(r.into())) + // Minimum execution time: 85_236_000 picoseconds. + Weight::from_parts(108_121_903, 0) + // Standard Error: 338_552 + .saturating_add(Weight::from_parts(130_391_399, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 188_901_000 picoseconds. - Weight::from_parts(192_422_000, 0) - // Standard Error: 54_402 - .saturating_add(Weight::from_parts(25_703_289, 0).saturating_mul(n.into())) + // Minimum execution time: 143_555_000 picoseconds. + Weight::from_parts(145_256_000, 0) + // Standard Error: 61_456 + .saturating_add(Weight::from_parts(25_766_308, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_538_000 picoseconds. - Weight::from_parts(83_073_715, 0) - // Standard Error: 285_530 - .saturating_add(Weight::from_parts(174_178_092, 0).saturating_mul(r.into())) + // Minimum execution time: 88_706_000 picoseconds. + Weight::from_parts(82_734_112, 0) + // Standard Error: 323_634 + .saturating_add(Weight::from_parts(107_133_410, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_697_000 picoseconds. - Weight::from_parts(89_049_881, 0) - // Standard Error: 281_628 - .saturating_add(Weight::from_parts(27_362_618, 0).saturating_mul(r.into())) + // Minimum execution time: 84_050_000 picoseconds. + Weight::from_parts(88_261_802, 0) + // Standard Error: 247_640 + .saturating_add(Weight::from_parts(23_580_197, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_006_000 picoseconds. - Weight::from_parts(86_657_161, 0) - // Standard Error: 254_208 - .saturating_add(Weight::from_parts(14_853_038, 0).saturating_mul(r.into())) + // Minimum execution time: 86_558_000 picoseconds. + Weight::from_parts(90_338_028, 0) + // Standard Error: 270_999 + .saturating_add(Weight::from_parts(15_249_771, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_155_000 picoseconds. - Weight::from_parts(87_136_381, 0) - // Standard Error: 296_075 - .saturating_add(Weight::from_parts(15_564_718, 0).saturating_mul(r.into())) + // Minimum execution time: 86_250_000 picoseconds. + Weight::from_parts(90_448_269, 0) + // Standard Error: 274_039 + .saturating_add(Weight::from_parts(12_874_930, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_160_000 picoseconds. - Weight::from_parts(87_382_440, 0) - // Standard Error: 263_499 - .saturating_add(Weight::from_parts(17_288_459, 0).saturating_mul(r.into())) + // Minimum execution time: 84_278_000 picoseconds. + Weight::from_parts(88_025_842, 0) + // Standard Error: 274_359 + .saturating_add(Weight::from_parts(11_610_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_780_000 picoseconds. - Weight::from_parts(90_970_389, 0) - // Standard Error: 273_512 - .saturating_add(Weight::from_parts(14_976_210, 0).saturating_mul(r.into())) + // Minimum execution time: 83_849_000 picoseconds. + Weight::from_parts(87_858_273, 0) + // Standard Error: 263_624 + .saturating_add(Weight::from_parts(14_636_926, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 141_871_000 picoseconds. - Weight::from_parts(203_107_595, 0) - // Standard Error: 322_999 - .saturating_add(Weight::from_parts(280_023_774, 0).saturating_mul(r.into())) + // Minimum execution time: 134_444_000 picoseconds. + Weight::from_parts(198_654_906, 0) + // Standard Error: 409_120 + .saturating_add(Weight::from_parts(200_669_427, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 99_132_000 picoseconds. - Weight::from_parts(166_620_417, 0) - // Standard Error: 428_363 - .saturating_add(Weight::from_parts(469_520_431, 0).saturating_mul(r.into())) + // Minimum execution time: 97_737_000 picoseconds. + Weight::from_parts(162_389_592, 0) + // Standard Error: 437_002 + .saturating_add(Weight::from_parts(385_229_944, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1083,22 +1085,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_670_030_000 picoseconds. - Weight::from_parts(46_979_707_000, 0) - // Standard Error: 290_199 - .saturating_add(Weight::from_parts(7_295_075, 0).saturating_mul(p.into())) - // Standard Error: 290_185 - .saturating_add(Weight::from_parts(178_049_340, 0).saturating_mul(s.into())) + // Minimum execution time: 44_710_614_000 picoseconds. + Weight::from_parts(44_848_530_000, 0) + // Standard Error: 271_081 + .saturating_add(Weight::from_parts(7_518_236, 0).saturating_mul(p.into())) + // Standard Error: 271_067 + .saturating_add(Weight::from_parts(176_484_363, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_401_000 picoseconds. - Weight::from_parts(162_215_381, 0) - // Standard Error: 435_866 - .saturating_add(Weight::from_parts(479_266_464, 0).saturating_mul(r.into())) + // Minimum execution time: 93_935_000 picoseconds. + Weight::from_parts(155_283_975, 0) + // Standard Error: 398_331 + .saturating_add(Weight::from_parts(394_750_144, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1106,32 +1108,32 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 44_093_174_000 picoseconds. - Weight::from_parts(44_268_099_000, 0) - // Standard Error: 249_484 - .saturating_add(Weight::from_parts(7_595_737, 0).saturating_mul(p.into())) - // Standard Error: 249_471 - .saturating_add(Weight::from_parts(179_055_114, 0).saturating_mul(s.into())) + // Minimum execution time: 43_166_105_000 picoseconds. + Weight::from_parts(43_210_411_000, 0) + // Standard Error: 273_792 + .saturating_add(Weight::from_parts(7_685_961, 0).saturating_mul(p.into())) + // Standard Error: 273_779 + .saturating_add(Weight::from_parts(177_206_473, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_188_000 picoseconds. - Weight::from_parts(101_583_480, 0) - // Standard Error: 35_878 - .saturating_add(Weight::from_parts(3_611_568, 0).saturating_mul(r.into())) + // Minimum execution time: 86_385_000 picoseconds. + Weight::from_parts(100_368_488, 0) + // Standard Error: 25_882 + .saturating_add(Weight::from_parts(2_517_495, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 86_183_000 picoseconds. - Weight::from_parts(118_618_192, 1131) - // Standard Error: 6_832 - .saturating_add(Weight::from_parts(11_877_671, 0).saturating_mul(p.into())) + // Minimum execution time: 86_723_000 picoseconds. + Weight::from_parts(112_959_650, 1131) + // Standard Error: 5_171 + .saturating_add(Weight::from_parts(11_884_248, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1140,10 +1142,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 84_629_000 picoseconds. - Weight::from_parts(86_416_000, 1131) - // Standard Error: 28_253 - .saturating_add(Weight::from_parts(36_463_142, 0).saturating_mul(p.into())) + // Minimum execution time: 85_367_000 picoseconds. + Weight::from_parts(86_968_000, 1131) + // Standard Error: 35_935 + .saturating_add(Weight::from_parts(35_294_476, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1152,10 +1154,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_148_282_000 picoseconds. - Weight::from_parts(5_977_321_351, 5069931) - // Standard Error: 52_501 - .saturating_add(Weight::from_parts(36_684_019, 0).saturating_mul(p.into())) + // Minimum execution time: 6_166_740_000 picoseconds. + Weight::from_parts(5_878_966_706, 5069931) + // Standard Error: 72_748 + .saturating_add(Weight::from_parts(35_598_278, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1163,10 +1165,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_557_000 picoseconds. - Weight::from_parts(86_547_000, 1939) - // Standard Error: 32_777 - .saturating_add(Weight::from_parts(46_224_064, 0).saturating_mul(p.into())) + // Minimum execution time: 84_509_000 picoseconds. + Weight::from_parts(86_396_000, 1939) + // Standard Error: 37_909 + .saturating_add(Weight::from_parts(46_229_201, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1175,10 +1177,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 89_966_000 picoseconds. - Weight::from_parts(89_543_596, 1131) - // Standard Error: 68_448 - .saturating_add(Weight::from_parts(36_359_585, 0).saturating_mul(p.into())) + // Minimum execution time: 89_570_000 picoseconds. + Weight::from_parts(91_679_907, 1131) + // Standard Error: 74_102 + .saturating_add(Weight::from_parts(36_034_356, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1187,10 +1189,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 600_329_000 picoseconds. - Weight::from_parts(623_878_315, 1496) - // Standard Error: 267_055 - .saturating_add(Weight::from_parts(46_147_238, 0).saturating_mul(p.into())) + // Minimum execution time: 581_516_000 picoseconds. + Weight::from_parts(574_828_964, 1496) + // Standard Error: 226_535 + .saturating_add(Weight::from_parts(44_029_625, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1199,10 +1201,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_023_023_000 picoseconds. - Weight::from_parts(1_022_993_537, 317931) - // Standard Error: 203_791 - .saturating_add(Weight::from_parts(43_538_291, 0).saturating_mul(p.into())) + // Minimum execution time: 984_554_000 picoseconds. + Weight::from_parts(1_010_300_775, 317931) + // Standard Error: 330_750 + .saturating_add(Weight::from_parts(45_768_209, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1210,885 +1212,883 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_300_000 picoseconds. - Weight::from_parts(2_436_506, 0) - // Standard Error: 16_946 - .saturating_add(Weight::from_parts(24_493_632, 0).saturating_mul(r.into())) + // Minimum execution time: 4_399_000 picoseconds. + Weight::from_parts(2_513_898, 0) + // Standard Error: 22_468 + .saturating_add(Weight::from_parts(24_974_238, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_347_874_000 picoseconds. - Weight::from_parts(4_179_322_071, 0) - // Standard Error: 53_086 - .saturating_add(Weight::from_parts(4_505_224, 0).saturating_mul(r.into())) + // Minimum execution time: 4_354_805_000 picoseconds. + Weight::from_parts(4_247_725_842, 0) + // Standard Error: 49_167 + .saturating_add(Weight::from_parts(4_375_644, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_348_187_000 picoseconds. - Weight::from_parts(4_205_195_765, 0) - // Standard Error: 44_017 - .saturating_add(Weight::from_parts(4_404_586, 0).saturating_mul(r.into())) + // Minimum execution time: 4_344_769_000 picoseconds. + Weight::from_parts(4_143_583_164, 0) + // Standard Error: 64_865 + .saturating_add(Weight::from_parts(4_885_201, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_882_662_000 picoseconds. - Weight::from_parts(11_083_501_979, 0) - // Standard Error: 200_162 - .saturating_add(Weight::from_parts(13_165_815, 0).saturating_mul(r.into())) + // Minimum execution time: 10_321_597_000 picoseconds. + Weight::from_parts(10_856_474_625, 0) + // Standard Error: 228_480 + .saturating_add(Weight::from_parts(13_648_467, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_784_867_000 picoseconds. - Weight::from_parts(11_957_102_430, 0) - // Standard Error: 187_347 - .saturating_add(Weight::from_parts(8_480_335, 0).saturating_mul(r.into())) + // Minimum execution time: 10_444_861_000 picoseconds. + Weight::from_parts(11_811_924_847, 0) + // Standard Error: 220_732 + .saturating_add(Weight::from_parts(8_104_347, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_343_000 picoseconds. - Weight::from_parts(2_421_000, 0) - // Standard Error: 9_011 - .saturating_add(Weight::from_parts(3_834_828, 0).saturating_mul(r.into())) + // Minimum execution time: 2_102_000 picoseconds. + Weight::from_parts(2_199_000, 0) + // Standard Error: 8_145 + .saturating_add(Weight::from_parts(3_817_860, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_326_000 picoseconds. - Weight::from_parts(2_421_000, 0) - // Standard Error: 5_612 - .saturating_add(Weight::from_parts(3_061_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_084_000 picoseconds. + Weight::from_parts(2_171_000, 0) + // Standard Error: 5_734 + .saturating_add(Weight::from_parts(3_044_285, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(3_427_769, 0) - // Standard Error: 941 - .saturating_add(Weight::from_parts(1_568_677, 0).saturating_mul(r.into())) + // Minimum execution time: 2_074_000 picoseconds. + Weight::from_parts(3_341_361, 0) + // Standard Error: 1_168 + .saturating_add(Weight::from_parts(1_569_364, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_284_000 picoseconds. - Weight::from_parts(2_392_000, 0) - // Standard Error: 8_418 - .saturating_add(Weight::from_parts(2_921_747, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_253_000, 0) + // Standard Error: 7_562 + .saturating_add(Weight::from_parts(2_914_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_263_000 picoseconds. - Weight::from_parts(1_354_050, 0) - // Standard Error: 14_642 - .saturating_add(Weight::from_parts(5_182_595, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(99_037, 0) + // Standard Error: 11_949 + .saturating_add(Weight::from_parts(5_173_684, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_011_000 picoseconds. - Weight::from_parts(5_823_252, 0) - // Standard Error: 2_035 - .saturating_add(Weight::from_parts(162_988, 0).saturating_mul(e.into())) + // Minimum execution time: 6_992_000 picoseconds. + Weight::from_parts(6_256_207, 0) + // Standard Error: 1_332 + .saturating_add(Weight::from_parts(161_069, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_405_000 picoseconds. - Weight::from_parts(5_172_082, 0) - // Standard Error: 7_906 - .saturating_add(Weight::from_parts(2_576_107, 0).saturating_mul(r.into())) + // Minimum execution time: 2_106_000 picoseconds. + Weight::from_parts(4_233_365, 0) + // Standard Error: 7_839 + .saturating_add(Weight::from_parts(2_631_387, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_576_107 - - 2_413_885, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_631_387 - + 2_404_882, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_315_000 picoseconds. - Weight::from_parts(4_417_546, 0) - // Standard Error: 12_281 - .saturating_add(Weight::from_parts(2_413_885, 0).saturating_mul(r.into())) + // Minimum execution time: 2_192_000 picoseconds. + Weight::from_parts(4_830_171, 0) + // Standard Error: 12_370 + .saturating_add(Weight::from_parts(2_404_882, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_774_000 picoseconds. - Weight::from_parts(19_445_534, 0) - // Standard Error: 34_031 - .saturating_add(Weight::from_parts(9_947_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_413_000 picoseconds. + Weight::from_parts(16_855_535, 0) + // Standard Error: 25_880 + .saturating_add(Weight::from_parts(10_029_290, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_663_000 picoseconds. - Weight::from_parts(2_443_915, 0) - // Standard Error: 6_189 - .saturating_add(Weight::from_parts(1_274_832, 0).saturating_mul(p.into())) + // Minimum execution time: 12_145_000 picoseconds. + Weight::from_parts(4_520_615, 0) + // Standard Error: 6_765 + .saturating_add(Weight::from_parts(1_202_471, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(l: u32, ) -> Weight { + fn instr_call_per_local(_l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_382_000 picoseconds. - Weight::from_parts(5_657_220, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(14, 0).saturating_mul(l.into())) + // Minimum execution time: 5_133_000 picoseconds. + Weight::from_parts(5_476_163, 0) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_461_000 picoseconds. - Weight::from_parts(1_936_508, 0) - // Standard Error: 3_019 - .saturating_add(Weight::from_parts(275_086, 0).saturating_mul(r.into())) + // Minimum execution time: 2_117_000 picoseconds. + Weight::from_parts(1_458_597, 0) + // Standard Error: 3_356 + .saturating_add(Weight::from_parts(265_574, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_305_000 picoseconds. - Weight::from_parts(2_394_000, 0) - // Standard Error: 4_239 - .saturating_add(Weight::from_parts(763_775, 0).saturating_mul(r.into())) + // Minimum execution time: 2_135_000 picoseconds. + Weight::from_parts(2_223_000, 0) + // Standard Error: 5_214 + .saturating_add(Weight::from_parts(766_010, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_367_000 picoseconds. - Weight::from_parts(2_411_000, 0) - // Standard Error: 5_426 - .saturating_add(Weight::from_parts(771_295, 0).saturating_mul(r.into())) + // Minimum execution time: 2_078_000 picoseconds. + Weight::from_parts(2_218_000, 0) + // Standard Error: 5_801 + .saturating_add(Weight::from_parts(743_573, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_346_000 picoseconds. - Weight::from_parts(2_691_888, 0) - // Standard Error: 7_020 - .saturating_add(Weight::from_parts(804_877, 0).saturating_mul(r.into())) + // Minimum execution time: 6_226_000 picoseconds. + Weight::from_parts(2_093_625, 0) + // Standard Error: 7_678 + .saturating_add(Weight::from_parts(824_956, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_476_000 picoseconds. - Weight::from_parts(6_582_000, 0) - // Standard Error: 8_493 - .saturating_add(Weight::from_parts(1_358_866, 0).saturating_mul(r.into())) + // Minimum execution time: 6_201_000 picoseconds. + Weight::from_parts(154_770, 0) + // Standard Error: 9_398 + .saturating_add(Weight::from_parts(1_480_245, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_943_000 picoseconds. - Weight::from_parts(1_102_558, 0) - // Standard Error: 12_614 - .saturating_add(Weight::from_parts(7_099_473, 0).saturating_mul(r.into())) + // Minimum execution time: 6_989_000 picoseconds. + Weight::from_parts(2_628_082, 0) + // Standard Error: 12_268 + .saturating_add(Weight::from_parts(6_921_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_298_000 picoseconds. - Weight::from_parts(2_357_000, 0) - // Standard Error: 7_419 - .saturating_add(Weight::from_parts(3_438_043, 0).saturating_mul(r.into())) + // Minimum execution time: 2_086_000 picoseconds. + Weight::from_parts(2_156_000, 0) + // Standard Error: 5_477 + .saturating_add(Weight::from_parts(3_348_027, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_201_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 7_089 - .saturating_add(Weight::from_parts(3_224_674, 0).saturating_mul(r.into())) + // Minimum execution time: 2_102_000 picoseconds. + Weight::from_parts(2_163_000, 0) + // Standard Error: 6_833 + .saturating_add(Weight::from_parts(3_134_916, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_358_000 picoseconds. - Weight::from_parts(2_444_000, 0) - // Standard Error: 5_880 - .saturating_add(Weight::from_parts(3_196_577, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(2_209_000, 0) + // Standard Error: 7_612 + .saturating_add(Weight::from_parts(3_170_404, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_205_000 picoseconds. - Weight::from_parts(2_361_000, 0) - // Standard Error: 5_007 - .saturating_add(Weight::from_parts(2_694_074, 0).saturating_mul(r.into())) + // Minimum execution time: 2_124_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 4_823 + .saturating_add(Weight::from_parts(2_668_874, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_217_000 picoseconds. - Weight::from_parts(2_339_000, 0) - // Standard Error: 4_242 - .saturating_add(Weight::from_parts(562_083, 0).saturating_mul(r.into())) + // Minimum execution time: 2_159_000 picoseconds. + Weight::from_parts(2_240_000, 0) + // Standard Error: 3_992 + .saturating_add(Weight::from_parts(559_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(1_150_328, 0) - // Standard Error: 4_155 - .saturating_add(Weight::from_parts(430_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_127_000 picoseconds. + Weight::from_parts(1_178_239, 0) + // Standard Error: 3_346 + .saturating_add(Weight::from_parts(416_704, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_269_000, 0) - // Standard Error: 12_863 - .saturating_add(Weight::from_parts(1_875_276, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 11_707 + .saturating_add(Weight::from_parts(1_918_501, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_290_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 8_333 - .saturating_add(Weight::from_parts(1_185_939, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 7_593 + .saturating_add(Weight::from_parts(1_219_931, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_384_000 picoseconds. - Weight::from_parts(1_572_617, 0) - // Standard Error: 3_727 - .saturating_add(Weight::from_parts(382_695, 0).saturating_mul(r.into())) + // Minimum execution time: 2_124_000 picoseconds. + Weight::from_parts(726_401, 0) + // Standard Error: 4_086 + .saturating_add(Weight::from_parts(424_161, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(1_495_799, 0) - // Standard Error: 4_058 - .saturating_add(Weight::from_parts(373_636, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(1_225_918, 0) + // Standard Error: 3_748 + .saturating_add(Weight::from_parts(392_373, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_341_000 picoseconds. - Weight::from_parts(465_059, 0) - // Standard Error: 4_917 - .saturating_add(Weight::from_parts(551_259, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(11_174, 0) + // Standard Error: 5_816 + .saturating_add(Weight::from_parts(594_467, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(515_890, 0) - // Standard Error: 4_848 - .saturating_add(Weight::from_parts(545_542, 0).saturating_mul(r.into())) + // Minimum execution time: 2_138_000 picoseconds. + Weight::from_parts(12_680, 0) + // Standard Error: 5_830 + .saturating_add(Weight::from_parts(595_552, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(739_709, 0) - // Standard Error: 4_827 - .saturating_add(Weight::from_parts(496_885, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(172_344, 0) + // Standard Error: 5_372 + .saturating_add(Weight::from_parts(537_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_322_000 picoseconds. - Weight::from_parts(1_492_190, 0) - // Standard Error: 3_923 - .saturating_add(Weight::from_parts(340_665, 0).saturating_mul(r.into())) + // Minimum execution time: 2_171_000 picoseconds. + Weight::from_parts(459_682, 0) + // Standard Error: 5_533 + .saturating_add(Weight::from_parts(421_155, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_979_817, 0) - // Standard Error: 1_972 - .saturating_add(Weight::from_parts(154_315, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_640_857, 0) + // Standard Error: 2_132 + .saturating_add(Weight::from_parts(175_772, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(2_877_230, 0) - // Standard Error: 1_753 - .saturating_add(Weight::from_parts(153_462, 0).saturating_mul(r.into())) + // Minimum execution time: 2_149_000 picoseconds. + Weight::from_parts(2_625_890, 0) + // Standard Error: 2_246 + .saturating_add(Weight::from_parts(177_728, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 11_649 - .saturating_add(Weight::from_parts(1_795_062, 0).saturating_mul(r.into())) + // Minimum execution time: 2_082_000 picoseconds. + Weight::from_parts(2_193_000, 0) + // Standard Error: 9_664 + .saturating_add(Weight::from_parts(1_832_396, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_303_000 picoseconds. - Weight::from_parts(2_366_000, 0) - // Standard Error: 7_436 - .saturating_add(Weight::from_parts(1_091_962, 0).saturating_mul(r.into())) + // Minimum execution time: 2_029_000 picoseconds. + Weight::from_parts(2_185_000, 0) + // Standard Error: 7_691 + .saturating_add(Weight::from_parts(1_203_465, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_346_000 picoseconds. - Weight::from_parts(2_409_000, 0) - // Standard Error: 11_197 - .saturating_add(Weight::from_parts(1_828_518, 0).saturating_mul(r.into())) + // Minimum execution time: 2_146_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 10_390 + .saturating_add(Weight::from_parts(1_868_795, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_328_000 picoseconds. - Weight::from_parts(2_384_000, 0) - // Standard Error: 7_307 - .saturating_add(Weight::from_parts(1_106_869, 0).saturating_mul(r.into())) + // Minimum execution time: 2_082_000 picoseconds. + Weight::from_parts(2_133_000, 0) + // Standard Error: 8_282 + .saturating_add(Weight::from_parts(1_199_983, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_286_000 picoseconds. - Weight::from_parts(2_343_000, 0) - // Standard Error: 10_932 - .saturating_add(Weight::from_parts(1_789_419, 0).saturating_mul(r.into())) + // Minimum execution time: 2_145_000 picoseconds. + Weight::from_parts(2_178_000, 0) + // Standard Error: 10_175 + .saturating_add(Weight::from_parts(1_943_386, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 7_556 - .saturating_add(Weight::from_parts(1_111_326, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_168_000, 0) + // Standard Error: 6_923 + .saturating_add(Weight::from_parts(1_125_091, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_263_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 10_995 - .saturating_add(Weight::from_parts(1_822_680, 0).saturating_mul(r.into())) + // Minimum execution time: 2_200_000 picoseconds. + Weight::from_parts(2_250_000, 0) + // Standard Error: 11_944 + .saturating_add(Weight::from_parts(1_852_545, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_276_000 picoseconds. - Weight::from_parts(2_334_000, 0) - // Standard Error: 6_944 - .saturating_add(Weight::from_parts(1_121_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_121_000, 0) + // Standard Error: 7_914 + .saturating_add(Weight::from_parts(1_171_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 11_873 - .saturating_add(Weight::from_parts(1_840_273, 0).saturating_mul(r.into())) + // Minimum execution time: 2_171_000 picoseconds. + Weight::from_parts(2_278_000, 0) + // Standard Error: 10_701 + .saturating_add(Weight::from_parts(1_859_283, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_265_000 picoseconds. - Weight::from_parts(2_409_000, 0) - // Standard Error: 7_972 - .saturating_add(Weight::from_parts(1_134_825, 0).saturating_mul(r.into())) + // Minimum execution time: 2_167_000 picoseconds. + Weight::from_parts(2_209_000, 0) + // Standard Error: 7_361 + .saturating_add(Weight::from_parts(1_182_113, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_269_000 picoseconds. - Weight::from_parts(2_355_000, 0) - // Standard Error: 11_547 - .saturating_add(Weight::from_parts(1_813_029, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_239_000, 0) + // Standard Error: 12_468 + .saturating_add(Weight::from_parts(1_847_236, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_273_000 picoseconds. - Weight::from_parts(2_349_000, 0) - // Standard Error: 6_487 - .saturating_add(Weight::from_parts(1_091_201, 0).saturating_mul(r.into())) + // Minimum execution time: 2_072_000 picoseconds. + Weight::from_parts(2_164_000, 0) + // Standard Error: 8_208 + .saturating_add(Weight::from_parts(1_117_969, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_329_000, 0) - // Standard Error: 12_018 - .saturating_add(Weight::from_parts(1_823_755, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_155_000, 0) + // Standard Error: 9_963 + .saturating_add(Weight::from_parts(1_877_035, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(2_359_000, 0) - // Standard Error: 7_325 - .saturating_add(Weight::from_parts(1_192_292, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 7_561 + .saturating_add(Weight::from_parts(1_124_600, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_352_000 picoseconds. - Weight::from_parts(2_386_000, 0) - // Standard Error: 10_009 - .saturating_add(Weight::from_parts(1_870_539, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_210_000, 0) + // Standard Error: 11_998 + .saturating_add(Weight::from_parts(1_829_852, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_315_000 picoseconds. - Weight::from_parts(2_382_000, 0) - // Standard Error: 7_109 - .saturating_add(Weight::from_parts(1_122_152, 0).saturating_mul(r.into())) + // Minimum execution time: 2_098_000 picoseconds. + Weight::from_parts(2_189_000, 0) + // Standard Error: 8_286 + .saturating_add(Weight::from_parts(1_189_196, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_337_000, 0) - // Standard Error: 11_700 - .saturating_add(Weight::from_parts(1_825_021, 0).saturating_mul(r.into())) + // Minimum execution time: 2_125_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 10_056 + .saturating_add(Weight::from_parts(1_829_185, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_357_000 picoseconds. - Weight::from_parts(2_407_000, 0) - // Standard Error: 7_769 - .saturating_add(Weight::from_parts(1_146_472, 0).saturating_mul(r.into())) + // Minimum execution time: 2_065_000 picoseconds. + Weight::from_parts(2_174_000, 0) + // Standard Error: 8_171 + .saturating_add(Weight::from_parts(1_176_701, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_196_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 9_908 - .saturating_add(Weight::from_parts(1_845_094, 0).saturating_mul(r.into())) + // Minimum execution time: 2_141_000 picoseconds. + Weight::from_parts(2_220_000, 0) + // Standard Error: 9_910 + .saturating_add(Weight::from_parts(1_871_442, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_276_000 picoseconds. - Weight::from_parts(2_382_000, 0) - // Standard Error: 9_519 - .saturating_add(Weight::from_parts(1_241_507, 0).saturating_mul(r.into())) + // Minimum execution time: 2_024_000 picoseconds. + Weight::from_parts(2_166_000, 0) + // Standard Error: 7_933 + .saturating_add(Weight::from_parts(1_156_214, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 7_921 - .saturating_add(Weight::from_parts(1_330_988, 0).saturating_mul(r.into())) + // Minimum execution time: 2_068_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 7_815 + .saturating_add(Weight::from_parts(1_353_927, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_203_000 picoseconds. - Weight::from_parts(2_262_000, 0) - // Standard Error: 4_732 - .saturating_add(Weight::from_parts(619_908, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_208_000, 0) + // Standard Error: 4_587 + .saturating_add(Weight::from_parts(635_023, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_273_000 picoseconds. - Weight::from_parts(2_318_000, 0) - // Standard Error: 8_121 - .saturating_add(Weight::from_parts(1_255_733, 0).saturating_mul(r.into())) + // Minimum execution time: 2_080_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 8_399 + .saturating_add(Weight::from_parts(1_278_782, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_332_000 picoseconds. - Weight::from_parts(2_392_000, 0) - // Standard Error: 5_698 - .saturating_add(Weight::from_parts(666_782, 0).saturating_mul(r.into())) + // Minimum execution time: 2_069_000 picoseconds. + Weight::from_parts(2_233_000, 0) + // Standard Error: 6_395 + .saturating_add(Weight::from_parts(682_415, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_269_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 10_724 - .saturating_add(Weight::from_parts(1_779_885, 0).saturating_mul(r.into())) + // Minimum execution time: 2_206_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 9_477 + .saturating_add(Weight::from_parts(1_819_764, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_239_000 picoseconds. - Weight::from_parts(2_377_000, 0) - // Standard Error: 8_303 - .saturating_add(Weight::from_parts(1_231_579, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 7_615 + .saturating_add(Weight::from_parts(1_207_931, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(3_881_473, 0) - // Standard Error: 22_336 - .saturating_add(Weight::from_parts(2_602_873, 0).saturating_mul(r.into())) + // Minimum execution time: 2_108_000 picoseconds. + Weight::from_parts(1_363_438, 0) + // Standard Error: 18_139 + .saturating_add(Weight::from_parts(2_743_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_366_000 picoseconds. - Weight::from_parts(971_800, 0) - // Standard Error: 9_516 - .saturating_add(Weight::from_parts(2_473_994, 0).saturating_mul(r.into())) + // Minimum execution time: 2_197_000 picoseconds. + Weight::from_parts(726_043, 0) + // Standard Error: 12_539 + .saturating_add(Weight::from_parts(2_447_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_333_000 picoseconds. - Weight::from_parts(3_150_808, 0) - // Standard Error: 24_239 - .saturating_add(Weight::from_parts(2_853_024, 0).saturating_mul(r.into())) + // Minimum execution time: 2_118_000 picoseconds. + Weight::from_parts(1_113_814, 0) + // Standard Error: 15_837 + .saturating_add(Weight::from_parts(2_939_546, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(1_149_774, 0) - // Standard Error: 13_355 - .saturating_add(Weight::from_parts(2_517_122, 0).saturating_mul(r.into())) + // Minimum execution time: 2_121_000 picoseconds. + Weight::from_parts(2_089_486, 0) + // Standard Error: 15_833 + .saturating_add(Weight::from_parts(2_447_304, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(1_527_824, 0) - // Standard Error: 31_972 - .saturating_add(Weight::from_parts(9_267_865, 0).saturating_mul(r.into())) + // Minimum execution time: 2_200_000 picoseconds. + Weight::from_parts(2_235_000, 0) + // Standard Error: 16_089 + .saturating_add(Weight::from_parts(9_370_736, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_323_000 picoseconds. - Weight::from_parts(988_781, 0) - // Standard Error: 44_193 - .saturating_add(Weight::from_parts(7_612_584, 0).saturating_mul(r.into())) + // Minimum execution time: 2_191_000 picoseconds. + Weight::from_parts(3_207_641, 0) + // Standard Error: 45_758 + .saturating_add(Weight::from_parts(7_437_894, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_334_729, 0) - // Standard Error: 15_965 - .saturating_add(Weight::from_parts(2_951_129, 0).saturating_mul(r.into())) + // Minimum execution time: 2_118_000 picoseconds. + Weight::from_parts(588_160, 0) + // Standard Error: 17_384 + .saturating_add(Weight::from_parts(2_989_240, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(1_116_651, 0) - // Standard Error: 17_134 - .saturating_add(Weight::from_parts(2_528_749, 0).saturating_mul(r.into())) + // Minimum execution time: 2_135_000 picoseconds. + Weight::from_parts(4_961_665, 0) + // Standard Error: 26_016 + .saturating_add(Weight::from_parts(2_253_733, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 8_575 - .saturating_add(Weight::from_parts(1_262_352, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 8_661 + .saturating_add(Weight::from_parts(1_328_375, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_338_000, 0) - // Standard Error: 4_378 - .saturating_add(Weight::from_parts(623_671, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(2_225_000, 0) + // Standard Error: 4_778 + .saturating_add(Weight::from_parts(648_611, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_335_000 picoseconds. - Weight::from_parts(2_380_000, 0) - // Standard Error: 8_320 - .saturating_add(Weight::from_parts(1_276_618, 0).saturating_mul(r.into())) + // Minimum execution time: 2_125_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 8_338 + .saturating_add(Weight::from_parts(1_260_241, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_330_000 picoseconds. - Weight::from_parts(2_374_000, 0) - // Standard Error: 4_039 - .saturating_add(Weight::from_parts(593_652, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(2_233_000, 0) + // Standard Error: 5_007 + .saturating_add(Weight::from_parts(642_088, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_220_000 picoseconds. - Weight::from_parts(2_325_000, 0) - // Standard Error: 8_112 - .saturating_add(Weight::from_parts(1_247_970, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_267_000, 0) + // Standard Error: 8_196 + .saturating_add(Weight::from_parts(1_328_828, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_280_000 picoseconds. - Weight::from_parts(2_353_000, 0) - // Standard Error: 4_344 - .saturating_add(Weight::from_parts(606_457, 0).saturating_mul(r.into())) + // Minimum execution time: 2_135_000 picoseconds. + Weight::from_parts(2_211_000, 0) + // Standard Error: 5_376 + .saturating_add(Weight::from_parts(693_541, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_234_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 7_296 - .saturating_add(Weight::from_parts(1_053_977, 0).saturating_mul(r.into())) + // Minimum execution time: 2_208_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 7_393 + .saturating_add(Weight::from_parts(1_144_418, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_342_000 picoseconds. - Weight::from_parts(75_359, 0) - // Standard Error: 6_197 - .saturating_add(Weight::from_parts(627_367, 0).saturating_mul(r.into())) + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_237_000, 0) + // Standard Error: 3_890 + .saturating_add(Weight::from_parts(589_899, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_281_000 picoseconds. - Weight::from_parts(2_367_000, 0) - // Standard Error: 6_750 - .saturating_add(Weight::from_parts(1_078_782, 0).saturating_mul(r.into())) + // Minimum execution time: 2_129_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 7_182 + .saturating_add(Weight::from_parts(1_101_585, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 4_413 - .saturating_add(Weight::from_parts(586_782, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_126_000, 0) + // Standard Error: 3_865 + .saturating_add(Weight::from_parts(588_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_353_000 picoseconds. - Weight::from_parts(2_385_000, 0) - // Standard Error: 9_421 - .saturating_add(Weight::from_parts(1_130_965, 0).saturating_mul(r.into())) + // Minimum execution time: 2_129_000 picoseconds. + Weight::from_parts(2_215_000, 0) + // Standard Error: 8_265 + .saturating_add(Weight::from_parts(1_152_496, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_344_000 picoseconds. - Weight::from_parts(2_438_000, 0) - // Standard Error: 5_975 - .saturating_add(Weight::from_parts(638_969, 0).saturating_mul(r.into())) + // Minimum execution time: 2_103_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 3_989 + .saturating_add(Weight::from_parts(614_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_356_000, 0) - // Standard Error: 8_189 - .saturating_add(Weight::from_parts(1_080_515, 0).saturating_mul(r.into())) + // Minimum execution time: 2_133_000 picoseconds. + Weight::from_parts(2_175_000, 0) + // Standard Error: 6_506 + .saturating_add(Weight::from_parts(1_096_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_253_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 3_500 - .saturating_add(Weight::from_parts(556_273, 0).saturating_mul(r.into())) + // Minimum execution time: 2_088_000 picoseconds. + Weight::from_parts(2_154_000, 0) + // Standard Error: 4_053 + .saturating_add(Weight::from_parts(582_323, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_215_000 picoseconds. - Weight::from_parts(2_333_000, 0) - // Standard Error: 7_954 - .saturating_add(Weight::from_parts(1_067_773, 0).saturating_mul(r.into())) + // Minimum execution time: 2_120_000 picoseconds. + Weight::from_parts(2_213_000, 0) + // Standard Error: 6_472 + .saturating_add(Weight::from_parts(1_056_569, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_183_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 3_658 - .saturating_add(Weight::from_parts(566_527, 0).saturating_mul(r.into())) + // Minimum execution time: 2_097_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 3_800 + .saturating_add(Weight::from_parts(579_517, 0).saturating_mul(r.into())) } } @@ -2113,10 +2113,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_003_000 picoseconds. - Weight::from_parts(1_051_000, 0) - // Standard Error: 968 - .saturating_add(Weight::from_parts(212_482, 0).saturating_mul(c.into())) + // Minimum execution time: 1_017_000 picoseconds. + Weight::from_parts(1_119_000, 0) + // Standard Error: 761 + .saturating_add(Weight::from_parts(209_074, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -2124,10 +2124,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `113 + c * (1024 ±0)` // Estimated: `3577 + c * (1024 ±0)` - // Minimum execution time: 3_267_000 picoseconds. - Weight::from_parts(3_316_000, 3577) - // Standard Error: 1_072 - .saturating_add(Weight::from_parts(688_242, 0).saturating_mul(c.into())) + // Minimum execution time: 3_299_000 picoseconds. + Weight::from_parts(3_409_000, 3577) + // Standard Error: 809 + .saturating_add(Weight::from_parts(667_635, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2136,17 +2136,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 53_248_000 picoseconds. - Weight::from_parts(71_345_881, 0) - // Standard Error: 10_707 - .saturating_add(Weight::from_parts(2_548_249, 0).saturating_mul(c.into())) + // Minimum execution time: 50_278_000 picoseconds. + Weight::from_parts(73_427_731, 0) + // Standard Error: 6_473 + .saturating_add(Weight::from_parts(2_331_768, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1050` // Estimated: `42875` - // Minimum execution time: 84_992_000 picoseconds. - Weight::from_parts(88_176_000, 42875) + // Minimum execution time: 81_857_000 picoseconds. + Weight::from_parts(83_494_000, 42875) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2154,8 +2154,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `958` // Estimated: `21477` - // Minimum execution time: 56_951_000 picoseconds. - Weight::from_parts(58_755_000, 21477) + // Minimum execution time: 53_880_000 picoseconds. + Weight::from_parts(55_703_000, 21477) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2163,8 +2163,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `605` // Estimated: `17354` - // Minimum execution time: 30_483_000 picoseconds. - Weight::from_parts(31_174_000, 17354) + // Minimum execution time: 28_976_000 picoseconds. + Weight::from_parts(30_055_000, 17354) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2173,10 +2173,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 8_269_000 picoseconds. - Weight::from_parts(7_343_300, 7640) - // Standard Error: 45_015 - .saturating_add(Weight::from_parts(15_758_869, 0).saturating_mul(c.into())) + // Minimum execution time: 7_954_000 picoseconds. + Weight::from_parts(9_206_629, 7640) + // Standard Error: 40_915 + .saturating_add(Weight::from_parts(13_218_946, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -2185,10 +2185,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1439 + c * (16389 ±0)` // Estimated: `42034 + c * (131112 ±0)` - // Minimum execution time: 70_643_000 picoseconds. - Weight::from_parts(71_487_000, 42034) - // Standard Error: 217_960 - .saturating_add(Weight::from_parts(56_304_860, 0).saturating_mul(c.into())) + // Minimum execution time: 69_036_000 picoseconds. + Weight::from_parts(70_072_000, 42034) + // Standard Error: 149_794 + .saturating_add(Weight::from_parts(52_674_750, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2199,10 +2199,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `80` // Estimated: `5270` - // Minimum execution time: 63_871_000 picoseconds. - Weight::from_parts(31_431_372, 5270) - // Standard Error: 58_224 - .saturating_add(Weight::from_parts(52_560_364, 0).saturating_mul(c.into())) + // Minimum execution time: 61_042_000 picoseconds. + Weight::from_parts(42_647_149, 5270) + // Standard Error: 41_151 + .saturating_add(Weight::from_parts(51_906_843, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2211,10 +2211,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `742` // Estimated: `39419` - // Minimum execution time: 65_988_000 picoseconds. - Weight::from_parts(102_441_114, 39419) - // Standard Error: 1 - .saturating_add(Weight::from_parts(2_612, 0).saturating_mul(s.into())) + // Minimum execution time: 62_956_000 picoseconds. + Weight::from_parts(74_593_794, 39419) + // Standard Error: 0 + .saturating_add(Weight::from_parts(2_594, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2224,12 +2224,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `306` // Estimated: `35235` - // Minimum execution time: 11_021_135_000 picoseconds. - Weight::from_parts(397_699_856, 35235) - // Standard Error: 169_994 - .saturating_add(Weight::from_parts(52_665_060, 0).saturating_mul(c.into())) - // Standard Error: 10 - .saturating_add(Weight::from_parts(2_533, 0).saturating_mul(s.into())) + // Minimum execution time: 10_939_548_000 picoseconds. + Weight::from_parts(505_483_291, 35235) + // Standard Error: 158_935 + .saturating_add(Weight::from_parts(51_999_053, 0).saturating_mul(c.into())) + // Standard Error: 9 + .saturating_add(Weight::from_parts(2_500, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } @@ -2238,10 +2238,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `349` // Estimated: `23860` - // Minimum execution time: 57_013_000 picoseconds. - Weight::from_parts(35_413_717, 23860) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_158, 0).saturating_mul(p.into())) + // Minimum execution time: 54_714_000 picoseconds. + Weight::from_parts(39_682_905, 23860) + // Standard Error: 0 + .saturating_add(Weight::from_parts(1_012, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -2250,10 +2250,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `452` // Estimated: `27184` - // Minimum execution time: 60_180_000 picoseconds. - Weight::from_parts(33_390_466, 27184) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_167, 0).saturating_mul(p.into())) + // Minimum execution time: 56_333_000 picoseconds. + Weight::from_parts(38_749_450, 27184) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } @@ -2262,10 +2262,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1049` // Estimated: `42866` - // Minimum execution time: 87_446_000 picoseconds. - Weight::from_parts(69_330_706, 42866) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_174, 0).saturating_mul(p.into())) + // Minimum execution time: 82_073_000 picoseconds. + Weight::from_parts(66_860_069, 42866) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2274,20 +2274,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1152` // Estimated: `46396` - // Minimum execution time: 97_152_000 picoseconds. - Weight::from_parts(77_891_346, 46396) - // Standard Error: 2 - .saturating_add(Weight::from_parts(1_170, 0).saturating_mul(p.into())) + // Minimum execution time: 92_361_000 picoseconds. + Weight::from_parts(69_850_521, 46396) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_052, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(14_u64)) .saturating_add(RocksDbWeight::get().writes(11_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(_q: u32, ) -> Weight { + fn initial_allocation(q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85981` - // Minimum execution time: 323_882_000 picoseconds. - Weight::from_parts(336_539_045, 85981) + // Minimum execution time: 316_122_000 picoseconds. + Weight::from_parts(330_387_653, 85981) + // Standard Error: 1_030 + .saturating_add(Weight::from_parts(2_167, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().writes(23_u64)) } @@ -2296,8 +2298,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85905` - // Minimum execution time: 336_406_000 picoseconds. - Weight::from_parts(353_807_338, 85905) + // Minimum execution time: 327_296_000 picoseconds. + Weight::from_parts(344_778_587, 85905) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().writes(23_u64)) } @@ -2306,10 +2308,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_464_000 picoseconds. - Weight::from_parts(45_831_000, 3899) - // Standard Error: 36_617 - .saturating_add(Weight::from_parts(51_273_892, 0).saturating_mul(c.into())) + // Minimum execution time: 45_031_000 picoseconds. + Weight::from_parts(45_572_000, 3899) + // Standard Error: 24_669 + .saturating_add(Weight::from_parts(50_090_777, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2319,630 +2321,630 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_254_000 picoseconds. - Weight::from_parts(86_749_000, 0) - // Standard Error: 3_967_638 - .saturating_add(Weight::from_parts(617_894_062, 0).saturating_mul(r.into())) + // Minimum execution time: 83_663_000 picoseconds. + Weight::from_parts(84_983_000, 0) + // Standard Error: 4_066_232 + .saturating_add(Weight::from_parts(564_447_416, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 366_392_000 picoseconds. - Weight::from_parts(294_624_660, 0) - // Standard Error: 10_067 - .saturating_add(Weight::from_parts(30_802_641, 0).saturating_mul(p.into())) + // Minimum execution time: 311_448_000 picoseconds. + Weight::from_parts(245_631_815, 0) + // Standard Error: 7_937 + .saturating_add(Weight::from_parts(30_896_737, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 199_070_000 picoseconds. - Weight::from_parts(213_938_845, 0) - // Standard Error: 343_895 - .saturating_add(Weight::from_parts(120_152_478, 0).saturating_mul(r.into())) + // Minimum execution time: 149_067_000 picoseconds. + Weight::from_parts(130_181_921, 0) + // Standard Error: 294_281 + .saturating_add(Weight::from_parts(60_998_326, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_714_000 picoseconds. - Weight::from_parts(96_261_609, 0) - // Standard Error: 3_991 - .saturating_add(Weight::from_parts(3_567_375, 0).saturating_mul(r.into())) + // Minimum execution time: 87_222_000 picoseconds. + Weight::from_parts(94_195_714, 0) + // Standard Error: 3_616 + .saturating_add(Weight::from_parts(2_672_494, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_882_000 picoseconds. - Weight::from_parts(221_553_985, 0) - // Standard Error: 29_743 - .saturating_add(Weight::from_parts(3_602_987, 0).saturating_mul(r.into())) + // Minimum execution time: 139_429_000 picoseconds. + Weight::from_parts(171_049_360, 0) + // Standard Error: 31_588 + .saturating_add(Weight::from_parts(2_923_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_497_000 picoseconds. - Weight::from_parts(118_603_695, 0) - // Standard Error: 431_810 - .saturating_add(Weight::from_parts(177_456_338, 0).saturating_mul(r.into())) + // Minimum execution time: 86_992_000 picoseconds. + Weight::from_parts(115_936_976, 0) + // Standard Error: 414_340 + .saturating_add(Weight::from_parts(116_785_346, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_831_000 picoseconds. - Weight::from_parts(88_005_607, 0) - // Standard Error: 244_708 - .saturating_add(Weight::from_parts(175_744_834, 0).saturating_mul(r.into())) + // Minimum execution time: 87_790_000 picoseconds. + Weight::from_parts(90_746_200, 0) + // Standard Error: 270_835 + .saturating_add(Weight::from_parts(107_416_174, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_145_000 picoseconds. - Weight::from_parts(86_969_872, 0) - // Standard Error: 302_008 - .saturating_add(Weight::from_parts(180_744_297, 0).saturating_mul(r.into())) + // Minimum execution time: 84_210_000 picoseconds. + Weight::from_parts(91_082_335, 0) + // Standard Error: 211_867 + .saturating_add(Weight::from_parts(104_318_383, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_337_000 picoseconds. - Weight::from_parts(80_268_581, 0) - // Standard Error: 290_578 - .saturating_add(Weight::from_parts(180_541_423, 0).saturating_mul(r.into())) + // Minimum execution time: 84_806_000 picoseconds. + Weight::from_parts(85_438_969, 0) + // Standard Error: 248_652 + .saturating_add(Weight::from_parts(105_330_427, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_327_000 picoseconds. - Weight::from_parts(84_307_332, 0) - // Standard Error: 316_639 - .saturating_add(Weight::from_parts(179_561_839, 0).saturating_mul(r.into())) + // Minimum execution time: 84_654_000 picoseconds. + Weight::from_parts(82_257_210, 0) + // Standard Error: 336_548 + .saturating_add(Weight::from_parts(106_454_200, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_300_000 picoseconds. - Weight::from_parts(70_645_226, 0) - // Standard Error: 320_673 - .saturating_add(Weight::from_parts(182_342_085, 0).saturating_mul(r.into())) + // Minimum execution time: 84_452_000 picoseconds. + Weight::from_parts(82_661_045, 0) + // Standard Error: 286_452 + .saturating_add(Weight::from_parts(105_467_642, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_250_000 picoseconds. - Weight::from_parts(81_902_510, 0) - // Standard Error: 273_253 - .saturating_add(Weight::from_parts(180_582_426, 0).saturating_mul(r.into())) + // Minimum execution time: 84_893_000 picoseconds. + Weight::from_parts(81_216_834, 0) + // Standard Error: 315_266 + .saturating_add(Weight::from_parts(107_016_702, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_232_000 picoseconds. - Weight::from_parts(87_259_581, 0) - // Standard Error: 294_035 - .saturating_add(Weight::from_parts(175_294_464, 0).saturating_mul(r.into())) + // Minimum execution time: 85_282_000 picoseconds. + Weight::from_parts(82_548_887, 0) + // Standard Error: 341_172 + .saturating_add(Weight::from_parts(105_504_622, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 595_636_000 picoseconds. - Weight::from_parts(656_136_663, 0) - // Standard Error: 485_302 - .saturating_add(Weight::from_parts(261_855_478, 0).saturating_mul(r.into())) + // Minimum execution time: 556_352_000 picoseconds. + Weight::from_parts(607_493_748, 0) + // Standard Error: 448_674 + .saturating_add(Weight::from_parts(184_670_390, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 850_360_000 picoseconds. - Weight::from_parts(903_367_000, 0) - // Standard Error: 55_203 - .saturating_add(Weight::from_parts(13_094_816, 0).saturating_mul(n.into())) + // Minimum execution time: 714_496_000 picoseconds. + Weight::from_parts(722_520_000, 0) + // Standard Error: 46_538 + .saturating_add(Weight::from_parts(13_033_234, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_957_000 picoseconds. - Weight::from_parts(87_586_547, 0) - // Standard Error: 323_063 - .saturating_add(Weight::from_parts(174_117_671, 0).saturating_mul(r.into())) + // Minimum execution time: 85_627_000 picoseconds. + Weight::from_parts(85_563_243, 0) + // Standard Error: 311_752 + .saturating_add(Weight::from_parts(105_877_332, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_008_000 picoseconds. - Weight::from_parts(78_303_076, 0) - // Standard Error: 299_495 - .saturating_add(Weight::from_parts(175_222_715, 0).saturating_mul(r.into())) + // Minimum execution time: 86_852_000 picoseconds. + Weight::from_parts(84_860_381, 0) + // Standard Error: 321_988 + .saturating_add(Weight::from_parts(105_008_310, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_234_000 picoseconds. - Weight::from_parts(103_801_859, 0) - // Standard Error: 382_198 - .saturating_add(Weight::from_parts(245_171_881, 0).saturating_mul(n.into())) + // Minimum execution time: 84_396_000 picoseconds. + Weight::from_parts(89_972_413, 0) + // Standard Error: 338_324 + .saturating_add(Weight::from_parts(184_316_536, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_211_000 picoseconds. - Weight::from_parts(87_766_000, 0) - // Standard Error: 4_237_435 - .saturating_add(Weight::from_parts(1_076_031_771, 0).saturating_mul(r.into())) + // Minimum execution time: 89_385_000 picoseconds. + Weight::from_parts(90_760_000, 0) + // Standard Error: 4_378_367 + .saturating_add(Weight::from_parts(914_427_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_722_000 picoseconds. - Weight::from_parts(144_011_827, 0) - // Standard Error: 476_324 - .saturating_add(Weight::from_parts(387_231_993, 0).saturating_mul(r.into())) + // Minimum execution time: 86_060_000 picoseconds. + Weight::from_parts(138_647_807, 0) + // Standard Error: 449_220 + .saturating_add(Weight::from_parts(301_188_566, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 461_434_000 picoseconds. - Weight::from_parts(469_780_000, 0) - // Standard Error: 61_125 - .saturating_add(Weight::from_parts(21_613_603, 0).saturating_mul(n.into())) + // Minimum execution time: 391_797_000 picoseconds. + Weight::from_parts(394_943_000, 0) + // Standard Error: 58_663 + .saturating_add(Weight::from_parts(21_187_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_818_000 picoseconds. - Weight::from_parts(149_809_757, 0) - // Standard Error: 456_443 - .saturating_add(Weight::from_parts(395_488_333, 0).saturating_mul(r.into())) + // Minimum execution time: 85_418_000 picoseconds. + Weight::from_parts(149_848_797, 0) + // Standard Error: 459_492 + .saturating_add(Weight::from_parts(308_230_219, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 479_154_000 picoseconds. - Weight::from_parts(483_278_000, 0) - // Standard Error: 67_159 - .saturating_add(Weight::from_parts(21_947_194, 0).saturating_mul(n.into())) + // Minimum execution time: 390_635_000 picoseconds. + Weight::from_parts(395_782_000, 0) + // Standard Error: 61_326 + .saturating_add(Weight::from_parts(20_818_419, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 567_500_000 picoseconds. - Weight::from_parts(693_644_323, 0) - // Standard Error: 568_410 - .saturating_add(Weight::from_parts(412_109_027, 0).saturating_mul(r.into())) + // Minimum execution time: 561_280_000 picoseconds. + Weight::from_parts(634_390_717, 0) + // Standard Error: 473_236 + .saturating_add(Weight::from_parts(316_661_157, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 575_808_000 picoseconds. - Weight::from_parts(724_736_213, 0) - // Standard Error: 602_935 - .saturating_add(Weight::from_parts(412_885_093, 0).saturating_mul(r.into())) + // Minimum execution time: 559_804_000 picoseconds. + Weight::from_parts(650_695_494, 0) + // Standard Error: 489_218 + .saturating_add(Weight::from_parts(321_789_584, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_691_000 picoseconds. - Weight::from_parts(74_497_929, 0) - // Standard Error: 328_672 - .saturating_add(Weight::from_parts(197_295_056, 0).saturating_mul(r.into())) + // Minimum execution time: 86_345_000 picoseconds. + Weight::from_parts(74_080_057, 0) + // Standard Error: 328_119 + .saturating_add(Weight::from_parts(116_742_827, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_899_275_000 picoseconds. - Weight::from_parts(4_052_914_766, 0) - // Standard Error: 433_071 - .saturating_add(Weight::from_parts(279_414_467, 0).saturating_mul(r.into())) + // Minimum execution time: 2_307_192_000 picoseconds. + Weight::from_parts(2_419_334_440, 0) + // Standard Error: 484_032 + .saturating_add(Weight::from_parts(211_293_866, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 481_093_000 picoseconds. - Weight::from_parts(489_651_000, 0) - // Standard Error: 58_131 - .saturating_add(Weight::from_parts(29_725_779, 0).saturating_mul(n.into())) + // Minimum execution time: 346_160_000 picoseconds. + Weight::from_parts(348_777_000, 0) + // Standard Error: 58_661 + .saturating_add(Weight::from_parts(29_434_095, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_898_930_000 picoseconds. - Weight::from_parts(4_051_051_643, 0) - // Standard Error: 422_685 - .saturating_add(Weight::from_parts(335_909_883, 0).saturating_mul(r.into())) + // Minimum execution time: 2_292_607_000 picoseconds. + Weight::from_parts(2_434_102_108, 0) + // Standard Error: 502_502 + .saturating_add(Weight::from_parts(264_859_383, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_889_863_000 picoseconds. - Weight::from_parts(4_037_859_582, 0) - // Standard Error: 492_684 - .saturating_add(Weight::from_parts(354_039_027, 0).saturating_mul(r.into())) + // Minimum execution time: 2_289_426_000 picoseconds. + Weight::from_parts(2_437_443_919, 0) + // Standard Error: 471_320 + .saturating_add(Weight::from_parts(268_510_540, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 254_292_000 picoseconds. - Weight::from_parts(299_243_857, 0) - // Standard Error: 453_209 - .saturating_add(Weight::from_parts(402_577_817, 0).saturating_mul(r.into())) + // Minimum execution time: 242_827_000 picoseconds. + Weight::from_parts(291_906_943, 0) + // Standard Error: 419_132 + .saturating_add(Weight::from_parts(316_375_969, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 654_055_000 picoseconds. - Weight::from_parts(663_310_000, 0) - // Standard Error: 60_031 - .saturating_add(Weight::from_parts(21_652_831, 0).saturating_mul(n.into())) + // Minimum execution time: 554_876_000 picoseconds. + Weight::from_parts(559_277_000, 0) + // Standard Error: 59_610 + .saturating_add(Weight::from_parts(21_490_976, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_054_583_000 picoseconds. - Weight::from_parts(4_192_801_478, 0) - // Standard Error: 494_878 - .saturating_add(Weight::from_parts(356_698_705, 0).saturating_mul(r.into())) + // Minimum execution time: 2_443_317_000 picoseconds. + Weight::from_parts(2_625_227_536, 0) + // Standard Error: 511_289 + .saturating_add(Weight::from_parts(283_117_268, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_037_000 picoseconds. - Weight::from_parts(88_828_036, 0) - // Standard Error: 335_490 - .saturating_add(Weight::from_parts(26_597_063, 0).saturating_mul(r.into())) + // Minimum execution time: 85_099_000 picoseconds. + Weight::from_parts(88_574_604, 0) + // Standard Error: 274_173 + .saturating_add(Weight::from_parts(20_834_495, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 108_733_000 picoseconds. - Weight::from_parts(93_898_943, 0) - // Standard Error: 1_151 - .saturating_add(Weight::from_parts(428_904, 0).saturating_mul(n.into())) + // Minimum execution time: 102_246_000 picoseconds. + Weight::from_parts(90_382_254, 0) + // Standard Error: 1_257 + .saturating_add(Weight::from_parts(428_781, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_569_000 picoseconds. - Weight::from_parts(89_213_638, 0) - // Standard Error: 317_917 - .saturating_add(Weight::from_parts(22_797_961, 0).saturating_mul(r.into())) + // Minimum execution time: 86_454_000 picoseconds. + Weight::from_parts(90_235_951, 0) + // Standard Error: 256_364 + .saturating_add(Weight::from_parts(14_555_548, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_164_000 picoseconds. - Weight::from_parts(95_571_505, 0) - // Standard Error: 1_085 - .saturating_add(Weight::from_parts(425_025, 0).saturating_mul(n.into())) + // Minimum execution time: 104_189_000 picoseconds. + Weight::from_parts(91_177_961, 0) + // Standard Error: 1_127 + .saturating_add(Weight::from_parts(424_751, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_844_000 picoseconds. - Weight::from_parts(88_247_426, 0) - // Standard Error: 280_700 - .saturating_add(Weight::from_parts(17_706_873, 0).saturating_mul(r.into())) + // Minimum execution time: 84_893_000 picoseconds. + Weight::from_parts(88_684_789, 0) + // Standard Error: 287_468 + .saturating_add(Weight::from_parts(16_661_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_987_000 picoseconds. - Weight::from_parts(87_544_514, 0) - // Standard Error: 269_120 - .saturating_add(Weight::from_parts(21_098_185, 0).saturating_mul(r.into())) + // Minimum execution time: 84_534_000 picoseconds. + Weight::from_parts(88_923_020, 0) + // Standard Error: 249_896 + .saturating_add(Weight::from_parts(19_208_979, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_012_000 picoseconds. - Weight::from_parts(115_149_368, 0) - // Standard Error: 328_818 - .saturating_add(Weight::from_parts(265_684_350, 0).saturating_mul(r.into())) + // Minimum execution time: 85_229_000 picoseconds. + Weight::from_parts(120_908_395, 0) + // Standard Error: 327_109 + .saturating_add(Weight::from_parts(190_143_835, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_890_000 picoseconds. - Weight::from_parts(102_844_000, 0) - // Standard Error: 2_931 - .saturating_add(Weight::from_parts(635_797, 0).saturating_mul(n.into())) + // Minimum execution time: 98_549_000 picoseconds. + Weight::from_parts(100_553_000, 0) + // Standard Error: 2_727 + .saturating_add(Weight::from_parts(616_949, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 563_182_000 picoseconds. - Weight::from_parts(640_794_146, 0) - // Standard Error: 7_497_207 - .saturating_add(Weight::from_parts(15_239_053, 0).saturating_mul(r.into())) + // Minimum execution time: 553_918_000 picoseconds. + Weight::from_parts(572_988_848, 0) + // Standard Error: 2_210_952 + .saturating_add(Weight::from_parts(30_333_551, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 560_481_000 picoseconds. - Weight::from_parts(593_427_573, 0) - // Standard Error: 3_203_142 - .saturating_add(Weight::from_parts(25_969_526, 0).saturating_mul(r.into())) + // Minimum execution time: 552_664_000 picoseconds. + Weight::from_parts(571_824_067, 0) + // Standard Error: 1_981_598 + .saturating_add(Weight::from_parts(28_343_432, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_574_000 picoseconds. - Weight::from_parts(97_280_140, 0) - // Standard Error: 268_694 - .saturating_add(Weight::from_parts(12_092_859, 0).saturating_mul(r.into())) + // Minimum execution time: 96_114_000 picoseconds. + Weight::from_parts(99_799_695, 0) + // Standard Error: 263_342 + .saturating_add(Weight::from_parts(5_959_704, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 109_631_000 picoseconds. - Weight::from_parts(94_175_255, 0) - // Standard Error: 1_213 - .saturating_add(Weight::from_parts(427_553, 0).saturating_mul(n.into())) + // Minimum execution time: 104_595_000 picoseconds. + Weight::from_parts(94_900_895, 0) + // Standard Error: 1_221 + .saturating_add(Weight::from_parts(425_729, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_505_000 picoseconds. - Weight::from_parts(100_109_459, 0) - // Standard Error: 279_145 - .saturating_add(Weight::from_parts(8_335_840, 0).saturating_mul(r.into())) + // Minimum execution time: 94_123_000 picoseconds. + Weight::from_parts(99_068_002, 0) + // Standard Error: 278_340 + .saturating_add(Weight::from_parts(6_056_397, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_015_000 picoseconds. - Weight::from_parts(96_000_128, 0) - // Standard Error: 1_363 - .saturating_add(Weight::from_parts(423_685, 0).saturating_mul(n.into())) + // Minimum execution time: 106_148_000 picoseconds. + Weight::from_parts(93_583_351, 0) + // Standard Error: 1_048 + .saturating_add(Weight::from_parts(420_112, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_784_000 picoseconds. - Weight::from_parts(84_956_444, 0) - // Standard Error: 285_268 - .saturating_add(Weight::from_parts(178_346_410, 0).saturating_mul(r.into())) + // Minimum execution time: 83_951_000 picoseconds. + Weight::from_parts(80_983_069, 0) + // Standard Error: 260_297 + .saturating_add(Weight::from_parts(114_164_207, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_915_000 picoseconds. - Weight::from_parts(78_586_027, 0) - // Standard Error: 254_710 - .saturating_add(Weight::from_parts(178_243_954, 0).saturating_mul(r.into())) + // Minimum execution time: 88_991_000 picoseconds. + Weight::from_parts(83_808_552, 0) + // Standard Error: 291_596 + .saturating_add(Weight::from_parts(107_977_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 557_380_000 picoseconds. - Weight::from_parts(633_253_100, 0) - // Standard Error: 538_762 - .saturating_add(Weight::from_parts(195_061_580, 0).saturating_mul(r.into())) + // Minimum execution time: 555_192_000 picoseconds. + Weight::from_parts(637_741_196, 0) + // Standard Error: 498_770 + .saturating_add(Weight::from_parts(126_311_515, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 597_682_000 picoseconds. - Weight::from_parts(661_897_574, 0) - // Standard Error: 3_826 - .saturating_add(Weight::from_parts(136_457, 0).saturating_mul(n.into())) + // Minimum execution time: 567_642_000 picoseconds. + Weight::from_parts(587_862_774, 0) + // Standard Error: 1_100 + .saturating_add(Weight::from_parts(120_318, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_454_821_000 picoseconds. - Weight::from_parts(4_682_125_339, 0) - // Standard Error: 520_741 - .saturating_add(Weight::from_parts(206_155_172, 0).saturating_mul(r.into())) + // Minimum execution time: 2_764_152_000 picoseconds. + Weight::from_parts(2_885_803_691, 0) + // Standard Error: 562_616 + .saturating_add(Weight::from_parts(154_883_526, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_637_831_000 picoseconds. - Weight::from_parts(4_748_853_254, 0) - // Standard Error: 16_010 - .saturating_add(Weight::from_parts(12_276_105, 0).saturating_mul(n.into())) + // Minimum execution time: 2_942_765_000 picoseconds. + Weight::from_parts(2_852_597_513, 0) + // Standard Error: 14_069 + .saturating_add(Weight::from_parts(12_388_759, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_447_000 picoseconds. - Weight::from_parts(111_081_974, 0) - // Standard Error: 422_093 - .saturating_add(Weight::from_parts(195_515_962, 0).saturating_mul(r.into())) + // Minimum execution time: 85_236_000 picoseconds. + Weight::from_parts(108_121_903, 0) + // Standard Error: 338_552 + .saturating_add(Weight::from_parts(130_391_399, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 188_901_000 picoseconds. - Weight::from_parts(192_422_000, 0) - // Standard Error: 54_402 - .saturating_add(Weight::from_parts(25_703_289, 0).saturating_mul(n.into())) + // Minimum execution time: 143_555_000 picoseconds. + Weight::from_parts(145_256_000, 0) + // Standard Error: 61_456 + .saturating_add(Weight::from_parts(25_766_308, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_538_000 picoseconds. - Weight::from_parts(83_073_715, 0) - // Standard Error: 285_530 - .saturating_add(Weight::from_parts(174_178_092, 0).saturating_mul(r.into())) + // Minimum execution time: 88_706_000 picoseconds. + Weight::from_parts(82_734_112, 0) + // Standard Error: 323_634 + .saturating_add(Weight::from_parts(107_133_410, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_697_000 picoseconds. - Weight::from_parts(89_049_881, 0) - // Standard Error: 281_628 - .saturating_add(Weight::from_parts(27_362_618, 0).saturating_mul(r.into())) + // Minimum execution time: 84_050_000 picoseconds. + Weight::from_parts(88_261_802, 0) + // Standard Error: 247_640 + .saturating_add(Weight::from_parts(23_580_197, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_006_000 picoseconds. - Weight::from_parts(86_657_161, 0) - // Standard Error: 254_208 - .saturating_add(Weight::from_parts(14_853_038, 0).saturating_mul(r.into())) + // Minimum execution time: 86_558_000 picoseconds. + Weight::from_parts(90_338_028, 0) + // Standard Error: 270_999 + .saturating_add(Weight::from_parts(15_249_771, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_155_000 picoseconds. - Weight::from_parts(87_136_381, 0) - // Standard Error: 296_075 - .saturating_add(Weight::from_parts(15_564_718, 0).saturating_mul(r.into())) + // Minimum execution time: 86_250_000 picoseconds. + Weight::from_parts(90_448_269, 0) + // Standard Error: 274_039 + .saturating_add(Weight::from_parts(12_874_930, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_160_000 picoseconds. - Weight::from_parts(87_382_440, 0) - // Standard Error: 263_499 - .saturating_add(Weight::from_parts(17_288_459, 0).saturating_mul(r.into())) + // Minimum execution time: 84_278_000 picoseconds. + Weight::from_parts(88_025_842, 0) + // Standard Error: 274_359 + .saturating_add(Weight::from_parts(11_610_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_780_000 picoseconds. - Weight::from_parts(90_970_389, 0) - // Standard Error: 273_512 - .saturating_add(Weight::from_parts(14_976_210, 0).saturating_mul(r.into())) + // Minimum execution time: 83_849_000 picoseconds. + Weight::from_parts(87_858_273, 0) + // Standard Error: 263_624 + .saturating_add(Weight::from_parts(14_636_926, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 141_871_000 picoseconds. - Weight::from_parts(203_107_595, 0) - // Standard Error: 322_999 - .saturating_add(Weight::from_parts(280_023_774, 0).saturating_mul(r.into())) + // Minimum execution time: 134_444_000 picoseconds. + Weight::from_parts(198_654_906, 0) + // Standard Error: 409_120 + .saturating_add(Weight::from_parts(200_669_427, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 99_132_000 picoseconds. - Weight::from_parts(166_620_417, 0) - // Standard Error: 428_363 - .saturating_add(Weight::from_parts(469_520_431, 0).saturating_mul(r.into())) + // Minimum execution time: 97_737_000 picoseconds. + Weight::from_parts(162_389_592, 0) + // Standard Error: 437_002 + .saturating_add(Weight::from_parts(385_229_944, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2950,22 +2952,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 46_670_030_000 picoseconds. - Weight::from_parts(46_979_707_000, 0) - // Standard Error: 290_199 - .saturating_add(Weight::from_parts(7_295_075, 0).saturating_mul(p.into())) - // Standard Error: 290_185 - .saturating_add(Weight::from_parts(178_049_340, 0).saturating_mul(s.into())) + // Minimum execution time: 44_710_614_000 picoseconds. + Weight::from_parts(44_848_530_000, 0) + // Standard Error: 271_081 + .saturating_add(Weight::from_parts(7_518_236, 0).saturating_mul(p.into())) + // Standard Error: 271_067 + .saturating_add(Weight::from_parts(176_484_363, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_401_000 picoseconds. - Weight::from_parts(162_215_381, 0) - // Standard Error: 435_866 - .saturating_add(Weight::from_parts(479_266_464, 0).saturating_mul(r.into())) + // Minimum execution time: 93_935_000 picoseconds. + Weight::from_parts(155_283_975, 0) + // Standard Error: 398_331 + .saturating_add(Weight::from_parts(394_750_144, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2973,32 +2975,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 44_093_174_000 picoseconds. - Weight::from_parts(44_268_099_000, 0) - // Standard Error: 249_484 - .saturating_add(Weight::from_parts(7_595_737, 0).saturating_mul(p.into())) - // Standard Error: 249_471 - .saturating_add(Weight::from_parts(179_055_114, 0).saturating_mul(s.into())) + // Minimum execution time: 43_166_105_000 picoseconds. + Weight::from_parts(43_210_411_000, 0) + // Standard Error: 273_792 + .saturating_add(Weight::from_parts(7_685_961, 0).saturating_mul(p.into())) + // Standard Error: 273_779 + .saturating_add(Weight::from_parts(177_206_473, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_188_000 picoseconds. - Weight::from_parts(101_583_480, 0) - // Standard Error: 35_878 - .saturating_add(Weight::from_parts(3_611_568, 0).saturating_mul(r.into())) + // Minimum execution time: 86_385_000 picoseconds. + Weight::from_parts(100_368_488, 0) + // Standard Error: 25_882 + .saturating_add(Weight::from_parts(2_517_495, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 86_183_000 picoseconds. - Weight::from_parts(118_618_192, 1131) - // Standard Error: 6_832 - .saturating_add(Weight::from_parts(11_877_671, 0).saturating_mul(p.into())) + // Minimum execution time: 86_723_000 picoseconds. + Weight::from_parts(112_959_650, 1131) + // Standard Error: 5_171 + .saturating_add(Weight::from_parts(11_884_248, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3007,10 +3009,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 84_629_000 picoseconds. - Weight::from_parts(86_416_000, 1131) - // Standard Error: 28_253 - .saturating_add(Weight::from_parts(36_463_142, 0).saturating_mul(p.into())) + // Minimum execution time: 85_367_000 picoseconds. + Weight::from_parts(86_968_000, 1131) + // Standard Error: 35_935 + .saturating_add(Weight::from_parts(35_294_476, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3019,10 +3021,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_148_282_000 picoseconds. - Weight::from_parts(5_977_321_351, 5069931) - // Standard Error: 52_501 - .saturating_add(Weight::from_parts(36_684_019, 0).saturating_mul(p.into())) + // Minimum execution time: 6_166_740_000 picoseconds. + Weight::from_parts(5_878_966_706, 5069931) + // Standard Error: 72_748 + .saturating_add(Weight::from_parts(35_598_278, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -3030,10 +3032,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_557_000 picoseconds. - Weight::from_parts(86_547_000, 1939) - // Standard Error: 32_777 - .saturating_add(Weight::from_parts(46_224_064, 0).saturating_mul(p.into())) + // Minimum execution time: 84_509_000 picoseconds. + Weight::from_parts(86_396_000, 1939) + // Standard Error: 37_909 + .saturating_add(Weight::from_parts(46_229_201, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -3042,10 +3044,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 89_966_000 picoseconds. - Weight::from_parts(89_543_596, 1131) - // Standard Error: 68_448 - .saturating_add(Weight::from_parts(36_359_585, 0).saturating_mul(p.into())) + // Minimum execution time: 89_570_000 picoseconds. + Weight::from_parts(91_679_907, 1131) + // Standard Error: 74_102 + .saturating_add(Weight::from_parts(36_034_356, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3054,10 +3056,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 600_329_000 picoseconds. - Weight::from_parts(623_878_315, 1496) - // Standard Error: 267_055 - .saturating_add(Weight::from_parts(46_147_238, 0).saturating_mul(p.into())) + // Minimum execution time: 581_516_000 picoseconds. + Weight::from_parts(574_828_964, 1496) + // Standard Error: 226_535 + .saturating_add(Weight::from_parts(44_029_625, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3066,10 +3068,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_023_023_000 picoseconds. - Weight::from_parts(1_022_993_537, 317931) - // Standard Error: 203_791 - .saturating_add(Weight::from_parts(43_538_291, 0).saturating_mul(p.into())) + // Minimum execution time: 984_554_000 picoseconds. + Weight::from_parts(1_010_300_775, 317931) + // Standard Error: 330_750 + .saturating_add(Weight::from_parts(45_768_209, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3077,884 +3079,882 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_300_000 picoseconds. - Weight::from_parts(2_436_506, 0) - // Standard Error: 16_946 - .saturating_add(Weight::from_parts(24_493_632, 0).saturating_mul(r.into())) + // Minimum execution time: 4_399_000 picoseconds. + Weight::from_parts(2_513_898, 0) + // Standard Error: 22_468 + .saturating_add(Weight::from_parts(24_974_238, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_347_874_000 picoseconds. - Weight::from_parts(4_179_322_071, 0) - // Standard Error: 53_086 - .saturating_add(Weight::from_parts(4_505_224, 0).saturating_mul(r.into())) + // Minimum execution time: 4_354_805_000 picoseconds. + Weight::from_parts(4_247_725_842, 0) + // Standard Error: 49_167 + .saturating_add(Weight::from_parts(4_375_644, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_348_187_000 picoseconds. - Weight::from_parts(4_205_195_765, 0) - // Standard Error: 44_017 - .saturating_add(Weight::from_parts(4_404_586, 0).saturating_mul(r.into())) + // Minimum execution time: 4_344_769_000 picoseconds. + Weight::from_parts(4_143_583_164, 0) + // Standard Error: 64_865 + .saturating_add(Weight::from_parts(4_885_201, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_882_662_000 picoseconds. - Weight::from_parts(11_083_501_979, 0) - // Standard Error: 200_162 - .saturating_add(Weight::from_parts(13_165_815, 0).saturating_mul(r.into())) + // Minimum execution time: 10_321_597_000 picoseconds. + Weight::from_parts(10_856_474_625, 0) + // Standard Error: 228_480 + .saturating_add(Weight::from_parts(13_648_467, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_784_867_000 picoseconds. - Weight::from_parts(11_957_102_430, 0) - // Standard Error: 187_347 - .saturating_add(Weight::from_parts(8_480_335, 0).saturating_mul(r.into())) + // Minimum execution time: 10_444_861_000 picoseconds. + Weight::from_parts(11_811_924_847, 0) + // Standard Error: 220_732 + .saturating_add(Weight::from_parts(8_104_347, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_343_000 picoseconds. - Weight::from_parts(2_421_000, 0) - // Standard Error: 9_011 - .saturating_add(Weight::from_parts(3_834_828, 0).saturating_mul(r.into())) + // Minimum execution time: 2_102_000 picoseconds. + Weight::from_parts(2_199_000, 0) + // Standard Error: 8_145 + .saturating_add(Weight::from_parts(3_817_860, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_326_000 picoseconds. - Weight::from_parts(2_421_000, 0) - // Standard Error: 5_612 - .saturating_add(Weight::from_parts(3_061_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_084_000 picoseconds. + Weight::from_parts(2_171_000, 0) + // Standard Error: 5_734 + .saturating_add(Weight::from_parts(3_044_285, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(3_427_769, 0) - // Standard Error: 941 - .saturating_add(Weight::from_parts(1_568_677, 0).saturating_mul(r.into())) + // Minimum execution time: 2_074_000 picoseconds. + Weight::from_parts(3_341_361, 0) + // Standard Error: 1_168 + .saturating_add(Weight::from_parts(1_569_364, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_284_000 picoseconds. - Weight::from_parts(2_392_000, 0) - // Standard Error: 8_418 - .saturating_add(Weight::from_parts(2_921_747, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_253_000, 0) + // Standard Error: 7_562 + .saturating_add(Weight::from_parts(2_914_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_263_000 picoseconds. - Weight::from_parts(1_354_050, 0) - // Standard Error: 14_642 - .saturating_add(Weight::from_parts(5_182_595, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(99_037, 0) + // Standard Error: 11_949 + .saturating_add(Weight::from_parts(5_173_684, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_011_000 picoseconds. - Weight::from_parts(5_823_252, 0) - // Standard Error: 2_035 - .saturating_add(Weight::from_parts(162_988, 0).saturating_mul(e.into())) + // Minimum execution time: 6_992_000 picoseconds. + Weight::from_parts(6_256_207, 0) + // Standard Error: 1_332 + .saturating_add(Weight::from_parts(161_069, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_405_000 picoseconds. - Weight::from_parts(5_172_082, 0) - // Standard Error: 7_906 - .saturating_add(Weight::from_parts(2_576_107, 0).saturating_mul(r.into())) + // Minimum execution time: 2_106_000 picoseconds. + Weight::from_parts(4_233_365, 0) + // Standard Error: 7_839 + .saturating_add(Weight::from_parts(2_631_387, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_576_107 - - 2_413_885, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_631_387 - + 2_404_882, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_315_000 picoseconds. - Weight::from_parts(4_417_546, 0) - // Standard Error: 12_281 - .saturating_add(Weight::from_parts(2_413_885, 0).saturating_mul(r.into())) + // Minimum execution time: 2_192_000 picoseconds. + Weight::from_parts(4_830_171, 0) + // Standard Error: 12_370 + .saturating_add(Weight::from_parts(2_404_882, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_774_000 picoseconds. - Weight::from_parts(19_445_534, 0) - // Standard Error: 34_031 - .saturating_add(Weight::from_parts(9_947_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_413_000 picoseconds. + Weight::from_parts(16_855_535, 0) + // Standard Error: 25_880 + .saturating_add(Weight::from_parts(10_029_290, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_663_000 picoseconds. - Weight::from_parts(2_443_915, 0) - // Standard Error: 6_189 - .saturating_add(Weight::from_parts(1_274_832, 0).saturating_mul(p.into())) + // Minimum execution time: 12_145_000 picoseconds. + Weight::from_parts(4_520_615, 0) + // Standard Error: 6_765 + .saturating_add(Weight::from_parts(1_202_471, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(l: u32, ) -> Weight { + fn instr_call_per_local(_l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_382_000 picoseconds. - Weight::from_parts(5_657_220, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(14, 0).saturating_mul(l.into())) + // Minimum execution time: 5_133_000 picoseconds. + Weight::from_parts(5_476_163, 0) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_461_000 picoseconds. - Weight::from_parts(1_936_508, 0) - // Standard Error: 3_019 - .saturating_add(Weight::from_parts(275_086, 0).saturating_mul(r.into())) + // Minimum execution time: 2_117_000 picoseconds. + Weight::from_parts(1_458_597, 0) + // Standard Error: 3_356 + .saturating_add(Weight::from_parts(265_574, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_305_000 picoseconds. - Weight::from_parts(2_394_000, 0) - // Standard Error: 4_239 - .saturating_add(Weight::from_parts(763_775, 0).saturating_mul(r.into())) + // Minimum execution time: 2_135_000 picoseconds. + Weight::from_parts(2_223_000, 0) + // Standard Error: 5_214 + .saturating_add(Weight::from_parts(766_010, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_367_000 picoseconds. - Weight::from_parts(2_411_000, 0) - // Standard Error: 5_426 - .saturating_add(Weight::from_parts(771_295, 0).saturating_mul(r.into())) + // Minimum execution time: 2_078_000 picoseconds. + Weight::from_parts(2_218_000, 0) + // Standard Error: 5_801 + .saturating_add(Weight::from_parts(743_573, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_346_000 picoseconds. - Weight::from_parts(2_691_888, 0) - // Standard Error: 7_020 - .saturating_add(Weight::from_parts(804_877, 0).saturating_mul(r.into())) + // Minimum execution time: 6_226_000 picoseconds. + Weight::from_parts(2_093_625, 0) + // Standard Error: 7_678 + .saturating_add(Weight::from_parts(824_956, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_476_000 picoseconds. - Weight::from_parts(6_582_000, 0) - // Standard Error: 8_493 - .saturating_add(Weight::from_parts(1_358_866, 0).saturating_mul(r.into())) + // Minimum execution time: 6_201_000 picoseconds. + Weight::from_parts(154_770, 0) + // Standard Error: 9_398 + .saturating_add(Weight::from_parts(1_480_245, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_943_000 picoseconds. - Weight::from_parts(1_102_558, 0) - // Standard Error: 12_614 - .saturating_add(Weight::from_parts(7_099_473, 0).saturating_mul(r.into())) + // Minimum execution time: 6_989_000 picoseconds. + Weight::from_parts(2_628_082, 0) + // Standard Error: 12_268 + .saturating_add(Weight::from_parts(6_921_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_298_000 picoseconds. - Weight::from_parts(2_357_000, 0) - // Standard Error: 7_419 - .saturating_add(Weight::from_parts(3_438_043, 0).saturating_mul(r.into())) + // Minimum execution time: 2_086_000 picoseconds. + Weight::from_parts(2_156_000, 0) + // Standard Error: 5_477 + .saturating_add(Weight::from_parts(3_348_027, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_201_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 7_089 - .saturating_add(Weight::from_parts(3_224_674, 0).saturating_mul(r.into())) + // Minimum execution time: 2_102_000 picoseconds. + Weight::from_parts(2_163_000, 0) + // Standard Error: 6_833 + .saturating_add(Weight::from_parts(3_134_916, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_358_000 picoseconds. - Weight::from_parts(2_444_000, 0) - // Standard Error: 5_880 - .saturating_add(Weight::from_parts(3_196_577, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(2_209_000, 0) + // Standard Error: 7_612 + .saturating_add(Weight::from_parts(3_170_404, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_205_000 picoseconds. - Weight::from_parts(2_361_000, 0) - // Standard Error: 5_007 - .saturating_add(Weight::from_parts(2_694_074, 0).saturating_mul(r.into())) + // Minimum execution time: 2_124_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 4_823 + .saturating_add(Weight::from_parts(2_668_874, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_217_000 picoseconds. - Weight::from_parts(2_339_000, 0) - // Standard Error: 4_242 - .saturating_add(Weight::from_parts(562_083, 0).saturating_mul(r.into())) + // Minimum execution time: 2_159_000 picoseconds. + Weight::from_parts(2_240_000, 0) + // Standard Error: 3_992 + .saturating_add(Weight::from_parts(559_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(1_150_328, 0) - // Standard Error: 4_155 - .saturating_add(Weight::from_parts(430_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_127_000 picoseconds. + Weight::from_parts(1_178_239, 0) + // Standard Error: 3_346 + .saturating_add(Weight::from_parts(416_704, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_269_000, 0) - // Standard Error: 12_863 - .saturating_add(Weight::from_parts(1_875_276, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 11_707 + .saturating_add(Weight::from_parts(1_918_501, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_290_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 8_333 - .saturating_add(Weight::from_parts(1_185_939, 0).saturating_mul(r.into())) + // Minimum execution time: 2_131_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 7_593 + .saturating_add(Weight::from_parts(1_219_931, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_384_000 picoseconds. - Weight::from_parts(1_572_617, 0) - // Standard Error: 3_727 - .saturating_add(Weight::from_parts(382_695, 0).saturating_mul(r.into())) + // Minimum execution time: 2_124_000 picoseconds. + Weight::from_parts(726_401, 0) + // Standard Error: 4_086 + .saturating_add(Weight::from_parts(424_161, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(1_495_799, 0) - // Standard Error: 4_058 - .saturating_add(Weight::from_parts(373_636, 0).saturating_mul(r.into())) + // Minimum execution time: 2_107_000 picoseconds. + Weight::from_parts(1_225_918, 0) + // Standard Error: 3_748 + .saturating_add(Weight::from_parts(392_373, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_341_000 picoseconds. - Weight::from_parts(465_059, 0) - // Standard Error: 4_917 - .saturating_add(Weight::from_parts(551_259, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(11_174, 0) + // Standard Error: 5_816 + .saturating_add(Weight::from_parts(594_467, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(515_890, 0) - // Standard Error: 4_848 - .saturating_add(Weight::from_parts(545_542, 0).saturating_mul(r.into())) + // Minimum execution time: 2_138_000 picoseconds. + Weight::from_parts(12_680, 0) + // Standard Error: 5_830 + .saturating_add(Weight::from_parts(595_552, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(739_709, 0) - // Standard Error: 4_827 - .saturating_add(Weight::from_parts(496_885, 0).saturating_mul(r.into())) + // Minimum execution time: 2_163_000 picoseconds. + Weight::from_parts(172_344, 0) + // Standard Error: 5_372 + .saturating_add(Weight::from_parts(537_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_322_000 picoseconds. - Weight::from_parts(1_492_190, 0) - // Standard Error: 3_923 - .saturating_add(Weight::from_parts(340_665, 0).saturating_mul(r.into())) + // Minimum execution time: 2_171_000 picoseconds. + Weight::from_parts(459_682, 0) + // Standard Error: 5_533 + .saturating_add(Weight::from_parts(421_155, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_979_817, 0) - // Standard Error: 1_972 - .saturating_add(Weight::from_parts(154_315, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_640_857, 0) + // Standard Error: 2_132 + .saturating_add(Weight::from_parts(175_772, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(2_877_230, 0) - // Standard Error: 1_753 - .saturating_add(Weight::from_parts(153_462, 0).saturating_mul(r.into())) + // Minimum execution time: 2_149_000 picoseconds. + Weight::from_parts(2_625_890, 0) + // Standard Error: 2_246 + .saturating_add(Weight::from_parts(177_728, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 11_649 - .saturating_add(Weight::from_parts(1_795_062, 0).saturating_mul(r.into())) + // Minimum execution time: 2_082_000 picoseconds. + Weight::from_parts(2_193_000, 0) + // Standard Error: 9_664 + .saturating_add(Weight::from_parts(1_832_396, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_303_000 picoseconds. - Weight::from_parts(2_366_000, 0) - // Standard Error: 7_436 - .saturating_add(Weight::from_parts(1_091_962, 0).saturating_mul(r.into())) + // Minimum execution time: 2_029_000 picoseconds. + Weight::from_parts(2_185_000, 0) + // Standard Error: 7_691 + .saturating_add(Weight::from_parts(1_203_465, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_346_000 picoseconds. - Weight::from_parts(2_409_000, 0) - // Standard Error: 11_197 - .saturating_add(Weight::from_parts(1_828_518, 0).saturating_mul(r.into())) + // Minimum execution time: 2_146_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 10_390 + .saturating_add(Weight::from_parts(1_868_795, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_328_000 picoseconds. - Weight::from_parts(2_384_000, 0) - // Standard Error: 7_307 - .saturating_add(Weight::from_parts(1_106_869, 0).saturating_mul(r.into())) + // Minimum execution time: 2_082_000 picoseconds. + Weight::from_parts(2_133_000, 0) + // Standard Error: 8_282 + .saturating_add(Weight::from_parts(1_199_983, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_286_000 picoseconds. - Weight::from_parts(2_343_000, 0) - // Standard Error: 10_932 - .saturating_add(Weight::from_parts(1_789_419, 0).saturating_mul(r.into())) + // Minimum execution time: 2_145_000 picoseconds. + Weight::from_parts(2_178_000, 0) + // Standard Error: 10_175 + .saturating_add(Weight::from_parts(1_943_386, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 7_556 - .saturating_add(Weight::from_parts(1_111_326, 0).saturating_mul(r.into())) + // Minimum execution time: 2_094_000 picoseconds. + Weight::from_parts(2_168_000, 0) + // Standard Error: 6_923 + .saturating_add(Weight::from_parts(1_125_091, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_263_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 10_995 - .saturating_add(Weight::from_parts(1_822_680, 0).saturating_mul(r.into())) + // Minimum execution time: 2_200_000 picoseconds. + Weight::from_parts(2_250_000, 0) + // Standard Error: 11_944 + .saturating_add(Weight::from_parts(1_852_545, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_276_000 picoseconds. - Weight::from_parts(2_334_000, 0) - // Standard Error: 6_944 - .saturating_add(Weight::from_parts(1_121_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_121_000, 0) + // Standard Error: 7_914 + .saturating_add(Weight::from_parts(1_171_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 11_873 - .saturating_add(Weight::from_parts(1_840_273, 0).saturating_mul(r.into())) + // Minimum execution time: 2_171_000 picoseconds. + Weight::from_parts(2_278_000, 0) + // Standard Error: 10_701 + .saturating_add(Weight::from_parts(1_859_283, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_265_000 picoseconds. - Weight::from_parts(2_409_000, 0) - // Standard Error: 7_972 - .saturating_add(Weight::from_parts(1_134_825, 0).saturating_mul(r.into())) + // Minimum execution time: 2_167_000 picoseconds. + Weight::from_parts(2_209_000, 0) + // Standard Error: 7_361 + .saturating_add(Weight::from_parts(1_182_113, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_269_000 picoseconds. - Weight::from_parts(2_355_000, 0) - // Standard Error: 11_547 - .saturating_add(Weight::from_parts(1_813_029, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_239_000, 0) + // Standard Error: 12_468 + .saturating_add(Weight::from_parts(1_847_236, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_273_000 picoseconds. - Weight::from_parts(2_349_000, 0) - // Standard Error: 6_487 - .saturating_add(Weight::from_parts(1_091_201, 0).saturating_mul(r.into())) + // Minimum execution time: 2_072_000 picoseconds. + Weight::from_parts(2_164_000, 0) + // Standard Error: 8_208 + .saturating_add(Weight::from_parts(1_117_969, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_329_000, 0) - // Standard Error: 12_018 - .saturating_add(Weight::from_parts(1_823_755, 0).saturating_mul(r.into())) + // Minimum execution time: 2_077_000 picoseconds. + Weight::from_parts(2_155_000, 0) + // Standard Error: 9_963 + .saturating_add(Weight::from_parts(1_877_035, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(2_359_000, 0) - // Standard Error: 7_325 - .saturating_add(Weight::from_parts(1_192_292, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 7_561 + .saturating_add(Weight::from_parts(1_124_600, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_352_000 picoseconds. - Weight::from_parts(2_386_000, 0) - // Standard Error: 10_009 - .saturating_add(Weight::from_parts(1_870_539, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_210_000, 0) + // Standard Error: 11_998 + .saturating_add(Weight::from_parts(1_829_852, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_315_000 picoseconds. - Weight::from_parts(2_382_000, 0) - // Standard Error: 7_109 - .saturating_add(Weight::from_parts(1_122_152, 0).saturating_mul(r.into())) + // Minimum execution time: 2_098_000 picoseconds. + Weight::from_parts(2_189_000, 0) + // Standard Error: 8_286 + .saturating_add(Weight::from_parts(1_189_196, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_337_000, 0) - // Standard Error: 11_700 - .saturating_add(Weight::from_parts(1_825_021, 0).saturating_mul(r.into())) + // Minimum execution time: 2_125_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 10_056 + .saturating_add(Weight::from_parts(1_829_185, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_357_000 picoseconds. - Weight::from_parts(2_407_000, 0) - // Standard Error: 7_769 - .saturating_add(Weight::from_parts(1_146_472, 0).saturating_mul(r.into())) + // Minimum execution time: 2_065_000 picoseconds. + Weight::from_parts(2_174_000, 0) + // Standard Error: 8_171 + .saturating_add(Weight::from_parts(1_176_701, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_196_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 9_908 - .saturating_add(Weight::from_parts(1_845_094, 0).saturating_mul(r.into())) + // Minimum execution time: 2_141_000 picoseconds. + Weight::from_parts(2_220_000, 0) + // Standard Error: 9_910 + .saturating_add(Weight::from_parts(1_871_442, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_276_000 picoseconds. - Weight::from_parts(2_382_000, 0) - // Standard Error: 9_519 - .saturating_add(Weight::from_parts(1_241_507, 0).saturating_mul(r.into())) + // Minimum execution time: 2_024_000 picoseconds. + Weight::from_parts(2_166_000, 0) + // Standard Error: 7_933 + .saturating_add(Weight::from_parts(1_156_214, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 7_921 - .saturating_add(Weight::from_parts(1_330_988, 0).saturating_mul(r.into())) + // Minimum execution time: 2_068_000 picoseconds. + Weight::from_parts(2_169_000, 0) + // Standard Error: 7_815 + .saturating_add(Weight::from_parts(1_353_927, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_203_000 picoseconds. - Weight::from_parts(2_262_000, 0) - // Standard Error: 4_732 - .saturating_add(Weight::from_parts(619_908, 0).saturating_mul(r.into())) + // Minimum execution time: 2_157_000 picoseconds. + Weight::from_parts(2_208_000, 0) + // Standard Error: 4_587 + .saturating_add(Weight::from_parts(635_023, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_273_000 picoseconds. - Weight::from_parts(2_318_000, 0) - // Standard Error: 8_121 - .saturating_add(Weight::from_parts(1_255_733, 0).saturating_mul(r.into())) + // Minimum execution time: 2_080_000 picoseconds. + Weight::from_parts(2_140_000, 0) + // Standard Error: 8_399 + .saturating_add(Weight::from_parts(1_278_782, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_332_000 picoseconds. - Weight::from_parts(2_392_000, 0) - // Standard Error: 5_698 - .saturating_add(Weight::from_parts(666_782, 0).saturating_mul(r.into())) + // Minimum execution time: 2_069_000 picoseconds. + Weight::from_parts(2_233_000, 0) + // Standard Error: 6_395 + .saturating_add(Weight::from_parts(682_415, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_269_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 10_724 - .saturating_add(Weight::from_parts(1_779_885, 0).saturating_mul(r.into())) + // Minimum execution time: 2_206_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 9_477 + .saturating_add(Weight::from_parts(1_819_764, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_239_000 picoseconds. - Weight::from_parts(2_377_000, 0) - // Standard Error: 8_303 - .saturating_add(Weight::from_parts(1_231_579, 0).saturating_mul(r.into())) + // Minimum execution time: 2_095_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 7_615 + .saturating_add(Weight::from_parts(1_207_931, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(3_881_473, 0) - // Standard Error: 22_336 - .saturating_add(Weight::from_parts(2_602_873, 0).saturating_mul(r.into())) + // Minimum execution time: 2_108_000 picoseconds. + Weight::from_parts(1_363_438, 0) + // Standard Error: 18_139 + .saturating_add(Weight::from_parts(2_743_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_366_000 picoseconds. - Weight::from_parts(971_800, 0) - // Standard Error: 9_516 - .saturating_add(Weight::from_parts(2_473_994, 0).saturating_mul(r.into())) + // Minimum execution time: 2_197_000 picoseconds. + Weight::from_parts(726_043, 0) + // Standard Error: 12_539 + .saturating_add(Weight::from_parts(2_447_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_333_000 picoseconds. - Weight::from_parts(3_150_808, 0) - // Standard Error: 24_239 - .saturating_add(Weight::from_parts(2_853_024, 0).saturating_mul(r.into())) + // Minimum execution time: 2_118_000 picoseconds. + Weight::from_parts(1_113_814, 0) + // Standard Error: 15_837 + .saturating_add(Weight::from_parts(2_939_546, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(1_149_774, 0) - // Standard Error: 13_355 - .saturating_add(Weight::from_parts(2_517_122, 0).saturating_mul(r.into())) + // Minimum execution time: 2_121_000 picoseconds. + Weight::from_parts(2_089_486, 0) + // Standard Error: 15_833 + .saturating_add(Weight::from_parts(2_447_304, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(1_527_824, 0) - // Standard Error: 31_972 - .saturating_add(Weight::from_parts(9_267_865, 0).saturating_mul(r.into())) + // Minimum execution time: 2_200_000 picoseconds. + Weight::from_parts(2_235_000, 0) + // Standard Error: 16_089 + .saturating_add(Weight::from_parts(9_370_736, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_323_000 picoseconds. - Weight::from_parts(988_781, 0) - // Standard Error: 44_193 - .saturating_add(Weight::from_parts(7_612_584, 0).saturating_mul(r.into())) + // Minimum execution time: 2_191_000 picoseconds. + Weight::from_parts(3_207_641, 0) + // Standard Error: 45_758 + .saturating_add(Weight::from_parts(7_437_894, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_334_729, 0) - // Standard Error: 15_965 - .saturating_add(Weight::from_parts(2_951_129, 0).saturating_mul(r.into())) + // Minimum execution time: 2_118_000 picoseconds. + Weight::from_parts(588_160, 0) + // Standard Error: 17_384 + .saturating_add(Weight::from_parts(2_989_240, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(1_116_651, 0) - // Standard Error: 17_134 - .saturating_add(Weight::from_parts(2_528_749, 0).saturating_mul(r.into())) + // Minimum execution time: 2_135_000 picoseconds. + Weight::from_parts(4_961_665, 0) + // Standard Error: 26_016 + .saturating_add(Weight::from_parts(2_253_733, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 8_575 - .saturating_add(Weight::from_parts(1_262_352, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_198_000, 0) + // Standard Error: 8_661 + .saturating_add(Weight::from_parts(1_328_375, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_338_000, 0) - // Standard Error: 4_378 - .saturating_add(Weight::from_parts(623_671, 0).saturating_mul(r.into())) + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(2_225_000, 0) + // Standard Error: 4_778 + .saturating_add(Weight::from_parts(648_611, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_335_000 picoseconds. - Weight::from_parts(2_380_000, 0) - // Standard Error: 8_320 - .saturating_add(Weight::from_parts(1_276_618, 0).saturating_mul(r.into())) + // Minimum execution time: 2_125_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 8_338 + .saturating_add(Weight::from_parts(1_260_241, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_330_000 picoseconds. - Weight::from_parts(2_374_000, 0) - // Standard Error: 4_039 - .saturating_add(Weight::from_parts(593_652, 0).saturating_mul(r.into())) + // Minimum execution time: 2_153_000 picoseconds. + Weight::from_parts(2_233_000, 0) + // Standard Error: 5_007 + .saturating_add(Weight::from_parts(642_088, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_220_000 picoseconds. - Weight::from_parts(2_325_000, 0) - // Standard Error: 8_112 - .saturating_add(Weight::from_parts(1_247_970, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_267_000, 0) + // Standard Error: 8_196 + .saturating_add(Weight::from_parts(1_328_828, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_280_000 picoseconds. - Weight::from_parts(2_353_000, 0) - // Standard Error: 4_344 - .saturating_add(Weight::from_parts(606_457, 0).saturating_mul(r.into())) + // Minimum execution time: 2_135_000 picoseconds. + Weight::from_parts(2_211_000, 0) + // Standard Error: 5_376 + .saturating_add(Weight::from_parts(693_541, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_234_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 7_296 - .saturating_add(Weight::from_parts(1_053_977, 0).saturating_mul(r.into())) + // Minimum execution time: 2_208_000 picoseconds. + Weight::from_parts(2_224_000, 0) + // Standard Error: 7_393 + .saturating_add(Weight::from_parts(1_144_418, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_342_000 picoseconds. - Weight::from_parts(75_359, 0) - // Standard Error: 6_197 - .saturating_add(Weight::from_parts(627_367, 0).saturating_mul(r.into())) + // Minimum execution time: 2_161_000 picoseconds. + Weight::from_parts(2_237_000, 0) + // Standard Error: 3_890 + .saturating_add(Weight::from_parts(589_899, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_281_000 picoseconds. - Weight::from_parts(2_367_000, 0) - // Standard Error: 6_750 - .saturating_add(Weight::from_parts(1_078_782, 0).saturating_mul(r.into())) + // Minimum execution time: 2_129_000 picoseconds. + Weight::from_parts(2_219_000, 0) + // Standard Error: 7_182 + .saturating_add(Weight::from_parts(1_101_585, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 4_413 - .saturating_add(Weight::from_parts(586_782, 0).saturating_mul(r.into())) + // Minimum execution time: 2_038_000 picoseconds. + Weight::from_parts(2_126_000, 0) + // Standard Error: 3_865 + .saturating_add(Weight::from_parts(588_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_353_000 picoseconds. - Weight::from_parts(2_385_000, 0) - // Standard Error: 9_421 - .saturating_add(Weight::from_parts(1_130_965, 0).saturating_mul(r.into())) + // Minimum execution time: 2_129_000 picoseconds. + Weight::from_parts(2_215_000, 0) + // Standard Error: 8_265 + .saturating_add(Weight::from_parts(1_152_496, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_344_000 picoseconds. - Weight::from_parts(2_438_000, 0) - // Standard Error: 5_975 - .saturating_add(Weight::from_parts(638_969, 0).saturating_mul(r.into())) + // Minimum execution time: 2_103_000 picoseconds. + Weight::from_parts(2_181_000, 0) + // Standard Error: 3_989 + .saturating_add(Weight::from_parts(614_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_356_000, 0) - // Standard Error: 8_189 - .saturating_add(Weight::from_parts(1_080_515, 0).saturating_mul(r.into())) + // Minimum execution time: 2_133_000 picoseconds. + Weight::from_parts(2_175_000, 0) + // Standard Error: 6_506 + .saturating_add(Weight::from_parts(1_096_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_253_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 3_500 - .saturating_add(Weight::from_parts(556_273, 0).saturating_mul(r.into())) + // Minimum execution time: 2_088_000 picoseconds. + Weight::from_parts(2_154_000, 0) + // Standard Error: 4_053 + .saturating_add(Weight::from_parts(582_323, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_215_000 picoseconds. - Weight::from_parts(2_333_000, 0) - // Standard Error: 7_954 - .saturating_add(Weight::from_parts(1_067_773, 0).saturating_mul(r.into())) + // Minimum execution time: 2_120_000 picoseconds. + Weight::from_parts(2_213_000, 0) + // Standard Error: 6_472 + .saturating_add(Weight::from_parts(1_056_569, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_183_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 3_658 - .saturating_add(Weight::from_parts(566_527, 0).saturating_mul(r.into())) + // Minimum execution time: 2_097_000 picoseconds. + Weight::from_parts(2_192_000, 0) + // Standard Error: 3_800 + .saturating_add(Weight::from_parts(579_517, 0).saturating_mul(r.into())) } } diff --git a/runtime/vara/src/weights/pallet_gear_voucher.rs b/runtime/vara/src/weights/pallet_gear_voucher.rs index 9b536c8f873..2abb7e94df3 100644 --- a/runtime/vara/src/weights/pallet_gear_voucher.rs +++ b/runtime/vara/src/weights/pallet_gear_voucher.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear_voucher //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -47,8 +47,8 @@ impl pallet_gear_voucher::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 30_067_000 picoseconds. - Weight::from_parts(30_908_000, 6196) + // Minimum execution time: 26_637_000 picoseconds. + Weight::from_parts(27_302_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -60,8 +60,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 30_067_000 picoseconds. - Weight::from_parts(30_908_000, 6196) + // Minimum execution time: 26_637_000 picoseconds. + Weight::from_parts(27_302_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/runtime/vara/src/weights/pallet_timestamp.rs b/runtime/vara/src/weights/pallet_timestamp.rs index 47a61b07806..aa716bcc65c 100644 --- a/runtime/vara/src/weights/pallet_timestamp.rs +++ b/runtime/vara/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -48,8 +48,8 @@ impl pallet_timestamp::WeightInfo for SubstrateWeight pallet_timestamp::WeightInfo for SubstrateWeight pallet_utility::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_350_000 picoseconds. - Weight::from_parts(8_163_155, 0) - // Standard Error: 2_074 - .saturating_add(Weight::from_parts(4_084_858, 0).saturating_mul(c.into())) + // Minimum execution time: 5_390_000 picoseconds. + Weight::from_parts(15_138_158, 0) + // Standard Error: 2_071 + .saturating_add(Weight::from_parts(3_958_890, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_978_000 picoseconds. - Weight::from_parts(4_136_000, 0) + // Minimum execution time: 3_614_000 picoseconds. + Weight::from_parts(3_757_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_406_000 picoseconds. - Weight::from_parts(9_180_867, 0) - // Standard Error: 2_030 - .saturating_add(Weight::from_parts(4_259_130, 0).saturating_mul(c.into())) + // Minimum execution time: 5_187_000 picoseconds. + Weight::from_parts(12_724_758, 0) + // Standard Error: 1_830 + .saturating_add(Weight::from_parts(4_146_725, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_029_000 picoseconds. - Weight::from_parts(7_246_000, 0) + // Minimum execution time: 6_937_000 picoseconds. + Weight::from_parts(7_217_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_457_000 picoseconds. - Weight::from_parts(8_377_232, 0) - // Standard Error: 2_856 - .saturating_add(Weight::from_parts(4_077_791, 0).saturating_mul(c.into())) + // Minimum execution time: 5_197_000 picoseconds. + Weight::from_parts(12_700_602, 0) + // Standard Error: 2_607 + .saturating_add(Weight::from_parts(3_964_305, 0).saturating_mul(c.into())) } } @@ -100,43 +100,43 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_350_000 picoseconds. - Weight::from_parts(8_163_155, 0) - // Standard Error: 2_074 - .saturating_add(Weight::from_parts(4_084_858, 0).saturating_mul(c.into())) + // Minimum execution time: 5_390_000 picoseconds. + Weight::from_parts(15_138_158, 0) + // Standard Error: 2_071 + .saturating_add(Weight::from_parts(3_958_890, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_978_000 picoseconds. - Weight::from_parts(4_136_000, 0) + // Minimum execution time: 3_614_000 picoseconds. + Weight::from_parts(3_757_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_406_000 picoseconds. - Weight::from_parts(9_180_867, 0) - // Standard Error: 2_030 - .saturating_add(Weight::from_parts(4_259_130, 0).saturating_mul(c.into())) + // Minimum execution time: 5_187_000 picoseconds. + Weight::from_parts(12_724_758, 0) + // Standard Error: 1_830 + .saturating_add(Weight::from_parts(4_146_725, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_029_000 picoseconds. - Weight::from_parts(7_246_000, 0) + // Minimum execution time: 6_937_000 picoseconds. + Weight::from_parts(7_217_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_457_000 picoseconds. - Weight::from_parts(8_377_232, 0) - // Standard Error: 2_856 - .saturating_add(Weight::from_parts(4_077_791, 0).saturating_mul(c.into())) + // Minimum execution time: 5_197_000 picoseconds. + Weight::from_parts(12_700_602, 0) + // Standard Error: 2_607 + .saturating_add(Weight::from_parts(3_964_305, 0).saturating_mul(c.into())) } } diff --git a/sandbox/env/Cargo.toml b/sandbox/env/Cargo.toml index 3d9138e7321..844eaa9bc90 100644 --- a/sandbox/env/Cargo.toml +++ b/sandbox/env/Cargo.toml @@ -15,6 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] codec.workspace = true sp-core.workspace = true sp-std.workspace = true +sp-wasm-interface = { workspace = true, default-features = false } [features] default = ["std"] @@ -22,4 +23,5 @@ std = [ "codec/std", "sp-core/std", "sp-std/std", + "sp-wasm-interface/std", ] diff --git a/sandbox/env/src/lib.rs b/sandbox/env/src/lib.rs index aacbcf9c3bd..7c344495963 100644 --- a/sandbox/env/src/lib.rs +++ b/sandbox/env/src/lib.rs @@ -21,9 +21,20 @@ #![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; - use sp_core::RuntimeDebug; use sp_std::vec::Vec; +use sp_wasm_interface::ReturnValue; + +#[derive(Clone, Copy, Debug)] +pub enum Instantiate { + /// The first version of instantiate method and syscalls. + Version1, + /// The second version of syscalls changes their signatures to + /// accept global gas value as its first argument and return the remaining + /// gas value as its first result tuple element. The approach eliminates + /// redundant host calls to get/set WASM-global value. + Version2, +} /// Error error that can be returned from host function. #[derive(Encode, Decode, RuntimeDebug)] @@ -108,6 +119,20 @@ pub const ERROR_GLOBALS_NOT_FOUND: u32 = u32::MAX; /// For FFI purposes. pub const ERROR_GLOBALS_OTHER: u32 = u32::MAX - 1; +/// Typed value that can be returned from a wasm function +/// through the dispatch thunk. +/// Additionally contains globals values. +#[derive(Clone, Copy, PartialEq, Encode, Decode, Debug)] +#[codec(crate = codec)] +pub struct WasmReturnValue { + pub gas: i64, + pub inner: ReturnValue, +} + +impl WasmReturnValue { + pub const ENCODED_MAX_SIZE: usize = 8 + ReturnValue::ENCODED_MAX_SIZE; +} + #[cfg(test)] mod tests { use super::*; diff --git a/sandbox/host/src/sandbox.rs b/sandbox/host/src/sandbox.rs index 4cafa6502a6..5c67022d847 100644 --- a/sandbox/host/src/sandbox.rs +++ b/sandbox/host/src/sandbox.rs @@ -26,6 +26,7 @@ mod wasmi_backend; use std::{collections::HashMap, pin::Pin, rc::Rc}; use codec::Decode; +use env::Instantiate; use gear_sandbox_env as sandbox_env; use sp_wasm_interface::{Pointer, WordSize}; @@ -629,6 +630,7 @@ impl Store
{ /// Returns uninitialized sandboxed module instance or an instantiation error. pub fn instantiate( &mut self, + version: Instantiate, wasm: &[u8], guest_env: GuestEnvironment, sandbox_context: &mut dyn SandboxContext, @@ -637,7 +639,7 @@ impl Store
{ BackendContext::Wasmi => wasmi_instantiate(wasm, guest_env, sandbox_context)?, BackendContext::Wasmer(ref context) => { - wasmer_instantiate(context, wasm, guest_env, sandbox_context)? + wasmer_instantiate(version, context, wasm, guest_env, sandbox_context)? } }; diff --git a/sandbox/host/src/sandbox/wasmer_backend.rs b/sandbox/host/src/sandbox/wasmer_backend.rs index 3bea2d8505b..9d2531cea84 100644 --- a/sandbox/host/src/sandbox/wasmer_backend.rs +++ b/sandbox/host/src/sandbox/wasmer_backend.rs @@ -20,10 +20,10 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc}; -use wasmer::RuntimeError; +use wasmer::{Exportable, RuntimeError}; use codec::{Decode, Encode}; -use gear_sandbox_env::HostError; +use gear_sandbox_env::{HostError, Instantiate, WasmReturnValue}; use sp_wasm_interface::{util, Pointer, ReturnValue, Value, WordSize}; use crate::{ @@ -69,6 +69,39 @@ impl Backend { } } +#[derive(Default)] +pub struct Env { + gas: Option, +} + +// WARNING: intentionally to avoid cyclic refs +impl Clone for Env { + fn clone(&self) -> Self { + Self { + gas: self.gas.clone().map(|mut global| { + global.into_weak_instance_ref(); + + global + }), + } + } +} + +// TODO #3057 +pub const GLOBAL_NAME_GAS: &str = "gear_gas"; + +impl wasmer::WasmerEnv for Env { + fn init_with_instance( + &mut self, + instance: &wasmer::Instance, + ) -> std::result::Result<(), wasmer::HostEnvInitError> { + let gas: wasmer::Global = instance.exports.get_with_generics_weak(GLOBAL_NAME_GAS)?; + self.gas = Some(gas); + + Ok(()) + } +} + /// Invoke a function within a sandboxed module pub fn invoke( instance: &wasmer::Instance, @@ -152,6 +185,7 @@ fn try_to_store_module_in_cache(mut fs_cache: FileSystemCache, code_hash: Hash, /// Instantiate a module within a sandbox context pub fn instantiate( + version: Instantiate, context: &Backend, wasm: &[u8], guest_env: GuestEnvironment, @@ -240,7 +274,14 @@ pub fn instantiate( .func_by_guest_index(guest_func_index) .ok_or(InstantiationError::ModuleDecoding)?; - let function = dispatch_function(supervisor_func_index, &context.store, func_ty); + let function = match version { + Instantiate::Version1 => { + dispatch_function(supervisor_func_index, &context.store, func_ty) + } + Instantiate::Version2 => { + dispatch_function_v2(supervisor_func_index, &context.store, func_ty) + } + }; let exports = exports_map .entry(import.module().to_string()) @@ -277,6 +318,7 @@ pub fn instantiate( }) } +// TODO #3067 fn dispatch_function( supervisor_func_index: SupervisorFuncIndex, store: &wasmer::Store, @@ -341,6 +383,7 @@ fn dispatch_function( let serialized_result = serialized_result?; + // TODO #3038 // dispatch_thunk returns pointer to serialized arguments. // Unpack pointer and len of the serialized result data. let (serialized_result_val_ptr, serialized_result_val_len) = { @@ -386,6 +429,125 @@ fn dispatch_function( }) } +// TODO #3067 +fn dispatch_function_v2( + supervisor_func_index: SupervisorFuncIndex, + store: &wasmer::Store, + func_ty: &wasmer::FunctionType, +) -> wasmer::Function { + wasmer::Function::new_with_env(store, func_ty, Env::default(), move |env, params| { + SandboxContextStore::with(|sandbox_context| { + let gas = env + .gas + .as_ref() + .ok_or_else(|| RuntimeError::new("gas global should be set"))?; + + // Serialize arguments into a byte vector. + let invoke_args_data = [gas.get()] + .iter() + .chain(params.iter()) + .map(|val| match val { + wasmer::Val::I32(val) => Ok(Value::I32(*val)), + wasmer::Val::I64(val) => Ok(Value::I64(*val)), + wasmer::Val::F32(val) => Ok(Value::F32(f32::to_bits(*val))), + wasmer::Val::F64(val) => Ok(Value::F64(f64::to_bits(*val))), + _ => Err(RuntimeError::new(format!( + "Unsupported function argument: {:?}", + val + ))), + }) + .collect::, _>>()? + .encode(); + + // Move serialized arguments inside the memory, invoke dispatch thunk and + // then free allocated memory. + let invoke_args_len = invoke_args_data.len() as WordSize; + let invoke_args_ptr = + sandbox_context + .allocate_memory(invoke_args_len) + .map_err(|_| { + RuntimeError::new("Can't allocate memory in supervisor for the arguments") + })?; + + let deallocate = |fe: &mut dyn SandboxContext, ptr, fail_msg| { + fe.deallocate_memory(ptr) + .map_err(|_| RuntimeError::new(fail_msg)) + }; + + if sandbox_context + .write_memory(invoke_args_ptr, &invoke_args_data) + .is_err() + { + deallocate( + sandbox_context, + invoke_args_ptr, + "Failed dealloction after failed write of invoke arguments", + )?; + + return Err(RuntimeError::new("Can't write invoke args into memory")); + } + + // Perform the actuall call + let serialized_result = sandbox_context + .invoke(invoke_args_ptr, invoke_args_len, supervisor_func_index) + .map_err(|e| RuntimeError::new(e.to_string())); + + deallocate( + sandbox_context, + invoke_args_ptr, + "Failed dealloction after invoke", + )?; + + let serialized_result = serialized_result?; + + // TODO #3038 + // dispatch_thunk returns pointer to serialized arguments. + // Unpack pointer and len of the serialized result data. + let (serialized_result_val_ptr, serialized_result_val_len) = { + // Cast to u64 to use zero-extension. + let v = serialized_result as u64; + let ptr = (v >> 32) as u32; + let len = (v & 0xFFFFFFFF) as u32; + (Pointer::new(ptr), len) + }; + + let serialized_result_val = sandbox_context + .read_memory(serialized_result_val_ptr, serialized_result_val_len) + .map_err(|_| { + RuntimeError::new("Can't read the serialized result from dispatch thunk") + }); + + deallocate( + sandbox_context, + serialized_result_val_ptr, + "Can't deallocate memory for dispatch thunk's result", + )?; + + let serialized_result_val = serialized_result_val?; + + let deserialized_result = std::result::Result::::decode( + &mut serialized_result_val.as_slice(), + ) + .map_err(|_| RuntimeError::new("Decoding Result failed!"))? + .map_err(|_| RuntimeError::new("Supervisor function returned sandbox::HostError"))?; + + let result = match deserialized_result.inner { + ReturnValue::Value(Value::I32(val)) => vec![wasmer::Val::I32(val)], + ReturnValue::Value(Value::I64(val)) => vec![wasmer::Val::I64(val)], + ReturnValue::Value(Value::F32(val)) => vec![wasmer::Val::F32(f32::from_bits(val))], + ReturnValue::Value(Value::F64(val)) => vec![wasmer::Val::F64(f64::from_bits(val))], + + ReturnValue::Unit => vec![], + }; + + gas.set(wasmer::Val::I64(deserialized_result.gas))?; + + Ok(result) + }) + .expect("SandboxContextStore is set when invoking sandboxed functions; qed") + }) +} + /// Allocate new memory region pub fn new_memory( context: &Backend, diff --git a/sandbox/sandbox/src/embedded_executor.rs b/sandbox/sandbox/src/embedded_executor.rs index 76b48c1ea94..79d9ec396fb 100644 --- a/sandbox/sandbox/src/embedded_executor.rs +++ b/sandbox/sandbox/src/embedded_executor.rs @@ -137,7 +137,7 @@ impl<'a, T> Externals for GuestExternals<'a, T> { let result = (self.defined_host_functions.funcs[index])(self.state, &args); match result { - Ok(value) => Ok(match value { + Ok(value) => Ok(match value.inner { ReturnValue::Value(v) => Some(to_wasmi(v)), ReturnValue::Unit => None, }), @@ -282,24 +282,9 @@ pub struct Instance { _marker: PhantomData, } -/// Unit-type as InstanceGlobals for wasmi executor. -#[derive(Clone, Default)] -pub struct InstanceGlobals; - -impl super::InstanceGlobals for InstanceGlobals { - fn get_global_val(&self, _name: &str) -> Option { - None - } - - fn set_global_val(&self, _name: &str, _value: Value) -> Result<(), super::GlobalsSetError> { - Err(super::GlobalsSetError::NotFound) - } -} - impl super::SandboxInstance for Instance { type Memory = Memory; type EnvironmentBuilder = EnvironmentDefinitionBuilder; - type InstanceGlobals = InstanceGlobals; fn new( code: &[u8], @@ -350,8 +335,8 @@ impl super::SandboxInstance for Instance { Some(to_interface(global)) } - fn instance_globals(&self) -> Option { - None + fn set_global_val(&self, _name: &str, _value: Value) -> Result<(), crate::GlobalsSetError> { + Err(crate::GlobalsSetError::NotFound) } fn get_instance_ptr(&self) -> HostPointer { @@ -384,37 +369,50 @@ mod tests { use super::{EnvironmentDefinitionBuilder, Instance}; use crate::{Error, HostError, ReturnValue, SandboxEnvironmentBuilder, SandboxInstance, Value}; use assert_matches::assert_matches; + use gear_sandbox_env::WasmReturnValue; fn execute_sandboxed(code: &[u8], args: &[Value]) -> Result { struct State { counter: u32, } - fn env_assert(_e: &mut State, args: &[Value]) -> Result { + fn env_assert(_e: &mut State, args: &[Value]) -> Result { if args.len() != 1 { return Err(HostError); } let condition = args[0].as_i32().ok_or(HostError)?; if condition != 0 { - Ok(ReturnValue::Unit) + Ok(WasmReturnValue { + gas: 0, + inner: ReturnValue::Unit, + }) } else { Err(HostError) } } - fn env_inc_counter(e: &mut State, args: &[Value]) -> Result { + fn env_inc_counter(e: &mut State, args: &[Value]) -> Result { if args.len() != 1 { return Err(HostError); } let inc_by = args[0].as_i32().ok_or(HostError)?; e.counter += inc_by as u32; - Ok(ReturnValue::Value(Value::I32(e.counter as i32))) + Ok(WasmReturnValue { + gas: 0, + inner: ReturnValue::Value(Value::I32(e.counter as i32)), + }) } /// Function that takes one argument of any type and returns that value. - fn env_polymorphic_id(_e: &mut State, args: &[Value]) -> Result { + fn env_polymorphic_id( + _e: &mut State, + args: &[Value], + ) -> Result { if args.len() != 1 { return Err(HostError); } - Ok(ReturnValue::Value(args[0])) + Ok(WasmReturnValue { + gas: 0, + inner: ReturnValue::Value(args[0]), + }) } let mut state = State { counter: 0 }; @@ -525,8 +523,11 @@ mod tests { #[test] fn cant_return_unmatching_type() { - fn env_returns_i32(_e: &mut (), _args: &[Value]) -> Result { - Ok(ReturnValue::Value(Value::I32(42))) + fn env_returns_i32(_e: &mut (), _args: &[Value]) -> Result { + Ok(WasmReturnValue { + gas: 0, + inner: ReturnValue::Value(Value::I32(42)), + }) } let mut env_builder = EnvironmentDefinitionBuilder::new(); diff --git a/sandbox/sandbox/src/host_executor.rs b/sandbox/sandbox/src/host_executor.rs index 34bc0f9b7c3..a73b6b17cc9 100644 --- a/sandbox/sandbox/src/host_executor.rs +++ b/sandbox/sandbox/src/host_executor.rs @@ -20,12 +20,12 @@ use codec::{Decode, Encode}; +use crate::{env, Error, HostFuncType, ReturnValue, Value}; use gear_runtime_interface::sandbox; +use gear_sandbox_env::WasmReturnValue; use sp_std::{marker, mem, prelude::*, rc::Rc, slice, vec}; use sp_wasm_interface::HostPointer; -use crate::{env, Error, HostFuncType, ReturnValue, Value}; - mod ffi { use super::HostFuncType; use sp_std::mem; @@ -190,29 +190,6 @@ pub struct Instance { _marker: marker::PhantomData, } -#[derive(Clone, Default)] -pub struct InstanceGlobals { - instance_idx: Option, -} - -impl super::InstanceGlobals for InstanceGlobals { - fn get_global_val(&self, name: &str) -> Option { - self.instance_idx - .and_then(|i| sandbox::get_global_val(i, name)) - } - - fn set_global_val(&self, name: &str, value: Value) -> Result<(), super::GlobalsSetError> { - match self.instance_idx { - None => Err(super::GlobalsSetError::Other), - Some(i) => match sandbox::set_global_val(i, name, value) { - env::ERROR_GLOBALS_OK => Ok(()), - env::ERROR_GLOBALS_NOT_FOUND => Err(super::GlobalsSetError::NotFound), - _ => Err(super::GlobalsSetError::Other), - }, - } - } -} - /// The primary responsibility of this thunk is to deserialize arguments and /// call the original function, specified by the index. extern "C" fn dispatch_thunk( @@ -243,8 +220,9 @@ extern "C" fn dispatch_thunk( // This should be safe since mutable reference to T is passed upon the invocation. let state = &mut *(state as *mut T); + let mut result = Vec::with_capacity(WasmReturnValue::ENCODED_MAX_SIZE); // Pass control flow to the designated function. - let result = f(state, &args).encode(); + f(state, &args).encode_to(&mut result); // Leak the result vector and return the pointer to return data. let result_ptr = result.as_ptr() as u64; @@ -258,7 +236,6 @@ extern "C" fn dispatch_thunk( impl super::SandboxInstance for Instance { type Memory = Memory; type EnvironmentBuilder = EnvironmentDefinitionBuilder; - type InstanceGlobals = InstanceGlobals; fn new( code: &[u8], @@ -318,10 +295,12 @@ impl super::SandboxInstance for Instance { sandbox::get_global_val(self.instance_idx, name) } - fn instance_globals(&self) -> Option { - Some(InstanceGlobals { - instance_idx: Some(self.instance_idx), - }) + fn set_global_val(&self, name: &str, value: Value) -> Result<(), super::GlobalsSetError> { + match sandbox::set_global_val(self.instance_idx, name, value) { + env::ERROR_GLOBALS_OK => Ok(()), + env::ERROR_GLOBALS_NOT_FOUND => Err(super::GlobalsSetError::NotFound), + _ => Err(super::GlobalsSetError::Other), + } } fn get_instance_ptr(&self) -> HostPointer { diff --git a/sandbox/sandbox/src/lib.rs b/sandbox/sandbox/src/lib.rs index ccbf1be9969..446a53bc089 100644 --- a/sandbox/sandbox/src/lib.rs +++ b/sandbox/sandbox/src/lib.rs @@ -50,7 +50,7 @@ use sp_core::RuntimeDebug; use sp_std::prelude::*; use sp_wasm_interface::HostPointer; -pub use sp_wasm_interface::{ReturnValue, Value}; +pub use sp_wasm_interface::{IntoValue, ReturnValue, Value}; #[cfg(feature = "std")] pub use self::embedded_executor as default_executor; @@ -89,7 +89,7 @@ impl From for HostError { /// supervisor in [`EnvironmentDefinitionBuilder`]. /// /// [`EnvironmentDefinitionBuilder`]: struct.EnvironmentDefinitionBuilder.html -pub type HostFuncType = fn(&mut T, &[Value]) -> Result; +pub type HostFuncType = fn(&mut T, &[Value]) -> Result; /// Reference to a sandboxed linear memory, that /// will be used by the guest module. @@ -161,6 +161,16 @@ pub trait SandboxEnvironmentBuilder: Sized { N2: Into>; } +/// Error that can occur while using this crate. +#[derive(RuntimeDebug)] +pub enum GlobalsSetError { + /// A global variable is not found. + NotFound, + + /// A global variable is immutable or has a different type. + Other, +} + /// Sandboxed instance of a wasm module. /// /// This instance can be used for invoking exported functions. @@ -171,9 +181,6 @@ pub trait SandboxInstance: Sized { /// The environment builder used to construct this sandbox. type EnvironmentBuilder: SandboxEnvironmentBuilder; - /// The globals type used for this sandbox to change globals. - type InstanceGlobals: InstanceGlobals; - /// Instantiate a module with the given [`EnvironmentDefinitionBuilder`]. It will /// run the `start` function (if it is present in the module) with the given `state`. /// @@ -211,32 +218,9 @@ pub trait SandboxInstance: Sized { /// Returns `Some(_)` if the global could be found. fn get_global_val(&self, name: &str) -> Option; - /// Get the instance providing access to exported globals. - /// - /// Returns `None` if the executor doesn't support the interface. - fn instance_globals(&self) -> Option; + /// Set the value of a global with the given `name`. + fn set_global_val(&self, name: &str, value: Value) -> Result<(), GlobalsSetError>; /// Get raw pointer to the executor host sandbox instance. fn get_instance_ptr(&self) -> HostPointer; } - -/// Error that can occur while using this crate. -#[derive(RuntimeDebug)] -pub enum GlobalsSetError { - /// A global variable is not found. - NotFound, - - /// A global variable is immutable or has a different type. - Other, -} - -/// This instance can be used for changing exported globals. -pub trait InstanceGlobals: Sized + Clone { - /// Get the value from a global with the given `name`. - /// - /// Returns `Some(_)` if the global could be found. - fn get_global_val(&self, name: &str) -> Option; - - /// Set the value of a global with the given `name`. - fn set_global_val(&self, name: &str, value: Value) -> Result<(), GlobalsSetError>; -} diff --git a/utils/wasm-instrument/src/lib.rs b/utils/wasm-instrument/src/lib.rs index f3c04017d87..fe38b421e86 100644 --- a/utils/wasm-instrument/src/lib.rs +++ b/utils/wasm-instrument/src/lib.rs @@ -40,6 +40,7 @@ mod tests; pub mod rules; pub mod syscalls; +// TODO #3057 pub const GLOBAL_NAME_GAS: &str = "gear_gas"; pub const GLOBAL_NAME_FLAGS: &str = "gear_flags"; diff --git a/utils/wasm-proc/src/main.rs b/utils/wasm-proc/src/main.rs index 2a536a941f1..cac6e012ced 100644 --- a/utils/wasm-proc/src/main.rs +++ b/utils/wasm-proc/src/main.rs @@ -21,7 +21,7 @@ use gear_wasm_builder::optimize::{self, OptType, Optimizer}; use parity_wasm::elements::External; use std::{collections::HashSet, fs, path::PathBuf}; -const RT_ALLOWED_IMPORTS: [&str; 63] = [ +const RT_ALLOWED_IMPORTS: [&str; 64] = [ // From `Allocator` (substrate/primitives/io/src/lib.rs) "ext_allocator_free_version_1", "ext_allocator_malloc_version_1", @@ -73,6 +73,7 @@ const RT_ALLOWED_IMPORTS: [&str; 63] = [ "ext_sandbox_set_global_val_version_1", "ext_sandbox_instance_teardown_version_1", "ext_sandbox_instantiate_version_1", + "ext_sandbox_instantiate_version_2", "ext_sandbox_invoke_version_1", "ext_sandbox_memory_get_version_1", "ext_sandbox_memory_grow_version_1", From 4328b0094617a932a228253a4a10891a92e2879d Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Tue, 15 Aug 2023 19:54:40 +0500 Subject: [PATCH 048/165] feat(manifest): trim manifest with wildcard (#3055) --- Cargo.toml | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4e1bd8ad0be..ecbe1845d37 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,10 +15,7 @@ members = [ "common", "common/codegen", "core", - "core-backend/codegen", - "core-backend/common", - "core-backend/sandbox", - "core-backend/wasmi", + "core-backend/*", "core-processor", "core-errors", "examples/async", @@ -88,24 +85,9 @@ members = [ "node/authorship", "node/testing", "pallets/*", - "runtime/gear", - "runtime/vara", - "utils/bags-thresholds", - "utils/call-gen", - "utils/runtime-fuzzer", - "utils/runtime-fuzzer/fuzz", - "utils/junit-common", - "utils/node-loader/", - "utils/regression-analysis", - "utils/gear-replay-cli", - "utils/utils", - "utils/validator-checks", - "utils/wasm-builder", - "utils/wasm-gen", - "utils/wasm-info", - "utils/wasm-instrument", - "utils/wasm-proc", - "utils/weight-diff", + "runtime/*", + "utils/*", + "utils/runtime-fuzzer/fuzz" ] [workspace.dependencies] From 27cab7843d8f8afb430f6df5b52cedf211f19149 Mon Sep 17 00:00:00 2001 From: Georgy Shepelev Date: Wed, 16 Aug 2023 10:06:38 +0400 Subject: [PATCH 049/165] refactor(sandbox): Extract dispatch_common function in wasmer backend (#3068) --- sandbox/host/src/sandbox/wasmer_backend.rs | 327 ++++++++------------- 1 file changed, 117 insertions(+), 210 deletions(-) diff --git a/sandbox/host/src/sandbox/wasmer_backend.rs b/sandbox/host/src/sandbox/wasmer_backend.rs index 9d2531cea84..e02d53c92df 100644 --- a/sandbox/host/src/sandbox/wasmer_backend.rs +++ b/sandbox/host/src/sandbox/wasmer_backend.rs @@ -114,15 +114,7 @@ pub fn invoke( .get_function(export_name) .map_err(|error| Error::Sandbox(error.to_string()))?; - let args: Vec = args - .iter() - .map(|v| match *v { - Value::I32(val) => wasmer::Val::I32(val), - Value::I64(val) => wasmer::Val::I64(val), - Value::F32(val) => wasmer::Val::F32(f32::from_bits(val)), - Value::F64(val) => wasmer::Val::F64(f64::from_bits(val)), - }) - .collect(); + let args: Vec = args.iter().map(into_wasmer_val).collect(); let wasmer_result = SandboxContextStore::using(sandbox_context, || { function @@ -133,22 +125,13 @@ pub fn invoke( match wasmer_result.as_ref() { [] => Ok(None), - [wasm_value] => { - let wasmer_value = match *wasm_value { - wasmer::Val::I32(val) => Value::I32(val), - wasmer::Val::I64(val) => Value::I64(val), - wasmer::Val::F32(val) => Value::F32(f32::to_bits(val)), - wasmer::Val::F64(val) => Value::F64(f64::to_bits(val)), - _ => { - return Err(Error::Sandbox(format!( - "Unsupported return value: {:?}", - wasm_value, - ))) - } - }; - - Ok(Some(wasmer_value)) - } + [wasm_value] => match into_value(wasm_value) { + None => Err(Error::Sandbox(format!( + "Unsupported return value: {:?}", + wasm_value, + ))), + Some(v) => Ok(Some(v)), + }, _ => Err(Error::Sandbox( "multiple return types are not supported yet".into(), @@ -318,7 +301,99 @@ pub fn instantiate( }) } -// TODO #3067 +fn dispatch_common( + supervisor_func_index: SupervisorFuncIndex, + sandbox_context: &mut dyn SandboxContext, + invoke_args_data: Vec, +) -> std::result::Result, RuntimeError> { + // Move serialized arguments inside the memory, invoke dispatch thunk and + // then free allocated memory. + let invoke_args_len = invoke_args_data.len() as WordSize; + let invoke_args_ptr = sandbox_context + .allocate_memory(invoke_args_len) + .map_err(|_| RuntimeError::new("Can't allocate memory in supervisor for the arguments"))?; + + let deallocate = |fe: &mut dyn SandboxContext, ptr, fail_msg| { + fe.deallocate_memory(ptr) + .map_err(|_| RuntimeError::new(fail_msg)) + }; + + if sandbox_context + .write_memory(invoke_args_ptr, &invoke_args_data) + .is_err() + { + deallocate( + sandbox_context, + invoke_args_ptr, + "Failed dealloction after failed write of invoke arguments", + )?; + + return Err(RuntimeError::new("Can't write invoke args into memory")); + } + + // Perform the actuall call + let serialized_result = sandbox_context + .invoke(invoke_args_ptr, invoke_args_len, supervisor_func_index) + .map_err(|e| RuntimeError::new(e.to_string())); + + deallocate( + sandbox_context, + invoke_args_ptr, + "Failed dealloction after invoke", + )?; + + let serialized_result = serialized_result?; + + // TODO #3038 + // dispatch_thunk returns pointer to serialized arguments. + // Unpack pointer and len of the serialized result data. + let (serialized_result_val_ptr, serialized_result_val_len) = { + // Cast to u64 to use zero-extension. + let v = serialized_result as u64; + let ptr = (v >> 32) as u32; + let len = (v & 0xFFFFFFFF) as u32; + (Pointer::new(ptr), len) + }; + + let serialized_result_val = sandbox_context + .read_memory(serialized_result_val_ptr, serialized_result_val_len) + .map_err(|_| RuntimeError::new("Can't read the serialized result from dispatch thunk")); + + deallocate( + sandbox_context, + serialized_result_val_ptr, + "Can't deallocate memory for dispatch thunk's result", + )?; + + serialized_result_val +} + +fn into_wasmer_val(value: &Value) -> wasmer::Val { + match value { + Value::I32(val) => wasmer::Val::I32(*val), + Value::I64(val) => wasmer::Val::I64(*val), + Value::F32(val) => wasmer::Val::F32(f32::from_bits(*val)), + Value::F64(val) => wasmer::Val::F64(f64::from_bits(*val)), + } +} + +fn into_wasmer_result(value: ReturnValue) -> Vec { + match value { + ReturnValue::Value(v) => vec![into_wasmer_val(&v)], + ReturnValue::Unit => vec![], + } +} + +fn into_value(value: &wasmer::Val) -> Option { + match value { + wasmer::Val::I32(val) => Some(Value::I32(*val)), + wasmer::Val::I64(val) => Some(Value::I64(*val)), + wasmer::Val::F32(val) => Some(Value::F32(f32::to_bits(*val))), + wasmer::Val::F64(val) => Some(Value::F64(f64::to_bits(*val))), + _ => None, + } +} + fn dispatch_function( supervisor_func_index: SupervisorFuncIndex, store: &wasmer::Store, @@ -329,84 +404,16 @@ fn dispatch_function( // Serialize arguments into a byte vector. let invoke_args_data = params .iter() - .map(|val| match val { - wasmer::Val::I32(val) => Ok(Value::I32(*val)), - wasmer::Val::I64(val) => Ok(Value::I64(*val)), - wasmer::Val::F32(val) => Ok(Value::F32(f32::to_bits(*val))), - wasmer::Val::F64(val) => Ok(Value::F64(f64::to_bits(*val))), - _ => Err(RuntimeError::new(format!( - "Unsupported function argument: {:?}", - val - ))), + .map(|value| { + into_value(value).ok_or_else(|| { + RuntimeError::new(format!("Unsupported function argument: {:?}", value)) + }) }) .collect::, _>>()? .encode(); - // Move serialized arguments inside the memory, invoke dispatch thunk and - // then free allocated memory. - let invoke_args_len = invoke_args_data.len() as WordSize; - let invoke_args_ptr = - sandbox_context - .allocate_memory(invoke_args_len) - .map_err(|_| { - RuntimeError::new("Can't allocate memory in supervisor for the arguments") - })?; - - let deallocate = |fe: &mut dyn SandboxContext, ptr, fail_msg| { - fe.deallocate_memory(ptr) - .map_err(|_| RuntimeError::new(fail_msg)) - }; - - if sandbox_context - .write_memory(invoke_args_ptr, &invoke_args_data) - .is_err() - { - deallocate( - sandbox_context, - invoke_args_ptr, - "Failed dealloction after failed write of invoke arguments", - )?; - - return Err(RuntimeError::new("Can't write invoke args into memory")); - } - - // Perform the actuall call - let serialized_result = sandbox_context - .invoke(invoke_args_ptr, invoke_args_len, supervisor_func_index) - .map_err(|e| RuntimeError::new(e.to_string())); - - deallocate( - sandbox_context, - invoke_args_ptr, - "Failed dealloction after invoke", - )?; - - let serialized_result = serialized_result?; - - // TODO #3038 - // dispatch_thunk returns pointer to serialized arguments. - // Unpack pointer and len of the serialized result data. - let (serialized_result_val_ptr, serialized_result_val_len) = { - // Cast to u64 to use zero-extension. - let v = serialized_result as u64; - let ptr = (v >> 32) as u32; - let len = (v & 0xFFFFFFFF) as u32; - (Pointer::new(ptr), len) - }; - - let serialized_result_val = sandbox_context - .read_memory(serialized_result_val_ptr, serialized_result_val_len) - .map_err(|_| { - RuntimeError::new("Can't read the serialized result from dispatch thunk") - }); - - deallocate( - sandbox_context, - serialized_result_val_ptr, - "Can't deallocate memory for dispatch thunk's result", - )?; - - let serialized_result_val = serialized_result_val?; + let serialized_result_val = + dispatch_common(supervisor_func_index, sandbox_context, invoke_args_data)?; let deserialized_result = std::result::Result::::decode( &mut serialized_result_val.as_slice(), @@ -414,22 +421,12 @@ fn dispatch_function( .map_err(|_| RuntimeError::new("Decoding Result failed!"))? .map_err(|_| RuntimeError::new("Supervisor function returned sandbox::HostError"))?; - let result = match deserialized_result { - ReturnValue::Value(Value::I32(val)) => vec![wasmer::Val::I32(val)], - ReturnValue::Value(Value::I64(val)) => vec![wasmer::Val::I64(val)], - ReturnValue::Value(Value::F32(val)) => vec![wasmer::Val::F32(f32::from_bits(val))], - ReturnValue::Value(Value::F64(val)) => vec![wasmer::Val::F64(f64::from_bits(val))], - - ReturnValue::Unit => vec![], - }; - - Ok(result) + Ok(into_wasmer_result(deserialized_result)) }) .expect("SandboxContextStore is set when invoking sandboxed functions; qed") }) } -// TODO #3067 fn dispatch_function_v2( supervisor_func_index: SupervisorFuncIndex, store: &wasmer::Store, @@ -446,84 +443,16 @@ fn dispatch_function_v2( let invoke_args_data = [gas.get()] .iter() .chain(params.iter()) - .map(|val| match val { - wasmer::Val::I32(val) => Ok(Value::I32(*val)), - wasmer::Val::I64(val) => Ok(Value::I64(*val)), - wasmer::Val::F32(val) => Ok(Value::F32(f32::to_bits(*val))), - wasmer::Val::F64(val) => Ok(Value::F64(f64::to_bits(*val))), - _ => Err(RuntimeError::new(format!( - "Unsupported function argument: {:?}", - val - ))), + .map(|value| { + into_value(value).ok_or_else(|| { + RuntimeError::new(format!("Unsupported function argument: {:?}", value)) + }) }) .collect::, _>>()? .encode(); - // Move serialized arguments inside the memory, invoke dispatch thunk and - // then free allocated memory. - let invoke_args_len = invoke_args_data.len() as WordSize; - let invoke_args_ptr = - sandbox_context - .allocate_memory(invoke_args_len) - .map_err(|_| { - RuntimeError::new("Can't allocate memory in supervisor for the arguments") - })?; - - let deallocate = |fe: &mut dyn SandboxContext, ptr, fail_msg| { - fe.deallocate_memory(ptr) - .map_err(|_| RuntimeError::new(fail_msg)) - }; - - if sandbox_context - .write_memory(invoke_args_ptr, &invoke_args_data) - .is_err() - { - deallocate( - sandbox_context, - invoke_args_ptr, - "Failed dealloction after failed write of invoke arguments", - )?; - - return Err(RuntimeError::new("Can't write invoke args into memory")); - } - - // Perform the actuall call - let serialized_result = sandbox_context - .invoke(invoke_args_ptr, invoke_args_len, supervisor_func_index) - .map_err(|e| RuntimeError::new(e.to_string())); - - deallocate( - sandbox_context, - invoke_args_ptr, - "Failed dealloction after invoke", - )?; - - let serialized_result = serialized_result?; - - // TODO #3038 - // dispatch_thunk returns pointer to serialized arguments. - // Unpack pointer and len of the serialized result data. - let (serialized_result_val_ptr, serialized_result_val_len) = { - // Cast to u64 to use zero-extension. - let v = serialized_result as u64; - let ptr = (v >> 32) as u32; - let len = (v & 0xFFFFFFFF) as u32; - (Pointer::new(ptr), len) - }; - - let serialized_result_val = sandbox_context - .read_memory(serialized_result_val_ptr, serialized_result_val_len) - .map_err(|_| { - RuntimeError::new("Can't read the serialized result from dispatch thunk") - }); - - deallocate( - sandbox_context, - serialized_result_val_ptr, - "Can't deallocate memory for dispatch thunk's result", - )?; - - let serialized_result_val = serialized_result_val?; + let serialized_result_val = + dispatch_common(supervisor_func_index, sandbox_context, invoke_args_data)?; let deserialized_result = std::result::Result::::decode( &mut serialized_result_val.as_slice(), @@ -531,18 +460,9 @@ fn dispatch_function_v2( .map_err(|_| RuntimeError::new("Decoding Result failed!"))? .map_err(|_| RuntimeError::new("Supervisor function returned sandbox::HostError"))?; - let result = match deserialized_result.inner { - ReturnValue::Value(Value::I32(val)) => vec![wasmer::Val::I32(val)], - ReturnValue::Value(Value::I64(val)) => vec![wasmer::Val::I64(val)], - ReturnValue::Value(Value::F32(val)) => vec![wasmer::Val::F32(f32::from_bits(val))], - ReturnValue::Value(Value::F64(val)) => vec![wasmer::Val::F64(f64::from_bits(val))], - - ReturnValue::Unit => vec![], - }; - gas.set(wasmer::Val::I64(deserialized_result.gas))?; - Ok(result) + Ok(into_wasmer_result(deserialized_result.inner)) }) .expect("SandboxContextStore is set when invoking sandboxed functions; qed") }) @@ -701,15 +621,8 @@ impl MemoryTransfer for MemoryWrapper { /// Get global value by name pub fn get_global(instance: &wasmer::Instance, name: &str) -> Option { let global = instance.exports.get_global(name).ok()?; - let wasmtime_value = match global.get() { - wasmer::Val::I32(val) => Value::I32(val), - wasmer::Val::I64(val) => Value::I64(val), - wasmer::Val::F32(val) => Value::F32(f32::to_bits(val)), - wasmer::Val::F64(val) => Value::F64(f64::to_bits(val)), - _ => None?, - }; - Some(wasmtime_value) + into_value(&global.get()) } /// Set global value by name @@ -723,13 +636,7 @@ pub fn set_global( Err(_) => return Ok(None), }; - let value = match value { - Value::I32(val) => wasmer::Val::I32(val), - Value::I64(val) => wasmer::Val::I64(val), - Value::F32(val) => wasmer::Val::F32(f32::from_bits(val)), - Value::F64(val) => wasmer::Val::F64(f64::from_bits(val)), - }; - + let value = into_wasmer_val(&value); global .set(value) .map(|_| Some(())) From bf049db84284cf5d6568084d564099d720b8dd66 Mon Sep 17 00:00:00 2001 From: Shamil <66209982+shamilsan@users.noreply.github.com> Date: Wed, 16 Aug 2023 13:59:49 +0400 Subject: [PATCH 050/165] feat(gtest): make log more customizable (#3072) --- gtest/src/manager.rs | 16 ++++++---------- gtest/src/program.rs | 2 +- gtest/src/system.rs | 10 +++++++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/gtest/src/manager.rs b/gtest/src/manager.rs index 7abd98d65cf..c76b2b20571 100644 --- a/gtest/src/manager.rs +++ b/gtest/src/manager.rs @@ -921,13 +921,13 @@ impl JournalHandler for ExtManager { _reservation: Option, ) { if bn > 0 { - log::debug!(target: "gwasm", "[{}] new delayed dispatch#{}", message_id, dispatch.id()); + log::debug!("[{message_id}] new delayed dispatch#{}", dispatch.id()); self.send_delayed_dispatch(dispatch, self.block_info.height.saturating_add(bn)); return; } - log::debug!(target: "gwasm", "[{}] new dispatch#{}", message_id, dispatch.id()); + log::debug!("[{message_id}] new dispatch#{}", dispatch.id()); self.gas_limits.insert(dispatch.id(), dispatch.gas_limit()); @@ -962,7 +962,7 @@ impl JournalHandler for ExtManager { _duration: Option, _: MessageWaitedType, ) { - log::debug!(target: "gwasm", "[{}] wait", dispatch.id()); + log::debug!("[{}] wait", dispatch.id()); self.message_consumed(dispatch.id()); self.wait_list @@ -976,7 +976,7 @@ impl JournalHandler for ExtManager { awakening_id: MessageId, _delay: u32, ) { - log::debug!(target: "gwasm", "[{}] waked message#{}", message_id, awakening_id); + log::debug!("[{message_id}] waked message#{awakening_id}"); if let Some(msg) = self.wait_list.remove(&(program_id, awakening_id)) { self.dispatches.push_back(msg); @@ -1081,15 +1081,11 @@ impl JournalHandler for ExtManager { Some(init_message_id), ); } else { - log::debug!(target: "gwasm", "Program with id {:?} already exists", candidate_id); + log::debug!("Program with id {candidate_id:?} already exists"); } } } else { - log::debug!( - target: "gwasm", - "No referencing code with code hash {:?} for candidate programs", - code_id - ); + log::debug!("No referencing code with code hash {code_id:?} for candidate programs"); for (_, invalid_candidate_id) in candidates { self.actors .insert(invalid_candidate_id, (TestActor::Dormant, 0)); diff --git a/gtest/src/program.rs b/gtest/src/program.rs index 8d62e4772e0..c048bc04028 100644 --- a/gtest/src/program.rs +++ b/gtest/src/program.rs @@ -93,7 +93,7 @@ pub trait WasmProgram: Debug { fn handle_signal(&mut self, payload: Vec) -> Result<(), &'static str>; fn state(&mut self) -> Result, &'static str>; fn debug(&mut self, data: &str) { - log::debug!(target: "gwasm", "DEBUG: {}", data); + log::debug!(target: "gwasm", "DEBUG: {data}"); } } diff --git a/gtest/src/system.rs b/gtest/src/system.rs index 869f8a49994..81462312b43 100644 --- a/gtest/src/system.rs +++ b/gtest/src/system.rs @@ -37,14 +37,22 @@ impl Default for System { } impl System { + /// Create a new system. pub fn new() -> Self { Default::default() } + /// Init logger with "gwasm" target set to `debug` level. pub fn init_logger(&self) { - self.init_logger_with_default_filter("gwasm=debug") + self.init_logger_with_default_filter("gwasm=debug"); } + /// Init logger with "gwasm" and "gtest" targets set to `debug` level. + pub fn init_verbose_logger(&self) { + self.init_logger_with_default_filter("gwasm=debug,gtest=debug"); + } + + /// Init logger with `default_filter` as default filter. pub fn init_logger_with_default_filter<'a>(&self, default_filter: impl Into>) { let _ = Builder::from_env(Env::default().default_filter_or(default_filter)) .format(|buf, record| { From b996335b1c227ad199a5b8a57183d279bc57a1b6 Mon Sep 17 00:00:00 2001 From: mertwole <33563701+mertwole@users.noreply.github.com> Date: Thu, 17 Aug 2023 15:26:40 +0300 Subject: [PATCH 051/165] fix(runtime-fuzzer): fix overflowing gas limit (#3077) --- utils/runtime-fuzzer/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index c7098717bf9..96c61c894db 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -91,9 +91,11 @@ fn generate_gear_call(seed: u64, context: &ContextMutex) -> Gea let mut rand = Rng::seed_from_u64(seed); // Use (0..G)^3 / G^2 to produce more values closer to default_gas_limit. - let default_gas_limit = default_gas_limit(); + let default_gas_limit = default_gas_limit() as u128; let gas_limit = rand.gen_range(0..=default_gas_limit).pow(3) / default_gas_limit.pow(2); + let gas_limit = gas_limit as u64; + match rand.gen_range(0..=1) { 0 => UploadProgramArgs::generate::( (rand.next_u64(), rand.next_u64()), From e77743334b7d926cd236c4a6365b732d00484867 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Thu, 17 Aug 2023 16:55:25 +0300 Subject: [PATCH 052/165] Implement `Arbitrary` for the set of `GearCall`s (#3082) --- Cargo.lock | 4 + utils/call-gen/Cargo.toml | 2 + utils/call-gen/src/arbitrary_call.rs | 211 ++++++++++++++++++ utils/call-gen/src/lib.rs | 3 + .../src/batch_pool/generators/batch.rs | 4 +- utils/node-loader/src/utils.rs | 10 +- utils/runtime-fuzzer/fuzz/Cargo.toml | 1 + utils/runtime-fuzzer/src/lib.rs | 6 +- utils/wasm-gen/Cargo.toml | 5 +- utils/wasm-gen/src/config.rs | 12 +- utils/wasm-gen/src/config/generator.rs | 2 +- utils/wasm-gen/src/config/module.rs | 2 +- utils/wasm-gen/src/config/syscalls/param.rs | 2 +- utils/wasm-gen/src/generator.rs | 30 ++- utils/wasm-gen/src/generator/entry_points.rs | 61 ++--- utils/wasm-gen/src/generator/memory.rs | 22 +- utils/wasm-gen/src/generator/syscalls.rs | 10 + .../src/generator/syscalls/additional_data.rs | 66 ++++-- .../src/generator/syscalls/imports.rs | 78 ++++--- .../src/generator/syscalls/invocator.rs | 115 ++++++++-- utils/wasm-gen/src/lib.rs | 18 +- utils/wasm-gen/src/tests.rs | 14 +- utils/wasm-gen/src/wasm.rs | 16 +- 23 files changed, 534 insertions(+), 160 deletions(-) create mode 100644 utils/call-gen/src/arbitrary_call.rs diff --git a/Cargo.lock b/Cargo.lock index 6f1eac910fe..9241dbb219b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3798,6 +3798,8 @@ dependencies = [ "hex", "log", "rand 0.8.5", + "sha-1", + "static_assertions", "thiserror", ] @@ -4368,6 +4370,7 @@ dependencies = [ "gear-wasm-instrument", "gsys", "indicatif", + "log", "proptest", "rand 0.8.5", "wasm-smith", @@ -9185,6 +9188,7 @@ name = "runtime-fuzzer-fuzz" version = "0.1.0" dependencies = [ "env_logger", + "gear-call-gen", "gear-utils", "libfuzzer-sys", "log", diff --git a/utils/call-gen/Cargo.toml b/utils/call-gen/Cargo.toml index 749ce2db52d..8fd382a45cb 100644 --- a/utils/call-gen/Cargo.toml +++ b/utils/call-gen/Cargo.toml @@ -15,4 +15,6 @@ dyn-clonable.workspace = true hex.workspace = true log.workspace = true rand.workspace = true +sha-1 = "0.9.3" +static_assertions.workspace = true thiserror.workspace = true diff --git a/utils/call-gen/src/arbitrary_call.rs b/utils/call-gen/src/arbitrary_call.rs new file mode 100644 index 00000000000..ac76cf855e1 --- /dev/null +++ b/utils/call-gen/src/arbitrary_call.rs @@ -0,0 +1,211 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! `Arbitrary` trait implementation for a collection of [`GearCall`]. + +use crate::{GearCall, SendMessageArgs, UploadProgramArgs}; +use arbitrary::{Arbitrary, Result, Unstructured}; +use gear_core::ids::{CodeId, ProgramId}; +use gear_utils::NonEmpty; +use gear_wasm_gen::{ + EntryPointsSet, StandardGearWasmConfigsBundle, SysCallName, SysCallsInjectionAmounts, +}; +use sha1::*; +use std::{ + mem::{self, MaybeUninit}, + ops::{Div, Mul}, +}; + +/// Gear runtime max gas limit. +const GAS_LIMIT: u64 = 250_000_000_000; + +/// Maximum payload size for the fuzzer - 512 KiB. +const MAX_PAYLOAD_SIZE: usize = 512 * 1024; +static_assertions::const_assert!(MAX_PAYLOAD_SIZE <= gear_core::message::MAX_PAYLOAD_SIZE); + +/// New-type wrapper over array of [`GearCall`]s. +/// +/// It's main purpose is to be an implementor of `Arbitrary` for the array of [`GearCall`]s. +/// New-type is required as array is always a foreign type. +#[derive(Debug, Clone)] +pub struct GearCalls(pub [GearCall; GearCalls::MAX_CALLS]); + +impl GearCalls { + pub const MAX_CALLS: usize = GearCalls::INIT_MSGS + GearCalls::HANDLE_MSGS; + pub const INIT_MSGS: usize = 10; + pub const HANDLE_MSGS: usize = 25; +} + +impl<'a> Arbitrary<'a> for GearCalls { + fn arbitrary(u: &mut Unstructured<'a>) -> Result { + // Newline to easily browse logs. + println!("\n"); + + log::trace!("New GearCalls generation: random data received {}", u.len()); + + // 25 MiB is an approximate assessment for 35 calls, + // where each call of: + // 1. `UploadProgram` requires 1024 KiB for payload an salt and 50 KiB for code. + // 2. `SendMessage` requires 512 Kib for payload. + // So, [10 * (1024 + 50)] + [25 * 512] = 23540 KiB + if u.len() < 25_000_000_usize { + log::trace!("Not enough bytes for creating gear calls"); + return Err(arbitrary::Error::NotEnoughData); + } + + let log_data = format!( + "Generated from corpus - {}", + get_sha1_string(u.peek_bytes(u.len()).expect("checked")) + ); + let gas = GAS_LIMIT.mul(99).div(100); + let value = 0; + let mut programs = [ProgramId::default(); GearCalls::INIT_MSGS]; + // Upload code used as a default value. + let mut calls = get_uninitialized_calls(); + + // Generate `GearCalls::INIT_MSGS` number of `UploadProgram` calls. + for i in 0..GearCalls::INIT_MSGS { + log::trace!("New gear-wasm generation"); + + log::trace!("Random data before wasm gen {}, iter - {i}", u.len()); + + let code = gear_wasm_gen::generate_gear_program_code( + u, + config(programs, Some(log_data.clone())), + )?; + log::trace!("Random data after wasm gen {}, iter - {i}", u.len()); + log::trace!("Code length {:?}", code.len()); + + let salt = arbitrary_salt(u)?; + log::trace!("Random data after salt gen {}, iter - {i}", u.len()); + log::trace!("Salt length {:?}", salt.len()); + + let payload = arbitrary_payload(u)?; + log::trace!( + "Random data after payload (upload_program) gen {}, iter - {i}", + u.len() + ); + log::trace!("Payload (upload_program) length {:?}", payload.len()); + + programs[i] = ProgramId::generate(CodeId::generate(&code), &salt); + calls[i].write(GearCall::UploadProgram(UploadProgramArgs(( + code, salt, payload, gas, value, + )))); + } + + // Generate `GearCalls::HANDLE_MSGS` number of `SendMessage` calls. + #[allow(clippy::needless_range_loop)] + for i in GearCalls::INIT_MSGS..GearCalls::INIT_MSGS + GearCalls::HANDLE_MSGS { + let program_id = u.choose(&programs).copied()?; + let payload = arbitrary_payload(u)?; + log::trace!( + "Random data after payload (send_message) gen {}, iter - {i}", + u.len() + ); + log::trace!("Payload (send_message) length {:?}", payload.len()); + + calls[i].write(GearCall::SendMessage(SendMessageArgs(( + program_id, payload, gas, value, + )))); + } + + let calls = transmute_calls_to_init(calls); + + log::trace!( + "GearCalls generation ended. Random data remains - {}", + u.len() + ); + + Ok(GearCalls(calls)) + } +} + +fn arbitrary_salt(u: &mut Unstructured<'_>) -> Result> { + arbitrary_limited_bytes(u, MAX_PAYLOAD_SIZE) +} + +fn arbitrary_payload(u: &mut Unstructured<'_>) -> Result> { + arbitrary_limited_bytes(u, MAX_PAYLOAD_SIZE) +} + +fn arbitrary_limited_bytes(u: &mut Unstructured<'_>, limit: usize) -> Result> { + let arb_size = u.int_in_range(0..=limit)?; + u.bytes(arb_size).map(|bytes| bytes.to_vec()) +} + +fn get_uninitialized_calls() -> [MaybeUninit; GearCalls::MAX_CALLS] { + unsafe { + // # Safety: + // + // Create an uninitialized array of `MaybeUninit`. The `assume_init` is + // safe because the type we are claiming to have initialized here is a + // bunch of `MaybeUninit`s, which do not require initialization. + MaybeUninit::uninit().assume_init() + } +} + +fn transmute_calls_to_init( + uninit_calls: [MaybeUninit; GearCalls::MAX_CALLS], +) -> [GearCall; GearCalls::MAX_CALLS] { + unsafe { + // # Safety: + // + // Called when gear calls are initialized. Transmute the array to the + // initialized type. + mem::transmute::<_, [GearCall; GearCalls::MAX_CALLS]>(uninit_calls) + } +} + +fn config( + programs: [ProgramId; GearCalls::INIT_MSGS], + log_info: Option, +) -> StandardGearWasmConfigsBundle { + let mut injection_amounts = SysCallsInjectionAmounts::all_once(); + injection_amounts.set(SysCallName::Leave, 0, 0); + injection_amounts.set(SysCallName::Panic, 0, 0); + injection_amounts.set(SysCallName::OomPanic, 0, 0); + injection_amounts.set(SysCallName::Send, 20, 30); + injection_amounts.set(SysCallName::Exit, 0, 1); + + let existing_addresses = NonEmpty::collect( + programs + .iter() + .copied() + .filter(|&pid| pid != ProgramId::default()), + ); + + log::trace!( + "Messages will be sent to existing addresses {:?}", + existing_addresses + ); + + StandardGearWasmConfigsBundle { + entry_points_set: EntryPointsSet::InitHandleHandleReply, + injection_amounts, + existing_addresses, + log_info, + ..Default::default() + } +} + +fn get_sha1_string(input: &[u8]) -> String { + let mut hasher = sha1::Sha1::new(); + hasher.update(input); + + hex::encode(hasher.finalize()) +} diff --git a/utils/call-gen/src/lib.rs b/utils/call-gen/src/lib.rs index 0c9bc536724..8a0f868f7c3 100644 --- a/utils/call-gen/src/lib.rs +++ b/utils/call-gen/src/lib.rs @@ -18,6 +18,7 @@ //! Generator of the `pallet-gear` calls. +mod arbitrary_call; mod claim_value; mod create_program; mod rand_utils; @@ -26,6 +27,7 @@ mod send_reply; mod upload_code; mod upload_program; +pub use arbitrary_call::GearCalls; pub use claim_value::ClaimValueArgs; pub use create_program::CreateProgramArgs; pub use rand_utils::{CallGenRng, CallGenRngCore}; @@ -90,6 +92,7 @@ pub trait NamedCallArgs { } /// Set of `pallet_gear` calls supported by the crate. +#[derive(Debug, Clone)] pub enum GearCall { /// Upload program call args. UploadProgram(UploadProgramArgs), diff --git a/utils/node-loader/src/batch_pool/generators/batch.rs b/utils/node-loader/src/batch_pool/generators/batch.rs index b6da95141ed..f45f68fd7bd 100644 --- a/utils/node-loader/src/batch_pool/generators/batch.rs +++ b/utils/node-loader/src/batch_pool/generators/batch.rs @@ -12,7 +12,7 @@ use gear_call_gen::{ }; use gear_core::ids::ProgramId; use gear_utils::NonEmpty; -use gear_wasm_gen::ValidGearWasmConfigsBundle; +use gear_wasm_gen::StandardGearWasmConfigsBundle; use std::iter; use tracing::instrument; @@ -206,7 +206,7 @@ impl BatchGenerator { fn gen_batch< T: CallArgs, FuzzerArgsFn: FnMut(&mut Rng) -> T::FuzzerArgs, - ConstArgsFn: Fn() -> T::ConstArgs>, + ConstArgsFn: Fn() -> T::ConstArgs>, >( batch_size: usize, seed: Seed, diff --git a/utils/node-loader/src/utils.rs b/utils/node-loader/src/utils.rs index 72f2c3ad2a2..9beff5e7cda 100644 --- a/utils/node-loader/src/utils.rs +++ b/utils/node-loader/src/utils.rs @@ -6,7 +6,7 @@ use gear_call_gen::Seed; use gear_core::ids::{MessageId, ProgramId}; use gear_core_errors::ReplyCode; use gear_utils::NonEmpty; -use gear_wasm_gen::{EntryPointsSet, ValidGearWasmConfigsBundle}; +use gear_wasm_gen::{EntryPointsSet, StandardGearWasmConfigsBundle}; use gsdk::metadata::runtime_types::{ gear_common::event::DispatchStatus as GenDispatchStatus, gear_core::{ @@ -35,9 +35,9 @@ pub const WAITING_TX_FINALIZED_TIMEOUT_ERR_STR: &str = "Transaction finalization wait timeout is reached"; pub fn dump_with_seed(seed: u64) -> Result<()> { - let code = gear_call_gen::generate_gear_program::( + let code = gear_call_gen::generate_gear_program::( seed, - ValidGearWasmConfigsBundle::default(), + StandardGearWasmConfigsBundle::default(), ); let mut file = File::create("out.wasm")?; @@ -208,8 +208,8 @@ pub fn err_waited_or_succeed_batch( pub fn get_wasm_gen_config( seed: Seed, existing_programs: impl Iterator, -) -> ValidGearWasmConfigsBundle { - ValidGearWasmConfigsBundle { +) -> StandardGearWasmConfigsBundle { + StandardGearWasmConfigsBundle { log_info: Some(format!("Gear program seed = '{seed}'")), existing_addresses: NonEmpty::collect(existing_programs), entry_points_set: EntryPointsSet::InitHandleHandleReply, diff --git a/utils/runtime-fuzzer/fuzz/Cargo.toml b/utils/runtime-fuzzer/fuzz/Cargo.toml index d0b4efecd27..b92ef89cd01 100644 --- a/utils/runtime-fuzzer/fuzz/Cargo.toml +++ b/utils/runtime-fuzzer/fuzz/Cargo.toml @@ -14,6 +14,7 @@ gear-utils.workspace = true env_logger.workspace = true log.workspace = true once_cell.workspace = true +gear-call-gen.workspace = true [[bin]] name = "main" diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index 96c61c894db..14b59059289 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -26,7 +26,7 @@ use gear_common::event::ProgramChangeKind; use gear_core::ids::ProgramId; use gear_runtime::{AccountId, Gear, Runtime, RuntimeEvent, RuntimeOrigin, System}; use gear_utils::NonEmpty; -use gear_wasm_gen::{EntryPointsSet, ValidGearWasmConfigsBundle}; +use gear_wasm_gen::{EntryPointsSet, StandardGearWasmConfigsBundle}; use once_cell::sync::OnceCell; use pallet_balances::Pallet as BalancesPallet; use pallet_gear::Event; @@ -118,8 +118,8 @@ fn generate_gear_call(seed: u64, context: &ContextMutex) -> Gea } } -fn fuzzer_config(seed: u64, programs: Vec) -> ValidGearWasmConfigsBundle { - ValidGearWasmConfigsBundle { +fn fuzzer_config(seed: u64, programs: Vec) -> StandardGearWasmConfigsBundle { + StandardGearWasmConfigsBundle { log_info: Some(format!("Gear program seed = '{seed}'")), existing_addresses: NonEmpty::from_vec(programs), entry_points_set: EntryPointsSet::HandleHandleReply, diff --git a/utils/wasm-gen/Cargo.toml b/utils/wasm-gen/Cargo.toml index e838c59592e..1f59ba47d9a 100644 --- a/utils/wasm-gen/Cargo.toml +++ b/utils/wasm-gen/Cargo.toml @@ -8,15 +8,16 @@ license.workspace = true [dependencies] wasm-smith.workspace = true arbitrary = { workspace = true, features = ["derive"] } +log.workspace = true gear-wasm-instrument.workspace = true wasmprinter.workspace = true gsys.workspace = true gear-utils.workspace = true +gear-core.workspace = true +wasmparser.workspace = true [dev-dependencies] rand = { workspace = true, features = ["small_rng"] } -wasmparser.workspace = true wat.workspace = true indicatif.workspace = true proptest.workspace = true -gear-core.workspace = true diff --git a/utils/wasm-gen/src/config.rs b/utils/wasm-gen/src/config.rs index 10967dd04f7..68edfc69f72 100644 --- a/utils/wasm-gen/src/config.rs +++ b/utils/wasm-gen/src/config.rs @@ -107,10 +107,10 @@ impl ConfigsBundle for () { } } -/// Set of configurational data which is used to generate always +/// Standard set of configurational data which is used to generate always /// valid gear-wasm using generators of the current crate. #[derive(Debug, Clone)] -pub struct ValidGearWasmConfigsBundle { +pub struct StandardGearWasmConfigsBundle { /// Externalities to be logged. pub log_info: Option, /// Set of existing addresses, which will be used as message destinations. @@ -128,10 +128,10 @@ pub struct ValidGearWasmConfigsBundle { pub entry_points_set: EntryPointsSet, } -impl Default for ValidGearWasmConfigsBundle { +impl Default for StandardGearWasmConfigsBundle { fn default() -> Self { Self { - log_info: Some("Valid config".into()), + log_info: Some("StandardGearWasmConfigsBundle".into()), existing_addresses: None, remove_recursion: false, call_indirect_enabled: true, @@ -141,9 +141,9 @@ impl Default for ValidGearWasmConfigsBundle { } } -impl> ConfigsBundle for ValidGearWasmConfigsBundle { +impl> ConfigsBundle for StandardGearWasmConfigsBundle { fn into_parts(self) -> (GearWasmGeneratorConfig, SelectableParams) { - let ValidGearWasmConfigsBundle { + let StandardGearWasmConfigsBundle { log_info, existing_addresses, remove_recursion, diff --git a/utils/wasm-gen/src/config/generator.rs b/utils/wasm-gen/src/config/generator.rs index 0fe84d53605..5ee9341d8bd 100644 --- a/utils/wasm-gen/src/config/generator.rs +++ b/utils/wasm-gen/src/config/generator.rs @@ -96,7 +96,7 @@ impl Default for MemoryPagesConfig { fn default() -> Self { Self { initial_size: Self::MAX_VALUE / 2 + 5, - upper_limit: Some(Self::MAX_VALUE), + upper_limit: None, stack_end_page: Some(Self::MAX_VALUE / 2), } } diff --git a/utils/wasm-gen/src/config/module.rs b/utils/wasm-gen/src/config/module.rs index f72aca66281..34c716871d3 100644 --- a/utils/wasm-gen/src/config/module.rs +++ b/utils/wasm-gen/src/config/module.rs @@ -334,7 +334,7 @@ impl Default for ConstantParams { max_imports: 0, max_instructions: 100_000, min_funcs: 15, - max_funcs: 100, + max_funcs: 30, max_data_segments: 0, min_data_segments: 0, max_types: 100, diff --git a/utils/wasm-gen/src/config/syscalls/param.rs b/utils/wasm-gen/src/config/syscalls/param.rs index 74b9981eace..3573ce113c6 100644 --- a/utils/wasm-gen/src/config/syscalls/param.rs +++ b/utils/wasm-gen/src/config/syscalls/param.rs @@ -55,7 +55,7 @@ impl Default for SysCallsParamsConfig { (ParamType::Gas, (0..=250_000_000_000).into()), (ParamType::MessagePosition, (0..=10).into()), (ParamType::Duration, (0..=100).into()), - (ParamType::Delay, (0..=100).into()), + (ParamType::Delay, (0..=4).into()), (ParamType::Handler, (0..=100).into()), (ParamType::Alloc, (0..=512).into()), (ParamType::Free, (0..=512).into()), diff --git a/utils/wasm-gen/src/generator.rs b/utils/wasm-gen/src/generator.rs index 9848ba1b8ee..ffa44d21a90 100644 --- a/utils/wasm-gen/src/generator.rs +++ b/utils/wasm-gen/src/generator.rs @@ -93,23 +93,23 @@ impl ModuleWithCallIndexes { /// General gear wasm generator, which works as a mediator /// controlling relations between various available in the /// crate generators. -pub struct GearWasmGenerator<'a> { - unstructured: &'a mut Unstructured<'a>, +pub struct GearWasmGenerator<'a, 'b> { + unstructured: &'b mut Unstructured<'a>, module: WasmModule, config: GearWasmGeneratorConfig, call_indexes: CallIndexes, } -impl<'a> GearWasmGenerator<'a> { +impl<'a, 'b> GearWasmGenerator<'a, 'b> { /// Create a new generator with a default config.. - pub fn new(module: WasmModule, unstructured: &'a mut Unstructured<'a>) -> Self { + pub fn new(module: WasmModule, unstructured: &'b mut Unstructured<'a>) -> Self { Self::new_with_config(module, unstructured, GearWasmGeneratorConfig::default()) } /// Create a new generator with a defined config. pub fn new_with_config( module: WasmModule, - unstructured: &'a mut Unstructured<'a>, + unstructured: &'b mut Unstructured<'a>, config: GearWasmGeneratorConfig, ) -> Self { let call_indexes = CallIndexes::new(&module); @@ -126,8 +126,10 @@ impl<'a> GearWasmGenerator<'a> { pub fn generate(self) -> Result { let (disabled_mem_gen, frozen_gear_wasm_gen, mem_imports_gen_proof) = self.generate_memory_export(); + let (disabled_ep_gen, frozen_gear_wasm_gen, ep_gen_proof) = Self::from((disabled_mem_gen, frozen_gear_wasm_gen)).generate_entry_points()?; + let (disabled_syscalls_invocator, frozen_gear_wasm_gen) = Self::from((disabled_ep_gen, frozen_gear_wasm_gen)) .generate_sys_calls(mem_imports_gen_proof, ep_gen_proof)?; @@ -138,8 +140,10 @@ impl<'a> GearWasmGenerator<'a> { .into_inner(); Ok(if config.remove_recursions { + log::trace!("Removing recursions"); utils::remove_recursion(module) } else { + log::trace!("Leaving recursions"); module }) } @@ -149,7 +153,7 @@ impl<'a> GearWasmGenerator<'a> { self, ) -> ( DisabledMemoryGenerator, - FrozenGearWasmGenerator<'a>, + FrozenGearWasmGenerator<'a, 'b>, MemoryImportGenerationProof, ) { let (mem_gen, frozen_gear_wasm_gen): (MemoryGenerator, FrozenGearWasmGenerator) = @@ -163,8 +167,8 @@ impl<'a> GearWasmGenerator<'a> { pub fn generate_entry_points( self, ) -> Result<( - DisabledEntryPointsGenerator<'a>, - FrozenGearWasmGenerator<'a>, + DisabledEntryPointsGenerator<'a, 'b>, + FrozenGearWasmGenerator<'a, 'b>, GearEntryPointGenerationProof, )> { let (ep_gen, frozen_gear_wasm_gen): (EntryPointsGenerator, FrozenGearWasmGenerator) = @@ -179,7 +183,7 @@ impl<'a> GearWasmGenerator<'a> { self, mem_import_gen_proof: MemoryImportGenerationProof, ep_gen_proof: GearEntryPointGenerationProof, - ) -> Result<(DisabledSysCallsInvocator, FrozenGearWasmGenerator<'a>)> { + ) -> Result<(DisabledSysCallsInvocator, FrozenGearWasmGenerator<'a, 'b>)> { let sys_calls_imports_gen_instantiator = SysCallsImportsGeneratorInstantiator::from((self, mem_import_gen_proof, ep_gen_proof)); let (sys_calls_imports_gen, frozen_gear_wasm_gen) = @@ -256,6 +260,8 @@ impl CallIndexes { } fn add_func(&mut self, func_idx: usize) { + log::trace!("Inserting function with func index {func_idx}"); + self.inner.push(FunctionIndex::Func(func_idx as u32)); let is_new = self.custom_funcs.insert(func_idx); @@ -283,13 +289,13 @@ enum FunctionIndex { /// instance was converted to some other generator available in this crate. /// This type serves as an access/ticket for converting some generator back /// to the gear wasm generator. So it mainly controls state machine flow. -pub struct FrozenGearWasmGenerator<'a> { +pub struct FrozenGearWasmGenerator<'a, 'b> { config: GearWasmGeneratorConfig, call_indexes: Option, - unstructured: Option<&'a mut Unstructured<'a>>, + unstructured: Option<&'b mut Unstructured<'a>>, } -impl<'a> FrozenGearWasmGenerator<'a> { +impl<'a, 'b> FrozenGearWasmGenerator<'a, 'b> { /// Destroy the frozen generator and retrieve it's /// beneficial data. pub fn melt(self) -> GearWasmGeneratorConfig { diff --git a/utils/wasm-gen/src/generator/entry_points.rs b/utils/wasm-gen/src/generator/entry_points.rs index 9b792226382..6721792e435 100644 --- a/utils/wasm-gen/src/generator/entry_points.rs +++ b/utils/wasm-gen/src/generator/entry_points.rs @@ -31,15 +31,20 @@ use gear_wasm_instrument::parity_wasm::{ /// Gear wasm entry points generator. /// /// Inserts gear wasm required export functions depending on the config. -pub struct EntryPointsGenerator<'a> { - unstructured: &'a mut Unstructured<'a>, +pub struct EntryPointsGenerator<'a, 'b> { + unstructured: &'b mut Unstructured<'a>, module: WasmModule, config: EntryPointsSet, call_indexes: CallIndexes, } -impl<'a> From> for (EntryPointsGenerator<'a>, FrozenGearWasmGenerator<'a>) { - fn from(generator: GearWasmGenerator<'a>) -> Self { +impl<'a, 'b> From> + for ( + EntryPointsGenerator<'a, 'b>, + FrozenGearWasmGenerator<'a, 'b>, + ) +{ + fn from(generator: GearWasmGenerator<'a, 'b>) -> Self { let ep_generator = EntryPointsGenerator { unstructured: generator.unstructured, module: generator.module, @@ -56,12 +61,12 @@ impl<'a> From> for (EntryPointsGenerator<'a>, FrozenGearWa } } -impl<'a> EntryPointsGenerator<'a> { +impl<'a, 'b> EntryPointsGenerator<'a, 'b> { /// Instantiate a new gear wasm entry points generator. pub fn new( module_with_indexes: ModuleWithCallIndexes, config: EntryPointsSet, - unstructured: &'a mut Unstructured<'a>, + unstructured: &'b mut Unstructured<'a>, ) -> Self { let ModuleWithCallIndexes { module, @@ -77,7 +82,11 @@ impl<'a> EntryPointsGenerator<'a> { } /// Disable current generator. - pub fn disable(self) -> DisabledEntryPointsGenerator<'a> { + pub fn disable(self) -> DisabledEntryPointsGenerator<'a, 'b> { + log::trace!( + "Random data when disabling gear entry points generator - {}", + self.unstructured.len() + ); DisabledEntryPointsGenerator { unstructured: self.unstructured, module: self.module, @@ -91,9 +100,11 @@ impl<'a> EntryPointsGenerator<'a> { pub fn generate_entry_points( mut self, ) -> Result<( - DisabledEntryPointsGenerator<'a>, + DisabledEntryPointsGenerator<'a, 'b>, GearEntryPointGenerationProof, )> { + log::trace!("Generating gear entry points"); + if self.config.has_init() { self.generate_export("init")?; } @@ -106,13 +117,7 @@ impl<'a> EntryPointsGenerator<'a> { self.generate_export("handle_reply")?; } - let disabled = DisabledEntryPointsGenerator { - unstructured: self.unstructured, - module: self.module, - call_indexes: self.call_indexes, - }; - - Ok((disabled, GearEntryPointGenerationProof(()))) + Ok((self.disable(), GearEntryPointGenerationProof(()))) } /// Generates an export function with a `name`. @@ -127,6 +132,11 @@ impl<'a> EntryPointsGenerator<'a> { /// and then disabled, that export index can be retrieved from [`DisabledEntryPointsGenerator`], by /// accessing the underlying `parity_wasm::module::Module` and iterating over it's export section. pub fn generate_export(&mut self, name: &str) -> Result { + log::trace!( + "Random data before generating {name} export - {}", + self.unstructured.len() + ); + let last_func_idx = self.module.count_code_funcs() - 1; let export_body_call_idx = self.unstructured.int_in_range(0..=last_func_idx)?; @@ -175,6 +185,7 @@ impl<'a> EntryPointsGenerator<'a> { (module, ()) }); + log::trace!("Generated export - {name}"); self.call_indexes.add_func(export_idx); Ok(GearEntryPointGenerationProof(())) @@ -213,14 +224,14 @@ pub struct GearEntryPointGenerationProof(()); /// /// Instance of this types signals that there was once active gear wasm /// entry points generator, but it ended up it's work. -pub struct DisabledEntryPointsGenerator<'a> { - unstructured: &'a mut Unstructured<'a>, +pub struct DisabledEntryPointsGenerator<'a, 'b> { + unstructured: &'b mut Unstructured<'a>, module: WasmModule, call_indexes: CallIndexes, } -impl<'a> From> for ModuleWithCallIndexes { - fn from(ep_gen: DisabledEntryPointsGenerator<'a>) -> Self { +impl<'a, 'b> From> for ModuleWithCallIndexes { + fn from(ep_gen: DisabledEntryPointsGenerator<'a, 'b>) -> Self { ModuleWithCallIndexes { module: ep_gen.module, call_indexes: ep_gen.call_indexes, @@ -228,16 +239,16 @@ impl<'a> From> for ModuleWithCallIndexes { } } -impl<'a> +impl<'a, 'b> From<( - DisabledEntryPointsGenerator<'a>, - FrozenGearWasmGenerator<'a>, - )> for GearWasmGenerator<'a> + DisabledEntryPointsGenerator<'a, 'b>, + FrozenGearWasmGenerator<'a, 'b>, + )> for GearWasmGenerator<'a, 'b> { fn from( (disabled_ep_gen, frozen_gear_wasm_gen): ( - DisabledEntryPointsGenerator<'a>, - FrozenGearWasmGenerator<'a>, + DisabledEntryPointsGenerator<'a, 'b>, + FrozenGearWasmGenerator<'a, 'b>, ), ) -> Self { GearWasmGenerator { diff --git a/utils/wasm-gen/src/generator/memory.rs b/utils/wasm-gen/src/generator/memory.rs index 54280ff85fc..997336aebc2 100644 --- a/utils/wasm-gen/src/generator/memory.rs +++ b/utils/wasm-gen/src/generator/memory.rs @@ -20,9 +20,9 @@ use crate::{ generator::{CallIndexes, FrozenGearWasmGenerator, GearWasmGenerator, ModuleWithCallIndexes}, - wasm::WASM_PAGE_SIZE, MemoryPagesConfig, WasmModule, }; +use gear_core::pages::WASM_PAGE_SIZE; use gear_wasm_instrument::{ parity_wasm::{ builder, @@ -41,8 +41,10 @@ pub struct MemoryGenerator { module: WasmModule, } -impl<'a> From> for (MemoryGenerator, FrozenGearWasmGenerator<'a>) { - fn from(generator: GearWasmGenerator<'a>) -> Self { +impl<'a, 'b> From> + for (MemoryGenerator, FrozenGearWasmGenerator<'a, 'b>) +{ + fn from(generator: GearWasmGenerator<'a, 'b>) -> Self { let mem_generator = MemoryGenerator { config: generator.config.memory_config, module: generator.module, @@ -74,6 +76,8 @@ impl MemoryGenerator { /// /// Returns disabled memory generation and a proof that memory imports generation has happened. pub fn generate_memory(mut self) -> (DisabledMemoryGenerator, MemoryImportGenerationProof) { + log::trace!("Generating memory section"); + self.remove_mem_section(); let MemoryGenerator { @@ -86,6 +90,8 @@ impl MemoryGenerator { }, } = self; + log::trace!("Initial pages num - {}", initial_size); + // Define memory import in the module module.with(|module| { let mut module = builder::from_module(module) @@ -99,7 +105,9 @@ impl MemoryGenerator { // Define optional stack-end if let Some(stack_end_page) = stack_end_page { - let stack_end = stack_end_page * WASM_PAGE_SIZE; + log::trace!("Stack end offset - {:?}", stack_end_page); + + let stack_end = stack_end_page * WASM_PAGE_SIZE as u32; module = builder::from_module(module) .global() .value_type() @@ -173,11 +181,13 @@ impl From for ModuleWithCallIndexes { } } -impl<'a> From<(DisabledMemoryGenerator, FrozenGearWasmGenerator<'a>)> for GearWasmGenerator<'a> { +impl<'a, 'b> From<(DisabledMemoryGenerator, FrozenGearWasmGenerator<'a, 'b>)> + for GearWasmGenerator<'a, 'b> +{ fn from( (disabled_mem_gen, frozen_gear_wasm_gen): ( DisabledMemoryGenerator, - FrozenGearWasmGenerator<'a>, + FrozenGearWasmGenerator<'a, 'b>, ), ) -> Self { GearWasmGenerator { diff --git a/utils/wasm-gen/src/generator/syscalls.rs b/utils/wasm-gen/src/generator/syscalls.rs index 3a636fa054b..dc18e551812 100644 --- a/utils/wasm-gen/src/generator/syscalls.rs +++ b/utils/wasm-gen/src/generator/syscalls.rs @@ -61,6 +61,16 @@ pub(crate) enum InvocableSysCall { } impl InvocableSysCall { + fn to_str(self) -> &'static str { + match self { + InvocableSysCall::Loose(sys_call) => sys_call.to_str(), + InvocableSysCall::Precise(sys_call) => match sys_call { + SysCallName::ReservationSend => "precise_gr_reservation_send", + _ => unimplemented!(), + }, + } + } + fn into_signature(self) -> SysCallSignature { match self { InvocableSysCall::Loose(name) => name.signature(), diff --git a/utils/wasm-gen/src/generator/syscalls/additional_data.rs b/utils/wasm-gen/src/generator/syscalls/additional_data.rs index 3a8492a3e9c..4a2cdbb3751 100644 --- a/utils/wasm-gen/src/generator/syscalls/additional_data.rs +++ b/utils/wasm-gen/src/generator/syscalls/additional_data.rs @@ -26,6 +26,7 @@ use crate::{ utils, EntryPointName, InvocableSysCall, MessageDestination, SysCallsConfig, WasmModule, }; use arbitrary::Unstructured; +use gear_core::ids::ProgramId; use gear_wasm_instrument::{ parity_wasm::{builder, elements::Instruction}, syscalls::SysCallName, @@ -58,8 +59,8 @@ impl AddressesOffsets { /// /// The generator is instantiated only with having [`SysCallsImportsGenerationProof`], which gives a guarantee. that /// if log info should be injected, than `gr_debug` sys-call import is generated. -pub struct AdditionalDataInjector<'a> { - unstructured: &'a mut Unstructured<'a>, +pub struct AdditionalDataInjector<'a, 'b> { + unstructured: &'b mut Unstructured<'a>, call_indexes: CallIndexes, config: SysCallsConfig, last_offset: u32, @@ -68,15 +69,15 @@ pub struct AdditionalDataInjector<'a> { sys_calls_imports: BTreeMap, } -impl<'a> +impl<'a, 'b> From<( - DisabledSysCallsImportsGenerator<'a>, + DisabledSysCallsImportsGenerator<'a, 'b>, SysCallsImportsGenerationProof, - )> for AdditionalDataInjector<'a> + )> for AdditionalDataInjector<'a, 'b> { fn from( (disabled_gen, _sys_calls_gen_proof): ( - DisabledSysCallsImportsGenerator<'a>, + DisabledSysCallsImportsGenerator<'a, 'b>, SysCallsImportsGenerationProof, ), ) -> Self { @@ -96,33 +97,28 @@ impl<'a> } } -impl<'a> AdditionalDataInjector<'a> { +impl<'a, 'b> AdditionalDataInjector<'a, 'b> { /// Injects additional data from config to the wasm module. /// /// Returns disabled additional data injector and injection outcome. pub fn inject( mut self, ) -> ( - DisabledAdditionalDataInjector<'a>, + DisabledAdditionalDataInjector<'a, 'b>, AddressesInjectionOutcome, ) { + log::trace!("Injecting additional data"); + let offsets = self.inject_addresses(); self.inject_log_info_printing(); - let disabled = DisabledAdditionalDataInjector { - module: self.module, - call_indexes: self.call_indexes, - sys_calls_imports: self.sys_calls_imports, - config: self.config, - unstructured: self.unstructured, - }; let outcome = AddressesInjectionOutcome { offsets }; - (disabled, outcome) + (self.disable(), outcome) } /// Disable current generator. - pub fn disable(self) -> DisabledAdditionalDataInjector<'a> { + pub fn disable(self) -> DisabledAdditionalDataInjector<'a, 'b> { DisabledAdditionalDataInjector { module: self.module, call_indexes: self.call_indexes, @@ -138,6 +134,7 @@ impl<'a> AdditionalDataInjector<'a> { /// If no addresses were defined in the config, then returns `None`. pub fn inject_addresses(&mut self) -> Option { if !self.addresses_offsets.is_empty() { + log::trace!("Called address injection again"); return Some(AddressesOffsets( self.addresses_offsets.clone().into_iter().cycle(), )); @@ -147,6 +144,7 @@ impl<'a> AdditionalDataInjector<'a> { return None; }; + log::trace!("Inserting {} addresses into wasm", existing_addresses.len()); for address in existing_addresses { self.addresses_offsets.push(self.last_offset); @@ -163,9 +161,19 @@ impl<'a> AdditionalDataInjector<'a> { (module, ()) }); + log::trace!( + "Inserted {} program address into wasm", + ProgramId::from(address.hash.as_slice()) + ); + self.last_offset += data_len as u32; } + log::trace!( + "Last offset after inserting addresses - {}", + self.last_offset + ); + Some(AddressesOffsets( self.addresses_offsets.clone().into_iter().cycle(), )) @@ -181,13 +189,25 @@ impl<'a> AdditionalDataInjector<'a> { let Some(log_info) = self.config.log_info() else { return; }; + log::trace!("Inserting next logging info - {log_info}"); + let log_bytes = log_info.as_bytes().to_vec(); let export_idx = self .module .gear_entry_point(EntryPointName::Init) - .or_else(|| self.module.gear_entry_point(EntryPointName::Handle)) - .or_else(|| self.module.gear_entry_point(EntryPointName::HandleReply)) + .map(|idx| { + log::trace!("Info will be logged in init"); + idx + }) + .or_else(|| { + log::trace!("Info will be logged in handle"); + self.module.gear_entry_point(EntryPointName::Handle) + }) + .or_else(|| { + log::trace!("Info will be logged in handle_reply"); + self.module.gear_entry_point(EntryPointName::HandleReply) + }) // This generator is instantiated from SysCallsImportsGenerator, which can only be // generated if entry points and memory import were generated. .expect("impossible to have no gear export"); @@ -247,16 +267,16 @@ pub struct AddressesInjectionOutcome { /// /// Instance of this type signals that there was once active additional data injector, /// but it ended up it's work. -pub struct DisabledAdditionalDataInjector<'a> { - pub(super) unstructured: &'a mut Unstructured<'a>, +pub struct DisabledAdditionalDataInjector<'a, 'b> { + pub(super) unstructured: &'b mut Unstructured<'a>, pub(super) module: WasmModule, pub(super) call_indexes: CallIndexes, pub(super) sys_calls_imports: BTreeMap, pub(super) config: SysCallsConfig, } -impl<'a> From> for ModuleWithCallIndexes { - fn from(additional_data_inj: DisabledAdditionalDataInjector<'a>) -> Self { +impl<'a, 'b> From> for ModuleWithCallIndexes { + fn from(additional_data_inj: DisabledAdditionalDataInjector<'a, 'b>) -> Self { ModuleWithCallIndexes { module: additional_data_inj.module, call_indexes: additional_data_inj.call_indexes, diff --git a/utils/wasm-gen/src/generator/syscalls/imports.rs b/utils/wasm-gen/src/generator/syscalls/imports.rs index feab1e3dbc2..df5d5caa747 100644 --- a/utils/wasm-gen/src/generator/syscalls/imports.rs +++ b/utils/wasm-gen/src/generator/syscalls/imports.rs @@ -38,8 +38,8 @@ use gsys::{ErrorWithHash, HashWithValue, Length}; use std::{collections::BTreeMap, mem}; /// Gear sys-calls imports generator. -pub struct SysCallsImportsGenerator<'a> { - unstructured: &'a mut Unstructured<'a>, +pub struct SysCallsImportsGenerator<'a, 'b> { + unstructured: &'b mut Unstructured<'a>, call_indexes: CallIndexes, module: WasmModule, config: SysCallsConfig, @@ -49,24 +49,24 @@ pub struct SysCallsImportsGenerator<'a> { /// Sys-calls imports generator instantiator. /// /// Serves as a new type in order to create the generator from gear wasm generator and proofs. -pub struct SysCallsImportsGeneratorInstantiator<'a>( +pub struct SysCallsImportsGeneratorInstantiator<'a, 'b>( ( - GearWasmGenerator<'a>, + GearWasmGenerator<'a, 'b>, MemoryImportGenerationProof, GearEntryPointGenerationProof, ), ); -impl<'a> +impl<'a, 'b> From<( - GearWasmGenerator<'a>, + GearWasmGenerator<'a, 'b>, MemoryImportGenerationProof, GearEntryPointGenerationProof, - )> for SysCallsImportsGeneratorInstantiator<'a> + )> for SysCallsImportsGeneratorInstantiator<'a, 'b> { fn from( inner: ( - GearWasmGenerator<'a>, + GearWasmGenerator<'a, 'b>, MemoryImportGenerationProof, GearEntryPointGenerationProof, ), @@ -75,10 +75,13 @@ impl<'a> } } -impl<'a> From> - for (SysCallsImportsGenerator<'a>, FrozenGearWasmGenerator<'a>) +impl<'a, 'b> From> + for ( + SysCallsImportsGenerator<'a, 'b>, + FrozenGearWasmGenerator<'a, 'b>, + ) { - fn from(instantiator: SysCallsImportsGeneratorInstantiator<'a>) -> Self { + fn from(instantiator: SysCallsImportsGeneratorInstantiator<'a, 'b>) -> Self { let SysCallsImportsGeneratorInstantiator(( generator, _mem_import_gen_proof, @@ -101,7 +104,7 @@ impl<'a> From> } } -impl<'a> SysCallsImportsGenerator<'a> { +impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { /// Instantiate a new gear sys-calls imports generator. /// /// The generator instantiations requires having type-level proof that the wasm module has memory import in it. @@ -109,7 +112,7 @@ impl<'a> SysCallsImportsGenerator<'a> { pub fn new( module_with_indexes: ModuleWithCallIndexes, config: SysCallsConfig, - unstructured: &'a mut Unstructured<'a>, + unstructured: &'b mut Unstructured<'a>, _mem_import_gen_proof: MemoryImportGenerationProof, _gen_ep_gen_proof: GearEntryPointGenerationProof, ) -> Self { @@ -128,7 +131,11 @@ impl<'a> SysCallsImportsGenerator<'a> { } /// Disable current generator. - pub fn disable(self) -> DisabledSysCallsImportsGenerator<'a> { + pub fn disable(self) -> DisabledSysCallsImportsGenerator<'a, 'b> { + log::trace!( + "Random data when disabling sys-calls imports generator - {}", + self.unstructured.len() + ); DisabledSysCallsImportsGenerator { unstructured: self.unstructured, call_indexes: self.call_indexes, @@ -145,25 +152,24 @@ impl<'a> SysCallsImportsGenerator<'a> { pub fn generate( mut self, ) -> Result<( - DisabledSysCallsImportsGenerator<'a>, + DisabledSysCallsImportsGenerator<'a, 'b>, SysCallsImportsGenerationProof, )> { + log::trace!("Generating sys-calls imports"); + let sys_calls_proof = self.generate_sys_calls_imports()?; self.generate_send_from_reservation(); - let disabled = DisabledSysCallsImportsGenerator { - unstructured: self.unstructured, - call_indexes: self.call_indexes, - module: self.module, - config: self.config, - sys_calls_imports: self.sys_calls_imports, - }; - - Ok((disabled, sys_calls_proof)) + Ok((self.disable(), sys_calls_proof)) } /// Generates sys-calls imports from config, used to instantiate the generator. pub fn generate_sys_calls_imports(&mut self) -> Result { + log::trace!( + "Random data before sys-calls imports - {}", + self.unstructured.len() + ); + for sys_call in SysCallName::instrumentable() { let sys_call_generation_data = self.generate_sys_call_import(sys_call)?; if let Some(sys_call_generation_data) = sys_call_generation_data { @@ -186,9 +192,14 @@ impl<'a> SysCallsImportsGenerator<'a> { ) -> Result> { let sys_call_amount_range = self.config.injection_amounts(sys_call); let sys_call_amount = self.unstructured.int_in_range(sys_call_amount_range)?; - Ok((sys_call_amount != 0).then(|| { let call_indexes_handle = self.insert_sys_call_import(sys_call); + log::trace!( + " -- Generated {} amount of {} sys-call", + sys_call_amount, + sys_call.to_str() + ); + (sys_call_amount, call_indexes_handle) })) } @@ -230,7 +241,7 @@ impl<'a> SysCallsImportsGenerator<'a> { } } -impl<'a> SysCallsImportsGenerator<'a> { +impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { /// Generates a function which calls "properly" the `gr_reservation_send`. fn generate_send_from_reservation(&mut self) { let (reserve_gas_idx, reservation_send_idx) = { @@ -245,7 +256,10 @@ impl<'a> SysCallsImportsGenerator<'a> { match maybe_reserve_gas.zip(maybe_reservation_send) { Some(indexes) => indexes, - None => return, + None => { + log::trace!("Wasm hasn't got either gr_reserve_gas, or gr_reservation_send, or both of them"); + return; + } } }; @@ -343,6 +357,8 @@ impl<'a> SysCallsImportsGenerator<'a> { (module_builder.build(), idx) }); + log::trace!("Built proper reservation send call"); + let call_indexes_handle = self.call_indexes.len(); self.call_indexes .add_func(send_from_reservation_func_idx.signature as usize); @@ -359,16 +375,16 @@ pub struct SysCallsImportsGenerationProof(()); /// /// Instance of this types signals that there was once active sys-calls generator, /// but it ended up it's work. -pub struct DisabledSysCallsImportsGenerator<'a> { - pub(super) unstructured: &'a mut Unstructured<'a>, +pub struct DisabledSysCallsImportsGenerator<'a, 'b> { + pub(super) unstructured: &'b mut Unstructured<'a>, pub(super) call_indexes: CallIndexes, pub(super) module: WasmModule, pub(super) config: SysCallsConfig, pub(super) sys_calls_imports: BTreeMap, } -impl<'a> From> for ModuleWithCallIndexes { - fn from(disabled_sys_call_gen: DisabledSysCallsImportsGenerator<'a>) -> Self { +impl<'a, 'b> From> for ModuleWithCallIndexes { + fn from(disabled_sys_call_gen: DisabledSysCallsImportsGenerator<'a, 'b>) -> Self { ModuleWithCallIndexes { module: disabled_sys_call_gen.module, call_indexes: disabled_sys_call_gen.call_indexes, diff --git a/utils/wasm-gen/src/generator/syscalls/invocator.rs b/utils/wasm-gen/src/generator/syscalls/invocator.rs index b24cc9563a4..5ecedf35f3c 100644 --- a/utils/wasm-gen/src/generator/syscalls/invocator.rs +++ b/utils/wasm-gen/src/generator/syscalls/invocator.rs @@ -91,8 +91,8 @@ pub(crate) fn process_sys_call_params( /// additional data injector was disabled, before injecting addresses from the config. As a result, /// invocator would set un-intended by config values as messages destination. To avoid such /// inconsistency the [`AddressesInjectionOutcome`] gives additional required guarantees. -pub struct SysCallsInvocator<'a> { - unstructured: &'a mut Unstructured<'a>, +pub struct SysCallsInvocator<'a, 'b> { + unstructured: &'b mut Unstructured<'a>, call_indexes: CallIndexes, module: WasmModule, config: SysCallsConfig, @@ -100,15 +100,15 @@ pub struct SysCallsInvocator<'a> { sys_call_imports: BTreeMap, } -impl<'a> +impl<'a, 'b> From<( - DisabledAdditionalDataInjector<'a>, + DisabledAdditionalDataInjector<'a, 'b>, AddressesInjectionOutcome, - )> for SysCallsInvocator<'a> + )> for SysCallsInvocator<'a, 'b> { fn from( (disabled_gen, outcome): ( - DisabledAdditionalDataInjector<'a>, + DisabledAdditionalDataInjector<'a, 'b>, AddressesInjectionOutcome, ), ) -> Self { @@ -123,20 +123,37 @@ impl<'a> } } -impl<'a> SysCallsInvocator<'a> { +impl<'a, 'b> SysCallsInvocator<'a, 'b> { /// Insert sys-calls invokes. /// /// The method builds instructions, which describe how each sys-call is called, and then /// insert these instructions into any random function. In the end, all call indexes are resolved. pub fn insert_invokes(mut self) -> Result { + log::trace!( + "Random data before inserting all sys-calls invocations - {}", + self.unstructured.len() + ); + for (invocable, (amount, call_indexes_handle)) in self.sys_call_imports.clone() { let instructions = self.build_sys_call_invoke_instructions(invocable, call_indexes_handle)?; + + log::trace!( + "Inserting the {} sys_call {} times", + invocable.to_str(), + amount + ); + for instructions in iter::repeat(&instructions).take(amount as usize) { self.insert_sys_call_instructions(instructions)?; } } + log::trace!( + "Random data after inserting all sys-calls invocations - {}", + self.unstructured.len() + ); + self.resolves_calls_indexes(); Ok(DisabledSysCallsInvocator { @@ -150,17 +167,33 @@ impl<'a> SysCallsInvocator<'a> { invocable: InvocableSysCall, call_indexes_handle: CallIndexesHandle, ) -> Result> { + log::trace!( + "Random data before building {} sys-call invoke instructions - {}", + invocable.to_str(), + self.unstructured.len() + ); + let signature = invocable.into_signature(); if self.is_not_send_sys_call(invocable) { + log::trace!( + " -- Generating build call for non-send sys-call {}", + invocable.to_str() + ); return self.build_call(&signature.params, &signature.results, call_indexes_handle); } + log::trace!( + " -- Generating build call for send sys-call {}", + invocable.to_str() + ); let mut call_without_destination_instrs = self.build_call( &signature.params[1..], &signature.results, call_indexes_handle, )?; let res = if self.config.sending_message_destination().is_source() { + log::trace!(" -- Message destination is result of `gr_source`"); + let gr_source_call_indexes_handle = self .sys_call_imports .get(&InvocableSysCall::Loose(SysCallName::Source)) @@ -198,11 +231,13 @@ impl<'a> SysCallsInvocator<'a> { .config .sending_message_destination() .is_existing_addresses()); + log::trace!(" -- Message destination is an existing program address"); offsets.next_offset() } None => { debug_assert!(self.config.sending_message_destination().is_random()); + log::trace!(" -- Message destination is a random address"); self.unstructured.arbitrary()? } @@ -235,6 +270,11 @@ impl<'a> SysCallsInvocator<'a> { results: &[ValueType], call_indexes_handle: CallIndexesHandle, ) -> Result> { + log::trace!( + " ---- Random data before SysCallsInvocator::build_call - {}", + self.unstructured.len() + ); + let results = results.iter().map(|_| Instruction::Drop); let mem_size_pages = self @@ -253,7 +293,11 @@ impl<'a> SysCallsInvocator<'a> { let pages_to_alloc = self .unstructured .int_in_range(0..=mem_size_pages.saturating_sub(1))?; - instructions.push(Instruction::I32Const(pages_to_alloc as i32)); + let instr = Instruction::I32Const(pages_to_alloc as i32); + + log::trace!(" ---- Allocate memory - {instr}"); + + instructions.push(instr); } ProcessedSysCallParams::Value { value_type, @@ -278,6 +322,8 @@ impl<'a> SysCallsInvocator<'a> { Instruction::I64Const(self.unstructured.arbitrary()?) }; + log::trace!(" ---- Pointer value - {instr}"); + instructions.push(instr); } ProcessedSysCallParams::MemoryArray => { @@ -286,15 +332,22 @@ impl<'a> SysCallsInvocator<'a> { let pointer_beyond = self.unstructured.int_in_range(0..=upper_limit)?; let offset = self.unstructured.int_in_range(0..=pointer_beyond)?; - instructions.push(Instruction::I32Const(offset as i32)); - instructions.push(Instruction::I32Const((pointer_beyond - offset) as i32)); + let first = Instruction::I32Const(offset as i32); + let second = Instruction::I32Const((pointer_beyond - offset) as i32); + log::trace!(" ---- Memory array {first}, {second}"); + + instructions.push(first); + instructions.push(second); } ProcessedSysCallParams::MemoryPtrValue => { // Subtract a bit more so entities from `gsys` fit. let upper_limit = mem_size.saturating_sub(100); let offset = self.unstructured.int_in_range(0..=upper_limit)?; - instructions.push(Instruction::I32Const(offset as i32)); + let instr = Instruction::I32Const(offset as i32); + log::trace!(" ---- Memory pointer value - {instr}"); + + instructions.push(instr); } } } @@ -302,19 +355,34 @@ impl<'a> SysCallsInvocator<'a> { instructions.push(Instruction::Call(call_indexes_handle as u32)); instructions.extend(results); + log::trace!( + " ---- Random data after SysCallsInvocator::build_call - {}", + self.unstructured.len() + ); + Ok(instructions) } fn insert_sys_call_instructions(&mut self, instructions: &[Instruction]) -> Result<()> { + log::trace!( + "Random data before inserting sys-call's invoke instructions - {}", + self.unstructured.len() + ); + let last_funcs_idx = self.module.count_code_funcs() - 1; - let insert_into_func_no = self.unstructured.int_in_range(0..=last_funcs_idx)?; + let mut insert_into_func_no = self.unstructured.int_in_range(0..=last_funcs_idx)?; // Do not insert into custom newly generated function, but only into pre-defined // internal functions. - if self.call_indexes.is_custom_func(insert_into_func_no) { - return Ok(()); + // + // This loop will definitely end, because there are only 4 custom functions (3 for gear entry points + // and one for precise reservation send) and minimal amount of internal functions is 15. + while self.call_indexes.is_custom_func(insert_into_func_no) { + insert_into_func_no = self.unstructured.int_in_range(0..=last_funcs_idx)?; } + log::trace!(" -- Inserting sys-call into function with idx {insert_into_func_no}"); + self.module.with(|mut module| { let code = module .code_section_mut() @@ -330,14 +398,22 @@ impl<'a> SysCallsInvocator<'a> { let last = if code.len() > 1 { code.len() - 2 } else { 0 }; let res = self.unstructured.int_in_range(0..=last).map(|pos| { + log::trace!(" -- Inserting into position {pos}"); code.splice(pos..pos, instructions.iter().cloned()); }); + log::trace!( + "Random data after inserting sys-call's invoke instructions - {}", + self.unstructured.len() + ); + (module, res) }) } fn resolves_calls_indexes(&mut self) { + log::trace!("Resolving calls indexes"); + let imports_num = self.module.count_import_funcs() as u32; self.module.with(|mut module| { @@ -354,7 +430,11 @@ impl<'a> SysCallsInvocator<'a> { .get(*call_indexes_handle as usize) .expect("getting by handle of existing call"); match index_ty { - FunctionIndex::Func(idx) => *call_indexes_handle = idx + imports_num, + FunctionIndex::Func(idx) => { + log::trace!(" -- Old function index - {idx}"); + *call_indexes_handle = idx + imports_num; + log::trace!(" -- New function index - {}", *call_indexes_handle); + } FunctionIndex::Import(idx) => *call_indexes_handle = idx, } } @@ -381,7 +461,12 @@ impl<'a> SysCallsInvocator<'a> { panic!("Export cannot be to the import function"); }; + log::trace!(" -- Old export function index - {idx}"); *export_call_indexes_handle = idx + imports_num; + log::trace!( + " -- New export function index - {}", + *export_call_indexes_handle + ); } (module, ()) diff --git a/utils/wasm-gen/src/lib.rs b/utils/wasm-gen/src/lib.rs index d72e58dc512..64bd9e4bfc3 100644 --- a/utils/wasm-gen/src/lib.rs +++ b/utils/wasm-gen/src/lib.rs @@ -36,6 +36,7 @@ mod utils; mod wasm; pub use config::*; +pub use gear_wasm_instrument::syscalls::SysCallName; pub use generator::*; pub use wasm::WasmModule; pub use wasm_gen_arbitrary::*; @@ -43,18 +44,25 @@ pub use wasm_gen_arbitrary::*; use gear_wasm_instrument::parity_wasm::{self, elements::Module}; /// Generate gear program as raw bytes. -pub fn generate_gear_program_code<'a>( - u: &'a mut Unstructured<'a>, +pub fn generate_gear_program_code( + u: &mut Unstructured<'_>, configs_bundle: impl ConfigsBundle, ) -> Result> { let module = generate_gear_program_module(u, configs_bundle)?; - Ok(parity_wasm::serialize(module).expect("unable to serialize pw module")) + let bytes = parity_wasm::serialize(module).expect("unable to serialize pw module"); + + log::trace!( + "{}", + wasmprinter::print_bytes(&bytes).expect("internal error: failed printing bytes") + ); + + Ok(bytes) } /// Generate gear program as [`parity_wasm::elements::Module`](https://docs.rs/parity-wasm/latest/parity_wasm/elements/struct.Module.html) -pub fn generate_gear_program_module<'a>( - u: &'a mut Unstructured<'a>, +pub fn generate_gear_program_module( + u: &mut Unstructured<'_>, configs_bundle: impl ConfigsBundle, ) -> Result { let (gear_wasm_generator_config, module_selectables_config) = configs_bundle.into_parts(); diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index a722388e69e..a7a048f11ef 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -16,11 +16,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::wasm::WASM_PAGE_SIZE; - use super::*; use arbitrary::Unstructured; -use gear_core::code::Code; +use gear_core::{code::Code, pages::WASM_PAGE_SIZE}; use gear_utils::NonEmpty; use gear_wasm_instrument::parity_wasm::{ self, @@ -144,7 +142,7 @@ fn injecting_addresses_works() { }; // No additional data, except for addresses. // First entry set to the 0 offset. - assert_eq!(*ptr, (stack_end_page * WASM_PAGE_SIZE) as i32); + assert_eq!(*ptr, (stack_end_page * WASM_PAGE_SIZE as u32) as i32); let second_addr_offset = entries .get(1) @@ -156,17 +154,17 @@ fn injecting_addresses_works() { }; // No additional data, except for addresses. // First entry set to the 0 offset. - assert_eq!(*ptr, size + (stack_end_page * WASM_PAGE_SIZE) as i32); + assert_eq!(*ptr, size + (stack_end_page * WASM_PAGE_SIZE as u32) as i32); } proptest! { #![proptest_config(ProptestConfig::with_cases(100))] #[test] // Test that valid config always generates a valid gear wasm. - fn test_valid_config(buf in prop::collection::vec(any::(), UNSTRUCTURED_SIZE)) { + fn test_standard_config(buf in prop::collection::vec(any::(), UNSTRUCTURED_SIZE)) { use gear_wasm_instrument::rules::CustomConstantCostRules; let mut u = Unstructured::new(&buf); - let configs_bundle: ValidGearWasmConfigsBundle = ValidGearWasmConfigsBundle { + let configs_bundle: StandardGearWasmConfigsBundle = StandardGearWasmConfigsBundle { log_info: Some("Some data".into()), entry_points_set: EntryPointsSet::InitHandleHandleReply, ..Default::default() @@ -184,7 +182,7 @@ proptest! { let mut u = Unstructured::new(&buf); let mut u2 = Unstructured::new(&buf); - let gear_config = ValidGearWasmConfigsBundle::<[u8; 32]>::default(); + let gear_config = StandardGearWasmConfigsBundle::<[u8; 32]>::default(); let first = generate_gear_program_code(&mut u, gear_config.clone()).expect("failed wasm generation"); let second = generate_gear_program_code(&mut u2, gear_config).expect("failed wasm generation"); diff --git a/utils/wasm-gen/src/wasm.rs b/utils/wasm-gen/src/wasm.rs index 2e058681033..231154ee16c 100644 --- a/utils/wasm-gen/src/wasm.rs +++ b/utils/wasm-gen/src/wasm.rs @@ -19,6 +19,7 @@ use crate::{config::WasmModuleConfig, EntryPointName}; use arbitrary::{Arbitrary, Result, Unstructured}; use core::mem; +use gear_core::pages::WASM_PAGE_SIZE; use gear_wasm_instrument::{ parity_wasm::{ self, @@ -166,19 +167,6 @@ impl WasmModule { } } -/// WASM page has size of 64KiBs (65_536 bytes) -pub(crate) const WASM_PAGE_SIZE: u32 = 0x10000; - -/// Struct for indexing WASM memory page. -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] -pub(crate) struct Page(u16); - -impl From for Page { - fn from(value: u16) -> Self { - Self(value) - } -} - /// New-type to represent WASM memory pages count. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub(crate) struct PageCount(u32); @@ -192,6 +180,6 @@ impl From for PageCount { impl PageCount { /// Calculate WASM memory size for this pages count. pub(crate) fn memory_size(&self) -> u32 { - self.0 * WASM_PAGE_SIZE + self.0 * WASM_PAGE_SIZE as u32 } } From c44e07d01290c1e03d2e7b1bd559f5ad7078ccf0 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Fri, 18 Aug 2023 10:45:48 +0300 Subject: [PATCH 053/165] feat(gstd): propagate stack allocations (#3007) --- examples/btree/src/lib.rs | 2 +- examples/fungible-token/io/src/lib.rs | 2 +- examples/fungible-token/src/contract.rs | 6 +- examples/stack-allocations/src/lib.rs | 7 +- gcore/src/lib.rs | 2 +- gstd/src/lib.rs | 2 + gstd/src/msg/encoded.rs | 91 +++++++------------------ gstd/src/prelude.rs | 2 +- gstd/src/prog/encoded.rs | 24 ++++--- gstd/src/prog/generator.rs | 26 ++++--- gstd/src/util.rs | 73 +++++++++++++++++++- 11 files changed, 137 insertions(+), 100 deletions(-) diff --git a/examples/btree/src/lib.rs b/examples/btree/src/lib.rs index 6a4510cc50d..c6da38cde85 100644 --- a/examples/btree/src/lib.rs +++ b/examples/btree/src/lib.rs @@ -58,7 +58,7 @@ mod wasm { #[no_mangle] extern "C" fn handle() { - let reply = msg::load_on_stack().map(process).unwrap_or_else(|e| { + let reply = msg::load().map(process).unwrap_or_else(|e| { debug!("Error processing request: {e:?}"); Reply::Error }); diff --git a/examples/fungible-token/io/src/lib.rs b/examples/fungible-token/io/src/lib.rs index db153a9f891..4f2a591b8da 100644 --- a/examples/fungible-token/io/src/lib.rs +++ b/examples/fungible-token/io/src/lib.rs @@ -20,7 +20,7 @@ use core::ops::Range; use gmeta::{In, InOut, Metadata}; -use gstd::{codec::MaxEncodedLen, prelude::*, ActorId}; +use gstd::{prelude::*, ActorId}; pub struct FungibleTokenMetadata; diff --git a/examples/fungible-token/src/contract.rs b/examples/fungible-token/src/contract.rs index 6980162b974..2248d87c045 100644 --- a/examples/fungible-token/src/contract.rs +++ b/examples/fungible-token/src/contract.rs @@ -110,7 +110,7 @@ impl FungibleToken { .entry(*to) .and_modify(|balance| *balance += amount) .or_insert(amount); - msg::reply_on_stack( + msg::reply( FTEvent::Transfer { from: *from, to: *to, @@ -201,7 +201,7 @@ fn reply(payload: impl Encode) -> GstdResult { #[no_mangle] extern "C" fn handle() { - let action: FTAction = msg::load_on_stack().expect("Could not load Action"); + let action: FTAction = msg::load().expect("Could not load Action"); let ft: &mut FungibleToken = unsafe { FUNGIBLE_TOKEN.get_or_insert(Default::default()) }; match action { FTAction::Mint(amount) => { @@ -229,7 +229,7 @@ extern "C" fn handle() { #[no_mangle] extern "C" fn init() { - let config: InitConfig = msg::load_on_stack().expect("Unable to decode InitConfig"); + let config: InitConfig = msg::load().expect("Unable to decode InitConfig"); let ft = FungibleToken { name: config.name, symbol: config.symbol, diff --git a/examples/stack-allocations/src/lib.rs b/examples/stack-allocations/src/lib.rs index 776e3b76da7..43440bf2ba4 100644 --- a/examples/stack-allocations/src/lib.rs +++ b/examples/stack-allocations/src/lib.rs @@ -79,8 +79,7 @@ mod wasm { .expect("Failed to read payload") }), Some(Action::Load) => { - let HandleData { data } = - msg::load_on_stack().expect("Failed to load handle config"); + let HandleData { data } = msg::load().expect("Failed to load handle config"); data.iter().fold(0, |acc, x| acc + *x as u32) } None => return 0, @@ -91,13 +90,13 @@ mod wasm { #[no_mangle] extern "C" fn handle() { let check_sum = do_actions(unsafe { STATE.actions.clone() }); - msg::reply_on_stack(ReplyData { check_sum }, 0).expect("Failed to reply"); + msg::reply(ReplyData { check_sum }, 0).expect("Failed to reply"); } #[no_mangle] extern "C" fn init() { unsafe { - STATE.actions = msg::load_on_stack().expect("Failed to load init config"); + STATE.actions = msg::load().expect("Failed to load init config"); } } } diff --git a/gcore/src/lib.rs b/gcore/src/lib.rs index 385e3851f0e..22e8392853b 100644 --- a/gcore/src/lib.rs +++ b/gcore/src/lib.rs @@ -67,7 +67,7 @@ pub mod errors; pub mod exec; pub mod msg; pub mod prog; -pub extern crate gear_stack_buffer as stack_buffer; +pub use gear_stack_buffer as stack_buffer; mod general; pub use general::*; diff --git a/gstd/src/lib.rs b/gstd/src/lib.rs index 91fe6f4010a..4f7424bbe28 100644 --- a/gstd/src/lib.rs +++ b/gstd/src/lib.rs @@ -131,6 +131,8 @@ #![cfg_attr(feature = "strict", deny(warnings))] #![doc(html_logo_url = "https://docs.gear.rs/logo.svg")] #![doc(test(attr(deny(warnings), allow(unused_variables, unused_assignments))))] +#![allow(incomplete_features)] +#![feature(specialization)] extern crate alloc; #[cfg(target_arch = "wasm32")] diff --git a/gstd/src/msg/encoded.rs b/gstd/src/msg/encoded.rs index 283663499e8..cf57e7d2a29 100644 --- a/gstd/src/msg/encoded.rs +++ b/gstd/src/msg/encoded.rs @@ -24,15 +24,12 @@ use crate::{ async_runtime::signals, errors::{Error, IntoResult, Result}, msg::{utils, CodecMessageFuture, MessageFuture}, - prelude::{ - convert::AsRef, - mem::{transmute, MaybeUninit}, - ops::RangeBounds, - }, + prelude::ops::RangeBounds, + util::with_optimized_encode, ActorId, MessageId, ReservationId, }; use gstd_codegen::wait_for_reply; -use scale_info::scale::{Decode, Encode, MaxEncodedLen, Output}; +use scale_info::scale::{Decode, Encode}; /// Get a payload of the message that is currently being processed. /// @@ -63,14 +60,6 @@ use scale_info::scale::{Decode, Encode, MaxEncodedLen, Output}; /// - [`load_bytes`](super::load_bytes) function returns a payload as a byte /// vector. pub fn load() -> Result { - D::decode(&mut super::load_bytes()?.as_ref()).map_err(Error::Decode) -} - -/// Same as [`load`](self::load), but reads current message payload to allocated -/// on stack buffer. Decoded object will be also on stack, but if it contains -/// any fields, with heap allocations inside (for example vec), then -/// this decoding may lead to heap allocations. -pub fn load_on_stack() -> Result { super::basic::with_read_on_stack(|read_result: Result<&mut [u8]>| -> Result { let mut buffer = read_result? as &[u8]; D::decode(&mut buffer).map_err(Error::Decode) @@ -125,49 +114,7 @@ pub fn load_on_stack() -> Result { /// functions allow forming a reply message in parts. /// - [`send`] function sends a new message to the program or user. pub fn reply(payload: E, value: u128) -> Result { - super::reply_bytes(payload.encode(), value) -} - -// TODO: use encoded_size and in reply also. But should also check, -// that does not lead to additional heap allocations and additional calculation -// #2880. -/// Same as [reply], but encodes payload to stack allocated buffer. -/// Buffer size for encoding is at least `E::max_encoded_len()`. -pub fn reply_on_stack(payload: E, value: u128) -> Result { - struct ExternalBufferOutput<'a> { - buffer: &'a mut [MaybeUninit], - offset: usize, - } - - impl<'a> Output for ExternalBufferOutput<'a> { - fn write(&mut self, bytes: &[u8]) { - const ERROR_LOG: &str = "Unexpected encoding behavior: too large input bytes size"; - let end_offset = self.offset.checked_add(bytes.len()).expect(ERROR_LOG); - if end_offset > self.buffer.len() { - panic!("{ERROR_LOG}"); - } - // SAFETY: same as - // `MaybeUninit::write_slice(&mut self.buffer[self.offset..end_offset], bytes)`. - // This code transmutes `bytes: &[T]` to `bytes: &[MaybeUninit]`. These types - // can be safely transmuted since they have the same layout. Then `bytes: - // &[MaybeUninit]` is written to uninitialized memory via `copy_from_slice`. - let this = &mut self.buffer[self.offset..end_offset]; - this.copy_from_slice(unsafe { transmute(bytes) }); - self.offset = end_offset; - } - } - - gcore::stack_buffer::with_byte_buffer(E::max_encoded_len(), |buffer| { - let mut output = ExternalBufferOutput { buffer, offset: 0 }; - payload.encode_to(&mut output); - let ExternalBufferOutput { buffer, offset } = output; - // SAFETY: same as `MaybeUninit::slice_assume_init_ref(&buffer[..offset])`. - // `ExternalBufferOutput` writes data to uninitialized memory. So we can take - // slice `&buffer[..offset]` and say that it was initialized earlier - // because the buffer from `0` to `offset` was initialized. - let payload = unsafe { &*(&buffer[..offset] as *const _ as *const [u8]) }; - super::reply_bytes(payload, value) - }) + with_optimized_encode(payload, |buffer| super::reply_bytes(buffer, value)) } /// Same as [`reply`], but it spends gas from a reservation instead of @@ -211,7 +158,9 @@ pub fn reply_from_reservation( payload: E, value: u128, ) -> Result { - super::reply_bytes_from_reservation(id, payload.encode(), value) + with_optimized_encode(payload, |buffer| { + super::reply_bytes_from_reservation(id, buffer, value) + }) } /// Same as [`reply`], but with an explicit gas limit. @@ -239,7 +188,9 @@ pub fn reply_from_reservation( /// } /// ``` pub fn reply_with_gas(payload: E, gas_limit: u64, value: u128) -> Result { - super::reply_bytes_with_gas(payload.encode(), gas_limit, value) + with_optimized_encode(payload, |buffer| { + super::reply_bytes_with_gas(buffer, gas_limit, value) + }) } /// Same as [`reply`] but uses the input buffer as a payload source. @@ -413,7 +364,7 @@ pub fn send_input_with_gas_delayed>( /// forming a message to send in parts. #[wait_for_reply] pub fn send(program: ActorId, payload: E, value: u128) -> Result { - super::send_bytes(program, payload.encode(), value) + with_optimized_encode(payload, |buffer| super::send_bytes(program, buffer, value)) } /// Same as [`send`], but sends the message after the `delay` expressed in block @@ -424,7 +375,9 @@ pub fn send_delayed( value: u128, delay: u32, ) -> Result { - super::send_bytes_delayed(program, payload.encode(), value, delay) + with_optimized_encode(payload, |buffer| { + super::send_bytes_delayed(program, buffer, value, delay) + }) } /// Same as [`send`], but with an explicit gas limit. @@ -435,7 +388,9 @@ pub fn send_with_gas( gas_limit: u64, value: u128, ) -> Result { - super::send_bytes_with_gas(program, payload.encode(), gas_limit, value) + with_optimized_encode(payload, |buffer| { + super::send_bytes_with_gas(program, buffer, gas_limit, value) + }) } /// Same as [`send_with_gas`], but sends the message after the `delay` expressed @@ -447,7 +402,9 @@ pub fn send_with_gas_delayed( value: u128, delay: u32, ) -> Result { - super::send_bytes_with_gas_delayed(program, payload.encode(), gas_limit, value, delay) + with_optimized_encode(payload, |buffer| { + super::send_bytes_with_gas_delayed(program, buffer, gas_limit, value, delay) + }) } /// Same as [`send`], but it spends gas from a reservation instead of borrowing @@ -503,7 +460,9 @@ pub fn send_from_reservation( payload: E, value: u128, ) -> Result { - super::send_bytes_from_reservation(id, program, payload.encode(), value) + with_optimized_encode(payload, |buffer| { + super::send_bytes_from_reservation(id, program, buffer, value) + }) } /// Same as [`send_from_reservation`], but sends the message after the `delay` @@ -515,5 +474,7 @@ pub fn send_delayed_from_reservation( value: u128, delay: u32, ) -> Result { - super::send_bytes_delayed_from_reservation(id, program, payload.encode(), value, delay) + with_optimized_encode(payload, |buffer| { + super::send_bytes_delayed_from_reservation(id, program, buffer, value, delay) + }) } diff --git a/gstd/src/prelude.rs b/gstd/src/prelude.rs index adc91acfed9..a5b3f536a25 100644 --- a/gstd/src/prelude.rs +++ b/gstd/src/prelude.rs @@ -36,7 +36,7 @@ pub use convert::{Into, TryInto}; pub use hashbrown::HashMap; pub use scale_info::{ self, - scale::{self as codec, Decode, Encode}, + scale::{self as codec, Decode, Encode, MaxEncodedLen}, TypeInfo, }; pub use string::{String, ToString}; diff --git a/gstd/src/prog/encoded.rs b/gstd/src/prog/encoded.rs index 0f85589c783..1511bc1ddd5 100644 --- a/gstd/src/prog/encoded.rs +++ b/gstd/src/prog/encoded.rs @@ -21,6 +21,7 @@ use crate::{ common::errors::Result, msg::{CodecCreateProgramFuture, CreateProgramFuture}, prelude::convert::AsRef, + util::with_optimized_encode, ActorId, CodeId, MessageId, }; use gstd_codegen::wait_create_program_for_reply; @@ -35,7 +36,9 @@ pub fn create_program( payload: E, value: u128, ) -> Result<(MessageId, ActorId)> { - super::create_program_bytes(code_id, salt, payload.encode(), value) + with_optimized_encode(payload, |buffer| { + super::create_program_bytes(code_id, salt, buffer, value) + }) } /// Same as [`create_program`], but creates a new program after the `delay` @@ -47,7 +50,9 @@ pub fn create_program_delayed( value: u128, delay: u32, ) -> Result<(MessageId, ActorId)> { - super::create_program_bytes_delayed(code_id, salt, payload.encode(), value, delay) + with_optimized_encode(payload, |buffer| { + super::create_program_bytes_delayed(code_id, salt, buffer, value, delay) + }) } /// Same as [`create_program`], but with an explicit gas limit. @@ -59,7 +64,9 @@ pub fn create_program_with_gas( gas_limit: u64, value: u128, ) -> Result<(MessageId, ActorId)> { - super::create_program_bytes_with_gas(code_id, salt, payload.encode(), gas_limit, value) + with_optimized_encode(payload, |buffer| { + super::create_program_bytes_with_gas(code_id, salt, buffer, gas_limit, value) + }) } /// Same as [`create_program_with_gas`], but creates a new program after the @@ -72,12 +79,7 @@ pub fn create_program_with_gas_delayed( value: u128, delay: u32, ) -> Result<(MessageId, ActorId)> { - super::create_program_bytes_with_gas_delayed( - code_id, - salt, - payload.encode(), - gas_limit, - value, - delay, - ) + with_optimized_encode(payload, |buffer| { + super::create_program_bytes_with_gas_delayed(code_id, salt, buffer, gas_limit, value, delay) + }) } diff --git a/gstd/src/prog/generator.rs b/gstd/src/prog/generator.rs index 70cd40eb940..8acfd231c89 100644 --- a/gstd/src/prog/generator.rs +++ b/gstd/src/prog/generator.rs @@ -23,7 +23,9 @@ use crate::{ common::errors::Result, msg::{CodecCreateProgramFuture, CreateProgramFuture}, prelude::convert::AsRef, - prog, ActorId, CodeId, MessageId, + prog, + util::with_optimized_encode, + ActorId, CodeId, MessageId, }; use gstd_codegen::wait_create_program_for_reply; use scale_info::scale::{alloc::vec::Vec, Decode, Encode}; @@ -150,7 +152,9 @@ impl ProgramGenerator { payload: E, value: u128, ) -> Result<(MessageId, ActorId)> { - Self::create_program_bytes(code_id, payload.encode(), value) + with_optimized_encode(payload, |buffer| { + Self::create_program_bytes(code_id, buffer, value) + }) } /// Same as [`create_program`](Self::create_program), but creates a new @@ -161,7 +165,9 @@ impl ProgramGenerator { value: u128, delay: u32, ) -> Result<(MessageId, ActorId)> { - Self::create_program_bytes_delayed(code_id, payload.encode(), value, delay) + with_optimized_encode(payload, |buffer| { + Self::create_program_bytes_delayed(code_id, buffer, value, delay) + }) } /// Same as [`create_program`](Self::create_program), but with an explicit @@ -173,7 +179,9 @@ impl ProgramGenerator { gas_limit: u64, value: u128, ) -> Result<(MessageId, ActorId)> { - Self::create_program_bytes_with_gas(code_id, payload.encode(), gas_limit, value) + with_optimized_encode(payload, |buffer| { + Self::create_program_bytes_with_gas(code_id, buffer, gas_limit, value) + }) } /// Same as [`create_program_with_gas`](Self::create_program_with_gas), but @@ -185,12 +193,8 @@ impl ProgramGenerator { value: u128, delay: u32, ) -> Result<(MessageId, ActorId)> { - Self::create_program_bytes_with_gas_delayed( - code_id, - payload.encode(), - gas_limit, - value, - delay, - ) + with_optimized_encode(payload, |buffer| { + Self::create_program_bytes_with_gas_delayed(code_id, buffer, gas_limit, value, delay) + }) } } diff --git a/gstd/src/util.rs b/gstd/src/util.rs index 996fef911e9..3beabfa9abc 100644 --- a/gstd/src/util.rs +++ b/gstd/src/util.rs @@ -19,9 +19,78 @@ //! Utility functions. pub use scale_info::MetaType; -use scale_info::{scale::Encode, PortableRegistry, Registry}; +use scale_info::{ + scale::{Encode, MaxEncodedLen, Output}, + PortableRegistry, Registry, +}; -use crate::prelude::{Box, String, Vec}; +use crate::prelude::{ + mem::{transmute, MaybeUninit}, + Box, String, Vec, +}; + +/// Items implementing [`MaybeMaxEncodedLen`] **might** have a statically known +/// maximum encoded size. +pub(crate) trait MaybeMaxEncodedLen: Encode { + /// If the data type implements [`MaxEncodedLen`], this method returns + /// `Some(::max_encoded_len())`. + /// + /// Otherwise, this method returns [`None`]. + fn maybe_max_encoded_len() -> Option; +} + +/// Default implementation for all types that implement [`Encode`], but not +/// [`MaxEncodedLen`]. +impl MaybeMaxEncodedLen for T { + default fn maybe_max_encoded_len() -> Option { + None + } +} + +/// Specialization for types that implement [`MaxEncodedLen`]. +impl MaybeMaxEncodedLen for T { + fn maybe_max_encoded_len() -> Option { + Some(T::max_encoded_len()) + } +} + +/// An auxiliary function that reduces gas consumption during payload encoding. +pub(crate) fn with_optimized_encode( + payload: E, + f: impl FnOnce(&[u8]) -> T, +) -> T { + struct ExternalBufferOutput<'a> { + buffer: &'a mut [MaybeUninit], + offset: usize, + } + + impl<'a> Output for ExternalBufferOutput<'a> { + fn write(&mut self, bytes: &[u8]) { + // SAFETY: same as + // `MaybeUninit::write_slice(&mut self.buffer[self.offset..end_offset], bytes)`. + // This code transmutes `bytes: &[T]` to `bytes: &[MaybeUninit]`. These types + // can be safely transmuted since they have the same layout. Then `bytes: + // &[MaybeUninit]` is written to uninitialized memory via `copy_from_slice`. + let end_offset = self.offset + bytes.len(); + let this = unsafe { self.buffer.get_unchecked_mut(self.offset..end_offset) }; + this.copy_from_slice(unsafe { transmute(bytes) }); + self.offset = end_offset; + } + } + + let size = E::maybe_max_encoded_len().unwrap_or_else(|| payload.encoded_size()); + gcore::stack_buffer::with_byte_buffer(size, |buffer| { + let mut output = ExternalBufferOutput { buffer, offset: 0 }; + payload.encode_to(&mut output); + let ExternalBufferOutput { buffer, offset } = output; + // SAFETY: same as `MaybeUninit::slice_assume_init_ref(&buffer[..offset])`. + // `ExternalBufferOutput` writes data to uninitialized memory. So we can take + // slice `&buffer[..offset]` and say that it was initialized earlier + // because the buffer from `0` to `offset` was initialized. + let payload = unsafe { &*(&buffer[..offset] as *const _ as *const [u8]) }; + f(payload) + }) +} /// Generate a registry from given meta types and encode it to hex. pub fn to_hex_registry(meta_types: Vec) -> String { From 2d7476d161d63c8849cadb04b101db75bea37f03 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Fri, 18 Aug 2023 13:14:16 +0400 Subject: [PATCH 054/165] chore(gcli): change the timeout ms from 10 to 1 in tests (#3090) --- gcli/tests/gear.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcli/tests/gear.rs b/gcli/tests/gear.rs index e1915f81e3f..a815d2d96d5 100644 --- a/gcli/tests/gear.rs +++ b/gcli/tests/gear.rs @@ -26,7 +26,7 @@ mod common; #[tokio::test] async fn api_timeout() { assert!(matches!( - Api::new_with_timeout(None, Some(10)).await.err(), + Api::new_with_timeout(None, Some(1)).await.err(), Some(Error::SubxtRpc(jsonrpsee::core::Error::Transport(..))) )); } From d558f44e7055cf5e42f1131f65968f8e59b1aa17 Mon Sep 17 00:00:00 2001 From: Gregory Sobol Date: Fri, 18 Aug 2023 13:58:48 +0400 Subject: [PATCH 055/165] fix UB in queue multiplier (#3080) --- pallets/payment/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pallets/payment/src/lib.rs b/pallets/payment/src/lib.rs index cfd2ca251de..ff957f585d0 100644 --- a/pallets/payment/src/lib.rs +++ b/pallets/payment/src/lib.rs @@ -217,7 +217,9 @@ where let len_step = S::get().max(1); // Avoiding division by 0. let queue_len: u128 = QueueOf::::len().saturated_into(); - let pow = queue_len.saturating_div(len_step); + // min(30) in order to not goes into negative multiplier or UB. + // 30 is the last not negative bit in i32. + let pow = queue_len.saturating_div(len_step).min(30); Multiplier::saturating_from_integer(1 << pow) } } From 1143197c2b67b9ee14897109695efba9178fcec7 Mon Sep 17 00:00:00 2001 From: Shamil <66209982+shamilsan@users.noreply.github.com> Date: Fri, 18 Aug 2023 16:19:51 +0400 Subject: [PATCH 056/165] chore: fix links in README (#3098) Co-authored-by: clearloop <26088946+clearloop@users.noreply.github.com> --- README.md | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index befdc85d910..7eb3610693e 100644 --- a/README.md +++ b/README.md @@ -41,20 +41,20 @@ Gear is a Substrate-based smart-contract platform allowing anyone to run dApp in 1. :open_hands: The easiest way to get started with Gear is to use a demo environment on [https://idea.gear-tech.io](https://idea.gear-tech.io). -2. :wrench: Follow the instructions from ["Getting started in 5 minutes"](https://wiki.gear-tech.io/getting-started-in-5-minutes) to compile the Rust test smart contract to WebAssembly. :running: Upload and run smart contract in Gear demo environment on [https://idea.gear-tech.io](https://idea.gear-tech.io), send a message to a program, check how it is going. +2. :wrench: Follow the instructions from ["Getting started in 5 minutes"](https://wiki.gear-tech.io/docs/getting-started-in-5-minutes/) to compile the Rust test smart contract to WebAssembly. :running: Upload and run smart contract in Gear demo environment on [https://idea.gear-tech.io](https://idea.gear-tech.io), send a message to a program, check how it is going. -3. :scroll: Write your own smart contract or take one from the [examples](https://github.com/gear-dapps). A comprehensive amount of smart contract examples are available for your convenience and faster onboarding. +3. :scroll: Write your own smart contract or take one from the [examples](https://github.com/gear-foundation). A comprehensive amount of smart contract examples are available for your convenience and faster onboarding. 4. :computer: Download and run your Gear node locally or create your own multi-node local testnet. -5. :dolphin: Deep dive to the [Smart Contracts section](https://wiki.gear-tech.io/developing-contracts/gear-program) of the Gear Wiki for more details about how to implement and run your dApp in Gear. +5. :dolphin: Deep dive to the [Smart Contracts section](https://wiki.gear-tech.io/docs/developing-contracts/introduction) of the Gear Wiki for more details about how to implement and run your dApp in Gear. ## Run Gear Node For Linux/MacOS users install script is available: ```bash - curl --proto '=https' --tlsv1.2 -sSf https://get.gear.rs/install.sh | sh + curl --proto '=https' --tlsv1.2 -sSf https://get.gear.rs/install.sh | sh ``` Gear node can run in a single Dev Net mode or you can create a Multi-Node local testnet or make your own build of Gear node. @@ -72,10 +72,10 @@ Gear node can run in a single Dev Net mode or you can create a Multi-Node local gear ``` -3. One may run a local node in development mode for testing purposes. This node will not be connected to any external network. Use `--dev` argument for running the node locally and `--tmp` for storing the state in temporary storage: +3. One may run a local node in development mode for testing purposes. This node will not be connected to any external network. Use `--dev` argument for running the node locally and storing the state in temporary storage: ```bash - gear --dev --tmp + gear --dev ``` 4. Get more info about usage details, flags, available options and subcommands: @@ -86,7 +86,7 @@ Gear node can run in a single Dev Net mode or you can create a Multi-Node local ## Implement and run your own blockchain application -1. Gear provides dApp [application templates](https://github.com/gear-dapps) that cover various use cases - DeFi, DAO, NFT and more. Write your own smart contract or take one from the available templates. Adapt a template in accordance to your business needs. +1. Gear provides dApp [application templates](https://github.com/gear-foundation) that cover various use cases - DeFi, DAO, NFT and more. Write your own smart contract or take one from the available templates. Adapt a template in accordance with your business needs. 2. Test your smart contract off-chain, test it on-chain using a local node, then upload to Gear network. @@ -101,9 +101,9 @@ Gear node can run in a single Dev Net mode or you can create a Multi-Node local * [gstd](https://github.com/gear-tech/gear/tree/master/gstd) - Standard library for Gear smart contracts. -* [gear-js](https://github.com/gear-tech/gear-js/tree/main/api) - jsonrpc API of Gear backend. +* [gear-js](https://github.com/gear-tech/gear-js/tree/main/api) - JSON-RPC API of Gear backend. -* [examples](https://github.com/gear-dapps) - Gear smart contract examples. +* [examples](https://github.com/gear-foundation) - Gear smart contract examples. Go to https://docs.gear.rs to dive into the documentation on Gear crates. @@ -124,7 +124,7 @@ Go to https://docs.gear.rs to dive into the documentation on Gear crates. ### :fire: Key features - - Programs run in WASM VM (near-native code execution speed) + - Programs run in Wasm VM (near-native code execution speed) - **Unique** :crown: : Parallelizable architecture (even greater speed) - **Unique** :crown: : Actor model for message-passing communications - secure, effective, clear - dApp in minutes using Gear libraries @@ -160,8 +160,7 @@ To resolve the interoperability issue, Parity technologies focused on creating a - Polkadot - a blockchain of blockchains. Provides a “relay chain” (the primary blockchain) that enables “parachains” (functional blockchains) to be deployed on top of it. All parachains are interconnected, creating a massive network of multifunctional blockchain services. - Substrate - a modular framework that allows to create custom-built blockchains with consensus mechanism, core functionality and security out of the box. -Building a blockchain with Substrate allows it to be deployed on any compatible relay chain such as Polkadot and Kusama -Substrate serves as a layer of communication between the relay chain and the parachain +Building a blockchain with Substrate allows it to be deployed on any compatible relay chain such as Polkadot and Kusama. Substrate serves as a layer of communication between the relay chain and the parachain. # How does it work? @@ -177,8 +176,8 @@ Performance charts can be seen here: https://gear-tech.github.io/performance-cha # Contribution -You can request a new feature by creating a new Issue or discuss it with us on [Discord](https://discord.gg/7BQznC9uD9). -Here are some features in-prog or planned: https://github.com/gear-tech/gear/issues +You can request a new feature by [creating a new issue](https://github.com/gear-tech/gear/issues/new/choose) or discuss it with us on [Discord](https://discord.gg/7BQznC9uD9). +Here are some features in progress or planned: https://github.com/gear-tech/gear/issues # License From 39f04c828d80f19e0e730673591f1ea381e3684b Mon Sep 17 00:00:00 2001 From: Gregory Sobol Date: Fri, 18 Aug 2023 16:24:30 +0400 Subject: [PATCH 057/165] feat!: append payload in `read_state` rpc call (#3059) --- Cargo.lock | 39 ++------ Cargo.toml | 8 +- examples/backend-error/Cargo.toml | 21 ----- examples/backend-error/build.rs | 21 ----- examples/btree/Cargo.toml | 24 ----- examples/capacitor/build.rs | 21 ----- examples/capacitor/src/lib.rs | 63 ------------- examples/{capacitor => custom}/Cargo.toml | 7 +- examples/{btree => custom}/build.rs | 2 +- .../lib.rs => custom/src/backend_error.rs} | 24 ++--- .../{btree/src/lib.rs => custom/src/btree.rs} | 76 ++++++++------- examples/custom/src/capacitor.rs | 57 ++++++++++++ examples/custom/src/lib.rs | 92 +++++++++++++++++++ examples/fungible-token/io/src/lib.rs | 6 +- examples/fungible-token/src/contract.rs | 74 +++------------ examples/gas-burned/src/lib.rs | 40 ++++---- examples/new-meta/io/src/lib.rs | 4 +- gcli/src/cmd/program.rs | 2 +- gcli/src/meta/mod.rs | 7 +- gcli/src/meta/tests.rs | 5 +- gcli/tests/cmd/program.rs | 5 +- gclient/Cargo.toml | 4 +- gclient/src/api/rpc.rs | 26 ++++-- gclient/tests/backend.rs | 5 +- gclient/tests/memory_dump.rs | 9 +- gclient/tests/state.rs | 68 +++++++++++++- gmeta/src/lib.rs | 16 ++-- gsdk/src/rpc.rs | 12 ++- gtest/Cargo.toml | 2 +- gtest/src/program.rs | 24 +++-- pallets/gear/Cargo.toml | 3 +- pallets/gear/rpc/runtime-api/src/lib.rs | 2 +- pallets/gear/rpc/src/lib.rs | 10 +- pallets/gear/src/lib.rs | 4 +- pallets/gear/src/runtime_api.rs | 9 +- pallets/gear/src/tests.rs | 83 ++++++++++++++--- runtime/common/src/apis.rs | 4 +- 37 files changed, 474 insertions(+), 405 deletions(-) delete mode 100644 examples/backend-error/Cargo.toml delete mode 100644 examples/backend-error/build.rs delete mode 100644 examples/btree/Cargo.toml delete mode 100644 examples/capacitor/build.rs delete mode 100644 examples/capacitor/src/lib.rs rename examples/{capacitor => custom}/Cargo.toml (69%) rename examples/{btree => custom}/build.rs (94%) rename examples/{backend-error/src/lib.rs => custom/src/backend_error.rs} (78%) rename examples/{btree/src/lib.rs => custom/src/btree.rs} (67%) create mode 100644 examples/custom/src/capacitor.rs create mode 100644 examples/custom/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 9241dbb219b..8f158d173e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1840,25 +1840,6 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "demo-backend-error" -version = "0.1.0" -dependencies = [ - "gear-wasm-builder", - "gstd", - "gsys", -] - -[[package]] -name = "demo-btree" -version = "0.1.0" -dependencies = [ - "gear-wasm-builder", - "gstd", - "gtest", - "parity-scale-codec", -] - [[package]] name = "demo-calc-hash" version = "0.1.0" @@ -1889,29 +1870,32 @@ dependencies = [ ] [[package]] -name = "demo-capacitor" +name = "demo-compose" version = "0.1.0" dependencies = [ "gear-wasm-builder", "gstd", + "hex", ] [[package]] -name = "demo-compose" +name = "demo-constructor" version = "0.1.0" dependencies = [ "gear-wasm-builder", "gstd", "hex", + "parity-scale-codec", ] [[package]] -name = "demo-constructor" +name = "demo-custom" version = "0.1.0" dependencies = [ "gear-wasm-builder", "gstd", - "hex", + "gsys", + "gtest", "parity-scale-codec", ] @@ -3629,12 +3613,10 @@ dependencies = [ "anyhow", "async-trait", "demo-async-tester", - "demo-backend-error", - "demo-btree", "demo-calc-hash", "demo-calc-hash-in-one-block", - "demo-capacitor", "demo-constructor", + "demo-custom", "demo-distributor", "demo-meta-io", "demo-mul-by-const", @@ -4686,7 +4668,7 @@ version = "0.1.0" dependencies = [ "anyhow", "colored", - "demo-capacitor", + "demo-custom", "demo-futures-unordered", "demo-piggy-bank", "demo-ping", @@ -7234,13 +7216,12 @@ dependencies = [ "demo-async-recursion", "demo-async-signal-entry", "demo-async-tester", - "demo-backend-error", - "demo-btree", "demo-calc-hash", "demo-calc-hash-in-one-block", "demo-calc-hash-over-blocks", "demo-compose", "demo-constructor", + "demo-custom", "demo-delayed-sender", "demo-distributor", "demo-futures-unordered", diff --git a/Cargo.toml b/Cargo.toml index ecbe1845d37..f28e605b553 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,10 +23,8 @@ members = [ "examples/async-init", "examples/async-signal-entry", "examples/async-tester", - "examples/backend-error", - "examples/btree", "examples/calc-hash", - "examples/capacitor", + "examples/custom", "examples/compose", "examples/constructor", "examples/delayed-sender", @@ -359,12 +357,10 @@ demo-async-init = { path = "examples/async-init" } demo-async-recursion = { path = "examples/async-recursion" } demo-async-signal-entry = { path = "examples/async-signal-entry" } demo-async-tester = { path = "examples/async-tester" } -demo-backend-error = { path = "examples/backend-error" } -demo-btree = { path = "examples/btree" } demo-calc-hash = { path = "examples/calc-hash" } demo-calc-hash-in-one-block = { path = "examples/calc-hash/in-one-block" } demo-calc-hash-over-blocks = { path = "examples/calc-hash/over-blocks" } -demo-capacitor = { path = "examples/capacitor" } +demo-custom = { path = "examples/custom" } demo-compose = { path = "examples/compose" } demo-constructor = { path = "examples/constructor" } demo-delayed-sender = { path = "examples/delayed-sender" } diff --git a/examples/backend-error/Cargo.toml b/examples/backend-error/Cargo.toml deleted file mode 100644 index 4b6a6de68a9..00000000000 --- a/examples/backend-error/Cargo.toml +++ /dev/null @@ -1,21 +0,0 @@ -[package] -name = "demo-backend-error" -version = "0.1.0" -authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" - -[dependencies] -gstd.workspace = true -gsys.workspace = true - -[build-dependencies] -gear-wasm-builder.workspace = true - -[lib] - -[features] -debug = ["gstd/debug"] -std = [] -default = ["std"] diff --git a/examples/backend-error/build.rs b/examples/backend-error/build.rs deleted file mode 100644 index a5a62b25b7b..00000000000 --- a/examples/backend-error/build.rs +++ /dev/null @@ -1,21 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -fn main() { - gear_wasm_builder::build(); -} diff --git a/examples/btree/Cargo.toml b/examples/btree/Cargo.toml deleted file mode 100644 index 4b566bb34d6..00000000000 --- a/examples/btree/Cargo.toml +++ /dev/null @@ -1,24 +0,0 @@ -[package] -name = "demo-btree" -version = "0.1.0" -authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" - -[dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } -gstd.workspace = true - -[build-dependencies] -gear-wasm-builder.workspace = true - -[dev-dependencies] -gtest.workspace = true - -[lib] - -[features] -debug = ["gstd/debug"] -std = ["parity-scale-codec/std"] -default = ["std"] diff --git a/examples/capacitor/build.rs b/examples/capacitor/build.rs deleted file mode 100644 index 4c502a3ddee..00000000000 --- a/examples/capacitor/build.rs +++ /dev/null @@ -1,21 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -fn main() { - gear_wasm_builder::build(); -} diff --git a/examples/capacitor/src/lib.rs b/examples/capacitor/src/lib.rs deleted file mode 100644 index e8a0fc84089..00000000000 --- a/examples/capacitor/src/lib.rs +++ /dev/null @@ -1,63 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#![no_std] - -#[cfg(feature = "std")] -mod code { - include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -} - -#[cfg(feature = "std")] -pub use code::WASM_BINARY_OPT as WASM_BINARY; - -#[cfg(not(feature = "std"))] -mod wasm { - use gstd::{debug, msg, prelude::*}; - - static mut CHARGE: u32 = 0; - static mut LIMIT: u32 = 0; - static mut DISCHARGE_HISTORY: Vec = Vec::new(); - - #[no_mangle] - extern "C" fn init() { - let initstr = String::from_utf8(msg::load_bytes().expect("Failed to load payload bytes")) - .expect("Invalid message: should be utf-8"); - let limit = u32::from_str(initstr.as_ref()).expect("Invalid number"); - unsafe { LIMIT = limit }; - debug!("Init capacitor with limit capacity {limit}, {initstr}"); - } - - #[no_mangle] - extern "C" fn handle() { - let new_msg = String::from_utf8(msg::load_bytes().expect("Failed to load payload bytes")) - .expect("Invalid message: should be utf-8"); - let to_add = u32::from_str(new_msg.as_ref()).expect("Invalid number"); - - unsafe { - CHARGE += to_add; - debug!("Charge capacitor with {to_add}, new charge {CHARGE}"); - if CHARGE >= LIMIT { - debug!("Discharge #{CHARGE} due to limit {LIMIT}"); - msg::send_bytes(msg::source(), format!("Discharged: {CHARGE}"), 0).unwrap(); - DISCHARGE_HISTORY.push(CHARGE); - CHARGE = 0; - } - } - } -} diff --git a/examples/capacitor/Cargo.toml b/examples/custom/Cargo.toml similarity index 69% rename from examples/capacitor/Cargo.toml rename to examples/custom/Cargo.toml index 02cb93866a1..164f8415084 100644 --- a/examples/capacitor/Cargo.toml +++ b/examples/custom/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "demo-capacitor" +name = "demo-custom" version = "0.1.0" authors.workspace = true edition.workspace = true @@ -8,6 +8,11 @@ workspace = "../../" [dependencies] gstd.workspace = true +gsys.workspace = true +parity-scale-codec.workspace = true + +[dev-dependencies] +gtest.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/btree/build.rs b/examples/custom/build.rs similarity index 94% rename from examples/btree/build.rs rename to examples/custom/build.rs index 4c502a3ddee..1a948b5bf66 100644 --- a/examples/btree/build.rs +++ b/examples/custom/build.rs @@ -1,6 +1,6 @@ // This file is part of Gear. -// Copyright (C) 2021-2023 Gear Technologies Inc. +// Copyright (C) 2023 Gear Technologies Inc. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify diff --git a/examples/backend-error/src/lib.rs b/examples/custom/src/backend_error.rs similarity index 78% rename from examples/backend-error/src/lib.rs rename to examples/custom/src/backend_error.rs index 3f06eb8249b..49ec8eebbda 100644 --- a/examples/backend-error/src/lib.rs +++ b/examples/custom/src/backend_error.rs @@ -1,6 +1,6 @@ // This file is part of Gear. -// Copyright (C) 2022-2023 Gear Technologies Inc. +// Copyright (C) 2023 Gear Technologies Inc. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -16,23 +16,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![cfg_attr(not(feature = "std"), no_std)] - -#[cfg(feature = "std")] -mod code { - include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -} - -#[cfg(feature = "std")] -pub use code::WASM_BINARY_OPT as WASM_BINARY; - #[cfg(not(feature = "std"))] -mod wasm { - extern crate gstd; +pub(crate) mod wasm { use gsys::{ErrorWithHash, HashWithValue}; - #[no_mangle] - extern "C" fn init() { + pub(crate) struct State; + + pub(crate) fn init() -> State { // Code below is copied and simplified from `gcore::msg::send`. let pid_value = HashWithValue { hash: [0; 32], @@ -52,6 +42,8 @@ mod wasm { ) }; - assert!(res.error_code != 0) + assert!(res.error_code != 0); + + State } } diff --git a/examples/btree/src/lib.rs b/examples/custom/src/btree.rs similarity index 67% rename from examples/btree/src/lib.rs rename to examples/custom/src/btree.rs index c6da38cde85..9451e0c5fb2 100644 --- a/examples/btree/src/lib.rs +++ b/examples/custom/src/btree.rs @@ -1,6 +1,6 @@ // This file is part of Gear. -// Copyright (C) 2021-2023 Gear Technologies Inc. +// Copyright (C) 2023 Gear Technologies Inc. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -16,20 +16,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![no_std] +use crate::{Decode, Encode}; -#[cfg(feature = "std")] -mod code { - include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); -} - -#[cfg(feature = "std")] -pub use code::WASM_BINARY_OPT as WASM_BINARY; - -extern crate alloc; - -use gstd::prelude::*; -use parity_scale_codec::{Decode, Encode}; +use alloc::vec::Vec; #[derive(Encode, Debug, Decode, PartialEq, Eq)] pub enum Request { @@ -47,47 +36,55 @@ pub enum Reply { List(Vec<(u32, u32)>), } +#[derive(Debug, Encode, Decode)] +pub enum StateRequest { + Full, + ForKey(u32), +} + #[cfg(not(feature = "std"))] -mod wasm { +pub(crate) mod wasm { use super::*; + use gstd::{debug, msg, prelude::*, BTreeMap}; - use alloc::collections::BTreeMap; - use gstd::{debug, msg}; + pub(crate) type State = BTreeMap; - static mut STATE: Option> = None; + pub(crate) fn init() -> State { + msg::reply((), 0).unwrap(); + BTreeMap::new() + } - #[no_mangle] - extern "C" fn handle() { - let reply = msg::load().map(process).unwrap_or_else(|e| { - debug!("Error processing request: {e:?}"); - Reply::Error - }); + pub(crate) fn handle(state: &mut State) { + let reply = msg::load() + .map(|request| process(state, request)) + .unwrap_or_else(|e| { + debug!("Error processing request: {e:?}"); + Reply::Error + }); msg::reply(reply, 0).unwrap(); } - fn state() -> &'static mut BTreeMap { - unsafe { STATE.as_mut().unwrap() } + pub(crate) fn state(state: State) { + let request: StateRequest = msg::load().unwrap(); + match request { + StateRequest::Full => msg::reply(state, 0).unwrap(), + StateRequest::ForKey(key) => msg::reply(state.get(&key), 0).unwrap(), + }; } - fn process(request: Request) -> Reply { + fn process(state: &mut State, request: Request) -> Reply { use Request::*; match request { - Insert(key, value) => Reply::Value(state().insert(key, value)), - Remove(key) => Reply::Value(state().remove(&key)), - List => Reply::List(state().iter().map(|(k, v)| (*k, *v)).collect()), + Insert(key, value) => Reply::Value(state.insert(key, value)), + Remove(key) => Reply::Value(state.remove(&key)), + List => Reply::List(state.iter().map(|(k, v)| (*k, *v)).collect()), Clear => { - state().clear(); + state.clear(); Reply::None } } } - - #[no_mangle] - extern "C" fn init() { - unsafe { STATE = Some(BTreeMap::new()) }; - msg::reply((), 0).unwrap(); - } } #[cfg(test)] @@ -95,6 +92,7 @@ mod tests { extern crate std; use super::{Reply, Request}; + use crate::InitMessage; use alloc::vec; use gtest::{Log, Program, System}; @@ -107,7 +105,7 @@ mod tests { let from = 42; - let res = program.send_bytes(from, b"init"); + let res = program.send(from, InitMessage::BTree); let log = Log::builder().source(program.id()).dest(from); assert!(res.contains(&log)); } @@ -121,7 +119,7 @@ mod tests { let from = 42; - let _res = program.send_bytes(from, b"init"); + let _res = program.send(from, InitMessage::BTree); IntoIterator::into_iter([ Request::Insert(0, 1), diff --git a/examples/custom/src/capacitor.rs b/examples/custom/src/capacitor.rs new file mode 100644 index 00000000000..79d4b869ebb --- /dev/null +++ b/examples/custom/src/capacitor.rs @@ -0,0 +1,57 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#[cfg(not(feature = "std"))] +pub(crate) mod wasm { + use gstd::{debug, msg, prelude::*, String, Vec}; + + #[derive(Default)] + pub(crate) struct State { + charge: u32, + limit: u32, + discharge_history: Vec, + } + + pub(crate) fn init(payload: String) -> State { + let limit = u32::from_str(payload.as_ref()).expect("Invalid number"); + debug!("Init capacitor with limit capacity {limit}, {payload}"); + State { + charge: 0, + limit, + discharge_history: Vec::new(), + } + } + + pub(crate) fn handle(state: &mut State) { + let new_msg = String::from_utf8(msg::load_bytes().expect("Failed to load payload bytes")) + .expect("Invalid message: should be utf-8"); + let to_add = u32::from_str(new_msg.as_ref()).expect("Invalid number"); + + state.charge += to_add; + debug!( + "Charge capacitor with {to_add}, new charge {}", + state.charge + ); + if state.charge >= state.limit { + debug!("Discharge #{} due to limit {}", state.charge, state.limit); + msg::send_bytes(msg::source(), format!("Discharged: {}", state.charge), 0).unwrap(); + state.discharge_history.push(state.charge); + state.charge = 0; + } + } +} diff --git a/examples/custom/src/lib.rs b/examples/custom/src/lib.rs new file mode 100644 index 00000000000..39db57ca2d1 --- /dev/null +++ b/examples/custom/src/lib.rs @@ -0,0 +1,92 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// TODO: #3058. Move here demo-vec, demo-ping, demo-distributor, demo-piggy-bank and others. +// Also need to make implementation with dyn instead of using matches. + +#![no_std] + +extern crate alloc; + +pub mod backend_error; +pub mod btree; +pub mod capacitor; + +use alloc::string::String; +use parity_scale_codec::{Decode, Encode}; + +#[cfg(feature = "std")] +mod code { + include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +} + +#[cfg(feature = "std")] +pub use code::WASM_BINARY_OPT as WASM_BINARY; + +#[derive(Decode, Encode)] +pub enum InitMessage { + Capacitor(String), + BTree, + BackendError, +} + +#[cfg(not(feature = "std"))] +mod wasm { + use super::{ + backend_error::wasm as backend_error, btree::wasm as btree, capacitor::wasm as capacitor, + InitMessage, + }; + use gstd::msg; + + enum State { + Capacitor(capacitor::State), + BTree(btree::State), + BackendError(backend_error::State), + } + + static mut STATE: Option = None; + + #[no_mangle] + extern "C" fn init() { + let init_message: InitMessage = msg::load().expect("Failed to load payload bytes"); + let state = match init_message { + InitMessage::Capacitor(payload) => State::Capacitor(capacitor::init(payload)), + InitMessage::BTree => State::BTree(btree::init()), + InitMessage::BackendError => State::BackendError(backend_error::init()), + }; + unsafe { STATE = Some(state) }; + } + + #[no_mangle] + extern "C" fn handle() { + let state = unsafe { STATE.as_mut().expect("State must be set in handle") }; + match state { + State::Capacitor(state) => capacitor::handle(state), + State::BTree(state) => btree::handle(state), + _ => {} + } + } + + #[no_mangle] + extern "C" fn state() { + let state = unsafe { STATE.take().expect("State must be set in handle") }; + if let State::BTree(state) = state { + btree::state(state); + } + } +} diff --git a/examples/fungible-token/io/src/lib.rs b/examples/fungible-token/io/src/lib.rs index 4f2a591b8da..c5af655dc9f 100644 --- a/examples/fungible-token/io/src/lib.rs +++ b/examples/fungible-token/io/src/lib.rs @@ -19,8 +19,8 @@ #![no_std] use core::ops::Range; -use gmeta::{In, InOut, Metadata}; -use gstd::{prelude::*, ActorId}; +use gmeta::{In, InOut, Metadata, Out}; +use gstd::{codec::MaxEncodedLen, prelude::*, ActorId}; pub struct FungibleTokenMetadata; @@ -30,7 +30,7 @@ impl Metadata for FungibleTokenMetadata { type Others = (); type Reply = (); type Signal = (); - type State = IoFungibleToken; + type State = Out; } #[derive(Debug, Decode, Encode, TypeInfo)] diff --git a/examples/fungible-token/src/contract.rs b/examples/fungible-token/src/contract.rs index 2248d87c045..9840581aeab 100644 --- a/examples/fungible-token/src/contract.rs +++ b/examples/fungible-token/src/contract.rs @@ -18,8 +18,7 @@ use core::ops::Range; use ft_io::*; -use gmeta::Metadata; -use gstd::{debug, errors::Result as GstdResult, msg, prelude::*, ActorId, MessageId}; +use gstd::{msg, prelude::*, ActorId}; use hashbrown::HashMap; const ZERO_ID: ActorId = ActorId::new([0u8; 32]); @@ -159,8 +158,9 @@ impl FungibleToken { } } -fn common_state() -> ::State { - let state = static_mut_state(); +#[no_mangle] +extern "C" fn state() { + let state = unsafe { FUNGIBLE_TOKEN.take().expect("State is not initialized") }; let FungibleToken { name, symbol, @@ -168,35 +168,24 @@ fn common_state() -> ::State { balances, allowances, decimals, - } = state.clone(); + } = state; - let balances = balances.iter().map(|(k, v)| (*k, *v)).collect(); + let balances = balances.into_iter().map(|(k, v)| (k, v)).collect(); let allowances = allowances - .iter() - .map(|(id, allowance)| (*id, allowance.iter().map(|(k, v)| (*k, *v)).collect())) + .into_iter() + .map(|(id, allowance)| (id, allowance.into_iter().map(|(k, v)| (k, v)).collect())) .collect(); - IoFungibleToken { + let payload = IoFungibleToken { name, symbol, total_supply, balances, allowances, decimals, - } -} - -fn static_mut_state() -> &'static mut FungibleToken { - unsafe { FUNGIBLE_TOKEN.get_or_insert(Default::default()) } -} - -#[no_mangle] -extern "C" fn state() { - reply(common_state()) - .expect("Failed to encode or reply with `::State` from `state()`"); -} + }; -fn reply(payload: impl Encode) -> GstdResult { msg::reply(payload, 0) + .expect("Failed to encode or reply with `::State` from `state()`"); } #[no_mangle] @@ -239,44 +228,3 @@ extern "C" fn init() { }; unsafe { FUNGIBLE_TOKEN = Some(ft) }; } - -#[no_mangle] -extern "C" fn meta_state() -> *mut [i32; 2] { - let query: State = msg::load().expect("failed to decode input argument"); - let ft: &mut FungibleToken = unsafe { FUNGIBLE_TOKEN.get_or_insert(Default::default()) }; - debug!("{query:?}"); - let encoded = match query { - State::Name => StateReply::Name(ft.name.clone()), - State::Symbol => StateReply::Name(ft.symbol.clone()), - State::Decimals => StateReply::Decimals(ft.decimals), - State::TotalSupply => StateReply::TotalSupply(ft.total_supply), - State::BalanceOf(account) => { - let balance = ft.balances.get(&account).unwrap_or(&0); - StateReply::Balance(*balance) - } - } - .encode(); - gstd::util::to_leak_ptr(encoded) -} - -#[derive(Debug, Encode, Decode, TypeInfo)] -#[codec(crate = gstd::codec)] -#[scale_info(crate = gstd::scale_info)] -pub enum State { - Name, - Symbol, - Decimals, - TotalSupply, - BalanceOf(ActorId), -} - -#[derive(Debug, Encode, Decode, TypeInfo)] -#[codec(crate = gstd::codec)] -#[scale_info(crate = gstd::scale_info)] -pub enum StateReply { - Name(String), - Symbol(String), - Decimals(u8), - TotalSupply(u128), - Balance(u128), -} diff --git a/examples/gas-burned/src/lib.rs b/examples/gas-burned/src/lib.rs index 85d8460285c..85514ae9dbb 100644 --- a/examples/gas-burned/src/lib.rs +++ b/examples/gas-burned/src/lib.rs @@ -8,28 +8,28 @@ mod code { #[cfg(feature = "std")] pub use code::WASM_BINARY_OPT as WASM_BINARY; -extern crate alloc; - -use alloc::vec; -use gstd::{msg, prelude::*}; - -const SHORT: usize = 100; -const LONG: usize = 10000; - -#[no_mangle] -extern "C" fn init() { - let mut v = vec![0; SHORT]; - for (i, item) in v.iter_mut().enumerate() { - *item = i * i; +#[cfg(not(feature = "std"))] +mod wasm { + use gstd::{msg, prelude::*}; + + const SHORT: usize = 100; + const LONG: usize = 10000; + + #[no_mangle] + extern "C" fn init() { + let mut v = vec![0; SHORT]; + for (i, item) in v.iter_mut().enumerate() { + *item = i * i; + } + msg::reply_bytes(format!("init: {}", v.into_iter().sum::()), 0).unwrap(); } - msg::reply_bytes(format!("init: {}", v.into_iter().sum::()), 0).unwrap(); -} -#[no_mangle] -extern "C" fn handle() { - let mut v = vec![0; LONG]; - for (i, item) in v.iter_mut().enumerate() { - *item = i * i; + #[no_mangle] + extern "C" fn handle() { + let mut v = vec![0; LONG]; + for (i, item) in v.iter_mut().enumerate() { + *item = i * i; + } } } diff --git a/examples/new-meta/io/src/lib.rs b/examples/new-meta/io/src/lib.rs index fb1f7edae77..75072030ebb 100644 --- a/examples/new-meta/io/src/lib.rs +++ b/examples/new-meta/io/src/lib.rs @@ -3,7 +3,7 @@ extern crate alloc; use alloc::{string::String, vec, vec::Vec}; -use gmeta::{InOut, Metadata}; +use gmeta::{InOut, Metadata, Out}; use parity_scale_codec::{Decode, Encode}; use scale_info::TypeInfo; @@ -15,7 +15,7 @@ impl Metadata for ProgramMetadata { type Others = InOut>; type Reply = String; type Signal = (); - type State = Vec; + type State = Out>; } // Metatypes for input and output diff --git a/gcli/src/cmd/program.rs b/gcli/src/cmd/program.rs index 8b4e2797044..43cce66265f 100644 --- a/gcli/src/cmd/program.rs +++ b/gcli/src/cmd/program.rs @@ -100,7 +100,7 @@ impl Program { } async fn full_state(api: Api, pid: H256, at: Option) -> Result<()> { - let state = api.read_state(pid, at).await?; + let state = api.read_state(pid, Default::default(), at).await?; println!("{}", state); Ok(()) } diff --git a/gcli/src/meta/mod.rs b/gcli/src/meta/mod.rs index f2d2db1bd39..0c964c8191d 100644 --- a/gcli/src/meta/mod.rs +++ b/gcli/src/meta/mod.rs @@ -80,11 +80,8 @@ impl Meta { display.field("init", &Io::new(&meta.init, ®istry)); display.field("handle", &Io::new(&meta.handle, ®istry)); display.field("others", &Io::new(&meta.others, ®istry)); - let single_types = [ - ("reply", meta.reply), - ("signal", meta.signal), - ("state", meta.state), - ]; + display.field("state", &Io::new(&meta.state, ®istry)); + let single_types = [("reply", meta.reply), ("signal", meta.signal)]; for (name, ty) in single_types { if let Some(id) = ty { display.field(name, ®istry.derive_id(id).map_err(|_| fmt::Error)?); diff --git a/gcli/src/meta/tests.rs b/gcli/src/meta/tests.rs index 3bd06976a25..51373147ae8 100644 --- a/gcli/src/meta/tests.rs +++ b/gcli/src/meta/tests.rs @@ -45,9 +45,12 @@ Metadata { }, output: Option, }, + state: { + input: "()", + output: [Wallet { id: "Id", person: "Person" }], + }, reply: str, signal: "()", - state: [Wallet { id: "Id", person: "Person" }], } "#; diff --git a/gcli/tests/cmd/program.rs b/gcli/tests/cmd/program.rs index 7464aa13153..46c83bbfb22 100644 --- a/gcli/tests/cmd/program.rs +++ b/gcli/tests/cmd/program.rs @@ -86,9 +86,12 @@ Metadata { }, output: Option, }, + state: { + input: (), + output: [Wallet { id: Id, person: Person }], + }, reply: str, signal: (), - state: [Wallet { id: Id, person: Person }], } "#; diff --git a/gclient/Cargo.toml b/gclient/Cargo.toml index 3c0829285d7..3ee7de0f6ec 100644 --- a/gclient/Cargo.toml +++ b/gclient/Cargo.toml @@ -35,11 +35,9 @@ env_logger.workspace = true hex-literal.workspace = true log.workspace = true demo-async-tester.workspace = true -demo-backend-error.workspace = true -demo-btree.workspace = true demo-calc-hash.workspace = true demo-calc-hash-in-one-block.workspace = true -demo-capacitor.workspace = true +demo-custom.workspace = true demo-constructor.workspace = true demo-distributor.workspace = true demo-meta-io.workspace = true diff --git a/gclient/src/api/rpc.rs b/gclient/src/api/rpc.rs index 5f0e67ec612..13d435a968f 100644 --- a/gclient/src/api/rpc.rs +++ b/gclient/src/api/rpc.rs @@ -209,8 +209,12 @@ impl GearApi { } /// Read the program's state as a byte vector. - pub async fn read_state_bytes(&self, program_id: ProgramId) -> Result> { - self.read_state_bytes_at(program_id, None).await + pub async fn read_state_bytes( + &self, + program_id: ProgramId, + payload: Vec, + ) -> Result> { + self.read_state_bytes_at(program_id, payload, None).await } /// Same as [`read_state_bytes`](Self::read_state_bytes), but reads the @@ -218,15 +222,24 @@ impl GearApi { pub async fn read_state_bytes_at( &self, program_id: ProgramId, + payload: Vec, at: Option, ) -> Result> { - let response: String = self.0.api().read_state(H256(program_id.into()), at).await?; + let response: String = self + .0 + .api() + .read_state(H256(program_id.into()), payload, at) + .await?; crate::utils::hex_to_vec(response).map_err(Into::into) } /// Read the program's state as decoded data. - pub async fn read_state(&self, program_id: ProgramId) -> Result { - self.read_state_at(program_id, None).await + pub async fn read_state( + &self, + program_id: ProgramId, + payload: Vec, + ) -> Result { + self.read_state_at(program_id, payload, None).await } /// Same as [`read_state`](Self::read_state), but reads the program's state @@ -234,9 +247,10 @@ impl GearApi { pub async fn read_state_at( &self, program_id: ProgramId, + payload: Vec, at: Option, ) -> Result { - let bytes = self.read_state_bytes_at(program_id, at).await?; + let bytes = self.read_state_bytes_at(program_id, payload, at).await?; D::decode(&mut bytes.as_ref()).map_err(Into::into) } diff --git a/gclient/tests/backend.rs b/gclient/tests/backend.rs index c928eb4582a..aacbf7e6ca6 100644 --- a/gclient/tests/backend.rs +++ b/gclient/tests/backend.rs @@ -18,8 +18,9 @@ //! Test for infinity loop, that it can't exceed block production time. -use demo_backend_error::WASM_BINARY; +use demo_custom::{InitMessage, WASM_BINARY}; use gclient::{EventProcessor, GearApi}; +use parity_scale_codec::Encode; #[tokio::test] async fn backend_errors_handled_by_sandbox() -> anyhow::Result<()> { @@ -39,7 +40,7 @@ async fn backend_errors_handled_by_sandbox() -> anyhow::Result<()> { .upload_program_bytes( WASM_BINARY, gclient::now_micros().to_le_bytes(), - [], + InitMessage::BackendError.encode(), gas_limit, 0, ) diff --git a/gclient/tests/memory_dump.rs b/gclient/tests/memory_dump.rs index 1c71b2a54b4..173fe1426a7 100644 --- a/gclient/tests/memory_dump.rs +++ b/gclient/tests/memory_dump.rs @@ -16,9 +16,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use demo_capacitor::WASM_BINARY; +use demo_custom::{InitMessage, WASM_BINARY}; use gclient::{EventListener, EventProcessor, GearApi, Result}; use gear_core::ids::ProgramId; +use parity_scale_codec::Encode; async fn charge_10( api: &GearApi, @@ -70,7 +71,7 @@ async fn memory_dump() -> Result<()> { // Check that blocks are still running assert!(listener.blocks_running().await?); // Calculate gas amount needed for initialization - let payload = b"15".to_vec(); + let payload = InitMessage::Capacitor("15".to_string()).encode(); let gas_info = api .calculate_upload_gas(None, WASM_BINARY.to_vec(), payload.clone(), 0, true) .await?; @@ -95,7 +96,7 @@ async fn memory_dump() -> Result<()> { path: "./296c6962726".to_string(), }; - api.save_program_memory_dump_at(program_id, None, "./296c6962726/demo_capacitor.dump") + api.save_program_memory_dump_at(program_id, None, "./296c6962726/demo_custom.dump") .await .unwrap(); @@ -104,7 +105,7 @@ async fn memory_dump() -> Result<()> { "Discharged: 20" ); - api.replace_program_memory(program_id, "./296c6962726/demo_capacitor.dump") + api.replace_program_memory(program_id, "./296c6962726/demo_custom.dump") .await .unwrap(); diff --git a/gclient/tests/state.rs b/gclient/tests/state.rs index eed29c931f7..dd996ef58dd 100644 --- a/gclient/tests/state.rs +++ b/gclient/tests/state.rs @@ -19,7 +19,7 @@ use demo_meta_io::Wallet; use gclient::{EventProcessor, GearApi}; use gmeta::MetadataRepr; -use parity_scale_codec::Decode; +use parity_scale_codec::{Decode, Encode}; #[tokio::test] async fn get_state() -> anyhow::Result<()> { @@ -59,7 +59,7 @@ async fn get_state() -> anyhow::Result<()> { assert_eq!(actual_metahash, expected_metahash); // Read state bytes - let state = api.read_state_bytes(program_id).await?; + let state = api.read_state_bytes(program_id, Default::default()).await?; let wallets = Vec::::decode(&mut state.as_ref()).expect("Unable to decode"); assert_eq!(wallets.len(), 2); @@ -80,3 +80,67 @@ async fn get_state() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test] +async fn get_state_request() -> anyhow::Result<()> { + use demo_custom::{btree, InitMessage, WASM_BINARY}; + + let gas_limit = 100_000_000_000; + + let api = GearApi::dev_from_path("../target/release/gear").await?; + + // Or use this comment to run test on custom node + // let api = GearApi::dev().await?.with("//Alice")?; + + // Subscribe to events + let mut listener = api.subscribe().await?; + + // Check that blocks are still running + assert!(listener.blocks_running().await?); + + // Upload btree program and wait initialization is done + let (message_id, program_id, _hash) = api + .upload_program_bytes( + WASM_BINARY, + gclient::now_micros().to_le_bytes(), + InitMessage::BTree.encode(), + gas_limit, + 0, + ) + .await?; + assert!(listener.message_processed(message_id).await?.succeed()); + + let data = [(0u32, 1u32), (1, 2), (3, 4)]; + let batch = data.map(|(key, value)| { + ( + program_id, + btree::Request::Insert(key, value).encode(), + gas_limit, + 0, + ) + }); + + // Store some data in btree and wait the results + let message_ids = api + .send_message_bytes_batch(batch) + .await + .unwrap() + .0 + .into_iter() + .map(|res| res.unwrap().0); + listener + .message_processed_batch(message_ids.into_iter()) + .await? + .into_iter() + .for_each(|(_, status)| assert!(status.succeed())); + + // Check state can be read by one key + for (key, value) in data { + let res: Option = api + .read_state(program_id, btree::StateRequest::ForKey(key).encode()) + .await?; + assert_eq!(res, Some(value)); + } + + Ok(()) +} diff --git a/gmeta/src/lib.rs b/gmeta/src/lib.rs index a368a851722..d90a08a4256 100644 --- a/gmeta/src/lib.rs +++ b/gmeta/src/lib.rs @@ -54,7 +54,7 @@ //! //! ``` //! #[no_std] -//! use gmeta::{InOut, Metadata}; +//! use gmeta::{InOut, Metadata, Out}; //! use gstd::prelude::*; //! //! // Message type for `handle()` function. @@ -82,7 +82,7 @@ //! // The unit tuple is used as we don't process any signals in this contract. //! type Signal = (); //! // We return a counter value (`i32`) in the `state()` function in this contract. -//! type State = i32; +//! type State = Out; //! } //! ``` //! @@ -149,7 +149,7 @@ //! using `build.rs`: //! //! ``` -//! use gmeta::Metadata; +//! use gmeta::{Metadata, Out}; //! # const IGNORE: &'static str = stringify! { //! use ping_io::ContractMetadata; //! # }; @@ -168,11 +168,11 @@ //! # type Others = (); //! # type Reply = (); //! # type Signal = (); -//! # type State = i32; +//! # type State = Out; //! # } //! # //! let metadata_hex = ContractMetadata::repr().hex(); -//! assert_eq!(metadata_hex.len(), 144); +//! assert_eq!(metadata_hex.len(), 146); //! fs::write("ping.meta.txt", metadata_hex).expect("Unable to write"); //! ``` //! @@ -225,7 +225,7 @@ use scale_info::{ TypeInfo, }; -const METADATA_VERSION: u16 = 1; +const METADATA_VERSION: u16 = 2; /// Language identifier. /// @@ -263,7 +263,7 @@ pub struct MetadataRepr { /// Internal representation for [`Metadata::Signal`] type. pub signal: Option, /// Internal representation for [`Metadata::State`] type. - pub state: Option, + pub state: TypesRepr, /// Encoded registry of types. pub registry: Vec, } @@ -468,7 +468,7 @@ pub trait Metadata { /// /// Use the type that you pass to the `msg::reply` function in the `state()` /// function or unit tuple `()` if no `state()` function is defined. - type State: Type; + type State: Types; /// Create metadata representation and register types in registry. fn repr() -> MetadataRepr { diff --git a/gsdk/src/rpc.rs b/gsdk/src/rpc.rs index 12c7d4d7948..ecab4c28339 100644 --- a/gsdk/src/rpc.rs +++ b/gsdk/src/rpc.rs @@ -137,9 +137,17 @@ impl Api { } /// gear_readState - pub async fn read_state(&self, pid: H256, at: Option) -> Result { + pub async fn read_state( + &self, + pid: H256, + payload: Vec, + at: Option, + ) -> Result { self.rpc() - .request("gear_readState", rpc_params![H256(pid.into()), at]) + .request( + "gear_readState", + rpc_params![H256(pid.into()), hex::encode(payload), at], + ) .await .map_err(Into::into) } diff --git a/gtest/Cargo.toml b/gtest/Cargo.toml index 5ce67012494..da51090797f 100644 --- a/gtest/Cargo.toml +++ b/gtest/Cargo.toml @@ -26,7 +26,7 @@ gear-wasm-instrument.workspace = true log.workspace = true [dev-dependencies] -demo-capacitor.workspace = true +demo-custom.workspace = true demo-piggy-bank.workspace = true demo-ping.workspace = true demo-futures-unordered.workspace = true diff --git a/gtest/src/program.rs b/gtest/src/program.rs index c048bc04028..a30d5497b7f 100644 --- a/gtest/src/program.rs +++ b/gtest/src/program.rs @@ -713,22 +713,19 @@ mod tests { #[test] fn save_load_memory_dump() { + use demo_custom::{InitMessage, WASM_BINARY}; let sys = System::new(); sys.init_logger(); - let mut prog = Program::from_opt_and_meta_code_with_id( - &sys, - 420, - demo_capacitor::WASM_BINARY.to_vec(), - None, - ); + let mut prog = + Program::from_opt_and_meta_code_with_id(&sys, 420, WASM_BINARY.to_vec(), None); let signer = 42; - // Init capacitor with CAPACITY = 15 - prog.send_bytes(signer, b"15"); + // Init capacitor with limit = 15 + prog.send(signer, InitMessage::Capacitor("15".to_string())); - // Charge capacitor with CHARGE = 10 + // Charge capacitor with charge = 10 let response = dbg!(prog.send_bytes(signer, b"10")); let log = Log::builder() .source(prog.id()) @@ -739,21 +736,22 @@ mod tests { let cleanup = CleanupFolderOnDrop { path: "./296c6962726".to_string(), }; - prog.save_memory_dump("./296c6962726/demo_capacitor.dump"); + prog.save_memory_dump("./296c6962726/demo_custom.dump"); - // Charge capacitor with CHARGE = 10 + // Charge capacitor with charge = 10 let response = prog.send_bytes(signer, b"10"); let log = Log::builder() .source(prog.id()) .dest(signer) .payload_bytes("Discharged: 20"); + // dbg!(log.clone()); assert!(response.contains(&log)); sys.claim_value_from_mailbox(signer); - prog.load_memory_dump("./296c6962726/demo_capacitor.dump"); + prog.load_memory_dump("./296c6962726/demo_custom.dump"); drop(cleanup); - // Charge capacitor with CHARGE = 10 + // Charge capacitor with charge = 10 let response = prog.send_bytes(signer, b"10"); let log = Log::builder() .source(prog.id()) diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index bb3c94a549e..aaa9e5c9053 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -68,8 +68,6 @@ demo-async.workspace = true demo-async-init.workspace = true demo-async-recursion.workspace = true demo-async-tester.workspace = true -demo-backend-error.workspace = true -demo-btree.workspace = true demo-delayed-sender.workspace = true demo-distributor.workspace = true demo-init-fail-sender.workspace = true @@ -107,6 +105,7 @@ demo-async-custom-entry.workspace = true demo-out-of-memory.workspace = true demo-ping.workspace = true demo-sync-duplicate.workspace = true +demo-custom.workspace = true test-syscalls.workspace = true page_size.workspace = true frame-support-test = { workspace = true, features = ["std"] } diff --git a/pallets/gear/rpc/runtime-api/src/lib.rs b/pallets/gear/rpc/runtime-api/src/lib.rs index 8d4fa918283..eaa58705cb6 100644 --- a/pallets/gear/rpc/runtime-api/src/lib.rs +++ b/pallets/gear/rpc/runtime-api/src/lib.rs @@ -31,7 +31,7 @@ sp_api::decl_runtime_apis! { /// Generate inherent-like extrinsic that runs message queue processing. fn gear_run_extrinsic() -> ::Extrinsic; - fn read_state(program_id: H256) -> Result, Vec>; + fn read_state(program_id: H256, payload: Vec) -> Result, Vec>; fn read_state_using_wasm(program_id: H256, fn_name: Vec, wasm: Vec, argument: Option>) -> Result, Vec>; diff --git a/pallets/gear/rpc/src/lib.rs b/pallets/gear/rpc/src/lib.rs index fb55b6b3182..ad5d763d1b9 100644 --- a/pallets/gear/rpc/src/lib.rs +++ b/pallets/gear/rpc/src/lib.rs @@ -94,7 +94,12 @@ pub trait GearApi { ) -> RpcResult; #[method(name = "gear_readState")] - fn read_state(&self, program_id: H256, at: Option) -> RpcResult; + fn read_state( + &self, + program_id: H256, + payload: Bytes, + at: Option, + ) -> RpcResult; #[method(name = "gear_readStateUsingWasm")] fn read_state_using_wasm( @@ -321,11 +326,12 @@ where fn read_state( &self, program_id: H256, + payload: Bytes, at: Option<::Hash>, ) -> RpcResult { let at_hash = at.unwrap_or_else(|| self.client.info().best_hash); - self.run_with_api_copy(|api| api.read_state(at_hash, program_id)) + self.run_with_api_copy(|api| api.read_state(at_hash, program_id, payload.to_vec())) .map(Bytes) } diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 0b9d03d6cfd..d63cd84bac0 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -726,10 +726,10 @@ pub mod pallet { .map_err(String::into_bytes) } - pub fn read_state(program_id: H256) -> Result, Vec> { + pub fn read_state(program_id: H256, payload: Vec) -> Result, Vec> { let program_id = ProgramId::from_origin(program_id.into_origin()); - Self::read_state_impl(program_id).map_err(String::into_bytes) + Self::read_state_impl(program_id, payload).map_err(String::into_bytes) } pub fn read_metahash(program_id: H256) -> Result> { diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index d7a259c4b10..89a75ddac54 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -306,7 +306,7 @@ where let instrumented_code = code_and_id.into_parts().0; let mut payload = argument.unwrap_or_default(); - payload.append(&mut Self::read_state_impl(program_id)?); + payload.append(&mut Self::read_state_impl(program_id, Default::default())?); let block_info = BlockInfo { height: Self::block_number().unique_saturated_into(), @@ -325,7 +325,10 @@ where ) } - pub(crate) fn read_state_impl(program_id: ProgramId) -> Result, String> { + pub(crate) fn read_state_impl( + program_id: ProgramId, + payload: Vec, + ) -> Result, String> { #[cfg(feature = "lazy-pages")] { let prefix = ProgramStorageOf::::pages_final_prefix(); @@ -353,7 +356,7 @@ where program_pages, Some(allocations), Some(program_id), - Default::default(), + payload, BlockGasLimitOf::::get() * RUNTIME_API_BLOCK_LIMITS_COUNT, block_info, ) diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 8ed9ae258d4..16402a10df0 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -74,7 +74,7 @@ use gear_core::{ }; use gear_core_errors::*; use gear_wasm_instrument::STACK_END_EXPORT_NAME; -use gstd::errors::Error as GstdError; +use gstd::{errors::Error as GstdError, BTreeMap}; use sp_runtime::{traits::UniqueSaturatedInto, SaturatedConversion}; use sp_std::convert::TryFrom; pub use utils::init_logger; @@ -169,7 +169,8 @@ fn read_big_state() { run_to_next_block(None); assert_succeed(mid); - let state = Gear::read_state_impl(pid).expect("Failed to read state"); + let state = + Gear::read_state_impl(pid, Default::default()).expect("Failed to read state"); assert_eq!(approx_size(state.len(), i), expected_size(i)); } }); @@ -898,7 +899,7 @@ fn gasfull_after_gasless() { #[test] fn backend_errors_handled_in_program() { - use demo_backend_error::WASM_BINARY; + use demo_custom::{InitMessage, WASM_BINARY}; init_logger(); new_test_ext().execute_with(|| { @@ -906,7 +907,7 @@ fn backend_errors_handled_in_program() { RuntimeOrigin::signed(USER_1), WASM_BINARY.to_vec(), DEFAULT_SALT.to_vec(), - EMPTY_PAYLOAD.to_vec(), + InitMessage::BackendError.encode(), DEFAULT_GAS_LIMIT * 100, 0, )); @@ -1911,7 +1912,8 @@ fn read_state_works() { let expected = Wallet::test_sequence().encode(); - let res = Gear::read_state_impl(program_id).expect("Failed to read state"); + let res = + Gear::read_state_impl(program_id, Default::default()).expect("Failed to read state"); assert_eq!(res, expected); }); @@ -6113,20 +6115,70 @@ fn resume_session_init_works() { }) } +#[test] +fn state_request() { + init_logger(); + new_test_ext().execute_with(|| { + use demo_custom::{ + btree::{Request, StateRequest}, + InitMessage, WASM_BINARY, + }; + + let code = WASM_BINARY; + let program_id = generate_program_id(code, DEFAULT_SALT); + + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_2), + code.to_vec(), + DEFAULT_SALT.to_vec(), + InitMessage::BTree.encode(), + 50_000_000_000, + 0, + )); + + let data = [(0u32, 1u32), (2, 4), (7, 8)]; + for (key, value) in data { + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + program_id, + Request::Insert(key, value).encode(), + 1_000_000_000, + 0 + )); + } + + run_to_next_block(None); + + for (key, value) in data { + let ret = + Gear::read_state_impl(program_id, StateRequest::ForKey(key).encode()).unwrap(); + assert_eq!( + Option::::decode(&mut ret.as_slice()).unwrap().unwrap(), + value + ); + } + + let ret = Gear::read_state_impl(program_id, StateRequest::Full.encode()).unwrap(); + let ret = BTreeMap::::decode(&mut ret.as_slice()).unwrap(); + let expected: BTreeMap = data.into_iter().collect(); + assert_eq!(ret, expected); + }) +} + #[test] fn resume_session_push_works() { init_logger(); new_test_ext().execute_with(|| { - use demo_btree::Request; + use demo_custom::{btree::Request, InitMessage, WASM_BINARY}; - let code = demo_btree::WASM_BINARY; + let code = WASM_BINARY; let program_id = generate_program_id(code, DEFAULT_SALT); assert_ok!(Gear::upload_program( RuntimeOrigin::signed(USER_2), code.to_vec(), DEFAULT_SALT.to_vec(), - EMPTY_PAYLOAD.to_vec(), + InitMessage::BTree.encode(), 50_000_000_000, 0, )); @@ -6227,16 +6279,19 @@ fn resume_session_push_works() { fn resume_program_works() { init_logger(); new_test_ext().execute_with(|| { - use demo_btree::{Reply, Request}; + use demo_custom::{ + btree::{Reply, Request}, + InitMessage, WASM_BINARY, + }; - let code = demo_btree::WASM_BINARY; + let code = WASM_BINARY; let program_id = generate_program_id(code, DEFAULT_SALT); assert_ok!(Gear::upload_program( RuntimeOrigin::signed(USER_1), code.to_vec(), DEFAULT_SALT.to_vec(), - EMPTY_PAYLOAD.to_vec(), + InitMessage::BTree.encode(), 50_000_000_000, 0, )); @@ -7436,7 +7491,7 @@ fn calculate_init_gas() { #[test] fn gas_spent_vs_balance() { - use demo_btree::{Request, WASM_BINARY}; + use demo_custom::{btree::Request, InitMessage, WASM_BINARY}; init_logger(); new_test_ext().execute_with(|| { @@ -7446,7 +7501,7 @@ fn gas_spent_vs_balance() { RuntimeOrigin::signed(USER_1), WASM_BINARY.to_vec(), DEFAULT_SALT.to_vec(), - EMPTY_PAYLOAD.to_vec(), + InitMessage::BTree.encode(), 50_000_000_000, 0, )); @@ -7477,7 +7532,7 @@ fn gas_spent_vs_balance() { } = Gear::calculate_gas_info( USER_1.into_origin(), HandleKind::Init(WASM_BINARY.to_vec()), - EMPTY_PAYLOAD.to_vec(), + InitMessage::BTree.encode(), 0, true, true, diff --git a/runtime/common/src/apis.rs b/runtime/common/src/apis.rs index 9a27125f8b5..c4219c4fe16 100644 --- a/runtime/common/src/apis.rs +++ b/runtime/common/src/apis.rs @@ -165,8 +165,8 @@ macro_rules! impl_runtime_apis_plus_common { UncheckedExtrinsic::new_unsigned(Gear::run_call().into()).into() } - fn read_state(program_id: H256) -> Result, Vec> { - Gear::read_state(program_id) + fn read_state(program_id: H256, payload: Vec) -> Result, Vec> { + Gear::read_state(program_id, payload) } fn read_state_using_wasm( From c5ba086f400f442e77eb18db1efc90d26d98d5dc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 19 Aug 2023 12:17:07 +0400 Subject: [PATCH 058/165] deps: combine dependabot's PRs (#3109) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Shamil <66209982+shamilsan@users.noreply.github.com> --- Cargo.lock | 39 +++++++++++++++++++++++++-------------- Cargo.toml | 4 ++-- utils/call-gen/Cargo.toml | 2 +- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8f158d173e5..c664a5e36bc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3780,7 +3780,7 @@ dependencies = [ "hex", "log", "rand 0.8.5", - "sha-1", + "sha-1 0.10.1", "static_assertions", "thiserror", ] @@ -6162,9 +6162,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "loupe" @@ -8877,13 +8877,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ "aho-corasick 1.0.2", "memchr", - "regex-automata 0.3.2", + "regex-automata 0.3.6", "regex-syntax 0.7.4", ] @@ -8898,9 +8898,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.2" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d3daa6976cffb758ec878f108ba0e062a45b2d6ca3a2cca965338855476caf" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" dependencies = [ "aho-corasick 1.0.2", "memchr", @@ -10745,9 +10745,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" dependencies = [ "itoa", "ryu", @@ -10799,6 +10799,17 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + [[package]] name = "sha1" version = "0.10.5" @@ -11006,7 +11017,7 @@ dependencies = [ "httparse", "log", "rand 0.8.5", - "sha-1", + "sha-1 0.9.8", ] [[package]] @@ -13069,9 +13080,9 @@ dependencies = [ [[package]] name = "trybuild" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84e0202ea606ba5ebee8507ab2bfbe89b98551ed9b8f0be198109275cff284b" +checksum = "6df60d81823ed9c520ee897489573da4b1d79ffbe006b8134f46de1a1aa03555" dependencies = [ "basic-toml", "dissimilar", @@ -14416,7 +14427,7 @@ dependencies = [ "log", "rtcp", "rtp", - "sha-1", + "sha-1 0.9.8", "subtle", "thiserror", "tokio", diff --git a/Cargo.toml b/Cargo.toml index f28e605b553..00abc3e6e58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -116,7 +116,7 @@ hex-literal = "0.4.1" jsonrpsee = { version = "^0.16" } lazy_static = "1.4.0" libc = { version = "0.2", default-features = false } -log = { version = "0.4.17", default-features = false } +log = { version = "0.4.20", default-features = false } once_cell = "1.17.1" parity-scale-codec = { version = "3.6.4", default-features = false } parity-wasm = "0.45.0" @@ -129,7 +129,7 @@ quick-xml = "0.28" quote = { version = "1.0.26", default-features = false } rand = { version = "0.8", default-features = false } rayon = "1.7" -regex = "^1.7" +regex = "^1.9" region = "3.0.0" reqwest = { version = "0.11.16", default-features = false } scale-info = { version = "2.5.0", default-features = false } diff --git a/utils/call-gen/Cargo.toml b/utils/call-gen/Cargo.toml index 8fd382a45cb..923993fa1b3 100644 --- a/utils/call-gen/Cargo.toml +++ b/utils/call-gen/Cargo.toml @@ -15,6 +15,6 @@ dyn-clonable.workspace = true hex.workspace = true log.workspace = true rand.workspace = true -sha-1 = "0.9.3" +sha-1 = "0.10.1" static_assertions.workspace = true thiserror.workspace = true From 626e760959b4317f71aa372ed13c460235a7ac43 Mon Sep 17 00:00:00 2001 From: ekovalev Date: Sat, 19 Aug 2023 16:29:03 +0400 Subject: [PATCH 059/165] feat(cli): Add node CLI arg to set max block gas value (#3110) --- Cargo.lock | 1 + gsdk/src/metadata/generated.rs | 4 +- node/authorship/Cargo.toml | 1 + node/authorship/src/authorship.rs | 9 +- node/authorship/src/block_builder.rs | 6 +- node/authorship/src/tests.rs | 139 ++++++++++++++++++- node/cli/src/cli.rs | 4 + node/cli/src/command.rs | 2 +- node/service/src/lib.rs | 5 + pallets/gear-debug/src/mock.rs | 2 +- pallets/gear-scheduler/src/mock.rs | 2 +- pallets/gear/rpc/runtime-api/src/lib.rs | 2 +- pallets/gear/src/benchmarking/tests/utils.rs | 2 +- pallets/gear/src/lib.rs | 17 ++- pallets/gear/src/manager/journal.rs | 1 + pallets/gear/src/mock.rs | 2 +- runtime/common/src/apis.rs | 6 +- runtime/vara/src/integration_tests.rs | 2 +- 18 files changed, 186 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c664a5e36bc..04bedf8801e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3668,6 +3668,7 @@ name = "gear-authorship" version = "0.1.0" dependencies = [ "demo-mul-by-const", + "env_logger", "frame-support", "frame-system", "futures", diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index 4cad2fa3a52..79b65e57639 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -1881,7 +1881,9 @@ pub mod runtime_types { }, #[codec(index = 6)] #[doc = "Process message queue"] - run, + run { + max_gas: ::core::option::Option<::core::primitive::u64>, + }, #[codec(index = 7)] #[doc = "Sets `ExecuteInherent` flag."] #[doc = ""] diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index f8bdc82182e..3dabd4fc783 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -57,3 +57,4 @@ pallet-gear-messenger = { workspace = true, features = ["std"] } testing.workspace = true vara-runtime = { workspace = true, features = ["std"] } demo-mul-by-const.workspace = true +env_logger.workspace = true diff --git a/node/authorship/src/authorship.rs b/node/authorship/src/authorship.rs index 194da183a00..2b8c5e2b1cc 100644 --- a/node/authorship/src/authorship.rs +++ b/node/authorship/src/authorship.rs @@ -80,6 +80,8 @@ pub struct ProposerFactory { telemetry: Option, /// When estimating the block size, should the proof be included? include_proof_in_block_size_estimation: bool, + /// Hard limit for the gas allowed to burn in one block. + max_gas: Option, /// phantom member to pin the `Backend`/`ProofRecording` type. _phantom: PhantomData<(B, PR)>, } @@ -95,6 +97,7 @@ impl ProposerFactory { transaction_pool: Arc, prometheus: Option<&PrometheusRegistry>, telemetry: Option, + max_gas: Option, ) -> Self { ProposerFactory { spawn_handle: Box::new(spawn_handle), @@ -105,6 +108,7 @@ impl ProposerFactory { telemetry, client, include_proof_in_block_size_estimation: false, + max_gas, _phantom: PhantomData, } } @@ -133,6 +137,7 @@ impl ProposerFactory { soft_deadline_percent: DEFAULT_SOFT_DEADLINE_PERCENT, telemetry, include_proof_in_block_size_estimation: true, + max_gas: None, _phantom: PhantomData, } } @@ -210,6 +215,7 @@ where default_block_size_limit: self.default_block_size_limit, soft_deadline_percent: self.soft_deadline_percent, telemetry: self.telemetry.clone(), + max_gas: self.max_gas, _phantom: PhantomData, include_proof_in_block_size_estimation: self.include_proof_in_block_size_estimation, }; @@ -258,6 +264,7 @@ pub struct Proposer { include_proof_in_block_size_estimation: bool, soft_deadline_percent: Percent, telemetry: Option, + max_gas: Option, _phantom: PhantomData<(B, PR)>, } @@ -514,7 +521,7 @@ where self.transaction_pool.remove_invalid(&unqueue_invalid); // Pushing a custom extrinsic that must run at the end of a block - let custom_extrinsic = block_builder.create_terminal_extrinsic()?; + let custom_extrinsic = block_builder.create_terminal_extrinsic(self.max_gas)?; debug!(target: "gear::authorship", "⚙️ Pushing Gear::run extrinsic into the block..."); match block_builder.push(custom_extrinsic) { diff --git a/node/authorship/src/block_builder.rs b/node/authorship/src/block_builder.rs index 2deacf0c75e..2ef70e5cb9f 100644 --- a/node/authorship/src/block_builder.rs +++ b/node/authorship/src/block_builder.rs @@ -75,13 +75,17 @@ where self.block_builder.estimate_block_size(include_proof) } - pub fn create_terminal_extrinsic(&mut self) -> Result { + pub fn create_terminal_extrinsic( + &mut self, + max_gas: Option, + ) -> Result { let block_hash = self.parent_hash; self.api .execute_in_transaction(move |api| { TransactionOutcome::Rollback(api.gear_run_extrinsic_with_context( block_hash, ExecutionContext::BlockConstruction, + max_gas, )) }) .map_err(|e| Error::Application(Box::new(e))) diff --git a/node/authorship/src/tests.rs b/node/authorship/src/tests.rs index 314f89183d1..775062f6018 100644 --- a/node/authorship/src/tests.rs +++ b/node/authorship/src/tests.rs @@ -91,7 +91,7 @@ fn checked_extrinsics(n: u32, signer: AccountId, nonce: &mut u32) -> Vec Vec::try_from(&client.info().best_hash[..]).expect("H256 is a 32 byte type"); + let mut nonce = 0_u32; + // Creating 5 extrinsics + let extrinsics = checked_extrinsics(5, bob(), &mut nonce) + .iter() + .map(|x| { + sign( + x.clone(), + VERSION.spec_version, + VERSION.transaction_version, + genesis_hash, + ) + .into() + }) + .collect::>(); + + block_on(txpool.submit_at(&BlockId::number(0), SOURCE, extrinsics)).unwrap(); + + block_on( + txpool.maintain(chain_event( + client + .header( + client + .block_hash_from_id(&BlockId::Number(0_u32)) + .unwrap() + .unwrap(), + ) + .expect("header get error") + .expect("there should be header"), + )), + ); + + let mut proposer_factory = + ProposerFactory::new(spawner, client.clone(), txpool, None, None, Some(MAX_GAS)); + + let timestamp_provider = sp_timestamp::InherentDataProvider::from_system_time(); + + let proposer = block_on( + proposer_factory.init( + &client + .header( + client + .block_hash_from_id(&BlockId::number(0)) + .unwrap() + .unwrap(), + ) + .expect("Database error querying block #0") + .expect("Block #0 should exist"), + ), + ) + .expect("Proposer initialization failed"); + + let inherent_data = + block_on(timestamp_provider.create_inherent_data()).expect("Create inherent data failed"); + let time_slot = sp_timestamp::Timestamp::current().as_millis() / SLOT_DURATION; + + let proposal = block_on(proposer.propose( + inherent_data, + pre_digest(time_slot, 0), + time::Duration::from_secs(20), + None, + )) + .unwrap(); + + // All extrinsics have been included in the block: 1 inherent + 5 normal + 1 terminal + assert_eq!(proposal.block.extrinsics().len(), 7); + + // Importing block #1 + block_on(client.import(BlockOrigin::Own, proposal.block.clone())).unwrap(); + + let best_hash = client.info().best_hash; + assert_eq!(best_hash, proposal.block.hash()); + + let state = backend.state_at(best_hash).unwrap(); + // Ensure message queue still has 5 messages as none of the messages fit into the gas allownce + let queue_entry_prefix = storage_prefix( + pallet_gear_messenger::Pallet::::name().as_bytes(), + "Dispatches".as_bytes(), + ); + let mut queue_entry_args = IterArgs::default(); + queue_entry_args.prefix = Some(&queue_entry_prefix); + + let mut queue_len = 0_u32; + + state + .keys(queue_entry_args) + .unwrap() + .for_each(|_k| queue_len += 1); + + // 2 out of 5 messages have been processed, 3 remain in the queue + assert_eq!(queue_len, 3); +} diff --git a/node/cli/src/cli.rs b/node/cli/src/cli.rs index 305b209477f..affc4079da7 100644 --- a/node/cli/src/cli.rs +++ b/node/cli/src/cli.rs @@ -29,6 +29,10 @@ pub struct RunCmd { /// Force using Vara native runtime. #[arg(long = "force-vara")] pub force_vara: bool, + + /// The upper limit for the amount of gas a validator can burn in one block. + #[arg(long)] + pub max_gas: Option, } #[derive(Debug, Parser)] diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index 767f5dc6046..42cf04ca104 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -362,7 +362,7 @@ pub fn run() -> sc_cli::Result<()> { }; runner.run_node_until_exit(|config| async move { - service::new_full(config, cli.no_hardware_benchmarks) + service::new_full(config, cli.no_hardware_benchmarks, cli.run.max_gas) .map_err(sc_cli::Error::Service) }) } diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index ba14f2a03bb..47ad6b70d2f 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -368,6 +368,7 @@ pub fn new_full_base( >, &sc_consensus_babe::BabeLink, ), + max_gas: Option, ) -> Result, ServiceError> where RuntimeApi: ConstructRuntimeApi> @@ -490,6 +491,7 @@ where transaction_pool.clone(), prometheus_registry.as_ref(), telemetry.as_ref().map(|x| x.handle()), + max_gas, ); let client_clone = client.clone(); @@ -640,6 +642,7 @@ impl ExecuteWithClient for RevertConsensus { pub fn new_full( config: Configuration, disable_hardware_benchmarks: bool, + max_gas: Option, ) -> Result { match &config.chain_spec { #[cfg(feature = "gear-native")] @@ -647,6 +650,7 @@ pub fn new_full( config, disable_hardware_benchmarks, |_, _| (), + max_gas, ) .map(|NewFullBase { task_manager, .. }| task_manager), #[cfg(feature = "vara-native")] @@ -654,6 +658,7 @@ pub fn new_full( config, disable_hardware_benchmarks, |_, _| (), + max_gas, ) .map(|NewFullBase { task_manager, .. }| task_manager), _ => Err(ServiceError::Other("Invalid chain spec".into())), diff --git a/pallets/gear-debug/src/mock.rs b/pallets/gear-debug/src/mock.rs index 4f4414311f4..b6d3703c601 100644 --- a/pallets/gear-debug/src/mock.rs +++ b/pallets/gear-debug/src/mock.rs @@ -250,7 +250,7 @@ pub fn run_to_block(n: u64, remaining_weight: Option) { ); } - Gear::run(frame_support::dispatch::RawOrigin::None.into()).unwrap(); + Gear::run(frame_support::dispatch::RawOrigin::None.into(), None).unwrap(); Gear::on_finalize(System::block_number()); assert!(!System::events().iter().any(|e| { diff --git a/pallets/gear-scheduler/src/mock.rs b/pallets/gear-scheduler/src/mock.rs index 6b9e794e046..a5372349d42 100644 --- a/pallets/gear-scheduler/src/mock.rs +++ b/pallets/gear-scheduler/src/mock.rs @@ -250,7 +250,7 @@ pub fn run_to_block(n: u64, remaining_weight: Option) { ); } - Gear::run(frame_support::dispatch::RawOrigin::None.into()).unwrap(); + Gear::run(frame_support::dispatch::RawOrigin::None.into(), None).unwrap(); Gear::on_finalize(System::block_number()); assert!(!System::events().iter().any(|e| { diff --git a/pallets/gear/rpc/runtime-api/src/lib.rs b/pallets/gear/rpc/runtime-api/src/lib.rs index eaa58705cb6..6de80ffcfe8 100644 --- a/pallets/gear/rpc/runtime-api/src/lib.rs +++ b/pallets/gear/rpc/runtime-api/src/lib.rs @@ -29,7 +29,7 @@ sp_api::decl_runtime_apis! { fn calculate_gas_info(source: H256, kind: HandleKind, payload: Vec, value: u128, allow_other_panics: bool, initial_gas: Option,) -> Result>; /// Generate inherent-like extrinsic that runs message queue processing. - fn gear_run_extrinsic() -> ::Extrinsic; + fn gear_run_extrinsic(max_gas: Option) -> ::Extrinsic; fn read_state(program_id: H256, payload: Vec) -> Result, Vec>; diff --git a/pallets/gear/src/benchmarking/tests/utils.rs b/pallets/gear/src/benchmarking/tests/utils.rs index 902ed9c5a6d..b9602934850 100644 --- a/pallets/gear/src/benchmarking/tests/utils.rs +++ b/pallets/gear/src/benchmarking/tests/utils.rs @@ -76,7 +76,7 @@ where ); } - Gear::::run(frame_support::dispatch::RawOrigin::None.into()).unwrap(); + Gear::::run(frame_support::dispatch::RawOrigin::None.into(), None).unwrap(); Gear::::on_finalize(SystemPallet::::block_number()); } } diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index d63cd84bac0..da400d184d8 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -1284,8 +1284,8 @@ pub mod pallet { Ok(()) } - pub fn run_call() -> Call { - Call::run {} + pub fn run_call(max_gas: Option>) -> Call { + Call::run { max_gas } } pub fn rent_fee_for(block_count: BlockNumberFor) -> BalanceOf { @@ -1704,7 +1704,10 @@ pub mod pallet { /// Process message queue #[pallet::call_index(6)] #[pallet::weight((Weight::zero(), DispatchClass::Mandatory))] - pub fn run(origin: OriginFor) -> DispatchResultWithPostInfo { + pub fn run( + origin: OriginFor, + max_gas: Option>, + ) -> DispatchResultWithPostInfo { ensure_none(origin)?; ensure!( @@ -1716,8 +1719,12 @@ pub mod pallet { let max_weight = ::BlockWeights::get().max_block; let remaining_weight = max_weight.saturating_sub(weight_used.total()); - // Remaining weight may exceed the minimum block gas limit determined by the Limiter trait - let adjusted_gas = GasAllowanceOf::::get().max(remaining_weight.ref_time()); + // Remaining weight may exceed the minimum block gas limit set by the Limiter trait. + let mut adjusted_gas = GasAllowanceOf::::get().max(remaining_weight.ref_time()); + // Gas for queue processing can never exceed the hard limit, if the latter is provided. + if let Some(max_gas) = max_gas { + adjusted_gas = adjusted_gas.min(max_gas); + }; log::debug!( target: "gear::runtime", diff --git a/pallets/gear/src/manager/journal.rs b/pallets/gear/src/manager/journal.rs index 4ddd332ba7f..5bbb2fb1e61 100644 --- a/pallets/gear/src/manager/journal.rs +++ b/pallets/gear/src/manager/journal.rs @@ -490,6 +490,7 @@ where ); GasAllowanceOf::::decrease(gas_burned); + // TODO: #3112. Rework requeueing logic to avoid blocked queue. QueueOf::::requeue(dispatch) .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)); } diff --git a/pallets/gear/src/mock.rs b/pallets/gear/src/mock.rs index f9e3c28cf1b..d86e232871e 100644 --- a/pallets/gear/src/mock.rs +++ b/pallets/gear/src/mock.rs @@ -369,7 +369,7 @@ pub fn run_to_block_maybe_with_queue( QueueProcessingOf::::deny(); } - Gear::run(frame_support::dispatch::RawOrigin::None.into()).unwrap(); + Gear::run(frame_support::dispatch::RawOrigin::None.into(), None).unwrap(); } Gear::on_finalize(System::block_number()); diff --git a/runtime/common/src/apis.rs b/runtime/common/src/apis.rs index c4219c4fe16..4d604c6dafd 100644 --- a/runtime/common/src/apis.rs +++ b/runtime/common/src/apis.rs @@ -161,8 +161,10 @@ macro_rules! impl_runtime_apis_plus_common { Gear::calculate_gas_info(account_id, kind, payload, value, allow_other_panics, initial_gas) } - fn gear_run_extrinsic() -> ::Extrinsic { - UncheckedExtrinsic::new_unsigned(Gear::run_call().into()).into() + fn gear_run_extrinsic(max_gas: Option) -> ::Extrinsic { + UncheckedExtrinsic::new_unsigned( + Gear::run_call(max_gas).into() + ).into() } fn read_state(program_id: H256, payload: Vec) -> Result, Vec> { diff --git a/runtime/vara/src/integration_tests.rs b/runtime/vara/src/integration_tests.rs index bd08e33b18d..1e29d1701fb 100644 --- a/runtime/vara/src/integration_tests.rs +++ b/runtime/vara/src/integration_tests.rs @@ -66,7 +66,7 @@ pub(crate) fn on_initialize(new_block_number: BlockNumberFor) { // Run on_finalize hooks (in pallets reverse order, as they appear in AllPalletsWithSystem) pub(crate) fn on_finalize(current_blk: BlockNumberFor) { - Gear::run(frame_support::dispatch::RawOrigin::None.into()).unwrap(); + Gear::run(frame_support::dispatch::RawOrigin::None.into(), None).unwrap(); GearPayment::on_finalize(current_blk); GearGas::on_finalize(current_blk); Gear::on_finalize(current_blk); From 07d1b79fb82ba76104843b9e2607246c16fa2a96 Mon Sep 17 00:00:00 2001 From: ekovalev Date: Sat, 19 Aug 2023 16:53:53 +0400 Subject: [PATCH 060/165] refactor(node): Get rid of redundant `_with_voucher` extrinsics (#3083) --- examples/fungible-token/tests/benchmarks.rs | 10 +- gcli/src/cmd/reply.rs | 5 + gcli/src/cmd/send.rs | 5 + gclient/src/api/calls.rs | 28 +- gclient/tests/memory_dump.rs | 2 +- gclient/tests/node.rs | 2 + gclient/tests/state.rs | 1 + gclient/tests/upload.rs | 2 +- gsdk/src/metadata/generated.rs | 58 +--- gsdk/src/metadata/impls.rs | 4 + gsdk/src/signer/calls.rs | 4 + gsdk/tests/rpc.rs | 6 +- pallets/gear-debug/src/tests.rs | 9 +- pallets/gear/src/benchmarking/mod.rs | 63 +--- .../benchmarking/tests/syscalls_integrity.rs | 5 + pallets/gear/src/lib.rs | 291 ++++------------ pallets/gear/src/runtime_api.rs | 14 +- pallets/gear/src/tests.rs | 324 ++++++++++++++---- pallets/gear/src/weights.rs | 50 --- pallets/payment/src/lib.rs | 2 +- pallets/payment/src/mock.rs | 28 +- pallets/payment/src/tests.rs | 8 +- runtime/gear/src/lib.rs | 30 +- runtime/gear/src/weights/pallet_gear.rs | 50 --- runtime/vara/src/integration_tests.rs | 1 + runtime/vara/src/lib.rs | 30 +- runtime/vara/src/weights/pallet_gear.rs | 50 --- utils/call-gen/src/arbitrary_call.rs | 3 +- utils/call-gen/src/send_message.rs | 6 +- utils/call-gen/src/send_reply.rs | 6 +- utils/runtime-fuzzer/src/lib.rs | 3 +- 31 files changed, 507 insertions(+), 593 deletions(-) diff --git a/examples/fungible-token/tests/benchmarks.rs b/examples/fungible-token/tests/benchmarks.rs index 63596aabce8..b52c153f827 100644 --- a/examples/fungible-token/tests/benchmarks.rs +++ b/examples/fungible-token/tests/benchmarks.rs @@ -40,7 +40,7 @@ async fn send_messages_in_parallel( api: &GearApi, batch_size: usize, treads_number: usize, - messages: &[(ProgramId, Vec, u64, u128)], + messages: &[(ProgramId, Vec, u64, u128, bool)], ) -> Result> { // TODO: currently have problem with transaction priorities from one user. // Fix this after loader become a lib #2781 @@ -190,9 +190,9 @@ async fn stress_test() -> Result<()> { } // Converting batch - let batch: Vec<(_, Vec, u64, _)> = batch + let batch: Vec<(_, Vec, u64, _, _)> = batch .iter() - .map(|x| (program_id, x.encode(), MAX_GAS_LIMIT, 0)) + .map(|x| (program_id, x.encode(), MAX_GAS_LIMIT, 0, false)) .collect(); // Sending batch @@ -251,9 +251,9 @@ async fn stress_transfer() -> Result<()> { )); } - let messages: Vec<(_, Vec, u64, _)> = actions + let messages: Vec<(_, Vec, u64, _, _)> = actions .into_iter() - .map(|action| (program_id, action.encode(), MAX_GAS_LIMIT, 0)) + .map(|action| (program_id, action.encode(), MAX_GAS_LIMIT, 0, false)) .collect(); let message_ids = send_messages_in_parallel(&api, BATCH_CHUNK_SIZE, 1, &messages).await?; diff --git a/gcli/src/cmd/reply.rs b/gcli/src/cmd/reply.rs index 505b1eca853..b2c4b60f56f 100644 --- a/gcli/src/cmd/reply.rs +++ b/gcli/src/cmd/reply.rs @@ -31,6 +31,7 @@ use gsdk::signer::Signer; /// - `payload`: data expected by the original sender. /// - `gas_limit`: maximum amount of gas the program can spend before it is halted. /// - `value`: balance to be transferred to the program once it's been created. +/// - `prepaid`: a flag indicating whether the tx fee and gas are paid from a voucher. /// /// - `DispatchMessageEnqueued(H256)` when dispatch message is placed in the queue. #[derive(Parser, Debug)] @@ -46,6 +47,9 @@ pub struct Reply { /// Reply value #[arg(short, long, default_value = "0")] value: u128, + /// Use pre-issued voucher + #[arg(long)] + pub prepaid: bool, } impl Reply { @@ -58,6 +62,7 @@ impl Reply { self.payload.to_vec()?, self.gas_limit, self.value, + self.prepaid, ) .await?; diff --git a/gcli/src/cmd/send.rs b/gcli/src/cmd/send.rs index 886ff22b0ae..551c4d033ff 100644 --- a/gcli/src/cmd/send.rs +++ b/gcli/src/cmd/send.rs @@ -35,6 +35,7 @@ use gsdk::signer::Signer; /// - `payload`: in case of a program destination, parameters of the `handle` function. /// - `gas_limit`: maximum amount of gas the program can spend before it is halted. /// - `value`: balance to be transferred to the program once it's been created. +/// - `prepaid`: a flag indicating whether the tx fee and gas are paid from a voucher. /// /// Emits the following events: /// - `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue. @@ -51,6 +52,9 @@ pub struct Send { /// Send value #[arg(short, long, default_value = "0")] pub value: u128, + /// Use pre-issued voucher + #[arg(long)] + pub prepaid: bool, } impl Send { @@ -61,6 +65,7 @@ impl Send { self.payload.to_vec()?, self.gas_limit, self.value, + self.prepaid, ) .await?; diff --git a/gclient/src/api/calls.rs b/gclient/src/api/calls.rs index a912d4a73e6..4d6cd0d3c39 100644 --- a/gclient/src/api/calls.rs +++ b/gclient/src/api/calls.rs @@ -633,12 +633,13 @@ impl GearApi { payload: impl AsRef<[u8]>, gas_limit: u64, value: u128, + prepaid: bool, ) -> Result<(MessageId, H256)> { let payload = payload.as_ref().to_vec(); let tx = self .0 - .send_message(destination, payload, gas_limit, value) + .send_message(destination, payload, gas_limit, value, prepaid) .await?; for event in tx.wait_for_success().await?.iter() { @@ -664,16 +665,17 @@ impl GearApi { /// to one program. pub async fn send_message_bytes_batch( &self, - args: impl IntoIterator, u64, u128)>, + args: impl IntoIterator, u64, u128, bool)>, ) -> Result<(Vec>, H256)> { let calls: Vec<_> = args .into_iter() - .map(|(destination, payload, gas_limit, value)| { + .map(|(destination, payload, gas_limit, value, prepaid)| { RuntimeCall::Gear(GearCall::send_message { destination: destination.into(), payload: payload.as_ref().to_vec(), gas_limit, value, + prepaid, }) }) .collect(); @@ -713,8 +715,9 @@ impl GearApi { payload: impl Encode, gas_limit: u64, value: u128, + prepaid: bool, ) -> Result<(MessageId, H256)> { - self.send_message_bytes(destination, payload.encode(), gas_limit, value) + self.send_message_bytes(destination, payload.encode(), gas_limit, value, prepaid) .await } @@ -743,6 +746,7 @@ impl GearApi { payload: impl AsRef<[u8]>, gas_limit: u64, value: u128, + prepaid: bool, ) -> Result<(MessageId, u128, H256)> { let payload = payload.as_ref().to_vec(); @@ -750,7 +754,7 @@ impl GearApi { let tx = self .0 - .send_reply(reply_to_id, payload, gas_limit, value) + .send_reply(reply_to_id, payload, gas_limit, value, prepaid) .await?; let events = tx.wait_for_success().await?; @@ -783,9 +787,13 @@ impl GearApi { /// program id is also returned in the resulting tuple. pub async fn send_reply_bytes_batch( &self, - args: impl IntoIterator, u64, u128)> + Clone, + args: impl IntoIterator, u64, u128, bool)> + Clone, ) -> Result<(Vec>, H256)> { - let message_ids: Vec<_> = args.clone().into_iter().map(|(mid, _, _, _)| mid).collect(); + let message_ids: Vec<_> = args + .clone() + .into_iter() + .map(|(mid, _, _, _, _)| mid) + .collect(); let messages = futures::future::try_join_all( message_ids.iter().map(|mid| self.get_mailbox_message(*mid)), @@ -800,12 +808,13 @@ impl GearApi { let calls: Vec<_> = args .into_iter() - .map(|(reply_to_id, payload, gas_limit, value)| { + .map(|(reply_to_id, payload, gas_limit, value, prepaid)| { RuntimeCall::Gear(GearCall::send_reply { reply_to_id: reply_to_id.into(), payload: payload.as_ref().to_vec(), gas_limit, value, + prepaid, }) }) .collect(); @@ -851,8 +860,9 @@ impl GearApi { payload: impl Encode, gas_limit: u64, value: u128, + prepaid: bool, ) -> Result<(MessageId, u128, H256)> { - self.send_reply_bytes(reply_to_id, payload.encode(), gas_limit, value) + self.send_reply_bytes(reply_to_id, payload.encode(), gas_limit, value, prepaid) .await } diff --git a/gclient/tests/memory_dump.rs b/gclient/tests/memory_dump.rs index 173fe1426a7..3b5ce79a543 100644 --- a/gclient/tests/memory_dump.rs +++ b/gclient/tests/memory_dump.rs @@ -31,7 +31,7 @@ async fn charge_10( .calculate_handle_gas(None, program_id, payload.clone(), 0, true) .await?; let (message_id, _hash) = api - .send_message_bytes(program_id, payload, gas_info.min_limit, 0) + .send_message_bytes(program_id, payload, gas_info.min_limit, 0, false) .await?; assert!(listener.message_processed(message_id).await?.succeed()); diff --git a/gclient/tests/node.rs b/gclient/tests/node.rs index e07fafc0dfd..b4e42cb0ba4 100644 --- a/gclient/tests/node.rs +++ b/gclient/tests/node.rs @@ -69,6 +69,7 @@ async fn program_migrated_to_another_node() { MULTIPLICATOR_VALUE_PAYLOAD, dest_node_gas_limit, 0, + false, ) .await .expect("Unable to send message to destination program"); @@ -208,6 +209,7 @@ async fn program_with_gas_reservation_migrated_to_another_node() { demo_reserve_gas::HandleAction::ReplyFromReservation, dest_node_gas_limit, 0, + false, ) .await .expect("Unable to send message to destination program"); diff --git a/gclient/tests/state.rs b/gclient/tests/state.rs index dd996ef58dd..10f7beb7ee5 100644 --- a/gclient/tests/state.rs +++ b/gclient/tests/state.rs @@ -117,6 +117,7 @@ async fn get_state_request() -> anyhow::Result<()> { btree::Request::Insert(key, value).encode(), gas_limit, 0, + false, ) }); diff --git a/gclient/tests/upload.rs b/gclient/tests/upload.rs index 2ffd9c7268e..9878f114932 100644 --- a/gclient/tests/upload.rs +++ b/gclient/tests/upload.rs @@ -198,7 +198,7 @@ async fn get_mailbox() -> anyhow::Result<()> { .calculate_handle_gas(None, program_id, vec![], 0, true) .await?; - let messages = vec![(program_id, vec![], gas_info.min_limit * 10, 0); 5]; + let messages = vec![(program_id, vec![], gas_info.min_limit * 10, 0, false); 5]; let (messages, _hash) = api.send_message_bytes_batch(messages).await?; diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index 79b65e57639..93fc8e557da 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -1833,11 +1833,18 @@ pub mod runtime_types { #[doc = "is not a program in uninitialized state. If the opposite holds true,"] #[doc = "the message is not enqueued for processing."] #[doc = ""] + #[doc = "If `prepaid` flag is set, the transaction fee and the gas cost will be"] + #[doc = "charged against a `voucher` that must have been issued for the sender"] + #[doc = "in conjunction with the `destination` program. That means that the"] + #[doc = "synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must"] + #[doc = "exist and have sufficient funds in it. Otherwise, the call is invalidated."] + #[doc = ""] #[doc = "Parameters:"] #[doc = "- `destination`: the message destination."] #[doc = "- `payload`: in case of a program destination, parameters of the `handle` function."] #[doc = "- `gas_limit`: maximum amount of gas the program can spend before it is halted."] #[doc = "- `value`: balance to be transferred to the program once it's been created."] + #[doc = "- `prepaid`: a flag that indicates whether a voucher should be used."] #[doc = ""] #[doc = "Emits the following events:"] #[doc = "- `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue."] @@ -1846,6 +1853,7 @@ pub mod runtime_types { payload: ::std::vec::Vec<::core::primitive::u8>, gas_limit: ::core::primitive::u64, value: ::core::primitive::u128, + prepaid: ::core::primitive::bool, }, #[codec(index = 4)] #[doc = "Send reply on message in `Mailbox`."] @@ -1861,11 +1869,18 @@ pub mod runtime_types { #[doc = ""] #[doc = "NOTE: only user who is destination of the message, can claim value"] #[doc = "or reply on the message from mailbox."] + #[doc = ""] + #[doc = "If `prepaid` flag is set, the transaction fee and the gas cost will be"] + #[doc = "charged against a `voucher` that must have been issued for the sender"] + #[doc = "in conjunction with the mailboxed message source program. That means that the"] + #[doc = "synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must"] + #[doc = "exist and have sufficient funds in it. Otherwise, the call is invalidated."] send_reply { reply_to_id: runtime_types::gear_core::ids::MessageId, payload: ::std::vec::Vec<::core::primitive::u8>, gas_limit: ::core::primitive::u64, value: ::core::primitive::u128, + prepaid: ::core::primitive::bool, }, #[codec(index = 5)] #[doc = "Claim value from message in `Mailbox`."] @@ -1936,45 +1951,6 @@ pub mod runtime_types { session_id: ::core::primitive::u128, block_count: ::core::primitive::u32, }, - #[codec(index = 12)] - #[doc = "Sends a message to a program using pre-allocated funds."] - #[doc = ""] - #[doc = "The origin must be Signed and the sender must have been issued a `voucher` -"] - #[doc = "a record for the (`AccountId`, `ProgramId`) pair exists in the `Voucher` pallet"] - #[doc = "and the respective synthesize account for such pair has funds in it."] - #[doc = "The `gas` and transaction fees will, therefore, be paid from this synthesize account."] - #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `destination`: the message destination (must be an initialized program)."] - #[doc = "- `payload`: in case of a program destination, parameters of the `handle` function."] - #[doc = "- `gas_limit`: maximum amount of gas the program can spend before it is halted."] - #[doc = "- `value`: balance to be transferred to the program once it's been created."] - #[doc = ""] - #[doc = "Emits the following events:"] - #[doc = "- `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue."] - send_message_with_voucher { - destination: runtime_types::gear_core::ids::ProgramId, - payload: ::std::vec::Vec<::core::primitive::u8>, - gas_limit: ::core::primitive::u64, - value: ::core::primitive::u128, - }, - #[codec(index = 13)] - #[doc = "Sends the reply to a message in `Mailbox` using pre-allocated funds."] - #[doc = ""] - #[doc = "Removes message by given `MessageId` from callers `Mailbox`:"] - #[doc = "rent funds become free, associated with the message value"] - #[doc = "transfers from message sender to extrinsic caller."] - #[doc = ""] - #[doc = "Generates reply on removed message with given parameters"] - #[doc = "and pushes it in `MessageQueue`."] - #[doc = ""] - #[doc = "NOTE: source of the message in mailbox must be a program."] - send_reply_with_voucher { - reply_to_id: runtime_types::gear_core::ids::MessageId, - payload: ::std::vec::Vec<::core::primitive::u8>, - gas_limit: ::core::primitive::u64, - value: ::core::primitive::u128, - }, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] @@ -7794,8 +7770,6 @@ pub mod calls { ResumeSessionInit, ResumeSessionPush, ResumeSessionCommit, - SendMessageWithVoucher, - SendReplyWithVoucher, } impl CallInfo for GearCall { const PALLET: &'static str = "Gear"; @@ -7813,8 +7787,6 @@ pub mod calls { Self::ResumeSessionInit => "resume_session_init", Self::ResumeSessionPush => "resume_session_push", Self::ResumeSessionCommit => "resume_session_commit", - Self::SendMessageWithVoucher => "send_message_with_voucher", - Self::SendReplyWithVoucher => "send_reply_with_voucher", } } } diff --git a/gsdk/src/metadata/impls.rs b/gsdk/src/metadata/impls.rs index d2d88bfeb34..9f10d9aec80 100644 --- a/gsdk/src/metadata/impls.rs +++ b/gsdk/src/metadata/impls.rs @@ -219,6 +219,7 @@ fn gear_call_to_scale_value(call: GearCall) -> Value { payload, gas_limit, value, + prepaid, } => Value::named_variant( "send_message", [ @@ -226,6 +227,7 @@ fn gear_call_to_scale_value(call: GearCall) -> Value { ("payload", Value::from_bytes(payload)), ("gas_limit", Value::u128(gas_limit as u128)), ("value", Value::u128(value as u128)), + ("prepaid", Value::bool(prepaid)), ], ), GearCall::send_reply { @@ -233,6 +235,7 @@ fn gear_call_to_scale_value(call: GearCall) -> Value { payload, gas_limit, value, + prepaid, } => Value::named_variant( "send_reply", [ @@ -240,6 +243,7 @@ fn gear_call_to_scale_value(call: GearCall) -> Value { ("payload", Value::from_bytes(payload)), ("gas_limit", Value::u128(gas_limit as u128)), ("value", Value::u128(value as u128)), + ("prepaid", Value::bool(prepaid)), ], ), GearCall::claim_value { message_id } => Value::named_variant( diff --git a/gsdk/src/signer/calls.rs b/gsdk/src/signer/calls.rs index 80479d3306f..d7aef241e9f 100644 --- a/gsdk/src/signer/calls.rs +++ b/gsdk/src/signer/calls.rs @@ -109,6 +109,7 @@ impl Signer { payload: Vec, gas_limit: u64, value: u128, + prepaid: bool, ) -> Result { self.run_tx( GearCall::SendMessage, @@ -117,6 +118,7 @@ impl Signer { Value::from_bytes(payload), Value::u128(gas_limit as u128), Value::u128(value), + Value::bool(prepaid), ], ) .await @@ -129,6 +131,7 @@ impl Signer { payload: Vec, gas_limit: u64, value: u128, + prepaid: bool, ) -> Result { self.run_tx( GearCall::SendReply, @@ -137,6 +140,7 @@ impl Signer { Value::from_bytes(payload), Value::u128(gas_limit as u128), Value::u128(value), + Value::bool(prepaid), ], ) .await diff --git a/gsdk/tests/rpc.rs b/gsdk/tests/rpc.rs index a20c30644ba..8d4d111cd39 100644 --- a/gsdk/tests/rpc.rs +++ b/gsdk/tests/rpc.rs @@ -130,7 +130,7 @@ async fn test_calculate_handle_gas() -> Result<()> { .await?; signer - .send_message(pid, vec![], gas_info.min_limit, 0) + .send_message(pid, vec![], gas_info.min_limit, 0, false) .await?; Ok(()) @@ -164,7 +164,7 @@ async fn test_calculate_reply_gas() -> Result<()> { // 2. send wait message. signer - .send_message(pid, payload.encode(), 100_000_000_000, 0) + .send_message(pid, payload.encode(), 100_000_000_000, 0, false) .await?; let mailbox = signer @@ -180,7 +180,7 @@ async fn test_calculate_reply_gas() -> Result<()> { .await?; signer - .send_reply(message_id, vec![], gas_info.min_limit, 0) + .send_reply(message_id, vec![], gas_info.min_limit, 0, false) .await?; Ok(()) diff --git a/pallets/gear-debug/src/tests.rs b/pallets/gear-debug/src/tests.rs index 2fb9e2fca10..364135ee09b 100644 --- a/pallets/gear-debug/src/tests.rs +++ b/pallets/gear-debug/src/tests.rs @@ -88,6 +88,7 @@ fn vec() { 131072i32.encode(), 10_000_000_000, 0, + false, )); run_to_next_block(None); @@ -237,6 +238,7 @@ fn debug_mode_works() { vec![], 1_000_000_000_u64, 0_u128, + false, ) .expect("Failed to send message"); @@ -248,6 +250,7 @@ fn debug_mode_works() { vec![], 1_000_000_000_u64, 0_u128, + false, ) .expect("Failed to send message"); @@ -574,7 +577,8 @@ fn check_not_allocated_pages() { program_id, vec![], 5_000_000_000_u64, - 0_u128 + 0_u128, + false, )); run_to_block(3, None); @@ -807,7 +811,8 @@ fn check_changed_pages_in_storage() { program_id, vec![], 5_000_000_000_u64, - 0_u128 + 0_u128, + false, )); run_to_block(3, None); diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 65ac317ec71..f9a56de0a48 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -677,30 +677,10 @@ benchmarks! { let code = benchmarking::generate_wasm2(16.into()).unwrap(); benchmarking::set_program::, _>(program_id, code, 1.into()); let payload = vec![0_u8; p as usize]; + let prepaid = false; init_block::(None); - }: _(RawOrigin::Signed(caller), program_id, payload, 100_000_000_u64, minimum_balance) - verify { - assert!(matches!(QueueOf::::dequeue(), Ok(Some(_)))); - } - - send_message_with_voucher { - let p in 0 .. MAX_PAYLOAD_LEN; - - let caller = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); - let minimum_balance = ::Currency::minimum_balance(); - let program_id = ProgramId::from_origin(benchmarking::account::("program", 0, 100).into_origin()); - let code = benchmarking::generate_wasm2(16.into()).unwrap(); - benchmarking::set_program::, _>(program_id, code, 1.into()); - let payload = vec![0_u8; p as usize]; - - // Add voucher for the (caller, program_id) pair - let voucher_id = pallet_gear_voucher::Pallet::::voucher_account_id(&caller, &program_id); - ::Currency::deposit_creating(&voucher_id, 100_000_000_000_000_u128.unique_saturated_into()); - - init_block::(None); - }: _(RawOrigin::Signed(caller), program_id, payload, 100_000_000_u64, minimum_balance) + }: _(RawOrigin::Signed(caller), program_id, payload, 100_000_000_u64, minimum_balance, prepaid) verify { assert!(matches!(QueueOf::::dequeue(), Ok(Some(_)))); } @@ -728,45 +708,10 @@ benchmarks! { None, ).try_into().unwrap_or_else(|_| unreachable!("Signal message sent to user")), u32::MAX.unique_saturated_into()).expect("Error during mailbox insertion"); let payload = vec![0_u8; p as usize]; + let prepaid = false; init_block::(None); - }: _(RawOrigin::Signed(caller.clone()), original_message_id, payload, 100_000_000_u64, minimum_balance) - verify { - assert!(matches!(QueueOf::::dequeue(), Ok(Some(_)))); - assert!(MailboxOf::::is_empty(&caller)) - } - - send_reply_with_voucher { - let p in 0 .. MAX_PAYLOAD_LEN; - let caller = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); - let minimum_balance = ::Currency::minimum_balance(); - let program_id = benchmarking::account::("program", 0, 100); - ::Currency::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into()); - let code = benchmarking::generate_wasm2(16.into()).unwrap(); - benchmarking::set_program::, _>(ProgramId::from_origin(program_id.clone().into_origin()), code, 1.into()); - let original_message_id = MessageId::from_origin(benchmarking::account::("message", 0, 100).into_origin()); - let gas_limit = 50000; - let value = (p % 2).into(); - GasHandlerOf::::create(program_id.clone(), original_message_id, gas_limit).expect("Failed to create gas handler"); - ::Currency::reserve(&program_id, ::GasPrice::gas_price(gas_limit) + value).expect("Failed to reserve"); - let program_id = ProgramId::from_origin(program_id.into_origin()); - MailboxOf::::insert(gear_core::message::StoredMessage::new( - original_message_id, - program_id, - ProgramId::from_origin(caller.clone().into_origin()), - Default::default(), - value.unique_saturated_into(), - None, - ).try_into().unwrap_or_else(|_| unreachable!("Signal message sent to user")), u32::MAX.unique_saturated_into()).expect("Error during mailbox insertion"); - let payload = vec![0_u8; p as usize]; - - // Add voucher for the (caller, program_id) pair - let voucher_id = pallet_gear_voucher::Pallet::::voucher_account_id(&caller, &program_id); - ::Currency::deposit_creating(&voucher_id, 100_000_000_000_000_u128.unique_saturated_into()); - - init_block::(None); - }: _(RawOrigin::Signed(caller.clone()), original_message_id, payload, 100_000_000_u64, minimum_balance) + }: _(RawOrigin::Signed(caller.clone()), original_message_id, payload, 100_000_000_u64, minimum_balance, prepaid) verify { assert!(matches!(QueueOf::::dequeue(), Ok(Some(_)))); assert!(MailboxOf::::is_empty(&caller)) diff --git a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs index 28b949bbff4..2b92e986150 100644 --- a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs +++ b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs @@ -331,6 +331,7 @@ where b"".to_vec(), 50_000_000_000, 0u128.unique_saturated_into(), + false, // call is not prepaid by issuing a voucher ) .expect("failed to send message to test program"); utils::run_to_next_block::(None); @@ -685,6 +686,7 @@ where vec![Kind::ReplyDetails([255u8; 32], reply_code)].encode(), 50_000_000_000, 0u128.unique_saturated_into(), + false, // call is not prepaid by issuing a voucher ) .expect("triggering message send to mailbox failed"); @@ -723,6 +725,7 @@ where vec![Kind::SignalDetails].encode(), 50_000_000_000, 0u128.unique_saturated_into(), + false, // call is not prepaid by issuing a voucher ) .expect("triggering message send to mailbox failed"); @@ -926,6 +929,7 @@ where mp.payload, 50_000_000_000, mp.value.unique_saturated_into(), + false, // call is not prepaid by issuing a voucher ) .expect("failed send message"); } @@ -937,6 +941,7 @@ where rp.payload, 50_000_000_000, rp.value.unique_saturated_into(), + false, // call is not prepaid by issuing a voucher ) .expect("failed send reply"); } diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index da400d184d8..e1a71c9b211 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -1473,11 +1473,18 @@ pub mod pallet { /// is not a program in uninitialized state. If the opposite holds true, /// the message is not enqueued for processing. /// + /// If `prepaid` flag is set, the transaction fee and the gas cost will be + /// charged against a `voucher` that must have been issued for the sender + /// in conjunction with the `destination` program. That means that the + /// synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must + /// exist and have sufficient funds in it. Otherwise, the call is invalidated. + /// /// Parameters: /// - `destination`: the message destination. /// - `payload`: in case of a program destination, parameters of the `handle` function. /// - `gas_limit`: maximum amount of gas the program can spend before it is halted. /// - `value`: balance to be transferred to the program once it's been created. + /// - `prepaid`: a flag that indicates whether a voucher should be used. /// /// Emits the following events: /// - `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue. @@ -1489,6 +1496,7 @@ pub mod pallet { payload: Vec, gas_limit: u64, value: BalanceOf, + prepaid: bool, ) -> DispatchResultWithPostInfo { let payload = payload .try_into() @@ -1514,16 +1522,33 @@ pub mod pallet { // Message is not guaranteed to be executed, that's why value is not immediately transferred. // That's because destination can fail to be initialized, while this dispatch message is next // in the queue. + // Note: reservaton is always made against the user's account regardless whether + // a voucher exists. The latter can only be used to pay for gas or transaction fee. CurrencyOf::::reserve(&who, value.unique_saturated_into()) .map_err(|_| Error::::InsufficientBalance)?; let gas_limit_reserve = T::GasPrice::gas_price(gas_limit); - // First we reserve enough funds on the account to pay for `gas_limit` - CurrencyOf::::reserve(&who, gas_limit_reserve) - .map_err(|_| Error::::InsufficientBalance)?; + let external_node = if prepaid { + // If voucher is used, we attempt to reserve funds on the respective account. + // If no such voucher exists, the call is invalidated. + VoucherOf::::redeem_with_id(who.clone(), destination, gas_limit_reserve) + .map_err(|_| { + log::error!( + "Failed to redeem voucher for user {:?} and program {:?}", + who, + destination, + ); + Error::::FailureRedeemingVoucher + })? + } else { + // If voucher is not used, we reserve gas limit on the user's account. + CurrencyOf::::reserve(&who, gas_limit_reserve) + .map_err(|_| Error::::InsufficientBalance)?; + who.clone() + }; - Self::create(who.clone(), message.id(), gas_limit, false); + Self::create(external_node, message.id(), gas_limit, false); let message = message.into_stored_dispatch(ProgramId::from_origin(origin)); @@ -1573,14 +1598,27 @@ pub mod pallet { /// /// NOTE: only user who is destination of the message, can claim value /// or reply on the message from mailbox. + /// + /// If `prepaid` flag is set, the transaction fee and the gas cost will be + /// charged against a `voucher` that must have been issued for the sender + /// in conjunction with the mailboxed message source program. That means that the + /// synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must + /// exist and have sufficient funds in it. Otherwise, the call is invalidated. #[pallet::call_index(4)] - #[pallet::weight(::WeightInfo::send_reply(payload.len() as u32))] + #[pallet::weight(::WeightInfo::send_reply(payload.len() as u32) + if *prepaid { + Weight::zero() + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(1_u64)) + } else { + Weight::zero() + })] pub fn send_reply( origin: OriginFor, reply_to_id: MessageId, payload: Vec, gas_limit: u64, value: BalanceOf, + prepaid: bool, ) -> DispatchResultWithPostInfo { // Validating origin. let origin = ensure_signed(origin)?; @@ -1598,11 +1636,10 @@ pub mod pallet { Self::check_gas_limit_and_value(gas_limit, value)?; + let destination = mailboxed.source(); + // Checking that program, origin replies to, is not terminated. - ensure!( - Self::is_active(mailboxed.source()), - Error::::InactiveProgram - ); + ensure!(Self::is_active(destination), Error::::InactiveProgram); let reply_id = MessageId::generate_reply(mailboxed.id()); @@ -1616,12 +1653,35 @@ pub mod pallet { // Converting applied gas limit into value to reserve. let gas_limit_reserve = T::GasPrice::gas_price(gas_limit); - // Reserving funds for gas limit and value sending. - // - // Note, that message is not guaranteed to be successfully executed, - // that's why value is not immediately transferred. - CurrencyOf::::reserve(&origin, gas_limit_reserve + value) - .map_err(|_| Error::::InsufficientBalance)?; + let external_node = if prepaid { + // Reserving funds for sending `value` on the sender's account + // even though a voucher is supposed to be used. + // + // Note, that message is not guaranteed to be successfully executed, + // that's why value is not immediately transferred. + CurrencyOf::::reserve(&origin, value) + .map_err(|_| Error::::InsufficientBalance)?; + VoucherOf::::redeem_with_id(origin.clone(), destination, gas_limit_reserve) + .map_err(|_| { + log::error!( + "Failed to redeem voucher for user {:?} and program {:?}", + origin, + destination, + ); + Error::::FailureRedeemingVoucher + })? + } else { + // Reserving funds for both gas limit and value sending on the sender's account. + // + // Note, that message is not guaranteed to be successfully executed, + // that's why value is not immediately transferred. + CurrencyOf::::reserve(&origin, gas_limit_reserve + value) + .map_err(|_| Error::::InsufficientBalance)?; + origin.clone() + }; + + // Following up with a gas node creation. + Self::create(external_node, reply_id, gas_limit, true); // Creating reply message. let message = ReplyMessage::from_packet( @@ -1629,12 +1689,10 @@ pub mod pallet { ReplyPacket::new_with_gas(payload, gas_limit, value.unique_saturated_into()), ); - Self::create(origin.clone(), message.id(), gas_limit, true); - // Converting reply message into appropriate type for queueing. let dispatch = message.into_stored_dispatch( ProgramId::from_origin(origin.clone().into_origin()), - mailboxed.source(), + destination, mailboxed.id(), ); @@ -1916,203 +1974,6 @@ pub mod pallet { Ok(().into()) } - - /// Sends a message to a program using pre-allocated funds. - /// - /// The origin must be Signed and the sender must have been issued a `voucher` - - /// a record for the (`AccountId`, `ProgramId`) pair exists in the `Voucher` pallet - /// and the respective synthesize account for such pair has funds in it. - /// The `gas` and transaction fees will, therefore, be paid from this synthesize account. - /// - /// Parameters: - /// - `destination`: the message destination (must be an initialized program). - /// - `payload`: in case of a program destination, parameters of the `handle` function. - /// - `gas_limit`: maximum amount of gas the program can spend before it is halted. - /// - `value`: balance to be transferred to the program once it's been created. - /// - /// Emits the following events: - /// - `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue. - #[pallet::call_index(12)] - #[pallet::weight(::WeightInfo::send_message_with_voucher(payload.len() as u32))] - pub fn send_message_with_voucher( - origin: OriginFor, - destination: ProgramId, - payload: Vec, - gas_limit: u64, - value: BalanceOf, - ) -> DispatchResultWithPostInfo { - let payload = payload - .try_into() - .map_err(|err: PayloadSizeError| DispatchError::Other(err.into()))?; - let who = ensure_signed(origin)?; - let origin = who.clone().into_origin(); - - Self::check_gas_limit_and_value(gas_limit, value)?; - - let message = HandleMessage::from_packet( - Self::next_message_id(origin), - HandlePacket::new_with_gas( - destination, - payload, - gas_limit, - value.unique_saturated_into(), - ), - ); - - ensure!( - Self::program_exists(destination) && Self::is_active(destination), - Error::::InactiveProgram - ); - - // Message is not guaranteed to be executed, that's why value is not immediately - // transferred. That's because destination can fail to be initialized by the time - // this dispatch message is next in the queue. - // - // Note: reservaton is made from the user's account as voucher can only be used - // to pay for gas or settle transaction fees, but not as source for value transfer. - CurrencyOf::::reserve(&who, value.unique_saturated_into()) - .map_err(|_| Error::::InsufficientBalance)?; - - let gas_limit_reserve = T::GasPrice::gas_price(gas_limit); - - // We attempt to reserve enough funds using the voucher that should have been issued - // for the transaction sender to pay for the gas. If no such voucher exists, the call - // will fail. - // If successful, Currency will be reserved on the voucher's account. - let voucher_id = - VoucherOf::::redeem_with_id(who.clone(), destination, gas_limit_reserve) - .map_err(|_| { - log::debug!( - "Failed to redeem voucher for user {:?} and program {:?}", - who, - destination, - ); - Error::::FailureRedeemingVoucher - })?; - - // Using the `voucher_id` as the external origin to create the gas node in order for - // the leftover being refunded back to the voucher account and not the user's account. - Self::create(voucher_id, message.id(), gas_limit, false); - - let message = message.into_stored_dispatch(ProgramId::from_origin(origin)); - - Self::deposit_event(Event::MessageQueued { - id: message.id(), - source: who, - destination: message.destination(), - entry: MessageEntry::Handle, - }); - - QueueOf::::queue(message).map_err(|_| Error::::MessagesStorageCorrupted)?; - - Ok(().into()) - } - - /// Sends the reply to a message in `Mailbox` using pre-allocated funds. - /// - /// Removes message by given `MessageId` from callers `Mailbox`: - /// rent funds become free, associated with the message value - /// transfers from message sender to extrinsic caller. - /// - /// Generates reply on removed message with given parameters - /// and pushes it in `MessageQueue`. - /// - /// NOTE: source of the message in mailbox must be a program. - #[pallet::call_index(13)] - #[pallet::weight(::WeightInfo::send_reply(payload.len() as u32))] - pub fn send_reply_with_voucher( - origin: OriginFor, - reply_to_id: MessageId, - payload: Vec, - gas_limit: u64, - value: BalanceOf, - ) -> DispatchResultWithPostInfo { - // Validating origin. - let origin = ensure_signed(origin)?; - - let payload = payload - .try_into() - .map_err(|err: PayloadSizeError| DispatchError::Other(err.into()))?; - - // Reason for reading from mailbox. - let reason = UserMessageReadRuntimeReason::MessageReplied.into_reason(); - - // Reading message, if found, or failing extrinsic. - let mailboxed = Self::read_message(origin.clone(), reply_to_id, reason) - .ok_or(Error::::MessageNotFound)?; - - Self::check_gas_limit_and_value(gas_limit, value)?; - - let destination = mailboxed.source(); - - // Checking that program, origin replies to, is not terminated. - ensure!(Self::is_active(destination), Error::::InactiveProgram); - - // Reserving funds for sending `value`. The funds are reserved on the - // account of the reply sender. - // - // Note, that message is not guaranteed to be successfully executed, - // that's why value is not immediately transferred. - CurrencyOf::::reserve(&origin, value) - .map_err(|_| Error::::InsufficientBalance)?; - - let reply_id = MessageId::generate_reply(mailboxed.id()); - - // Set zero gas limit if reply deposit exists. - let gas_limit = if GasHandlerOf::::exists_and_deposit(reply_id) { - 0 - } else { - gas_limit - }; - - // Converting applied gas limit into value to reserve. - let gas_limit_reserve = T::GasPrice::gas_price(gas_limit); - - // Redeeming voucher to pay for gas. - // Currency will be reserved on the voucher's account as a result of this call. - let voucher_id = - VoucherOf::::redeem_with_id(origin.clone(), destination, gas_limit_reserve) - .map_err(|_| { - log::debug!( - "Failed to redeem voucher for user {:?} and program {:?}", - origin, - destination, - ); - Error::::FailureRedeemingVoucher - })?; - - // Creating reply message. - let message = ReplyMessage::from_packet( - reply_id, - ReplyPacket::new_with_gas(payload, gas_limit, value.unique_saturated_into()), - ); - - Self::create(voucher_id, message.id(), gas_limit, true); - - // Converting reply message into appropriate type for queueing. - let dispatch = message.into_stored_dispatch( - ProgramId::from_origin(origin.clone().into_origin()), - destination, - mailboxed.id(), - ); - - // Pre-generating appropriate event to avoid dispatch cloning. - let event = Event::MessageQueued { - id: dispatch.id(), - source: origin, - destination: dispatch.destination(), - entry: MessageEntry::Reply(mailboxed.id()), - }; - - // Queueing dispatch. - QueueOf::::queue(dispatch) - .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)); - - // Depositing pre-generated event. - Self::deposit_event(event); - - Ok(().into()) - } } impl QueueRunner for Pallet diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index 89a75ddac54..96793ae3b51 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -73,14 +73,16 @@ where })?; } HandleKind::Handle(destination) => { - Self::send_message(who.into(), destination, payload, initial_gas, value).map_err( - |e| format!("Internal error: send_message failed with '{e:?}'").into_bytes(), - )?; + Self::send_message(who.into(), destination, payload, initial_gas, value, false) + .map_err(|e| { + format!("Internal error: send_message failed with '{e:?}'").into_bytes() + })?; } HandleKind::Reply(reply_to_id, _status_code) => { - Self::send_reply(who.into(), reply_to_id, payload, initial_gas, value).map_err( - |e| format!("Internal error: send_reply failed with '{e:?}'").into_bytes(), - )?; + Self::send_reply(who.into(), reply_to_id, payload, initial_gas, value, false) + .map_err(|e| { + format!("Internal error: send_reply failed with '{e:?}'").into_bytes() + })?; } HandleKind::Signal(_signal_from, _status_code) => { return Err(b"Gas calculation for `handle_signal` is not supported".to_vec()); diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 16402a10df0..4866c670d49 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -162,7 +162,8 @@ fn read_big_state() { pid, strings.encode(), BlockGasLimitOf::::get(), - 0 + 0, + false, )); let mid = get_last_message_id(); @@ -201,6 +202,7 @@ fn auto_reply_sent() { EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), 10_000, + false, )); run_to_next_block(None); @@ -230,6 +232,7 @@ fn auto_reply_sent() { EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), 0, + false, )); System::reset_events(); @@ -258,6 +261,7 @@ fn auto_reply_from_user_no_mailbox() { calls.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -282,6 +286,7 @@ fn auto_reply_from_user_no_mailbox() { calls.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -357,6 +362,7 @@ fn auto_reply_out_of_rent_waitlist() { Command::Wait(WaitSubcommand::Wait).encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -405,6 +411,7 @@ fn auto_reply_out_of_rent_mailbox() { EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), 0, + false, )); let message_id = utils::get_last_message_id(); @@ -468,6 +475,7 @@ fn reply_deposit_to_program() { 10_000_000_000u64.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -499,6 +507,7 @@ fn reply_deposit_to_user_auto_reply() { 10_000_000_000u64.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -530,6 +539,7 @@ fn reply_deposit_panic_in_handle_reply() { 1u64.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -563,6 +573,7 @@ fn reply_deposit_to_user_reply() { reply_deposit.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -594,6 +605,7 @@ fn reply_deposit_to_user_reply() { vec![], BlockGasLimitOf::::get(), value, + false, )); assert_eq!(get_last_message_id(), reply_id); @@ -638,6 +650,7 @@ fn reply_deposit_to_user_claim() { reply_deposit.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -704,6 +717,7 @@ fn reply_deposit_to_user_out_of_rent() { reply_deposit.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -777,6 +791,7 @@ fn reply_deposit_gstd_async() { hello.to_vec(), 30_000_000_000, 0, + false, )); let handle_id = get_last_message_id(); @@ -794,6 +809,7 @@ fn reply_deposit_gstd_async() { hello_reply.to_vec(), 0, 0, + false, )); run_to_next_block(None); @@ -825,6 +841,7 @@ fn pseudo_duplicate_wake() { calls.encode(), BlockGasLimitOf::::get(), 0, + false, )); let msg_id = get_last_message_id(); run_to_next_block(None); @@ -1040,6 +1057,7 @@ fn waited_with_zero_gas() { EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT * 100, 0, + false, )); run_to_next_block(None); @@ -1086,6 +1104,7 @@ fn terminated_program_zero_gas() { EMPTY_PAYLOAD.to_vec(), 0, 0, + false, )); run_to_next_block(None); @@ -1131,6 +1150,7 @@ fn exited_program_zero_gas() { EMPTY_PAYLOAD.to_vec(), 0, 0, + false, )); run_to_next_block(None); @@ -1160,6 +1180,7 @@ fn delayed_user_replacement() { gas_limit_to_forward.encode(), // to be forwarded as gas limit gas_limit_to_forward + DEFAULT_GAS_LIMIT * 100, 100_000_000, // before fix to be forwarded as value + false, )); let message_id = utils::get_last_message_id(); @@ -1250,6 +1271,7 @@ fn delayed_send_user_message_payment() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, + false, )); let proxy_msg_id = get_last_message_id(); @@ -1349,6 +1371,7 @@ fn delayed_send_user_message_with_reservation() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, + false, )); let proxy_msg_id = get_last_message_id(); @@ -1457,6 +1480,7 @@ fn delayed_send_program_message_payment() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, + false, )); let proxy_msg_id = utils::get_last_message_id(); @@ -1558,6 +1582,7 @@ fn delayed_send_program_message_with_reservation() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, + false, )); let proxy_msg_id = utils::get_last_message_id(); @@ -1668,6 +1693,7 @@ fn delayed_send_program_message_with_low_reservation() { 0u64.encode(), DEFAULT_GAS_LIMIT * 100, 0, + false, )); let proxy_msg_id = utils::get_last_message_id(); @@ -1868,6 +1894,7 @@ fn unstoppable_block_execution_works() { EMPTY_PAYLOAD.to_vec(), gas_for_each_execution, 0, + false, )); } @@ -2377,7 +2404,8 @@ fn mailbox_sending_instant_transfer() { sender, payload.request(USER_2.into_origin()).encode(), gas_info.burned + gas_limit.unwrap_or_default(), - 0 + 0, + false, )); utils::assert_balance( @@ -2502,6 +2530,7 @@ fn send_message_works() { EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT, mail_value, + false, )); let message_id = get_last_message_id(); @@ -2581,6 +2610,7 @@ fn mailbox_threshold_works() { (rent - 1).encode(), BlockGasLimitOf::::get(), 0, + false, )); check_result(false); @@ -2591,6 +2621,7 @@ fn mailbox_threshold_works() { (rent).encode(), BlockGasLimitOf::::get(), 0, + false, )); let message_id = check_result(true); @@ -2601,6 +2632,7 @@ fn mailbox_threshold_works() { rent.encode(), BlockGasLimitOf::::get(), 0, + false, )); let message_id = check_result(true); @@ -2611,6 +2643,7 @@ fn mailbox_threshold_works() { (rent - 1).encode(), BlockGasLimitOf::::get(), 0, + false, )); check_result(false); }); @@ -2692,7 +2725,8 @@ fn send_message_expected_failure() { USER_1.into(), EMPTY_PAYLOAD.to_vec(), 10, - value + value, + false, )); // And no message will be in mailbox @@ -2713,7 +2747,8 @@ fn send_message_expected_failure() { program_id, EMPTY_PAYLOAD.to_vec(), block_gas_limit + 1, - 0 + 0, + false, ), Error::::GasLimitTooHigh ); @@ -2799,7 +2834,8 @@ fn unused_gas_released_back_works() { program_id, EMPTY_PAYLOAD.to_vec(), huge_send_message_gas_limit, - 0 + 0, + false, )); // Spends for submit program with default gas limit and sending default message with a huge gas limit @@ -3084,6 +3120,7 @@ fn memory_access_cases() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, + false, ); assert_ok!(res); @@ -3098,6 +3135,7 @@ fn memory_access_cases() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, + false, ); assert_ok!(res); @@ -3184,6 +3222,7 @@ fn lazy_pages() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 1000, + false, ); assert_ok!(res); @@ -3439,7 +3478,8 @@ fn block_gas_limit_works() { pid1, EMPTY_PAYLOAD.to_vec(), gas1.min_limit - 1, - 1000 + 1000, + false, )); let failed1 = get_last_message_id(); @@ -3448,7 +3488,8 @@ fn block_gas_limit_works() { pid1, EMPTY_PAYLOAD.to_vec(), gas1.min_limit, - 1000 + 1000, + false, )); let succeed1 = get_last_message_id(); @@ -3457,7 +3498,8 @@ fn block_gas_limit_works() { pid2, EMPTY_PAYLOAD.to_vec(), gas2.min_limit - 1, - 1000 + 1000, + false, )); let failed2 = get_last_message_id(); @@ -3466,7 +3508,8 @@ fn block_gas_limit_works() { pid2, EMPTY_PAYLOAD.to_vec(), gas2.min_limit, - 1000 + 1000, + false, )); let succeed2 = get_last_message_id(); @@ -3496,7 +3539,8 @@ fn block_gas_limit_works() { pid, EMPTY_PAYLOAD.to_vec(), gas.min_limit, - 1000 + 1000, + false, )); }; @@ -3835,6 +3879,7 @@ fn send_reply_works() { EMPTY_PAYLOAD.to_vec(), 10_000_000, 1000, // `prog_id` sent message with value of 1000 (see program code) + false, )); let expected_reply_message_id = get_last_message_id(); @@ -3869,7 +3914,8 @@ fn send_reply_failure_to_claim_from_mailbox() { MessageId::from_origin(5.into_origin()), // non existent `reply_to_id` EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT, - 0 + 0, + false, ), Error::::MessageNotFound ); @@ -3958,6 +4004,7 @@ fn send_reply_value_claiming_works() { EMPTY_PAYLOAD.to_vec(), gas_limit_to_reply, value_to_reply, + false, )); let currently_sent = value_to_reply + GasPrice::gas_price(gas_limit_to_reply); @@ -4109,6 +4156,7 @@ fn uninitialized_program_zero_gas() { vec![], 0, // that triggers unreachable code atm 0, + false, )); run_to_block(3, None); @@ -4173,6 +4221,7 @@ fn distributor_distribute() { Request::Receive(10).encode(), 30_000_000_000, 0, + false, )); run_to_block(3, None); @@ -4370,7 +4419,8 @@ fn messages_to_uninitialized_program_wait() { program_id, vec![], 10_000u64, - 0u128 + 0u128, + false, )); run_to_block(3, None); @@ -4419,6 +4469,7 @@ fn uninitialized_program_should_accept_replies() { b"PONG".to_vec(), 10_000_000_000u64, 0, + false, )); run_to_block(3, None); @@ -4459,6 +4510,7 @@ fn defer_program_initialization() { b"PONG".to_vec(), 10_000_000_000u64, 0, + false, )); run_to_block(3, None); @@ -4468,7 +4520,8 @@ fn defer_program_initialization() { program_id, vec![], 10_000_000_000u64, - 0u128 + 0u128, + false, )); run_to_block(4, None); @@ -4513,7 +4566,8 @@ fn wake_messages_after_program_inited() { program_id, vec![], 5_000_000_000u64, - 0u128 + 0u128, + false, )); } @@ -4530,6 +4584,7 @@ fn wake_messages_after_program_inited() { b"PONG".to_vec(), 20_000_000_000u64, 0, + false, )); run_to_block(20, None); @@ -4611,7 +4666,8 @@ fn test_different_waits_success() { program_id, payload, gas_info.burned + wl_gas + system_reservation, - value + value, + false, )); let wait_success = get_last_message_id(); @@ -4643,7 +4699,8 @@ fn test_different_waits_success() { program_id, payload, gas_info.burned + wl_gas + system_reservation, - value + value, + false, )); let wait_for_success = get_last_message_id(); @@ -4678,7 +4735,8 @@ fn test_different_waits_success() { program_id, payload, gas_info.burned + wl_gas + system_reservation, - value + value, + false, )); let wait_up_to_success = get_last_message_id(); @@ -4737,7 +4795,8 @@ fn test_different_waits_fail() { program_id, payload, gas_info.burned + wl_gas + system_reservation, - value + value, + false, )); let wait_gas = get_last_message_id(); @@ -4773,7 +4832,8 @@ fn test_different_waits_fail() { program_id, payload, gas_info.burned + wl_gas + system_reservation, - value + value, + false, )); let wait_for_gas = get_last_message_id(); @@ -4809,7 +4869,8 @@ fn test_different_waits_fail() { program_id, payload, gas_info.burned + wl_gas + system_reservation, - value + value, + false, )); let wait_up_to_gas = get_last_message_id(); @@ -4846,7 +4907,8 @@ fn test_different_waits_fail() { program_id, payload, gas_info.burned + wl_gas + system_reservation, - value + value, + false, )); let wait_for_arg = get_last_message_id(); @@ -4883,7 +4945,8 @@ fn test_different_waits_fail() { program_id, payload, gas_info.burned + wl_gas + system_reservation, - value + value, + false, )); let wait_up_to_arg = get_last_message_id(); @@ -4926,7 +4989,8 @@ fn wait_after_reply() { program_id, Command::ReplyAndWait(subcommand).encode(), BlockGasLimitOf::::get(), - 0 + 0, + false, )); let message_id = utils::get_last_message_id(); @@ -4977,6 +5041,7 @@ fn test_requeue_after_wait_for_timeout() { payload, 30_000_000_000, 0, + false, )); // Fast forward blocks. @@ -5048,6 +5113,7 @@ fn test_sending_waits() { payload, 25_000_000_000, 0, + false, )); let wait_for = get_last_message_id(); @@ -5066,6 +5132,7 @@ fn test_sending_waits() { payload, 25_000_000_000, 0, + false, )); let wait_no_more = get_last_message_id(); @@ -5084,6 +5151,7 @@ fn test_sending_waits() { payload, 30_000_000_000, 0, + false, )); let wait_wait = get_last_message_id(); @@ -5102,6 +5170,7 @@ fn test_sending_waits() { vec![], 10_000_000_000, 0, + false, )); run_to_next_block(None); @@ -5143,6 +5212,7 @@ fn test_wait_timeout() { payload, 30_000_000_000, 0, + false, )); run_to_next_block(None); @@ -5156,6 +5226,7 @@ fn test_wait_timeout() { Command::Wake.encode(), 10_000_000, 0, + false, )); run_to_next_block(None); @@ -5199,6 +5270,7 @@ fn test_join_wait_timeout() { payload, 30_000_000_000, 0, + false, )); run_to_next_block(None); @@ -5257,6 +5329,7 @@ fn test_select_wait_timeout() { payload, 30_000_000_000, 0, + false, )); run_to_next_block(None); @@ -5302,6 +5375,7 @@ fn test_wait_lost() { payload, 30_000_000_000, 0, + false, )); run_to_next_block(None); @@ -5313,7 +5387,8 @@ fn test_wait_lost() { msg.id(), b"ping".to_vec(), 100_000_000, - 0 + 0, + false, )); true @@ -5369,7 +5444,8 @@ fn test_message_processing_for_non_existing_destination() { program_id, EMPTY_PAYLOAD.to_vec(), 10_000, - 1_000 + 1_000, + false, )); let skipped_message_id = get_last_message_id(); @@ -5409,7 +5485,8 @@ fn exit_locking_funds() { program_id, calls.encode(), 10_000_000_000, - value + value, + false, )); let message_1 = utils::get_last_message_id(); @@ -5419,7 +5496,8 @@ fn exit_locking_funds() { program_id, calls.encode(), 10_000_000_000, - 0 + 0, + false, )); let message_2 = utils::get_last_message_id(); @@ -5563,7 +5641,8 @@ fn terminated_locking_funds() { message_to_reply, EMPTY_PAYLOAD.to_vec(), gas_spent_reply, - 0 + 0, + false, )); let reply_id = get_last_message_id(); @@ -5733,6 +5812,7 @@ fn test_create_program_works() { // Calculate the gas spent after #1242. 10_000_000_000u64, 0, + false, )); run_to_next_block(None); @@ -5776,6 +5856,7 @@ fn test_create_program_no_code_hash() { CreateProgram::Default.encode(), 50_000_000_000, 0, + false, )); run_to_block(2, None); @@ -5800,6 +5881,7 @@ fn test_create_program_no_code_hash() { .encode(), 100_000_000_000, 0, + false, )); run_to_block(3, None); @@ -5830,6 +5912,7 @@ fn test_create_program_no_code_hash() { .encode(), 100_000_000_000, 0, + false, )); run_to_block(4, None); @@ -5872,6 +5955,7 @@ fn test_create_program_simple() { CreateProgram::Default.encode(), 50_000_000_000, 0, + false, )); run_to_block(3, None); @@ -5885,6 +5969,7 @@ fn test_create_program_simple() { .encode(), 10_000_000_000, 0, + false, )); run_to_block(4, None); @@ -5906,6 +5991,7 @@ fn test_create_program_simple() { .encode(), 50_000_000_000, 0, + false, )); run_to_block(5, None); @@ -5920,6 +6006,7 @@ fn test_create_program_simple() { .encode(), 50_000_000_000, 0, + false, )); run_to_block(6, None); @@ -5964,6 +6051,7 @@ fn test_pausing_programs_works() { .encode(), 50_000_000_000, 0, + false, )); run_to_next_block(None); @@ -6143,7 +6231,8 @@ fn state_request() { program_id, Request::Insert(key, value).encode(), 1_000_000_000, - 0 + 0, + false, )); } @@ -6189,7 +6278,8 @@ fn resume_session_push_works() { program_id, request, 1_000_000_000, - 0 + 0, + false, )); run_to_next_block(None); @@ -6302,7 +6392,8 @@ fn resume_program_works() { program_id, request, 10_000_000_000, - 0 + 0, + false, )); run_to_next_block(None); @@ -6464,7 +6555,8 @@ fn resume_program_works() { program_id, request, 10_000_000_000, - 0 + 0, + false, )); run_to_next_block(None); @@ -6498,6 +6590,7 @@ fn test_no_messages_to_paused_program() { demo_wait_wake::Request::EchoWait(10).encode(), 50_000_000_000, 0, + false, )); run_to_next_block(None); @@ -6598,6 +6691,7 @@ fn uninitialized_program_terminates_on_pause() { b"0123456789".to_vec(), 50_000_000_000, 0, + false, )); run_to_next_block(None); @@ -6689,6 +6783,7 @@ fn pay_program_rent_syscall_works() { .encode(), 20_000_000_000, 0, + false, )); run_to_next_block(None); @@ -6712,6 +6807,7 @@ fn pay_program_rent_syscall_works() { vec![Kind::PayProgramRent([0u8; 32], rent, None)].encode(), 20_000_000_000, 0, + false, )); run_to_next_block(None); @@ -6730,6 +6826,7 @@ fn pay_program_rent_syscall_works() { .encode(), 20_000_000_000, 0, + false, )); let message_id = get_last_message_id(); @@ -6775,6 +6872,7 @@ fn pay_program_rent_syscall_works() { .encode(), 20_000_000_000, Gear::rent_fee_for(u32::MAX), + false, )); let message_id = get_last_message_id(); @@ -6811,6 +6909,7 @@ fn pay_program_rent_syscall_works() { .encode(), 20_000_000_000, required_value, + false, )); let message_id = get_last_message_id(); @@ -6962,6 +7061,7 @@ fn test_create_program_duplicate() { .encode(), 20_000_000_000, 0, + false, )); run_to_block(4, None); @@ -6982,6 +7082,7 @@ fn test_create_program_duplicate() { .encode(), 20_000_000_000, 0, + false, )); run_to_block(5, None); @@ -6993,6 +7094,7 @@ fn test_create_program_duplicate() { .encode(), 20_000_000_000, 0, + false, )); run_to_block(6, None); @@ -7053,6 +7155,7 @@ fn test_create_program_duplicate_in_one_execution() { .encode(), 20_000_000_000, 0, + false, )); run_to_block(3, None); @@ -7072,6 +7175,7 @@ fn test_create_program_duplicate_in_one_execution() { .encode(), 20_000_000_000, 0, + false, )); run_to_block(4, None); @@ -7141,6 +7245,7 @@ fn test_create_program_miscellaneous() { .encode(), 50_000_000_000, 0, + false, )); run_to_block(3, None); @@ -7158,6 +7263,7 @@ fn test_create_program_miscellaneous() { .encode(), 50_000_000_000, 0, + false, )); run_to_block(4, None); @@ -7174,6 +7280,7 @@ fn test_create_program_miscellaneous() { .encode(), 50_000_000_000, 0, + false, )); run_to_block(5, None); @@ -7199,7 +7306,8 @@ fn exit_handle() { program_id, vec![], 50_000_000_000u64, - 0u128 + 0u128, + false, )); run_to_block(3, None); @@ -7252,6 +7360,7 @@ fn no_redundant_gas_value_after_exiting() { EMPTY_PAYLOAD.to_vec(), gas_spent, 0, + false, )); let msg_id = get_last_message_id(); @@ -7312,7 +7421,8 @@ fn init_wait_reply_exit_cleaned_storage() { pid, vec![], 10_000u64, - 0u128 + 0u128, + false, )); } @@ -7336,6 +7446,7 @@ fn init_wait_reply_exit_cleaned_storage() { EMPTY_PAYLOAD.to_vec(), 100_000_000_000u64, 0, + false, )); assert!(!Gear::is_initialized(pid)); @@ -7518,7 +7629,8 @@ fn gas_spent_vs_balance() { prog_id, request.clone(), 10_000_000_000, - 0 + 0, + false, )); run_to_block(3, None); @@ -7791,6 +7903,7 @@ fn test_two_contracts_composition_works() { 100_u64.to_le_bytes().to_vec(), 60_000_000_000, 0, + false, )); run_to_block(4, None); @@ -8008,6 +8121,7 @@ fn demo_constructor_works() { calls.encode(), BlockGasLimitOf::::get(), 100_000, + false, )); let message_id = get_last_message_id(); @@ -8036,6 +8150,7 @@ fn demo_constructor_works() { calls.encode(), BlockGasLimitOf::::get(), 0, + false, )); let message_id = get_last_message_id(); @@ -8087,6 +8202,7 @@ fn demo_constructor_value_eq() { calls.encode(), BlockGasLimitOf::::get(), 100_000, + false, )); run_to_next_block(None); @@ -8100,6 +8216,7 @@ fn demo_constructor_value_eq() { calls.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -8149,6 +8266,7 @@ fn demo_constructor_is_demo_ping() { b"PING".to_vec(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -8166,6 +8284,7 @@ fn demo_constructor_is_demo_ping() { vec![], BlockGasLimitOf::::get(), 0, + false, )); let reply_id = get_last_message_id(); @@ -8201,6 +8320,7 @@ fn test_reply_to_terminated_program() { payload: EMPTY_PAYLOAD.to_vec(), gas_limit: 10_000_000, value: 0, + prepaid: false, }); assert_noop!( reply_call.dispatch(RuntimeOrigin::signed(USER_1)), @@ -8317,7 +8437,8 @@ fn delayed_wake() { prog, vec![], BlockGasLimitOf::::get(), - 0 + 0, + false, )); let mid = get_last_message_id(); @@ -8336,7 +8457,8 @@ fn delayed_wake() { prog, delay.to_le_bytes().to_vec(), BlockGasLimitOf::::get(), - 0 + 0, + false, )); run_to_next_block(None); @@ -8429,6 +8551,7 @@ fn cascading_messages_with_value_do_not_overcharge() { payload, gas_reserved, value, + false, )); let gas_to_spend = GasPrice::gas_price(gas_to_spend); @@ -8614,6 +8737,7 @@ fn execution_over_blocks() { Package::new(128, src).encode(), block_gas_limit, 0, + false, )); run_to_next_block(None); @@ -8626,6 +8750,7 @@ fn execution_over_blocks() { Package::new(17_384, src).encode(), block_gas_limit, 0, + false, )); let message_id = get_last_message_id(); @@ -8666,6 +8791,7 @@ fn execution_over_blocks() { Method::Start { src, id, expected }.encode(), 10_000_000_000, 0, + false, )); run_to_next_block(None); @@ -8684,6 +8810,7 @@ fn execution_over_blocks() { Method::Refuel(id).encode(), block_gas_limit, 0, + false, )); count += 1; @@ -8763,6 +8890,7 @@ fn waking_message_waiting_for_mx_lock_does_not_lead_to_deadlock() { command.encode(), BlockGasLimitOf::::get(), 0, + false, ) .unwrap_or_else(|_| panic!("Failed to send command {:?} to Waiter", command)); let msg_id = get_last_message_id(); @@ -8842,6 +8970,7 @@ fn waking_message_waiting_for_rw_lock_does_not_lead_to_deadlock() { command.encode(), BlockGasLimitOf::::get(), 0, + false, ) .unwrap_or_else(|_| panic!("Failed to send command {:?} to Waiter", command)); let msg_id = get_last_message_id(); @@ -8978,6 +9107,7 @@ fn async_sleep_for() { command.encode(), BlockGasLimitOf::::get(), 0, + false, ) .unwrap_or_else(|_| panic!("Failed to send command {:?} to Waiter", command)); let msg_id = get_last_message_id(); @@ -9238,6 +9368,7 @@ fn test_async_messages() { kind.encode(), 30_000_000_000u64, 0, + false, )); // check the message sent from the program @@ -9253,6 +9384,7 @@ fn test_async_messages() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000u64, 0, + false, )); // check the reply from the program @@ -9300,7 +9432,8 @@ fn program_generator_works() { generator_id, EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), - 0 + 0, + false, )); let message_id = get_last_message_id(); @@ -9441,6 +9574,7 @@ fn missing_functions_are_not_executed() { EMPTY_PAYLOAD.to_vec(), 1_000_000_000, 0, + false, )); run_to_next_block(None); @@ -9467,6 +9601,7 @@ fn missing_functions_are_not_executed() { EMPTY_PAYLOAD.to_vec(), 100_000_000, reply_value, + false, )); run_to_next_block(None); @@ -9531,6 +9666,7 @@ fn missing_handle_is_not_executed() { EMPTY_PAYLOAD.to_vec(), 1_000_000_000, 0, + false, )); assert_ok!(Gear::send_message( @@ -9539,6 +9675,7 @@ fn missing_handle_is_not_executed() { EMPTY_PAYLOAD.to_vec(), 1_000_000_000, 0, + false, )); run_to_next_block(None); @@ -9611,7 +9748,8 @@ fn test_reinstrumentation_works() { pid, vec![], 10_000_000_000, - 0 + 0, + false, )); run_to_block(3, None); @@ -9625,7 +9763,8 @@ fn test_reinstrumentation_works() { pid, vec![], 10_000_000_000, - 0 + 0, + false, )); run_to_block(4, None); @@ -9720,6 +9859,7 @@ fn send_from_reservation() { HandleAction::SendToUser.encode(), 10_000_000_000, 1_000, + false, )); run_to_block(3, None); @@ -9744,6 +9884,7 @@ fn send_from_reservation() { .encode(), 10_000_000_000, 1_000, + false, )); let mid = get_last_message_id(); @@ -9768,6 +9909,7 @@ fn send_from_reservation() { HandleAction::SendToUserDelayed.encode(), 10_000_000_000, 1_000, + false, )); run_to_block(5, None); @@ -9796,6 +9938,7 @@ fn send_from_reservation() { .encode(), 10_000_000_000, 1_000, + false, )); let mid = get_last_message_id(); @@ -9853,6 +9996,7 @@ fn reply_from_reservation() { HandleAction::ReplyToUser.encode(), 30_000_000_000, 1_000, + false, )); run_to_block(3, None); @@ -9877,6 +10021,7 @@ fn reply_from_reservation() { .encode(), 30_000_000_000, 1_000, + false, )); let mid = get_last_message_id(); @@ -9922,6 +10067,7 @@ fn signal_recursion_not_occurs() { HandleAction::PanicInSignal.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -9991,6 +10137,7 @@ fn signal_during_precharge() { HandleAction::WaitWithReserveAmountAndPanic(1).encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10006,7 +10153,8 @@ fn signal_during_precharge() { reply_to_id, EMPTY_PAYLOAD.to_vec(), 10_000_000_000, - 0 + 0, + false, )); run_to_block(4, None); @@ -10060,6 +10208,7 @@ fn signal_during_prepare() { HandleAction::WaitWithReserveAmountAndPanic(program_gas).encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10075,7 +10224,8 @@ fn signal_during_prepare() { reply_to_id, EMPTY_PAYLOAD.to_vec(), 10_000_000_000, - 0 + 0, + false, )); run_to_block(4, None); @@ -10138,6 +10288,7 @@ fn signal_async_wait_works() { EMPTY_PAYLOAD.to_vec(), gas_spent, 0, + false, )); let mid = get_last_message_id(); @@ -10197,6 +10348,7 @@ fn signal_gas_limit_exceeded_works() { HandleAction::OutOfGas.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10248,6 +10400,7 @@ fn system_reservation_unreserve_works() { HandleAction::Simple.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10289,6 +10442,7 @@ fn few_system_reservations_across_waits_works() { HandleAction::AcrossWaits.encode(), 30_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10306,7 +10460,8 @@ fn few_system_reservations_across_waits_works() { reply_to_id, EMPTY_PAYLOAD.to_vec(), 30_000_000_000, - 0 + 0, + false, )); run_to_next_block(None); @@ -10339,6 +10494,7 @@ fn system_reservation_panic_works() { HandleAction::Panic.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10378,6 +10534,7 @@ fn system_reservation_exit_works() { HandleAction::Exit.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10419,6 +10576,7 @@ fn system_reservation_wait_and_panic_works() { HandleAction::WaitAndPanic.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10434,7 +10592,8 @@ fn system_reservation_wait_and_panic_works() { reply_to_id, EMPTY_PAYLOAD.to_vec(), 10_000_000_000, - 0 + 0, + false, )); run_to_block(4, None); @@ -10468,6 +10627,7 @@ fn system_reservation_wait_works() { HandleAction::Wait.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10527,6 +10687,7 @@ fn system_reservation_wait_and_exit_works() { HandleAction::WaitAndExit.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10542,7 +10703,8 @@ fn system_reservation_wait_and_exit_works() { reply_to_id, EMPTY_PAYLOAD.to_vec(), 10_000_000_000, - 0 + 0, + false, )); run_to_block(4, None); @@ -10580,6 +10742,7 @@ fn system_reservation_wait_and_reserve_with_panic_works() { HandleAction::WaitAndReserveWithPanic.encode(), 30_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10597,7 +10760,8 @@ fn system_reservation_wait_and_reserve_with_panic_works() { reply_to_id, EMPTY_PAYLOAD.to_vec(), 10_000_000_000, - 0 + 0, + false, )); run_to_block(4, None); @@ -10635,6 +10799,7 @@ fn system_reservation_accumulate_works() { HandleAction::Accumulate.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10672,6 +10837,7 @@ fn system_reservation_zero_amount_panics() { HandleAction::ZeroReserve.encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -10731,7 +10897,8 @@ fn gas_reservation_works() { pid, HandleAction::Unreserve.encode(), spent_gas, - 0 + 0, + false, )); run_to_block(3, None); @@ -10772,7 +10939,8 @@ fn gas_reservation_works() { pid, HandleAction::Exit.encode(), 50_000_000_000, - 0 + 0, + false, )); run_to_block(2 + 4, None); @@ -10821,6 +10989,7 @@ fn gas_reservations_cleaned_in_terminated_program() { ReplyAction::Panic.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_block(3, None); @@ -10870,6 +11039,7 @@ fn gas_reservation_wait_wake_exit() { ReplyAction::Exit.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_block(3, None); @@ -10958,7 +11128,8 @@ fn gas_reservations_existing_reserve_unreserve() { pid, HandleAction::SendFromReservationAndUnreserve.encode(), 10_000_000_000, - 0 + 0, + false, )); let mid = get_last_message_id(); @@ -10996,6 +11167,7 @@ fn custom_async_entrypoint_works() { EMPTY_PAYLOAD.to_vec(), 30_000_000_000, 0, + false, )); run_to_block(3, None); @@ -11008,7 +11180,8 @@ fn custom_async_entrypoint_works() { msg.id(), EMPTY_PAYLOAD.to_vec(), 30_000_000_000, - 0 + 0, + false, )); run_to_block(4, None); @@ -11046,6 +11219,7 @@ fn dispatch_kind_forbidden_function() { HandleAction::ForbiddenCallInSignal(USER_1.into_origin().into()).encode(), 10_000_000_000, 0, + false, )); let mid = get_last_message_id(); @@ -11125,6 +11299,7 @@ fn system_reservation_gas_allowance_rollbacks() { HandleAction::Simple.encode(), min_limit, 0, + false, )); let mid = get_last_message_id(); @@ -11160,6 +11335,7 @@ fn system_reservation_wait_and_exit_across_executions() { HandleAction::Wait.encode(), 10_000_000_000, 0, + false, )); let mid_wait = get_last_message_id(); @@ -11174,6 +11350,7 @@ fn system_reservation_wait_and_exit_across_executions() { HandleAction::Exit.encode(), 10_000_000_000, 0, + false, )); let mid_exit = get_last_message_id(); @@ -11242,6 +11419,7 @@ fn signal_on_uninitialized_program() { EMPTY_PAYLOAD.to_vec(), 10_000_000_000, 0, + false, )); let reply_mid = get_last_message_id(); @@ -11272,7 +11450,8 @@ fn missing_block_tasks_handled() { pid, vec![], 100_000_000, - 1000 + 1000, + false, )); run_to_block(N - 1, None); @@ -11346,6 +11525,7 @@ fn async_does_not_duplicate_sync() { b"async".to_vec(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -12111,6 +12291,7 @@ fn check_random_works() { EMPTY_PAYLOAD.to_vec(), 50_000_000_000, 0, + false, )); let output: ([u8; 32], BlockNumber) = @@ -12173,6 +12354,7 @@ fn reply_with_small_non_zero_gas() { payload.to_vec(), DEFAULT_GAS_LIMIT * 10, 0, + false, )); let message_id = utils::get_last_message_id(); @@ -12213,7 +12395,8 @@ fn replies_denied_in_handle_reply() { proxy, vec![], 50_000_000_000, - 0 + 0, + false, )); let message_id = get_last_message_id(); @@ -12228,6 +12411,7 @@ fn replies_denied_in_handle_reply() { vec![], 50_000_000_000, 0, + false, )); let reply_id = get_last_message_id(); @@ -12285,6 +12469,7 @@ fn relay_messages() { payload.to_vec(), DEFAULT_GAS_LIMIT * 10, 0, + false, ) .is_ok(), "{}", @@ -12688,6 +12873,7 @@ fn calculate_gas_fails_when_calculation_limit_exceeded() { .encode(), BlockGasLimitOf::::get(), 0, + false, ) .expect("Making reservation failed"); } @@ -12740,6 +12926,7 @@ fn reservation_manager() { payload.encode(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -12831,7 +13018,7 @@ fn check_mutable_global_exports_restriction() { } #[test] -fn send_message_with_voucher_works() { +fn send_gasless_message_works() { init_logger(); let minimal_weight = mock::get_min_weight(); @@ -12849,15 +13036,16 @@ fn send_message_with_voucher_works() { res.expect("submit result was asserted") }; - // Test 1: USER_2 sends a message to the program with a voucher - // Expect failure because USER_2 has no voucher + // Test 1: USER_2 sends a gasless message to the program (intending to use a voucher). + // Expect failure because USER_2 has no voucher. assert_noop!( - Gear::send_message_with_voucher( + Gear::send_message( RuntimeOrigin::signed(USER_2), program_id, EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT, 0, + true, ), Error::::FailureRedeemingVoucher ); @@ -12889,14 +13077,15 @@ fn send_message_with_voucher_works() { GasPrice::gas_price(DEFAULT_GAS_LIMIT) ); - // Test 2: USER_2 sends a message to the program with a voucher - // Now that voucher is issued, the message should be sent successfully - assert_ok!(Gear::send_message_with_voucher( + // Test 2: USER_2 sends a gasless message to the program (intending to use a voucher). + // Now that voucher is issued, the message should be sent successfully. + assert_ok!(Gear::send_message( RuntimeOrigin::signed(USER_2), program_id, EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT, 1_000_000_u128, + true, )); // Balances check @@ -12936,7 +13125,7 @@ fn send_message_with_voucher_works() { } #[test] -fn send_reply_with_voucher_works() { +fn send_gasless_reply_works() { init_logger(); new_test_ext().execute_with(|| { // USER_2 uploads a program and sends message to it which leads to @@ -12972,14 +13161,15 @@ fn send_reply_with_voucher_works() { GasPrice::gas_price(DEFAULT_GAS_LIMIT) ); - // USER_1 sends a reply using the voucher + // USER_1 sends a gasless reply using a voucher let gas_limit = 10_000_000_u64; - assert_ok!(Gear::send_reply_with_voucher( + assert_ok!(Gear::send_reply( RuntimeOrigin::signed(USER_1), reply_to_id, EMPTY_PAYLOAD.to_vec(), gas_limit, 1000, // `prog_id` sent message with value of 1000 (see program code) + true, )); let expected_reply_message_id = get_last_message_id(); @@ -13045,6 +13235,7 @@ fn double_read_works() { b"PAYLOAD".to_vec(), BlockGasLimitOf::::get(), 100_000, + false, )); run_to_next_block(None); @@ -13139,6 +13330,7 @@ fn test_gas_allowance_exceed_with_context() { calls.encode(), BlockGasLimitOf::::get(), 0, + false, )); let msg_id = get_last_message_id(); run_to_next_block(allowance); @@ -13290,6 +13482,7 @@ fn test_send_to_terminated_from_program() { EMPTY_PAYLOAD.to_vec(), BlockGasLimitOf::::get(), 0, + false, )); run_to_next_block(None); @@ -13457,7 +13650,8 @@ mod utils { destination, payload, limit, - value + value, + false, )); let message_id = get_last_message_id(); @@ -13553,6 +13747,7 @@ mod utils { Vec::new(), gas_limit, // `prog_id` program sends message in handle which sets gas limit to 10_000_000. value, + false, )); let message_id = get_last_message_id(); @@ -13650,6 +13845,7 @@ mod utils { EMPTY_PAYLOAD.to_vec(), DEFAULT_GAS_LIMIT, 0, + false, ) } @@ -13659,6 +13855,7 @@ mod utils { payload: EMPTY_PAYLOAD.to_vec(), gas_limit: DEFAULT_GAS_LIMIT, value: 0, + prepaid: false, }) } @@ -14129,6 +14326,7 @@ mod utils { payload, BlockGasLimitOf::::get(), 0, + false, )); get_last_message_id() diff --git a/pallets/gear/src/weights.rs b/pallets/gear/src/weights.rs index ccc5aa6d48e..98d4376cdda 100644 --- a/pallets/gear/src/weights.rs +++ b/pallets/gear/src/weights.rs @@ -49,9 +49,7 @@ pub trait WeightInfo { fn create_program(s: u32, ) -> Weight; fn upload_program(c: u32, s: u32, ) -> Weight; fn send_message(p: u32, ) -> Weight; - fn send_message_with_voucher(p: u32, ) -> Weight; fn send_reply(p: u32, ) -> Weight; - fn send_reply_with_voucher(p: u32, ) -> Weight; fn initial_allocation(q: u32, ) -> Weight; fn alloc_in_handle(q: u32, ) -> Weight; fn reinstrument_per_kb(c: u32, ) -> Weight; @@ -379,18 +377,6 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().writes(8_u64)) } /// The range of component `p` is `[0, 2097152]`. - fn send_message_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `451` - // Estimated: `27177` - // Minimum execution time: 57_078_000 picoseconds. - Weight::from_parts(37_366_780, 27177) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(10_u64)) - .saturating_add(T::DbWeight::get().writes(9_u64)) - } - /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `978` @@ -402,18 +388,6 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } - /// The range of component `p` is `[0, 2097152]`. - fn send_reply_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `1081` - // Estimated: `45757` - // Minimum execution time: 93_602_000 picoseconds. - Weight::from_parts(69_941_334, 45757) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_057, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(14_u64)) - .saturating_add(T::DbWeight::get().writes(11_u64)) - } /// The range of component `q` is `[1, 512]`. fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: @@ -2248,18 +2222,6 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(8_u64)) } /// The range of component `p` is `[0, 2097152]`. - fn send_message_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `451` - // Estimated: `27177` - // Minimum execution time: 57_078_000 picoseconds. - Weight::from_parts(37_366_780, 27177) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(10_u64)) - .saturating_add(RocksDbWeight::get().writes(9_u64)) - } - /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `978` @@ -2271,18 +2233,6 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } - /// The range of component `p` is `[0, 2097152]`. - fn send_reply_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `1081` - // Estimated: `45757` - // Minimum execution time: 93_602_000 picoseconds. - Weight::from_parts(69_941_334, 45757) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_057, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(14_u64)) - .saturating_add(RocksDbWeight::get().writes(11_u64)) - } /// The range of component `q` is `[1, 512]`. fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: diff --git a/pallets/payment/src/lib.rs b/pallets/payment/src/lib.rs index ff957f585d0..edfe4272034 100644 --- a/pallets/payment/src/lib.rs +++ b/pallets/payment/src/lib.rs @@ -196,7 +196,7 @@ where who: &'a ::AccountId, ) -> Cow<'a, ::AccountId> { // Check if the extrinsic being called allows to charge fee payment to another account. - // The only such call at the moment is `Gear::send_message_with_voucher`. + // The only such call at the moment is `Gear::send_message` with `prepaid == true`. if let Some(acc) = T::DelegateFee::delegate_fee(call, who) { Cow::Owned(acc) } else { diff --git a/pallets/payment/src/mock.rs b/pallets/payment/src/mock.rs index 538a9e297ad..4ad92101b9c 100644 --- a/pallets/payment/src/mock.rs +++ b/pallets/payment/src/mock.rs @@ -261,19 +261,29 @@ impl Contains for ExtraFeeFilter { pub struct DelegateFeeAccountBuilder; // We want to test the way the fee delegate is calculated in real runtime -// for the `send_reply_with_voucher` call. Hence, the actual trait implementation is used. -// For the `send_message_with_voucher` call, a mock implementation is used. +// for the gasless `send_reply` call. Hence, the actual trait implementation is used. +// For the gasless `send_message` call, a mock implementation is used. impl DelegateFee for DelegateFeeAccountBuilder { fn delegate_fee(call: &RuntimeCall, who: &AccountId) -> Option { match call { - RuntimeCall::Gear(pallet_gear::Call::send_message_with_voucher { .. }) => { - Some(FEE_PAYER) + RuntimeCall::Gear(pallet_gear::Call::send_message { prepaid, .. }) => { + prepaid.then_some(FEE_PAYER) + } + RuntimeCall::Gear(pallet_gear::Call::send_reply { + reply_to_id, + prepaid, + .. + }) => { + if *prepaid { + as common::storage::Mailbox>::peek(who, reply_to_id).map( + |stored_message| { + GearVoucher::voucher_account_id(who, &stored_message.source()) + }, + ) + } else { + None + } } - RuntimeCall::Gear(pallet_gear::Call::send_reply_with_voucher { - reply_to_id, .. - }) => as common::storage::Mailbox>::peek(who, reply_to_id).map( - |stored_message| GearVoucher::voucher_account_id(who, &stored_message.source()), - ), _ => None, } } diff --git a/pallets/payment/src/tests.rs b/pallets/payment/src/tests.rs index b1ac4eee585..39a315a4e36 100644 --- a/pallets/payment/src/tests.rs +++ b/pallets/payment/src/tests.rs @@ -218,6 +218,7 @@ fn mq_size_affecting_fee_works() { payload: Default::default(), gas_limit: 100_000, value: 0, + prepaid: false, }); let len = 100usize; @@ -398,6 +399,7 @@ fn query_info_and_fee_details_work() { payload: Default::default(), gas_limit: 100_000, value: 0, + prepaid: false, }); let call_not_affecting_mq = RuntimeCall::Gear(pallet_gear::Call::claim_value { message_id: 1.into(), @@ -569,11 +571,12 @@ fn fee_payer_replacement_works() { let program_id = ProgramId::from_origin(H256::random()); let call: &::RuntimeCall = - &RuntimeCall::Gear(pallet_gear::Call::send_message_with_voucher { + &RuntimeCall::Gear(pallet_gear::Call::send_message { destination: program_id, payload: Default::default(), gas_limit: 100_000, value: 0, + prepaid: true, }); let len = 100usize; @@ -657,11 +660,12 @@ fn reply_with_voucher_pays_fee_from_voucher_ok() { // Preparing a call let gas_limit = 100_000_u64; let call: &::RuntimeCall = - &RuntimeCall::Gear(pallet_gear::Call::send_reply_with_voucher { + &RuntimeCall::Gear(pallet_gear::Call::send_reply { reply_to_id: msg_id, payload: vec![], gas_limit, value: 0, + prepaid: true, }); let len = 100_usize; diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 14ec73cf374..1ffb58ce9a1 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -520,21 +520,33 @@ impl Contains for ExtraFeeFilter { } pub struct DelegateFeeAccountBuilder; -// TODO: in case of the `send_reply_with_voucher` call we have to iterate through the +// TODO: in case of the `send_reply` prepaid call we have to iterate through the // user's mailbox to dig out the stored message source `program_id` to check if it has // issued a voucher to pay for the reply extrinsic transaction fee. // Isn't there a better way to do that? impl DelegateFee for DelegateFeeAccountBuilder { fn delegate_fee(call: &RuntimeCall, who: &AccountId) -> Option { match call { - RuntimeCall::Gear(pallet_gear::Call::send_message_with_voucher { - destination, .. - }) => Some(GearVoucher::voucher_account_id(who, destination)), - RuntimeCall::Gear(pallet_gear::Call::send_reply_with_voucher { - reply_to_id, .. - }) => <::Mailbox as Mailbox>::peek(who, reply_to_id).map( - |stored_message| GearVoucher::voucher_account_id(who, &stored_message.source()), - ), + RuntimeCall::Gear(pallet_gear::Call::send_message { + destination, + prepaid, + .. + }) => prepaid.then(|| GearVoucher::voucher_account_id(who, destination)), + RuntimeCall::Gear(pallet_gear::Call::send_reply { + reply_to_id, + prepaid, + .. + }) => { + if *prepaid { + <::Mailbox as Mailbox>::peek(who, reply_to_id).map( + |stored_message| { + GearVoucher::voucher_account_id(who, &stored_message.source()) + }, + ) + } else { + None + } + } _ => None, } } diff --git a/runtime/gear/src/weights/pallet_gear.rs b/runtime/gear/src/weights/pallet_gear.rs index f4429240be6..96cf975fa48 100644 --- a/runtime/gear/src/weights/pallet_gear.rs +++ b/runtime/gear/src/weights/pallet_gear.rs @@ -49,9 +49,7 @@ pub trait WeightInfo { fn create_program(s: u32, ) -> Weight; fn upload_program(c: u32, s: u32, ) -> Weight; fn send_message(p: u32, ) -> Weight; - fn send_message_with_voucher(p: u32, ) -> Weight; fn send_reply(p: u32, ) -> Weight; - fn send_reply_with_voucher(p: u32, ) -> Weight; fn initial_allocation(q: u32, ) -> Weight; fn alloc_in_handle(q: u32, ) -> Weight; fn reinstrument_per_kb(c: u32, ) -> Weight; @@ -379,18 +377,6 @@ impl pallet_gear::WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().writes(8_u64)) } /// The range of component `p` is `[0, 2097152]`. - fn send_message_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `451` - // Estimated: `27177` - // Minimum execution time: 57_078_000 picoseconds. - Weight::from_parts(37_366_780, 27177) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(10_u64)) - .saturating_add(T::DbWeight::get().writes(9_u64)) - } - /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `978` @@ -402,18 +388,6 @@ impl pallet_gear::WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } - /// The range of component `p` is `[0, 2097152]`. - fn send_reply_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `1081` - // Estimated: `45757` - // Minimum execution time: 93_602_000 picoseconds. - Weight::from_parts(69_941_334, 45757) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_057, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(14_u64)) - .saturating_add(T::DbWeight::get().writes(11_u64)) - } /// The range of component `q` is `[1, 512]`. fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: @@ -2248,18 +2222,6 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(8_u64)) } /// The range of component `p` is `[0, 2097152]`. - fn send_message_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `451` - // Estimated: `27177` - // Minimum execution time: 57_078_000 picoseconds. - Weight::from_parts(37_366_780, 27177) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(10_u64)) - .saturating_add(RocksDbWeight::get().writes(9_u64)) - } - /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `978` @@ -2271,18 +2233,6 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } - /// The range of component `p` is `[0, 2097152]`. - fn send_reply_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `1081` - // Estimated: `45757` - // Minimum execution time: 93_602_000 picoseconds. - Weight::from_parts(69_941_334, 45757) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_057, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(14_u64)) - .saturating_add(RocksDbWeight::get().writes(11_u64)) - } /// The range of component `q` is `[1, 512]`. fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: diff --git a/runtime/vara/src/integration_tests.rs b/runtime/vara/src/integration_tests.rs index 1e29d1701fb..976b9ad2f6d 100644 --- a/runtime/vara/src/integration_tests.rs +++ b/runtime/vara/src/integration_tests.rs @@ -502,6 +502,7 @@ fn tokens_locking_works() { vec![], 10_000_000_000, 11 * UNITS, + false, ), pallet_gear::Error::::InsufficientBalance ); diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 0f160e0438b..4daf00ff2d4 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -835,21 +835,33 @@ impl Contains for ExtraFeeFilter { } pub struct DelegateFeeAccountBuilder; -// TODO: in case of the `send_reply_with_voucher` call we have to iterate through the +// TODO: in case of the `send_reply` prepaid call we have to iterate through the // user's mailbox to dig out the stored message source `program_id` to check if it has // issued a voucher to pay for the reply extrinsic transaction fee. // Isn't there a better way to do that? impl DelegateFee for DelegateFeeAccountBuilder { fn delegate_fee(call: &RuntimeCall, who: &AccountId) -> Option { match call { - RuntimeCall::Gear(pallet_gear::Call::send_message_with_voucher { - destination, .. - }) => Some(GearVoucher::voucher_account_id(who, destination)), - RuntimeCall::Gear(pallet_gear::Call::send_reply_with_voucher { - reply_to_id, .. - }) => <::Mailbox as Mailbox>::peek(who, reply_to_id).map( - |stored_message| GearVoucher::voucher_account_id(who, &stored_message.source()), - ), + RuntimeCall::Gear(pallet_gear::Call::send_message { + destination, + prepaid, + .. + }) => prepaid.then(|| GearVoucher::voucher_account_id(who, destination)), + RuntimeCall::Gear(pallet_gear::Call::send_reply { + reply_to_id, + prepaid, + .. + }) => { + if *prepaid { + <::Mailbox as Mailbox>::peek(who, reply_to_id).map( + |stored_message| { + GearVoucher::voucher_account_id(who, &stored_message.source()) + }, + ) + } else { + None + } + } _ => None, } } diff --git a/runtime/vara/src/weights/pallet_gear.rs b/runtime/vara/src/weights/pallet_gear.rs index 5ad37564e7b..356ab963620 100644 --- a/runtime/vara/src/weights/pallet_gear.rs +++ b/runtime/vara/src/weights/pallet_gear.rs @@ -49,9 +49,7 @@ pub trait WeightInfo { fn create_program(s: u32, ) -> Weight; fn upload_program(c: u32, s: u32, ) -> Weight; fn send_message(p: u32, ) -> Weight; - fn send_message_with_voucher(p: u32, ) -> Weight; fn send_reply(p: u32, ) -> Weight; - fn send_reply_with_voucher(p: u32, ) -> Weight; fn initial_allocation(q: u32, ) -> Weight; fn alloc_in_handle(q: u32, ) -> Weight; fn reinstrument_per_kb(c: u32, ) -> Weight; @@ -379,18 +377,6 @@ impl pallet_gear::WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().writes(8_u64)) } /// The range of component `p` is `[0, 2097152]`. - fn send_message_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `452` - // Estimated: `27184` - // Minimum execution time: 56_333_000 picoseconds. - Weight::from_parts(38_749_450, 27184) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(10_u64)) - .saturating_add(T::DbWeight::get().writes(9_u64)) - } - /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1049` @@ -402,18 +388,6 @@ impl pallet_gear::WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } - /// The range of component `p` is `[0, 2097152]`. - fn send_reply_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `1152` - // Estimated: `46396` - // Minimum execution time: 92_361_000 picoseconds. - Weight::from_parts(69_850_521, 46396) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_052, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(14_u64)) - .saturating_add(T::DbWeight::get().writes(11_u64)) - } /// The range of component `q` is `[1, 512]`. fn initial_allocation(q: u32, ) -> Weight { // Proof Size summary in bytes: @@ -2246,18 +2220,6 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().writes(8_u64)) } /// The range of component `p` is `[0, 2097152]`. - fn send_message_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `452` - // Estimated: `27184` - // Minimum execution time: 56_333_000 picoseconds. - Weight::from_parts(38_749_450, 27184) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_023, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(10_u64)) - .saturating_add(RocksDbWeight::get().writes(9_u64)) - } - /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `1049` @@ -2269,18 +2231,6 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } - /// The range of component `p` is `[0, 2097152]`. - fn send_reply_with_voucher(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `1152` - // Estimated: `46396` - // Minimum execution time: 92_361_000 picoseconds. - Weight::from_parts(69_850_521, 46396) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_052, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(14_u64)) - .saturating_add(RocksDbWeight::get().writes(11_u64)) - } /// The range of component `q` is `[1, 512]`. fn initial_allocation(q: u32, ) -> Weight { // Proof Size summary in bytes: diff --git a/utils/call-gen/src/arbitrary_call.rs b/utils/call-gen/src/arbitrary_call.rs index ac76cf855e1..4f9b5a000df 100644 --- a/utils/call-gen/src/arbitrary_call.rs +++ b/utils/call-gen/src/arbitrary_call.rs @@ -74,6 +74,7 @@ impl<'a> Arbitrary<'a> for GearCalls { ); let gas = GAS_LIMIT.mul(99).div(100); let value = 0; + let prepaid = false; let mut programs = [ProgramId::default(); GearCalls::INIT_MSGS]; // Upload code used as a default value. let mut calls = get_uninitialized_calls(); @@ -120,7 +121,7 @@ impl<'a> Arbitrary<'a> for GearCalls { log::trace!("Payload (send_message) length {:?}", payload.len()); calls[i].write(GearCall::SendMessage(SendMessageArgs(( - program_id, payload, gas, value, + program_id, payload, gas, value, prepaid, )))); } diff --git a/utils/call-gen/src/send_message.rs b/utils/call-gen/src/send_message.rs index 302885c32a0..bb74fef8a08 100644 --- a/utils/call-gen/src/send_message.rs +++ b/utils/call-gen/src/send_message.rs @@ -26,7 +26,7 @@ use gear_core::ids::ProgramId; use gear_utils::{NonEmpty, RingGet}; // destination, payload, gas, value -type SendMessageArgsInner = (ProgramId, Vec, u64, u128); +type SendMessageArgsInner = (ProgramId, Vec, u64, u128, bool); /// Send message args /// @@ -67,6 +67,8 @@ impl GeneratableCallArgs for SendMessageArgs { // TODO #2203 let value = 0; - Self((destination, payload, gas_limit, value)) + let prepaid = false; + + Self((destination, payload, gas_limit, value, prepaid)) } } diff --git a/utils/call-gen/src/send_reply.rs b/utils/call-gen/src/send_reply.rs index 6d604352a91..0845e6634c9 100644 --- a/utils/call-gen/src/send_reply.rs +++ b/utils/call-gen/src/send_reply.rs @@ -26,7 +26,7 @@ use gear_core::ids::MessageId; use gear_utils::{NonEmpty, RingGet}; // reply to message id, payload, gas limit, value -type SendReplyArgsInner = (MessageId, Vec, u64, u128); +type SendReplyArgsInner = (MessageId, Vec, u64, u128, bool); /// Send reply args /// @@ -62,6 +62,8 @@ impl GeneratableCallArgs for SendReplyArgs { // TODO #2203 let value = 0; - Self((message_id, payload, gas_limit, value)) + let prepaid = false; + + Self((message_id, payload, gas_limit, value, prepaid)) } } diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index 14b59059289..ccd3279bf3e 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -143,13 +143,14 @@ fn execute_gear_call(sender: AccountId, call: GearCall) -> DispatchResultWithPos ) } GearCall::SendMessage(args) => { - let SendMessageArgs((destination, payload, gas_limit, value)) = args; + let SendMessageArgs((destination, payload, gas_limit, value, prepaid)) = args; Gear::send_message( RuntimeOrigin::signed(sender), destination, payload, gas_limit, value, + prepaid, ) } _ => unreachable!("Unsupported currently."), From 2638a27b2e25e74a0e5684665326a43a37a299aa Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Sat, 19 Aug 2023 16:40:02 +0300 Subject: [PATCH 061/165] feat(runtime-fuzzer): Introduce "precise" `runtime-fuzzer` (#3102) --- Cargo.lock | 6 +- Cargo.toml | 1 + scripts/check-fuzzer.sh | 7 + scripts/src/test.sh | 4 +- utils/call-gen/Cargo.toml | 2 - utils/call-gen/src/lib.rs | 2 - utils/runtime-fuzzer/Cargo.toml | 4 +- .../runtime-fuzzer/fuzz/fuzz_targets/main.rs | 52 +------ .../src/arbitrary_call.rs | 39 ++++-- .../runtime-fuzzer/src/bin/reproduce_fuzz.rs | 63 --------- utils/runtime-fuzzer/src/lib.rs | 132 +++--------------- .../src/generator/syscalls/invocator.rs | 4 + utils/wasm-gen/src/lib.rs | 3 + 13 files changed, 70 insertions(+), 249 deletions(-) rename utils/{call-gen => runtime-fuzzer}/src/arbitrary_call.rs (85%) delete mode 100644 utils/runtime-fuzzer/src/bin/reproduce_fuzz.rs diff --git a/Cargo.lock b/Cargo.lock index 04bedf8801e..91e904a5fa0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3781,8 +3781,6 @@ dependencies = [ "hex", "log", "rand 0.8.5", - "sha-1 0.10.1", - "static_assertions", "thiserror", ] @@ -9149,13 +9147,12 @@ dependencies = [ "gear-wasm-gen", "hex", "log", - "once_cell", "pallet-authorship", "pallet-balances", "pallet-gear", "parity-scale-codec", - "parking_lot 0.12.1", "rand 0.8.5", + "sha-1 0.10.1", "sp-consensus-babe", "sp-consensus-grandpa", "sp-consensus-slots", @@ -9163,6 +9160,7 @@ dependencies = [ "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-keyring", "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "static_assertions", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 00abc3e6e58..c44a2ea8e02 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -136,6 +136,7 @@ scale-info = { version = "2.5.0", default-features = false } serde = "^1" serde_json = "^1" serde_yaml = "0.8.26" +sha-1 = "0.10.1" static_assertions = "1" # # NOTE # diff --git a/scripts/check-fuzzer.sh b/scripts/check-fuzzer.sh index 0df98f92fcf..a7a9d4a37e8 100755 --- a/scripts/check-fuzzer.sh +++ b/scripts/check-fuzzer.sh @@ -1,9 +1,16 @@ #!/usr/bin/env sh main() { + echo " >> Getting random bytes from /dev/urandom" + # Fuzzer expects a minimal input size of 25 MiB. Without providing a corpus of the same or larger + # size fuzzer will stuck for a long time with trying to test the target using 0..100 bytes. + mkdir -p utils/runtime-fuzzer/fuzz/corpus/main + dd if=/dev/urandom of=utils/runtime-fuzzer/fuzz/corpus/main/check-fuzzer-bytes bs=1 count=27000000 + echo " >> Running fuzzer with failpoint" RUST_BACKTRACE=1 FAILPOINTS=fail_fuzzer=return ./scripts/gear.sh test fuzz > fuzz_run 2>&1 + echo " >> Checking fuzzer output" if cat fuzz_run | grep -qzP '(?s)(?=.*GasTree corrupted)(?=.*NodeAlreadyExists)(?=.*\Qpallet_gear::pallet::Pallet>::consume_and_retrieve\E)' ; then echo "Success" exit 0 diff --git a/scripts/src/test.sh b/scripts/src/test.sh index 7118f8467c4..e3b25b9c66d 100755 --- a/scripts/src/test.sh +++ b/scripts/src/test.sh @@ -85,8 +85,8 @@ run_fuzzer() { cd $ROOT_DIR/utils/runtime-fuzzer # Run fuzzer - RUST_LOG="debug,runtime_fuzzer_fuzz=debug,wasmi,libfuzzer_sys,node_fuzzer=debug,gear,pallet_gear,gear-core-processor,gear-backend-wasmi,gwasm'" \ - cargo fuzz run --release --sanitizer=none main -- -rss_limit_mb=8192 + RUST_LOG=debug,syscalls,gear_wasm_gen=trace,runtime_fuzzer=trace,gear_backend_common=trace \ + cargo fuzz run --release --sanitizer=none main -- -rss_limit_mb=8192 -max_len=35000000 -len_control=0 } # TODO this is likely to be merged with `pallet_test` or `workspace_test` in #1802 diff --git a/utils/call-gen/Cargo.toml b/utils/call-gen/Cargo.toml index 923993fa1b3..749ce2db52d 100644 --- a/utils/call-gen/Cargo.toml +++ b/utils/call-gen/Cargo.toml @@ -15,6 +15,4 @@ dyn-clonable.workspace = true hex.workspace = true log.workspace = true rand.workspace = true -sha-1 = "0.10.1" -static_assertions.workspace = true thiserror.workspace = true diff --git a/utils/call-gen/src/lib.rs b/utils/call-gen/src/lib.rs index 8a0f868f7c3..c9513421ec6 100644 --- a/utils/call-gen/src/lib.rs +++ b/utils/call-gen/src/lib.rs @@ -18,7 +18,6 @@ //! Generator of the `pallet-gear` calls. -mod arbitrary_call; mod claim_value; mod create_program; mod rand_utils; @@ -27,7 +26,6 @@ mod send_reply; mod upload_code; mod upload_program; -pub use arbitrary_call::GearCalls; pub use claim_value::ClaimValueArgs; pub use create_program::CreateProgramArgs; pub use rand_utils::{CallGenRng, CallGenRngCore}; diff --git a/utils/runtime-fuzzer/Cargo.toml b/utils/runtime-fuzzer/Cargo.toml index 6962de72089..ba2ac414873 100644 --- a/utils/runtime-fuzzer/Cargo.toml +++ b/utils/runtime-fuzzer/Cargo.toml @@ -10,8 +10,8 @@ arbitrary.workspace = true codec = { workspace = true, features = ["derive"] } hex.workspace = true log.workspace = true -once_cell.workspace = true -parking_lot.workspace = true +sha-1.workspace = true +static_assertions.workspace = true rand = { workspace = true, features = ["small_rng"] } # Temporary deps for the reproducing crash script until #2313 is implemented diff --git a/utils/runtime-fuzzer/fuzz/fuzz_targets/main.rs b/utils/runtime-fuzzer/fuzz/fuzz_targets/main.rs index 6bee5c88171..73908b7df23 100644 --- a/utils/runtime-fuzzer/fuzz/fuzz_targets/main.rs +++ b/utils/runtime-fuzzer/fuzz/fuzz_targets/main.rs @@ -19,53 +19,13 @@ #![no_main] use libfuzzer_sys::fuzz_target; -use once_cell::sync::OnceCell; -use std::{ - fs::{self, OpenOptions}, - io::{Error as IoError, Result as IoResult, Write}, - path::Path, -}; +use runtime_fuzzer::GearCalls; -const SEEDS_STORE_DIR: &str = "/tmp/fuzzing-seeds-dir"; -const SEEDS_STORE_FILE: &str = "fuzzing-seeds"; - -static RUN_INTIALIZED: OnceCell = OnceCell::new(); - -fuzz_target!(|seed: u64| { +fuzz_target!(|gear_calls: GearCalls| { gear_utils::init_default_logger(); - dump_seed(seed).unwrap_or_else(|e| unreachable!("internal error: failed dumping seed: {e}")); - - log::info!("Running the seed {seed}"); - runtime_fuzzer::run(seed); + // Newline to easily browse logs. + println!(); + log::info!("Executing generated gear calls"); + runtime_fuzzer::run(gear_calls); }); - -// Dumps seed to the `SEEDS_STORE_FILE` file inside `SEEDS_STORE_DIR` -// directory before running fuzz test. -// -// If directory already exists for the current run, it will be cleared. -fn dump_seed(seed: u64) -> IoResult<()> { - let seeds_file = RUN_INTIALIZED.get_or_try_init(|| { - let seeds_dir = Path::new(SEEDS_STORE_DIR); - match seeds_dir.exists() { - true => clear_dir(seeds_dir)?, - false => fs::create_dir_all(seeds_dir)?, - } - - Ok::(format!("{SEEDS_STORE_DIR}/{SEEDS_STORE_FILE}")) - })?; - - OpenOptions::new() - .create(true) - .append(true) - .open(seeds_file) - .and_then(|mut file| writeln!(file, "{seed}")) -} - -fn clear_dir(path: &Path) -> IoResult<()> { - for dir_entry in fs::read_dir(path)? { - fs::remove_file(dir_entry?.path())?; - } - - Ok(()) -} diff --git a/utils/call-gen/src/arbitrary_call.rs b/utils/runtime-fuzzer/src/arbitrary_call.rs similarity index 85% rename from utils/call-gen/src/arbitrary_call.rs rename to utils/runtime-fuzzer/src/arbitrary_call.rs index 4f9b5a000df..aeba9459219 100644 --- a/utils/call-gen/src/arbitrary_call.rs +++ b/utils/runtime-fuzzer/src/arbitrary_call.rs @@ -18,7 +18,7 @@ //! `Arbitrary` trait implementation for a collection of [`GearCall`]. -use crate::{GearCall, SendMessageArgs, UploadProgramArgs}; +use crate::{runtime::default_gas_limit, GearCall, SendMessageArgs, UploadProgramArgs}; use arbitrary::{Arbitrary, Result, Unstructured}; use gear_core::ids::{CodeId, ProgramId}; use gear_utils::NonEmpty; @@ -27,13 +27,10 @@ use gear_wasm_gen::{ }; use sha1::*; use std::{ + fmt::Debug, mem::{self, MaybeUninit}, - ops::{Div, Mul}, }; -/// Gear runtime max gas limit. -const GAS_LIMIT: u64 = 250_000_000_000; - /// Maximum payload size for the fuzzer - 512 KiB. const MAX_PAYLOAD_SIZE: usize = 512 * 1024; static_assertions::const_assert!(MAX_PAYLOAD_SIZE <= gear_core::message::MAX_PAYLOAD_SIZE); @@ -42,9 +39,23 @@ static_assertions::const_assert!(MAX_PAYLOAD_SIZE <= gear_core::message::MAX_PAY /// /// It's main purpose is to be an implementor of `Arbitrary` for the array of [`GearCall`]s. /// New-type is required as array is always a foreign type. -#[derive(Debug, Clone)] +#[derive(Clone)] pub struct GearCalls(pub [GearCall; GearCalls::MAX_CALLS]); +/// That's done because when fuzzer finds a crash it prints a [`Debug`] string of the [`GearCalls`]. +/// Fuzzer executes [`GearCalls`] with pretty large codes and payloads, therefore to avoid printing huge +/// amount of data we do a mock implementation of [`Debug`]. +/// +/// If one wants to see a real debug string of the type, a separate wrapper over [`GearCall`]s array must be +/// implemented. This wrapper must implement [`Debug`] then. +impl Debug for GearCalls { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_tuple("GearCalls") + .field(&"Mock `Debug` impl") + .finish() + } +} + impl GearCalls { pub const MAX_CALLS: usize = GearCalls::INIT_MSGS + GearCalls::HANDLE_MSGS; pub const INIT_MSGS: usize = 10; @@ -68,11 +79,11 @@ impl<'a> Arbitrary<'a> for GearCalls { return Err(arbitrary::Error::NotEnoughData); } - let log_data = format!( - "Generated from corpus - {}", - get_sha1_string(u.peek_bytes(u.len()).expect("checked")) - ); - let gas = GAS_LIMIT.mul(99).div(100); + let test_input_id = get_sha1_string(u.peek_bytes(u.len()).expect("checked")); + log::trace!("Generating GearCalls from corpus - {}", test_input_id); + + let log_data = format!("Generated program from corpus - {}", test_input_id); + let gas = default_gas_limit(); let value = 0; let prepaid = false; let mut programs = [ProgramId::default(); GearCalls::INIT_MSGS]; @@ -103,7 +114,11 @@ impl<'a> Arbitrary<'a> for GearCalls { ); log::trace!("Payload (upload_program) length {:?}", payload.len()); - programs[i] = ProgramId::generate(CodeId::generate(&code), &salt); + let program_id = ProgramId::generate(CodeId::generate(&code), &salt); + + log::trace!("Generated code for program id - {program_id}"); + + programs[i] = program_id; calls[i].write(GearCall::UploadProgram(UploadProgramArgs(( code, salt, payload, gas, value, )))); diff --git a/utils/runtime-fuzzer/src/bin/reproduce_fuzz.rs b/utils/runtime-fuzzer/src/bin/reproduce_fuzz.rs deleted file mode 100644 index 61baf17ca51..00000000000 --- a/utils/runtime-fuzzer/src/bin/reproduce_fuzz.rs +++ /dev/null @@ -1,63 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Script to reproduce crashes found by `runtime-fuzzer`. -//! -//! This file is a temporary solution until #2313 is implemented. -//! Fuzzer dumps all the seed into the file, so the full run can -//! be reproduced in case of the fail. -//! -//! Just simply run `cargo run -- -p `. - -use anyhow::Result; -use clap::Parser; -use std::{ - fs::File, - io::{BufRead, BufReader}, - path::PathBuf, -}; - -#[derive(Debug, Parser)] -pub struct Params { - /// Path to the file, which contains seeds from previously run fuzzer. - #[arg(short, long)] - pub path: PathBuf, -} - -fn main() -> Result<()> { - gear_utils::init_default_logger(); - - let file_reader = create_file_reader(Params::parse().path)?; - - // Read seeds and run test against all of them. - for line in file_reader.lines() { - let seed: u64 = line?.trim().parse()?; - - log::info!("Reproducing run with the seed - {seed}"); - - runtime_fuzzer::run(seed); - } - - Ok(()) -} - -fn create_file_reader(path: PathBuf) -> Result> { - let file = File::open(path)?; - - Ok(BufReader::new(file)) -} diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index ccd3279bf3e..98bf4587ded 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -16,51 +16,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +mod arbitrary_call; mod runtime; +pub use arbitrary_call::GearCalls; + use frame_support::pallet_prelude::DispatchResultWithPostInfo; -use gear_call_gen::{ - CallGenRng, GearCall, GeneratableCallArgs, SendMessageArgs, UploadProgramArgs, -}; -use gear_common::event::ProgramChangeKind; -use gear_core::ids::ProgramId; -use gear_runtime::{AccountId, Gear, Runtime, RuntimeEvent, RuntimeOrigin, System}; -use gear_utils::NonEmpty; -use gear_wasm_gen::{EntryPointsSet, StandardGearWasmConfigsBundle}; -use once_cell::sync::OnceCell; +use gear_call_gen::{GearCall, SendMessageArgs, UploadProgramArgs}; +use gear_runtime::{AccountId, Gear, Runtime, RuntimeOrigin}; use pallet_balances::Pallet as BalancesPallet; -use pallet_gear::Event; -use parking_lot::Mutex; -use rand::rngs::SmallRng; use runtime::*; -use sp_io::TestExternalities; - -type ContextMutex = Mutex; - -// Saving ext is planned to be multithreaded, so sync primitive is used -// TODO #2189 -static TEST_EXT: OnceCell> = OnceCell::new(); -static CONTEXT: OnceCell> = OnceCell::new(); - -struct Context { - programs: Vec, -} - -impl Context { - fn new() -> Self { - Self { - programs: Vec::new(), - } - } -} /// Runs all the fuzz testing internal machinery. -pub fn run(seed: u64) { +pub fn run(GearCalls(gear_calls): GearCalls) { let sender = runtime::account(runtime::alice()); - let test_ext = TEST_EXT.get_or_init(|| Mutex::new(new_test_ext())); - let context = CONTEXT.get_or_init(|| Mutex::new(Context::new())); - test_ext.lock().execute_with(|| { + new_test_ext().execute_with(|| { // Increase maximum balance of the `sender`. { increase_to_max_balance(sender.clone()) @@ -71,64 +42,18 @@ pub fn run(seed: u64) { ); } - // Generate gear call. - let call = generate_gear_call::(seed, context); - - // Execute gear call. - let call_res = execute_gear_call(sender, call); - log::info!("Extrinsic result: {call_res:?}"); - - // Run task and message queues with max possible gas limit. - run_to_next_block(); + for gear_call in gear_calls { + let call_res = execute_gear_call(sender.clone(), gear_call); + // Newline to easily browse logs. + println!(); + log::info!("Extrinsic result: {call_res:?}"); - // Update context after the run. - update_context(context) + // Run task and message queues with max possible gas limit. + run_to_next_block(); + } }); } -fn generate_gear_call(seed: u64, context: &ContextMutex) -> GearCall { - let config = fuzzer_config(seed, context.lock().programs.clone()); - let mut rand = Rng::seed_from_u64(seed); - - // Use (0..G)^3 / G^2 to produce more values closer to default_gas_limit. - let default_gas_limit = default_gas_limit() as u128; - let gas_limit = rand.gen_range(0..=default_gas_limit).pow(3) / default_gas_limit.pow(2); - - let gas_limit = gas_limit as u64; - - match rand.gen_range(0..=1) { - 0 => UploadProgramArgs::generate::( - (rand.next_u64(), rand.next_u64()), - (gas_limit, config), - ) - .into(), - 1 => match NonEmpty::from_vec(context.lock().programs.clone()) { - Some(existing_programs) => SendMessageArgs::generate::( - (existing_programs, rand.next_u64()), - (gas_limit,), - ) - .into(), - None => UploadProgramArgs::generate::( - (rand.next_u64(), rand.next_u64()), - (gas_limit, config), - ) - .into(), - }, - _ => unreachable!("Generate in range 0..=1."), - } -} - -fn fuzzer_config(seed: u64, programs: Vec) -> StandardGearWasmConfigsBundle { - StandardGearWasmConfigsBundle { - log_info: Some(format!("Gear program seed = '{seed}'")), - existing_addresses: NonEmpty::from_vec(programs), - entry_points_set: EntryPointsSet::HandleHandleReply, - remove_recursion: true, - call_indirect_enabled: false, - ..Default::default() - } -} - fn execute_gear_call(sender: AccountId, call: GearCall) -> DispatchResultWithPostInfo { match call { GearCall::UploadProgram(args) => { @@ -153,31 +78,6 @@ fn execute_gear_call(sender: AccountId, call: GearCall) -> DispatchResultWithPos prepaid, ) } - _ => unreachable!("Unsupported currently."), + _ => unimplemented!("Unsupported currently."), } } - -fn update_context(context: &ContextMutex) { - log::debug!("Starting updating context"); - let mut initialized_programs: Vec<_> = System::events() - .into_iter() - .filter_map(|v| { - if let RuntimeEvent::Gear(Event::ProgramChanged { - id, - change: ProgramChangeKind::Active { .. }, - }) = v.event - { - Some(id) - } else { - None - } - }) - .collect(); - - System::reset_events(); - - log::debug!("Collected all the programs"); - - context.lock().programs.append(&mut initialized_programs); - log::debug!("Context is stored"); -} diff --git a/utils/wasm-gen/src/generator/syscalls/invocator.rs b/utils/wasm-gen/src/generator/syscalls/invocator.rs index 5ecedf35f3c..59344a01d50 100644 --- a/utils/wasm-gen/src/generator/syscalls/invocator.rs +++ b/utils/wasm-gen/src/generator/syscalls/invocator.rs @@ -167,6 +167,8 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { invocable: InvocableSysCall, call_indexes_handle: CallIndexesHandle, ) -> Result> { + // Newline to easily browse logs. + println!(); log::trace!( "Random data before building {} sys-call invoke instructions - {}", invocable.to_str(), @@ -412,6 +414,8 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { } fn resolves_calls_indexes(&mut self) { + // Newline to easily browse logs. + println!(); log::trace!("Resolving calls indexes"); let imports_num = self.module.count_import_funcs() as u32; diff --git a/utils/wasm-gen/src/lib.rs b/utils/wasm-gen/src/lib.rs index 64bd9e4bfc3..079bff124c1 100644 --- a/utils/wasm-gen/src/lib.rs +++ b/utils/wasm-gen/src/lib.rs @@ -52,10 +52,13 @@ pub fn generate_gear_program_code( let bytes = parity_wasm::serialize(module).expect("unable to serialize pw module"); + // Newline to easily browse logs. + println!(); log::trace!( "{}", wasmprinter::print_bytes(&bytes).expect("internal error: failed printing bytes") ); + println!(); Ok(bytes) } From 8b54acaf652807d4e93cffc9b2b719751a939483 Mon Sep 17 00:00:00 2001 From: mertwole <33563701+mertwole@users.noreply.github.com> Date: Sat, 19 Aug 2023 18:17:20 +0400 Subject: [PATCH 062/165] refactoring(gsdk): structure gsdk API (#3035) --- gcli/src/cmd/claim.rs | 2 +- gcli/src/cmd/create.rs | 2 + gcli/src/cmd/reply.rs | 1 + gcli/src/cmd/send.rs | 1 + gcli/src/cmd/transfer.rs | 1 + gcli/src/cmd/upload.rs | 4 +- gclient/src/api/calls.rs | 18 ++++- gclient/src/api/rpc.rs | 4 + gsdk/src/signer/calls.rs | 159 ++++++++++++++++++++++----------------- gsdk/src/signer/mod.rs | 83 ++++++++++++++++++-- gsdk/src/signer/rpc.rs | 32 ++++++-- gsdk/src/signer/utils.rs | 19 +++-- gsdk/tests/rpc.rs | 13 +++- 13 files changed, 238 insertions(+), 101 deletions(-) diff --git a/gcli/src/cmd/claim.rs b/gcli/src/cmd/claim.rs index cd248d8a60d..730cbcff38d 100644 --- a/gcli/src/cmd/claim.rs +++ b/gcli/src/cmd/claim.rs @@ -32,7 +32,7 @@ impl Claim { pub async fn exec(&self, signer: Signer) -> Result<()> { let message_id = self.message_id.to_hash()?.into(); - signer.claim_value(message_id).await?; + signer.calls.claim_value(message_id).await?; Ok(()) } diff --git a/gcli/src/cmd/create.rs b/gcli/src/cmd/create.rs index fb7e4f9b513..0f30db2b585 100644 --- a/gcli/src/cmd/create.rs +++ b/gcli/src/cmd/create.rs @@ -50,6 +50,7 @@ impl Create { let gas = if self.gas_limit == 0 { signer + .rpc .calculate_create_gas(None, code_id, payload.clone(), self.value, false, None) .await? .min_limit @@ -62,6 +63,7 @@ impl Create { // create program signer + .calls .create_program(code_id, self.salt.to_vec()?, payload, gas_limit, self.value) .await?; diff --git a/gcli/src/cmd/reply.rs b/gcli/src/cmd/reply.rs index b2c4b60f56f..ebf48079fb9 100644 --- a/gcli/src/cmd/reply.rs +++ b/gcli/src/cmd/reply.rs @@ -57,6 +57,7 @@ impl Reply { let reply_to_id = self.reply_to_id.to_hash()?; signer + .calls .send_reply( reply_to_id.into(), self.payload.to_vec()?, diff --git a/gcli/src/cmd/send.rs b/gcli/src/cmd/send.rs index 551c4d033ff..8fee0608a0c 100644 --- a/gcli/src/cmd/send.rs +++ b/gcli/src/cmd/send.rs @@ -60,6 +60,7 @@ pub struct Send { impl Send { pub async fn exec(&self, signer: Signer) -> Result<()> { signer + .calls .send_message( self.destination.to_hash()?.into(), self.payload.to_vec()?, diff --git a/gcli/src/cmd/transfer.rs b/gcli/src/cmd/transfer.rs index 633239f9ce1..ff0f4feb956 100644 --- a/gcli/src/cmd/transfer.rs +++ b/gcli/src/cmd/transfer.rs @@ -50,6 +50,7 @@ impl Transfer { println!("Value: {}", self.value); signer + .calls .transfer(AccountId32::from_ss58check(&self.destination)?, self.value) .await?; diff --git a/gcli/src/cmd/upload.rs b/gcli/src/cmd/upload.rs index 1b9a115322f..34635284f92 100644 --- a/gcli/src/cmd/upload.rs +++ b/gcli/src/cmd/upload.rs @@ -49,13 +49,14 @@ impl Upload { pub async fn exec(&self, signer: Signer) -> Result<()> { let code = fs::read(&self.code)?; if self.code_only { - signer.upload_code(code).await?; + signer.calls.upload_code(code).await?; return Ok(()); } let payload = self.payload.to_vec()?; let gas = if self.gas_limit == 0 { signer + .rpc .calculate_upload_gas(None, code.clone(), payload.clone(), self.value, false, None) .await? .min_limit @@ -66,6 +67,7 @@ impl Upload { // Estimate gas and upload program. let gas_limit = signer.api().cmp_gas_limit(gas)?; signer + .calls .upload_program(code, self.salt.to_vec()?, payload, gas_limit, self.value) .await?; diff --git a/gclient/src/api/calls.rs b/gclient/src/api/calls.rs index 4d6cd0d3c39..bf4cee2aee7 100644 --- a/gclient/src/api/calls.rs +++ b/gclient/src/api/calls.rs @@ -98,7 +98,7 @@ impl GearApi { pub async fn transfer(&self, destination: ProgramId, value: u128) -> Result { let destination: [u8; 32] = destination.into(); - let tx = self.0.transfer(destination, value).await?; + let tx = self.0.calls.transfer(destination, value).await?; for event in tx.wait_for_success().await?.iter() { if let Event::Balances(BalancesEvent::Transfer { .. }) = @@ -165,6 +165,7 @@ impl GearApi { let tx = self .0 + .calls .create_program(code_id, salt, payload, gas_limit, value) .await?; @@ -357,16 +358,19 @@ impl GearApi { dest_node_api .0 + .storage .set_code_storage(src_code_id, &src_code) .await?; dest_node_api .0 + .storage .set_code_len_storage(src_code_id, src_code_len) .await?; dest_node_api .0 + .storage .set_gas_nodes(&src_program_reserved_gas_nodes) .await?; @@ -411,6 +415,7 @@ impl GearApi { dest_node_api .0 + .storage .set_total_issuance( dest_gas_total_issuance.saturating_add(src_program_reserved_gas_total), ) @@ -418,12 +423,14 @@ impl GearApi { dest_node_api .0 + .storage .set_gpages(dest_program_id, &src_program_pages) .await?; src_program.expiration_block = dest_node_api.last_block_number().await?; dest_node_api .0 + .storage .set_gprog(dest_program_id, src_program) .await?; @@ -513,7 +520,7 @@ impl GearApi { ) .await?; - self.0.set_gpages(program_id, &pages).await?; + self.0.storage.set_gpages(program_id, &pages).await?; Ok(()) } @@ -537,7 +544,7 @@ impl GearApi { .await? .map(|(message, _interval)| message.value()); - let tx = self.0.claim_value(message_id).await?; + let tx = self.0.calls.claim_value(message_id).await?; for event in tx.wait_for_success().await?.iter() { if let Event::Gear(GearEvent::UserMessageRead { .. }) = @@ -639,6 +646,7 @@ impl GearApi { let tx = self .0 + .calls .send_message(destination, payload, gas_limit, value, prepaid) .await?; @@ -754,6 +762,7 @@ impl GearApi { let tx = self .0 + .calls .send_reply(reply_to_id, payload, gas_limit, value, prepaid) .await?; @@ -884,7 +893,7 @@ impl GearApi { /// - [`upload_program`](Self::upload_program) function uploads a new /// program and initialize it. pub async fn upload_code(&self, code: impl AsRef<[u8]>) -> Result<(CodeId, H256)> { - let tx = self.0.upload_code(code.as_ref().to_vec()).await?; + let tx = self.0.calls.upload_code(code.as_ref().to_vec()).await?; for event in tx.wait_for_success().await?.iter() { if let Event::Gear(GearEvent::CodeChanged { @@ -999,6 +1008,7 @@ impl GearApi { let tx = self .0 + .calls .upload_program(code, salt, payload, gas_limit, value) .await?; diff --git a/gclient/src/api/rpc.rs b/gclient/src/api/rpc.rs index 13d435a968f..e1afb50312b 100644 --- a/gclient/src/api/rpc.rs +++ b/gclient/src/api/rpc.rs @@ -65,6 +65,7 @@ impl GearApi { at: Option, ) -> Result { self.0 + .rpc .calculate_create_gas(origin, code_id, payload, value, allow_other_panics, at) .await .map_err(Into::into) @@ -109,6 +110,7 @@ impl GearApi { at: Option, ) -> Result { self.0 + .rpc .calculate_upload_gas(origin, code, payload, value, allow_other_panics, at) .await .map_err(Into::into) @@ -158,6 +160,7 @@ impl GearApi { at: Option, ) -> Result { self.0 + .rpc .calculate_handle_gas(origin, destination, payload, value, allow_other_panics, at) .await .map_err(Into::into) @@ -203,6 +206,7 @@ impl GearApi { at: Option, ) -> Result { self.0 + .rpc .calculate_reply_gas(origin, message_id, payload, value, allow_other_panics, at) .await .map_err(Into::into) diff --git a/gsdk/src/signer/calls.rs b/gsdk/src/signer/calls.rs index d7aef241e9f..d148d92af2a 100644 --- a/gsdk/src/signer/calls.rs +++ b/gsdk/src/signer/calls.rs @@ -17,6 +17,7 @@ // along with this program. If not, see . //! gear api calls +use super::SignerInner; use crate::{ config::GearConfig, metadata::{ @@ -32,7 +33,7 @@ use crate::{ sudo::Event as SudoEvent, Event, }, - signer::Signer, + signer::SignerRpc, utils::storage_address_bytes, Api, BlockNumber, Error, GearGasNode, GearGasNodeId, GearPages, Result, TxInBlock, TxStatus, }; @@ -44,6 +45,7 @@ use gear_core::{ use hex::ToHex; use parity_scale_codec::Encode; use sp_runtime::AccountId32; +use std::sync::Arc; use subxt::{ blocks::ExtrinsicEvents, dynamic::Value, @@ -57,23 +59,32 @@ use subxt::{ type TxProgressT = TxProgress>; type EventsResult = Result, Error>; +/// Implementation of calls to programs/other users for [`Signer`]. +#[derive(Clone)] +pub struct SignerCalls(pub(crate) Arc); + +/// Implementation of storage calls for [`Signer`]. +#[derive(Clone)] +pub struct SignerStorage(pub(crate) Arc); + // pallet-balances -impl Signer { +impl SignerCalls { /// `pallet_balances::transfer` pub async fn transfer(&self, dest: impl Into, value: u128) -> Result { - self.run_tx( - BalancesCall::Transfer, - vec![ - Value::unnamed_variant("Id", [Value::from_bytes(dest.into())]), - Value::u128(value), - ], - ) - .await + self.0 + .run_tx( + BalancesCall::Transfer, + vec![ + Value::unnamed_variant("Id", [Value::from_bytes(dest.into())]), + Value::u128(value), + ], + ) + .await } } // pallet-gear -impl Signer { +impl SignerCalls { /// `pallet_gear::create_program` pub async fn create_program( &self, @@ -83,22 +94,24 @@ impl Signer { gas_limit: u64, value: u128, ) -> Result { - self.run_tx( - GearCall::CreateProgram, - vec![ - Value::from_bytes(code_id), - Value::from_bytes(salt), - Value::from_bytes(payload), - Value::u128(gas_limit as u128), - Value::u128(value), - ], - ) - .await + self.0 + .run_tx( + GearCall::CreateProgram, + vec![ + Value::from_bytes(code_id), + Value::from_bytes(salt), + Value::from_bytes(payload), + Value::u128(gas_limit as u128), + Value::u128(value), + ], + ) + .await } /// `pallet_gear::claim_value` pub async fn claim_value(&self, message_id: MessageId) -> Result { - self.run_tx(GearCall::ClaimValue, vec![Value::from_bytes(message_id)]) + self.0 + .run_tx(GearCall::ClaimValue, vec![Value::from_bytes(message_id)]) .await } @@ -111,17 +124,18 @@ impl Signer { value: u128, prepaid: bool, ) -> Result { - self.run_tx( - GearCall::SendMessage, - vec![ - Value::from_bytes(destination), - Value::from_bytes(payload), - Value::u128(gas_limit as u128), - Value::u128(value), - Value::bool(prepaid), - ], - ) - .await + self.0 + .run_tx( + GearCall::SendMessage, + vec![ + Value::from_bytes(destination), + Value::from_bytes(payload), + Value::u128(gas_limit as u128), + Value::u128(value), + Value::bool(prepaid), + ], + ) + .await } /// `pallet_gear::send_reply` @@ -133,22 +147,24 @@ impl Signer { value: u128, prepaid: bool, ) -> Result { - self.run_tx( - GearCall::SendReply, - vec![ - Value::from_bytes(reply_to_id), - Value::from_bytes(payload), - Value::u128(gas_limit as u128), - Value::u128(value), - Value::bool(prepaid), - ], - ) - .await + self.0 + .run_tx( + GearCall::SendReply, + vec![ + Value::from_bytes(reply_to_id), + Value::from_bytes(payload), + Value::u128(gas_limit as u128), + Value::u128(value), + Value::bool(prepaid), + ], + ) + .await } /// `pallet_gear::upload_code` pub async fn upload_code(&self, code: Vec) -> Result { - self.run_tx(GearCall::UploadCode, vec![Value::from_bytes(code)]) + self.0 + .run_tx(GearCall::UploadCode, vec![Value::from_bytes(code)]) .await } @@ -161,22 +177,23 @@ impl Signer { gas_limit: u64, value: u128, ) -> Result { - self.run_tx( - GearCall::UploadProgram, - vec![ - Value::from_bytes(code), - Value::from_bytes(salt), - Value::from_bytes(payload), - Value::u128(gas_limit as u128), - Value::u128(value), - ], - ) - .await + self.0 + .run_tx( + GearCall::UploadProgram, + vec![ + Value::from_bytes(code), + Value::from_bytes(salt), + Value::from_bytes(payload), + Value::u128(gas_limit as u128), + Value::u128(value), + ], + ) + .await } } // pallet-utility -impl Signer { +impl SignerInner { /// `pallet_utility::force_batch` pub async fn force_batch(&self, calls: Vec) -> Result { self.run_tx( @@ -188,7 +205,7 @@ impl Signer { } // pallet-sudo -impl Signer { +impl SignerInner { pub async fn process_sudo(&self, tx: DynamicPayload) -> EventsResult { let tx = self.process(tx).await?; let events = tx.wait_for_success().await?; @@ -229,10 +246,10 @@ impl Signer { } // pallet-system -impl Signer { +impl SignerStorage { /// Sets storage values via calling sudo pallet pub async fn set_storage(&self, items: &[(impl StorageAddress, impl Encode)]) -> EventsResult { - let metadata = self.api().metadata(); + let metadata = self.0.api().metadata(); let mut items_to_set = Vec::with_capacity(items.len()); for item in items { let item_key = storage_address_bytes(&item.0, &metadata)?; @@ -246,15 +263,16 @@ impl Signer { items_to_set.push((item_key, item_value_bytes)); } - self.sudo(RuntimeCall::System(Call::set_storage { - items: items_to_set, - })) - .await + self.0 + .sudo(RuntimeCall::System(Call::set_storage { + items: items_to_set, + })) + .await } } // pallet-gas -impl Signer { +impl SignerStorage { /// Writes gas total issuance into storage. pub async fn set_total_issuance(&self, value: u64) -> EventsResult { let addr = Api::storage_root(GearGasStorage::TotalIssuance); @@ -277,7 +295,7 @@ impl Signer { } // pallet-gear-program -impl Signer { +impl SignerStorage { /// Writes `InstrumentedCode` length into storage at `CodeId` pub async fn set_code_len_storage(&self, code_id: CodeId, code_len: u32) -> EventsResult { let addr = Api::storage( @@ -334,7 +352,7 @@ impl Signer { } // Singer utils -impl Signer { +impl SignerInner { /// Propagates log::info for given status. pub(crate) fn log_status(&self, status: &TxStatus) { match status { @@ -382,7 +400,9 @@ impl Signer { pub async fn process<'a>(&self, tx: DynamicPayload) -> Result { use subxt::tx::TxStatus::*; - let before = self.balance().await?; + let signer_rpc = SignerRpc(Arc::new(self.clone())); + let before = signer_rpc.get_balance().await?; + let mut process = self.sign_and_submit_then_watch(&tx).await?; let (pallet, name) = (tx.pallet_name(), tx.call_name()); @@ -401,7 +421,6 @@ impl Signer { b.extrinsic_hash(), b.block_hash() ); - self.log_balance_spent(before).await?; return Ok(b); } diff --git a/gsdk/src/signer/mod.rs b/gsdk/src/signer/mod.rs index c421673bc69..d8e1f1161b5 100644 --- a/gsdk/src/signer/mod.rs +++ b/gsdk/src/signer/mod.rs @@ -17,22 +17,44 @@ // along with this program. If not, see . //! Gear api with signer + use crate::{ config::GearConfig, result::{Error, Result}, Api, }; +use calls::{SignerCalls, SignerStorage}; +use core::ops::Deref; pub use pair_signer::PairSigner; +use rpc::SignerRpc; use sp_core::{crypto::Ss58Codec, sr25519::Pair, Pair as PairT}; use sp_runtime::AccountId32; +use std::sync::Arc; mod calls; mod pair_signer; mod rpc; mod utils; +/// Signer representation that provides access to gear API. +/// Implements low-level methods such as [`run_tx`](`SignerInner::run_tx`) +/// and [`force_batch`](`SignerInner::force_batch`). +/// Other higher-level calls are provided by [`Signer::storage`], +/// [`Signer::calls`], [`Signer::rpc`]. #[derive(Clone)] pub struct Signer { + signer: Arc, + /// Calls that get or set storage. + pub storage: SignerStorage, + /// Calls for interaction with on-chain programs. + pub calls: SignerCalls, + /// Calls to fetch data from node. + pub rpc: SignerRpc, +} + +/// Implementation of low-level calls for [`Signer`]. +#[derive(Clone)] +pub struct SignerInner { api: Api, /// Current signer. signer: PairSigner, @@ -42,32 +64,69 @@ pub struct Signer { impl Signer { /// New signer api. pub fn new(api: Api, suri: &str, passwd: Option<&str>) -> Result { - Ok(Self { + let signer = SignerInner { api, signer: PairSigner::new( Pair::from_string(suri, passwd).map_err(|_| Error::InvalidSecret)?, ), nonce: None, - }) + }; + + Ok(Self::from_inner(signer)) + } + + fn from_inner(signer: SignerInner) -> Self { + let signer = Arc::new(signer); + + Self { + storage: SignerStorage(signer.clone()), + calls: SignerCalls(signer.clone()), + rpc: SignerRpc(signer.clone()), + signer, + } + } + + #[deny(unused_variables)] + fn replace_inner(&mut self, inner: SignerInner) { + let Signer { + signer, + storage, + calls, + rpc, + } = self; + + *signer = Arc::new(inner); + *storage = SignerStorage(signer.clone()); + *calls = SignerCalls(signer.clone()); + *rpc = SignerRpc(signer.clone()); } /// Change inner signer. pub fn change(mut self, suri: &str, passwd: Option<&str>) -> Result { let signer = PairSigner::new(Pair::from_string(suri, passwd).map_err(|_| Error::InvalidSecret)?); - self.signer = signer; + + self.replace_inner(SignerInner { + signer, + ..self.signer.as_ref().clone() + }); Ok(self) } /// Set nonce of the signer pub fn set_nonce(&mut self, nonce: u32) { - self.nonce = Some(nonce) + self.replace_inner(SignerInner { + nonce: Some(nonce), + ..self.signer.as_ref().clone() + }); } +} +impl SignerInner { /// Get address of the current signer pub fn address(&self) -> String { - self.signer.account_id().to_ss58check() + self.account_id().to_ss58check() } /// Get address of the current signer @@ -83,10 +142,20 @@ impl Signer { impl From<(Api, PairSigner)> for Signer { fn from((api, signer): (Api, PairSigner)) -> Self { - Signer { + let signer = SignerInner { api, signer, nonce: None, - } + }; + + Self::from_inner(signer) + } +} + +impl Deref for Signer { + type Target = SignerInner; + + fn deref(&self) -> &SignerInner { + self.signer.as_ref() } } diff --git a/gsdk/src/signer/rpc.rs b/gsdk/src/signer/rpc.rs index 6fa642be1c1..912531fd809 100644 --- a/gsdk/src/signer/rpc.rs +++ b/gsdk/src/signer/rpc.rs @@ -18,14 +18,28 @@ //! RPC calls with signer -use crate::{result::Result, signer::Signer, GasInfo}; +use crate::{result::Result, signer::SignerInner, GasInfo}; use gear_core::ids::{CodeId, MessageId, ProgramId}; use sp_core::H256; +use std::sync::Arc; -impl Signer { +/// Implementation of calls to node RPC for [`Signer`]. +#[derive(Clone)] +pub struct SignerRpc(pub(crate) Arc); + +impl SignerRpc { /// public key of the signer in H256 pub fn source(&self) -> H256 { - AsRef::<[u8; 32]>::as_ref(self.signer.account_id()).into() + AsRef::<[u8; 32]>::as_ref(self.0.account_id()).into() + } + + /// Get self balance. + pub async fn get_balance(&self) -> Result { + self.0 + .as_ref() + .api() + .get_balance(&self.0.as_ref().address()) + .await } /// gear_calculateInitCreateGas @@ -38,7 +52,8 @@ impl Signer { allow_other_panics: bool, at: Option, ) -> Result { - self.api + self.0 + .api .calculate_create_gas( origin.unwrap_or_else(|| self.source()), code_id, @@ -60,7 +75,8 @@ impl Signer { allow_other_panics: bool, at: Option, ) -> Result { - self.api + self.0 + .api .calculate_upload_gas( origin.unwrap_or_else(|| self.source()), code, @@ -82,7 +98,8 @@ impl Signer { allow_other_panics: bool, at: Option, ) -> Result { - self.api + self.0 + .api .calculate_handle_gas( origin.unwrap_or_else(|| self.source()), destination, @@ -104,7 +121,8 @@ impl Signer { allow_other_panics: bool, at: Option, ) -> Result { - self.api + self.0 + .api .calculate_reply_gas( origin.unwrap_or_else(|| self.source()), message_id, diff --git a/gsdk/src/signer/utils.rs b/gsdk/src/signer/utils.rs index e815cf92efc..f4d88a5f4a5 100644 --- a/gsdk/src/signer/utils.rs +++ b/gsdk/src/signer/utils.rs @@ -18,23 +18,22 @@ //! Utils +use std::sync::Arc; + +use super::SignerInner; use crate::{ - config::GearConfig, metadata::CallInfo, result::Result, signer::Signer, Error, TxInBlock, + config::GearConfig, metadata::CallInfo, result::Result, signer::SignerRpc, Error, TxInBlock, }; use scale_value::Composite; use subxt::blocks::ExtrinsicEvents; type EventsResult = Result, Error>; -impl Signer { - /// Get self balance - pub async fn balance(&self) -> Result { - self.api().get_balance(&self.address()).await - } - +impl SignerInner { /// Logging balance spent pub async fn log_balance_spent(&self, before: u128) -> Result<()> { - let after = before.saturating_sub(self.balance().await?); + let signer_rpc = SignerRpc(Arc::new(self.clone())); + let after = before.saturating_sub(signer_rpc.get_balance().await?); log::info!(" Balance spent: {after}"); Ok(()) @@ -46,7 +45,7 @@ impl Signer { /// /// # You may not need this. /// - /// Read the docs of [`Signer`] to checkout the wrappred transactions, + /// Read the docs of [`Signer`](`super::Signer`) to checkout the wrappred transactions, /// we need this function only when we want to execute a transaction /// which has not been wrapped in `gsdk`. /// @@ -74,7 +73,7 @@ impl Signer { /// // The code above euqals to: /// /// { - /// let in_block = signer.transfer(dest, value).await?; + /// let in_block = signer.calls.transfer(dest, value).await?; /// } /// /// // ... diff --git a/gsdk/tests/rpc.rs b/gsdk/tests/rpc.rs index 8d4d111cd39..ec375c5b6d0 100644 --- a/gsdk/tests/rpc.rs +++ b/gsdk/tests/rpc.rs @@ -84,16 +84,19 @@ async fn test_calculate_create_gas() -> Result<()> { .await? .signer("//Alice", None)?; signer + .calls .upload_code(demo_messager::WASM_BINARY.to_vec()) .await?; // 2. calculate create gas and create program. let code_id = CodeId::generate(demo_messager::WASM_BINARY); let gas_info = signer + .rpc .calculate_create_gas(None, code_id, vec![], 0, true, None) .await?; signer + .calls .create_program(code_id, vec![], vec![], gas_info.min_limit, 0) .await?; @@ -113,6 +116,7 @@ async fn test_calculate_handle_gas() -> Result<()> { .signer("//Alice", None)?; signer + .calls .upload_program( demo_messager::WASM_BINARY.to_vec(), salt, @@ -126,10 +130,12 @@ async fn test_calculate_handle_gas() -> Result<()> { // 2. calculate handle gas and send message. let gas_info = signer + .rpc .calculate_handle_gas(None, pid, vec![], 0, true, None) .await?; signer + .calls .send_message(pid, vec![], gas_info.min_limit, 0, false) .await?; @@ -151,6 +157,7 @@ async fn test_calculate_reply_gas() -> Result<()> { .await? .signer("//Alice", None)?; signer + .calls .upload_program( demo_waiter::WASM_BINARY.to_vec(), salt, @@ -164,6 +171,7 @@ async fn test_calculate_reply_gas() -> Result<()> { // 2. send wait message. signer + .calls .send_message(pid, payload.encode(), 100_000_000_000, 0, false) .await?; @@ -176,10 +184,12 @@ async fn test_calculate_reply_gas() -> Result<()> { // 3. calculate reply gas and send reply. let gas_info = signer + .rpc .calculate_reply_gas(None, message_id, vec![], 0, true, None) .await?; signer + .calls .send_reply(message_id, vec![], gas_info.min_limit, 0, false) .await?; @@ -278,6 +288,7 @@ async fn test_original_code_storage() -> Result<()> { .signer("//Alice", None)?; signer + .calls .upload_program( demo_messager::WASM_BINARY.to_vec(), salt, @@ -290,7 +301,7 @@ async fn test_original_code_storage() -> Result<()> { let program = signer.api().gprog(pid).await?; let rpc = signer.api().rpc(); let last_block = rpc.block(None).await?.unwrap().block.header.number(); - let block_hash = rpc.block_hash(Some(last_block.into())).await?.unwrap(); + let block_hash = rpc.block_hash(Some(last_block.into())).await?; let code = signer .api() .original_code_storage_at(program.code_hash.0.into(), block_hash) From b74a34a94603736124ab223d56e5f901f22ba671 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Sat, 19 Aug 2023 19:04:33 +0400 Subject: [PATCH 063/165] ci(label): trigger workflows on labelling (#3070) --- .github/actions/label/build.js | 179 ++++++++++++++++++++++++++++++ .github/workflows/build-macos.yml | 56 ++++++++++ .github/workflows/build.yml | 46 +------- .github/workflows/label.yml | 30 +++++ 4 files changed, 268 insertions(+), 43 deletions(-) create mode 100644 .github/actions/label/build.js create mode 100644 .github/workflows/build-macos.yml create mode 100644 .github/workflows/label.yml diff --git a/.github/actions/label/build.js b/.github/actions/label/build.js new file mode 100644 index 00000000000..39503e28172 --- /dev/null +++ b/.github/actions/label/build.js @@ -0,0 +1,179 @@ +/** + * Javascript module for the label action. + */ + +const [owner, repo] = ["gear-tech", "gear"]; +const { LABEL, REF, HEAD_SHA } = process.env; +const linux = LABEL === "A0-pleasereview"; +const checks = linux ? ["linux", "win-cross"] : ["x86"]; +const workflow_id = linux + ? ".github/workflows/build.yml" + : ".github/workflows/build-macos.yml"; + +/** + * Sleep for ms milliseconds. + **/ +const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); + +/** + * If skipping this action. + **/ +const skip = async ({ github }) => { + const { + data: { check_runs }, + } = await github.rest.checks.listForRef({ + owner, + repo, + ref: REF, + }); + + const runs = linux + ? check_runs.filter((run) => run.name === "build" || run.name === "build / linux") + : check_runs.filter((run) => run.name === "build / macox-x86"); + + if (runs.length === 0) return false; + for (run of runs) { + if (run.conclusion !== "skipped") return true; + } + + return false; +}; + +/** + * Create build checks. + * + * TODO: + * * Queue the new created checks to check suite PR (#3087). + * * Support re-runing the checks. (#3088) + **/ +const createChecks = async ({ core, github }) => { + let status = {}; + for (check of checks) { + const { data: res } = await github.rest.checks.create({ + owner, + repo, + name: `build / ${check}`, + head_sha: HEAD_SHA, + }); + + core.info(`Created check ${check}`); + status[check] = res; + } + + return status; +}; + +/** + * Dispatch the target workflow. + */ +const dispatchWorkflow = async ({ core, github }) => { + await github.rest.actions.createWorkflowDispatch({ + owner, + repo, + workflow_id, + ref: REF, + }); + + await sleep(10000); + + // Get the target workflow run + const { + data: { workflow_runs }, + } = await github.rest.actions.listWorkflowRuns({ + owner, + repo, + workflow_id, + head_sha: HEAD_SHA, + }); + + if (workflow_runs.length != 1) { + core.setFailed(`Incorrect workflow runs`); + return; + } + + return workflow_runs[0]; +}; + +/// List jobs of workflow run. +const listJobs = async ({ github, core, run_id }) => { + const { + data: { jobs }, + } = await github.rest.actions.listJobsForWorkflowRun({ + owner, + repo, + run_id, + }); + + if (jobs.length === 0) { + core.setFailed(`Empty jobs from dispatched workflow`); + return; + } + + const requiredJobs = jobs.filter((job) => checks.includes(job.name)); + if (requiredJobs.length !== checks.length) { + core.setFailed(`Incorrect count for disptached jobs`); + return; + } + + return requiredJobs; +}; + +/** + * The main function. + **/ +module.exports = async ({ github, core }) => { + if (await skip({ github })) { + core.info("Build has already been processed."); + return; + } + + const run = await dispatchWorkflow({ core, github }); + let labelChecks = await createChecks({ core, github }); + + while (true) { + const jobs = await listJobs({ github, core, run_id: run.id }); + completed = jobs.filter((job) => job.status === "completed").length; + + for (job of jobs) { + let checkJob = labelChecks[job.name]; + if ( + checkJob.status !== job.status || + checkJob.conclusion !== job.conclusion + ) { + core.info( + `Updating check ${job.name}, status: ${job.status}, conclusion: ${job.conclusion}` + ); + + let { status, conclusion } = job; + + let data = { + owner, + repo, + check_run_id: checkJob.id, + status, + output: { + title: `Build ${job.name}`, + summary: `ref ${job.html_url}`, + }, + }; + + labelChecks[job.name].status = status; + if (conclusion) { + data.conclusion = conclusion; + labelChecks[job.name].conclusion = conclusion; + } + + await github.rest.checks.update(data); + } else { + continue; + } + } + + if (completed === checks.length) { + core.info("All jobs completed."); + break; + } else { + await sleep(10000); + } + } +}; diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml new file mode 100644 index 00000000000..8ab63dd12da --- /dev/null +++ b/.github/workflows/build-macos.yml @@ -0,0 +1,56 @@ +name: Build MacOS + +on: + workflow_call: + workflow_dispatch: + +env: + CARGO_INCREMENTAL: 0 + CARGO_TERM_COLOR: always + RUST_BACKTRACE: short + TERM: xterm-256color + BINARYEN_VERSION: version_111 + +jobs: + x86: + runs-on: macos-latest + env: + RUSTUP_HOME: /tmp/rustup_home + steps: + - name: "ACTIONS: Checkout" + uses: actions/checkout@v3 + + - name: "ACTIONS: Setup caching" + uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: "Install: protobuf" + run: brew install protobuf + + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: "Install: cargo-nextest" + run: curl -LsSf https://get.nexte.st/latest/mac | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin + + - name: "Build: Node" + run: >- + cargo build + -p gear-cli --features=lazy-pages + + - name: "Test: Lazy pages" + run: >- + cargo nextest run + -p "pallet-*" + -p gear-lazy-pages + -p gear-runtime-interface + --features=lazy-pages diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 56712d14826..0aaf814d993 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -247,47 +247,7 @@ jobs: env: CARGO_BUILD_TARGET: x86_64-pc-windows-msvc - macos-x86: - if: ${{ always() && inputs.macos }} + macos: needs: linux - runs-on: macos-latest - env: - RUSTUP_HOME: /tmp/rustup_home - steps: - - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 - - - name: "ACTIONS: Setup caching" - uses: actions/cache@v3 - with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ - target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - restore-keys: | - ${{ runner.os }}-cargo- - - - name: "Install: protobuf" - run: brew install protobuf - - - name: "Install: Rust toolchain" - uses: dsherret/rust-toolchain-file@v1 - - - name: "Install: cargo-nextest" - run: curl -LsSf https://get.nexte.st/latest/mac | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin - - - name: "Build: Node" - run: >- - cargo build - -p gear-cli --features=lazy-pages - - - name: "Test: Lazy pages" - run: >- - cargo nextest run - -p "pallet-*" - -p gear-lazy-pages - -p gear-runtime-interface - --features=lazy-pages + if: ${{ always() && inputs.macos }} + uses: ./.github/workflows/build-macos.yml diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml new file mode 100644 index 00000000000..187032b8adc --- /dev/null +++ b/.github/workflows/label.yml @@ -0,0 +1,30 @@ +name: Label + +on: + pull_request: + branches: [master, vara-stage-1, vara-stage-2, vara-stage-3] + types: [labeled] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + dispatch: + runs-on: ubuntu-latest + if: >- + github.event.label.name == 'A0-pleasereview' + || github.event.label.name == 'E2-forcemacos' + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/github-script@v6 + env: + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + LABEL: ${{ github.event.label.name }} + REF: ${{ github.head_ref || github.ref_name }} + with: + script: | + const script = require('./.github/actions/label/build.js'); + await script({ github, core }); From 9d32b41f22f2c57aa3706039a829b797ad00bf0b Mon Sep 17 00:00:00 2001 From: ekovalev Date: Sat, 19 Aug 2023 22:57:34 +0400 Subject: [PATCH 064/165] fix(authorship): Forward-fix a test that will require the gear-bank account to exist (#3118) --- Cargo.lock | 1 + node/authorship/Cargo.toml | 1 + node/authorship/src/tests.rs | 50 ++++++++++++++++++++++++++---------- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 91e904a5fa0..7da3b19afde 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3677,6 +3677,7 @@ dependencies = [ "gear-node-testing", "gear-runtime-primitives", "log", + "pallet-balances", "pallet-gear", "pallet-gear-messenger", "pallet-gear-rpc-runtime-api", diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index 3dabd4fc783..d8a95695478 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -52,6 +52,7 @@ sp-consensus-babe = { workspace = true, features = ["std"] } sp-state-machine = { workspace = true, features = ["std"] } pallet-sudo = { workspace = true, features = ["std"] } pallet-timestamp = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } pallet-gear = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } testing.workspace = true diff --git a/node/authorship/src/tests.rs b/node/authorship/src/tests.rs index 775062f6018..cd9cf21fa08 100644 --- a/node/authorship/src/tests.rs +++ b/node/authorship/src/tests.rs @@ -101,6 +101,19 @@ fn checked_extrinsics(n: u32, signer: AccountId, nonce: &mut u32) -> Vec RuntimeCall { + RuntimeCall::Sudo(pallet_sudo::Call::sudo { + call: Box::new(RuntimeCall::Balances(pallet_balances::Call::set_balance { + who: sp_runtime::MultiAddress::Id(AccountId::from(BANK_ADDRESS)), + new_free: 1_000_000_000_000_000, + new_reserved: 0, + })), + }) +} + pub(crate) fn init_logger() { let _ = env_logger::Builder::from_default_env() .format_module_path(false) @@ -519,19 +532,28 @@ fn block_max_gas_works() { let genesis_hash = <[u8; 32]>::try_from(&client.info().best_hash[..]).expect("H256 is a 32 byte type"); let mut nonce = 0_u32; + // Create an extrinsic that prefunds the bank account + let pre_fund_bank_xt = sign( + CheckedExtrinsic { + signed: Some((alice(), signed_extra(0))), + function: pre_fund_bank_account_call(), + }, + VERSION.spec_version, + VERSION.transaction_version, + genesis_hash, + ); + + let mut extrinsics = vec![pre_fund_bank_xt.into()]; // Creating 5 extrinsics - let extrinsics = checked_extrinsics(5, bob(), &mut nonce) - .iter() - .map(|x| { - sign( - x.clone(), - VERSION.spec_version, - VERSION.transaction_version, - genesis_hash, - ) - .into() - }) - .collect::>(); + extrinsics.extend(checked_extrinsics(5, bob(), &mut nonce).iter().map(|x| { + sign( + x.clone(), + VERSION.spec_version, + VERSION.transaction_version, + genesis_hash, + ) + .into() + })); block_on(txpool.submit_at(&BlockId::number(0), SOURCE, extrinsics)).unwrap(); @@ -581,8 +603,8 @@ fn block_max_gas_works() { )) .unwrap(); - // All extrinsics have been included in the block: 1 inherent + 5 normal + 1 terminal - assert_eq!(proposal.block.extrinsics().len(), 7); + // All extrinsics have been included in the block: 1 inherent + sudo + 5 normal + 1 terminal + assert_eq!(proposal.block.extrinsics().len(), 8); // Importing block #1 block_on(client.import(BlockOrigin::Own, proposal.block.clone())).unwrap(); From b0c3784ea2a349cac4ea75f1dccb2ca3c4873a1f Mon Sep 17 00:00:00 2001 From: Georgy Shepelev Date: Sun, 20 Aug 2023 16:36:58 +0400 Subject: [PATCH 065/165] refactor(node): Terminate the program in RemoveFromWaitlist task for init-message (#3085) --- .../src/scheme/demo_wait_init_exit_reply.rs | 47 +++++ examples/constructor/src/scheme/mod.rs | 1 + pallets/gear/src/manager/journal.rs | 110 ++--------- pallets/gear/src/manager/mod.rs | 119 ++++++++---- pallets/gear/src/manager/task.rs | 72 +++----- pallets/gear/src/tests.rs | 172 ++++++++++++++++++ 6 files changed, 349 insertions(+), 172 deletions(-) create mode 100644 examples/constructor/src/scheme/demo_wait_init_exit_reply.rs diff --git a/examples/constructor/src/scheme/demo_wait_init_exit_reply.rs b/examples/constructor/src/scheme/demo_wait_init_exit_reply.rs new file mode 100644 index 00000000000..bea2b68c1b6 --- /dev/null +++ b/examples/constructor/src/scheme/demo_wait_init_exit_reply.rs @@ -0,0 +1,47 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{Calls, Scheme}; + +pub fn init() -> Calls { + let source_var = "source_var"; + + Calls::builder() + // Storing source id under `source_var`. + .source(source_var) + .send(source_var, []) + .wait() +} + +pub fn handle() -> Calls { + Calls::builder().noop() +} + +pub fn handle_reply() -> Calls { + let source_var = "source_var"; + + Calls::builder() + // Storing source id under `source_var`. + .source(source_var) + // Exit call. + .exit(source_var) +} + +pub fn scheme() -> Scheme { + Scheme::predefined(init(), handle(), handle_reply()) +} diff --git a/examples/constructor/src/scheme/mod.rs b/examples/constructor/src/scheme/mod.rs index e2365ab4684..a13a3379d1a 100644 --- a/examples/constructor/src/scheme/mod.rs +++ b/examples/constructor/src/scheme/mod.rs @@ -8,6 +8,7 @@ pub mod demo_ping; pub mod demo_proxy_with_gas; pub mod demo_reply_deposit; pub mod demo_value_sender; +pub mod demo_wait_init_exit_reply; #[derive(Encode, Decode, Clone, Debug)] /// Represents behavior pattern of `demo_constructor`. diff --git a/pallets/gear/src/manager/journal.rs b/pallets/gear/src/manager/journal.rs index 5bbb2fb1e61..5fb98f3faca 100644 --- a/pallets/gear/src/manager/journal.rs +++ b/pallets/gear/src/manager/journal.rs @@ -29,10 +29,7 @@ use common::{ CodeStorage, LockableTree, Origin, Program, ProgramState, ProgramStorage, ReservableTree, }; use core_processor::common::{DispatchOutcome as CoreDispatchOutcome, JournalHandler}; -use frame_support::{ - sp_runtime::Saturating, - traits::{Currency, ExistenceRequirement, ReservableCurrency}, -}; +use frame_support::{sp_runtime::Saturating, traits::ReservableCurrency}; use frame_system::pallet_prelude::BlockNumberFor; use gear_core::{ ids::{CodeId, MessageId, ProgramId, ReservationId}, @@ -142,66 +139,9 @@ where executed, .. } => { - log::trace!( - "Dispatch ({:?}) init failure for program {:?}", - message_id, - program_id - ); - - // Some messages addressed to the program could be processed - // in the queue before init message. For example, that could - // happen when init message had more gas limit then rest block - // gas allowance, but a dispatch message to the program was - // dequeued. The other case is async init. - wake_waiting_init_msgs(program_id); - - // If we run into `InitFailure` after real execution (not - // prepare or precharge) processor methods, then we are - // sure that it was active program. - let maybe_inactive = !executed; - - self.clean_reservation_tasks(program_id, maybe_inactive); - - ProgramStorageOf::::update_program_if_active(program_id, |p, bn| { - let _ = TaskPoolOf::::delete( - bn, - ScheduledTask::PauseProgram(program_id), - ); - - *p = Program::Terminated(origin); - }).unwrap_or_else(|e| { - if !maybe_inactive { - unreachable!( - "Program terminated status may only be set to an existing active program: {:?}", - e, - ); - } - }); - - ProgramStorageOf::::remove_program_pages(program_id); - - let event = Event::ProgramChanged { - id: program_id, - change: ProgramChangeKind::Terminated, - }; - - let program_id = ::from_origin(program_id.into_origin()); - - let balance = CurrencyOf::::free_balance(&program_id); - let destination = Pallet::::inheritor_for(origin); - let destination = ::from_origin(destination.into_origin()); - - if !balance.is_zero() { - CurrencyOf::::transfer( - &program_id, - &destination, - balance, - ExistenceRequirement::AllowDeath, - ) - .unwrap_or_else(|e| unreachable!("Failed to transfer value: {:?}", e)); - } + log::trace!("Dispatch ({message_id:?}) init failure for program {program_id:?}"); - Pallet::::deposit_event(event); + Self::process_failed_init(program_id, origin, executed); DispatchStatus::Failed } @@ -226,48 +166,30 @@ where } fn exit_dispatch(&mut self, id_exited: ProgramId, value_destination: ProgramId) { - log::debug!("Exit dispatch"); - - let reason = MessageWokenSystemReason::ProgramGotInitialized.into_reason(); - - WaitlistOf::::drain_key(id_exited).for_each(|entry| { - let message = Pallet::::wake_dispatch_requirements(entry, reason.clone()); - - QueueOf::::queue(message) - .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)); - }); - - let _ = ProgramStorageOf::::waiting_init_take_messages(id_exited); + log::debug!( + "Exit dispatch: id_exited = {id_exited}, value_destination = {value_destination}" + ); - // Program can't be inactive, cause it was executed. - self.clean_reservation_tasks(id_exited, false); + Self::clean_waitlist(id_exited); ProgramStorageOf::::update_program_if_active(id_exited, |p, bn| { let _ = TaskPoolOf::::delete(bn, ScheduledTask::PauseProgram(id_exited)); + match p { + Program::Active(program) => Self::remove_gas_reservation_map( + id_exited, + core::mem::take(&mut program.gas_reservation_map), + ), + _ => unreachable!("Action executed only for active program"), + } + *p = Program::Exited(value_destination); }) .unwrap_or_else(|e| { unreachable!("`exit` can be called only from active program: {:?}", e); }); - ProgramStorageOf::::remove_program_pages(id_exited); - - let program_account = &::from_origin(id_exited.into_origin()); - let balance = CurrencyOf::::free_balance(program_account); - - let destination = Pallet::::inheritor_for(value_destination); - let destination = ::from_origin(destination.into_origin()); - - if !balance.is_zero() { - CurrencyOf::::transfer( - program_account, - &destination, - balance, - ExistenceRequirement::AllowDeath, - ) - .unwrap_or_else(|e| unreachable!("Failed to transfer value: {:?}", e)); - } + Self::clean_inactive_program(id_exited, value_destination); } fn message_consumed(&mut self, message_id: MessageId) { diff --git a/pallets/gear/src/manager/mod.rs b/pallets/gear/src/manager/mod.rs index aaefbddff2e..8d25b8cf21a 100644 --- a/pallets/gear/src/manager/mod.rs +++ b/pallets/gear/src/manager/mod.rs @@ -52,18 +52,21 @@ use gear_core_errors::{ReplyCode, SignalCode}; pub use journal::*; pub use task::*; -use crate::{Config, CurrencyOf, GasHandlerOf, Pallet, ProgramStorageOf, QueueOf, TaskPoolOf}; +use crate::{ + Config, CurrencyOf, Event, GasHandlerOf, Pallet, ProgramStorageOf, QueueOf, TaskPoolOf, + WaitlistOf, +}; use common::{ event::*, - scheduler::{ScheduledTask, StorageType, TaskHandler, TaskPool}, - storage::{Interval, Queue}, - ActiveProgram, CodeStorage, Origin, ProgramState, ProgramStorage, ReservableTree, + scheduler::{ScheduledTask, StorageType, TaskPool}, + storage::{Interval, IterableByKeyMap, Queue}, + ActiveProgram, CodeStorage, Origin, Program, ProgramState, ProgramStorage, ReservableTree, }; use core::fmt; use core_processor::common::{Actor, ExecutableActorData}; use frame_support::{ codec::{Decode, Encode}, - traits::Currency, + traits::{Currency, ExistenceRequirement}, }; use frame_system::pallet_prelude::BlockNumberFor; use gear_core::{ @@ -74,10 +77,10 @@ use gear_core::{ reservation::GasReservationSlot, }; use primitive_types::H256; -use sp_runtime::traits::UniqueSaturatedInto; +use sp_runtime::traits::{UniqueSaturatedInto, Zero}; use sp_std::{ collections::{btree_map::BTreeMap, btree_set::BTreeSet}, - convert::{TryFrom, TryInto}, + convert::TryInto, marker::PhantomData, prelude::*, }; @@ -272,32 +275,6 @@ where .expect("set_program shouldn't be called for the existing id"); } - fn clean_reservation_tasks(&mut self, program_id: ProgramId, maybe_inactive: bool) { - let maybe_active_program = ProgramStorageOf::::get_program(program_id) - .and_then(|program| ActiveProgram::try_from(program).ok()); - - if maybe_active_program.is_none() && maybe_inactive { - return; - }; - - let active_program = maybe_active_program.unwrap_or_else(|| { - unreachable!("Clean reservations can only be called on active program") - }); - - for (reservation_id, reservation_slot) in active_program.gas_reservation_map { - >::remove_gas_reservation( - self, - program_id, - reservation_id, - ); - - let _ = TaskPoolOf::::delete( - BlockNumberFor::::from(reservation_slot.finish), - ScheduledTask::RemoveGasReservation(program_id, reservation_id), - ); - } - } - fn remove_gas_reservation_slot( reservation_id: ReservationId, slot: GasReservationSlot, @@ -388,4 +365,80 @@ where log::trace!("Signal wasn't sent due to inappropriate supply"); } } + + /// Removes memory pages of the program and transfers program balance to the `value_destination`. + fn clean_inactive_program(program_id: ProgramId, value_destination: ProgramId) { + ProgramStorageOf::::remove_program_pages(program_id); + + let program_account = &::from_origin(program_id.into_origin()); + let balance = CurrencyOf::::free_balance(program_account); + if !balance.is_zero() { + let destination = Pallet::::inheritor_for(value_destination); + let destination = ::from_origin(destination.into_origin()); + + CurrencyOf::::transfer( + program_account, + &destination, + balance, + ExistenceRequirement::AllowDeath, + ) + .unwrap_or_else(|e| unreachable!("Failed to transfer value: {e:?}")); + } + } + + /// Removes all messages to `program_id` from the waitlist. + fn clean_waitlist(program_id: ProgramId) { + let reason = MessageWokenSystemReason::ProgramGotInitialized.into_reason(); + + WaitlistOf::::drain_key(program_id).for_each(|entry| { + let message = Pallet::::wake_dispatch_requirements(entry, reason.clone()); + + QueueOf::::queue(message) + .unwrap_or_else(|e| unreachable!("Message queue corrupted! {e:?}")); + }); + + ProgramStorageOf::::waiting_init_remove(program_id); + } + + fn process_failed_init(program_id: ProgramId, origin: ProgramId, executed: bool) { + // Some messages addressed to the program could be processed + // in the queue before init message. For example, that could + // happen when init message had more gas limit then rest block + // gas allowance, but a dispatch message to the program was + // dequeued. The other case is async init. + Self::clean_waitlist(program_id); + + ProgramStorageOf::::update_program_if_active(program_id, |p, bn| { + let _ = TaskPoolOf::::delete(bn, ScheduledTask::PauseProgram(program_id)); + + match p { + Program::Active(program) => Self::remove_gas_reservation_map( + program_id, + core::mem::take(&mut program.gas_reservation_map), + ), + _ if executed => unreachable!("Action executed only for active program"), + _ => (), + } + + *p = Program::Terminated(origin); + }) + .unwrap_or_else(|e| { + // If we run into `InitFailure` after real execution (not + // prepare or precharge) processor methods, then we are + // sure that it was active program. + if executed { + unreachable!( + "Program terminated status may only be set to an existing active program: {:?}", + e, + ); + } + }); + + Self::clean_inactive_program(program_id, origin); + + Pallet::::deposit_event(Event::ProgramChanged { + id: program_id, + change: ProgramChangeKind::Terminated, + }); + } } diff --git a/pallets/gear/src/manager/task.rs b/pallets/gear/src/manager/task.rs index 75cda3d6b78..af518386f67 100644 --- a/pallets/gear/src/manager/task.rs +++ b/pallets/gear/src/manager/task.rs @@ -17,8 +17,8 @@ // along with this program. If not, see . use crate::{ - manager::ExtManager, Config, CurrencyOf, DispatchStashOf, Event, Pallet, ProgramStorageOf, - QueueOf, WaitlistOf, + manager::ExtManager, Config, DispatchStashOf, Event, Pallet, ProgramStorageOf, QueueOf, + WaitlistOf, }; use alloc::string::ToString; use common::{ @@ -31,13 +31,11 @@ use common::{ storage::*, Origin, PausedProgramStorage, Program, ProgramStorage, }; -use frame_support::traits::{Currency, ExistenceRequirement}; use gear_core::{ ids::{CodeId, MessageId, ProgramId, ReservationId}, message::{DispatchKind, ReplyMessage}, }; use gear_core_errors::{ErrorReplyReason, SignalCode}; -use sp_runtime::traits::Zero; impl TaskHandler for ExtManager where @@ -95,53 +93,32 @@ where }) .unwrap_or_else(|| unreachable!("Failed to find init-message.")); + ProgramStorageOf::::waiting_init_remove(program_id); + // set program status to Terminated - let gas_reservations = - ProgramStorageOf::::update_program_if_active(program_id, |p, _bn| { - let gas_reservations = match p { - Program::Active(program) => core::mem::take(&mut program.gas_reservation_map), - _ => unreachable!("Action executed only for active program"), - }; + ProgramStorageOf::::update_program_if_active(program_id, |p, _bn| { + match p { + Program::Active(program) => Self::remove_gas_reservation_map( + program_id, + core::mem::take(&mut program.gas_reservation_map), + ), + _ => unreachable!("Action executed only for active program"), + } - *p = Program::Terminated(origin); + *p = Program::Terminated(origin); + }) + .unwrap_or_else(|e| { + unreachable!( + "Program terminated status may only be set to an existing active program: {e:?}" + ); + }); - gas_reservations - }) - .unwrap_or_else(|e| { - unreachable!( - "Program terminated status may only be set to an existing active program: {:?}", - e, - ); - }); + Self::clean_inactive_program(program_id, origin); - // remove program's resources - Self::remove_gas_reservation_map(program_id, gas_reservations); - ProgramStorageOf::::remove_program_pages(program_id); - ProgramStorageOf::::waiting_init_remove(program_id); - - let event = Event::ProgramChanged { + Pallet::::deposit_event(Event::ProgramChanged { id: program_id, change: ProgramChangeKind::Terminated, - }; - - // transfer program's balance to the origin - let program_id = ::from_origin(program_id.into_origin()); - - let balance = CurrencyOf::::free_balance(&program_id); - let destination = Pallet::::inheritor_for(origin); - let destination = ::from_origin(destination.into_origin()); - - if !balance.is_zero() { - CurrencyOf::::transfer( - &program_id, - &destination, - balance, - ExistenceRequirement::AllowDeath, - ) - .unwrap_or_else(|e| unreachable!("Failed to transfer value: {:?}", e)); - } - - Pallet::::deposit_event(event); + }); } fn remove_code(&mut self, _code_id: CodeId) { @@ -236,6 +213,11 @@ where // Consuming gas handler for waitlisted message. Pallet::::consume_and_retrieve(waitlisted.id()); + + if waitlisted.kind() == DispatchKind::Init { + let origin = waitlisted.source(); + Self::process_failed_init(program_id, origin, true); + } } fn remove_paused_program(&mut self, _program_id: ProgramId) { diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 4866c670d49..595c05db71a 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -13508,6 +13508,178 @@ fn test_send_to_terminated_from_program() { }) } +#[test] +fn pause_waited_uninited_program() { + use demo_init_wait::WASM_BINARY; + + init_logger(); + + // closure to get corresponding block numbers + let get_remove_block = |current_gas: u64| { + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + current_gas.to_le_bytes().to_vec(), + Vec::new(), + current_gas, + 0u128 + )); + + let program_id = utils::get_last_program_id(); + + assert!(!Gear::is_initialized(program_id)); + assert!(Gear::is_active(program_id)); + + run_to_next_block(None); + + let (_, remove_from_waitlist_block) = get_last_message_waited(); + + let program = ProgramStorageOf::::get_program(program_id) + .and_then(|p| ActiveProgram::try_from(p).ok()) + .expect("program should exist"); + + (remove_from_waitlist_block, program.expiration_block) + }; + + // determine such gas value that init message will be removed + // from the waitlist before an execution of the PauseProgram task + let gas = new_test_ext().execute_with(|| { + let GasInfo { + waited: init_waited, + burned, + .. + } = Gear::calculate_gas_info( + USER_1.into_origin(), + HandleKind::Init(WASM_BINARY.to_vec()), + vec![], + 0, + true, + true, + ) + .expect("calculate_gas_info failed"); + + assert!(init_waited); + + let mut current_gas = 2 * burned; + + let (mut remove_from_waitlist_block, mut expiration_block) = get_remove_block(current_gas); + + while remove_from_waitlist_block >= expiration_block { + current_gas = (current_gas + burned) / 2; + + (remove_from_waitlist_block, expiration_block) = get_remove_block(current_gas); + } + + current_gas + }); + + new_test_ext().execute_with(|| { + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + vec![], + Vec::new(), + gas, + 0u128 + )); + + let program_id = utils::get_last_program_id(); + + assert!(!Gear::is_initialized(program_id)); + assert!(Gear::is_active(program_id)); + + run_to_next_block(None); + + let (_, remove_from_waitlist_block) = get_last_message_waited(); + + let program = ProgramStorageOf::::get_program(program_id) + .and_then(|p| ActiveProgram::try_from(p).ok()) + .expect("program should exist"); + let expiration_block = program.expiration_block; + + assert!(TaskPoolOf::::contains( + &expiration_block, + &ScheduledTask::PauseProgram(program_id) + )); + + assert!(!Gear::is_initialized(program_id)); + assert!(Gear::is_active(program_id)); + + run_to_next_block(None); + + System::set_block_number(remove_from_waitlist_block - 1); + Gear::set_block_number(remove_from_waitlist_block - 1); + + run_to_next_block(None); + + assert!(Gear::is_terminated(program_id)); + assert!(!TaskPoolOf::::contains( + &expiration_block, + &ScheduledTask::PauseProgram(program_id) + )); + + System::set_block_number(expiration_block - 1); + Gear::set_block_number(expiration_block - 1); + + run_to_next_block(None); + }) +} + +#[test] +fn remove_from_waitlist_after_exit_reply() { + use demo_constructor::demo_wait_init_exit_reply; + + init_logger(); + + new_test_ext().execute_with(|| { + let (init_mid, program_id) = init_constructor(demo_wait_init_exit_reply::scheme()); + + assert!(!Gear::is_initialized(program_id)); + assert!(Gear::is_active(program_id)); + + run_to_next_block(None); + + let reply = maybe_last_message(USER_1).unwrap(); + let (waited_mid, remove_from_waitlist_block) = get_last_message_waited(); + assert_eq!(init_mid, waited_mid); + + assert_ok!(Gear::pay_program_rent( + RuntimeOrigin::signed(USER_1), + program_id, + remove_from_waitlist_block + 1 + )); + + run_to_next_block(None); + + assert!(TaskPoolOf::::contains( + &remove_from_waitlist_block, + &ScheduledTask::RemoveFromWaitlist(program_id, init_mid) + )); + + assert_ok!(Gear::send_reply( + RuntimeOrigin::signed(USER_1), + reply.id(), + vec![], + 1_000_000_000, + 0, + false, + )); + + run_to_next_block(None); + + assert!(Gear::is_exited(program_id)); + assert!(!TaskPoolOf::::contains( + &remove_from_waitlist_block, + &ScheduledTask::RemoveFromWaitlist(program_id, init_mid) + )); + + System::set_block_number(remove_from_waitlist_block - 1); + Gear::set_block_number(remove_from_waitlist_block - 1); + + run_to_next_block(None); + }) +} + mod utils { #![allow(unused)] From 23e83e4120a278647ee4728fd474adc6b77aef92 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Sun, 20 Aug 2023 15:55:08 +0300 Subject: [PATCH 066/165] test(runtime-fuzzer): Test that `GearCalls` generation is deterministic (#3117) --- .github/workflows/check.yml | 6 +++ Cargo.lock | 1 + scripts/gear.sh | 4 ++ scripts/src/test.sh | 5 +++ utils/call-gen/src/claim_value.rs | 2 +- utils/call-gen/src/create_program.rs | 2 +- utils/call-gen/src/lib.rs | 2 +- utils/call-gen/src/send_message.rs | 2 +- utils/call-gen/src/send_reply.rs | 2 +- utils/call-gen/src/upload_code.rs | 2 +- utils/call-gen/src/upload_program.rs | 2 +- utils/runtime-fuzzer/Cargo.toml | 5 ++- utils/runtime-fuzzer/src/arbitrary_call.rs | 16 ++++---- utils/runtime-fuzzer/src/lib.rs | 15 +++++++- utils/runtime-fuzzer/src/tests.rs | 43 ++++++++++++++++++++++ 15 files changed, 92 insertions(+), 17 deletions(-) create mode 100644 utils/runtime-fuzzer/src/tests.rs diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 30f8c0f27f6..1dadbc66043 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -80,10 +80,16 @@ jobs: - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 + - name: "Install: cargo-nextest" + run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin + - name: Install cargo-fuzz run: cargo install cargo-fuzz - name: "Check fuzzer with mutation test" run: ./scripts/check-fuzzer.sh + - name: "Check fuzzer reproduction" + run: ./scripts/gear.sh test fuzz-repr + - run: sccache --show-stats diff --git a/Cargo.lock b/Cargo.lock index 7da3b19afde..34939298aed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9152,6 +9152,7 @@ dependencies = [ "pallet-balances", "pallet-gear", "parity-scale-codec", + "proptest", "rand 0.8.5", "sha-1 0.10.1", "sp-consensus-babe", diff --git a/scripts/gear.sh b/scripts/gear.sh index 2a09978c2af..d6e21e70388 100755 --- a/scripts/gear.sh +++ b/scripts/gear.sh @@ -297,6 +297,10 @@ case "$COMMAND" in header "Running fuzzer for runtime panic checks" run_fuzzer "$ROOT_DIR" ;; + fuzz-repr) + header "Running fuzzer reproduction" + test_fuzzer_reproduction ;; + syscalls) header "Running syscalls integrity test of pallet-gear 'benchmarking' module on WASMI executor" syscalls_integrity_test "$@"; ;; diff --git a/scripts/src/test.sh b/scripts/src/test.sh index e3b25b9c66d..41b68731c31 100755 --- a/scripts/src/test.sh +++ b/scripts/src/test.sh @@ -21,6 +21,7 @@ test_usage() { pallet run pallet-gear tests client run client tests via gclient fuzz run fuzzer with a fuzz target + fuzz-repr run fuzzer reproduction test syscalls run syscalls integrity test in benchmarking module of pallet-gear docs run doc tests validators run validator checks @@ -89,6 +90,10 @@ run_fuzzer() { cargo fuzz run --release --sanitizer=none main -- -rss_limit_mb=8192 -max_len=35000000 -len_control=0 } +test_fuzzer_reproduction() { + cargo nextest run -p runtime-fuzzer -E 'test(=tests::test_fuzzer_reproduction)' +} + # TODO this is likely to be merged with `pallet_test` or `workspace_test` in #1802 syscalls_integrity_test() { $CARGO test -p pallet-gear check_syscalls_integrity --features runtime-benchmarks --no-fail-fast "$@" diff --git a/utils/call-gen/src/claim_value.rs b/utils/call-gen/src/claim_value.rs index 6719b729e3e..c3a4aded7ad 100644 --- a/utils/call-gen/src/claim_value.rs +++ b/utils/call-gen/src/claim_value.rs @@ -28,7 +28,7 @@ use gear_utils::{NonEmpty, RingGet}; /// Claim value args /// /// Main type used to generate arguments for the `pallet_gear::Pallet::::claim_value` call. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct ClaimValueArgs(pub MessageId); impl_convert_traits!(ClaimValueArgs, MessageId, ClaimValue, "claim_value"); diff --git a/utils/call-gen/src/create_program.rs b/utils/call-gen/src/create_program.rs index 5fffd84aac6..131ee69f790 100644 --- a/utils/call-gen/src/create_program.rs +++ b/utils/call-gen/src/create_program.rs @@ -31,7 +31,7 @@ type CreateProgramArgsInner = (CodeId, Vec, Vec, u64, u128); /// Create program args /// /// Main type used to generate arguments for the `pallet_gear::Pallet::::create_program` call. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct CreateProgramArgs(pub CreateProgramArgsInner); impl_convert_traits!( diff --git a/utils/call-gen/src/lib.rs b/utils/call-gen/src/lib.rs index c9513421ec6..3e61042b807 100644 --- a/utils/call-gen/src/lib.rs +++ b/utils/call-gen/src/lib.rs @@ -90,7 +90,7 @@ pub trait NamedCallArgs { } /// Set of `pallet_gear` calls supported by the crate. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub enum GearCall { /// Upload program call args. UploadProgram(UploadProgramArgs), diff --git a/utils/call-gen/src/send_message.rs b/utils/call-gen/src/send_message.rs index bb74fef8a08..0c4d2bbfb23 100644 --- a/utils/call-gen/src/send_message.rs +++ b/utils/call-gen/src/send_message.rs @@ -31,7 +31,7 @@ type SendMessageArgsInner = (ProgramId, Vec, u64, u128, bool); /// Send message args /// /// Main type used to generate arguments for the `pallet_gear::Pallet::::send_message` call. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct SendMessageArgs(pub SendMessageArgsInner); impl_convert_traits!( diff --git a/utils/call-gen/src/send_reply.rs b/utils/call-gen/src/send_reply.rs index 0845e6634c9..899c64f2297 100644 --- a/utils/call-gen/src/send_reply.rs +++ b/utils/call-gen/src/send_reply.rs @@ -31,7 +31,7 @@ type SendReplyArgsInner = (MessageId, Vec, u64, u128, bool); /// Send reply args /// /// Main type used to generate arguments for the `pallet_gear::Pallet::::send_reply` call. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct SendReplyArgs(pub SendReplyArgsInner); impl_convert_traits!(SendReplyArgs, SendReplyArgsInner, SendReply, "send_reply"); diff --git a/utils/call-gen/src/upload_code.rs b/utils/call-gen/src/upload_code.rs index 4245cf4e59b..88497e6ebfe 100644 --- a/utils/call-gen/src/upload_code.rs +++ b/utils/call-gen/src/upload_code.rs @@ -26,7 +26,7 @@ use crate::{ /// Upload code args /// /// Main type used to generate arguments for the `pallet_gear::Pallet::::upload_code` call. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct UploadCodeArgs(pub Vec); impl_convert_traits!(UploadCodeArgs, Vec, UploadCode, "upload_code"); diff --git a/utils/call-gen/src/upload_program.rs b/utils/call-gen/src/upload_program.rs index 7bf28e06384..93c54cb89f6 100644 --- a/utils/call-gen/src/upload_program.rs +++ b/utils/call-gen/src/upload_program.rs @@ -29,7 +29,7 @@ type UploadProgramArgsInner = (Vec, Vec, Vec, u64, u128); /// Upload program args /// /// Main type used to generate arguments for the `pallet_gear::Pallet::::upload_program` call. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct UploadProgramArgs(pub UploadProgramArgsInner); impl_convert_traits!( diff --git a/utils/runtime-fuzzer/Cargo.toml b/utils/runtime-fuzzer/Cargo.toml index ba2ac414873..1c160974b5f 100644 --- a/utils/runtime-fuzzer/Cargo.toml +++ b/utils/runtime-fuzzer/Cargo.toml @@ -12,7 +12,6 @@ hex.workspace = true log.workspace = true sha-1.workspace = true static_assertions.workspace = true -rand = { workspace = true, features = ["small_rng"] } # Temporary deps for the reproducing crash script until #2313 is implemented clap = { workspace = true, features = ["derive"] } @@ -37,3 +36,7 @@ sp-consensus-slots = { workspace = true } sp-consensus-babe.workspace = true sp-consensus-grandpa.workspace = true pallet-authorship.workspace = true + +[dev-dependencies] +proptest.workspace = true +rand = { workspace = true, features = ["small_rng"] } diff --git a/utils/runtime-fuzzer/src/arbitrary_call.rs b/utils/runtime-fuzzer/src/arbitrary_call.rs index aeba9459219..d01cb920197 100644 --- a/utils/runtime-fuzzer/src/arbitrary_call.rs +++ b/utils/runtime-fuzzer/src/arbitrary_call.rs @@ -35,11 +35,18 @@ use std::{ const MAX_PAYLOAD_SIZE: usize = 512 * 1024; static_assertions::const_assert!(MAX_PAYLOAD_SIZE <= gear_core::message::MAX_PAYLOAD_SIZE); +/// 25 MiB is an approximate assessment for 35 calls, +/// where each call of: +/// 1. `UploadProgram` requires 1024 KiB for payload an salt and 50 KiB for code. +/// 2. `SendMessage` requires 512 Kib for payload. +/// So, [10 * (1024 + 50)] + [25 * 512] = 23540 KiB +pub(crate) const MIN_GEAR_CALLS_BYTES: usize = 25_000_000; + /// New-type wrapper over array of [`GearCall`]s. /// /// It's main purpose is to be an implementor of `Arbitrary` for the array of [`GearCall`]s. /// New-type is required as array is always a foreign type. -#[derive(Clone)] +#[derive(Clone, PartialEq, Eq)] pub struct GearCalls(pub [GearCall; GearCalls::MAX_CALLS]); /// That's done because when fuzzer finds a crash it prints a [`Debug`] string of the [`GearCalls`]. @@ -69,12 +76,7 @@ impl<'a> Arbitrary<'a> for GearCalls { log::trace!("New GearCalls generation: random data received {}", u.len()); - // 25 MiB is an approximate assessment for 35 calls, - // where each call of: - // 1. `UploadProgram` requires 1024 KiB for payload an salt and 50 KiB for code. - // 2. `SendMessage` requires 512 Kib for payload. - // So, [10 * (1024 + 50)] + [25 * 512] = 23540 KiB - if u.len() < 25_000_000_usize { + if u.len() < MIN_GEAR_CALLS_BYTES { log::trace!("Not enough bytes for creating gear calls"); return Err(arbitrary::Error::NotEnoughData); } diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index 98bf4587ded..893ccc676e8 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -16,8 +16,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#![allow(clippy::items_after_test_module)] + mod arbitrary_call; mod runtime; +#[cfg(test)] +mod tests; pub use arbitrary_call::GearCalls; @@ -28,10 +32,15 @@ use pallet_balances::Pallet as BalancesPallet; use runtime::*; /// Runs all the fuzz testing internal machinery. -pub fn run(GearCalls(gear_calls): GearCalls) { +pub fn run(gear_calls: GearCalls) { + run_impl(gear_calls); +} + +fn run_impl(GearCalls(gear_calls): GearCalls) -> sp_io::TestExternalities { let sender = runtime::account(runtime::alice()); - new_test_ext().execute_with(|| { + let mut test_ext = new_test_ext(); + test_ext.execute_with(|| { // Increase maximum balance of the `sender`. { increase_to_max_balance(sender.clone()) @@ -52,6 +61,8 @@ pub fn run(GearCalls(gear_calls): GearCalls) { run_to_next_block(); } }); + + test_ext } fn execute_gear_call(sender: AccountId, call: GearCall) -> DispatchResultWithPostInfo { diff --git a/utils/runtime-fuzzer/src/tests.rs b/utils/runtime-fuzzer/src/tests.rs new file mode 100644 index 00000000000..8a414a1b3c7 --- /dev/null +++ b/utils/runtime-fuzzer/src/tests.rs @@ -0,0 +1,43 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use super::arbitrary_call::MIN_GEAR_CALLS_BYTES; +use crate::*; +use arbitrary::{Arbitrary, Unstructured}; +use proptest::prelude::*; + +const MAX_GEAR_CALLS_BYTES: usize = 30_000_000; + +proptest! { + #![proptest_config(ProptestConfig::with_cases(10))] + #[test] + fn test_fuzzer_reproduction(buf in prop::collection::vec(any::(), MIN_GEAR_CALLS_BYTES..MAX_GEAR_CALLS_BYTES)) { + let mut u1 = Unstructured::new(&buf); + let mut u2 = Unstructured::new(&buf); + + let calls1 = GearCalls::arbitrary(&mut u1).expect("failed gear calls creation"); + let calls2 = GearCalls::arbitrary(&mut u2).expect("failed gear calls creation"); + + assert_eq!(calls1, calls2); + + let ext1 = run_impl(calls1); + let ext2 = run_impl(calls2); + + assert!(ext1.eq(&ext2), "Both test-exts must be equal"); + } +} From 2774fc7da419be98478add848ea50420f508ae68 Mon Sep 17 00:00:00 2001 From: Arsenii Lyashenko Date: Sun, 20 Aug 2023 17:51:46 +0300 Subject: [PATCH 067/165] refactor: Introduce ActorSystemError (#3086) --- Cargo.lock | 9 ++ Cargo.toml | 1 + core-backend/common/Cargo.toml | 1 + core-backend/common/src/lib.rs | 12 ++- core-processor/Cargo.toml | 1 + core-processor/src/common.rs | 13 +-- core-processor/src/executor.rs | 10 +-- utils/actor-system-error/Cargo.toml | 7 ++ utils/actor-system-error/src/lib.rs | 134 ++++++++++++++++++++++++++++ 9 files changed, 166 insertions(+), 22 deletions(-) create mode 100644 utils/actor-system-error/Cargo.toml create mode 100644 utils/actor-system-error/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 34939298aed..8af934b4cd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,6 +12,13 @@ dependencies = [ "regex", ] +[[package]] +name = "actor-system-error" +version = "0.1.0" +dependencies = [ + "derive_more", +] + [[package]] name = "addr2line" version = "0.17.0" @@ -3718,6 +3725,7 @@ dependencies = [ name = "gear-backend-common" version = "0.2.2" dependencies = [ + "actor-system-error", "blake2-rfc", "derive_more", "gear-backend-codegen", @@ -3889,6 +3897,7 @@ dependencies = [ name = "gear-core-processor" version = "0.2.2" dependencies = [ + "actor-system-error", "derive_more", "enum-iterator 1.4.1", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index c44a2ea8e02..33d8300e061 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -218,6 +218,7 @@ gear-wasm-builder = { path = "utils/wasm-builder", default-features = false } gear-wasm-gen = { path = "utils/wasm-gen" } gear-wasm-instrument = { path = "utils/wasm-instrument", default-features = false } junit-common = { path = "utils/junit-common" } +actor-system-error = { path = "utils/actor-system-error" } pallet-airdrop = { path = "pallets/airdrop", default-features = false } pallet-gear = { path = "pallets/gear", default-features = false } pallet-gear-debug = { path = "pallets/gear-debug", default-features = false } diff --git a/core-backend/common/Cargo.toml b/core-backend/common/Cargo.toml index 50a477d2917..e122604b4c7 100644 --- a/core-backend/common/Cargo.toml +++ b/core-backend/common/Cargo.toml @@ -22,6 +22,7 @@ gsys.workspace = true log.workspace = true parity-scale-codec.workspace = true scale-info = { workspace = true, features = ["derive"] } +actor-system-error.workspace = true [dev-dependencies] rand = { workspace = true, features = ["std", "std_rng"] } diff --git a/core-backend/common/src/lib.rs b/core-backend/common/src/lib.rs index 87909095626..fd8240d1c72 100644 --- a/core-backend/common/src/lib.rs +++ b/core-backend/common/src/lib.rs @@ -33,6 +33,8 @@ pub mod funcs; pub mod memory; pub mod runtime; +use crate::runtime::RunFallibleError; +use actor_system_error::actor_system_error; use alloc::{ collections::{BTreeMap, BTreeSet}, string::String, @@ -46,7 +48,7 @@ use gear_core::{ env::Externalities, gas::{ChargeError, CounterType, CountersOwner, GasAmount}, ids::{CodeId, MessageId, ProgramId, ReservationId}, - memory::{Memory, MemoryInterval, PageBuf}, + memory::{Memory, MemoryError, MemoryInterval, PageBuf}, message::{ ContextStore, Dispatch, DispatchKind, IncomingDispatch, MessageWaitedType, WasmEntryPoint, }, @@ -57,17 +59,13 @@ use lazy_pages::GlobalsAccessConfig; use memory::ProcessAccessError; use scale_info::scale::{self, Decode, Encode}; -use crate::runtime::RunFallibleError; pub use crate::utils::LimitedStr; -use gear_core::memory::MemoryError; pub use log; pub const PTR_SPECIAL: u32 = u32::MAX; -#[derive(Debug, Clone, Eq, PartialEq, derive_more::From)] -pub enum TerminationReason { - Actor(ActorTerminationReason), - System(SystemTerminationReason), +actor_system_error! { + pub type TerminationReason = ActorSystemError; } #[derive(Debug, Clone, Eq, PartialEq, derive_more::From)] diff --git a/core-processor/Cargo.toml b/core-processor/Cargo.toml index 752712d7895..179e98ee664 100644 --- a/core-processor/Cargo.toml +++ b/core-processor/Cargo.toml @@ -20,6 +20,7 @@ scale-info = { workspace = true, features = ["derive"] } log.workspace = true derive_more.workspace = true static_assertions.workspace = true +actor-system-error.workspace = true [dev-dependencies] proptest.workspace = true diff --git a/core-processor/src/common.rs b/core-processor/src/common.rs index e524b1e65ad..dc9e100d129 100644 --- a/core-processor/src/common.rs +++ b/core-processor/src/common.rs @@ -21,6 +21,7 @@ use crate::{ executor::SystemPrepareMemoryError, precharge::PreChargeGasOperation, ActorPrepareMemoryError, }; +use actor_system_error::actor_system_error; use alloc::{ collections::{BTreeMap, BTreeSet}, string::String, @@ -432,15 +433,9 @@ pub trait JournalHandler { fn reply_deposit(&mut self, message_id: MessageId, future_reply_id: MessageId, amount: u64); } -/// Execution error -#[derive(Debug, derive_more::Display, derive_more::From)] -pub enum ExecutionError { - /// Actor execution error - #[display(fmt = "{_0}")] - Actor(ActorExecutionError), - /// System execution error - #[display(fmt = "{_0}")] - System(SystemExecutionError), +actor_system_error! { + /// Execution error. + pub type ExecutionError = ActorSystemError; } /// Actor execution error. diff --git a/core-processor/src/executor.rs b/core-processor/src/executor.rs index eb9547f7c0c..e1db391f813 100644 --- a/core-processor/src/executor.rs +++ b/core-processor/src/executor.rs @@ -24,6 +24,7 @@ use crate::{ configs::{BlockInfo, ExecutionSettings}, ext::{ProcessorContext, ProcessorExternalities}, }; +use actor_system_error::actor_system_error; use alloc::{ collections::{BTreeMap, BTreeSet}, format, @@ -54,12 +55,9 @@ use scale_info::{ TypeInfo, }; -#[derive(Debug, derive_more::Display, derive_more::From)] -pub enum PrepareMemoryError { - #[display(fmt = "{_0}")] - Actor(ActorPrepareMemoryError), - #[display(fmt = "{_0}")] - System(SystemPrepareMemoryError), +actor_system_error! { + /// Prepare memory error. + pub type PrepareMemoryError = ActorSystemError; } /// Prepare memory error diff --git a/utils/actor-system-error/Cargo.toml b/utils/actor-system-error/Cargo.toml new file mode 100644 index 00000000000..503a0e8bbb2 --- /dev/null +++ b/utils/actor-system-error/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "actor-system-error" +version = "0.1.0" +edition = "2021" + +[dependencies] +derive_more.workspace = true diff --git a/utils/actor-system-error/src/lib.rs b/utils/actor-system-error/src/lib.rs new file mode 100644 index 00000000000..72b6f326afa --- /dev/null +++ b/utils/actor-system-error/src/lib.rs @@ -0,0 +1,134 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Actor-system error. +//! +//! Actor is intended to be errors passed to user. +//! System errors are to be unreachable or recoverable. + +#![no_std] + +/// Define type alias with implemented `From`s. +#[macro_export] +macro_rules! actor_system_error { + ( + $(#[$($meta:meta)*])? + $vis:vis type $name:ident = ActorSystemError<$actor_err:ident, $system_err:ident>; + ) => { + $(#[$($meta)*])? + $vis type $name = $crate::ActorSystemError<$actor_err, $system_err>; + + impl From<$actor_err> for $crate::ActorSystemError<$actor_err, $system_err> { + fn from(err: $actor_err) -> Self { + Self::Actor(err) + } + } + + impl From<$system_err> for $crate::ActorSystemError<$actor_err, $system_err> { + fn from(err: $system_err) -> Self { + Self::System(err) + } + } + }; +} + +/// Actor or system error. +#[derive(Debug, Eq, PartialEq, derive_more::Display)] +pub enum ActorSystemError { + Actor(A), + System(S), +} + +impl ActorSystemError { + /// Map actor error. + pub fn map_actor(self, f: F) -> ActorSystemError + where + F: FnOnce(A) -> U, + { + match self { + Self::Actor(a) => ActorSystemError::Actor(f(a)), + Self::System(s) => ActorSystemError::System(s), + } + } + + /// Map system error. + pub fn map_system(self, f: F) -> ActorSystemError + where + F: FnOnce(S) -> U, + { + match self { + Self::Actor(a) => ActorSystemError::Actor(a), + Self::System(s) => ActorSystemError::System(f(s)), + } + } + + /// Map actor or system error using [`From::from()`]. + pub fn map_into(self) -> ActorSystemError + where + UA: From, + US: From, + { + match self { + Self::Actor(a) => ActorSystemError::Actor(UA::from(a)), + Self::System(s) => ActorSystemError::System(US::from(s)), + } + } +} + +/// Extension for [`Result`] around actor-system error. +pub trait ResultExt { + /// Map actor error. + fn map_actor_err(self, f: F) -> Result> + where + F: FnOnce(A) -> U; + + /// Map system error. + fn map_system_err(self, f: F) -> Result> + where + F: FnOnce(S) -> U; + + /// Map actor or system error. + fn map_err_into(self) -> Result> + where + UA: From, + US: From; +} + +impl ResultExt for Result> { + fn map_actor_err(self, f: F) -> Result> + where + F: FnOnce(A) -> U, + { + self.map_err(|err| err.map_actor(f)) + } + + fn map_system_err(self, f: F) -> Result> + where + F: FnOnce(S) -> U, + { + self.map_err(|err| err.map_system(f)) + } + + fn map_err_into(self) -> Result> + where + UA: From, + US: From, + { + self.map_err(ActorSystemError::map_into) + } +} From 532083975fc14ce4c0fcddc27b86939641358895 Mon Sep 17 00:00:00 2001 From: Arsenii Lyashenko Date: Mon, 21 Aug 2023 16:53:41 +0400 Subject: [PATCH 068/165] refactor(core-backend,sandbox): Update WASMI in embedded executor (#2987) --- Cargo.lock | 38 +- core-backend/common/src/lib.rs | 11 +- core-backend/{wasmi => common}/src/state.rs | 22 +- core-backend/sandbox/src/env.rs | 226 +++++-- core-backend/sandbox/src/memory.rs | 114 +++- core-backend/sandbox/src/runtime.rs | 155 +++-- core-backend/wasmi/src/env.rs | 18 +- core-backend/wasmi/src/funcs_tree.rs | 12 +- core-backend/wasmi/src/lib.rs | 1 - core-backend/wasmi/src/memory.rs | 29 +- core-backend/wasmi/src/runtime.rs | 15 +- pallets/gear/src/benchmarking/code.rs | 10 +- pallets/gear/src/benchmarking/mod.rs | 6 +- pallets/gear/src/benchmarking/sandbox.rs | 21 +- pallets/gear/src/lib.rs | 4 - pallets/gear/src/tests.rs | 23 + runtime-interface/src/lib.rs | 1 - sandbox/env/src/lib.rs | 18 +- sandbox/host/src/sandbox.rs | 14 +- sandbox/host/src/sandbox/wasmer_backend.rs | 5 +- sandbox/sandbox/Cargo.toml | 2 +- sandbox/sandbox/src/embedded_executor.rs | 667 +++++++++++--------- sandbox/sandbox/src/host_executor.rs | 148 +++-- sandbox/sandbox/src/lib.rs | 72 ++- 24 files changed, 1036 insertions(+), 596 deletions(-) rename core-backend/{wasmi => common}/src/state.rs (62%) diff --git a/Cargo.lock b/Cargo.lock index 8af934b4cd0..68d5b782295 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4171,7 +4171,7 @@ dependencies = [ "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-wasm-interface 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", - "wasmi 0.13.2", + "wasmi 0.30.0", "wat", ] @@ -5196,6 +5196,12 @@ dependencies = [ "webrtc-util", ] +[[package]] +name = "intx" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f38a50a899dc47a6d0ed5508e7f601a2e34c3a85303514b5d137f3c10a0c75" + [[package]] name = "io-lifetimes" version = "1.0.11" @@ -13923,6 +13929,19 @@ dependencies = [ "wasmparser-nostd 0.83.0", ] +[[package]] +name = "wasmi" +version = "0.30.0" +source = "git+https://github.com/gear-tech/wasmi?branch=gear-v0.30.0#c8b0be9c2012e0478959a59074fd953a942782bc" +dependencies = [ + "intx", + "smallvec", + "spin 0.9.8", + "wasmi_arena", + "wasmi_core 0.12.0", + "wasmparser-nostd 0.100.1", +] + [[package]] name = "wasmi-validation" version = "0.5.0" @@ -13931,6 +13950,11 @@ dependencies = [ "parity-wasm 0.45.0", ] +[[package]] +name = "wasmi_arena" +version = "0.4.0" +source = "git+https://github.com/gear-tech/wasmi?branch=gear-v0.30.0#c8b0be9c2012e0478959a59074fd953a942782bc" + [[package]] name = "wasmi_core" version = "0.2.1" @@ -13958,6 +13982,18 @@ dependencies = [ "region", ] +[[package]] +name = "wasmi_core" +version = "0.12.0" +source = "git+https://github.com/gear-tech/wasmi?branch=gear-v0.30.0#c8b0be9c2012e0478959a59074fd953a942782bc" +dependencies = [ + "downcast-rs", + "libm 0.2.7", + "num-traits", + "paste", + "region", +] + [[package]] name = "wasmparser" version = "0.83.0" diff --git a/core-backend/common/src/lib.rs b/core-backend/common/src/lib.rs index fd8240d1c72..62d47e1cd99 100644 --- a/core-backend/common/src/lib.rs +++ b/core-backend/common/src/lib.rs @@ -32,6 +32,7 @@ pub mod mock; pub mod funcs; pub mod memory; pub mod runtime; +pub mod state; use crate::runtime::RunFallibleError; use actor_system_error::actor_system_error; @@ -454,10 +455,10 @@ pub trait BackendState { /// Backend termination aims to return to the caller gear wasm program /// execution outcome, which is the state of externalities, memory and /// termination reason. -pub trait BackendTermination: Sized { +pub trait BackendTermination: Sized { /// Transforms [`Self`] into tuple of externalities, memory and /// termination reason returned after the execution. - fn into_parts(self) -> (Ext, EnvMem, UndefinedTerminationReason); + fn into_parts(self) -> (Ext, UndefinedTerminationReason); /// Terminates backend work after execution. /// @@ -478,10 +479,10 @@ pub trait BackendTermination: Sized { self, res: Result, gas: u64, - ) -> (Ext, EnvMem, TerminationReason) { + ) -> (Ext, TerminationReason) { log::trace!("Execution result = {res:?}"); - let (mut ext, memory, termination_reason) = self.into_parts(); + let (mut ext, termination_reason) = self.into_parts(); let termination_reason = termination_reason.define(ext.current_counter_type()); ext.decrease_current_counter_to(gas); @@ -506,7 +507,7 @@ pub trait BackendTermination: Sized { ) }; - (ext, memory, termination_reason) + (ext, termination_reason) } } diff --git a/core-backend/wasmi/src/state.rs b/core-backend/common/src/state.rs similarity index 62% rename from core-backend/wasmi/src/state.rs rename to core-backend/common/src/state.rs index 0a307a284f1..a59a7b5116b 100644 --- a/core-backend/wasmi/src/state.rs +++ b/core-backend/common/src/state.rs @@ -1,7 +1,7 @@ // This file is part of Gear. -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-lat&er WITH Classpath-exception-2.0 +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -16,30 +16,28 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use gear_backend_common::{ - BackendExternalities, BackendState, BackendTermination, UndefinedTerminationReason, -}; +use crate::{BackendExternalities, BackendState, BackendTermination, UndefinedTerminationReason}; -pub(crate) type HostState = Option>; +pub type HostState = Option>; -/// It's supposed that `E` implements [BackendExt] -pub(crate) struct State { +pub struct State { pub ext: Ext, + pub memory: Mem, pub termination_reason: UndefinedTerminationReason, } -impl BackendTermination for State { - fn into_parts(self) -> (Ext, (), UndefinedTerminationReason) { +impl BackendTermination for State { + fn into_parts(self) -> (Ext, UndefinedTerminationReason) { let State { ext, termination_reason, .. } = self; - (ext, (), termination_reason) + (ext, termination_reason) } } -impl BackendState for State { +impl BackendState for State { fn set_termination_reason(&mut self, reason: UndefinedTerminationReason) { self.termination_reason = reason; } diff --git a/core-backend/sandbox/src/env.rs b/core-backend/sandbox/src/env.rs index efb2691e6a8..ca5c9f0f81a 100644 --- a/core-backend/sandbox/src/env.rs +++ b/core-backend/sandbox/src/env.rs @@ -18,28 +18,30 @@ //! sp-sandbox environment for running a module. -use crate::{ - memory::MemoryWrap, - runtime::{self, Runtime}, -}; +use crate::{memory::MemoryWrap, runtime, runtime::CallerWrap}; use alloc::{collections::BTreeSet, format}; -use core::{convert::Infallible, fmt::Display}; +use core::{any::Any, convert::Infallible, fmt::Display}; use gear_backend_common::{ funcs::FuncsHandler, - lazy_pages::{GlobalsAccessConfig, GlobalsAccessMod}, + lazy_pages::{GlobalsAccessConfig, GlobalsAccessError, GlobalsAccessMod, GlobalsAccessor}, runtime::RunFallibleError, + state::{HostState, State}, ActorTerminationReason, BackendAllocSyscallError, BackendExternalities, BackendReport, BackendSyscallError, BackendTermination, Environment, EnvironmentError, - EnvironmentExecutionResult, + EnvironmentExecutionResult, LimitedStr, }; use gear_core::{ + env::Externalities, + memory::HostPointer, message::{DispatchKind, WasmEntryPoint}, pages::{PageNumber, WasmPage}, }; use gear_sandbox::{ - default_executor::{EnvironmentDefinitionBuilder, Instance, Memory as DefaultExecutorMemory}, - HostError, HostFuncType, IntoValue, ReturnValue, SandboxEnvironmentBuilder, SandboxInstance, - SandboxMemory, Value, + default_executor::{ + EnvironmentDefinitionBuilder, Instance, Memory as DefaultExecutorMemory, Store, + }, + AsContextExt, HostError, HostFuncType, IntoValue, ReturnValue, SandboxEnvironmentBuilder, + SandboxInstance, SandboxMemory, SandboxStore, Value, }; use gear_sandbox_env::WasmReturnValue; use gear_wasm_instrument::{ @@ -95,7 +97,8 @@ impl TryFrom for u64 { macro_rules! wrap_common_func_internal_ret{ ($func:path, $($arg_no:expr),*) => { |ctx, args: &[Value]| -> Result { - $func(ctx, $(SandboxValue(args[$arg_no]).try_into()?,)*) + let mut ctx = CallerWrap::prepare(ctx).map_err(|_| HostError)?; + $func(&mut ctx, $(SandboxValue(args[$arg_no]).try_into()?,)*) .map(|(gas, r)| WasmReturnValue { gas: gas as i64, inner: r.into_value().into(), @@ -107,7 +110,8 @@ macro_rules! wrap_common_func_internal_ret{ macro_rules! wrap_common_func_internal_no_ret{ ($func:path, $($arg_no:expr),*) => { |ctx, _args: &[Value]| -> Result { - $func(ctx, $(SandboxValue(_args[$arg_no]).try_into()?,)*) + let mut ctx = CallerWrap::prepare(ctx).map_err(|_| HostError)?; + $func(&mut ctx, $(SandboxValue(_args[$arg_no]).try_into()?,)*) .map(|(gas, _)| WasmReturnValue { gas: gas as i64, inner: ReturnValue::Unit, @@ -142,6 +146,15 @@ macro_rules! wrap_common_func { ($func:path, (9) -> (1)) => { wrap_common_func_internal_ret!($func, 0, 1, 2, 3, 4, 5, 6, 7, 8) }; } +fn store_host_state_mut( + store: &mut Store>, +) -> &mut State { + store + .data_mut() + .as_mut() + .unwrap_or_else(|| unreachable!("State must be set in `WasmiEnvironment::new`; qed")) +} + #[derive(Debug, derive_more::Display)] pub enum SandboxEnvironmentError { #[display(fmt = "Failed to create env memory: {_0:?}")] @@ -158,16 +171,17 @@ where Ext: BackendExternalities, EntryPoint: WasmEntryPoint, { - instance: Instance>, - runtime: Runtime, + instance: Instance>, entries: BTreeSet, entry_point: EntryPoint, + store: Store>, + memory: DefaultExecutorMemory, } // A helping wrapper for `EnvironmentDefinitionBuilder` and `forbidden_funcs`. // It makes adding functions to `EnvironmentDefinitionBuilder` shorter. struct EnvBuilder { - env_def_builder: EnvironmentDefinitionBuilder>, + env_def_builder: EnvironmentDefinitionBuilder>, forbidden_funcs: BTreeSet, funcs_count: usize, } @@ -179,7 +193,11 @@ where RunFallibleError: From, Ext::AllocError: BackendAllocSyscallError, { - fn add_func(&mut self, name: SysCallName, f: HostFuncType>) { + fn add_func( + &mut self, + name: SysCallName, + f: HostFuncType>, + ) { if self.forbidden_funcs.contains(&name) { self.env_def_builder.add_host_func( "env", @@ -199,7 +217,7 @@ where } impl From> - for EnvironmentDefinitionBuilder> + for EnvironmentDefinitionBuilder> { fn from(builder: EnvBuilder) -> Self { builder.env_def_builder @@ -275,6 +293,32 @@ where } } +struct GlobalsAccessProvider { + instance: Instance>, + store: Option>>, +} + +impl GlobalsAccessor for GlobalsAccessProvider { + fn get_i64(&self, name: &LimitedStr) -> Result { + let store = self.store.as_ref().ok_or(GlobalsAccessError)?; + self.instance + .get_global_val(store, name.as_str()) + .and_then(runtime::as_i64) + .ok_or(GlobalsAccessError) + } + + fn set_i64(&mut self, name: &LimitedStr, value: i64) -> Result<(), GlobalsAccessError> { + let store = self.store.as_mut().ok_or(GlobalsAccessError)?; + self.instance + .set_global_val(store, name.as_str(), Value::I64(value)) + .map_err(|_| GlobalsAccessError) + } + + fn as_any_mut(&mut self) -> &mut dyn Any { + self + } +} + impl Environment for SandboxEnvironment where EnvExt: BackendExternalities + 'static, @@ -284,7 +328,7 @@ where EntryPoint: WasmEntryPoint, { type Ext = EnvExt; - type Memory = MemoryWrap; + type Memory = MemoryWrap; type SystemError = SandboxEnvironmentError; fn new( @@ -303,6 +347,8 @@ where .map(DispatchKind::forbidden_funcs) .unwrap_or_default(); + let mut store = Store::new(None); + let mut builder = EnvBuilder:: { env_def_builder: EnvironmentDefinitionBuilder::new(), forbidden_funcs: ext @@ -314,10 +360,11 @@ where funcs_count: 0, }; - let memory: DefaultExecutorMemory = match SandboxMemory::new(mem_size.raw(), None) { - Ok(mem) => mem, - Err(e) => return Err(System(CreateEnvMemory(e))), - }; + let memory: DefaultExecutorMemory = + match SandboxMemory::new(&mut store, mem_size.raw(), None) { + Ok(mem) => mem, + Err(e) => return Err(System(CreateEnvMemory(e))), + }; builder.add_memory(memory.clone()); @@ -334,22 +381,26 @@ where let env_builder: EnvironmentDefinitionBuilder<_> = builder.into(); - let mut runtime = Runtime { + *store.data_mut() = Some(State { ext, - memory: MemoryWrap::new(memory), - memory_manager: Default::default(), + memory: memory.clone(), termination_reason: ActorTerminationReason::Success.into(), - }; + }); - match Instance::new(binary, &env_builder, &mut runtime) { - Ok(instance) => Ok(Self { - instance, - runtime, - entries, - entry_point, - }), - Err(e) => Err(Actor(runtime.ext.gas_amount(), format!("{e:?}"))), - } + let instance = Instance::new(&mut store, binary, &env_builder).map_err(|e| { + Actor( + store_host_state_mut(&mut store).ext.gas_amount(), + format!("{e:?}"), + ) + })?; + + Ok(Self { + instance, + entries, + entry_point, + store, + memory, + }) } fn execute( @@ -369,58 +420,113 @@ where let Self { mut instance, - mut runtime, entries, entry_point, + mut store, + memory, } = self; let stack_end = instance - .get_global_val(STACK_END_EXPORT_NAME) + .get_global_val(&store, STACK_END_EXPORT_NAME) .and_then(|global| global.as_i32()) .map(|global| global as u32); - let gas = runtime.ext.define_current_counter(); + let gas = store_host_state_mut(&mut store) + .ext + .define_current_counter(); instance - .set_global_val(GLOBAL_NAME_GAS, Value::I64(gas as i64)) + .set_global_val(&mut store, GLOBAL_NAME_GAS, Value::I64(gas as i64)) .map_err(|_| System(WrongInjectedGas))?; - let globals_config = if cfg!(not(feature = "std")) { - GlobalsAccessConfig { - access_ptr: instance.get_instance_ptr(), - access_mod: GlobalsAccessMod::WasmRuntime, - } - } else { - unreachable!("We cannot use sandbox backend in std environment currently"); + #[cfg(feature = "std")] + let mut globals_provider = GlobalsAccessProvider { + instance: instance.clone(), + store: None, + }; + #[cfg(feature = "std")] + let globals_provider_dyn_ref = &mut globals_provider as &mut dyn GlobalsAccessor; + + // Pointer to the globals access provider is valid until the end of `invoke` method. + // So, we can safely use it inside lazy-pages and be sure that it points to the valid object. + // We cannot guaranty that `store` (and so globals also) will be in a valid state, + // because executor mut-borrows `store` during execution. But if it's in a valid state + // each moment when protect memory signal can occur, than this trick is pretty safe. + #[cfg(feature = "std")] + let globals_access_ptr = &globals_provider_dyn_ref as *const _ as HostPointer; + + #[cfg(feature = "std")] + let globals_config = GlobalsAccessConfig { + access_ptr: globals_access_ptr, + access_mod: GlobalsAccessMod::NativeRuntime, }; - match prepare_memory(&mut runtime.memory, stack_end, globals_config) { - Ok(_) => (), - Err(e) => { - return Err(PrepareMemory(runtime.ext.gas_amount(), e)); - } - } + #[cfg(not(feature = "std"))] + let globals_config = GlobalsAccessConfig { + access_ptr: instance.get_instance_ptr(), + access_mod: GlobalsAccessMod::WasmRuntime, + }; + + let mut memory_wrap = MemoryWrap::new(memory.clone(), store); + prepare_memory(&mut memory_wrap, stack_end, globals_config).map_err(|e| { + let store = &mut memory_wrap.store; + PrepareMemory(store_host_state_mut(store).ext.gas_amount(), e) + })?; let needs_execution = entry_point .try_into_kind() .map(|kind| entries.contains(&kind)) .unwrap_or(true); - let res = needs_execution - .then(|| instance.invoke(entry_point.as_entry(), &[], &mut runtime)) - .unwrap_or(Ok(ReturnValue::Unit)); + let mut store = memory_wrap.into_store(); + let res = if needs_execution { + #[cfg(feature = "std")] + let res = { + let store_option = &mut globals_provider_dyn_ref + .as_any_mut() + .downcast_mut::>() + // Provider is `GlobalsAccessProvider`, so panic is impossible. + .unwrap_or_else(|| unreachable!("Provider must be `GlobalsAccessProvider`")) + .store; + + store_option.replace(store); + + let store_ref = store_option + .as_mut() + // We set store above, so panic is impossible. + .unwrap_or_else(|| unreachable!("Store must be set before")); + + let res = instance.invoke(store_ref, entry_point.as_entry(), &[]); + + store = globals_provider.store.take().unwrap(); + + res + }; + + #[cfg(not(feature = "std"))] + let res = instance.invoke(&mut store, entry_point.as_entry(), &[]); + + res + } else { + Ok(ReturnValue::Unit) + }; // Fetching global value. let gas = instance - .get_global_val(GLOBAL_NAME_GAS) - .and_then(runtime::as_u64) - .ok_or(System(WrongInjectedGas))?; + .get_global_val(&store, GLOBAL_NAME_GAS) + .and_then(runtime::as_i64) + .ok_or(System(WrongInjectedGas))? as u64; + + let state = store + .data_mut() + .take() + .unwrap_or_else(|| unreachable!("State must be set in `WasmiEnvironment::new`; qed")); - let (ext, memory_wrap, termination_reason) = runtime.terminate(res, gas); + let (ext, termination_reason) = state.terminate(res, gas); Ok(BackendReport { termination_reason, - memory_wrap, + memory_wrap: MemoryWrap::new(memory, store), ext, }) } diff --git a/core-backend/sandbox/src/memory.rs b/core-backend/sandbox/src/memory.rs index 3ba7b9144f9..56409841003 100644 --- a/core-backend/sandbox/src/memory.rs +++ b/core-backend/sandbox/src/memory.rs @@ -18,50 +18,109 @@ //! sp-sandbox extensions for memory. +use gear_backend_common::state::HostState; use gear_core::{ + env::Externalities, memory::{HostPointer, Memory, MemoryError}, pages::{PageNumber, PageU32Size, WasmPage}, }; -use gear_sandbox::SandboxMemory; +use gear_sandbox::{ + default_executor::{Caller, Store}, + SandboxMemory, +}; pub type DefaultExecutorMemory = gear_sandbox::default_executor::Memory; -/// Wrapper for sp_sandbox::Memory. -pub struct MemoryWrap(DefaultExecutorMemory); +pub(crate) struct MemoryWrapRef<'a, 'b: 'a, Ext: Externalities + 'static> { + pub memory: DefaultExecutorMemory, + pub caller: &'a mut Caller<'b, HostState>, +} + +impl Memory for MemoryWrapRef<'_, '_, Ext> { + type GrowError = gear_sandbox::Error; + + fn grow(&mut self, pages: WasmPage) -> Result<(), Self::GrowError> { + self.memory.grow(self.caller, pages.raw()).map(|_| ()) + } + + fn size(&self) -> WasmPage { + WasmPage::new(self.memory.size(self.caller)) + .expect("Unexpected backend behavior: wasm size is bigger then u32::MAX") + } -impl MemoryWrap { - pub fn new(mem: DefaultExecutorMemory) -> Self { - MemoryWrap(mem) + fn write(&mut self, offset: u32, buffer: &[u8]) -> Result<(), MemoryError> { + self.memory + .write(self.caller, offset, buffer) + .map_err(|_| MemoryError::AccessOutOfBounds) + } + + fn read(&self, offset: u32, buffer: &mut [u8]) -> Result<(), MemoryError> { + self.memory + .read(self.caller, offset, buffer) + .map_err(|_| MemoryError::AccessOutOfBounds) + } + + unsafe fn get_buffer_host_addr_unsafe(&mut self) -> HostPointer { + self.memory.get_buff(self.caller) as HostPointer + } +} + +/// Wrapper for [`DefaultExecutorMemory`]. +pub struct MemoryWrap +where + Ext: Externalities + 'static, +{ + pub(crate) memory: DefaultExecutorMemory, + pub(crate) store: Store>, +} + +impl MemoryWrap +where + Ext: Externalities + 'static, +{ + /// Wrap [`DefaultExecutorMemory`] for Memory trait. + pub fn new( + memory: DefaultExecutorMemory, + store: Store>, + ) -> Self { + MemoryWrap { memory, store } + } + + pub(crate) fn into_store(self) -> Store> { + self.store } } /// Memory interface for the allocator. -impl Memory for MemoryWrap { +impl Memory for MemoryWrap +where + Ext: Externalities + 'static, +{ type GrowError = gear_sandbox::Error; fn grow(&mut self, pages: WasmPage) -> Result<(), Self::GrowError> { - self.0.grow(pages.raw()).map(|_| ()) + self.memory.grow(&mut self.store, pages.raw()).map(|_| ()) } fn size(&self) -> WasmPage { - WasmPage::new(self.0.size()) - .expect("Unexpected backend behavior: size is bigger then u32::MAX") + WasmPage::new(self.memory.size(&self.store)) + .expect("Unexpected backend behavior: wasm size is bigger then u32::MAX") } fn write(&mut self, offset: u32, buffer: &[u8]) -> Result<(), MemoryError> { - self.0 - .set(offset, buffer) + self.memory + .write(&mut self.store, offset, buffer) .map_err(|_| MemoryError::AccessOutOfBounds) } fn read(&self, offset: u32, buffer: &mut [u8]) -> Result<(), MemoryError> { - self.0 - .get(offset, buffer) + self.memory + .read(&self.store, offset, buffer) .map_err(|_| MemoryError::AccessOutOfBounds) } unsafe fn get_buffer_host_addr_unsafe(&mut self) -> HostPointer { - self.0.get_buff() + self.memory.get_buff(&mut self.store) as HostPointer } } @@ -69,16 +128,29 @@ impl Memory for MemoryWrap { #[cfg(test)] mod tests { use super::*; - use gear_backend_common::{assert_err, assert_ok}; + use gear_backend_common::{ + assert_err, assert_ok, mock::MockExt, state::State, ActorTerminationReason, + }; use gear_core::memory::{AllocError, AllocationsContext, NoopGrowHandler}; + use gear_sandbox::{AsContextExt, SandboxStore}; - fn new_test_memory(static_pages: u16, max_pages: u16) -> (AllocationsContext, MemoryWrap) { + fn new_test_memory( + static_pages: u16, + max_pages: u16, + ) -> (AllocationsContext, MemoryWrap) { use gear_sandbox::SandboxMemory as WasmMemory; - let memory = MemoryWrap::new( - WasmMemory::new(static_pages as u32, Some(max_pages as u32)) - .expect("Memory creation failed"), - ); + let mut store = Store::new(None); + let memory: DefaultExecutorMemory = + WasmMemory::new(&mut store, static_pages as u32, Some(max_pages as u32)) + .expect("Memory creation failed"); + *store.data_mut() = Some(State { + ext: MockExt::default(), + memory: memory.clone(), + termination_reason: ActorTerminationReason::Success.into(), + }); + + let memory = MemoryWrap::new(memory, store); ( AllocationsContext::new(Default::default(), static_pages.into(), max_pages.into()), diff --git a/core-backend/sandbox/src/runtime.rs b/core-backend/sandbox/src/runtime.rs index 1e2573239b4..73dc54c5a8f 100644 --- a/core-backend/sandbox/src/runtime.rs +++ b/core-backend/sandbox/src/runtime.rs @@ -18,7 +18,7 @@ //! sp-sandbox runtime (here it's contract execution state) realization. -use crate::MemoryWrap; +use crate::{memory::MemoryWrapRef, DefaultExecutorMemory}; use alloc::vec::Vec; use codec::{Decode, MaxEncodedLen}; use gear_backend_common::{ @@ -27,10 +27,11 @@ use gear_backend_common::{ WasmMemoryReadAs, WasmMemoryReadDecoded, WasmMemoryWrite, WasmMemoryWriteAs, }, runtime::{RunFallibleError, Runtime as CommonRuntime}, - BackendExternalities, BackendState, BackendTermination, UndefinedTerminationReason, + state::{HostState, State}, + BackendExternalities, BackendState, UndefinedTerminationReason, }; use gear_core::{costs::RuntimeCosts, pages::WasmPage}; -use gear_sandbox::{HostError, Value}; +use gear_sandbox::{default_executor::Caller, AsContextExt, HostError, Value}; pub(crate) fn as_i64(v: Value) -> Option { match v { @@ -39,37 +40,52 @@ pub(crate) fn as_i64(v: Value) -> Option { } } -pub(crate) fn as_u64(v: Value) -> Option { - as_i64(v).map(|v| v as u64) +#[track_caller] +pub(crate) fn caller_host_state_mut<'a, 'b: 'a, Ext>( + caller: &'a mut Caller<'_, HostState>, +) -> &'a mut State { + caller + .data_mut() + .as_mut() + .unwrap_or_else(|| unreachable!("host_state must be set before execution")) } -pub(crate) struct Runtime { - pub ext: Ext, - pub memory: MemoryWrap, - pub termination_reason: UndefinedTerminationReason, - // TODO: make wrapper around runtime and move memory_manager there (issue #2067) - pub memory_manager: MemoryAccessManager, +#[track_caller] +pub(crate) fn caller_host_state_take( + caller: &mut Caller<'_, HostState>, +) -> State { + caller + .data_mut() + .take() + .unwrap_or_else(|| unreachable!("host_state must be set before execution")) } -impl CommonRuntime for Runtime { +pub(crate) struct CallerWrap<'a, 'b: 'a, Ext> { + pub caller: &'a mut Caller<'b, HostState>, + pub manager: MemoryAccessManager, + pub memory: DefaultExecutorMemory, +} + +impl<'a, 'b, Ext: BackendExternalities + 'static> CommonRuntime for CallerWrap<'a, 'b, Ext> { type Error = HostError; fn ext_mut(&mut self) -> &mut Ext { - &mut self.ext + &mut self.host_state_mut().ext } fn unreachable_error() -> Self::Error { HostError } + #[track_caller] fn run_any(&mut self, gas: u64, cost: RuntimeCosts, f: F) -> Result<(u64, T), Self::Error> where F: FnOnce(&mut Self) -> Result, { - self.prepare_run(gas); + self.host_state_mut().ext.decrease_current_counter_to(gas); let run = || { - self.ext.charge_gas_runtime(cost)?; + self.host_state_mut().ext.charge_gas_runtime(cost)?; f(self) }; @@ -78,9 +94,10 @@ impl CommonRuntime for Runtime { self.set_termination_reason(err); HostError }) - .map(|r| (self.ext.define_current_counter(), r)) + .map(|r| (self.host_state_mut().ext.define_current_counter(), r)) } + #[track_caller] fn run_fallible( &mut self, gas: u64, @@ -92,80 +109,116 @@ impl CommonRuntime for Runtime { F: FnOnce(&mut Self) -> Result, R: From> + Sized, { - self.run_any(gas, cost, |ctx| { - let res = f(ctx); - let res = ctx.process_fallible_func_result(res)?; + self.run_any( + gas, + cost, + |ctx: &mut Self| -> Result<_, UndefinedTerminationReason> { + let res = f(ctx); + let res = ctx.host_state_mut().process_fallible_func_result(res)?; - // TODO: move above or make normal process memory access. - let write_res = ctx.memory_manager.register_write_as::(res_ptr); + // TODO: move above or make normal process memory access. + let write_res = ctx.register_write_as::(res_ptr); - ctx.write_as(write_res, R::from(res)).map_err(Into::into) - }) + ctx.write_as(write_res, R::from(res)).map_err(Into::into) + }, + ) } fn alloc(&mut self, pages: u32) -> Result::AllocError> { - self.ext.alloc(pages, &mut self.memory) + let mut state = caller_host_state_take(self.caller); + let mut mem = CallerWrap::memory(self.caller, self.memory.clone()); + let res = state.ext.alloc(pages, &mut mem); + self.caller.data_mut().replace(state); + res } } -impl Runtime { - // Cleans `memory_manager`, updates ext counters based on globals. - fn prepare_run(&mut self, gas: u64) { - self.memory_manager = Default::default(); +impl<'a, 'b, Ext: BackendExternalities + 'static> CallerWrap<'a, 'b, Ext> { + #[track_caller] + pub fn prepare( + caller: &'a mut Caller<'b, HostState>, + ) -> Result { + let memory = caller_host_state_mut(caller).memory.clone(); + Ok(Self { + caller, + manager: Default::default(), + memory, + }) + } + + #[track_caller] + pub fn host_state_mut(&mut self) -> &mut State { + caller_host_state_mut(self.caller) + } - self.ext.decrease_current_counter_to(gas); + #[track_caller] + pub fn memory<'c, 'd: 'c>( + caller: &'c mut Caller<'d, HostState>, + memory: DefaultExecutorMemory, + ) -> MemoryWrapRef<'c, 'd, Ext> { + MemoryWrapRef::<'c, 'd, _> { memory, caller } } fn with_memory(&mut self, f: F) -> Result where F: FnOnce( &mut MemoryAccessManager, - &mut MemoryWrap, + &mut MemoryWrapRef, &mut u64, ) -> Result, { - let mut gas_counter = self.ext.define_current_counter(); + let mut gas_counter = self.host_state_mut().ext.define_current_counter(); + + let mut memory = Self::memory(self.caller, self.memory.clone()); // With memory ops do similar subtractions for both counters. - let res = f(&mut self.memory_manager, &mut self.memory, &mut gas_counter); + let res = f(&mut self.manager, &mut memory, &mut gas_counter); - self.ext.decrease_current_counter_to(gas_counter); + self.host_state_mut() + .ext + .decrease_current_counter_to(gas_counter); res } } -impl MemoryAccessRecorder for Runtime { +impl<'a, 'b, Ext> MemoryAccessRecorder for CallerWrap<'a, 'b, Ext> { fn register_read(&mut self, ptr: u32, size: u32) -> WasmMemoryRead { - self.memory_manager.register_read(ptr, size) + self.manager.register_read(ptr, size) } fn register_read_as(&mut self, ptr: u32) -> WasmMemoryReadAs { - self.memory_manager.register_read_as(ptr) + self.manager.register_read_as(ptr) } fn register_read_decoded( &mut self, ptr: u32, ) -> WasmMemoryReadDecoded { - self.memory_manager.register_read_decoded(ptr) + self.manager.register_read_decoded(ptr) } fn register_write(&mut self, ptr: u32, size: u32) -> WasmMemoryWrite { - self.memory_manager.register_write(ptr, size) + self.manager.register_write(ptr, size) } fn register_write_as(&mut self, ptr: u32) -> WasmMemoryWriteAs { - self.memory_manager.register_write_as(ptr) + self.manager.register_write_as(ptr) + } +} + +impl BackendState for CallerWrap<'_, '_, Ext> { + fn set_termination_reason(&mut self, reason: UndefinedTerminationReason) { + self.host_state_mut().set_termination_reason(reason); } } -impl MemoryOwner for Runtime { +impl<'a, 'b, Ext: BackendExternalities + 'static> MemoryOwner for CallerWrap<'a, 'b, Ext> { fn read(&mut self, read: WasmMemoryRead) -> Result, MemoryAccessError> { - self.with_memory(move |manager, memory, gas_left| manager.read(memory, read, gas_left)) + self.with_memory(|manager, memory, gas_left| manager.read(memory, read, gas_left)) } fn read_as(&mut self, read: WasmMemoryReadAs) -> Result { - self.with_memory(move |manager, memory, gas_left| manager.read_as(memory, read, gas_left)) + self.with_memory(|manager, memory, gas_left| manager.read_as(memory, read, gas_left)) } fn read_decoded( @@ -193,21 +246,3 @@ impl MemoryOwner for Runtime { }) } } - -impl BackendState for Runtime { - fn set_termination_reason(&mut self, reason: UndefinedTerminationReason) { - self.termination_reason = reason; - } -} - -impl BackendTermination for Runtime { - fn into_parts(self) -> (Ext, MemoryWrap, UndefinedTerminationReason) { - let Self { - ext, - memory, - termination_reason, - .. - } = self; - (ext, memory, termination_reason) - } -} diff --git a/core-backend/wasmi/src/env.rs b/core-backend/wasmi/src/env.rs index 44bc50edb78..ddf03c1469c 100644 --- a/core-backend/wasmi/src/env.rs +++ b/core-backend/wasmi/src/env.rs @@ -18,16 +18,13 @@ //! wasmi environment for running a module. -use crate::{ - funcs_tree, - memory::MemoryWrap, - state::{HostState, State}, -}; +use crate::{funcs_tree, memory::MemoryWrap}; use alloc::{collections::BTreeSet, format, string::ToString}; use core::{any::Any, convert::Infallible, fmt::Display}; use gear_backend_common::{ lazy_pages::{GlobalsAccessConfig, GlobalsAccessError, GlobalsAccessMod, GlobalsAccessor}, runtime::RunFallibleError, + state::{HostState, State}, ActorTerminationReason, BackendAllocSyscallError, BackendExternalities, BackendReport, BackendSyscallError, BackendTermination, Environment, EnvironmentError, EnvironmentExecutionResult, LimitedStr, @@ -73,7 +70,7 @@ where EntryPoint: WasmEntryPoint, { instance: Instance, - store: Store>, + store: Store>, memory: Memory, entries: BTreeSet, entry_point: EntryPoint, @@ -81,7 +78,7 @@ where struct GlobalsAccessProvider { instance: Instance, - store: Option>>, + store: Option>>, } impl GlobalsAccessProvider { @@ -144,9 +141,9 @@ where use WasmiEnvironmentError::*; let engine = Engine::default(); - let mut store: Store> = Store::new(&engine, None); + let mut store: Store> = Store::new(&engine, None); - let mut linker: Linker> = Linker::new(); + let mut linker: Linker> = Linker::new(); let memory_type = MemoryType::new(mem_size.raw(), None); let memory = @@ -180,6 +177,7 @@ where let runtime = State { ext, + memory, termination_reason: ActorTerminationReason::Success.into(), }; @@ -321,7 +319,7 @@ where .take() .unwrap_or_else(|| unreachable!("State must be set in `WasmiEnvironment::new`; qed")); - let (ext, _, termination_reason) = state.terminate(res, gas as u64); + let (ext, termination_reason) = state.terminate(res, gas as u64); Ok(BackendReport { termination_reason, diff --git a/core-backend/wasmi/src/funcs_tree.rs b/core-backend/wasmi/src/funcs_tree.rs index dba1ef58a79..78dacbf2a9a 100644 --- a/core-backend/wasmi/src/funcs_tree.rs +++ b/core-backend/wasmi/src/funcs_tree.rs @@ -18,11 +18,11 @@ //! `build` function that collects all the syscalls. -use crate::{runtime::CallerWrap, state::HostState, wasmi::Caller}; +use crate::{runtime::CallerWrap, wasmi::Caller}; use alloc::collections::{BTreeMap, BTreeSet}; use gear_backend_common::{ - funcs::FuncsHandler as CommonFuncsHandler, runtime::RunFallibleError, BackendAllocSyscallError, - BackendExternalities, BackendSyscallError, + funcs::FuncsHandler as CommonFuncsHandler, runtime::RunFallibleError, state::HostState, + BackendAllocSyscallError, BackendExternalities, BackendSyscallError, }; use gear_wasm_instrument::syscalls::SysCallName::{self, *}; use wasmi::{core::Trap, Func, Memory, Store}; @@ -43,7 +43,7 @@ impl FunctionBuilder { macro_rules! wrap_common_func_internal_ret { ($func:path, $($arg_name:ident),*) => { |store: &mut Store<_>, forbidden, memory| { - let func = move |caller: Caller<'_, HostState>, $($arg_name,)*| -> Result<(_, ), Trap> + let func = move |caller: Caller<'_, HostState>, $($arg_name,)*| -> Result<(_, ), Trap> { let mut ctx = CallerWrap::prepare(caller, forbidden, memory)?; // Zero-value argument is an unused gas value for wasmi backend as well @@ -58,7 +58,7 @@ macro_rules! wrap_common_func_internal_ret { macro_rules! wrap_common_func_internal_no_ret { ($func:path, $($arg_name:ident),*) => { |store: &mut Store<_>, forbidden, memory| { - let func = move |caller: Caller<'_, HostState>, $($arg_name,)*| -> Result<(), Trap> + let func = move |caller: Caller<'_, HostState>, $($arg_name,)*| -> Result<(), Trap> { let mut ctx = CallerWrap::prepare(caller, forbidden, memory)?; // Zero-value argument is an unused gas value for wasmi backend as well @@ -95,7 +95,7 @@ macro_rules! wrap_common_func { } pub(crate) fn build( - store: &mut Store>, + store: &mut Store>, memory: Memory, forbidden_funcs: BTreeSet, ) -> BTreeMap diff --git a/core-backend/wasmi/src/lib.rs b/core-backend/wasmi/src/lib.rs index 0667153c41e..386cd0397ff 100644 --- a/core-backend/wasmi/src/lib.rs +++ b/core-backend/wasmi/src/lib.rs @@ -26,7 +26,6 @@ pub mod env; pub mod funcs_tree; pub mod memory; pub mod runtime; -pub mod state; pub use env::WasmiEnvironment; pub use memory::MemoryWrap; diff --git a/core-backend/wasmi/src/memory.rs b/core-backend/wasmi/src/memory.rs index 0f4d1ad0a34..e1eb2fdac24 100644 --- a/core-backend/wasmi/src/memory.rs +++ b/core-backend/wasmi/src/memory.rs @@ -18,7 +18,7 @@ //! wasmi extensions for memory. -use crate::state::HostState; +use gear_backend_common::state::HostState; use gear_core::{ env::Externalities, memory::{HostPointer, Memory, MemoryError}, @@ -28,7 +28,7 @@ use wasmi::{core::memory_units::Pages, Memory as WasmiMemory, Store, StoreContex pub(crate) struct MemoryWrapRef<'a, Ext: Externalities + 'static> { pub memory: WasmiMemory, - pub store: StoreContextMut<'a, HostState>, + pub store: StoreContextMut<'a, HostState>, } impl<'a, Ext: Externalities + 'static> Memory for MemoryWrapRef<'a, Ext> { @@ -65,15 +65,15 @@ impl<'a, Ext: Externalities + 'static> Memory for MemoryWrapRef<'a, Ext> { /// Wrapper for [`wasmi::Memory`]. pub struct MemoryWrap { pub(crate) memory: WasmiMemory, - pub(crate) store: Store>, + pub(crate) store: Store>, } impl MemoryWrap { /// Wrap [`wasmi::Memory`] for Memory trait. - pub(crate) fn new(memory: WasmiMemory, store: Store>) -> Self { + pub(crate) fn new(memory: WasmiMemory, store: Store>) -> Self { MemoryWrap { memory, store } } - pub(crate) fn into_store(self) -> Store> { + pub(crate) fn into_store(self) -> Store> { self.store } } @@ -112,10 +112,11 @@ impl Memory for MemoryWrap { #[cfg(test)] mod tests { - use crate::state::State; use super::*; - use gear_backend_common::{assert_err, assert_ok, mock::MockExt, ActorTerminationReason}; + use gear_backend_common::{ + assert_err, assert_ok, mock::MockExt, state::State, ActorTerminationReason, + }; use gear_core::memory::{AllocError, AllocationsContext, NoopGrowHandler}; use wasmi::{Engine, Store}; @@ -128,15 +129,13 @@ mod tests { let memory_type = MemoryType::new(static_pages as u32, Some(max_pages as u32)); let engine = Engine::default(); - let mut store = Store::new( - &engine, - Some(State { - ext: MockExt::default(), - termination_reason: ActorTerminationReason::Success.into(), - }), - ); - + let mut store = Store::new(&engine, None); let memory = WasmiMemory::new(&mut store, memory_type).expect("Memory creation failed"); + *store.state_mut() = Some(State { + ext: MockExt::default(), + memory, + termination_reason: ActorTerminationReason::Success.into(), + }); let memory = MemoryWrap::new(memory, store); ( diff --git a/core-backend/wasmi/src/runtime.rs b/core-backend/wasmi/src/runtime.rs index da154a83905..e21745f43b2 100644 --- a/core-backend/wasmi/src/runtime.rs +++ b/core-backend/wasmi/src/runtime.rs @@ -18,7 +18,7 @@ //! Runtime implementation for wasmi backend. -use crate::{memory::MemoryWrapRef, state::HostState}; +use crate::memory::MemoryWrapRef; use alloc::vec::Vec; use codec::{Decode, MaxEncodedLen}; use gear_backend_common::{ @@ -27,6 +27,7 @@ use gear_backend_common::{ WasmMemoryReadAs, WasmMemoryReadDecoded, WasmMemoryWrite, WasmMemoryWriteAs, }, runtime::{RunFallibleError, Runtime}, + state::{HostState, State}, ActorTerminationReason, BackendExternalities, BackendState, TrapExplanation, UndefinedTerminationReason, }; @@ -37,8 +38,7 @@ use wasmi::{ AsContextMut, Caller, Memory as WasmiMemory, }; -use crate::state::State; - +#[track_caller] pub(crate) fn caller_host_state_mut<'a, 'b: 'a, Ext>( caller: &'a mut Caller<'b, Option>, ) -> &'a mut Ext { @@ -48,6 +48,7 @@ pub(crate) fn caller_host_state_mut<'a, 'b: 'a, Ext>( .unwrap_or_else(|| unreachable!("host_state must be set before execution")) } +#[track_caller] pub(crate) fn caller_host_state_take<'a, 'b: 'a, Ext>( caller: &'a mut Caller<'b, Option>, ) -> Ext { @@ -58,7 +59,7 @@ pub(crate) fn caller_host_state_take<'a, 'b: 'a, Ext>( } pub(crate) struct CallerWrap<'a, Ext> { - pub caller: Caller<'a, HostState>, + pub caller: Caller<'a, HostState>, pub manager: MemoryAccessManager, pub memory: WasmiMemory, } @@ -134,7 +135,7 @@ impl<'a, Ext: BackendExternalities + 'static> Runtime for CallerWrap<'a, Ex impl<'a, Ext: BackendExternalities + 'static> CallerWrap<'a, Ext> { #[track_caller] pub fn prepare( - caller: Caller<'a, HostState>, + caller: Caller<'a, HostState>, forbidden: bool, memory: WasmiMemory, ) -> Result { @@ -170,13 +171,13 @@ impl<'a, Ext: BackendExternalities + 'static> CallerWrap<'a, Ext> { } #[track_caller] - pub fn host_state_mut(&mut self) -> &mut State { + pub fn host_state_mut(&mut self) -> &mut State { caller_host_state_mut(&mut self.caller) } #[track_caller] pub fn memory<'b, 'c: 'b>( - caller: &'b mut Caller<'c, Option>>, + caller: &'b mut Caller<'c, Option>>, memory: WasmiMemory, ) -> MemoryWrapRef<'b, Ext> { MemoryWrapRef::<'b, _> { diff --git a/pallets/gear/src/benchmarking/code.rs b/pallets/gear/src/benchmarking/code.rs index 122712fda9a..70f86827b96 100644 --- a/pallets/gear/src/benchmarking/code.rs +++ b/pallets/gear/src/benchmarking/code.rs @@ -33,7 +33,7 @@ use gear_core::{ pages::{PageNumber, PageU32Size, WasmPage}, }; use gear_sandbox::{ - default_executor::{EnvironmentDefinitionBuilder, Memory}, + default_executor::{EnvironmentDefinitionBuilder, Memory, Store}, SandboxEnvironmentBuilder, SandboxMemory, }; use gear_wasm_instrument::{ @@ -376,13 +376,17 @@ where /// Creates a memory instance for use in a sandbox with dimensions declared in this module /// and adds it to `env`. A reference to that memory is returned so that it can be used to /// access the memory contents from the supervisor. - pub fn add_memory(&self, env: &mut EnvironmentDefinitionBuilder) -> Option { + pub fn add_memory( + &self, + store: &mut Store<()>, + env: &mut EnvironmentDefinitionBuilder, + ) -> Option { let memory = if let Some(memory) = &self.memory { memory } else { return None; }; - let memory = Memory::new(memory.min_pages.raw(), None).unwrap(); + let memory = Memory::new(store, memory.min_pages.raw(), None).unwrap(); env.add_memory("env", "memory", memory.clone()); Some(memory) } diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index f9a56de0a48..3e48b7ef458 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -95,7 +95,7 @@ use gear_core::{ reservation::GasReserver, }; use gear_core_errors::*; -use gear_sandbox::SandboxMemory; +use gear_sandbox::{default_executor::Store, SandboxMemory, SandboxStore}; use gear_wasm_instrument::{ parity_wasm::elements::{BlockType, BrTableData, Instruction, SignExtInstruction, ValueType}, syscalls::SysCallName, @@ -1619,7 +1619,9 @@ benchmarks! { mem_grow { let r in 0 .. API_BENCHMARK_BATCHES; - let mut mem = MemoryWrap::new(DefaultExecutorMemory::new(1, None).unwrap()); + let mut store = Store::new(None); + let mem = DefaultExecutorMemory::new(&mut store, 1, None).unwrap(); + let mut mem = MemoryWrap::::new(mem, store); }: { for _ in 0..(r * API_BENCHMARK_BATCH_SIZE) { mem.grow(1.into()).unwrap(); diff --git a/pallets/gear/src/benchmarking/sandbox.rs b/pallets/gear/src/benchmarking/sandbox.rs index 8954a3f0fc5..a091ea32b5a 100644 --- a/pallets/gear/src/benchmarking/sandbox.rs +++ b/pallets/gear/src/benchmarking/sandbox.rs @@ -26,20 +26,23 @@ use super::{ use common::Origin; use gear_sandbox::{ - default_executor::{EnvironmentDefinitionBuilder, Instance, Memory}, - SandboxEnvironmentBuilder, SandboxInstance, + default_executor::{EnvironmentDefinitionBuilder, Instance, Memory, Store}, + SandboxEnvironmentBuilder, SandboxInstance, SandboxStore, }; /// Minimal execution environment without any exported functions. pub struct Sandbox { instance: Instance<()>, + store: Store<()>, _memory: Option, } impl Sandbox { /// Invoke the `handle` function of a program code and panic on any execution error. pub fn invoke(&mut self) { - self.instance.invoke("handle", &[], &mut ()).unwrap(); + self.instance + .invoke(&mut self.store, "handle", &[]) + .unwrap(); } } @@ -52,11 +55,13 @@ where /// to the instance as the module declares as imported. fn from(module: &WasmModule) -> Self { let mut env_builder = EnvironmentDefinitionBuilder::new(); - let memory = module.add_memory(&mut env_builder); - let instance = Instance::new(&module.code, &env_builder, &mut ()) + let mut store = Store::new(()); + let memory = module.add_memory(&mut store, &mut env_builder); + let instance = Instance::new(&mut store, &module.code, &env_builder) .expect("Failed to create benchmarking Sandbox instance"); Self { instance, + store, _memory: memory, } } @@ -72,11 +77,13 @@ impl Sandbox { { let module: WasmModule = module.into(); let mut env_builder = EnvironmentDefinitionBuilder::new(); - let memory = module.add_memory(&mut env_builder); - let instance = Instance::new(&module.code, &env_builder, &mut ()) + let mut store = Store::new(()); + let memory = module.add_memory(&mut store, &mut env_builder); + let instance = Instance::new(&mut store, &module.code, &env_builder) .expect("Failed to create benchmarking Sandbox instance"); Self { instance, + store, _memory: memory, } } diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index e1a71c9b211..1ccd629e1d2 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -99,10 +99,6 @@ use ext::LazyPagesExt as Ext; #[cfg(not(feature = "lazy-pages"))] use core_processor::Ext; -#[cfg(feature = "std")] -type ExecutionEnvironment = gear_backend_wasmi::WasmiEnvironment; - -#[cfg(not(feature = "std"))] type ExecutionEnvironment = gear_backend_sandbox::SandboxEnvironment; pub(crate) type CurrencyOf = ::Currency; diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 595c05db71a..8b98ec8d18b 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -12664,6 +12664,7 @@ fn module_instantiation_error() { } #[test] +#[ignore = "issue #3100"] fn wrong_entry_type() { let wat = r#" (module @@ -13680,6 +13681,28 @@ fn remove_from_waitlist_after_exit_reply() { }) } +// currently `parity_wasm` doesn't support WASM reference types +#[test] +fn wasm_ref_types_doesnt_work() { + const WAT: &str = r#" + (module + (import "env" "memory" (memory 1)) + (export "init" (func $init)) + (elem declare func $init) + (func $init + ref.func $init + call $test + ) + (func $test (param funcref)) + ) + "#; + + init_logger(); + new_test_ext().execute_with(|| { + let _pid = upload_program_default(USER_1, ProgramCodeKind::Custom(WAT)).unwrap_err(); + }); +} + mod utils { #![allow(unused)] diff --git a/runtime-interface/src/lib.rs b/runtime-interface/src/lib.rs index 62b2fd416d5..2608fdcaff4 100644 --- a/runtime-interface/src/lib.rs +++ b/runtime-interface/src/lib.rs @@ -37,7 +37,6 @@ use sp_runtime_interface::{ }; extern crate alloc; -use alloc::string::String; #[cfg(feature = "std")] use gear_lazy_pages as lazy_pages; diff --git a/sandbox/env/src/lib.rs b/sandbox/env/src/lib.rs index 7c344495963..968f77095c3 100644 --- a/sandbox/env/src/lib.rs +++ b/sandbox/env/src/lib.rs @@ -20,6 +20,9 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + +use alloc::string::String; use codec::{Decode, Encode}; use sp_core::RuntimeDebug; use sp_std::vec::Vec; @@ -64,9 +67,9 @@ pub enum ExternEntity { #[codec(crate = codec)] pub struct Entry { /// Module name of which corresponding entity being defined. - pub module_name: Vec, + pub module_name: String, /// Field name in which corresponding entity being defined. - pub field_name: Vec, + pub field_name: String, /// External entity being defined. pub entity: ExternEntity, } @@ -133,6 +136,9 @@ impl WasmReturnValue { pub const ENCODED_MAX_SIZE: usize = 8 + ReturnValue::ENCODED_MAX_SIZE; } +// TODO #3057 +pub const GLOBAL_NAME_GAS: &str = "gear_gas"; + #[cfg(test)] mod tests { use super::*; @@ -150,16 +156,16 @@ mod tests { roundtrip(EnvironmentDefinition { entries: vec![Entry { - module_name: b"kernel"[..].into(), - field_name: b"memory"[..].into(), + module_name: "kernel".to_string(), + field_name: "memory".to_string(), entity: ExternEntity::Memory(1337), }], }); roundtrip(EnvironmentDefinition { entries: vec![Entry { - module_name: b"env"[..].into(), - field_name: b"abort"[..].into(), + module_name: "env".to_string(), + field_name: "abort".to_string(), entity: ExternEntity::Function(228), }], }); diff --git a/sandbox/host/src/sandbox.rs b/sandbox/host/src/sandbox.rs index 5c67022d847..bb469729841 100644 --- a/sandbox/host/src/sandbox.rs +++ b/sandbox/host/src/sandbox.rs @@ -100,28 +100,22 @@ impl GuestToSupervisorFunctionMapping { /// Holds sandbox function and memory imports and performs name resolution struct Imports { /// Maps qualified function name to its guest function index - func_map: HashMap<(Vec, Vec), GuestFuncIndex>, + func_map: HashMap<(String, String), GuestFuncIndex>, /// Maps qualified field name to its memory reference - memories_map: HashMap<(Vec, Vec), Memory>, + memories_map: HashMap<(String, String), Memory>, } impl Imports { fn func_by_name(&self, module_name: &str, func_name: &str) -> Option { self.func_map - .get(&( - module_name.as_bytes().to_owned(), - func_name.as_bytes().to_owned(), - )) + .get(&(module_name.to_owned(), func_name.to_string())) .cloned() } fn memory_by_name(&self, module_name: &str, memory_name: &str) -> Option { self.memories_map - .get(&( - module_name.as_bytes().to_owned(), - memory_name.as_bytes().to_owned(), - )) + .get(&(module_name.to_string(), memory_name.to_string())) .cloned() } } diff --git a/sandbox/host/src/sandbox/wasmer_backend.rs b/sandbox/host/src/sandbox/wasmer_backend.rs index e02d53c92df..3d183163ec3 100644 --- a/sandbox/host/src/sandbox/wasmer_backend.rs +++ b/sandbox/host/src/sandbox/wasmer_backend.rs @@ -23,7 +23,7 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc}; use wasmer::{Exportable, RuntimeError}; use codec::{Decode, Encode}; -use gear_sandbox_env::{HostError, Instantiate, WasmReturnValue}; +use gear_sandbox_env::{HostError, Instantiate, WasmReturnValue, GLOBAL_NAME_GAS}; use sp_wasm_interface::{util, Pointer, ReturnValue, Value, WordSize}; use crate::{ @@ -87,9 +87,6 @@ impl Clone for Env { } } -// TODO #3057 -pub const GLOBAL_NAME_GAS: &str = "gear_gas"; - impl wasmer::WasmerEnv for Env { fn init_with_instance( &mut self, diff --git a/sandbox/sandbox/Cargo.toml b/sandbox/sandbox/Cargo.toml index 9332dfdeefd..1e986b8051c 100644 --- a/sandbox/sandbox/Cargo.toml +++ b/sandbox/sandbox/Cargo.toml @@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec.workspace = true log.workspace = true -wasmi = { git = "https://github.com/gear-tech/wasmi", branch = "v0.13.2-sign-ext", default-features = false } +wasmi = { git = "https://github.com/gear-tech/wasmi", branch = "gear-v0.30.0", default-features = false } sp-core.workspace = true sp-std.workspace = true sp-wasm-interface.workspace = true diff --git a/sandbox/sandbox/src/embedded_executor.rs b/sandbox/sandbox/src/embedded_executor.rs index 79d9ec396fb..8a73ef00989 100644 --- a/sandbox/sandbox/src/embedded_executor.rs +++ b/sandbox/sandbox/src/embedded_executor.rs @@ -18,325 +18,402 @@ //! An embedded WASM executor utilizing `wasmi`. +use crate::{ + AsContextExt, Error, GlobalsSetError, HostError, HostFuncType, ReturnValue, SandboxStore, + Value, TARGET, +}; use alloc::string::String; - +use gear_sandbox_env::GLOBAL_NAME_GAS; +use sp_std::{collections::btree_map::BTreeMap, marker::PhantomData, prelude::*}; use sp_wasm_interface::HostPointer; use wasmi::{ - memory_units::Pages, Externals, FuncInstance, FuncRef, GlobalDescriptor, GlobalRef, - ImportResolver, MemoryDescriptor, MemoryInstance, MemoryRef, Module, ModuleInstance, ModuleRef, - RuntimeArgs, RuntimeValue, Signature, TableDescriptor, TableRef, Trap, + core::{Pages, Trap}, + Engine, ExternType, Linker, MemoryType, Module, StoreContext, StoreContextMut, + Value as RuntimeValue, }; -use sp_std::{ - borrow::ToOwned, collections::btree_map::BTreeMap, fmt, marker::PhantomData, prelude::*, -}; +/// [`AsContextExt`] extension. +pub trait AsContext: wasmi::AsContext + wasmi::AsContextMut {} -use crate::{Error, HostError, HostFuncType, ReturnValue, Value, TARGET}; +/// wasmi store wrapper. +pub struct Store(wasmi::Store); -/// The linear memory used by the sandbox. -#[derive(Clone)] -pub struct Memory { - memref: MemoryRef, +impl Store { + fn engine(&self) -> &Engine { + self.0.engine() + } } -impl super::SandboxMemory for Memory { - fn new(initial: u32, maximum: Option) -> Result { - Ok(Memory { - memref: MemoryInstance::alloc( - Pages(initial as usize), - maximum.map(|m| Pages(m as usize)), - ) - .map_err(|_| Error::Module)?, - }) +impl SandboxStore for Store { + fn new(state: T) -> Self { + let engine = Engine::default(); + let store = wasmi::Store::new(&engine, state); + Self(store) } +} - fn get(&self, ptr: u32, buf: &mut [u8]) -> Result<(), Error> { - self.memref - .get_into(ptr, buf) - .map_err(|_| Error::OutOfBounds)?; - Ok(()) +impl wasmi::AsContext for Store { + type UserState = T; + + fn as_context(&self) -> StoreContext { + self.0.as_context() } +} - fn set(&self, ptr: u32, value: &[u8]) -> Result<(), Error> { - self.memref - .set(ptr, value) - .map_err(|_| Error::OutOfBounds)?; - Ok(()) +impl wasmi::AsContextMut for Store { + fn as_context_mut(&mut self) -> StoreContextMut { + self.0.as_context_mut() + } +} + +impl AsContextExt for Store { + fn data_mut(&mut self) -> &mut T { + self.0.data_mut() } +} - fn grow(&self, pages: u32) -> Result { - self.memref - .grow(Pages(pages as usize)) - .map(|prev| (prev.0 as u32)) - .map_err(|_| Error::MemoryGrow) +impl AsContext for Store {} + +/// wasmi caller wrapper. +pub struct Caller<'a, T>(wasmi::Caller<'a, T>); + +impl wasmi::AsContext for Caller<'_, T> { + type UserState = T; + + fn as_context(&self) -> StoreContext { + self.0.as_context() } +} - fn size(&self) -> u32 { - self.memref.current_size().0 as u32 +impl wasmi::AsContextMut for Caller<'_, T> { + fn as_context_mut(&mut self) -> StoreContextMut { + self.0.as_context_mut() } +} - unsafe fn get_buff(&self) -> u64 { - self.memref.direct_access_mut().as_mut().as_mut_ptr() as usize as u64 +impl AsContextExt for Caller<'_, T> { + fn data_mut(&mut self) -> &mut T { + self.0.data_mut() } } -struct HostFuncIndex(usize); +impl AsContext for Caller<'_, T> {} -struct DefinedHostFunctions { - funcs: Vec>, +/// The linear memory used by the sandbox. +#[derive(Clone)] +pub struct Memory { + memref: wasmi::Memory, } -impl Clone for DefinedHostFunctions { - fn clone(&self) -> DefinedHostFunctions { - DefinedHostFunctions { - funcs: self.funcs.clone(), - } +impl super::SandboxMemory for Memory { + fn new(store: &mut Store, initial: u32, maximum: Option) -> Result { + let ty = MemoryType::new(initial, maximum).map_err(|_| Error::Module)?; + let memref = wasmi::Memory::new(store, ty).map_err(|_| Error::Module)?; + Ok(Memory { memref }) + } + + fn read(&self, ctx: &Context, ptr: u32, buf: &mut [u8]) -> Result<(), Error> + where + Context: AsContextExt, + { + let data = self + .memref + .data(ctx) + .get((ptr as usize)..(ptr as usize + buf.len())) + .ok_or(Error::OutOfBounds)?; + buf[..].copy_from_slice(data); + Ok(()) } -} -impl DefinedHostFunctions { - fn new() -> DefinedHostFunctions { - DefinedHostFunctions { funcs: Vec::new() } + fn write(&self, ctx: &mut Context, ptr: u32, value: &[u8]) -> Result<(), Error> + where + Context: AsContextExt, + { + let data = self + .memref + .data_mut(ctx) + .get_mut((ptr as usize)..(ptr as usize + value.len())) + .ok_or(Error::OutOfBounds)?; + data[..].copy_from_slice(value); + Ok(()) } - fn define(&mut self, f: HostFuncType) -> HostFuncIndex { - let idx = self.funcs.len(); - self.funcs.push(f); - HostFuncIndex(idx) + fn grow(&self, ctx: &mut Context, pages: u32) -> Result + where + Context: AsContextExt, + { + let pages = Pages::new(pages).ok_or(Error::MemoryGrow)?; + self.memref + .grow(ctx, pages) + .map(Into::into) + .map_err(|_| Error::MemoryGrow) } -} -#[derive(Debug)] -struct DummyHostError; + fn size(&self, ctx: &Context) -> u32 + where + Context: AsContextExt, + { + self.memref.current_pages(ctx).into() + } -impl fmt::Display for DummyHostError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "DummyHostError") + unsafe fn get_buff(&self, ctx: &mut Context) -> u64 + where + Context: AsContextExt, + { + self.memref.data_mut(ctx).as_mut_ptr() as usize as u64 } } -impl wasmi::HostError for DummyHostError {} - -struct GuestExternals<'a, T: 'a> { - state: &'a mut T, - defined_host_functions: &'a DefinedHostFunctions, +enum ExternVal { + HostFunc(HostFuncType), + Memory(Memory), } -impl<'a, T> Externals for GuestExternals<'a, T> { - fn invoke_index( - &mut self, - index: usize, - args: RuntimeArgs, - ) -> Result, Trap> { - let args = args - .as_ref() - .iter() - .cloned() - .map(to_interface) - .collect::>(); - - let result = (self.defined_host_functions.funcs[index])(self.state, &args); - match result { - Ok(value) => Ok(match value.inner { - ReturnValue::Value(v) => Some(to_wasmi(v)), - ReturnValue::Unit => None, - }), - Err(HostError) => Err(Trap::host(DummyHostError)), +impl ExternVal { + fn host_func(self) -> Option> { + match self { + ExternVal::HostFunc(ptr) => Some(ptr), + ExternVal::Memory(_) => None, + } + } + + fn memory(self) -> Option { + match self { + ExternVal::HostFunc(_) => None, + ExternVal::Memory(mem) => Some(mem), } } } -enum ExternVal { - HostFunc(HostFuncIndex), - Memory(Memory), +impl Clone for ExternVal { + fn clone(&self) -> Self { + match self { + ExternVal::HostFunc(func) => ExternVal::HostFunc(*func), + ExternVal::Memory(mem) => ExternVal::Memory(mem.clone()), + } + } } /// A builder for the environment of the sandboxed WASM module. pub struct EnvironmentDefinitionBuilder { - map: BTreeMap<(Vec, Vec), ExternVal>, - defined_host_functions: DefinedHostFunctions, + map: BTreeMap<(String, String), ExternVal>, } impl super::SandboxEnvironmentBuilder for EnvironmentDefinitionBuilder { - fn new() -> EnvironmentDefinitionBuilder { + fn new() -> Self { EnvironmentDefinitionBuilder { map: BTreeMap::new(), - defined_host_functions: DefinedHostFunctions::new(), } } fn add_host_func(&mut self, module: N1, field: N2, f: HostFuncType) where - N1: Into>, - N2: Into>, + N1: Into, + N2: Into, { - let idx = self.defined_host_functions.define(f); self.map - .insert((module.into(), field.into()), ExternVal::HostFunc(idx)); + .insert((module.into(), field.into()), ExternVal::HostFunc(f)); } fn add_memory(&mut self, module: N1, field: N2, mem: Memory) where - N1: Into>, - N2: Into>, + N1: Into, + N2: Into, { self.map .insert((module.into(), field.into()), ExternVal::Memory(mem)); } } -impl ImportResolver for EnvironmentDefinitionBuilder { - fn resolve_func( - &self, - module_name: &str, - field_name: &str, - signature: &Signature, - ) -> Result { - let key = ( - module_name.as_bytes().to_owned(), - field_name.as_bytes().to_owned(), - ); - let externval = self.map.get(&key).ok_or_else(|| { - log::debug!( - target: TARGET, - "Export {}:{} not found", - module_name, - field_name - ); - wasmi::Error::Instantiation(String::new()) - })?; - let host_func_idx = match *externval { - ExternVal::HostFunc(ref idx) => idx, - _ => { - log::debug!( - target: TARGET, - "Export {}:{} is not a host func", - module_name, - field_name, - ); - return Err(wasmi::Error::Instantiation(String::new())); - } - }; - Ok(FuncInstance::alloc_host(signature.clone(), host_func_idx.0)) - } - - fn resolve_global( - &self, - _module_name: &str, - _field_name: &str, - _global_type: &GlobalDescriptor, - ) -> Result { - log::debug!(target: TARGET, "Importing globals is not supported yet"); - Err(wasmi::Error::Instantiation(String::new())) - } - - fn resolve_memory( - &self, - module_name: &str, - field_name: &str, - _memory_type: &MemoryDescriptor, - ) -> Result { - let key = ( - module_name.as_bytes().to_owned(), - field_name.as_bytes().to_owned(), - ); - let externval = self.map.get(&key).ok_or_else(|| { - log::debug!( - target: TARGET, - "Export {}:{} not found", - module_name, - field_name - ); - wasmi::Error::Instantiation(String::new()) - })?; - let memory = match *externval { - ExternVal::Memory(ref m) => m, - _ => { - log::debug!( - target: TARGET, - "Export {}:{} is not a memory", - module_name, - field_name, - ); - return Err(wasmi::Error::Instantiation(String::new())); - } - }; - Ok(memory.memref.clone()) - } - - fn resolve_table( - &self, - _module_name: &str, - _field_name: &str, - _table_type: &TableDescriptor, - ) -> Result { - log::debug!("Importing tables is not supported yet"); - Err(wasmi::Error::Instantiation(String::new())) - } +/// Sandboxed instance of a WASM module. +pub struct Instance { + instance: wasmi::Instance, + _marker: PhantomData, } -/// Sandboxed instance of a WASM module. -pub struct Instance { - instance: ModuleRef, - defined_host_functions: DefinedHostFunctions, - _marker: PhantomData, +impl Clone for Instance { + fn clone(&self) -> Self { + Self { + instance: self.instance, + _marker: PhantomData, + } + } } -impl super::SandboxInstance for Instance { +impl super::SandboxInstance for Instance { type Memory = Memory; - type EnvironmentBuilder = EnvironmentDefinitionBuilder; + type EnvironmentBuilder = EnvironmentDefinitionBuilder; fn new( + mut store: &mut Store, code: &[u8], - env_def_builder: &EnvironmentDefinitionBuilder, - state: &mut T, - ) -> Result, Error> { - let module = Module::from_buffer(code).map_err(|_| Error::Module)?; - let not_started_instance = - ModuleInstance::new(&module, env_def_builder).map_err(|_| Error::Module)?; - - let defined_host_functions = env_def_builder.defined_host_functions.clone(); - let instance = { - let mut externals = GuestExternals { - state, - defined_host_functions: &defined_host_functions, - }; - not_started_instance - .run_start(&mut externals) - .map_err(|_| Error::Execution)? - }; + env_def_builder: &Self::EnvironmentBuilder, + ) -> Result, Error> { + let module = Module::new(store.engine(), code).map_err(|e| { + log::error!(target: TARGET, "Failed to create module: {e}"); + Error::Module + })?; + let mut linker = Linker::new(store.engine()); + + for import in module.imports() { + let module = import.module().to_string(); + let name = import.name().to_string(); + let key = (module.clone(), name.clone()); + + match import.ty() { + ExternType::Global(_) | ExternType::Table(_) => {} + ExternType::Memory(_mem_ty) => { + let mem = env_def_builder + .map + .get(&key) + .cloned() + .and_then(|val| val.memory()) + .ok_or(Error::Module)? + .memref; + + let mem = wasmi::Extern::Memory(mem); + linker + .define(&module, &name, mem) + .map_err(|_| Error::Module)?; + } + ExternType::Func(func_ty) => { + let func_ptr = env_def_builder + .map + .get(&key) + .cloned() + .and_then(|val| val.host_func()) + .ok_or(Error::Module)?; + + let func = wasmi::Func::new( + &mut store, + func_ty.clone(), + move |caller, params, results| { + let gas = caller + .get_export(GLOBAL_NAME_GAS) + .ok_or_else(|| { + Trap::new(format!("failed to find `{GLOBAL_NAME_GAS}` export")) + })? + .into_global() + .ok_or_else(|| { + Trap::new(format!("{GLOBAL_NAME_GAS} is not global")) + })?; + + let params: Vec<_> = Some(gas.get(&caller)) + .into_iter() + .chain(params.iter().cloned()) + .map(to_interface) + .map(|val| { + val.ok_or(Trap::new( + "`externref` or `funcref` are not supported", + )) + }) + .collect::>()?; + + let mut caller = Caller(caller); + let val = (func_ptr)(&mut caller, ¶ms) + .map_err(|HostError| Trap::new("function error"))?; + + match (val.inner, results) { + (ReturnValue::Unit, []) => {} + (ReturnValue::Value(val), [ret]) => { + let val = to_wasmi(val); + + if val.ty() != ret.ty() { + return Err(Trap::new("mismatching return types")); + } + + *ret = val; + } + _ => unreachable!( + "embedded executor doesn't support multi-value return" + ), + } + + gas.set(&mut caller.0, RuntimeValue::I64(val.gas)) + .map_err(|e| { + Trap::new(format!( + "failed to set `{GLOBAL_NAME_GAS}` global: {e}" + )) + })?; + + Ok(()) + }, + ); + let func = wasmi::Extern::Func(func); + linker + .define(&module, &name, func) + .map_err(|_| Error::Module)?; + } + } + } + + let instance_pre = linker.instantiate(&mut store, &module).map_err(|e| { + log::error!(target: TARGET, "Error instantiating module: {:?}", e); + Error::Module + })?; + let instance = instance_pre.start(&mut store).map_err(|e| { + log::error!(target: TARGET, "Error starting module: {:?}", e); + Error::Module + })?; Ok(Instance { instance, - defined_host_functions, - _marker: PhantomData::, + _marker: PhantomData, }) } - fn invoke(&mut self, name: &str, args: &[Value], state: &mut T) -> Result { + fn invoke( + &mut self, + mut store: &mut Store, + name: &str, + args: &[Value], + ) -> Result { let args = args.iter().cloned().map(to_wasmi).collect::>(); - let mut externals = GuestExternals { - state, - defined_host_functions: &self.defined_host_functions, - }; - let result = self.instance.invoke_export(name, &args, &mut externals); + let func = self + .instance + .get_func(&store, name) + .ok_or(Error::Execution)?; + + let func_ty = func.ty(&store); + let mut results = + vec![RuntimeValue::ExternRef(wasmi::ExternRef::null()); func_ty.results().len()]; + + func.call(&mut store, &args, &mut results).map_err(|e| { + log::error!(target: TARGET, "invocation error: {e}"); + Error::Execution + })?; - match result { - Ok(None) => Ok(ReturnValue::Unit), - Ok(Some(val)) => Ok(ReturnValue::Value(to_interface(val))), - Err(_err) => Err(Error::Execution), + match results.as_slice() { + [] => Ok(ReturnValue::Unit), + [val] => { + let val = to_interface(val.clone()).ok_or(Error::Execution)?; + Ok(ReturnValue::Value(val)) + } + _ => unreachable!(), } } - fn get_global_val(&self, name: &str) -> Option { - let global = self.instance.export_by_name(name)?.as_global()?.get(); - - Some(to_interface(global)) + fn get_global_val(&self, store: &Store, name: &str) -> Option { + let global = self.instance.get_global(store, name)?; + let global = global.get(store); + to_interface(global) } - fn set_global_val(&self, _name: &str, _value: Value) -> Result<(), crate::GlobalsSetError> { - Err(crate::GlobalsSetError::NotFound) + fn set_global_val( + &self, + mut store: &mut Store, + name: &str, + value: Value, + ) -> Result<(), GlobalsSetError> { + let global = self + .instance + .get_global(&store, name) + .ok_or(GlobalsSetError::NotFound)?; + global + .set(&mut store, to_wasmi(value)) + .map_err(|_| GlobalsSetError::Other)?; + Ok(()) } fn get_instance_ptr(&self) -> HostPointer { @@ -355,32 +432,39 @@ fn to_wasmi(value: Value) -> RuntimeValue { } /// Convert the wasmi value type to the substrate value type. -fn to_interface(value: RuntimeValue) -> Value { +fn to_interface(value: RuntimeValue) -> Option { match value { - RuntimeValue::I32(val) => Value::I32(val), - RuntimeValue::I64(val) => Value::I64(val), - RuntimeValue::F32(val) => Value::F32(val.into()), - RuntimeValue::F64(val) => Value::F64(val.into()), + RuntimeValue::I32(val) => Some(Value::I32(val)), + RuntimeValue::I64(val) => Some(Value::I64(val)), + RuntimeValue::F32(val) => Some(Value::F32(val.into())), + RuntimeValue::F64(val) => Some(Value::F64(val.into())), + RuntimeValue::FuncRef(_) | RuntimeValue::ExternRef(_) => None, } } #[cfg(test)] mod tests { - use super::{EnvironmentDefinitionBuilder, Instance}; - use crate::{Error, HostError, ReturnValue, SandboxEnvironmentBuilder, SandboxInstance, Value}; + use super::{Caller, EnvironmentDefinitionBuilder, Instance}; + use crate::{ + default_executor::Store, AsContextExt, Error, HostError, ReturnValue, + SandboxEnvironmentBuilder, SandboxInstance, SandboxStore, Value, + }; use assert_matches::assert_matches; - use gear_sandbox_env::WasmReturnValue; + use gear_sandbox_env::{WasmReturnValue, GLOBAL_NAME_GAS}; - fn execute_sandboxed(code: &[u8], args: &[Value]) -> Result { + fn execute_sandboxed(code: &[u8], args: &[Value]) -> Result { struct State { counter: u32, } - fn env_assert(_e: &mut State, args: &[Value]) -> Result { - if args.len() != 1 { + fn env_assert( + _c: &mut Caller<'_, State>, + args: &[Value], + ) -> Result { + if args.len() != 2 { return Err(HostError); } - let condition = args[0].as_i32().ok_or(HostError)?; + let condition = args[1].as_i32().ok_or(HostError)?; if condition != 0 { Ok(WasmReturnValue { gas: 0, @@ -390,7 +474,11 @@ mod tests { Err(HostError) } } - fn env_inc_counter(e: &mut State, args: &[Value]) -> Result { + fn env_inc_counter( + e: &mut Caller<'_, State>, + args: &[Value], + ) -> Result { + let e = e.data_mut(); if args.len() != 1 { return Err(HostError); } @@ -403,7 +491,7 @@ mod tests { } /// Function that takes one argument of any type and returns that value. fn env_polymorphic_id( - _e: &mut State, + _c: &mut Caller<'_, State>, args: &[Value], ) -> Result { if args.len() != 1 { @@ -415,25 +503,26 @@ mod tests { }) } - let mut state = State { counter: 0 }; + let state = State { counter: 0 }; let mut env_builder = EnvironmentDefinitionBuilder::new(); env_builder.add_host_func("env", "assert", env_assert); env_builder.add_host_func("env", "inc_counter", env_inc_counter); env_builder.add_host_func("env", "polymorphic_id", env_polymorphic_id); - let mut instance = Instance::new(code, &env_builder, &mut state)?; - let result = instance.invoke("call", args, &mut state); - - result.map_err(|_| HostError) + let mut store = Store::new(state); + let mut instance = Instance::new(&mut store, code, &env_builder)?; + instance.invoke(&mut store, "call", args) } #[test] fn invoke_args() { - let code = wat::parse_str( + let code = wat::parse_str(format!( r#" (module (import "env" "assert" (func $assert (param i32))) + (global (;0;) (mut i64) (i64.const 0x20000)) + (export "{GLOBAL_NAME_GAS}" (global 0)) (func (export "call") (param $x i32) (param $y i64) ;; assert that $x = 0x12345678 @@ -452,22 +541,25 @@ mod tests { ) ) ) - "#, - ) + "# + )) .unwrap(); - let result = execute_sandboxed( + execute_sandboxed( &code, &[Value::I32(0x12345678), Value::I64(0x1234567887654321)], - ); - assert!(result.is_ok()); + ) + .unwrap(); } #[test] fn return_value() { - let code = wat::parse_str( + let code = wat::parse_str(format!( r#" (module + (global (;0;) (mut i64) (i64.const 0x20000)) + (export "{GLOBAL_NAME_GAS}" (global 0)) + (func (export "call") (param $x i32) (result i32) (i32.add (get_local $x) @@ -475,55 +567,20 @@ mod tests { ) ) ) - "#, - ) + "# + )) .unwrap(); let return_val = execute_sandboxed(&code, &[Value::I32(0x1336)]).unwrap(); assert_eq!(return_val, ReturnValue::Value(Value::I32(0x1337))); } - #[test] - fn signatures_dont_matter() { - let code = wat::parse_str( - r#" - (module - (import "env" "polymorphic_id" (func $id_i32 (param i32) (result i32))) - (import "env" "polymorphic_id" (func $id_i64 (param i64) (result i64))) - (import "env" "assert" (func $assert (param i32))) - - (func (export "call") - ;; assert that we can actually call the "same" function with different - ;; signatures. - (call $assert - (i32.eq - (call $id_i32 - (i32.const 0x012345678) - ) - (i32.const 0x012345678) - ) - ) - (call $assert - (i64.eq - (call $id_i64 - (i64.const 0x0123456789abcdef) - ) - (i64.const 0x0123456789abcdef) - ) - ) - ) - ) - "#, - ) - .unwrap(); - - let return_val = execute_sandboxed(&code, &[]).unwrap(); - assert_eq!(return_val, ReturnValue::Unit); - } - #[test] fn cant_return_unmatching_type() { - fn env_returns_i32(_e: &mut (), _args: &[Value]) -> Result { + fn env_returns_i32( + _e: &mut Caller<'_, ()>, + _args: &[Value], + ) -> Result { Ok(WasmReturnValue { gas: 0, inner: ReturnValue::Value(Value::I32(42)), @@ -533,11 +590,13 @@ mod tests { let mut env_builder = EnvironmentDefinitionBuilder::new(); env_builder.add_host_func("env", "returns_i32", env_returns_i32); - let code = wat::parse_str( + let code = wat::parse_str(format!( r#" (module ;; It's actually returns i32, but imported as if it returned i64 (import "env" "returns_i32" (func $returns_i32 (result i64))) + (global (;0;) (mut i64) (i64.const 0x20000)) + (export "{GLOBAL_NAME_GAS}" (global 0)) (func (export "call") (drop @@ -545,14 +604,18 @@ mod tests { ) ) ) - "#, - ) + "# + )) .unwrap(); + let mut store = Store::new(()); // It succeeds since we are able to import functions with types we want. - let mut instance = Instance::new(&code, &env_builder, &mut ()).unwrap(); + let mut instance = Instance::new(&mut store, &code, &env_builder).unwrap(); // But this fails since we imported a function that returns i32 as if it returned i64. - assert_matches!(instance.invoke("call", &[], &mut ()), Err(Error::Execution)); + assert_matches!( + instance.invoke(&mut store, "call", &[]), + Err(Error::Execution) + ); } } diff --git a/sandbox/sandbox/src/host_executor.rs b/sandbox/sandbox/src/host_executor.rs index a73b6b17cc9..0ba488ef61b 100644 --- a/sandbox/sandbox/src/host_executor.rs +++ b/sandbox/sandbox/src/host_executor.rs @@ -20,7 +20,10 @@ use codec::{Decode, Encode}; -use crate::{env, Error, HostFuncType, ReturnValue, Value}; +use crate::{ + env, AsContextExt, Error, GlobalsSetError, HostFuncType, ReturnValue, SandboxStore, Value, +}; +use alloc::string::String; use gear_runtime_interface::sandbox; use gear_sandbox_env::WasmReturnValue; use sp_std::{marker, mem, prelude::*, rc::Rc, slice, vec}; @@ -51,6 +54,34 @@ mod ffi { } } +pub trait AsContext {} + +pub struct Store(T); + +impl SandboxStore for Store { + fn new(state: T) -> Self { + Self(state) + } +} + +impl AsContextExt for Store { + fn data_mut(&mut self) -> &mut T { + &mut self.0 + } +} + +impl AsContext for Store {} + +pub struct Caller<'a, T>(&'a mut T); + +impl AsContextExt for Caller<'_, T> { + fn data_mut(&mut self) -> &mut T { + self.0 + } +} + +impl AsContext for Caller<'_, T> {} + struct MemoryHandle { memory_idx: u32, } @@ -69,8 +100,8 @@ pub struct Memory { handle: Rc, } -impl super::SandboxMemory for Memory { - fn new(initial: u32, maximum: Option) -> Result { +impl super::SandboxMemory for Memory { + fn new(_store: &mut Store, initial: u32, maximum: Option) -> Result { let maximum = if let Some(maximum) = maximum { maximum } else { @@ -85,7 +116,10 @@ impl super::SandboxMemory for Memory { } } - fn get(&self, offset: u32, buf: &mut [u8]) -> Result<(), Error> { + fn read(&self, _ctx: &Context, offset: u32, buf: &mut [u8]) -> Result<(), Error> + where + Context: AsContextExt, + { let result = sandbox::memory_get( self.handle.memory_idx, offset, @@ -99,7 +133,10 @@ impl super::SandboxMemory for Memory { } } - fn set(&self, offset: u32, val: &[u8]) -> Result<(), Error> { + fn write(&self, _ctx: &mut Context, offset: u32, val: &[u8]) -> Result<(), Error> + where + Context: AsContextExt, + { let result = sandbox::memory_set( self.handle.memory_idx, offset, @@ -113,17 +150,26 @@ impl super::SandboxMemory for Memory { } } - fn grow(&self, pages: u32) -> Result { - let size = self.size(); + fn grow(&self, ctx: &mut Context, pages: u32) -> Result + where + Context: AsContextExt, + { + let size = self.size(ctx); sandbox::memory_grow(self.handle.memory_idx, pages); Ok(size) } - fn size(&self) -> u32 { + fn size(&self, _ctx: &Context) -> u32 + where + Context: AsContextExt, + { sandbox::memory_size(self.handle.memory_idx) } - unsafe fn get_buff(&self) -> HostPointer { + unsafe fn get_buff(&self, _ctx: &mut Context) -> HostPointer + where + Context: AsContextExt, + { sandbox::get_buff(self.handle.memory_idx) } } @@ -138,8 +184,8 @@ pub struct EnvironmentDefinitionBuilder { impl EnvironmentDefinitionBuilder { fn add_entry(&mut self, module: N1, field: N2, extern_entity: env::ExternEntity) where - N1: Into>, - N2: Into>, + N1: Into, + N2: Into, { let entry = env::Entry { module_name: module.into(), @@ -163,33 +209,51 @@ impl super::SandboxEnvironmentBuilder for EnvironmentDefinitionBui fn add_host_func(&mut self, module: N1, field: N2, f: HostFuncType) where - N1: Into>, - N2: Into>, + N1: Into, + N2: Into, { - let f = env::ExternEntity::Function(f as u32); + let f = env::ExternEntity::Function(f as usize as u32); self.add_entry(module, field, f); } fn add_memory(&mut self, module: N1, field: N2, mem: Memory) where - N1: Into>, - N2: Into>, + N1: Into, + N2: Into, { // We need to retain memory to keep it alive while the EnvironmentDefinitionBuilder alive. self.retained_memories.push(mem.clone()); - let mem = env::ExternEntity::Memory(mem.handle.memory_idx as u32); + let mem = env::ExternEntity::Memory(mem.handle.memory_idx); self.add_entry(module, field, mem); } } /// Sandboxed instance of a WASM module. pub struct Instance { - instance_idx: u32, + instance_idx: Rc, _retained_memories: Vec, _marker: marker::PhantomData, } +impl Clone for Instance { + fn clone(&self) -> Self { + Self { + instance_idx: self.instance_idx.clone(), + _retained_memories: self._retained_memories.clone(), + _marker: marker::PhantomData, + } + } +} + +impl Drop for Instance { + fn drop(&mut self) { + if let Some(idx) = Rc::get_mut(&mut self.instance_idx) { + sandbox::instance_teardown(*idx); + } + } +} + /// The primary responsibility of this thunk is to deserialize arguments and /// call the original function, specified by the index. extern "C" fn dispatch_thunk( @@ -219,10 +283,11 @@ extern "C" fn dispatch_thunk( // This should be safe since mutable reference to T is passed upon the invocation. let state = &mut *(state as *mut T); + let mut caller = Caller(state); let mut result = Vec::with_capacity(WasmReturnValue::ENCODED_MAX_SIZE); // Pass control flow to the designated function. - f(state, &args).encode_to(&mut result); + f(&mut caller, &args).encode_to(&mut result); // Leak the result vector and return the pointer to return data. let result_ptr = result.as_ptr() as u64; @@ -238,18 +303,19 @@ impl super::SandboxInstance for Instance { type EnvironmentBuilder = EnvironmentDefinitionBuilder; fn new( + store: &mut Store, code: &[u8], env_def_builder: &EnvironmentDefinitionBuilder, - state: &mut T, ) -> Result, Error> { let serialized_env_def: Vec = env_def_builder.env_def.encode(); + // It's very important to instantiate thunk with the right type. let dispatch_thunk = dispatch_thunk::; let result = sandbox::instantiate( - dispatch_thunk as u32, + dispatch_thunk as usize as u32, code, &serialized_env_def, - state as *const T as _, + store.data_mut() as *const T as _, ); let instance_idx = match result { @@ -261,23 +327,28 @@ impl super::SandboxInstance for Instance { // We need to retain memories to keep them alive while the Instance is alive. let retained_memories = env_def_builder.retained_memories.clone(); Ok(Instance { - instance_idx, + instance_idx: Rc::new(instance_idx), _retained_memories: retained_memories, _marker: marker::PhantomData::, }) } - fn invoke(&mut self, name: &str, args: &[Value], state: &mut T) -> Result { + fn invoke( + &mut self, + store: &mut Store, + name: &str, + args: &[Value], + ) -> Result { let serialized_args = args.to_vec().encode(); let mut return_val = vec![0u8; ReturnValue::ENCODED_MAX_SIZE]; let result = sandbox::invoke( - self.instance_idx, + *self.instance_idx, name, &serialized_args, return_val.as_mut_ptr() as _, return_val.len() as u32, - state as *const T as _, + store.data_mut() as *const T as _, ); match result { @@ -291,25 +362,24 @@ impl super::SandboxInstance for Instance { } } - fn get_global_val(&self, name: &str) -> Option { - sandbox::get_global_val(self.instance_idx, name) + fn get_global_val(&self, _store: &Store, name: &str) -> Option { + sandbox::get_global_val(*self.instance_idx, name) } - fn set_global_val(&self, name: &str, value: Value) -> Result<(), super::GlobalsSetError> { - match sandbox::set_global_val(self.instance_idx, name, value) { + fn set_global_val( + &self, + _store: &mut Store, + name: &str, + value: Value, + ) -> Result<(), super::GlobalsSetError> { + match sandbox::set_global_val(*self.instance_idx, name, value) { env::ERROR_GLOBALS_OK => Ok(()), - env::ERROR_GLOBALS_NOT_FOUND => Err(super::GlobalsSetError::NotFound), - _ => Err(super::GlobalsSetError::Other), + env::ERROR_GLOBALS_NOT_FOUND => Err(GlobalsSetError::NotFound), + _ => Err(GlobalsSetError::Other), } } fn get_instance_ptr(&self) -> HostPointer { - sandbox::get_instance_ptr(self.instance_idx) - } -} - -impl Drop for Instance { - fn drop(&mut self) { - sandbox::instance_teardown(self.instance_idx); + sandbox::get_instance_ptr(*self.instance_idx) } } diff --git a/sandbox/sandbox/src/lib.rs b/sandbox/sandbox/src/lib.rs index 446a53bc089..aaf0b9e88b8 100644 --- a/sandbox/sandbox/src/lib.rs +++ b/sandbox/sandbox/src/lib.rs @@ -41,15 +41,17 @@ extern crate alloc; +#[cfg(feature = "std")] pub mod embedded_executor; pub use gear_sandbox_env as env; #[cfg(not(feature = "std"))] pub mod host_executor; +use alloc::string::String; use sp_core::RuntimeDebug; use sp_std::prelude::*; - use sp_wasm_interface::HostPointer; + pub use sp_wasm_interface::{IntoValue, ReturnValue, Value}; #[cfg(feature = "std")] @@ -89,14 +91,27 @@ impl From for HostError { /// supervisor in [`EnvironmentDefinitionBuilder`]. /// /// [`EnvironmentDefinitionBuilder`]: struct.EnvironmentDefinitionBuilder.html -pub type HostFuncType = fn(&mut T, &[Value]) -> Result; +pub type HostFuncType = + fn(&mut default_executor::Caller<'_, T>, &[Value]) -> Result; + +/// Sandbox store. +pub trait SandboxStore: AsContextExt { + /// Create a new sandbox store. + fn new(state: T) -> Self; +} + +/// Sandbox context. +pub trait AsContextExt: default_executor::AsContext { + /// Return mutable reference to state. + fn data_mut(&mut self) -> &mut T; +} /// Reference to a sandboxed linear memory, that /// will be used by the guest module. /// /// The memory can't be directly accessed by supervisor, but only -/// through designated functions [`get`](SandboxMemory::get) and [`set`](SandboxMemory::set). -pub trait SandboxMemory: Sized + Clone { +/// through designated functions [`get`](SandboxMemory::read) and [`set`](SandboxMemory::write). +pub trait SandboxMemory: Sized + Clone { /// Construct a new linear memory instance. /// /// The memory allocated with initial number of pages specified by `initial`. @@ -107,32 +122,46 @@ pub trait SandboxMemory: Sized + Clone { /// `maximum`. If not specified, this memory instance would be able to allocate up to 4GiB. /// /// Allocated memory is always zeroed. - fn new(initial: u32, maximum: Option) -> Result; + fn new( + store: &mut default_executor::Store, + initial: u32, + maximum: Option, + ) -> Result; /// Read a memory area at the address `ptr` with the size of the provided slice `buf`. /// /// Returns `Err` if the range is out-of-bounds. - fn get(&self, ptr: u32, buf: &mut [u8]) -> Result<(), Error>; + fn read(&self, ctx: &Context, ptr: u32, buf: &mut [u8]) -> Result<(), Error> + where + Context: AsContextExt; /// Write a memory area at the address `ptr` with contents of the provided slice `buf`. /// /// Returns `Err` if the range is out-of-bounds. - fn set(&self, ptr: u32, value: &[u8]) -> Result<(), Error>; + fn write(&self, ctx: &mut Context, ptr: u32, value: &[u8]) -> Result<(), Error> + where + Context: AsContextExt; /// Grow memory with provided number of pages. /// /// Returns `Err` if attempted to allocate more memory than permitted by the limit. - fn grow(&self, pages: u32) -> Result; + fn grow(&self, ctx: &mut Context, pages: u32) -> Result + where + Context: AsContextExt; /// Returns current memory size. /// /// Maximum memory size cannot exceed 65536 pages or 4GiB. - fn size(&self) -> u32; + fn size(&self, ctx: &Context) -> u32 + where + Context: AsContextExt; /// Returns pointer to the begin of wasm mem buffer /// # Safety /// Pointer is intended to use by `mprotect` function. - unsafe fn get_buff(&self) -> HostPointer; + unsafe fn get_buff(&self, ctx: &mut Context) -> HostPointer + where + Context: AsContextExt; } /// Struct that can be used for defining an environment for a sandboxed module. @@ -151,14 +180,14 @@ pub trait SandboxEnvironmentBuilder: Sized { /// the user code to check or constrain the types of signatures. fn add_host_func(&mut self, module: N1, field: N2, f: HostFuncType) where - N1: Into>, - N2: Into>; + N1: Into, + N2: Into; /// Register a memory in this environment definition. fn add_memory(&mut self, module: N1, field: N2, mem: Memory) where - N1: Into>, - N2: Into>; + N1: Into, + N2: Into; } /// Error that can occur while using this crate. @@ -176,7 +205,7 @@ pub enum GlobalsSetError { /// This instance can be used for invoking exported functions. pub trait SandboxInstance: Sized { /// The memory type used for this sandbox. - type Memory: SandboxMemory; + type Memory: SandboxMemory; /// The environment builder used to construct this sandbox. type EnvironmentBuilder: SandboxEnvironmentBuilder; @@ -190,9 +219,9 @@ pub trait SandboxInstance: Sized { /// /// [`EnvironmentDefinitionBuilder`]: struct.EnvironmentDefinitionBuilder.html fn new( + store: &mut default_executor::Store, code: &[u8], env_def_builder: &Self::EnvironmentBuilder, - state: &mut State, ) -> Result; /// Invoke an exported function with the given name. @@ -208,18 +237,23 @@ pub trait SandboxInstance: Sized { /// - Trap occurred at the execution time. fn invoke( &mut self, + store: &mut default_executor::Store, name: &str, args: &[Value], - state: &mut State, ) -> Result; /// Get the value from a global with the given `name`. /// /// Returns `Some(_)` if the global could be found. - fn get_global_val(&self, name: &str) -> Option; + fn get_global_val(&self, store: &default_executor::Store, name: &str) -> Option; /// Set the value of a global with the given `name`. - fn set_global_val(&self, name: &str, value: Value) -> Result<(), GlobalsSetError>; + fn set_global_val( + &self, + store: &mut default_executor::Store, + name: &str, + value: Value, + ) -> Result<(), GlobalsSetError>; /// Get raw pointer to the executor host sandbox instance. fn get_instance_ptr(&self) -> HostPointer; From d3c292270040147b0c3ad7dc33ed8054ec413547 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Mon, 21 Aug 2023 22:50:43 +0400 Subject: [PATCH 069/165] fix(backend): Remove strings from environment variant (#3124) --- core-processor/src/common.rs | 22 +++++++++------------- core-processor/src/executor.rs | 5 +++-- pallets/gear/src/tests.rs | 13 +++---------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/core-processor/src/common.rs b/core-processor/src/common.rs index dc9e100d129..65d7df3f45f 100644 --- a/core-processor/src/common.rs +++ b/core-processor/src/common.rs @@ -27,9 +27,7 @@ use alloc::{ string::String, vec::Vec, }; -use gear_backend_common::{ - LimitedStr, SystemReservationContext, SystemTerminationReason, TrapExplanation, -}; +use gear_backend_common::{SystemReservationContext, SystemTerminationReason, TrapExplanation}; use gear_core::{ gas::{GasAllowanceCounter, GasAmount, GasCounter}, ids::{CodeId, MessageId, ProgramId, ReservationId}, @@ -459,8 +457,8 @@ pub enum ActorExecutionErrorReplyReason { #[display(fmt = "{_0}")] PrepareMemory(ActorPrepareMemoryError), /// Backend error - #[display(fmt = "Environment error: {_0}")] - Environment(LimitedStr<'static>), + #[display(fmt = "Environment error: ")] + Environment, /// Trap explanation #[display(fmt = "{_0}")] Trap(TrapExplanation), @@ -470,16 +468,14 @@ impl ActorExecutionErrorReplyReason { /// Convert self into [`gear_core_errors::SimpleExecutionError`]. pub fn as_simple(&self) -> SimpleExecutionError { match self { - ActorExecutionErrorReplyReason::PreChargeGasLimitExceeded(_) => { - SimpleExecutionError::RanOutOfGas - } - ActorExecutionErrorReplyReason::PrepareMemory(_) => SimpleExecutionError::Unsupported, - ActorExecutionErrorReplyReason::Environment(_) => SimpleExecutionError::Unsupported, - ActorExecutionErrorReplyReason::Trap(expl) => match expl { + Self::PreChargeGasLimitExceeded(_) => SimpleExecutionError::RanOutOfGas, + Self::PrepareMemory(_) | Self::Environment => SimpleExecutionError::Unsupported, + Self::Trap(expl) => match expl { TrapExplanation::GasLimitExceeded => SimpleExecutionError::RanOutOfGas, - TrapExplanation::ForbiddenFunction => SimpleExecutionError::BackendError, + TrapExplanation::ForbiddenFunction | TrapExplanation::UnrecoverableExt(_) => { + SimpleExecutionError::BackendError + } TrapExplanation::ProgramAllocOutOfBounds => SimpleExecutionError::MemoryOverflow, - TrapExplanation::UnrecoverableExt(_) => SimpleExecutionError::BackendError, TrapExplanation::Panic(_) => SimpleExecutionError::UserspacePanic, TrapExplanation::Unknown => SimpleExecutionError::UnreachableInstruction, }, diff --git a/core-processor/src/executor.rs b/core-processor/src/executor.rs index e1db391f813..13942145ff9 100644 --- a/core-processor/src/executor.rs +++ b/core-processor/src/executor.rs @@ -389,10 +389,11 @@ where return Err(ExecutionError::System(e.into())); } Err(EnvironmentError::Actor(gas_amount, err)) => { + log::trace!("ActorExecutionErrorReplyReason::Environment({err}) occurred"); return Err(ExecutionError::Actor(ActorExecutionError { gas_amount, - reason: ActorExecutionErrorReplyReason::Environment(err.into()), - })) + reason: ActorExecutionErrorReplyReason::Environment, + })); } }; diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 8b98ec8d18b..9ad53ab2662 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -63,8 +63,7 @@ use frame_support::{ }; use frame_system::pallet_prelude::BlockNumberFor; use gear_backend_common::{ - LimitedStr, TrapExplanation, UnrecoverableExecutionError, UnrecoverableExtError, - UnrecoverableWaitError, + TrapExplanation, UnrecoverableExecutionError, UnrecoverableExtError, UnrecoverableWaitError, }; use gear_core::{ code::{self, Code}, @@ -12656,10 +12655,7 @@ fn module_instantiation_error() { assert!(Gear::is_terminated(prog_id)); let err = get_last_event_error(mid); - assert!(err.starts_with( - &ActorExecutionErrorReplyReason::Environment(LimitedStr::from_small_str("")) - .to_string() - )); + assert!(err.starts_with(&ActorExecutionErrorReplyReason::Environment.to_string())); }); } @@ -12692,10 +12688,7 @@ fn wrong_entry_type() { assert!(Gear::is_terminated(pid)); let err = get_last_event_error(mid); - assert!(err.starts_with( - &ActorExecutionErrorReplyReason::Environment(LimitedStr::from_small_str("")) - .to_string() - )); + assert!(err.starts_with(&ActorExecutionErrorReplyReason::Environment.to_string())); }); } From 84647fe473acc0e4c4db6ec4398abe5e34797134 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Tue, 22 Aug 2023 00:29:05 +0400 Subject: [PATCH 070/165] ci(typos): introduce typo checks (#3121) --- .github/workflows/typos.yml | 20 ++++ _typos.toml | 9 ++ ansible/README.md | 4 +- core-backend/common/src/memory.rs | 2 +- core/src/reservation.rs | 2 +- docker/Dockerfile | 2 +- docker/Vara-Dockerfile | 2 +- docker/runtime-fuzzer/Dockerfile | 2 +- docker/runtime-fuzzer/scripts/fuzzer.sh | 4 +- examples/distributor/src/lib.rs | 6 +- examples/node/src/lib.rs | 2 +- examples/wat/spec/large_scheduled.wat | 2 +- gcli/README.md | 4 +- gcli/res/pair.json | 10 +- gcli/src/cmd/program.rs | 6 +- gcli/src/lib.rs | 4 +- gclient/src/api/error.rs | 2 +- gclient/src/api/listener/iterator.rs | 2 +- gmeta/codegen/src/lib.rs | 2 +- gmeta/src/lib.rs | 2 +- gsdk/build.rs | 2 +- gsdk/codegen/src/lib.rs | 6 +- gsdk/codegen/src/storage.rs | 4 +- gsdk/src/metadata/generated.rs | 2 +- gstd/src/async_runtime/locks.rs | 2 +- lazy-pages/src/common.rs | 2 +- lazy-pages/src/process.rs | 4 +- node/authorship/src/authorship.rs | 4 +- node/service/src/lib.rs | 2 +- pallets/airdrop/src/lib.rs | 2 +- pallets/gear-messenger/src/lib.rs | 4 +- pallets/gear-voucher/README.md | 2 +- pallets/gear/src/queue.rs | 2 +- pallets/staking-rewards/src/mock.rs | 2 +- pallets/staking-rewards/src/tests.rs | 2 +- runtime/gear/src/constants.rs | 2 +- runtime/vara/src/constants.rs | 2 +- sandbox/env/src/lib.rs | 2 +- sandbox/host/src/error.rs | 2 +- sandbox/host/src/sandbox.rs | 2 +- sandbox/host/src/sandbox/wasmer_backend.rs | 10 +- scripts/check-spec.sh | 2 +- utils/gear-replay-cli/README.md | 107 ++++++++++----------- utils/gear-replay-cli/src/main.rs | 2 +- utils/node-loader/CHANGELOG.md | 4 +- utils/node-loader/src/batch_pool.rs | 20 ++-- utils/node-loader/src/main.rs | 2 +- utils/wasm-builder/README.md | 2 +- utils/wasm-builder/src/crate_info.rs | 2 +- utils/wasm-gen/src/config.rs | 2 +- utils/wasm-gen/src/generator/syscalls.rs | 2 +- utils/wasm-instrument/src/syscalls.rs | 2 +- utils/wasm-proc/README.md | 2 +- utils/wasm-proc/src/main.rs | 2 +- 54 files changed, 162 insertions(+), 140 deletions(-) create mode 100644 .github/workflows/typos.yml create mode 100644 _typos.toml diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 00000000000..6d601654747 --- /dev/null +++ b/.github/workflows/typos.yml @@ -0,0 +1,20 @@ +name: Typos + +on: + pull_request: + branches: [master, vara-stage-1, vara-stage-2, vara-stage-3] + +env: + CARGO_INCREMENTAL: 0 + CARGO_TERM_COLOR: always + RUST_BACKTRACE: short + TERM: xterm-256color + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: typos-action + uses: crate-ci/typos@master diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 00000000000..740fc8625f6 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,9 @@ +[default] +extend-ignore-re = [ + "\\w{48,49}", + "\"hel\"" +] + +[default.extend-words] +# typo in sp-state-machine, won't fix here for now. +overlayed = "overlayed" diff --git a/ansible/README.md b/ansible/README.md index b85dcb801c7..04d37b9dc13 100644 --- a/ansible/README.md +++ b/ansible/README.md @@ -4,7 +4,7 @@ ### Generate custom chain spec -The compiled runtime code as well as the genesis block configuration (the initial network state) should be placed in a "chain spec" JSON file that would later be supplied as a command line argumnet to the `gear` command: +The compiled runtime code as well as the genesis block configuration (the initial network state) should be placed in a "chain spec" JSON file that would later be supplied as a command line argument to the `gear` command: ```bash ./target/release/gear \ --base-path /tmp/data \ @@ -14,7 +14,7 @@ The compiled runtime code as well as the genesis block configuration (the initia A custom chain spec can be created in a few simple steps: -1. Build the node as per ususal. +1. Build the node as per usual. ```bash cargo build --profile production ``` diff --git a/core-backend/common/src/memory.rs b/core-backend/common/src/memory.rs index 5246691992e..2224888292c 100644 --- a/core-backend/common/src/memory.rs +++ b/core-backend/common/src/memory.rs @@ -371,7 +371,7 @@ fn read_memory_as(memory: &impl Memory, ptr: u32) -> Result &'static Mutex> { - unsafe { &mut STATE.as_mut().expect("STATE UNITIALIZED!").nodes } + unsafe { &mut STATE.as_mut().expect("STATE UNINITIALIZED!").nodes } } fn amount() -> &'static mut u64 { - unsafe { &mut STATE.as_mut().expect("STATE UNITIALIZED!").amount } + unsafe { &mut STATE.as_mut().expect("STATE UNINITIALIZED!").amount } } async fn handle_request() { @@ -191,7 +191,7 @@ mod wasm { } Err(_) => { // skipping erroneous sub-nodes! - debug!("Skipping errorneous node"); + debug!("Skipping erroneous node"); 0 } } diff --git a/examples/node/src/lib.rs b/examples/node/src/lib.rs index 04daeef71bc..ee8ff58f89e 100644 --- a/examples/node/src/lib.rs +++ b/examples/node/src/lib.rs @@ -120,7 +120,7 @@ fn process(request: Request) -> Reply { return Reply::Success; } TransitionState::Ready => { - // this means we successfully commited and we can + // this means we successfully committed and we can // drop the transition returning success debug!("Returning final commit signal"); diff --git a/examples/wat/spec/large_scheduled.wat b/examples/wat/spec/large_scheduled.wat index ece313acd03..81008f20b59 100644 --- a/examples/wat/spec/large_scheduled.wat +++ b/examples/wat/spec/large_scheduled.wat @@ -8,7 +8,7 @@ ;; length of each push supposed to be a half of a wasm page (32 kb) ;; delay for sending will be 100 (func $init - ;; for example pushing 3 fullfilled wasm pages + ;; for example pushing 3 fulfilled wasm pages (call $reply_push (i32.const 0) (i32.const 0x8000) (i32.const 0)) (call $reply_push (i32.const 0) (i32.const 0x8000) (i32.const 0)) (call $reply_push (i32.const 0) (i32.const 0x8000) (i32.const 0)) diff --git a/gcli/README.md b/gcli/README.md index 843d7114f63..759ead02ef9 100644 --- a/gcli/README.md +++ b/gcli/README.md @@ -87,12 +87,12 @@ Successfully logged in as 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY! ```sh $ gear upload hello-world/target/wasm32-unknown-unknown/release/hello_world.wasm -[INFO ] Submited extrinsic Gear::upload_code +[INFO ] Submitted extrinsic Gear::upload_code [INFO ] Status: Ready [INFO ] Status: Broadcast( ["12D3KooWQbJXFeRDJqmLT6jqahsJpwKGL5xEJJ6F3tevR1R85Upz", "12D3KooWFwZEE7cVz7fPTUrekv2Xfv2sR5HMetpadw4W9fZnEBr5", "12D3KooWNmeoxqMTSc3CzeA5SLTQ6xYQo4yz3Az1zjnAqrhpmBSH", "12D3KooWLFN7AceaViuVDakKghwLVo9i91Bi8DLyf1BGg6ftVGnG", "12D3KooWJ9EASqU3T89z1EBYMnvfTh5WK4Rgw3RMensrx5STRvXR", "12D3KooWDuzvhmTAebZXGJG8SCurHkn9x6mmpiTSQygGoCvXmYmU", "12D3KooWH7QBPHh5Byc2ZBjGSiqBbGzBAr5E8mqLWueyPXQJrxWB", "12D3KooWRw1Yfdo86zpgN9TTLJ6J53iAM1y1PW9ogKHsTHvBPDg9", "12D3KooWJ15sMWcCgmSLBAfRD5TZgKoCCZ1xDzPRGzbR2YC5zKqS", "12D3KooWEMDPU47VnnZPLEMXeFJkphaG8kRdn9SuTqoJJEhrwC2w", "12D3KooWSfMsGDWG6hvTgfLoFETZrnxNC649bQwSa9FxTAPw4Cmy", "12D3KooWK7fw8MdENES5jAb8kjLw4b3eGMxuWBPR52v15FRkmYF3", "12D3KooWLP3AxJf1VfVJzbzcrHAkipXXa9bSvPcE1TowuRQZE8bz", "12D3KooWSf2d69w7RYKtj9mgYpLDs3rqLAz9GHNSHHoCQDLUjeiP", "12D3KooWSKMmTordwL3t6SkQaKXuXt1aYC2QZAXNyt8DxjpgFXYq", "12D3KooWEsvboSEFhf5utCZJ4gfUjb7S5i9Qec1TXB2DuYPJZVzB", "12D3KooWRf7vAr79yAyDxGvYAdSqhh2EoeWe35Lx4QH4N6XMv2gH", "12D3KooWPuaSwvwq2EGdasjJruUzR1wwTk1tDdVBZauKwG8ZPFi1", "12D3KooWHSepUMWdNVgKPhdquR12AzSZrkHwUsfXvVfFMPGXpyH5", "12D3KooWDC3qNpRz5LdSfPWi3XWfc7kG5GHyEDNR2NcgJMedfu5v", "12D3KooWRQ8oUwhrW84UuVpQNZ2QxS2kg3SyhLwVkwHHk9vJgf5q", "12D3KooWHZaCXaMgavJYoH925jiLrLhsbPpU14tt6M7ypenDyfPc", "12D3KooWAd4GWfAqNTqoqTNnjsKqJHWNRezgcHi742eGYKDdYsfC", "12D3KooWFWc6NFCiuTxd9iKq9mi1n3G7nBEZ5yDkzzHjkGBSceje", "12D3KooWQ8yjECbzLThEwzcTQ3gtVgZbb1XPBrPyHnRkmLJRGfEW", "12D3KooWFsZdJERxRrc5afrFDxvts4bDxSHHDgQxh8bTm4Kq9PV7", "12D3KooWGpxgFFTXij8gXzx6YgExaVczUN2fuohccrkA11tGFzDu", "12D3KooWND9qfwCVtfB17y9fcThBKoWvCSpXrCQCs6XsWvHE5om2", "12D3KooWLoCosNXv1HESuU76r7xmp5UU4pdCncnZXB1hYvcbCYgX", "12D3KooWEga7tssCYmywnRU492ANXV4vGYqX5AVJrrAAKQ1zhhGN", "12D3KooWDP1pb16iGikYc8fkkL8ZYmzPqsrVRzQHHBDKxjRpUMNA", "12D3KooWG26t3Z1NfeAPNWdwrdWYntSUj69LzHcnBdV4PcQMEuHA", "12D3KooWS5DUgYPSQVrexXbPksR4cVsexFhLXzXFgsY47ZPeFHd9", "12D3KooWBWFtZqigVTC8W2GRMwLeuTK2o4hDC4XHVPyNV6hW1T1D", "12D3KooWDCboxcE7VAB3v3UJf1hrNZiswyk5Eg1u2kaiSs4v6Sbi", "12D3KooWNx1mbmwKXSPS8vuHkyVrQrZnwp4HGjLczPxFCpAyRhNS", "12D3KooWJ3KhEHCm4roQw2LAUGu28fXJf5QqQHhG6EaACw6RCUjr", "12D3KooWFnr5yyEcNAfdjJjfuBAMaZ2iz3GLyFrJAs5AiRJ74vWS", "12D3KooWMNeo7UgreqFxQ6BstVgZrNAZMVyKt9EWnC6AD9J2M1rT", "12D3KooWEVvqVD2mrLfmgeX1EXZ2caFXXEWWEs4Taa4mWzFUoF34", "12D3KooWMadAihMmvZmGt1HpxGAqqjb7Q2q96VVev6rGA1GLuqjv", "12D3KooWARM6duzRRd64fMJZJY3VqWekeG1rmJqxxjNLRYaQVPRt", "12D3KooWSqCyNpmVwaAxS1mMms2GQvUcPzPdoWB2XjiWpXvGW3Jf", "12D3KooWH22kTRSvhRnMUtu7Eg8d96Ma68jzRKV7vtxVMwB96kvS", "12D3KooWN1LBk84vnJEsQ33WsPRvpSzfrNMUZ2iLhTkUYjsSfwR5", "12D3KooWMxtE2fWGZZsZjfjoRN5aH6ecSKj8YfTkufi2vtywoKLS", "12D3KooWGMpAqtwpGR4tcQ3tc2ZThkTUN2YYcgxQsuSbfdQ4h3E4", "12D3KooWSyBLw12Z8rHRx2NSAfmb3cpAP6nJ2qK5FkdEC38zNVKk", "12D3KooWH7sqE4cp9wyLt5Z7xzuqA2imNGMeUHnu2gPJ4hGnJqJv", "12D3KooWK896roWsGutzksP9cZc3oypVPjRB1o83uHzjxM72V7zb"] ) [INFO ] Status: InBlock( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 ) [INFO ] Status: Finalized( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 ) -[INFO ] Successfully submited call Gear::upload_code 0x2c54…e9d9 at 0x4409…fa04! +[INFO ] Successfully submitted call Gear::upload_code 0x2c54…e9d9 at 0x4409…fa04! [INFO ] Balance spent: 3724868714 ``` diff --git a/gcli/res/pair.json b/gcli/res/pair.json index ec59954941d..3e2f3b2e4bf 100644 --- a/gcli/res/pair.json +++ b/gcli/res/pair.json @@ -1,14 +1,8 @@ { "encoded": "X/sAaS3pNejnqvbHk0lne8tcXXmTu2gPQgXvtbf3azgAgAAAAQAAAAgAAABxGGfnP+9PCbP7Gp0+7jxxl8twTthzIq4pLfC0m6NvA8hk557A4dkDapszVKhlyDhTvnQQE2WwhqzkfDwvq0XtFl9PDW6ShvVM/lSVLkZTF6QGnTzRZ2dwT7+X5v+gjFIJftI5z3vLFg7NM+NXy7kxU039iooVTxYDqzCnMSjXMBtnY2cqNedlGUcrbDGE0lNdWqu3MWT9J27kmysC", "encoding": { - "content": [ - "pkcs8", - "sr25519" - ], - "type": [ - "scrypt", - "xsalsa20-poly1305" - ], + "content": ["pkcs8", "sr25519"], + "type": ["scrypt", "xsalsa20-poly1305"], "version": "3" }, "address": "5Hax9tpSjfiX1nYrqhFf8F3sLiaa2ZfPv2VeDQzPBLzKNjRq", diff --git a/gcli/src/cmd/program.rs b/gcli/src/cmd/program.rs index 43cce66265f..e57de57616b 100644 --- a/gcli/src/cmd/program.rs +++ b/gcli/src/cmd/program.rs @@ -50,7 +50,7 @@ pub enum Program { /// The path of "*.meta.wasm". #[arg(short, long)] wasm: Option>, - /// Method arugments (hex encoding). + /// Method arguments (hex encoding). #[arg(short, long)] args: Option>, /// The block hash for reading state. @@ -112,11 +112,11 @@ impl Program { .ok_or_else(|| anyhow::anyhow!("Invalid file extension"))?; let data = fs::read(path)?; - // parse fom hex if end with `txt`. + // parse from hex if end with `txt`. let meta = if ext == "txt" { Meta::decode_hex(&data)? } else if ext == "wasm" { - // parse fom wasm if end with `wasm`. + // parse from wasm if end with `wasm`. Meta::decode_wasm(&data)? } else { return Err(anyhow::anyhow!(format!("Unsupported file extension {:?}", ext)).into()); diff --git a/gcli/src/lib.rs b/gcli/src/lib.rs index 52a048eb281..0617081f062 100644 --- a/gcli/src/lib.rs +++ b/gcli/src/lib.rs @@ -109,12 +109,12 @@ //! //! ```sh //! $ gear upload hello-world/target/wasm32-unknown-unknown/release/hello_world.wasm -//! [INFO ] Submited extrinsic Gear::upload_code +//! [INFO ] Submitted extrinsic Gear::upload_code //! [INFO ] Status: Ready //! [INFO ] Status: Broadcast( ["12D3KooWQbJXFeRDJqmLT6jqahsJpwKGL5xEJJ6F3tevR1R85Upz", "12D3KooWFwZEE7cVz7fPTUrekv2Xfv2sR5HMetpadw4W9fZnEBr5", "12D3KooWNmeoxqMTSc3CzeA5SLTQ6xYQo4yz3Az1zjnAqrhpmBSH", "12D3KooWLFN7AceaViuVDakKghwLVo9i91Bi8DLyf1BGg6ftVGnG", "12D3KooWJ9EASqU3T89z1EBYMnvfTh5WK4Rgw3RMensrx5STRvXR", "12D3KooWDuzvhmTAebZXGJG8SCurHkn9x6mmpiTSQygGoCvXmYmU", "12D3KooWH7QBPHh5Byc2ZBjGSiqBbGzBAr5E8mqLWueyPXQJrxWB", "12D3KooWRw1Yfdo86zpgN9TTLJ6J53iAM1y1PW9ogKHsTHvBPDg9", "12D3KooWJ15sMWcCgmSLBAfRD5TZgKoCCZ1xDzPRGzbR2YC5zKqS", "12D3KooWEMDPU47VnnZPLEMXeFJkphaG8kRdn9SuTqoJJEhrwC2w", "12D3KooWSfMsGDWG6hvTgfLoFETZrnxNC649bQwSa9FxTAPw4Cmy", "12D3KooWK7fw8MdENES5jAb8kjLw4b3eGMxuWBPR52v15FRkmYF3", "12D3KooWLP3AxJf1VfVJzbzcrHAkipXXa9bSvPcE1TowuRQZE8bz", "12D3KooWSf2d69w7RYKtj9mgYpLDs3rqLAz9GHNSHHoCQDLUjeiP", "12D3KooWSKMmTordwL3t6SkQaKXuXt1aYC2QZAXNyt8DxjpgFXYq", "12D3KooWEsvboSEFhf5utCZJ4gfUjb7S5i9Qec1TXB2DuYPJZVzB", "12D3KooWRf7vAr79yAyDxGvYAdSqhh2EoeWe35Lx4QH4N6XMv2gH", "12D3KooWPuaSwvwq2EGdasjJruUzR1wwTk1tDdVBZauKwG8ZPFi1", "12D3KooWHSepUMWdNVgKPhdquR12AzSZrkHwUsfXvVfFMPGXpyH5", "12D3KooWDC3qNpRz5LdSfPWi3XWfc7kG5GHyEDNR2NcgJMedfu5v", "12D3KooWRQ8oUwhrW84UuVpQNZ2QxS2kg3SyhLwVkwHHk9vJgf5q", "12D3KooWHZaCXaMgavJYoH925jiLrLhsbPpU14tt6M7ypenDyfPc", "12D3KooWAd4GWfAqNTqoqTNnjsKqJHWNRezgcHi742eGYKDdYsfC", "12D3KooWFWc6NFCiuTxd9iKq9mi1n3G7nBEZ5yDkzzHjkGBSceje", "12D3KooWQ8yjECbzLThEwzcTQ3gtVgZbb1XPBrPyHnRkmLJRGfEW", "12D3KooWFsZdJERxRrc5afrFDxvts4bDxSHHDgQxh8bTm4Kq9PV7", "12D3KooWGpxgFFTXij8gXzx6YgExaVczUN2fuohccrkA11tGFzDu", "12D3KooWND9qfwCVtfB17y9fcThBKoWvCSpXrCQCs6XsWvHE5om2", "12D3KooWLoCosNXv1HESuU76r7xmp5UU4pdCncnZXB1hYvcbCYgX", "12D3KooWEga7tssCYmywnRU492ANXV4vGYqX5AVJrrAAKQ1zhhGN", "12D3KooWDP1pb16iGikYc8fkkL8ZYmzPqsrVRzQHHBDKxjRpUMNA", "12D3KooWG26t3Z1NfeAPNWdwrdWYntSUj69LzHcnBdV4PcQMEuHA", "12D3KooWS5DUgYPSQVrexXbPksR4cVsexFhLXzXFgsY47ZPeFHd9", "12D3KooWBWFtZqigVTC8W2GRMwLeuTK2o4hDC4XHVPyNV6hW1T1D", "12D3KooWDCboxcE7VAB3v3UJf1hrNZiswyk5Eg1u2kaiSs4v6Sbi", "12D3KooWNx1mbmwKXSPS8vuHkyVrQrZnwp4HGjLczPxFCpAyRhNS", "12D3KooWJ3KhEHCm4roQw2LAUGu28fXJf5QqQHhG6EaACw6RCUjr", "12D3KooWFnr5yyEcNAfdjJjfuBAMaZ2iz3GLyFrJAs5AiRJ74vWS", "12D3KooWMNeo7UgreqFxQ6BstVgZrNAZMVyKt9EWnC6AD9J2M1rT", "12D3KooWEVvqVD2mrLfmgeX1EXZ2caFXXEWWEs4Taa4mWzFUoF34", "12D3KooWMadAihMmvZmGt1HpxGAqqjb7Q2q96VVev6rGA1GLuqjv", "12D3KooWARM6duzRRd64fMJZJY3VqWekeG1rmJqxxjNLRYaQVPRt", "12D3KooWSqCyNpmVwaAxS1mMms2GQvUcPzPdoWB2XjiWpXvGW3Jf", "12D3KooWH22kTRSvhRnMUtu7Eg8d96Ma68jzRKV7vtxVMwB96kvS", "12D3KooWN1LBk84vnJEsQ33WsPRvpSzfrNMUZ2iLhTkUYjsSfwR5", "12D3KooWMxtE2fWGZZsZjfjoRN5aH6ecSKj8YfTkufi2vtywoKLS", "12D3KooWGMpAqtwpGR4tcQ3tc2ZThkTUN2YYcgxQsuSbfdQ4h3E4", "12D3KooWSyBLw12Z8rHRx2NSAfmb3cpAP6nJ2qK5FkdEC38zNVKk", "12D3KooWH7sqE4cp9wyLt5Z7xzuqA2imNGMeUHnu2gPJ4hGnJqJv", "12D3KooWK896roWsGutzksP9cZc3oypVPjRB1o83uHzjxM72V7zb"] ) //! [INFO ] Status: InBlock( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 ) //! [INFO ] Status: Finalized( block_hash: 0x4409…fa04, extrinsic_hash: 0x2c54…e9d9 ) -//! [INFO ] Successfully submited call Gear::upload_code 0x2c54…e9d9 at 0x4409…fa04! +//! [INFO ] Successfully submitted call Gear::upload_code 0x2c54…e9d9 at 0x4409…fa04! //! [INFO ] Balance spent: 3724868714 //! ``` //! diff --git a/gclient/src/api/error.rs b/gclient/src/api/error.rs index 618b7057ecf..e174aac0437 100644 --- a/gclient/src/api/error.rs +++ b/gclient/src/api/error.rs @@ -86,7 +86,7 @@ pub enum Error { /// Occurs when being migrated program already exists in destination node. #[error("Program {0} already exists")] ProgramAlreadyExists(String), - /// Occurs when node spawining failed. + /// Occurs when node spawning failed. #[error(transparent)] Node(#[from] NodeError), /// Occurs when parsing websocket domain failed. diff --git a/gclient/src/api/listener/iterator.rs b/gclient/src/api/listener/iterator.rs index 8e42252fc75..4e3206171f6 100644 --- a/gclient/src/api/listener/iterator.rs +++ b/gclient/src/api/listener/iterator.rs @@ -107,7 +107,7 @@ impl EventListener { Err(Self::not_waited()) } - /// Reads the next event from the stream and returns the repsective block + /// Reads the next event from the stream and returns the respective block /// hash. pub async fn next_block_hash(&mut self) -> Result { Ok(self diff --git a/gmeta/codegen/src/lib.rs b/gmeta/codegen/src/lib.rs index e971c8616de..d1e5f40e06e 100644 --- a/gmeta/codegen/src/lib.rs +++ b/gmeta/codegen/src/lib.rs @@ -158,7 +158,7 @@ fn validate_if_has_no_attributes( /// /// **Important note**: although metafunctions can take more than 1 additional /// arguments, on the metaWASM binary level, they must be passed as one. So if -/// the amount of additinal arguments is 0 or 1, nothing needs to be changed, +/// the amount of additional arguments is 0 or 1, nothing needs to be changed, /// but if more - they all must be placed inside a tuple in the same order as in /// their function's signature. /// diff --git a/gmeta/src/lib.rs b/gmeta/src/lib.rs index d90a08a4256..369e8baa2fc 100644 --- a/gmeta/src/lib.rs +++ b/gmeta/src/lib.rs @@ -447,7 +447,7 @@ pub trait Metadata { type Handle: Types; /// Reply message type. /// - /// Describes incoming type for the `hanle_reply()` function. + /// Describes incoming type for the `handle_reply()` function. type Reply: Type; /// Message types for miscellaneous purposes. /// diff --git a/gsdk/build.rs b/gsdk/build.rs index 07045dcc169..647d9a77bdd 100644 --- a/gsdk/build.rs +++ b/gsdk/build.rs @@ -32,7 +32,7 @@ fn main() { // # NOTE // // using an extra tool for doing this is for preventing the -// build-dependencies slow down the complation speed. +// build-dependencies slow down the compilation speed. fn generate_api() -> Vec { let root = env!("CARGO_MANIFEST_DIR"); let profile = env::var("PROFILE").expect("Environment PROFILE not found."); diff --git a/gsdk/codegen/src/lib.rs b/gsdk/codegen/src/lib.rs index aa3a039e9fe..16aefbf4f86 100644 --- a/gsdk/codegen/src/lib.rs +++ b/gsdk/codegen/src/lib.rs @@ -26,14 +26,14 @@ mod storage; /// /// # Note /// -/// - the docs must be end with `at specfied block.` +/// - the docs must be end with `at specified block.` /// - the function name must be end with `_at`. /// - the last argument must be `Option`. /// /// # Example /// /// ```ignore -/// /// Imdocs at specfied block. +/// /// Imdocs at specified block. /// #[storage_fetch] /// pub fn query_storage_at(addr: Address, block_hash: Option) -> R { /// // ... @@ -43,7 +43,7 @@ mod storage; /// will generate functions /// /// ```ignore -/// /// Imdocs at specfied block. +/// /// Imdocs at specified block. /// pub fn query_storage_at(addr: Address, block_hash: impl Into>) -> R { /// // ... /// } diff --git a/gsdk/codegen/src/storage.rs b/gsdk/codegen/src/storage.rs index cb2ceca9628..4f5616e2604 100644 --- a/gsdk/codegen/src/storage.rs +++ b/gsdk/codegen/src/storage.rs @@ -34,7 +34,7 @@ const AT_BLOCK_HASH: &str = "Option"; pub struct StorageQueryBuilder(ItemFn); impl StorageQueryBuilder { - /// Build storage query at specifed block with and without Option. + /// Build storage query at specified block with and without Option. fn at(&self) -> ItemFn { let mut at = self.0.clone(); @@ -155,7 +155,7 @@ impl StorageQueryBuilder { /// This function validates the input of the storage query /// function, follows the rules below: /// - /// - the docs must be end with `at specfied block.` + /// - the docs must be end with `at specified block.` /// - the function name must be end with `_at`. /// - the last argument must be `Option`. fn validate(fun: &ItemFn) { diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index 93fc8e557da..676c2b38cf2 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -1016,7 +1016,7 @@ pub mod runtime_types { #[doc = "- `source`: the account with vesting running,"] #[doc = "- `dest`: the beneficiary account,"] #[doc = "- `schedule_index`: the index of `VestingInfo` for source account."] - #[doc = "- `amount`: the amount to be unlocked and transfered from `VestingInfo`."] + #[doc = "- `amount`: the amount to be unlocked and transferred from `VestingInfo`."] #[doc = ""] #[doc = "Emits the following events:"] #[doc = "- `VestingScheduleRemoved{ who, schedule_index }`"] diff --git a/gstd/src/async_runtime/locks.rs b/gstd/src/async_runtime/locks.rs index eb358752526..4fd3aaf2414 100644 --- a/gstd/src/async_runtime/locks.rs +++ b/gstd/src/async_runtime/locks.rs @@ -70,7 +70,7 @@ impl Lock { if let Some(blocks) = self.deadline().checked_sub(exec::block_height()) { if blocks == 0 { unreachable!( - "Checked in `crate::msg::async::poll`, will trigger the tiemout error automatically." + "Checked in `crate::msg::async::poll`, will trigger the timeout error automatically." ); } diff --git a/lazy-pages/src/common.rs b/lazy-pages/src/common.rs index 35f19696f9b..3ea618bf5ff 100644 --- a/lazy-pages/src/common.rs +++ b/lazy-pages/src/common.rs @@ -58,7 +58,7 @@ pub(crate) enum Error { #[display(fmt = "Something goes wrong when trying to access globals: {_0:?}")] #[from] AccessGlobal(GlobalsAccessError), - #[display(fmt = "It's unknown wether memory access is read or write")] + #[display(fmt = "It's unknown whether memory access is read or write")] ReadOrWriteIsUnknown, #[display(fmt = "Cannot receive signal from wasm memory, when status is gas limit exceed")] SignalWhenStatusGasExceeded, diff --git a/lazy-pages/src/process.rs b/lazy-pages/src/process.rs index d9cb329432f..e7f1fe31498 100644 --- a/lazy-pages/src/process.rs +++ b/lazy-pages/src/process.rs @@ -32,7 +32,7 @@ pub(crate) trait AccessHandler { type Pages; type Output; - /// Returns wether it is write access + /// Returns whether it is write access fn is_write(&self) -> bool; /// Returns whether gas exceeded status is allowed for current access. @@ -44,7 +44,7 @@ pub(crate) trait AccessHandler { /// Returns whether write accessed memory access is allowed for the case. fn check_write_accessed_memory_access() -> Result<(), Error>; - /// Returns wether already accessed memory read access is allowed for the case. + /// Returns whether already accessed memory read access is allowed for the case. fn check_read_from_accessed_memory() -> Result<(), Error>; /// Charge for accessed gear page. diff --git a/node/authorship/src/authorship.rs b/node/authorship/src/authorship.rs index 2b8c5e2b1cc..ec5d35050ea 100644 --- a/node/authorship/src/authorship.rs +++ b/node/authorship/src/authorship.rs @@ -75,7 +75,7 @@ pub struct ProposerFactory { /// The soft deadline indicates where we should stop attempting to add transactions /// to the block, which exhaust resources. After soft deadline is reached, /// we switch to a fixed-amount mode, in which after we see `MAX_SKIPPED_TRANSACTIONS` - /// transactions which exhaust resrouces, we will conclude that the block is full. + /// transactions which exhaust resources, we will conclude that the block is full. soft_deadline_percent: Percent, telemetry: Option, /// When estimating the block size, should the proof be included? @@ -166,7 +166,7 @@ impl ProposerFactory { /// The soft deadline indicates where we should stop attempting to add transactions /// to the block, which exhaust resources. After soft deadline is reached, /// we switch to a fixed-amount mode, in which after we see `MAX_SKIPPED_TRANSACTIONS` - /// transactions which exhaust resrouces, we will conclude that the block is full. + /// transactions which exhaust resources, we will conclude that the block is full. /// /// Setting the value too low will significantly limit the amount of transactions /// we try in case they exhaust resources. Setting the value too high can diff --git a/node/service/src/lib.rs b/node/service/src/lib.rs index 47ad6b70d2f..8a5ff9327c7 100644 --- a/node/service/src/lib.rs +++ b/node/service/src/lib.rs @@ -85,7 +85,7 @@ type FullGrandpaBlockImport; -/// The transaction pool type defintion. +/// The transaction pool type definition. type TransactionPool = sc_transaction_pool::FullPool>; diff --git a/pallets/airdrop/src/lib.rs b/pallets/airdrop/src/lib.rs index 613686b1c98..a47401e7c1e 100644 --- a/pallets/airdrop/src/lib.rs +++ b/pallets/airdrop/src/lib.rs @@ -141,7 +141,7 @@ pub mod pallet { /// - `source`: the account with vesting running, /// - `dest`: the beneficiary account, /// - `schedule_index`: the index of `VestingInfo` for source account. - /// - `amount`: the amount to be unlocked and transfered from `VestingInfo`. + /// - `amount`: the amount to be unlocked and transferred from `VestingInfo`. /// /// Emits the following events: /// - `VestingScheduleRemoved{ who, schedule_index }` diff --git a/pallets/gear-messenger/src/lib.rs b/pallets/gear-messenger/src/lib.rs index 558b2b85671..762ed75d8f7 100644 --- a/pallets/gear-messenger/src/lib.rs +++ b/pallets/gear-messenger/src/lib.rs @@ -32,8 +32,8 @@ //! - Counting amount of messages sent from outside (from extrinsics) //! within the current block. //! - Counting amount of messages removed from queue to be processed -//! or skipped withing the current block. -//! - Managing continuation of queue processing withing the current block. +//! or skipped within the current block. +//! - Managing continuation of queue processing within the current block. //! - Storing and managing message queue, it's pushing and popping algorithms. //! - Storing and managing mailbox, it's insertion and removal algorithms, //! including the value claiming with Balances Pallet as `Currency` diff --git a/pallets/gear-voucher/README.md b/pallets/gear-voucher/README.md index b23d0473060..2b82f5f3669 100644 --- a/pallets/gear-voucher/README.md +++ b/pallets/gear-voucher/README.md @@ -1,6 +1,6 @@ # Allows -A crate that implements a flow similar to "payment vouchers". A contract owner (or, actually, anyone, for that matter) may opt for sponsoring users with some amount of funds that can be spent to pay transcation fees and buy gas only for a specific call. +A crate that implements a flow similar to "payment vouchers". A contract owner (or, actually, anyone, for that matter) may opt for sponsoring users with some amount of funds that can be spent to pay transaction fees and buy gas only for a specific call. ## Interface diff --git a/pallets/gear/src/queue.rs b/pallets/gear/src/queue.rs index e5dd03f760a..c4381b91543 100644 --- a/pallets/gear/src/queue.rs +++ b/pallets/gear/src/queue.rs @@ -293,7 +293,7 @@ where // Reaching this branch is possible when init message was processed with failure, // while other kind of messages were already in the queue/were added to the queue // (for example. moved from wait list in case of async init). - // Also this branch is reachable when progam sends a message to a terminated + // Also this branch is reachable when program sends a message to a terminated // program. log::debug!("Program '{program_id:?}' is not active"); return ActorResult::Data(None); diff --git a/pallets/staking-rewards/src/mock.rs b/pallets/staking-rewards/src/mock.rs index 7b0233f42d9..d257504f23c 100644 --- a/pallets/staking-rewards/src/mock.rs +++ b/pallets/staking-rewards/src/mock.rs @@ -653,7 +653,7 @@ pub(crate) fn nominators_total_balance() -> u128 { .fold(0_u128, |acc, x| acc.saturating_add(x)) } -// Retuns the chain state as a tuple +// Returns the chain state as a tuple // (`total_issuance`, `stakeable_amount`, `treasury_balance`, `staking_rewards_pool_balance`) pub(crate) fn chain_state() -> (u128, u128, u128, u128) { ( diff --git a/pallets/staking-rewards/src/tests.rs b/pallets/staking-rewards/src/tests.rs index 3b2eb13aae9..74ba782673e 100644 --- a/pallets/staking-rewards/src/tests.rs +++ b/pallets/staking-rewards/src/tests.rs @@ -1040,7 +1040,7 @@ fn inflation_with_too_many_stakers_adds_up() { MILLISECONDS_PER_YEAR, ); let annualized_rewards = yearly_inflation * initial_total_issuance; - // At 92% staking rate, the respective ROI is withing the 30% cap. + // At 92% staking rate, the respective ROI is within the 30% cap. let expected_rewards = overall_time_fraction * annualized_rewards; // Rounding error could have accumulated over many eras diff --git a/runtime/gear/src/constants.rs b/runtime/gear/src/constants.rs index 60ce8f55daf..dc62ebd44b9 100644 --- a/runtime/gear/src/constants.rs +++ b/runtime/gear/src/constants.rs @@ -37,7 +37,7 @@ pub mod time { use runtime_primitives::{BlockNumber, Moment}; /// Since BABE is probabilistic this is the average expected block time that - /// we are targetting. Blocks will be produced at a minimum duration defined + /// we are targeting. Blocks will be produced at a minimum duration defined /// by `SLOT_DURATION`, but some slots will not be allocated to any /// authority and hence no block will be produced. We expect to have this /// block time on average following the defined slot duration and the value diff --git a/runtime/vara/src/constants.rs b/runtime/vara/src/constants.rs index a633b3bd9f7..4d5b4ccff03 100644 --- a/runtime/vara/src/constants.rs +++ b/runtime/vara/src/constants.rs @@ -44,7 +44,7 @@ pub mod time { use runtime_primitives::{BlockNumber, Moment}; /// Since BABE is probabilistic this is the average expected block time that - /// we are targetting. Blocks will be produced at a minimum duration defined + /// we are targeting. Blocks will be produced at a minimum duration defined /// by `SLOT_DURATION`, but some slots will not be allocated to any /// authority and hence no block will be produced. We expect to have this /// block time on average following the defined slot duration and the value diff --git a/sandbox/env/src/lib.rs b/sandbox/env/src/lib.rs index 968f77095c3..9b1e93fd43f 100644 --- a/sandbox/env/src/lib.rs +++ b/sandbox/env/src/lib.rs @@ -107,7 +107,7 @@ pub const ERR_OUT_OF_BOUNDS: u32 = -2i32 as u32; /// For FFI purposes. pub const ERR_EXECUTION: u32 = -3i32 as u32; -/// A global variable has been sucessfully changed. +/// A global variable has been successfully changed. /// /// For FFI purposes. pub const ERROR_GLOBALS_OK: u32 = 0; diff --git a/sandbox/host/src/error.rs b/sandbox/host/src/error.rs index a7de27f77a6..b3b6615b716 100644 --- a/sandbox/host/src/error.rs +++ b/sandbox/host/src/error.rs @@ -155,7 +155,7 @@ pub enum WasmError { #[error("{0}")] Instantiation(String), - /// Other error happenend. + /// Other error happened. #[error("{0}")] Other(String), } diff --git a/sandbox/host/src/sandbox.rs b/sandbox/host/src/sandbox.rs index bb469729841..734a26996d1 100644 --- a/sandbox/host/src/sandbox.rs +++ b/sandbox/host/src/sandbox.rs @@ -369,7 +369,7 @@ pub enum Memory { /// Wasmi memory reference Wasmi(WasmiMemoryWrapper), - /// Wasmer memory refernce + /// Wasmer memory reference Wasmer(WasmerMemoryWrapper), } diff --git a/sandbox/host/src/sandbox/wasmer_backend.rs b/sandbox/host/src/sandbox/wasmer_backend.rs index 3d183163ec3..96c33630639 100644 --- a/sandbox/host/src/sandbox/wasmer_backend.rs +++ b/sandbox/host/src/sandbox/wasmer_backend.rs @@ -328,7 +328,7 @@ fn dispatch_common( return Err(RuntimeError::new("Can't write invoke args into memory")); } - // Perform the actuall call + // Perform the actual call let serialized_result = sandbox_context .invoke(invoke_args_ptr, invoke_args_len, supervisor_func_index) .map_err(|e| RuntimeError::new(e.to_string())); @@ -507,7 +507,7 @@ impl MemoryWrapper { let len: usize = memory.data_size().try_into().expect( "maximum memory object size never exceeds pointer size on any architecture; \ usize by design and definition is enough to store any memory object size \ - possible on current achitecture; thus the conversion can not fail; qed", + possible on current architecture; thus the conversion can not fail; qed", ); if len == 0 { @@ -530,7 +530,7 @@ impl MemoryWrapper { let len: usize = memory.data_size().try_into().expect( "maximum memory object size never exceeds pointer size on any architecture; \ usize by design and definition is enough to store any memory object size \ - possible on current achitecture; thus the conversion can not fail; qed", + possible on current architecture; thus the conversion can not fail; qed", ); if len == 0 { @@ -548,7 +548,7 @@ impl MemoryTransfer for MemoryWrapper { let data_size: usize = memory.data_size().try_into().expect( "maximum memory object size never exceeds pointer size on any architecture; \ usize by design and definition is enough to store any memory object size \ - possible on current achitecture; thus the conversion can not fail; qed", + possible on current architecture; thus the conversion can not fail; qed", ); let range = util::checked_range(source_addr.into(), size, data_size) @@ -598,7 +598,7 @@ impl MemoryTransfer for MemoryWrapper { .grow(pages) .map_err(|e| { Error::Sandbox(format!( - "Connot grow memory in wasmer sandbox executor: {}", + "Cannot grow memory in wasmer sandbox executor: {}", e )) }) diff --git a/scripts/check-spec.sh b/scripts/check-spec.sh index b21e3363b61..3615a4b2f4e 100755 --- a/scripts/check-spec.sh +++ b/scripts/check-spec.sh @@ -22,7 +22,7 @@ check_spec() { else print "" # Ok case. We had our spec bumped else if ($1 - $2 >= 50 && $2 == 100) - print "" # Ok case. We have reseted the network + print "" # Ok case. We have reset the network else if ($1 != $2) print "equal",$1 }')" diff --git a/utils/gear-replay-cli/README.md b/utils/gear-replay-cli/README.md index c2d20aaef72..ac8898c8538 100644 --- a/utils/gear-replay-cli/README.md +++ b/utils/gear-replay-cli/README.md @@ -1,28 +1,27 @@ # Replaying actual Vara blocks via Remote Externalities - ## Overview -In an unlikely event of an error occurring in the `gear node` while processing a block on validators it's often extremely helpful to be able to replay the block with, potentially, more detailed logging level or even with ablitiy to run extrinsics in debugger to quicker understand the root cause of a problem. +In an unlikely event of an error occurring in the `gear node` while processing a block on validators it's often extremely helpful to be able to replay the block with, potentially, more detailed logging level or even with ablitiy to run extrinsics in debugger to quicker understand the root cause of a problem. -Substrate's built-in `try-runtime` machinery largely covers this. However, the CLI is a bit cumbersome, and it requires one to provide a custom-built Runtime with the `try-runtime` feature enabled in order for the latter to implement the specific `execute_block` runtime api. Besides, it enforces the `ExecutionStrategy::AlwaysWasm` strategy, that is only allows to use the wasm Runtime which even in case when the `RuntimeVersion` of the native and wasm Runtimes is identical (which should alwasy be the case anyway, to ensure the correct block application). +Substrate's built-in `try-runtime` machinery largely covers this. However, the CLI is a bit cumbersome, and it requires one to provide a custom-built Runtime with the `try-runtime` feature enabled in order for the latter to implement the specific `execute_block` runtime api. Besides, it enforces the `ExecutionStrategy::AlwaysWasm` strategy, that is only allows to use the wasm Runtime which even in case when the `RuntimeVersion` of the native and wasm Runtimes is identical (which should always be the case anyway, to ensure the correct block application). Regardless of these small inconveniences the `try-runtime` is a good tool whose functionality goes way beyond the scope of the task in question. In order to mitigate the downsides of the `try-runtime` CLI a dedicated tool has been created. It is dedicated exclusively for remote block execution on top of the on-chain state (currently, only Vara chain is supported). Advantages with respect to the Substrate' `try-runtime` are: + - doesn't require enabling additional features; - works with the native Runtime (in case the `RuntimeVersion` is as the one of the on-chain Runtime) rendering debugging possible. There are also some shortcomings though (which can easliy be fixed in later versions), like the fact it can only download state/block from the live chain and not use a local snapshot. -
## Substrate's `try-runtime` CLI command Substrate provides a rather complex machinery for testing various runtime aspects against real live data (via so-called `remote-externalities`). -The funtionality covers blocks execution, rening `on_runtime_upgrade` hooks to test storage migration consistency etc. +The functionality covers blocks execution, rening `on_runtime_upgrade` hooks to test storage migration consistency etc. It can run against a live chain as well as a downloaded data snapshot. Runs locally as a node CLI command. @@ -34,63 +33,60 @@ Other than that it's a good tool. ### Usage examples -* Execute block on Vara live chain - - * current latest finalized block on Vara chain - - ```bash - gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block live --uri wss://archive-rpc.vara-network.io:443 - ``` +- Execute block on Vara live chain - * at block `$HASH` + - current latest finalized block on Vara chain - ```bash - export HASH=0x8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905 + ```bash + gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block live --uri wss://archive-rpc.vara-network.io:443 + ``` - gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block live --uri wss://archive-rpc.vara-network.io:443 --at "$HASH" - ``` + - at block `$HASH` - *Note:* The `--at` parameter provides the hash of the block which determines the current state of the blockchain. Then the following block is fethced and applied to this state. Therefore if we want to replay extrinsics from the block `N` we must provide the hash of the block `N-1` as the height. + ```bash + export HASH=0x8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905 + gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block live --uri wss://archive-rpc.vara-network.io:443 --at "$HASH" + ``` -* Execute block against a local snapshot + _Note:_ The `--at` parameter provides the hash of the block which determines the current state of the blockchain. Then the following block is fetched and applied to this state. Therefore if we want to replay extrinsics from the block `N` we must provide the hash of the block `N-1` as the height. - * Download snapshot at block `$HASH` (if omitted, the state at the latest finalized block is downloaded) +- Execute block against a local snapshot - Note the `existing` value for the `--runtime` option which means the downloaded on-chain runtime is used (the only allowed option for `create-snapshot` command) + - Download snapshot at block `$HASH` (if omitted, the state at the latest finalized block is downloaded) - ```bash - export HASH=0x8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905 + Note the `existing` value for the `--runtime` option which means the downloaded on-chain runtime is used (the only allowed option for `create-snapshot` command) - gear try-runtime --chain=vara --runtime existing create-snapshot --uri wss://archive-rpc.vara-network.io:443 [--at "$HASH"] [$SNAPSHOT_PATH] - ``` + ```bash + export HASH=0x8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905 - If `$SNAPSHOT_PATH` is not provided the default filename for a snapshot would be `$chain`-`$spec_version`@`$block_hash`.snap (for instance, `vara-140@8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905.snap` or `vara-140@latest.snap`). + gear try-runtime --chain=vara --runtime existing create-snapshot --uri wss://archive-rpc.vara-network.io:443 [--at "$HASH"] [$SNAPSHOT_PATH] + ``` - * Exectute block agains a local snapshot (at block for which the snapshot was created) + If `$SNAPSHOT_PATH` is not provided the default filename for a snapshot would be `$chain`-`$spec_version`@`$block_hash`.snap (for instance, `vara-140@8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905.snap` or `vara-140@latest.snap`). - ```bash - export SNAPSHOT="vara-140@8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905.snap" + - Execute block against a local snapshot (at block for which the snapshot was created) - gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block --block-ws-uri wss://archive-rpc.vara-network.io:443 snap --snapshot-path "$SNAPSHOT" - ``` + ```bash + export SNAPSHOT="vara-140@8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905.snap" + gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block --block-ws-uri wss://archive-rpc.vara-network.io:443 snap --snapshot-path "$SNAPSHOT" + ``` - Warning: By default the `try-runtime execute-block` command runs with the `--try-state` option value set to `all`, that is it will try to validate the state of all the pallets in the snapshot. This may result in an error caused by inconsistencies in some pallets storage (for instance, at the moment of this writing the `BagsList` pallet has inconsisent data). This is, of course, something to look into, but it goes beyond the scope of the problem in question. - Since this doesn't affect the internal logic of the Gear flow we want to reproduce, we might consider either comletely omitting setting the `try_state` by setting the respective option to `none` + Warning: By default the `try-runtime execute-block` command runs with the `--try-state` option value set to `all`, that is it will try to validate the state of all the pallets in the snapshot. This may result in an error caused by inconsistencies in some pallets storage (for instance, at the moment of this writing the `BagsList` pallet has inconsistent data). This is, of course, something to look into, but it goes beyond the scope of the problem in question. + Since this doesn't affect the internal logic of the Gear flow we want to reproduce, we might consider either completely omitting setting the `try_state` by setting the respective option to `none` - ```bash - gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block --try-state none live --uri wss://archive-rpc.vara-network.io:443 - ``` + ```bash + gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block --try-state none live --uri wss://archive-rpc.vara-network.io:443 + ``` - or enumerate a number of pallets in the runtime we are only concerned with: + or enumerate a number of pallets in the runtime we are only concerned with: - ```bash - export TRY_PALLETS=System,Babe,Grandpa,Balances,Staking,Vesting,Gear,GearGas,GearProgram,GearMessenger,GearScheduler,GearPayment,StakingRewards - - gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block --try-state "$TRY_PALLETS" live --uri wss://archive-rpc.vara-network.io:443 - ``` + ```bash + export TRY_PALLETS=System,Babe,Grandpa,Balances,Staking,Vesting,Gear,GearGas,GearProgram,GearMessenger,GearScheduler,GearPayment,StakingRewards + gear try-runtime --chain=vara --runtime vara_runtime.compact.compressed.wasm execute-block --try-state "$TRY_PALLETS" live --uri wss://archive-rpc.vara-network.io:443 + ```
@@ -108,23 +104,23 @@ Another difference from the `try-runtime` API is that in `gear-replay-cli` the b In order to use the native runtime build make sure the node is built with the Runtime spec version that matches the one currently uploaded on chain. -* Replay a block on Vara live chain +- Replay a block on Vara live chain - * current latest finalized block on Vara chain + - current latest finalized block on Vara chain - ```bash - gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 -lgear::runtime=debug -lpallet_gear,gear_common,pallet_gear_scheduler=debug - ``` + ```bash + gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 -lgear::runtime=debug -lpallet_gear,gear_common,pallet_gear_scheduler=debug + ``` - * block with `$HASH` or `$BLOCK_NUM` + - block with `$HASH` or `$BLOCK_NUM` - ```bash - export HASH=0x8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905 - export BLOCK_NUM=2000000 + ```bash + export HASH=0x8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905 + export BLOCK_NUM=2000000 - gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 --block "$HASH" -lgear::runtime=debug -lpallet_gear,gear_common=debug - gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 --block "$BLOCK_NUM" -lgear::runtime=debug -lpallet_gear,gear_common=debug - ``` + gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 --block "$HASH" -lgear::runtime=debug -lpallet_gear,gear_common=debug + gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 --block "$BLOCK_NUM" -lgear::runtime=debug -lpallet_gear,gear_common=debug + ```
@@ -134,9 +130,11 @@ The `gear-replay-cli` CLI tools provides means to enable execution of a download The `wasm-only` version which runs the downloaded Runtime is lighter-weight (the executable is about 40% smaller as it doesn't include the `vara`- or `gear-runtime` as a dependency), and it works with both Gear testnet and the Vara chain (provided the user supplies the correct WebSocket connection uri). This is the default way of building the tool: + ```bash ./scripts/gear.sh build gear-replay --release ``` + or simply ```bash @@ -144,6 +142,7 @@ make gear-replay ``` In order to enable native runtime, use one of the following: + ```bash make gear-replay-vara-native make gear-replay-gear-native diff --git a/utils/gear-replay-cli/src/main.rs b/utils/gear-replay-cli/src/main.rs index b02ef3bb94f..ec3d332bc1c 100644 --- a/utils/gear-replay-cli/src/main.rs +++ b/utils/gear-replay-cli/src/main.rs @@ -146,7 +146,7 @@ async fn main() -> sc_cli::Result<()> { BlockHashOrNumber::Hash(hash) => (block_hash_to_number::(&rpc, hash).await?, hash), }; - // Get the state at the height corresponging to previous block. + // Get the state at the height corresponding to previous block. let previous_hash = block_number_to_hash::(&rpc, current_number.saturating_sub(One::one())).await?; log::info!( diff --git a/utils/node-loader/CHANGELOG.md b/utils/node-loader/CHANGELOG.md index 7c5cd9366c5..526dbfa0f3a 100644 --- a/utils/node-loader/CHANGELOG.md +++ b/utils/node-loader/CHANGELOG.md @@ -8,12 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.2.1] 2023-06-19. Spawn batch pool as tokio task and remove all blocking code. ### Changed - Use `tokio::spawn` to spawn `BatchPool`. -- `listen_events` throws error if no events recieved. +- `listen_events` throws error if no events received. ## [0.2.0] 2023-06-12. Spawn event listener background thread and spawn batch pool tasks. ### Changed - Use `tokio::spawn` to spawn batch pool tasks -- Spawn `tokio` event listener thread and broadcast events to recievers. +- Spawn `tokio` event listener thread and broadcast events to receivers. ## [0.1.6] 2023-03-16. Complete testing extrinsics set. diff --git a/utils/node-loader/src/batch_pool.rs b/utils/node-loader/src/batch_pool.rs index 74f3dd26f88..a29425b4bfa 100644 --- a/utils/node-loader/src/batch_pool.rs +++ b/utils/node-loader/src/batch_pool.rs @@ -28,14 +28,14 @@ mod report; type Seed = u64; type CallId = usize; -type EventsReciever = Receiver>; +type EventsReceiver = Receiver>; pub struct BatchPool { api: GearApiFacade, pool_size: usize, batch_size: usize, tasks_context: Context, - rx: EventsReciever, + rx: EventsReceiver, _phantom: PhantomData, } @@ -44,7 +44,7 @@ impl BatchPool { api: GearApiFacade, batch_size: usize, pool_size: usize, - rx: EventsReciever, + rx: EventsReceiver, ) -> Self { Self { api, @@ -63,7 +63,7 @@ impl BatchPool { /// - `renew_balance_task` - periodically setting a new balance for the user account. /// /// Wait for any task to return result with `tokio::select!`. - pub async fn run(mut self, params: LoadParams, rx: EventsReciever) -> Result<()> { + pub async fn run(mut self, params: LoadParams, rx: EventsReceiver) -> Result<()> { let gear_api = self.api.clone().into_gear_api(); let run_pool_task = self.run_pool_loop(params.loader_seed, params.code_seed_type); let inspect_crash_task = tokio::spawn(inspect_crash_events(rx)); @@ -131,12 +131,12 @@ impl BatchPool { } } -/// Runs the generated `BatchWithSeed` with the provided `GearApiFacade` and `EventsReciever` to handle produced events. +/// Runs the generated `BatchWithSeed` with the provided `GearApiFacade` and `EventsReceiver` to handle produced events. #[instrument(skip_all, fields(seed = batch.seed, batch_type = batch.batch_str()))] async fn run_batch( api: GearApiFacade, batch: BatchWithSeed, - rx: EventsReciever, + rx: EventsReceiver, ) -> Result { let (seed, batch) = batch.into(); match run_batch_impl(api, batch, rx).await { @@ -160,7 +160,7 @@ async fn run_batch( async fn run_batch_impl( mut api: GearApiFacade, batch: Batch, - rx: EventsReciever, + rx: EventsReceiver, ) -> Result { // Order of the results of each extrinsic execution in the batch // is the same as in the input set of calls in the batch. @@ -259,7 +259,7 @@ async fn process_events( api: GearApi, mut messages: BTreeMap, block_hash: H256, - mut rx: EventsReciever, + mut rx: EventsReceiver, ) -> Result { // States what amount of blocks we should wait for taking all the events about successful `messages` execution let wait_for_events_blocks = 30; @@ -271,7 +271,7 @@ async fn process_events( let results = { let mut events = rx.recv().await?; - // Wait with a timeout until the `EventsReciever` receives the expected block hash. + // Wait with a timeout until the `EventsReceiver` receives the expected block hash. while events.block_hash() != block_hash { tokio::time::sleep(Duration::new(0, 500)).await; events = tokio::time::timeout( @@ -350,7 +350,7 @@ async fn process_events( }) } -async fn inspect_crash_events(mut rx: EventsReciever) -> Result<()> { +async fn inspect_crash_events(mut rx: EventsReceiver) -> Result<()> { // Error means either event is not found and can't be found // in the listener, or some other error during event // parsing occurred. diff --git a/utils/node-loader/src/main.rs b/utils/node-loader/src/main.rs index 3b65317652d..a3913de12fb 100644 --- a/utils/node-loader/src/main.rs +++ b/utils/node-loader/src/main.rs @@ -35,7 +35,7 @@ async fn run(params: Params) -> Result<()> { /// Connect to API of provided node address and subscribe for events. /// -/// Broadcast new events to recievers. +/// Broadcast new events to receivers. async fn listen_events(tx: Sender>, node: String) -> Result<()> { let api = gsdk::Api::new(Some(&node)).await?; let mut event_listener = api.finalized_blocks().await?; diff --git a/utils/wasm-builder/README.md b/utils/wasm-builder/README.md index 1b60fc5eafa..14766e2c41e 100644 --- a/utils/wasm-builder/README.md +++ b/utils/wasm-builder/README.md @@ -4,7 +4,7 @@ This is a helper crate that can be used in build scripts for building Gear progr ## Usage -1. Add the `gear-wasm-buider` crate as a build dependency to the `Cargo.toml`: +1. Add the `gear-wasm-builder` crate as a build dependency to the `Cargo.toml`: ```toml # ... diff --git a/utils/wasm-builder/src/crate_info.rs b/utils/wasm-builder/src/crate_info.rs index ca0c4619a8d..e94342744d3 100644 --- a/utils/wasm-builder/src/crate_info.rs +++ b/utils/wasm-builder/src/crate_info.rs @@ -22,7 +22,7 @@ use std::{collections::HashMap, path::Path}; use crate::builder_error::BuilderError; -/// Helper to get a crate info exctracted from the `Cargo.toml`. +/// Helper to get a crate info extracted from the `Cargo.toml`. #[derive(Debug, Default)] pub struct CrateInfo { /// Original name of the crate. diff --git a/utils/wasm-gen/src/config.rs b/utils/wasm-gen/src/config.rs index 68edfc69f72..242470bcfff 100644 --- a/utils/wasm-gen/src/config.rs +++ b/utils/wasm-gen/src/config.rs @@ -70,7 +70,7 @@ //! } //! ``` //! -//! These types of configs instatiations are helpful if you want to call generators +//! These types of configs instantiations are helpful if you want to call generators //! manually with some special (maybe not) generators state transition flow. However, //! for the simplest usage with crate's main generation functions (like //! [`crate::generate_gear_program_code`] or [`crate::generate_gear_program_module`]) diff --git a/utils/wasm-gen/src/generator/syscalls.rs b/utils/wasm-gen/src/generator/syscalls.rs index dc18e551812..8bdb22d6694 100644 --- a/utils/wasm-gen/src/generator/syscalls.rs +++ b/utils/wasm-gen/src/generator/syscalls.rs @@ -48,7 +48,7 @@ use gear_wasm_instrument::syscalls::{ParamType, SysCallName, SysCallSignature}; /// /// Basically, there are 2 types of generated sys-calls: /// 1. Those invocation of which is done regardless of validity of call context (`Loose`). -/// 2. Those which are invoked correctly with implenting all call context (`Precise`). +/// 2. Those which are invoked correctly with implementing all call context (`Precise`). /// /// Clarifying that, `gr_reservation_send` requires an existing reservation id, /// which is pretty hard to predict beforehand with a generator. So this call context diff --git a/utils/wasm-instrument/src/syscalls.rs b/utils/wasm-instrument/src/syscalls.rs index 44f679e726a..444c6873386 100644 --- a/utils/wasm-instrument/src/syscalls.rs +++ b/utils/wasm-instrument/src/syscalls.rs @@ -344,7 +344,7 @@ impl SysCallName { /// Syscall param type. /// /// `Ptr` is usually used to point to the beginning of the array in memory. -/// In order to distiguish between pointer to the memory array and pointer +/// In order to distinguish between pointer to the memory array and pointer /// to some value, `Ptr` was defined as a tuple-like struct that owns an /// optional index of the memory array size parameter. So if current sys-call /// doesn't accept any memory array as an argument, then pointer parameter will diff --git a/utils/wasm-proc/README.md b/utils/wasm-proc/README.md index 6362d10477c..880e385e0fa 100644 --- a/utils/wasm-proc/README.md +++ b/utils/wasm-proc/README.md @@ -19,4 +19,4 @@ wasm_proc somefile.wasm You will get two files in the same directory: - `somefile.opt.wasm` which is destined for the node. -- `somefile.meta.wasm` which can be used by the browser or another ui to aquire metadata for the main wasm. +- `somefile.meta.wasm` which can be used by the browser or another ui to acquire metadata for the main wasm. diff --git a/utils/wasm-proc/src/main.rs b/utils/wasm-proc/src/main.rs index cac6e012ced..b6fb751447b 100644 --- a/utils/wasm-proc/src/main.rs +++ b/utils/wasm-proc/src/main.rs @@ -180,7 +180,7 @@ fn main() -> Result<(), Box> { let original_wasm_path = PathBuf::from(file); let optimized_wasm_path = original_wasm_path.clone().with_extension("opt.wasm"); - // Make pre-handle if input wasm has been builded from as-script + // Make pre-handle if input wasm has been built from as-script let wasm_path = if assembly_script { let mut optimizer = Optimizer::new(original_wasm_path.clone())?; optimizer From 35c21e83f30b7dc49446ddafe38cc3410a0dcc4c Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Tue, 22 Aug 2023 09:53:58 +0400 Subject: [PATCH 071/165] ci(sccache): Remove `RUSTC_WRAPPER` (#3125) --- .github/workflows/build.yml | 1 - .github/workflows/check.yml | 2 -- docker/build.sh | 2 +- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0aaf814d993..674a0f60ca6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,6 @@ jobs: env: LLVM_PROFILE_FILE: "gear-%p-%m.profraw" RUSTUP_HOME: /tmp/rustup_home - RUSTC_WRAPPER: sccache SCCACHE_DIR: ${{ inputs.cache }} steps: - name: "ACTIONS: Checkout" diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1dadbc66043..481b4fc4f8e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -19,7 +19,6 @@ jobs: runs-on: [kuberunner, github-runner-01] env: RUSTUP_HOME: /tmp/rustup_home - RUSTC_WRAPPER: sccache SCCACHE_DIR: ${{ inputs.cache }} steps: - name: "ACTIONS: Checkout" @@ -62,7 +61,6 @@ jobs: runs-on: [kuberunner, github-runner-01] env: RUSTUP_HOME: /tmp/rustup_home - RUSTC_WRAPPER: sccache SCCACHE_DIR: ${{ inputs.cache }} steps: - name: Cancel Previous Runs diff --git a/docker/build.sh b/docker/build.sh index 3a652df3782..bc6029bc9a3 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -14,7 +14,7 @@ GITREPO=gear # Build the image echo "Building ${GITUSER}/${GITREPO}:latest docker image, hang on!" -time docker build -f ./docker/Dockerfile --build-arg RUSTC_WRAPPER= --build-arg PROFILE=production -t ${GITUSER}/${GITREPO}:latest . +time docker build -f ./docker/Dockerfile --build-arg --build-arg PROFILE=production -t ${GITUSER}/${GITREPO}:latest . # Show the list of available images for this repo echo "Image is ready" From d65127f9f9b085a912e2647cac14d8c2f855a995 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 22 Aug 2023 12:28:36 +0400 Subject: [PATCH 072/165] feat(wasm-proc): Make sensible error-reporting on runtime imports check (#3136) --- utils/wasm-proc/src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/utils/wasm-proc/src/main.rs b/utils/wasm-proc/src/main.rs index b6fb751447b..134b058e01f 100644 --- a/utils/wasm-proc/src/main.rs +++ b/utils/wasm-proc/src/main.rs @@ -133,12 +133,22 @@ fn check_rt_imports(path_to_wasm: &str, allowed_imports: &HashSet<&str>) -> Resu .ok_or("Import section not found")? .entries(); + let mut unexpected_imports = vec![]; + for import in imports { if matches!(import.external(), External::Function(_) if !allowed_imports.contains(import.field())) { - return Err(format!("Unexpected import `{}`", import.field())); + unexpected_imports.push(import.field().to_string()); } } + + if !unexpected_imports.is_empty() { + return Err(format!( + "Unexpected imports found: {}", + unexpected_imports.join(", "), + )); + } + log::info!("{path_to_wasm} -> Ok"); Ok(()) } From 18c9926ffe21a4e3757bcd8a8f70010921bbd0bb Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 22 Aug 2023 15:04:02 +0400 Subject: [PATCH 073/165] Vara stage 2: Rolling changes (#1881) Co-authored-by: Vadim Smirnov Co-authored-by: clearloop <26088946+clearloop@users.noreply.github.com> --- Cargo.lock | 88 +- Cargo.toml | 5 + _typos.toml | 3 + gsdk/build.rs | 1 + gsdk/src/metadata/generated.rs | 3348 ++++++++++++++++----- node/service/src/chain_spec/vara.rs | 21 +- node/testing/src/genesis.rs | 6 +- runtime/vara/Cargo.toml | 21 +- runtime/vara/src/bag_thresholds.rs | 241 ++ runtime/vara/src/governance/fellowship.rs | 2 +- runtime/vara/src/governance/mod.rs | 2 +- runtime/vara/src/lib.rs | 375 ++- utils/wasm-proc/src/main.rs | 4 +- 13 files changed, 3238 insertions(+), 879 deletions(-) create mode 100644 runtime/vara/src/bag_thresholds.rs diff --git a/Cargo.lock b/Cargo.lock index 68d5b782295..51ebe927393 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7167,6 +7167,43 @@ dependencies = [ "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", ] +[[package]] +name = "pallet-bounties" +version = "4.0.0-dev" +source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", +] + +[[package]] +name = "pallet-child-bounties" +version = "4.0.0-dev" +source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "log", + "pallet-bounties", + "pallet-treasury", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", +] + [[package]] name = "pallet-conviction-voting" version = "4.0.0-dev" @@ -7662,6 +7699,51 @@ dependencies = [ "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", ] +[[package]] +name = "pallet-nomination-pools" +version = "1.0.0" +source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" +dependencies = [ + "frame-support", + "frame-system", + "log", + "parity-scale-codec", + "scale-info", + "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-staking", + "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", +] + +[[package]] +name = "pallet-nomination-pools-runtime-api" +version = "1.0.0-dev" +source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" +dependencies = [ + "pallet-nomination-pools", + "parity-scale-codec", + "sp-api", + "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", +] + +[[package]] +name = "pallet-offences" +version = "4.0.0-dev" +source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" +dependencies = [ + "frame-support", + "frame-system", + "log", + "pallet-balances", + "parity-scale-codec", + "scale-info", + "serde", + "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-staking", + "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", +] + [[package]] name = "pallet-preimage" version = "4.0.0-dev" @@ -13307,6 +13389,8 @@ dependencies = [ "pallet-babe", "pallet-bags-list", "pallet-balances", + "pallet-bounties", + "pallet-child-bounties", "pallet-conviction-voting", "pallet-election-provider-multi-phase", "pallet-gear", @@ -13323,6 +13407,9 @@ dependencies = [ "pallet-identity", "pallet-im-online", "pallet-multisig", + "pallet-nomination-pools", + "pallet-nomination-pools-runtime-api", + "pallet-offences", "pallet-preimage", "pallet-proxy", "pallet-ranked-collective", @@ -13359,7 +13446,6 @@ dependencies = [ "sp-version", "static_assertions", "substrate-build-script-utils", - "substrate-validator-set", "substrate-wasm-builder", "wat", ] diff --git a/Cargo.toml b/Cargo.toml index 33d8300e061..a49cbeab532 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -256,6 +256,8 @@ pallet-authorship = { version = "4.0.0-dev", git = "https://github.com/gear-tech pallet-authority-discovery = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-babe = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-bags-list = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } +pallet-bounties = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } +pallet-child-bounties = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-balances = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-conviction-voting = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-election-provider-multi-phase = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } @@ -263,6 +265,9 @@ pallet-grandpa = { version = "4.0.0-dev", git = "https://github.com/gear-tech/su pallet-identity = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-im-online = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-multisig = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } +pallet-nomination-pools = { version = "1.0.0", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } +pallet-nomination-pools-runtime-api = { version = "1.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } +pallet-offences = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-preimage = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-proxy = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } pallet-ranked-collective = { version = "4.0.0-dev", git = "https://github.com/gear-tech/substrate.git", branch = "gear-polkadot-v0.9.41-canary-no-sandbox", default-features = false } diff --git a/_typos.toml b/_typos.toml index 740fc8625f6..c2754eb7930 100644 --- a/_typos.toml +++ b/_typos.toml @@ -4,6 +4,9 @@ extend-ignore-re = [ "\"hel\"" ] +[files] +extend-exclude = ["gsdk/src/metadata/generated.rs"] + [default.extend-words] # typo in sp-state-machine, won't fix here for now. overlayed = "overlayed" diff --git a/gsdk/build.rs b/gsdk/build.rs index 647d9a77bdd..992126a4a46 100644 --- a/gsdk/build.rs +++ b/gsdk/build.rs @@ -82,6 +82,7 @@ fn format(stream: &[u8]) -> String { String::from_utf8_lossy(&out) .to_string() .replace(":: subxt", "::subxt") + .replace(" : :: ", ": ::") .replace(" :: ", "::") } diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index 676c2b38cf2..5e5cc446c7a 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -28,6 +28,11 @@ pub mod runtime_types { use super::runtime_types; pub mod bounded_collections { use super::runtime_types; + pub mod bounded_btree_map { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct BoundedBTreeMap<_0, _1>(pub ::subxt::utils::KeyedVec<_0, _1>); + } pub mod bounded_vec { use super::runtime_types; #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] @@ -1442,514 +1447,1205 @@ pub mod runtime_types { pub amount: _1, } } - pub mod pallet_conviction_voting { + pub mod pallet_bounties { use super::runtime_types; - pub mod conviction { - use super::runtime_types; - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub enum Conviction { - #[codec(index = 0)] - None, - #[codec(index = 1)] - Locked1x, - #[codec(index = 2)] - Locked2x, - #[codec(index = 3)] - Locked3x, - #[codec(index = 4)] - Locked4x, - #[codec(index = 5)] - Locked5x, - #[codec(index = 6)] - Locked6x, - } - } pub mod pallet { use super::runtime_types; #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] pub enum Call { #[codec(index = 0)] - #[doc = "Vote in a poll. If `vote.is_aye()`, the vote is to enact the proposal;"] - #[doc = "otherwise it is a vote to keep the status quo."] + #[doc = "Propose a new bounty."] #[doc = ""] - #[doc = "The dispatch origin of this call must be _Signed_."] + #[doc = "The dispatch origin for this call must be _Signed_."] #[doc = ""] - #[doc = "- `poll_index`: The index of the poll to vote for."] - #[doc = "- `vote`: The vote configuration."] + #[doc = "Payment: `TipReportDepositBase` will be reserved from the origin account, as well as"] + #[doc = "`DataDepositPerByte` for each byte in `reason`. It will be unreserved upon approval,"] + #[doc = "or slashed when rejected."] #[doc = ""] - #[doc = "Weight: `O(R)` where R is the number of polls the voter has voted on."] - vote { + #[doc = "- `curator`: The curator account whom will manage this bounty."] + #[doc = "- `fee`: The curator fee."] + #[doc = "- `value`: The total payment amount of this bounty, curator fee included."] + #[doc = "- `description`: The description of this bounty."] + propose_bounty { #[codec(compact)] - poll_index: ::core::primitive::u32, - vote: runtime_types::pallet_conviction_voting::vote::AccountVote< - ::core::primitive::u128, - >, + value: ::core::primitive::u128, + description: ::std::vec::Vec<::core::primitive::u8>, }, #[codec(index = 1)] - #[doc = "Delegate the voting power (with some given conviction) of the sending account for a"] - #[doc = "particular class of polls."] - #[doc = ""] - #[doc = "The balance delegated is locked for as long as it's delegated, and thereafter for the"] - #[doc = "time appropriate for the conviction's lock period."] - #[doc = ""] - #[doc = "The dispatch origin of this call must be _Signed_, and the signing account must either:"] - #[doc = " - be delegating already; or"] - #[doc = " - have no voting activity (if there is, then it will need to be removed/consolidated"] - #[doc = " through `reap_vote` or `unvote`)."] - #[doc = ""] - #[doc = "- `to`: The account whose voting the `target` account's voting power will follow."] - #[doc = "- `class`: The class of polls to delegate. To delegate multiple classes, multiple calls"] - #[doc = " to this function are required."] - #[doc = "- `conviction`: The conviction that will be attached to the delegated votes. When the"] - #[doc = " account is undelegated, the funds will be locked for the corresponding period."] - #[doc = "- `balance`: The amount of the account's balance to be used in delegating. This must not"] - #[doc = " be more than the account's current balance."] + #[doc = "Approve a bounty proposal. At a later time, the bounty will be funded and become active"] + #[doc = "and the original deposit will be returned."] #[doc = ""] - #[doc = "Emits `Delegated`."] + #[doc = "May only be called from `T::SpendOrigin`."] #[doc = ""] - #[doc = "Weight: `O(R)` where R is the number of polls the voter delegating to has"] - #[doc = " voted on. Weight is initially charged as if maximum votes, but is refunded later."] - delegate { - class: ::core::primitive::u16, - to: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - conviction: runtime_types::pallet_conviction_voting::conviction::Conviction, - balance: ::core::primitive::u128, + #[doc = "## Complexity"] + #[doc = "- O(1)."] + approve_bounty { + #[codec(compact)] + bounty_id: ::core::primitive::u32, }, #[codec(index = 2)] - #[doc = "Undelegate the voting power of the sending account for a particular class of polls."] + #[doc = "Assign a curator to a funded bounty."] #[doc = ""] - #[doc = "Tokens may be unlocked following once an amount of time consistent with the lock period"] - #[doc = "of the conviction with which the delegation was issued has passed."] - #[doc = ""] - #[doc = "The dispatch origin of this call must be _Signed_ and the signing account must be"] - #[doc = "currently delegating."] + #[doc = "May only be called from `T::SpendOrigin`."] #[doc = ""] - #[doc = "- `class`: The class of polls to remove the delegation from."] + #[doc = "## Complexity"] + #[doc = "- O(1)."] + propose_curator { + #[codec(compact)] + bounty_id: ::core::primitive::u32, + curator: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + fee: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "Unassign curator from a bounty."] #[doc = ""] - #[doc = "Emits `Undelegated`."] + #[doc = "This function can only be called by the `RejectOrigin` a signed origin."] #[doc = ""] - #[doc = "Weight: `O(R)` where R is the number of polls the voter delegating to has"] - #[doc = " voted on. Weight is initially charged as if maximum votes, but is refunded later."] - undelegate { class: ::core::primitive::u16 }, - #[codec(index = 3)] - #[doc = "Remove the lock caused by prior voting/delegating which has expired within a particular"] - #[doc = "class."] + #[doc = "If this function is called by the `RejectOrigin`, we assume that the curator is"] + #[doc = "malicious or inactive. As a result, we will slash the curator when possible."] #[doc = ""] - #[doc = "The dispatch origin of this call must be _Signed_."] + #[doc = "If the origin is the curator, we take this as a sign they are unable to do their job and"] + #[doc = "they willingly give up. We could slash them, but for now we allow them to recover their"] + #[doc = "deposit and exit without issue. (We may want to change this if it is abused.)"] #[doc = ""] - #[doc = "- `class`: The class of polls to unlock."] - #[doc = "- `target`: The account to remove the lock on."] + #[doc = "Finally, the origin can be anyone if and only if the curator is \"inactive\". This allows"] + #[doc = "anyone in the community to call out that a curator is not doing their due diligence, and"] + #[doc = "we should pick a new curator. In this case the curator should also be slashed."] #[doc = ""] - #[doc = "Weight: `O(R)` with R number of vote of target."] - unlock { - class: ::core::primitive::u16, - target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[doc = "## Complexity"] + #[doc = "- O(1)."] + unassign_curator { + #[codec(compact)] + bounty_id: ::core::primitive::u32, }, #[codec(index = 4)] - #[doc = "Remove a vote for a poll."] + #[doc = "Accept the curator role for a bounty."] + #[doc = "A deposit will be reserved from curator and refund upon successful payout."] #[doc = ""] - #[doc = "If:"] - #[doc = "- the poll was cancelled, or"] - #[doc = "- the poll is ongoing, or"] - #[doc = "- the poll has ended such that"] - #[doc = " - the vote of the account was in opposition to the result; or"] - #[doc = " - there was no conviction to the account's vote; or"] - #[doc = " - the account made a split vote"] - #[doc = "...then the vote is removed cleanly and a following call to `unlock` may result in more"] - #[doc = "funds being available."] + #[doc = "May only be called from the curator."] #[doc = ""] - #[doc = "If, however, the poll has ended and:"] - #[doc = "- it finished corresponding to the vote of the account, and"] - #[doc = "- the account made a standard vote with conviction, and"] - #[doc = "- the lock period of the conviction is not over"] - #[doc = "...then the lock will be aggregated into the overall account's lock, which may involve"] - #[doc = "*overlocking* (where the two locks are combined into a single lock that is the maximum"] - #[doc = "of both the amount locked and the time is it locked for)."] + #[doc = "## Complexity"] + #[doc = "- O(1)."] + accept_curator { + #[codec(compact)] + bounty_id: ::core::primitive::u32, + }, + #[codec(index = 5)] + #[doc = "Award bounty to a beneficiary account. The beneficiary will be able to claim the funds"] + #[doc = "after a delay."] #[doc = ""] - #[doc = "The dispatch origin of this call must be _Signed_, and the signer must have a vote"] - #[doc = "registered for poll `index`."] + #[doc = "The dispatch origin for this call must be the curator of this bounty."] #[doc = ""] - #[doc = "- `index`: The index of poll of the vote to be removed."] - #[doc = "- `class`: Optional parameter, if given it indicates the class of the poll. For polls"] - #[doc = " which have finished or are cancelled, this must be `Some`."] + #[doc = "- `bounty_id`: Bounty ID to award."] + #[doc = "- `beneficiary`: The beneficiary account whom will receive the payout."] #[doc = ""] - #[doc = "Weight: `O(R + log R)` where R is the number of polls that `target` has voted on."] - #[doc = " Weight is calculated for the maximum number of vote."] - remove_vote { - class: ::core::option::Option<::core::primitive::u16>, - index: ::core::primitive::u32, + #[doc = "## Complexity"] + #[doc = "- O(1)."] + award_bounty { + #[codec(compact)] + bounty_id: ::core::primitive::u32, + beneficiary: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, }, - #[codec(index = 5)] - #[doc = "Remove a vote for a poll."] + #[codec(index = 6)] + #[doc = "Claim the payout from an awarded bounty after payout delay."] #[doc = ""] - #[doc = "If the `target` is equal to the signer, then this function is exactly equivalent to"] - #[doc = "`remove_vote`. If not equal to the signer, then the vote must have expired,"] - #[doc = "either because the poll was cancelled, because the voter lost the poll or"] - #[doc = "because the conviction period is over."] + #[doc = "The dispatch origin for this call must be the beneficiary of this bounty."] #[doc = ""] - #[doc = "The dispatch origin of this call must be _Signed_."] + #[doc = "- `bounty_id`: Bounty ID to claim."] #[doc = ""] - #[doc = "- `target`: The account of the vote to be removed; this account must have voted for poll"] - #[doc = " `index`."] - #[doc = "- `index`: The index of poll of the vote to be removed."] - #[doc = "- `class`: The class of the poll."] + #[doc = "## Complexity"] + #[doc = "- O(1)."] + claim_bounty { + #[codec(compact)] + bounty_id: ::core::primitive::u32, + }, + #[codec(index = 7)] + #[doc = "Cancel a proposed or active bounty. All the funds will be sent to treasury and"] + #[doc = "the curator deposit will be unreserved if possible."] #[doc = ""] - #[doc = "Weight: `O(R + log R)` where R is the number of polls that `target` has voted on."] - #[doc = " Weight is calculated for the maximum number of vote."] - remove_other_vote { - target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - class: ::core::primitive::u16, - index: ::core::primitive::u32, + #[doc = "Only `T::RejectOrigin` is able to cancel a bounty."] + #[doc = ""] + #[doc = "- `bounty_id`: Bounty ID to cancel."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- O(1)."] + close_bounty { + #[codec(compact)] + bounty_id: ::core::primitive::u32, + }, + #[codec(index = 8)] + #[doc = "Extend the expiry time of an active bounty."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be the curator of this bounty."] + #[doc = ""] + #[doc = "- `bounty_id`: Bounty ID to extend."] + #[doc = "- `remark`: additional information."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- O(1)."] + extend_bounty_expiry { + #[codec(compact)] + bounty_id: ::core::primitive::u32, + remark: ::std::vec::Vec<::core::primitive::u8>, }, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] pub enum Error { #[codec(index = 0)] - #[doc = "Poll is not ongoing."] - NotOngoing, + #[doc = "Proposer's balance is too low."] + InsufficientProposersBalance, #[codec(index = 1)] - #[doc = "The given account did not vote on the poll."] - NotVoter, + #[doc = "No proposal or bounty at that index."] + InvalidIndex, #[codec(index = 2)] - #[doc = "The actor has no permission to conduct the action."] - NoPermission, + #[doc = "The reason given is just too big."] + ReasonTooBig, #[codec(index = 3)] - #[doc = "The actor has no permission to conduct the action right now but will do in the future."] - NoPermissionYet, + #[doc = "The bounty status is unexpected."] + UnexpectedStatus, #[codec(index = 4)] - #[doc = "The account is already delegating."] - AlreadyDelegating, + #[doc = "Require bounty curator."] + RequireCurator, #[codec(index = 5)] - #[doc = "The account currently has votes attached to it and the operation cannot succeed until"] - #[doc = "these are removed, either through `unvote` or `reap_vote`."] - AlreadyVoting, + #[doc = "Invalid bounty value."] + InvalidValue, #[codec(index = 6)] - #[doc = "Too high a balance was provided that the account cannot afford."] - InsufficientFunds, + #[doc = "Invalid bounty fee."] + InvalidFee, #[codec(index = 7)] - #[doc = "The account is not currently delegating."] - NotDelegating, + #[doc = "A bounty payout is pending."] + #[doc = "To cancel the bounty, you must unassign and slash the curator."] + PendingPayout, #[codec(index = 8)] - #[doc = "Delegation to oneself makes no sense."] - Nonsense, + #[doc = "The bounties cannot be claimed/closed because it's still in the countdown period."] + Premature, #[codec(index = 9)] - #[doc = "Maximum number of votes reached."] - MaxVotesReached, + #[doc = "The bounty cannot be closed because it has active child bounties."] + HasActiveChildBounty, #[codec(index = 10)] - #[doc = "The class must be supplied since it is not easily determinable from the state."] - ClassNeeded, - #[codec(index = 11)] - #[doc = "The class ID supplied is invalid."] - BadClass, + #[doc = "Too many approvals are already queued."] + TooManyQueued, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] pub enum Event { #[codec(index = 0)] - #[doc = "An account has delegated their vote to another account. \\[who, target\\]"] - Delegated(::subxt::utils::AccountId32, ::subxt::utils::AccountId32), + #[doc = "New bounty proposal."] + BountyProposed { index: ::core::primitive::u32 }, #[codec(index = 1)] - #[doc = "An \\[account\\] has cancelled a previous delegation operation."] - Undelegated(::subxt::utils::AccountId32), + #[doc = "A bounty proposal was rejected; funds were slashed."] + BountyRejected { + index: ::core::primitive::u32, + bond: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "A bounty proposal is funded and became active."] + BountyBecameActive { index: ::core::primitive::u32 }, + #[codec(index = 3)] + #[doc = "A bounty is awarded to a beneficiary."] + BountyAwarded { + index: ::core::primitive::u32, + beneficiary: ::subxt::utils::AccountId32, + }, + #[codec(index = 4)] + #[doc = "A bounty is claimed by beneficiary."] + BountyClaimed { + index: ::core::primitive::u32, + payout: ::core::primitive::u128, + beneficiary: ::subxt::utils::AccountId32, + }, + #[codec(index = 5)] + #[doc = "A bounty is cancelled."] + BountyCanceled { index: ::core::primitive::u32 }, + #[codec(index = 6)] + #[doc = "A bounty expiry is extended."] + BountyExtended { index: ::core::primitive::u32 }, } } - pub mod types { - use super::runtime_types; - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct Delegations<_0> { - pub votes: _0, - pub capital: _0, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct Tally<_0> { - pub ayes: _0, - pub nays: _0, - pub support: _0, - } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct Bounty<_0, _1, _2> { + pub proposer: _0, + pub value: _1, + pub fee: _1, + pub curator_deposit: _1, + pub bond: _1, + pub status: runtime_types::pallet_bounties::BountyStatus<_0, _2>, } - pub mod vote { + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum BountyStatus<_0, _1> { + #[codec(index = 0)] + Proposed, + #[codec(index = 1)] + Approved, + #[codec(index = 2)] + Funded, + #[codec(index = 3)] + CuratorProposed { curator: _0 }, + #[codec(index = 4)] + Active { curator: _0, update_due: _1 }, + #[codec(index = 5)] + PendingPayout { + curator: _0, + beneficiary: _0, + unlock_at: _1, + }, + } + } + pub mod pallet_child_bounties { + use super::runtime_types; + pub mod pallet { use super::runtime_types; #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub enum AccountVote<_0> { + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { #[codec(index = 0)] - Standard { - vote: runtime_types::pallet_conviction_voting::vote::Vote, - balance: _0, - }, - #[codec(index = 1)] - Split { aye: _0, nay: _0 }, - #[codec(index = 2)] - SplitAbstain { aye: _0, nay: _0, abstain: _0 }, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct Casting<_0, _1, _2> { - pub votes: runtime_types::bounded_collections::bounded_vec::BoundedVec<( - _1, - runtime_types::pallet_conviction_voting::vote::AccountVote<_0>, - )>, - pub delegations: - runtime_types::pallet_conviction_voting::types::Delegations<_0>, - pub prior: runtime_types::pallet_conviction_voting::vote::PriorLock<_1, _0>, - #[codec(skip)] - pub __subxt_unused_type_params: ::core::marker::PhantomData<_2>, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct Delegating<_0, _1, _2> { - pub balance: _0, - pub target: _1, - pub conviction: runtime_types::pallet_conviction_voting::conviction::Conviction, - pub delegations: - runtime_types::pallet_conviction_voting::types::Delegations<_0>, - pub prior: runtime_types::pallet_conviction_voting::vote::PriorLock<_2, _0>, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct PriorLock<_0, _1>(pub _0, pub _1); - #[derive( - ::subxt::ext::codec::CompactAs, - Debug, - crate::gp::Decode, - crate::gp::DecodeAsType, - crate::gp::Encode, - )] - pub struct Vote(pub ::core::primitive::u8); - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub enum Voting<_0, _1, _2, _3> { - #[codec(index = 0)] - Casting(runtime_types::pallet_conviction_voting::vote::Casting<_0, _2, _2>), - #[codec(index = 1)] - Delegating( - runtime_types::pallet_conviction_voting::vote::Delegating<_0, _1, _2>, - ), - __Ignore(::core::marker::PhantomData<_3>), - } - } - } - pub mod pallet_gear { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] - pub enum Call { - #[codec(index = 0)] - #[doc = "Saves program `code` in storage."] + #[doc = "Add a new child-bounty."] #[doc = ""] - #[doc = "The extrinsic was created to provide _deploy program from program_ functionality."] - #[doc = "Anyone who wants to define a \"factory\" logic in program should first store the code and metadata for the \"child\""] - #[doc = "program in storage. So the code for the child will be initialized by program initialization request only if it exists in storage."] + #[doc = "The dispatch origin for this call must be the curator of parent"] + #[doc = "bounty and the parent bounty must be in \"active\" state."] #[doc = ""] - #[doc = "More precisely, the code and its metadata are actually saved in the storage under the hash of the `code`. The code hash is computed"] - #[doc = "as Blake256 hash. At the time of the call the `code` hash should not be in the storage. If it was stored previously, call will end up"] - #[doc = "with an `CodeAlreadyExists` error. In this case user can be sure, that he can actually use the hash of his program's code bytes to define"] - #[doc = "\"program factory\" logic in his program."] + #[doc = "Child-bounty gets added successfully & fund gets transferred from"] + #[doc = "parent bounty to child-bounty account, if parent bounty has enough"] + #[doc = "funds, else the call fails."] #[doc = ""] - #[doc = "Parameters"] - #[doc = "- `code`: wasm code of a program as a byte vector."] + #[doc = "Upper bound to maximum number of active child bounties that can be"] + #[doc = "added are managed via runtime trait config"] + #[doc = "[`Config::MaxActiveChildBountyCount`]."] #[doc = ""] - #[doc = "Emits the following events:"] - #[doc = "- `SavedCode(H256)` - when the code is saved in storage."] - upload_code { - code: ::std::vec::Vec<::core::primitive::u8>, + #[doc = "If the call is success, the status of child-bounty is updated to"] + #[doc = "\"Added\"."] + #[doc = ""] + #[doc = "- `parent_bounty_id`: Index of parent bounty for which child-bounty is being added."] + #[doc = "- `value`: Value for executing the proposal."] + #[doc = "- `description`: Text description for the child-bounty."] + add_child_bounty { + #[codec(compact)] + parent_bounty_id: ::core::primitive::u32, + #[codec(compact)] + value: ::core::primitive::u128, + description: ::std::vec::Vec<::core::primitive::u8>, }, #[codec(index = 1)] - #[doc = "Creates program initialization request (message), that is scheduled to be run in the same block."] - #[doc = ""] - #[doc = "There are no guarantees that initialization message will be run in the same block due to block"] - #[doc = "gas limit restrictions. For example, when it will be the message's turn, required gas limit for it"] - #[doc = "could be more than remaining block gas limit. Therefore, the message processing will be postponed"] - #[doc = "until the next block."] - #[doc = ""] - #[doc = "`ProgramId` is computed as Blake256 hash of concatenated bytes of `code` + `salt`. (todo #512 `code_hash` + `salt`)"] - #[doc = "Such `ProgramId` must not exist in the Program Storage at the time of this call."] - #[doc = ""] - #[doc = "There is the same guarantee here as in `upload_code`. That is, future program's"] - #[doc = "`code` and metadata are stored before message was added to the queue and processed."] - #[doc = ""] - #[doc = "The origin must be Signed and the sender must have sufficient funds to pay"] - #[doc = "for `gas` and `value` (in case the latter is being transferred)."] + #[doc = "Propose curator for funded child-bounty."] #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `code`: wasm code of a program as a byte vector."] - #[doc = "- `salt`: randomness term (a seed) to allow programs with identical code"] - #[doc = " to be created independently."] - #[doc = "- `init_payload`: encoded parameters of the wasm module `init` function."] - #[doc = "- `gas_limit`: maximum amount of gas the program can spend before it is halted."] - #[doc = "- `value`: balance to be transferred to the program once it's been created."] + #[doc = "The dispatch origin for this call must be curator of parent bounty."] #[doc = ""] - #[doc = "Emits the following events:"] - #[doc = "- `InitMessageEnqueued(MessageInfo)` when init message is placed in the queue."] + #[doc = "Parent bounty must be in active state, for this child-bounty call to"] + #[doc = "work."] #[doc = ""] - #[doc = "# Note"] - #[doc = "Faulty (uninitialized) programs still have a valid addresses (program ids) that can deterministically be derived on the"] - #[doc = "caller's side upfront. It means that if messages are sent to such an address, they might still linger in the queue."] + #[doc = "Child-bounty must be in \"Added\" state, for processing the call. And"] + #[doc = "state of child-bounty is moved to \"CuratorProposed\" on successful"] + #[doc = "call completion."] #[doc = ""] - #[doc = "In order to mitigate the risk of users' funds being sent to an address,"] - #[doc = "where a valid program should have resided, while it's not,"] - #[doc = "such \"failed-to-initialize\" programs are not silently deleted from the"] - #[doc = "program storage but rather marked as \"ghost\" programs."] - #[doc = "Ghost program can be removed by their original author via an explicit call."] - #[doc = "The funds stored by a ghost program will be release to the author once the program"] - #[doc = "has been removed."] - upload_program { - code: ::std::vec::Vec<::core::primitive::u8>, - salt: ::std::vec::Vec<::core::primitive::u8>, - init_payload: ::std::vec::Vec<::core::primitive::u8>, - gas_limit: ::core::primitive::u64, - value: ::core::primitive::u128, + #[doc = "- `parent_bounty_id`: Index of parent bounty."] + #[doc = "- `child_bounty_id`: Index of child bounty."] + #[doc = "- `curator`: Address of child-bounty curator."] + #[doc = "- `fee`: payment fee to child-bounty curator for execution."] + propose_curator { + #[codec(compact)] + parent_bounty_id: ::core::primitive::u32, + #[codec(compact)] + child_bounty_id: ::core::primitive::u32, + curator: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + fee: ::core::primitive::u128, }, #[codec(index = 2)] - #[doc = "Creates program via `code_id` from storage."] + #[doc = "Accept the curator role for the child-bounty."] #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `code_id`: wasm code id in the code storage."] - #[doc = "- `salt`: randomness term (a seed) to allow programs with identical code"] - #[doc = " to be created independently."] - #[doc = "- `init_payload`: encoded parameters of the wasm module `init` function."] - #[doc = "- `gas_limit`: maximum amount of gas the program can spend before it is halted."] - #[doc = "- `value`: balance to be transferred to the program once it's been created."] + #[doc = "The dispatch origin for this call must be the curator of this"] + #[doc = "child-bounty."] #[doc = ""] - #[doc = "Emits the following events:"] - #[doc = "- `InitMessageEnqueued(MessageInfo)` when init message is placed in the queue."] + #[doc = "A deposit will be reserved from the curator and refund upon"] + #[doc = "successful payout or cancellation."] #[doc = ""] - #[doc = "# NOTE"] + #[doc = "Fee for curator is deducted from curator fee of parent bounty."] #[doc = ""] - #[doc = "For the details of this extrinsic, see `upload_code`."] - create_program { - code_id: runtime_types::gear_core::ids::CodeId, - salt: ::std::vec::Vec<::core::primitive::u8>, - init_payload: ::std::vec::Vec<::core::primitive::u8>, - gas_limit: ::core::primitive::u64, - value: ::core::primitive::u128, + #[doc = "Parent bounty must be in active state, for this child-bounty call to"] + #[doc = "work."] + #[doc = ""] + #[doc = "Child-bounty must be in \"CuratorProposed\" state, for processing the"] + #[doc = "call. And state of child-bounty is moved to \"Active\" on successful"] + #[doc = "call completion."] + #[doc = ""] + #[doc = "- `parent_bounty_id`: Index of parent bounty."] + #[doc = "- `child_bounty_id`: Index of child bounty."] + accept_curator { + #[codec(compact)] + parent_bounty_id: ::core::primitive::u32, + #[codec(compact)] + child_bounty_id: ::core::primitive::u32, }, #[codec(index = 3)] - #[doc = "Sends a message to a program or to another account."] + #[doc = "Unassign curator from a child-bounty."] #[doc = ""] - #[doc = "The origin must be Signed and the sender must have sufficient funds to pay"] - #[doc = "for `gas` and `value` (in case the latter is being transferred)."] + #[doc = "The dispatch origin for this call can be either `RejectOrigin`, or"] + #[doc = "the curator of the parent bounty, or any signed origin."] #[doc = ""] - #[doc = "To avoid an undefined behavior a check is made that the destination address"] - #[doc = "is not a program in uninitialized state. If the opposite holds true,"] - #[doc = "the message is not enqueued for processing."] + #[doc = "For the origin other than T::RejectOrigin and the child-bounty"] + #[doc = "curator, parent bounty must be in active state, for this call to"] + #[doc = "work. We allow child-bounty curator and T::RejectOrigin to execute"] + #[doc = "this call irrespective of the parent bounty state."] #[doc = ""] - #[doc = "If `prepaid` flag is set, the transaction fee and the gas cost will be"] - #[doc = "charged against a `voucher` that must have been issued for the sender"] - #[doc = "in conjunction with the `destination` program. That means that the"] - #[doc = "synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must"] - #[doc = "exist and have sufficient funds in it. Otherwise, the call is invalidated."] + #[doc = "If this function is called by the `RejectOrigin` or the"] + #[doc = "parent bounty curator, we assume that the child-bounty curator is"] + #[doc = "malicious or inactive. As a result, child-bounty curator deposit is"] + #[doc = "slashed."] #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `destination`: the message destination."] - #[doc = "- `payload`: in case of a program destination, parameters of the `handle` function."] - #[doc = "- `gas_limit`: maximum amount of gas the program can spend before it is halted."] - #[doc = "- `value`: balance to be transferred to the program once it's been created."] - #[doc = "- `prepaid`: a flag that indicates whether a voucher should be used."] + #[doc = "If the origin is the child-bounty curator, we take this as a sign"] + #[doc = "that they are unable to do their job, and are willingly giving up."] + #[doc = "We could slash the deposit, but for now we allow them to unreserve"] + #[doc = "their deposit and exit without issue. (We may want to change this if"] + #[doc = "it is abused.)"] #[doc = ""] - #[doc = "Emits the following events:"] - #[doc = "- `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue."] - send_message { - destination: runtime_types::gear_core::ids::ProgramId, - payload: ::std::vec::Vec<::core::primitive::u8>, - gas_limit: ::core::primitive::u64, - value: ::core::primitive::u128, - prepaid: ::core::primitive::bool, + #[doc = "Finally, the origin can be anyone iff the child-bounty curator is"] + #[doc = "\"inactive\". Expiry update due of parent bounty is used to estimate"] + #[doc = "inactive state of child-bounty curator."] + #[doc = ""] + #[doc = "This allows anyone in the community to call out that a child-bounty"] + #[doc = "curator is not doing their due diligence, and we should pick a new"] + #[doc = "one. In this case the child-bounty curator deposit is slashed."] + #[doc = ""] + #[doc = "State of child-bounty is moved to Added state on successful call"] + #[doc = "completion."] + #[doc = ""] + #[doc = "- `parent_bounty_id`: Index of parent bounty."] + #[doc = "- `child_bounty_id`: Index of child bounty."] + unassign_curator { + #[codec(compact)] + parent_bounty_id: ::core::primitive::u32, + #[codec(compact)] + child_bounty_id: ::core::primitive::u32, }, #[codec(index = 4)] - #[doc = "Send reply on message in `Mailbox`."] + #[doc = "Award child-bounty to a beneficiary."] #[doc = ""] - #[doc = "Removes message by given `MessageId` from callers `Mailbox`:"] - #[doc = "rent funds become free, associated with the message value"] - #[doc = "transfers from message sender to extrinsic caller."] + #[doc = "The beneficiary will be able to claim the funds after a delay."] #[doc = ""] - #[doc = "Generates reply on removed message with given parameters"] - #[doc = "and pushes it in `MessageQueue`."] + #[doc = "The dispatch origin for this call must be the parent curator or"] + #[doc = "curator of this child-bounty."] #[doc = ""] - #[doc = "NOTE: source of the message in mailbox guaranteed to be a program."] + #[doc = "Parent bounty must be in active state, for this child-bounty call to"] + #[doc = "work."] #[doc = ""] - #[doc = "NOTE: only user who is destination of the message, can claim value"] - #[doc = "or reply on the message from mailbox."] + #[doc = "Child-bounty must be in active state, for processing the call. And"] + #[doc = "state of child-bounty is moved to \"PendingPayout\" on successful call"] + #[doc = "completion."] #[doc = ""] - #[doc = "If `prepaid` flag is set, the transaction fee and the gas cost will be"] - #[doc = "charged against a `voucher` that must have been issued for the sender"] - #[doc = "in conjunction with the mailboxed message source program. That means that the"] - #[doc = "synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must"] - #[doc = "exist and have sufficient funds in it. Otherwise, the call is invalidated."] - send_reply { - reply_to_id: runtime_types::gear_core::ids::MessageId, - payload: ::std::vec::Vec<::core::primitive::u8>, - gas_limit: ::core::primitive::u64, - value: ::core::primitive::u128, - prepaid: ::core::primitive::bool, + #[doc = "- `parent_bounty_id`: Index of parent bounty."] + #[doc = "- `child_bounty_id`: Index of child bounty."] + #[doc = "- `beneficiary`: Beneficiary account."] + award_child_bounty { + #[codec(compact)] + parent_bounty_id: ::core::primitive::u32, + #[codec(compact)] + child_bounty_id: ::core::primitive::u32, + beneficiary: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, }, #[codec(index = 5)] - #[doc = "Claim value from message in `Mailbox`."] + #[doc = "Claim the payout from an awarded child-bounty after payout delay."] #[doc = ""] - #[doc = "Removes message by given `MessageId` from callers `Mailbox`:"] - #[doc = "rent funds become free, associated with the message value"] - #[doc = "transfers from message sender to extrinsic caller."] + #[doc = "The dispatch origin for this call may be any signed origin."] #[doc = ""] - #[doc = "NOTE: only user who is destination of the message, can claim value"] - #[doc = "or reply on the message from mailbox."] - claim_value { - message_id: runtime_types::gear_core::ids::MessageId, - }, - #[codec(index = 6)] - #[doc = "Process message queue"] - run { - max_gas: ::core::option::Option<::core::primitive::u64>, - }, - #[codec(index = 7)] - #[doc = "Sets `ExecuteInherent` flag."] + #[doc = "Call works independent of parent bounty state, No need for parent"] + #[doc = "bounty to be in active state."] #[doc = ""] - #[doc = "Requires root origin (eventually, will only be set via referendum)"] - set_execute_inherent { value: ::core::primitive::bool }, - #[codec(index = 8)] - #[doc = "Pay additional rent for the program."] - pay_program_rent { - program_id: runtime_types::gear_core::ids::ProgramId, - block_count: ::core::primitive::u32, - }, - #[codec(index = 9)] - #[doc = "Starts a resume session of the previously paused program."] + #[doc = "The Beneficiary is paid out with agreed bounty value. Curator fee is"] + #[doc = "paid & curator deposit is unreserved."] #[doc = ""] - #[doc = "The origin must be Signed."] + #[doc = "Child-bounty must be in \"PendingPayout\" state, for processing the"] + #[doc = "call. And instance of child-bounty is removed from the state on"] + #[doc = "successful call completion."] #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `program_id`: id of the program to resume."] - #[doc = "- `allocations`: memory allocations of program prior to stop."] - #[doc = "- `code_hash`: id of the program binary code."] - resume_session_init { - program_id: runtime_types::gear_core::ids::ProgramId, - allocations: ::std::vec::Vec, - code_hash: runtime_types::gear_core::ids::CodeId, + #[doc = "- `parent_bounty_id`: Index of parent bounty."] + #[doc = "- `child_bounty_id`: Index of child bounty."] + claim_child_bounty { + #[codec(compact)] + parent_bounty_id: ::core::primitive::u32, + #[codec(compact)] + child_bounty_id: ::core::primitive::u32, }, - #[codec(index = 10)] - #[doc = "Appends memory pages to the resume session."] + #[codec(index = 6)] + #[doc = "Cancel a proposed or active child-bounty. Child-bounty account funds"] + #[doc = "are transferred to parent bounty account. The child-bounty curator"] + #[doc = "deposit may be unreserved if possible."] #[doc = ""] - #[doc = "The origin must be Signed and should be the owner of the session."] + #[doc = "The dispatch origin for this call must be either parent curator or"] + #[doc = "`T::RejectOrigin`."] #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `session_id`: id of the resume session."] - #[doc = "- `memory_pages`: program memory (or its part) before it was paused."] - resume_session_push { - session_id: ::core::primitive::u128, - memory_pages: ::std::vec::Vec<( - runtime_types::gear_core::pages::GearPage, - runtime_types::gear_core::memory::PageBuf, - )>, - }, - #[codec(index = 11)] - #[doc = "Finishes the program resume session."] + #[doc = "If the state of child-bounty is `Active`, curator deposit is"] + #[doc = "unreserved."] #[doc = ""] - #[doc = "The origin must be Signed and should be the owner of the session."] + #[doc = "If the state of child-bounty is `PendingPayout`, call fails &"] + #[doc = "returns `PendingPayout` error."] #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `session_id`: id of the resume session."] - #[doc = "- `block_count`: the specified period of rent."] - resume_session_commit { - session_id: ::core::primitive::u128, - block_count: ::core::primitive::u32, + #[doc = "For the origin other than T::RejectOrigin, parent bounty must be in"] + #[doc = "active state, for this child-bounty call to work. For origin"] + #[doc = "T::RejectOrigin execution is forced."] + #[doc = ""] + #[doc = "Instance of child-bounty is removed from the state on successful"] + #[doc = "call completion."] + #[doc = ""] + #[doc = "- `parent_bounty_id`: Index of parent bounty."] + #[doc = "- `child_bounty_id`: Index of child bounty."] + close_child_bounty { + #[codec(compact)] + parent_bounty_id: ::core::primitive::u32, + #[codec(compact)] + child_bounty_id: ::core::primitive::u32, + }, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "The parent bounty is not in active state."] + ParentBountyNotActive, + #[codec(index = 1)] + #[doc = "The bounty balance is not enough to add new child-bounty."] + InsufficientBountyBalance, + #[codec(index = 2)] + #[doc = "Number of child bounties exceeds limit `MaxActiveChildBountyCount`."] + TooManyChildBounties, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "A child-bounty is added."] + Added { + index: ::core::primitive::u32, + child_index: ::core::primitive::u32, + }, + #[codec(index = 1)] + #[doc = "A child-bounty is awarded to a beneficiary."] + Awarded { + index: ::core::primitive::u32, + child_index: ::core::primitive::u32, + beneficiary: ::subxt::utils::AccountId32, + }, + #[codec(index = 2)] + #[doc = "A child-bounty is claimed by beneficiary."] + Claimed { + index: ::core::primitive::u32, + child_index: ::core::primitive::u32, + payout: ::core::primitive::u128, + beneficiary: ::subxt::utils::AccountId32, + }, + #[codec(index = 3)] + #[doc = "A child-bounty is cancelled."] + Canceled { + index: ::core::primitive::u32, + child_index: ::core::primitive::u32, + }, + } + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct ChildBounty<_0, _1, _2> { + pub parent_bounty: _2, + pub value: _1, + pub fee: _1, + pub curator_deposit: _1, + pub status: runtime_types::pallet_child_bounties::ChildBountyStatus<_0, _2>, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum ChildBountyStatus<_0, _1> { + #[codec(index = 0)] + Added, + #[codec(index = 1)] + CuratorProposed { curator: _0 }, + #[codec(index = 2)] + Active { curator: _0 }, + #[codec(index = 3)] + PendingPayout { + curator: _0, + beneficiary: _0, + unlock_at: _1, + }, + } + } + pub mod pallet_conviction_voting { + use super::runtime_types; + pub mod conviction { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum Conviction { + #[codec(index = 0)] + None, + #[codec(index = 1)] + Locked1x, + #[codec(index = 2)] + Locked2x, + #[codec(index = 3)] + Locked3x, + #[codec(index = 4)] + Locked4x, + #[codec(index = 5)] + Locked5x, + #[codec(index = 6)] + Locked6x, + } + } + pub mod pallet { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Vote in a poll. If `vote.is_aye()`, the vote is to enact the proposal;"] + #[doc = "otherwise it is a vote to keep the status quo."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be _Signed_."] + #[doc = ""] + #[doc = "- `poll_index`: The index of the poll to vote for."] + #[doc = "- `vote`: The vote configuration."] + #[doc = ""] + #[doc = "Weight: `O(R)` where R is the number of polls the voter has voted on."] + vote { + #[codec(compact)] + poll_index: ::core::primitive::u32, + vote: runtime_types::pallet_conviction_voting::vote::AccountVote< + ::core::primitive::u128, + >, + }, + #[codec(index = 1)] + #[doc = "Delegate the voting power (with some given conviction) of the sending account for a"] + #[doc = "particular class of polls."] + #[doc = ""] + #[doc = "The balance delegated is locked for as long as it's delegated, and thereafter for the"] + #[doc = "time appropriate for the conviction's lock period."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be _Signed_, and the signing account must either:"] + #[doc = " - be delegating already; or"] + #[doc = " - have no voting activity (if there is, then it will need to be removed/consolidated"] + #[doc = " through `reap_vote` or `unvote`)."] + #[doc = ""] + #[doc = "- `to`: The account whose voting the `target` account's voting power will follow."] + #[doc = "- `class`: The class of polls to delegate. To delegate multiple classes, multiple calls"] + #[doc = " to this function are required."] + #[doc = "- `conviction`: The conviction that will be attached to the delegated votes. When the"] + #[doc = " account is undelegated, the funds will be locked for the corresponding period."] + #[doc = "- `balance`: The amount of the account's balance to be used in delegating. This must not"] + #[doc = " be more than the account's current balance."] + #[doc = ""] + #[doc = "Emits `Delegated`."] + #[doc = ""] + #[doc = "Weight: `O(R)` where R is the number of polls the voter delegating to has"] + #[doc = " voted on. Weight is initially charged as if maximum votes, but is refunded later."] + delegate { + class: ::core::primitive::u16, + to: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + conviction: runtime_types::pallet_conviction_voting::conviction::Conviction, + balance: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "Undelegate the voting power of the sending account for a particular class of polls."] + #[doc = ""] + #[doc = "Tokens may be unlocked following once an amount of time consistent with the lock period"] + #[doc = "of the conviction with which the delegation was issued has passed."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be _Signed_ and the signing account must be"] + #[doc = "currently delegating."] + #[doc = ""] + #[doc = "- `class`: The class of polls to remove the delegation from."] + #[doc = ""] + #[doc = "Emits `Undelegated`."] + #[doc = ""] + #[doc = "Weight: `O(R)` where R is the number of polls the voter delegating to has"] + #[doc = " voted on. Weight is initially charged as if maximum votes, but is refunded later."] + undelegate { class: ::core::primitive::u16 }, + #[codec(index = 3)] + #[doc = "Remove the lock caused by prior voting/delegating which has expired within a particular"] + #[doc = "class."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be _Signed_."] + #[doc = ""] + #[doc = "- `class`: The class of polls to unlock."] + #[doc = "- `target`: The account to remove the lock on."] + #[doc = ""] + #[doc = "Weight: `O(R)` with R number of vote of target."] + unlock { + class: ::core::primitive::u16, + target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 4)] + #[doc = "Remove a vote for a poll."] + #[doc = ""] + #[doc = "If:"] + #[doc = "- the poll was cancelled, or"] + #[doc = "- the poll is ongoing, or"] + #[doc = "- the poll has ended such that"] + #[doc = " - the vote of the account was in opposition to the result; or"] + #[doc = " - there was no conviction to the account's vote; or"] + #[doc = " - the account made a split vote"] + #[doc = "...then the vote is removed cleanly and a following call to `unlock` may result in more"] + #[doc = "funds being available."] + #[doc = ""] + #[doc = "If, however, the poll has ended and:"] + #[doc = "- it finished corresponding to the vote of the account, and"] + #[doc = "- the account made a standard vote with conviction, and"] + #[doc = "- the lock period of the conviction is not over"] + #[doc = "...then the lock will be aggregated into the overall account's lock, which may involve"] + #[doc = "*overlocking* (where the two locks are combined into a single lock that is the maximum"] + #[doc = "of both the amount locked and the time is it locked for)."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be _Signed_, and the signer must have a vote"] + #[doc = "registered for poll `index`."] + #[doc = ""] + #[doc = "- `index`: The index of poll of the vote to be removed."] + #[doc = "- `class`: Optional parameter, if given it indicates the class of the poll. For polls"] + #[doc = " which have finished or are cancelled, this must be `Some`."] + #[doc = ""] + #[doc = "Weight: `O(R + log R)` where R is the number of polls that `target` has voted on."] + #[doc = " Weight is calculated for the maximum number of vote."] + remove_vote { + class: ::core::option::Option<::core::primitive::u16>, + index: ::core::primitive::u32, + }, + #[codec(index = 5)] + #[doc = "Remove a vote for a poll."] + #[doc = ""] + #[doc = "If the `target` is equal to the signer, then this function is exactly equivalent to"] + #[doc = "`remove_vote`. If not equal to the signer, then the vote must have expired,"] + #[doc = "either because the poll was cancelled, because the voter lost the poll or"] + #[doc = "because the conviction period is over."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be _Signed_."] + #[doc = ""] + #[doc = "- `target`: The account of the vote to be removed; this account must have voted for poll"] + #[doc = " `index`."] + #[doc = "- `index`: The index of poll of the vote to be removed."] + #[doc = "- `class`: The class of the poll."] + #[doc = ""] + #[doc = "Weight: `O(R + log R)` where R is the number of polls that `target` has voted on."] + #[doc = " Weight is calculated for the maximum number of vote."] + remove_other_vote { + target: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + class: ::core::primitive::u16, + index: ::core::primitive::u32, + }, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Poll is not ongoing."] + NotOngoing, + #[codec(index = 1)] + #[doc = "The given account did not vote on the poll."] + NotVoter, + #[codec(index = 2)] + #[doc = "The actor has no permission to conduct the action."] + NoPermission, + #[codec(index = 3)] + #[doc = "The actor has no permission to conduct the action right now but will do in the future."] + NoPermissionYet, + #[codec(index = 4)] + #[doc = "The account is already delegating."] + AlreadyDelegating, + #[codec(index = 5)] + #[doc = "The account currently has votes attached to it and the operation cannot succeed until"] + #[doc = "these are removed, either through `unvote` or `reap_vote`."] + AlreadyVoting, + #[codec(index = 6)] + #[doc = "Too high a balance was provided that the account cannot afford."] + InsufficientFunds, + #[codec(index = 7)] + #[doc = "The account is not currently delegating."] + NotDelegating, + #[codec(index = 8)] + #[doc = "Delegation to oneself makes no sense."] + Nonsense, + #[codec(index = 9)] + #[doc = "Maximum number of votes reached."] + MaxVotesReached, + #[codec(index = 10)] + #[doc = "The class must be supplied since it is not easily determinable from the state."] + ClassNeeded, + #[codec(index = 11)] + #[doc = "The class ID supplied is invalid."] + BadClass, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "An account has delegated their vote to another account. \\[who, target\\]"] + Delegated(::subxt::utils::AccountId32, ::subxt::utils::AccountId32), + #[codec(index = 1)] + #[doc = "An \\[account\\] has cancelled a previous delegation operation."] + Undelegated(::subxt::utils::AccountId32), + } + } + pub mod types { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct Delegations<_0> { + pub votes: _0, + pub capital: _0, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct Tally<_0> { + pub ayes: _0, + pub nays: _0, + pub support: _0, + } + } + pub mod vote { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum AccountVote<_0> { + #[codec(index = 0)] + Standard { + vote: runtime_types::pallet_conviction_voting::vote::Vote, + balance: _0, + }, + #[codec(index = 1)] + Split { aye: _0, nay: _0 }, + #[codec(index = 2)] + SplitAbstain { aye: _0, nay: _0, abstain: _0 }, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct Casting<_0, _1, _2> { + pub votes: runtime_types::bounded_collections::bounded_vec::BoundedVec<( + _1, + runtime_types::pallet_conviction_voting::vote::AccountVote<_0>, + )>, + pub delegations: + runtime_types::pallet_conviction_voting::types::Delegations<_0>, + pub prior: runtime_types::pallet_conviction_voting::vote::PriorLock<_1, _0>, + #[codec(skip)] + pub __subxt_unused_type_params: ::core::marker::PhantomData<_2>, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct Delegating<_0, _1, _2> { + pub balance: _0, + pub target: _1, + pub conviction: runtime_types::pallet_conviction_voting::conviction::Conviction, + pub delegations: + runtime_types::pallet_conviction_voting::types::Delegations<_0>, + pub prior: runtime_types::pallet_conviction_voting::vote::PriorLock<_2, _0>, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct PriorLock<_0, _1>(pub _0, pub _1); + #[derive( + ::subxt::ext::codec::CompactAs, + Debug, + crate::gp::Decode, + crate::gp::DecodeAsType, + crate::gp::Encode, + )] + pub struct Vote(pub ::core::primitive::u8); + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum Voting<_0, _1, _2, _3> { + #[codec(index = 0)] + Casting(runtime_types::pallet_conviction_voting::vote::Casting<_0, _2, _2>), + #[codec(index = 1)] + Delegating( + runtime_types::pallet_conviction_voting::vote::Delegating<_0, _1, _2>, + ), + __Ignore(::core::marker::PhantomData<_3>), + } + } + } + pub mod pallet_election_provider_multi_phase { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + # [codec (index = 0)] # [doc = "Submit a solution for the unsigned phase."] # [doc = ""] # [doc = "The dispatch origin fo this call must be __none__."] # [doc = ""] # [doc = "This submission is checked on the fly. Moreover, this unsigned solution is only"] # [doc = "validated when submitted to the pool from the **local** node. Effectively, this means"] # [doc = "that only active validators can submit this transaction when authoring a block (similar"] # [doc = "to an inherent)."] # [doc = ""] # [doc = "To prevent any incorrect solution (and thus wasted time/weight), this transaction will"] # [doc = "panic if the solution submitted by the validator is invalid in any way, effectively"] # [doc = "putting their authoring reward at risk."] # [doc = ""] # [doc = "No deposit or reward is associated with this submission."] submit_unsigned { raw_solution: ::std::boxed::Box < runtime_types::pallet_election_provider_multi_phase::RawSolution < runtime_types::vara_runtime::NposSolution16 > > , witness : runtime_types::pallet_election_provider_multi_phase::SolutionOrSnapshotSize , } , # [codec (index = 1)] # [doc = "Set a new value for `MinimumUntrustedScore`."] # [doc = ""] # [doc = "Dispatch origin must be aligned with `T::ForceOrigin`."] # [doc = ""] # [doc = "This check can be turned off by setting the value to `None`."] set_minimum_untrusted_score { maybe_next_score: ::core::option::Option < runtime_types::sp_npos_elections::ElectionScore > , } , # [codec (index = 2)] # [doc = "Set a solution in the queue, to be handed out to the client of this pallet in the next"] # [doc = "call to `ElectionProvider::elect`."] # [doc = ""] # [doc = "This can only be set by `T::ForceOrigin`, and only when the phase is `Emergency`."] # [doc = ""] # [doc = "The solution is not checked for any feasibility and is assumed to be trustworthy, as any"] # [doc = "feasibility check itself can in principle cause the election process to fail (due to"] # [doc = "memory/weight constrains)."] set_emergency_election_result { supports: ::std::vec::Vec < (::subxt::utils::AccountId32 , runtime_types::sp_npos_elections::Support < ::subxt::utils::AccountId32 > ,) > , } , # [codec (index = 3)] # [doc = "Submit a solution for the signed phase."] # [doc = ""] # [doc = "The dispatch origin fo this call must be __signed__."] # [doc = ""] # [doc = "The solution is potentially queued, based on the claimed score and processed at the end"] # [doc = "of the signed phase."] # [doc = ""] # [doc = "A deposit is reserved and recorded for the solution. Based on the outcome, the solution"] # [doc = "might be rewarded, slashed, or get all or a part of the deposit back."] submit { raw_solution: ::std::boxed::Box < runtime_types::pallet_election_provider_multi_phase::RawSolution < runtime_types::vara_runtime::NposSolution16 > > , } , # [codec (index = 4)] # [doc = "Trigger the governance fallback."] # [doc = ""] # [doc = "This can only be called when [`Phase::Emergency`] is enabled, as an alternative to"] # [doc = "calling [`Call::set_emergency_election_result`]."] governance_fallback { maybe_max_voters: ::core::option::Option <::core::primitive::u32 > , maybe_max_targets: ::core::option::Option <::core::primitive::u32 > , } , } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "Error of the pallet that can be returned in response to dispatches."] + pub enum Error { + #[codec(index = 0)] + #[doc = "Submission was too early."] + PreDispatchEarlySubmission, + #[codec(index = 1)] + #[doc = "Wrong number of winners presented."] + PreDispatchWrongWinnerCount, + #[codec(index = 2)] + #[doc = "Submission was too weak, score-wise."] + PreDispatchWeakSubmission, + #[codec(index = 3)] + #[doc = "The queue was full, and the solution was not better than any of the existing ones."] + SignedQueueFull, + #[codec(index = 4)] + #[doc = "The origin failed to pay the deposit."] + SignedCannotPayDeposit, + #[codec(index = 5)] + #[doc = "Witness data to dispatchable is invalid."] + SignedInvalidWitness, + #[codec(index = 6)] + #[doc = "The signed submission consumes too much weight"] + SignedTooMuchWeight, + #[codec(index = 7)] + #[doc = "OCW submitted solution for wrong round"] + OcwCallWrongEra, + #[codec(index = 8)] + #[doc = "Snapshot metadata should exist but didn't."] + MissingSnapshotMetadata, + #[codec(index = 9)] + #[doc = "`Self::insert_submission` returned an invalid index."] + InvalidSubmissionIndex, + #[codec(index = 10)] + #[doc = "The call is not allowed at this point."] + CallNotAllowed, + #[codec(index = 11)] + #[doc = "The fallback failed"] + FallbackFailed, + #[codec(index = 12)] + #[doc = "Some bound not met"] + BoundNotMet, + #[codec(index = 13)] + #[doc = "Submitted solution has too many winners"] + TooManyWinners, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "A solution was stored with the given compute."] + #[doc = ""] + #[doc = "The `origin` indicates the origin of the solution. If `origin` is `Some(AccountId)`,"] + #[doc = "the stored solution was submited in the signed phase by a miner with the `AccountId`."] + #[doc = "Otherwise, the solution was stored either during the unsigned phase or by"] + #[doc = "`T::ForceOrigin`. The `bool` is `true` when a previous solution was ejected to make"] + #[doc = "room for this one."] + SolutionStored { + compute: + runtime_types::pallet_election_provider_multi_phase::ElectionCompute, + origin: ::core::option::Option<::subxt::utils::AccountId32>, + prev_ejected: ::core::primitive::bool, + }, + #[codec(index = 1)] + #[doc = "The election has been finalized, with the given computation and score."] + ElectionFinalized { + compute: + runtime_types::pallet_election_provider_multi_phase::ElectionCompute, + score: runtime_types::sp_npos_elections::ElectionScore, + }, + #[codec(index = 2)] + #[doc = "An election failed."] + #[doc = ""] + #[doc = "Not much can be said about which computes failed in the process."] + ElectionFailed, + #[codec(index = 3)] + #[doc = "An account has been rewarded for their signed submission being finalized."] + Rewarded { + account: ::subxt::utils::AccountId32, + value: ::core::primitive::u128, + }, + #[codec(index = 4)] + #[doc = "An account has been slashed for submitting an invalid signed submission."] + Slashed { + account: ::subxt::utils::AccountId32, + value: ::core::primitive::u128, + }, + #[codec(index = 5)] + #[doc = "There was a phase transition in a given round."] + PhaseTransitioned { + from: runtime_types::pallet_election_provider_multi_phase::Phase< + ::core::primitive::u32, + >, + to: runtime_types::pallet_election_provider_multi_phase::Phase< + ::core::primitive::u32, + >, + round: ::core::primitive::u32, + }, + } + } + pub mod signed { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct SignedSubmission<_0, _1, _2> { + pub who: _0, + pub deposit: _1, + pub raw_solution: + runtime_types::pallet_election_provider_multi_phase::RawSolution<_2>, + pub call_fee: _1, + } + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum ElectionCompute { + #[codec(index = 0)] + OnChain, + #[codec(index = 1)] + Signed, + #[codec(index = 2)] + Unsigned, + #[codec(index = 3)] + Fallback, + #[codec(index = 4)] + Emergency, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum Phase<_0> { + #[codec(index = 0)] + Off, + #[codec(index = 1)] + Signed, + #[codec(index = 2)] + Unsigned((::core::primitive::bool, _0)), + #[codec(index = 3)] + Emergency, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct RawSolution<_0> { + pub solution: _0, + pub score: runtime_types::sp_npos_elections::ElectionScore, + pub round: ::core::primitive::u32, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct ReadySolution { + pub supports: runtime_types::bounded_collections::bounded_vec::BoundedVec<( + ::subxt::utils::AccountId32, + runtime_types::sp_npos_elections::Support<::subxt::utils::AccountId32>, + )>, + pub score: runtime_types::sp_npos_elections::ElectionScore, + pub compute: runtime_types::pallet_election_provider_multi_phase::ElectionCompute, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct RoundSnapshot<_0, _1> { + pub voters: ::std::vec::Vec<_1>, + pub targets: ::std::vec::Vec<_0>, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct SolutionOrSnapshotSize { + #[codec(compact)] + pub voters: ::core::primitive::u32, + #[codec(compact)] + pub targets: ::core::primitive::u32, + } + } + pub mod pallet_gear { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Saves program `code` in storage."] + #[doc = ""] + #[doc = "The extrinsic was created to provide _deploy program from program_ functionality."] + #[doc = "Anyone who wants to define a \"factory\" logic in program should first store the code and metadata for the \"child\""] + #[doc = "program in storage. So the code for the child will be initialized by program initialization request only if it exists in storage."] + #[doc = ""] + #[doc = "More precisely, the code and its metadata are actually saved in the storage under the hash of the `code`. The code hash is computed"] + #[doc = "as Blake256 hash. At the time of the call the `code` hash should not be in the storage. If it was stored previously, call will end up"] + #[doc = "with an `CodeAlreadyExists` error. In this case user can be sure, that he can actually use the hash of his program's code bytes to define"] + #[doc = "\"program factory\" logic in his program."] + #[doc = ""] + #[doc = "Parameters"] + #[doc = "- `code`: wasm code of a program as a byte vector."] + #[doc = ""] + #[doc = "Emits the following events:"] + #[doc = "- `SavedCode(H256)` - when the code is saved in storage."] + upload_code { + code: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 1)] + #[doc = "Creates program initialization request (message), that is scheduled to be run in the same block."] + #[doc = ""] + #[doc = "There are no guarantees that initialization message will be run in the same block due to block"] + #[doc = "gas limit restrictions. For example, when it will be the message's turn, required gas limit for it"] + #[doc = "could be more than remaining block gas limit. Therefore, the message processing will be postponed"] + #[doc = "until the next block."] + #[doc = ""] + #[doc = "`ProgramId` is computed as Blake256 hash of concatenated bytes of `code` + `salt`. (todo #512 `code_hash` + `salt`)"] + #[doc = "Such `ProgramId` must not exist in the Program Storage at the time of this call."] + #[doc = ""] + #[doc = "There is the same guarantee here as in `upload_code`. That is, future program's"] + #[doc = "`code` and metadata are stored before message was added to the queue and processed."] + #[doc = ""] + #[doc = "The origin must be Signed and the sender must have sufficient funds to pay"] + #[doc = "for `gas` and `value` (in case the latter is being transferred)."] + #[doc = ""] + #[doc = "Parameters:"] + #[doc = "- `code`: wasm code of a program as a byte vector."] + #[doc = "- `salt`: randomness term (a seed) to allow programs with identical code"] + #[doc = " to be created independently."] + #[doc = "- `init_payload`: encoded parameters of the wasm module `init` function."] + #[doc = "- `gas_limit`: maximum amount of gas the program can spend before it is halted."] + #[doc = "- `value`: balance to be transferred to the program once it's been created."] + #[doc = ""] + #[doc = "Emits the following events:"] + #[doc = "- `InitMessageEnqueued(MessageInfo)` when init message is placed in the queue."] + #[doc = ""] + #[doc = "# Note"] + #[doc = "Faulty (uninitialized) programs still have a valid addresses (program ids) that can deterministically be derived on the"] + #[doc = "caller's side upfront. It means that if messages are sent to such an address, they might still linger in the queue."] + #[doc = ""] + #[doc = "In order to mitigate the risk of users' funds being sent to an address,"] + #[doc = "where a valid program should have resided, while it's not,"] + #[doc = "such \"failed-to-initialize\" programs are not silently deleted from the"] + #[doc = "program storage but rather marked as \"ghost\" programs."] + #[doc = "Ghost program can be removed by their original author via an explicit call."] + #[doc = "The funds stored by a ghost program will be release to the author once the program"] + #[doc = "has been removed."] + upload_program { + code: ::std::vec::Vec<::core::primitive::u8>, + salt: ::std::vec::Vec<::core::primitive::u8>, + init_payload: ::std::vec::Vec<::core::primitive::u8>, + gas_limit: ::core::primitive::u64, + value: ::core::primitive::u128, + }, + #[codec(index = 2)] + #[doc = "Creates program via `code_id` from storage."] + #[doc = ""] + #[doc = "Parameters:"] + #[doc = "- `code_id`: wasm code id in the code storage."] + #[doc = "- `salt`: randomness term (a seed) to allow programs with identical code"] + #[doc = " to be created independently."] + #[doc = "- `init_payload`: encoded parameters of the wasm module `init` function."] + #[doc = "- `gas_limit`: maximum amount of gas the program can spend before it is halted."] + #[doc = "- `value`: balance to be transferred to the program once it's been created."] + #[doc = ""] + #[doc = "Emits the following events:"] + #[doc = "- `InitMessageEnqueued(MessageInfo)` when init message is placed in the queue."] + #[doc = ""] + #[doc = "# NOTE"] + #[doc = ""] + #[doc = "For the details of this extrinsic, see `upload_code`."] + create_program { + code_id: runtime_types::gear_core::ids::CodeId, + salt: ::std::vec::Vec<::core::primitive::u8>, + init_payload: ::std::vec::Vec<::core::primitive::u8>, + gas_limit: ::core::primitive::u64, + value: ::core::primitive::u128, + }, + #[codec(index = 3)] + #[doc = "Sends a message to a program or to another account."] + #[doc = ""] + #[doc = "The origin must be Signed and the sender must have sufficient funds to pay"] + #[doc = "for `gas` and `value` (in case the latter is being transferred)."] + #[doc = ""] + #[doc = "To avoid an undefined behavior a check is made that the destination address"] + #[doc = "is not a program in uninitialized state. If the opposite holds true,"] + #[doc = "the message is not enqueued for processing."] + #[doc = ""] + #[doc = "If `prepaid` flag is set, the transaction fee and the gas cost will be"] + #[doc = "charged against a `voucher` that must have been issued for the sender"] + #[doc = "in conjunction with the `destination` program. That means that the"] + #[doc = "synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must"] + #[doc = "exist and have sufficient funds in it. Otherwise, the call is invalidated."] + #[doc = ""] + #[doc = "Parameters:"] + #[doc = "- `destination`: the message destination."] + #[doc = "- `payload`: in case of a program destination, parameters of the `handle` function."] + #[doc = "- `gas_limit`: maximum amount of gas the program can spend before it is halted."] + #[doc = "- `value`: balance to be transferred to the program once it's been created."] + #[doc = "- `prepaid`: a flag that indicates whether a voucher should be used."] + #[doc = ""] + #[doc = "Emits the following events:"] + #[doc = "- `DispatchMessageEnqueued(MessageInfo)` when dispatch message is placed in the queue."] + send_message { + destination: runtime_types::gear_core::ids::ProgramId, + payload: ::std::vec::Vec<::core::primitive::u8>, + gas_limit: ::core::primitive::u64, + value: ::core::primitive::u128, + prepaid: ::core::primitive::bool, + }, + #[codec(index = 4)] + #[doc = "Send reply on message in `Mailbox`."] + #[doc = ""] + #[doc = "Removes message by given `MessageId` from callers `Mailbox`:"] + #[doc = "rent funds become free, associated with the message value"] + #[doc = "transfers from message sender to extrinsic caller."] + #[doc = ""] + #[doc = "Generates reply on removed message with given parameters"] + #[doc = "and pushes it in `MessageQueue`."] + #[doc = ""] + #[doc = "NOTE: source of the message in mailbox guaranteed to be a program."] + #[doc = ""] + #[doc = "NOTE: only user who is destination of the message, can claim value"] + #[doc = "or reply on the message from mailbox."] + #[doc = ""] + #[doc = "If `prepaid` flag is set, the transaction fee and the gas cost will be"] + #[doc = "charged against a `voucher` that must have been issued for the sender"] + #[doc = "in conjunction with the mailboxed message source program. That means that the"] + #[doc = "synthetic account corresponding to the (`AccountId`, `ProgramId`) pair must"] + #[doc = "exist and have sufficient funds in it. Otherwise, the call is invalidated."] + send_reply { + reply_to_id: runtime_types::gear_core::ids::MessageId, + payload: ::std::vec::Vec<::core::primitive::u8>, + gas_limit: ::core::primitive::u64, + value: ::core::primitive::u128, + prepaid: ::core::primitive::bool, + }, + #[codec(index = 5)] + #[doc = "Claim value from message in `Mailbox`."] + #[doc = ""] + #[doc = "Removes message by given `MessageId` from callers `Mailbox`:"] + #[doc = "rent funds become free, associated with the message value"] + #[doc = "transfers from message sender to extrinsic caller."] + #[doc = ""] + #[doc = "NOTE: only user who is destination of the message, can claim value"] + #[doc = "or reply on the message from mailbox."] + claim_value { + message_id: runtime_types::gear_core::ids::MessageId, + }, + #[codec(index = 6)] + #[doc = "Process message queue"] + run { + max_gas: ::core::option::Option<::core::primitive::u64>, + }, + #[codec(index = 7)] + #[doc = "Sets `ExecuteInherent` flag."] + #[doc = ""] + #[doc = "Requires root origin (eventually, will only be set via referendum)"] + set_execute_inherent { value: ::core::primitive::bool }, + #[codec(index = 8)] + #[doc = "Pay additional rent for the program."] + pay_program_rent { + program_id: runtime_types::gear_core::ids::ProgramId, + block_count: ::core::primitive::u32, + }, + #[codec(index = 9)] + #[doc = "Starts a resume session of the previously paused program."] + #[doc = ""] + #[doc = "The origin must be Signed."] + #[doc = ""] + #[doc = "Parameters:"] + #[doc = "- `program_id`: id of the program to resume."] + #[doc = "- `allocations`: memory allocations of program prior to stop."] + #[doc = "- `code_hash`: id of the program binary code."] + resume_session_init { + program_id: runtime_types::gear_core::ids::ProgramId, + allocations: ::std::vec::Vec, + code_hash: runtime_types::gear_core::ids::CodeId, + }, + #[codec(index = 10)] + #[doc = "Appends memory pages to the resume session."] + #[doc = ""] + #[doc = "The origin must be Signed and should be the owner of the session."] + #[doc = ""] + #[doc = "Parameters:"] + #[doc = "- `session_id`: id of the resume session."] + #[doc = "- `memory_pages`: program memory (or its part) before it was paused."] + resume_session_push { + session_id: ::core::primitive::u128, + memory_pages: ::std::vec::Vec<( + runtime_types::gear_core::pages::GearPage, + runtime_types::gear_core::memory::PageBuf, + )>, + }, + #[codec(index = 11)] + #[doc = "Finishes the program resume session."] + #[doc = ""] + #[doc = "The origin must be Signed and should be the owner of the session."] + #[doc = ""] + #[doc = "Parameters:"] + #[doc = "- `session_id`: id of the resume session."] + #[doc = "- `block_count`: the specified period of rent."] + resume_session_commit { + session_id: ::core::primitive::u128, + block_count: ::core::primitive::u32, }, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] @@ -3357,72 +4053,315 @@ pub mod runtime_types { #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] pub enum Error { #[codec(index = 0)] - #[doc = "Non existent public key."] - InvalidKey, + #[doc = "Non existent public key."] + InvalidKey, + #[codec(index = 1)] + #[doc = "Duplicated heartbeat."] + DuplicatedHeartbeat, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + pub enum Event { + #[codec(index = 0)] + #[doc = "A new heartbeat was received from `AuthorityId`."] + HeartbeatReceived { + authority_id: runtime_types::pallet_im_online::sr25519::app_sr25519::Public, + }, + #[codec(index = 1)] + #[doc = "At the end of the session, no offence was committed."] + AllGood, + #[codec(index = 2)] + #[doc = "At the end of the session, at least one validator was found to be offline."] + SomeOffline { + offline: ::std::vec::Vec<( + ::subxt::utils::AccountId32, + runtime_types::pallet_staking::Exposure< + ::subxt::utils::AccountId32, + ::core::primitive::u128, + >, + )>, + }, + } + } + pub mod sr25519 { + use super::runtime_types; + pub mod app_sr25519 { + use super::runtime_types; + #[derive( + Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode, + )] + pub struct Public(pub runtime_types::sp_core::sr25519::Public); + #[derive( + Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode, + )] + pub struct Signature(pub runtime_types::sp_core::sr25519::Signature); + } + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct BoundedOpaqueNetworkState { + pub peer_id: runtime_types::bounded_collections::weak_bounded_vec::WeakBoundedVec< + ::core::primitive::u8, + >, + pub external_addresses: + runtime_types::bounded_collections::weak_bounded_vec::WeakBoundedVec< + runtime_types::bounded_collections::weak_bounded_vec::WeakBoundedVec< + ::core::primitive::u8, + >, + >, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct Heartbeat<_0> { + pub block_number: _0, + pub network_state: runtime_types::sp_core::offchain::OpaqueNetworkState, + pub session_index: _0, + pub authority_index: _0, + pub validators_len: _0, + } + } + pub mod pallet_multisig { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] + pub enum Call { + #[codec(index = 0)] + #[doc = "Immediately dispatch a multi-signature call using a single approval from the caller."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `other_signatories`: The accounts (other than the sender) who are part of the"] + #[doc = "multi-signature, but do not participate in the approval process."] + #[doc = "- `call`: The call to be executed."] + #[doc = ""] + #[doc = "Result is equivalent to the dispatched result."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "O(Z + C) where Z is the length of the call and C its execution weight."] + as_multi_threshold_1 { + other_signatories: ::std::vec::Vec<::subxt::utils::AccountId32>, + call: ::std::boxed::Box, + }, + #[codec(index = 1)] + #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] + #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] + #[doc = ""] + #[doc = "If there are enough, then dispatch the call."] + #[doc = ""] + #[doc = "Payment: `DepositBase` will be reserved if this is the first approval, plus"] + #[doc = "`threshold` times `DepositFactor`. It is returned once this dispatch happens or"] + #[doc = "is cancelled."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] + #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] + #[doc = "dispatch. May not be empty."] + #[doc = "- `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is"] + #[doc = "not the first approval, then it must be `Some`, with the timepoint (block number and"] + #[doc = "transaction index) of the first approval transaction."] + #[doc = "- `call`: The call to be executed."] + #[doc = ""] + #[doc = "NOTE: Unless this is the final approval, you will generally want to use"] + #[doc = "`approve_as_multi` instead, since it only requires a hash of the call."] + #[doc = ""] + #[doc = "Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise"] + #[doc = "on success, result is `Ok` and the result from the interior call, if it was executed,"] + #[doc = "may be found in the deposited `MultisigExecuted` event."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- `O(S + Z + Call)`."] + #[doc = "- Up to one balance-reserve or unreserve operation."] + #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] + #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] + #[doc = "- One call encode & hash, both of complexity `O(Z)` where `Z` is tx-len."] + #[doc = "- One encode & hash, both of complexity `O(S)`."] + #[doc = "- Up to one binary search and insert (`O(logS + S)`)."] + #[doc = "- I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove."] + #[doc = "- One event."] + #[doc = "- The weight of the `call`."] + #[doc = "- Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit"] + #[doc = " taken for its lifetime of `DepositBase + threshold * DepositFactor`."] + as_multi { + threshold: ::core::primitive::u16, + other_signatories: ::std::vec::Vec<::subxt::utils::AccountId32>, + maybe_timepoint: ::core::option::Option< + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + >, + call: ::std::boxed::Box, + max_weight: runtime_types::sp_weights::weight_v2::Weight, + }, + #[codec(index = 2)] + #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] + #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] + #[doc = ""] + #[doc = "Payment: `DepositBase` will be reserved if this is the first approval, plus"] + #[doc = "`threshold` times `DepositFactor`. It is returned once this dispatch happens or"] + #[doc = "is cancelled."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] + #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] + #[doc = "dispatch. May not be empty."] + #[doc = "- `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is"] + #[doc = "not the first approval, then it must be `Some`, with the timepoint (block number and"] + #[doc = "transaction index) of the first approval transaction."] + #[doc = "- `call_hash`: The hash of the call to be executed."] + #[doc = ""] + #[doc = "NOTE: If this is the final approval, you will want to use `as_multi` instead."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- `O(S)`."] + #[doc = "- Up to one balance-reserve or unreserve operation."] + #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] + #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] + #[doc = "- One encode & hash, both of complexity `O(S)`."] + #[doc = "- Up to one binary search and insert (`O(logS + S)`)."] + #[doc = "- I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove."] + #[doc = "- One event."] + #[doc = "- Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit"] + #[doc = " taken for its lifetime of `DepositBase + threshold * DepositFactor`."] + approve_as_multi { + threshold: ::core::primitive::u16, + other_signatories: ::std::vec::Vec<::subxt::utils::AccountId32>, + maybe_timepoint: ::core::option::Option< + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + >, + call_hash: [::core::primitive::u8; 32usize], + max_weight: runtime_types::sp_weights::weight_v2::Weight, + }, + #[codec(index = 3)] + #[doc = "Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously"] + #[doc = "for this operation will be unreserved on success."] + #[doc = ""] + #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = ""] + #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] + #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] + #[doc = "dispatch. May not be empty."] + #[doc = "- `timepoint`: The timepoint (block number and transaction index) of the first approval"] + #[doc = "transaction for this dispatch."] + #[doc = "- `call_hash`: The hash of the call to be executed."] + #[doc = ""] + #[doc = "## Complexity"] + #[doc = "- `O(S)`."] + #[doc = "- Up to one balance-reserve or unreserve operation."] + #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] + #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] + #[doc = "- One encode & hash, both of complexity `O(S)`."] + #[doc = "- One event."] + #[doc = "- I/O: 1 read `O(S)`, one remove."] + #[doc = "- Storage: removes one item."] + cancel_as_multi { + threshold: ::core::primitive::u16, + other_signatories: ::std::vec::Vec<::subxt::utils::AccountId32>, + timepoint: + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + call_hash: [::core::primitive::u8; 32usize], + }, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Threshold must be 2 or greater."] + MinimumThreshold, #[codec(index = 1)] - #[doc = "Duplicated heartbeat."] - DuplicatedHeartbeat, + #[doc = "Call is already approved by this signatory."] + AlreadyApproved, + #[codec(index = 2)] + #[doc = "Call doesn't need any (more) approvals."] + NoApprovalsNeeded, + #[codec(index = 3)] + #[doc = "There are too few signatories in the list."] + TooFewSignatories, + #[codec(index = 4)] + #[doc = "There are too many signatories in the list."] + TooManySignatories, + #[codec(index = 5)] + #[doc = "The signatories were provided out of order; they should be ordered."] + SignatoriesOutOfOrder, + #[codec(index = 6)] + #[doc = "The sender was contained in the other signatories; it shouldn't be."] + SenderInSignatories, + #[codec(index = 7)] + #[doc = "Multisig operation not found when attempting to cancel."] + NotFound, + #[codec(index = 8)] + #[doc = "Only the account that originally created the multisig is able to cancel it."] + NotOwner, + #[codec(index = 9)] + #[doc = "No timepoint was given, yet the multisig operation is already underway."] + NoTimepoint, + #[codec(index = 10)] + #[doc = "A different timepoint was given to the multisig operation that is underway."] + WrongTimepoint, + #[codec(index = 11)] + #[doc = "A timepoint was given, yet no multisig operation is underway."] + UnexpectedTimepoint, + #[codec(index = 12)] + #[doc = "The maximum weight information provided was too low."] + MaxWeightTooLow, + #[codec(index = 13)] + #[doc = "The data to be stored is already stored."] + AlreadyStored, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] pub enum Event { #[codec(index = 0)] - #[doc = "A new heartbeat was received from `AuthorityId`."] - HeartbeatReceived { - authority_id: runtime_types::pallet_im_online::sr25519::app_sr25519::Public, + #[doc = "A new multisig operation has begun."] + NewMultisig { + approving: ::subxt::utils::AccountId32, + multisig: ::subxt::utils::AccountId32, + call_hash: [::core::primitive::u8; 32usize], }, #[codec(index = 1)] - #[doc = "At the end of the session, no offence was committed."] - AllGood, + #[doc = "A multisig operation has been approved by someone."] + MultisigApproval { + approving: ::subxt::utils::AccountId32, + timepoint: + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + multisig: ::subxt::utils::AccountId32, + call_hash: [::core::primitive::u8; 32usize], + }, #[codec(index = 2)] - #[doc = "At the end of the session, at least one validator was found to be offline."] - SomeOffline { - offline: ::std::vec::Vec<( - ::subxt::utils::AccountId32, - runtime_types::pallet_staking::Exposure< - ::subxt::utils::AccountId32, - ::core::primitive::u128, - >, - )>, + #[doc = "A multisig operation has been executed."] + MultisigExecuted { + approving: ::subxt::utils::AccountId32, + timepoint: + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + multisig: ::subxt::utils::AccountId32, + call_hash: [::core::primitive::u8; 32usize], + result: + ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + }, + #[codec(index = 3)] + #[doc = "A multisig operation has been cancelled."] + MultisigCancelled { + cancelling: ::subxt::utils::AccountId32, + timepoint: + runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + multisig: ::subxt::utils::AccountId32, + call_hash: [::core::primitive::u8; 32usize], }, - } - } - pub mod sr25519 { - use super::runtime_types; - pub mod app_sr25519 { - use super::runtime_types; - #[derive( - Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode, - )] - pub struct Public(pub runtime_types::sp_core::sr25519::Public); - #[derive( - Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode, - )] - pub struct Signature(pub runtime_types::sp_core::sr25519::Signature); } } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct BoundedOpaqueNetworkState { - pub peer_id: runtime_types::bounded_collections::weak_bounded_vec::WeakBoundedVec< - ::core::primitive::u8, - >, - pub external_addresses: - runtime_types::bounded_collections::weak_bounded_vec::WeakBoundedVec< - runtime_types::bounded_collections::weak_bounded_vec::WeakBoundedVec< - ::core::primitive::u8, - >, - >, + pub struct Multisig<_0, _1, _2> { + pub when: runtime_types::pallet_multisig::Timepoint<_0>, + pub deposit: _1, + pub depositor: _2, + pub approvals: runtime_types::bounded_collections::bounded_vec::BoundedVec<_2>, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct Heartbeat<_0> { - pub block_number: _0, - pub network_state: runtime_types::sp_core::offchain::OpaqueNetworkState, - pub session_index: _0, - pub authority_index: _0, - pub validators_len: _0, + pub struct Timepoint<_0> { + pub height: _0, + pub index: _0, } } - pub mod pallet_multisig { + pub mod pallet_nomination_pools { use super::runtime_types; pub mod pallet { use super::runtime_types; @@ -3430,240 +4369,699 @@ pub mod runtime_types { #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] pub enum Call { #[codec(index = 0)] - #[doc = "Immediately dispatch a multi-signature call using a single approval from the caller."] + #[doc = "Stake funds with a pool. The amount to bond is transferred from the member to the"] + #[doc = "pools account and immediately increases the pools bond."] #[doc = ""] - #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = "# Note"] #[doc = ""] - #[doc = "- `other_signatories`: The accounts (other than the sender) who are part of the"] - #[doc = "multi-signature, but do not participate in the approval process."] - #[doc = "- `call`: The call to be executed."] + #[doc = "* An account can only be a member of a single pool."] + #[doc = "* An account cannot join the same pool multiple times."] + #[doc = "* This call will *not* dust the member account, so the member must have at least"] + #[doc = " `existential deposit + amount` in their account."] + #[doc = "* Only a pool with [`PoolState::Open`] can be joined"] + join { + #[codec(compact)] + amount: ::core::primitive::u128, + pool_id: ::core::primitive::u32, + }, + #[codec(index = 1)] + #[doc = "Bond `extra` more funds from `origin` into the pool to which they already belong."] #[doc = ""] - #[doc = "Result is equivalent to the dispatched result."] + #[doc = "Additional funds can come from either the free balance of the account, of from the"] + #[doc = "accumulated rewards, see [`BondExtra`]."] #[doc = ""] - #[doc = "## Complexity"] - #[doc = "O(Z + C) where Z is the length of the call and C its execution weight."] - as_multi_threshold_1 { - other_signatories: ::std::vec::Vec<::subxt::utils::AccountId32>, - call: ::std::boxed::Box, + #[doc = "Bonding extra funds implies an automatic payout of all pending rewards as well."] + #[doc = "See `bond_extra_other` to bond pending rewards of `other` members."] + bond_extra { + extra: runtime_types::pallet_nomination_pools::BondExtra< + ::core::primitive::u128, + >, }, - #[codec(index = 1)] - #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] - #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] + #[codec(index = 2)] + #[doc = "A bonded member can use this to claim their payout based on the rewards that the pool"] + #[doc = "has accumulated since their last claimed payout (OR since joining if this is their first"] + #[doc = "time claiming rewards). The payout will be transferred to the member's account."] #[doc = ""] - #[doc = "If there are enough, then dispatch the call."] + #[doc = "The member will earn rewards pro rata based on the members stake vs the sum of the"] + #[doc = "members in the pools stake. Rewards do not \"expire\"."] #[doc = ""] - #[doc = "Payment: `DepositBase` will be reserved if this is the first approval, plus"] - #[doc = "`threshold` times `DepositFactor`. It is returned once this dispatch happens or"] - #[doc = "is cancelled."] + #[doc = "See `claim_payout_other` to caim rewards on bahalf of some `other` pool member."] + claim_payout, + #[codec(index = 3)] + #[doc = "Unbond up to `unbonding_points` of the `member_account`'s funds from the pool. It"] + #[doc = "implicitly collects the rewards one last time, since not doing so would mean some"] + #[doc = "rewards would be forfeited."] #[doc = ""] - #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = "Under certain conditions, this call can be dispatched permissionlessly (i.e. by any"] + #[doc = "account)."] #[doc = ""] - #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] - #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] - #[doc = "dispatch. May not be empty."] - #[doc = "- `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is"] - #[doc = "not the first approval, then it must be `Some`, with the timepoint (block number and"] - #[doc = "transaction index) of the first approval transaction."] - #[doc = "- `call`: The call to be executed."] + #[doc = "# Conditions for a permissionless dispatch."] #[doc = ""] - #[doc = "NOTE: Unless this is the final approval, you will generally want to use"] - #[doc = "`approve_as_multi` instead, since it only requires a hash of the call."] + #[doc = "* The pool is blocked and the caller is either the root or bouncer. This is refereed to"] + #[doc = " as a kick."] + #[doc = "* The pool is destroying and the member is not the depositor."] + #[doc = "* The pool is destroying, the member is the depositor and no other members are in the"] + #[doc = " pool."] #[doc = ""] - #[doc = "Result is equivalent to the dispatched result if `threshold` is exactly `1`. Otherwise"] - #[doc = "on success, result is `Ok` and the result from the interior call, if it was executed,"] - #[doc = "may be found in the deposited `MultisigExecuted` event."] + #[doc = "## Conditions for permissioned dispatch (i.e. the caller is also the"] + #[doc = "`member_account`):"] #[doc = ""] - #[doc = "## Complexity"] - #[doc = "- `O(S + Z + Call)`."] - #[doc = "- Up to one balance-reserve or unreserve operation."] - #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] - #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] - #[doc = "- One call encode & hash, both of complexity `O(Z)` where `Z` is tx-len."] - #[doc = "- One encode & hash, both of complexity `O(S)`."] - #[doc = "- Up to one binary search and insert (`O(logS + S)`)."] - #[doc = "- I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove."] - #[doc = "- One event."] - #[doc = "- The weight of the `call`."] - #[doc = "- Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit"] - #[doc = " taken for its lifetime of `DepositBase + threshold * DepositFactor`."] - as_multi { - threshold: ::core::primitive::u16, - other_signatories: ::std::vec::Vec<::subxt::utils::AccountId32>, - maybe_timepoint: ::core::option::Option< - runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, + #[doc = "* The caller is not the depositor."] + #[doc = "* The caller is the depositor, the pool is destroying and no other members are in the"] + #[doc = " pool."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "If there are too many unlocking chunks to unbond with the pool account,"] + #[doc = "[`Call::pool_withdraw_unbonded`] can be called to try and minimize unlocking chunks."] + #[doc = "The [`StakingInterface::unbond`] will implicitly call [`Call::pool_withdraw_unbonded`]"] + #[doc = "to try to free chunks if necessary (ie. if unbound was called and no unlocking chunks"] + #[doc = "are available). However, it may not be possible to release the current unlocking chunks,"] + #[doc = "in which case, the result of this call will likely be the `NoMoreChunks` error from the"] + #[doc = "staking system."] + unbond { + member_account: + ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + #[codec(compact)] + unbonding_points: ::core::primitive::u128, + }, + #[codec(index = 4)] + #[doc = "Call `withdraw_unbonded` for the pools account. This call can be made by any account."] + #[doc = ""] + #[doc = "This is useful if their are too many unlocking chunks to call `unbond`, and some"] + #[doc = "can be cleared by withdrawing. In the case there are too many unlocking chunks, the user"] + #[doc = "would probably see an error like `NoMoreChunks` emitted from the staking system when"] + #[doc = "they attempt to unbond."] + pool_withdraw_unbonded { + pool_id: ::core::primitive::u32, + num_slashing_spans: ::core::primitive::u32, + }, + #[codec(index = 5)] + #[doc = "Withdraw unbonded funds from `member_account`. If no bonded funds can be unbonded, an"] + #[doc = "error is returned."] + #[doc = ""] + #[doc = "Under certain conditions, this call can be dispatched permissionlessly (i.e. by any"] + #[doc = "account)."] + #[doc = ""] + #[doc = "# Conditions for a permissionless dispatch"] + #[doc = ""] + #[doc = "* The pool is in destroy mode and the target is not the depositor."] + #[doc = "* The target is the depositor and they are the only member in the sub pools."] + #[doc = "* The pool is blocked and the caller is either the root or bouncer."] + #[doc = ""] + #[doc = "# Conditions for permissioned dispatch"] + #[doc = ""] + #[doc = "* The caller is the target and they are not the depositor."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "If the target is the depositor, the pool will be destroyed."] + withdraw_unbonded { + member_account: + ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + num_slashing_spans: ::core::primitive::u32, + }, + #[codec(index = 6)] + #[doc = "Create a new delegation pool."] + #[doc = ""] + #[doc = "# Arguments"] + #[doc = ""] + #[doc = "* `amount` - The amount of funds to delegate to the pool. This also acts of a sort of"] + #[doc = " deposit since the pools creator cannot fully unbond funds until the pool is being"] + #[doc = " destroyed."] + #[doc = "* `index` - A disambiguation index for creating the account. Likely only useful when"] + #[doc = " creating multiple pools in the same extrinsic."] + #[doc = "* `root` - The account to set as [`PoolRoles::root`]."] + #[doc = "* `nominator` - The account to set as the [`PoolRoles::nominator`]."] + #[doc = "* `bouncer` - The account to set as the [`PoolRoles::bouncer`]."] + #[doc = ""] + #[doc = "# Note"] + #[doc = ""] + #[doc = "In addition to `amount`, the caller will transfer the existential deposit; so the caller"] + #[doc = "needs at have at least `amount + existential_deposit` transferrable."] + create { + #[codec(compact)] + amount: ::core::primitive::u128, + root: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + nominator: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + bouncer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + }, + #[codec(index = 7)] + #[doc = "Create a new delegation pool with a previously used pool id"] + #[doc = ""] + #[doc = "# Arguments"] + #[doc = ""] + #[doc = "same as `create` with the inclusion of"] + #[doc = "* `pool_id` - `A valid PoolId."] + create_with_pool_id { + #[codec(compact)] + amount: ::core::primitive::u128, + root: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + nominator: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + bouncer: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + pool_id: ::core::primitive::u32, + }, + #[codec(index = 8)] + #[doc = "Nominate on behalf of the pool."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be signed by the pool nominator or the pool"] + #[doc = "root role."] + #[doc = ""] + #[doc = "This directly forward the call to the staking pallet, on behalf of the pool bonded"] + #[doc = "account."] + nominate { + pool_id: ::core::primitive::u32, + validators: ::std::vec::Vec<::subxt::utils::AccountId32>, + }, + #[codec(index = 9)] + #[doc = "Set a new state for the pool."] + #[doc = ""] + #[doc = "If a pool is already in the `Destroying` state, then under no condition can its state"] + #[doc = "change again."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be either:"] + #[doc = ""] + #[doc = "1. signed by the bouncer, or the root role of the pool,"] + #[doc = "2. if the pool conditions to be open are NOT met (as described by `ok_to_be_open`), and"] + #[doc = " then the state of the pool can be permissionlessly changed to `Destroying`."] + set_state { + pool_id: ::core::primitive::u32, + state: runtime_types::pallet_nomination_pools::PoolState, + }, + #[codec(index = 10)] + #[doc = "Set a new metadata for the pool."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be signed by the bouncer, or the root role of the"] + #[doc = "pool."] + set_metadata { + pool_id: ::core::primitive::u32, + metadata: ::std::vec::Vec<::core::primitive::u8>, + }, + #[codec(index = 11)] + #[doc = "Update configurations for the nomination pools. The origin for this call must be"] + #[doc = "Root."] + #[doc = ""] + #[doc = "# Arguments"] + #[doc = ""] + #[doc = "* `min_join_bond` - Set [`MinJoinBond`]."] + #[doc = "* `min_create_bond` - Set [`MinCreateBond`]."] + #[doc = "* `max_pools` - Set [`MaxPools`]."] + #[doc = "* `max_members` - Set [`MaxPoolMembers`]."] + #[doc = "* `max_members_per_pool` - Set [`MaxPoolMembersPerPool`]."] + #[doc = "* `global_max_commission` - Set [`GlobalMaxCommission`]."] + set_configs { + min_join_bond: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u128, + >, + min_create_bond: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u128, + >, + max_pools: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u32, + >, + max_members: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u32, + >, + max_members_per_pool: runtime_types::pallet_nomination_pools::ConfigOp< + ::core::primitive::u32, + >, + global_max_commission: runtime_types::pallet_nomination_pools::ConfigOp< + runtime_types::sp_arithmetic::per_things::Perbill, + >, + }, + #[codec(index = 12)] + #[doc = "Update the roles of the pool."] + #[doc = ""] + #[doc = "The root is the only entity that can change any of the roles, including itself,"] + #[doc = "excluding the depositor, who can never change."] + #[doc = ""] + #[doc = "It emits an event, notifying UIs of the role change. This event is quite relevant to"] + #[doc = "most pool members and they should be informed of changes to pool roles."] + update_roles { + pool_id: ::core::primitive::u32, + new_root: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::utils::AccountId32, + >, + new_nominator: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::utils::AccountId32, + >, + new_bouncer: runtime_types::pallet_nomination_pools::ConfigOp< + ::subxt::utils::AccountId32, >, - call: ::std::boxed::Box, - max_weight: runtime_types::sp_weights::weight_v2::Weight, }, - #[codec(index = 2)] - #[doc = "Register approval for a dispatch to be made from a deterministic composite account if"] - #[doc = "approved by a total of `threshold - 1` of `other_signatories`."] + #[codec(index = 13)] + #[doc = "Chill on behalf of the pool."] #[doc = ""] - #[doc = "Payment: `DepositBase` will be reserved if this is the first approval, plus"] - #[doc = "`threshold` times `DepositFactor`. It is returned once this dispatch happens or"] - #[doc = "is cancelled."] + #[doc = "The dispatch origin of this call must be signed by the pool nominator or the pool"] + #[doc = "root role, same as [`Pallet::nominate`]."] #[doc = ""] - #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = "This directly forward the call to the staking pallet, on behalf of the pool bonded"] + #[doc = "account."] + chill { pool_id: ::core::primitive::u32 }, + #[codec(index = 14)] + #[doc = "`origin` bonds funds from `extra` for some pool member `member` into their respective"] + #[doc = "pools."] + #[doc = ""] + #[doc = "`origin` can bond extra funds from free balance or pending rewards when `origin =="] + #[doc = "other`."] + #[doc = ""] + #[doc = "In the case of `origin != other`, `origin` can only bond extra pending rewards of"] + #[doc = "`other` members assuming set_claim_permission for the given member is"] + #[doc = "`PermissionlessAll` or `PermissionlessCompound`."] + bond_extra_other { + member: ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, + extra: runtime_types::pallet_nomination_pools::BondExtra< + ::core::primitive::u128, + >, + }, + #[codec(index = 15)] + #[doc = "Allows a pool member to set a claim permission to allow or disallow permissionless"] + #[doc = "bonding and withdrawing."] #[doc = ""] - #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] - #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] - #[doc = "dispatch. May not be empty."] - #[doc = "- `maybe_timepoint`: If this is the first approval, then this must be `None`. If it is"] - #[doc = "not the first approval, then it must be `Some`, with the timepoint (block number and"] - #[doc = "transaction index) of the first approval transaction."] - #[doc = "- `call_hash`: The hash of the call to be executed."] + #[doc = "By default, this is `Permissioned`, which implies only the pool member themselves can"] + #[doc = "claim their pending rewards. If a pool member wishes so, they can set this to"] + #[doc = "`PermissionlessAll` to allow any account to claim their rewards and bond extra to the"] + #[doc = "pool."] #[doc = ""] - #[doc = "NOTE: If this is the final approval, you will want to use `as_multi` instead."] + #[doc = "# Arguments"] #[doc = ""] - #[doc = "## Complexity"] - #[doc = "- `O(S)`."] - #[doc = "- Up to one balance-reserve or unreserve operation."] - #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] - #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] - #[doc = "- One encode & hash, both of complexity `O(S)`."] - #[doc = "- Up to one binary search and insert (`O(logS + S)`)."] - #[doc = "- I/O: 1 read `O(S)`, up to 1 mutate `O(S)`. Up to one remove."] - #[doc = "- One event."] - #[doc = "- Storage: inserts one item, value size bounded by `MaxSignatories`, with a deposit"] - #[doc = " taken for its lifetime of `DepositBase + threshold * DepositFactor`."] - approve_as_multi { - threshold: ::core::primitive::u16, - other_signatories: ::std::vec::Vec<::subxt::utils::AccountId32>, - maybe_timepoint: ::core::option::Option< - runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, - >, - call_hash: [::core::primitive::u8; 32usize], - max_weight: runtime_types::sp_weights::weight_v2::Weight, + #[doc = "* `origin` - Member of a pool."] + #[doc = "* `actor` - Account to claim reward. // improve this"] + set_claim_permission { + permission: runtime_types::pallet_nomination_pools::ClaimPermission, }, - #[codec(index = 3)] - #[doc = "Cancel a pre-existing, on-going multisig transaction. Any deposit reserved previously"] - #[doc = "for this operation will be unreserved on success."] + #[codec(index = 16)] + #[doc = "`origin` can claim payouts on some pool member `other`'s behalf."] #[doc = ""] - #[doc = "The dispatch origin for this call must be _Signed_."] + #[doc = "Pool member `other` must have a `PermissionlessAll` or `PermissionlessWithdraw` in order"] + #[doc = "for this call to be successful."] + claim_payout_other { other: ::subxt::utils::AccountId32 }, + #[codec(index = 17)] + #[doc = "Set the commission of a pool."] + #[doc = "Both a commission percentage and a commission payee must be provided in the `current`"] + #[doc = "tuple. Where a `current` of `None` is provided, any current commission will be removed."] + #[doc = ""] + #[doc = "- If a `None` is supplied to `new_commission`, existing commission will be removed."] + set_commission { + pool_id: ::core::primitive::u32, + new_commission: ::core::option::Option<( + runtime_types::sp_arithmetic::per_things::Perbill, + ::subxt::utils::AccountId32, + )>, + }, + #[codec(index = 18)] + #[doc = "Set the maximum commission of a pool."] #[doc = ""] - #[doc = "- `threshold`: The total number of approvals for this dispatch before it is executed."] - #[doc = "- `other_signatories`: The accounts (other than the sender) who can approve this"] - #[doc = "dispatch. May not be empty."] - #[doc = "- `timepoint`: The timepoint (block number and transaction index) of the first approval"] - #[doc = "transaction for this dispatch."] - #[doc = "- `call_hash`: The hash of the call to be executed."] + #[doc = "- Initial max can be set to any `Perbill`, and only smaller values thereafter."] + #[doc = "- Current commission will be lowered in the event it is higher than a new max"] + #[doc = " commission."] + set_commission_max { + pool_id: ::core::primitive::u32, + max_commission: runtime_types::sp_arithmetic::per_things::Perbill, + }, + #[codec(index = 19)] + #[doc = "Set the commission change rate for a pool."] #[doc = ""] - #[doc = "## Complexity"] - #[doc = "- `O(S)`."] - #[doc = "- Up to one balance-reserve or unreserve operation."] - #[doc = "- One passthrough operation, one insert, both `O(S)` where `S` is the number of"] - #[doc = " signatories. `S` is capped by `MaxSignatories`, with weight being proportional."] - #[doc = "- One encode & hash, both of complexity `O(S)`."] - #[doc = "- One event."] - #[doc = "- I/O: 1 read `O(S)`, one remove."] - #[doc = "- Storage: removes one item."] - cancel_as_multi { - threshold: ::core::primitive::u16, - other_signatories: ::std::vec::Vec<::subxt::utils::AccountId32>, - timepoint: - runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, - call_hash: [::core::primitive::u8; 32usize], + #[doc = "Initial change rate is not bounded, whereas subsequent updates can only be more"] + #[doc = "restrictive than the current."] + set_commission_change_rate { + pool_id: ::core::primitive::u32, + change_rate: runtime_types::pallet_nomination_pools::CommissionChangeRate< + ::core::primitive::u32, + >, }, + #[codec(index = 20)] + #[doc = "Claim pending commission."] + #[doc = ""] + #[doc = "The dispatch origin of this call must be signed by the `root` role of the pool. Pending"] + #[doc = "commission is paid out and added to total claimed commission`. Total pending commission"] + #[doc = "is reset to zero. the current."] + claim_commission { pool_id: ::core::primitive::u32 }, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum DefensiveError { + #[codec(index = 0)] + NotEnoughSpaceInUnbondPool, + #[codec(index = 1)] + PoolNotFound, + #[codec(index = 2)] + RewardPoolNotFound, + #[codec(index = 3)] + SubPoolsNotFound, + #[codec(index = 4)] + BondedStashKilledPrematurely, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] pub enum Error { #[codec(index = 0)] - #[doc = "Threshold must be 2 or greater."] - MinimumThreshold, + #[doc = "A (bonded) pool id does not exist."] + PoolNotFound, #[codec(index = 1)] - #[doc = "Call is already approved by this signatory."] - AlreadyApproved, + #[doc = "An account is not a member."] + PoolMemberNotFound, #[codec(index = 2)] - #[doc = "Call doesn't need any (more) approvals."] - NoApprovalsNeeded, + #[doc = "A reward pool does not exist. In all cases this is a system logic error."] + RewardPoolNotFound, #[codec(index = 3)] - #[doc = "There are too few signatories in the list."] - TooFewSignatories, + #[doc = "A sub pool does not exist."] + SubPoolsNotFound, #[codec(index = 4)] - #[doc = "There are too many signatories in the list."] - TooManySignatories, + #[doc = "An account is already delegating in another pool. An account may only belong to one"] + #[doc = "pool at a time."] + AccountBelongsToOtherPool, #[codec(index = 5)] - #[doc = "The signatories were provided out of order; they should be ordered."] - SignatoriesOutOfOrder, + #[doc = "The member is fully unbonded (and thus cannot access the bonded and reward pool"] + #[doc = "anymore to, for example, collect rewards)."] + FullyUnbonding, #[codec(index = 6)] - #[doc = "The sender was contained in the other signatories; it shouldn't be."] - SenderInSignatories, + #[doc = "The member cannot unbond further chunks due to reaching the limit."] + MaxUnbondingLimit, #[codec(index = 7)] - #[doc = "Multisig operation not found when attempting to cancel."] - NotFound, + #[doc = "None of the funds can be withdrawn yet because the bonding duration has not passed."] + CannotWithdrawAny, #[codec(index = 8)] - #[doc = "Only the account that originally created the multisig is able to cancel it."] - NotOwner, + #[doc = "The amount does not meet the minimum bond to either join or create a pool."] + #[doc = ""] + #[doc = "The depositor can never unbond to a value less than"] + #[doc = "`Pallet::depositor_min_bond`. The caller does not have nominating"] + #[doc = "permissions for the pool. Members can never unbond to a value below `MinJoinBond`."] + MinimumBondNotMet, #[codec(index = 9)] - #[doc = "No timepoint was given, yet the multisig operation is already underway."] - NoTimepoint, + #[doc = "The transaction could not be executed due to overflow risk for the pool."] + OverflowRisk, #[codec(index = 10)] - #[doc = "A different timepoint was given to the multisig operation that is underway."] - WrongTimepoint, + #[doc = "A pool must be in [`PoolState::Destroying`] in order for the depositor to unbond or for"] + #[doc = "other members to be permissionlessly unbonded."] + NotDestroying, #[codec(index = 11)] - #[doc = "A timepoint was given, yet no multisig operation is underway."] - UnexpectedTimepoint, + #[doc = "The caller does not have nominating permissions for the pool."] + NotNominator, #[codec(index = 12)] - #[doc = "The maximum weight information provided was too low."] - MaxWeightTooLow, + #[doc = "Either a) the caller cannot make a valid kick or b) the pool is not destroying."] + NotKickerOrDestroying, #[codec(index = 13)] - #[doc = "The data to be stored is already stored."] - AlreadyStored, + #[doc = "The pool is not open to join"] + NotOpen, + #[codec(index = 14)] + #[doc = "The system is maxed out on pools."] + MaxPools, + #[codec(index = 15)] + #[doc = "Too many members in the pool or system."] + MaxPoolMembers, + #[codec(index = 16)] + #[doc = "The pools state cannot be changed."] + CanNotChangeState, + #[codec(index = 17)] + #[doc = "The caller does not have adequate permissions."] + DoesNotHavePermission, + #[codec(index = 18)] + #[doc = "Metadata exceeds [`Config::MaxMetadataLen`]"] + MetadataExceedsMaxLen, + #[codec(index = 19)] + #[doc = "Some error occurred that should never happen. This should be reported to the"] + #[doc = "maintainers."] + Defensive(runtime_types::pallet_nomination_pools::pallet::DefensiveError), + #[codec(index = 20)] + #[doc = "Partial unbonding now allowed permissionlessly."] + PartialUnbondNotAllowedPermissionlessly, + #[codec(index = 21)] + #[doc = "The pool's max commission cannot be set higher than the existing value."] + MaxCommissionRestricted, + #[codec(index = 22)] + #[doc = "The supplied commission exceeds the max allowed commission."] + CommissionExceedsMaximum, + #[codec(index = 23)] + #[doc = "Not enough blocks have surpassed since the last commission update."] + CommissionChangeThrottled, + #[codec(index = 24)] + #[doc = "The submitted changes to commission change rate are not allowed."] + CommissionChangeRateNotAllowed, + #[codec(index = 25)] + #[doc = "There is no pending commission to claim."] + NoPendingCommission, + #[codec(index = 26)] + #[doc = "No commission current has been set."] + NoCommissionCurrentSet, + #[codec(index = 27)] + #[doc = "Pool id currently in use."] + PoolIdInUse, + #[codec(index = 28)] + #[doc = "Pool id provided is not correct/usable."] + InvalidPoolId, + #[codec(index = 29)] + #[doc = "Bonding extra is restricted to the exact pending reward amount."] + BondExtraRestricted, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] + #[doc = "Events of this pallet."] pub enum Event { #[codec(index = 0)] - #[doc = "A new multisig operation has begun."] - NewMultisig { - approving: ::subxt::utils::AccountId32, - multisig: ::subxt::utils::AccountId32, - call_hash: [::core::primitive::u8; 32usize], + #[doc = "A pool has been created."] + Created { + depositor: ::subxt::utils::AccountId32, + pool_id: ::core::primitive::u32, }, #[codec(index = 1)] - #[doc = "A multisig operation has been approved by someone."] - MultisigApproval { - approving: ::subxt::utils::AccountId32, - timepoint: - runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, - multisig: ::subxt::utils::AccountId32, - call_hash: [::core::primitive::u8; 32usize], + #[doc = "A member has became bonded in a pool."] + Bonded { + member: ::subxt::utils::AccountId32, + pool_id: ::core::primitive::u32, + bonded: ::core::primitive::u128, + joined: ::core::primitive::bool, }, #[codec(index = 2)] - #[doc = "A multisig operation has been executed."] - MultisigExecuted { - approving: ::subxt::utils::AccountId32, - timepoint: - runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, - multisig: ::subxt::utils::AccountId32, - call_hash: [::core::primitive::u8; 32usize], - result: - ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, + #[doc = "A payout has been made to a member."] + PaidOut { + member: ::subxt::utils::AccountId32, + pool_id: ::core::primitive::u32, + payout: ::core::primitive::u128, }, #[codec(index = 3)] - #[doc = "A multisig operation has been cancelled."] - MultisigCancelled { - cancelling: ::subxt::utils::AccountId32, - timepoint: - runtime_types::pallet_multisig::Timepoint<::core::primitive::u32>, - multisig: ::subxt::utils::AccountId32, - call_hash: [::core::primitive::u8; 32usize], + #[doc = "A member has unbonded from their pool."] + #[doc = ""] + #[doc = "- `balance` is the corresponding balance of the number of points that has been"] + #[doc = " requested to be unbonded (the argument of the `unbond` transaction) from the bonded"] + #[doc = " pool."] + #[doc = "- `points` is the number of points that are issued as a result of `balance` being"] + #[doc = "dissolved into the corresponding unbonding pool."] + #[doc = "- `era` is the era in which the balance will be unbonded."] + #[doc = "In the absence of slashing, these values will match. In the presence of slashing, the"] + #[doc = "number of points that are issued in the unbonding pool will be less than the amount"] + #[doc = "requested to be unbonded."] + Unbonded { + member: ::subxt::utils::AccountId32, + pool_id: ::core::primitive::u32, + balance: ::core::primitive::u128, + points: ::core::primitive::u128, + era: ::core::primitive::u32, + }, + #[codec(index = 4)] + #[doc = "A member has withdrawn from their pool."] + #[doc = ""] + #[doc = "The given number of `points` have been dissolved in return of `balance`."] + #[doc = ""] + #[doc = "Similar to `Unbonded` event, in the absence of slashing, the ratio of point to balance"] + #[doc = "will be 1."] + Withdrawn { + member: ::subxt::utils::AccountId32, + pool_id: ::core::primitive::u32, + balance: ::core::primitive::u128, + points: ::core::primitive::u128, + }, + #[codec(index = 5)] + #[doc = "A pool has been destroyed."] + Destroyed { pool_id: ::core::primitive::u32 }, + #[codec(index = 6)] + #[doc = "The state of a pool has changed"] + StateChanged { + pool_id: ::core::primitive::u32, + new_state: runtime_types::pallet_nomination_pools::PoolState, + }, + #[codec(index = 7)] + #[doc = "A member has been removed from a pool."] + #[doc = ""] + #[doc = "The removal can be voluntary (withdrawn all unbonded funds) or involuntary (kicked)."] + MemberRemoved { + pool_id: ::core::primitive::u32, + member: ::subxt::utils::AccountId32, + }, + #[codec(index = 8)] + #[doc = "The roles of a pool have been updated to the given new roles. Note that the depositor"] + #[doc = "can never change."] + RolesUpdated { + root: ::core::option::Option<::subxt::utils::AccountId32>, + bouncer: ::core::option::Option<::subxt::utils::AccountId32>, + nominator: ::core::option::Option<::subxt::utils::AccountId32>, + }, + #[codec(index = 9)] + #[doc = "The active balance of pool `pool_id` has been slashed to `balance`."] + PoolSlashed { + pool_id: ::core::primitive::u32, + balance: ::core::primitive::u128, + }, + #[codec(index = 10)] + #[doc = "The unbond pool at `era` of pool `pool_id` has been slashed to `balance`."] + UnbondingPoolSlashed { + pool_id: ::core::primitive::u32, + era: ::core::primitive::u32, + balance: ::core::primitive::u128, + }, + #[codec(index = 11)] + #[doc = "A pool's commission setting has been changed."] + PoolCommissionUpdated { + pool_id: ::core::primitive::u32, + current: ::core::option::Option<( + runtime_types::sp_arithmetic::per_things::Perbill, + ::subxt::utils::AccountId32, + )>, + }, + #[codec(index = 12)] + #[doc = "A pool's maximum commission setting has been changed."] + PoolMaxCommissionUpdated { + pool_id: ::core::primitive::u32, + max_commission: runtime_types::sp_arithmetic::per_things::Perbill, + }, + #[codec(index = 13)] + #[doc = "A pool's commission `change_rate` has been changed."] + PoolCommissionChangeRateUpdated { + pool_id: ::core::primitive::u32, + change_rate: runtime_types::pallet_nomination_pools::CommissionChangeRate< + ::core::primitive::u32, + >, + }, + #[codec(index = 14)] + #[doc = "Pool commission has been claimed."] + PoolCommissionClaimed { + pool_id: ::core::primitive::u32, + commission: ::core::primitive::u128, + }, + } + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum BondExtra<_0> { + #[codec(index = 0)] + FreeBalance(_0), + #[codec(index = 1)] + Rewards, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct BondedPoolInner { + pub commission: runtime_types::pallet_nomination_pools::Commission, + pub member_counter: ::core::primitive::u32, + pub points: ::core::primitive::u128, + pub roles: + runtime_types::pallet_nomination_pools::PoolRoles<::subxt::utils::AccountId32>, + pub state: runtime_types::pallet_nomination_pools::PoolState, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum ClaimPermission { + #[codec(index = 0)] + Permissioned, + #[codec(index = 1)] + PermissionlessCompound, + #[codec(index = 2)] + PermissionlessWithdraw, + #[codec(index = 3)] + PermissionlessAll, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct Commission { + pub current: ::core::option::Option<( + runtime_types::sp_arithmetic::per_things::Perbill, + ::subxt::utils::AccountId32, + )>, + pub max: ::core::option::Option, + pub change_rate: ::core::option::Option< + runtime_types::pallet_nomination_pools::CommissionChangeRate< + ::core::primitive::u32, + >, + >, + pub throttle_from: ::core::option::Option<::core::primitive::u32>, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct CommissionChangeRate<_0> { + pub max_increase: runtime_types::sp_arithmetic::per_things::Perbill, + pub min_delay: _0, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum ConfigOp<_0> { + #[codec(index = 0)] + Noop, + #[codec(index = 1)] + Set(_0), + #[codec(index = 2)] + Remove, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct PoolMember { + pub pool_id: ::core::primitive::u32, + pub points: ::core::primitive::u128, + pub last_recorded_reward_counter: + runtime_types::sp_arithmetic::fixed_point::FixedU128, + pub unbonding_eras: + runtime_types::bounded_collections::bounded_btree_map::BoundedBTreeMap< + ::core::primitive::u32, + ::core::primitive::u128, + >, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct PoolRoles<_0> { + pub depositor: _0, + pub root: ::core::option::Option<_0>, + pub nominator: ::core::option::Option<_0>, + pub bouncer: ::core::option::Option<_0>, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum PoolState { + #[codec(index = 0)] + Open, + #[codec(index = 1)] + Blocked, + #[codec(index = 2)] + Destroying, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct RewardPool { + pub last_recorded_reward_counter: + runtime_types::sp_arithmetic::fixed_point::FixedU128, + pub last_recorded_total_payouts: ::core::primitive::u128, + pub total_rewards_claimed: ::core::primitive::u128, + pub total_commission_pending: ::core::primitive::u128, + pub total_commission_claimed: ::core::primitive::u128, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct SubPools { + pub no_era: runtime_types::pallet_nomination_pools::UnbondPool, + pub with_era: + runtime_types::bounded_collections::bounded_btree_map::BoundedBTreeMap< + ::core::primitive::u32, + runtime_types::pallet_nomination_pools::UnbondPool, + >, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct UnbondPool { + pub points: ::core::primitive::u128, + pub balance: ::core::primitive::u128, + } + } + pub mod pallet_offences { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "Events type."] + pub enum Event { + #[codec(index = 0)] + #[doc = "There is an offence reported of the given `kind` happened at the `session_index` and"] + #[doc = "(kind-specific) time slot. This event is not deposited for duplicate slashes."] + #[doc = "\\[kind, timeslot\\]."] + Offence { + kind: [::core::primitive::u8; 16usize], + timeslot: ::std::vec::Vec<::core::primitive::u8>, }, } } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct Multisig<_0, _1, _2> { - pub when: runtime_types::pallet_multisig::Timepoint<_0>, - pub deposit: _1, - pub depositor: _2, - pub approvals: runtime_types::bounded_collections::bounded_vec::BoundedVec<_2>, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct Timepoint<_0> { - pub height: _0, - pub index: _0, - } } pub mod pallet_preimage { use super::runtime_types; @@ -6412,6 +7810,14 @@ pub mod runtime_types { crate::gp::DecodeAsType, crate::gp::Encode, )] + pub struct PerU16(pub ::core::primitive::u16); + #[derive( + ::subxt::ext::codec::CompactAs, + Debug, + crate::gp::Decode, + crate::gp::DecodeAsType, + crate::gp::Encode, + )] pub struct Perbill(pub ::core::primitive::u32); #[derive( ::subxt::ext::codec::CompactAs, @@ -6613,6 +8019,20 @@ pub mod runtime_types { #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] pub enum Void {} } + pub mod sp_npos_elections { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct ElectionScore { + pub minimal_stake: ::core::primitive::u128, + pub sum_stake: ::core::primitive::u128, + pub sum_stake_squared: ::core::primitive::u128, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct Support<_0> { + pub total: ::core::primitive::u128, + pub voters: ::std::vec::Vec<(_0, ::core::primitive::u128)>, + } + } pub mod sp_runtime { use super::runtime_types; pub mod generic { @@ -7285,6 +8705,17 @@ pub mod runtime_types { pub validator_count: ::core::primitive::u32, } } + pub mod sp_staking { + use super::runtime_types; + pub mod offence { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct OffenceDetails<_0, _1> { + pub offender: _1, + pub reporters: ::std::vec::Vec<_0>, + } + } + } pub mod sp_version { use super::runtime_types; #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] @@ -7318,68 +8749,6 @@ pub mod runtime_types { pub write: ::core::primitive::u64, } } - pub mod substrate_validator_set { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] - pub enum Call { - #[codec(index = 0)] - #[doc = "Add a new validator."] - #[doc = ""] - #[doc = "New validator's session keys should be set in Session pallet before"] - #[doc = "calling this."] - #[doc = ""] - #[doc = "The origin can be configured using the `AddRemoveOrigin` type in the"] - #[doc = "host runtime. Can also be set to sudo/root."] - add_validator { - validator_id: ::subxt::utils::AccountId32, - }, - #[codec(index = 1)] - #[doc = "Remove a validator."] - #[doc = ""] - #[doc = "The origin can be configured using the `AddRemoveOrigin` type in the"] - #[doc = "host runtime. Can also be set to sudo/root."] - remove_validator { - validator_id: ::subxt::utils::AccountId32, - }, - #[codec(index = 2)] - #[doc = "Add an approved validator again when it comes back online."] - #[doc = ""] - #[doc = "For this call, the dispatch origin must be the validator itself."] - add_validator_again { - validator_id: ::subxt::utils::AccountId32, - }, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] - pub enum Error { - #[codec(index = 0)] - #[doc = "Target (post-removal) validator count is below the minimum."] - TooLowValidatorCount, - #[codec(index = 1)] - #[doc = "Validator is already in the validator set."] - Duplicate, - #[codec(index = 2)] - #[doc = "Validator is not approved for re-addition."] - ValidatorNotApproved, - #[codec(index = 3)] - #[doc = "Only the validator can add itself back after coming online."] - BadOrigin, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] - pub enum Event { - #[codec(index = 0)] - #[doc = "New validator addition initiated. Effective in ~2 sessions."] - ValidatorAdditionInitiated(::subxt::utils::AccountId32), - #[codec(index = 1)] - #[doc = "Validator removal initiated. Effective in ~2 sessions."] - ValidatorRemovalInitiated(::subxt::utils::AccountId32), - } - } - } pub mod vara_runtime { use super::runtime_types; pub mod extensions { @@ -7452,6 +8821,163 @@ pub mod runtime_types { } } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct NposSolution16 { + pub votes1: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes2: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + ( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ), + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes3: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 2usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes4: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 3usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes5: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 4usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes6: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 5usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes7: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 6usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes8: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 7usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes9: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 8usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes10: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 9usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes11: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 10usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes12: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 11usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes13: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 12usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes14: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 13usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes15: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 14usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + pub votes16: ::std::vec::Vec<( + ::subxt::ext::codec::Compact<::core::primitive::u32>, + [( + ::subxt::ext::codec::Compact<::core::primitive::u16>, + ::subxt::ext::codec::Compact< + runtime_types::sp_arithmetic::per_things::PerU16, + >, + ); 15usize], + ::subxt::ext::codec::Compact<::core::primitive::u16>, + )>, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] pub enum OriginCaller { #[codec(index = 0)] system( @@ -7505,6 +9031,8 @@ pub mod runtime_types { Session(runtime_types::pallet_session::pallet::Call), #[codec(index = 14)] Treasury(runtime_types::pallet_treasury::pallet::Call), + #[codec(index = 8)] + Utility(runtime_types::pallet_utility::pallet::Call), #[codec(index = 16)] ConvictionVoting(runtime_types::pallet_conviction_voting::pallet::Call), #[codec(index = 17)] @@ -7515,10 +9043,6 @@ pub mod runtime_types { FellowshipReferenda(runtime_types::pallet_referenda::pallet::Call2), #[codec(index = 21)] Whitelist(runtime_types::pallet_whitelist::pallet::Call), - #[codec(index = 98)] - ValidatorSet(runtime_types::substrate_validator_set::pallet::Call), - #[codec(index = 99)] - Sudo(runtime_types::pallet_sudo::pallet::Call), #[codec(index = 22)] Scheduler(runtime_types::pallet_scheduler::pallet::Call), #[codec(index = 23)] @@ -7529,14 +9053,24 @@ pub mod runtime_types { Proxy(runtime_types::pallet_proxy::pallet::Call), #[codec(index = 26)] Multisig(runtime_types::pallet_multisig::pallet::Call), - #[codec(index = 8)] - Utility(runtime_types::pallet_utility::pallet::Call), + #[codec(index = 27)] + ElectionProviderMultiPhase( + runtime_types::pallet_election_provider_multi_phase::pallet::Call, + ), + #[codec(index = 29)] + Bounties(runtime_types::pallet_bounties::pallet::Call), + #[codec(index = 30)] + ChildBounties(runtime_types::pallet_child_bounties::pallet::Call), + #[codec(index = 31)] + NominationPools(runtime_types::pallet_nomination_pools::pallet::Call), #[codec(index = 104)] Gear(runtime_types::pallet_gear::pallet::Call), #[codec(index = 106)] StakingRewards(runtime_types::pallet_gear_staking_rewards::pallet::Call), #[codec(index = 107)] GearVoucher(runtime_types::pallet_gear_voucher::pallet::Call), + #[codec(index = 99)] + Sudo(runtime_types::pallet_sudo::pallet::Call), #[codec(index = 198)] Airdrop(runtime_types::pallet_airdrop::pallet::Call), #[codec(index = 199)] @@ -7564,6 +9098,8 @@ pub mod runtime_types { Session(runtime_types::pallet_session::pallet::Event), #[codec(index = 14)] Treasury(runtime_types::pallet_treasury::pallet::Event), + #[codec(index = 8)] + Utility(runtime_types::pallet_utility::pallet::Event), #[codec(index = 16)] ConvictionVoting(runtime_types::pallet_conviction_voting::pallet::Event), #[codec(index = 17)] @@ -7574,10 +9110,6 @@ pub mod runtime_types { FellowshipReferenda(runtime_types::pallet_referenda::pallet::Event2), #[codec(index = 21)] Whitelist(runtime_types::pallet_whitelist::pallet::Event), - #[codec(index = 98)] - ValidatorSet(runtime_types::substrate_validator_set::pallet::Event), - #[codec(index = 99)] - Sudo(runtime_types::pallet_sudo::pallet::Event), #[codec(index = 22)] Scheduler(runtime_types::pallet_scheduler::pallet::Event), #[codec(index = 23)] @@ -7588,14 +9120,26 @@ pub mod runtime_types { Proxy(runtime_types::pallet_proxy::pallet::Event), #[codec(index = 26)] Multisig(runtime_types::pallet_multisig::pallet::Event), - #[codec(index = 8)] - Utility(runtime_types::pallet_utility::pallet::Event), + #[codec(index = 27)] + ElectionProviderMultiPhase( + runtime_types::pallet_election_provider_multi_phase::pallet::Event, + ), + #[codec(index = 28)] + Offences(runtime_types::pallet_offences::pallet::Event), + #[codec(index = 29)] + Bounties(runtime_types::pallet_bounties::pallet::Event), + #[codec(index = 30)] + ChildBounties(runtime_types::pallet_child_bounties::pallet::Event), + #[codec(index = 31)] + NominationPools(runtime_types::pallet_nomination_pools::pallet::Event), #[codec(index = 104)] Gear(runtime_types::pallet_gear::pallet::Event), #[codec(index = 106)] StakingRewards(runtime_types::pallet_gear_staking_rewards::pallet::Event), #[codec(index = 107)] GearVoucher(runtime_types::pallet_gear_voucher::pallet::Event), + #[codec(index = 99)] + Sudo(runtime_types::pallet_sudo::pallet::Event), #[codec(index = 198)] Airdrop(runtime_types::pallet_airdrop::pallet::Event), #[codec(index = 199)] @@ -7684,6 +9228,58 @@ pub mod calls { } } } + #[doc = "Calls of pallet `Bounties`."] + pub enum BountiesCall { + ProposeBounty, + ApproveBounty, + ProposeCurator, + UnassignCurator, + AcceptCurator, + AwardBounty, + ClaimBounty, + CloseBounty, + ExtendBountyExpiry, + } + impl CallInfo for BountiesCall { + const PALLET: &'static str = "Bounties"; + fn call_name(&self) -> &'static str { + match self { + Self::ProposeBounty => "propose_bounty", + Self::ApproveBounty => "approve_bounty", + Self::ProposeCurator => "propose_curator", + Self::UnassignCurator => "unassign_curator", + Self::AcceptCurator => "accept_curator", + Self::AwardBounty => "award_bounty", + Self::ClaimBounty => "claim_bounty", + Self::CloseBounty => "close_bounty", + Self::ExtendBountyExpiry => "extend_bounty_expiry", + } + } + } + #[doc = "Calls of pallet `ChildBounties`."] + pub enum ChildBountiesCall { + AddChildBounty, + ProposeCurator, + AcceptCurator, + UnassignCurator, + AwardChildBounty, + ClaimChildBounty, + CloseChildBounty, + } + impl CallInfo for ChildBountiesCall { + const PALLET: &'static str = "ChildBounties"; + fn call_name(&self) -> &'static str { + match self { + Self::AddChildBounty => "add_child_bounty", + Self::ProposeCurator => "propose_curator", + Self::AcceptCurator => "accept_curator", + Self::UnassignCurator => "unassign_curator", + Self::AwardChildBounty => "award_child_bounty", + Self::ClaimChildBounty => "claim_child_bounty", + Self::CloseChildBounty => "close_child_bounty", + } + } + } #[doc = "Calls of pallet `ConvictionVoting`."] pub enum ConvictionVotingCall { Vote, @@ -7706,6 +9302,26 @@ pub mod calls { } } } + #[doc = "Calls of pallet `ElectionProviderMultiPhase`."] + pub enum ElectionProviderMultiPhaseCall { + SubmitUnsigned, + SetMinimumUntrustedScore, + SetEmergencyElectionResult, + Submit, + GovernanceFallback, + } + impl CallInfo for ElectionProviderMultiPhaseCall { + const PALLET: &'static str = "ElectionProviderMultiPhase"; + fn call_name(&self) -> &'static str { + match self { + Self::SubmitUnsigned => "submit_unsigned", + Self::SetMinimumUntrustedScore => "set_minimum_untrusted_score", + Self::SetEmergencyElectionResult => "set_emergency_election_result", + Self::Submit => "submit", + Self::GovernanceFallback => "governance_fallback", + } + } + } #[doc = "Calls of pallet `FellowshipCollective`."] pub enum FellowshipCollectiveCall { AddMember, @@ -7900,6 +9516,58 @@ pub mod calls { } } } + #[doc = "Calls of pallet `NominationPools`."] + pub enum NominationPoolsCall { + Join, + BondExtra, + ClaimPayout, + Unbond, + PoolWithdrawUnbonded, + WithdrawUnbonded, + Create, + CreateWithPoolId, + Nominate, + SetState, + SetMetadata, + SetConfigs, + UpdateRoles, + Chill, + BondExtraOther, + SetClaimPermission, + ClaimPayoutOther, + SetCommission, + SetCommissionMax, + SetCommissionChangeRate, + ClaimCommission, + } + impl CallInfo for NominationPoolsCall { + const PALLET: &'static str = "NominationPools"; + fn call_name(&self) -> &'static str { + match self { + Self::Join => "join", + Self::BondExtra => "bond_extra", + Self::ClaimPayout => "claim_payout", + Self::Unbond => "unbond", + Self::PoolWithdrawUnbonded => "pool_withdraw_unbonded", + Self::WithdrawUnbonded => "withdraw_unbonded", + Self::Create => "create", + Self::CreateWithPoolId => "create_with_pool_id", + Self::Nominate => "nominate", + Self::SetState => "set_state", + Self::SetMetadata => "set_metadata", + Self::SetConfigs => "set_configs", + Self::UpdateRoles => "update_roles", + Self::Chill => "chill", + Self::BondExtraOther => "bond_extra_other", + Self::SetClaimPermission => "set_claim_permission", + Self::ClaimPayoutOther => "claim_payout_other", + Self::SetCommission => "set_commission", + Self::SetCommissionMax => "set_commission_max", + Self::SetCommissionChangeRate => "set_commission_change_rate", + Self::ClaimCommission => "claim_commission", + } + } + } #[doc = "Calls of pallet `Preimage`."] pub enum PreimageCall { NotePreimage, @@ -8188,22 +9856,6 @@ pub mod calls { } } } - #[doc = "Calls of pallet `ValidatorSet`."] - pub enum ValidatorSetCall { - AddValidator, - RemoveValidator, - AddValidatorAgain, - } - impl CallInfo for ValidatorSetCall { - const PALLET: &'static str = "ValidatorSet"; - fn call_name(&self) -> &'static str { - match self { - Self::AddValidator => "add_validator", - Self::RemoveValidator => "remove_validator", - Self::AddValidatorAgain => "add_validator_again", - } - } - } #[doc = "Calls of pallet `Vesting`."] pub enum VestingCall { Vest, @@ -8358,6 +10010,44 @@ pub mod storage { } } } + #[doc = "Storage of pallet `Bounties`."] + pub enum BountiesStorage { + BountyCount, + Bounties, + BountyDescriptions, + BountyApprovals, + } + impl StorageInfo for BountiesStorage { + const PALLET: &'static str = "Bounties"; + fn storage_name(&self) -> &'static str { + match self { + Self::BountyCount => "BountyCount", + Self::Bounties => "Bounties", + Self::BountyDescriptions => "BountyDescriptions", + Self::BountyApprovals => "BountyApprovals", + } + } + } + #[doc = "Storage of pallet `ChildBounties`."] + pub enum ChildBountiesStorage { + ChildBountyCount, + ParentChildBounties, + ChildBounties, + ChildBountyDescriptions, + ChildrenCuratorFees, + } + impl StorageInfo for ChildBountiesStorage { + const PALLET: &'static str = "ChildBounties"; + fn storage_name(&self) -> &'static str { + match self { + Self::ChildBountyCount => "ChildBountyCount", + Self::ParentChildBounties => "ParentChildBounties", + Self::ChildBounties => "ChildBounties", + Self::ChildBountyDescriptions => "ChildBountyDescriptions", + Self::ChildrenCuratorFees => "ChildrenCuratorFees", + } + } + } #[doc = "Storage of pallet `ConvictionVoting`."] pub enum ConvictionVotingStorage { VotingFor, @@ -8372,6 +10062,36 @@ pub mod storage { } } } + #[doc = "Storage of pallet `ElectionProviderMultiPhase`."] + pub enum ElectionProviderMultiPhaseStorage { + Round, + CurrentPhase, + QueuedSolution, + Snapshot, + DesiredTargets, + SnapshotMetadata, + SignedSubmissionNextIndex, + SignedSubmissionIndices, + SignedSubmissionsMap, + MinimumUntrustedScore, + } + impl StorageInfo for ElectionProviderMultiPhaseStorage { + const PALLET: &'static str = "ElectionProviderMultiPhase"; + fn storage_name(&self) -> &'static str { + match self { + Self::Round => "Round", + Self::CurrentPhase => "CurrentPhase", + Self::QueuedSolution => "QueuedSolution", + Self::Snapshot => "Snapshot", + Self::DesiredTargets => "DesiredTargets", + Self::SnapshotMetadata => "SnapshotMetadata", + Self::SignedSubmissionNextIndex => "SignedSubmissionNextIndex", + Self::SignedSubmissionIndices => "SignedSubmissionIndices", + Self::SignedSubmissionsMap => "SignedSubmissionsMap", + Self::MinimumUntrustedScore => "MinimumUntrustedScore", + } + } + } #[doc = "Storage of pallet `FellowshipCollective`."] pub enum FellowshipCollectiveStorage { MemberCount, @@ -8622,6 +10342,72 @@ pub mod storage { } } } + #[doc = "Storage of pallet `NominationPools`."] + pub enum NominationPoolsStorage { + MinJoinBond, + MinCreateBond, + MaxPools, + MaxPoolMembers, + MaxPoolMembersPerPool, + GlobalMaxCommission, + PoolMembers, + CounterForPoolMembers, + BondedPools, + CounterForBondedPools, + RewardPools, + CounterForRewardPools, + SubPoolsStorage, + CounterForSubPoolsStorage, + Metadata, + CounterForMetadata, + LastPoolId, + ReversePoolIdLookup, + CounterForReversePoolIdLookup, + ClaimPermissions, + } + impl StorageInfo for NominationPoolsStorage { + const PALLET: &'static str = "NominationPools"; + fn storage_name(&self) -> &'static str { + match self { + Self::MinJoinBond => "MinJoinBond", + Self::MinCreateBond => "MinCreateBond", + Self::MaxPools => "MaxPools", + Self::MaxPoolMembers => "MaxPoolMembers", + Self::MaxPoolMembersPerPool => "MaxPoolMembersPerPool", + Self::GlobalMaxCommission => "GlobalMaxCommission", + Self::PoolMembers => "PoolMembers", + Self::CounterForPoolMembers => "CounterForPoolMembers", + Self::BondedPools => "BondedPools", + Self::CounterForBondedPools => "CounterForBondedPools", + Self::RewardPools => "RewardPools", + Self::CounterForRewardPools => "CounterForRewardPools", + Self::SubPoolsStorage => "SubPoolsStorage", + Self::CounterForSubPoolsStorage => "CounterForSubPoolsStorage", + Self::Metadata => "Metadata", + Self::CounterForMetadata => "CounterForMetadata", + Self::LastPoolId => "LastPoolId", + Self::ReversePoolIdLookup => "ReversePoolIdLookup", + Self::CounterForReversePoolIdLookup => "CounterForReversePoolIdLookup", + Self::ClaimPermissions => "ClaimPermissions", + } + } + } + #[doc = "Storage of pallet `Offences`."] + pub enum OffencesStorage { + Reports, + ConcurrentReportsIndex, + ReportsByKindIndex, + } + impl StorageInfo for OffencesStorage { + const PALLET: &'static str = "Offences"; + fn storage_name(&self) -> &'static str { + match self { + Self::Reports => "Reports", + Self::ConcurrentReportsIndex => "ConcurrentReportsIndex", + Self::ReportsByKindIndex => "ReportsByKindIndex", + } + } + } #[doc = "Storage of pallet `Preimage`."] pub enum PreimageStorage { StatusFor, @@ -8912,22 +10698,6 @@ pub mod storage { } } } - #[doc = "Storage of pallet `ValidatorSet`."] - pub enum ValidatorSetStorage { - Validators, - ApprovedValidators, - OfflineValidators, - } - impl StorageInfo for ValidatorSetStorage { - const PALLET: &'static str = "ValidatorSet"; - fn storage_name(&self) -> &'static str { - match self { - Self::Validators => "Validators", - Self::ApprovedValidators => "ApprovedValidators", - Self::OfflineValidators => "OfflineValidators", - } - } - } #[doc = "Storage of pallet `Vesting`."] pub enum VestingStorage { Vesting, @@ -9055,6 +10825,15 @@ pub mod impls { )?, )); } + if pallet_name == "Utility" { + return Ok(Event::Utility( + crate::metadata::utility::Event::decode_with_metadata( + &mut &*pallet_bytes, + pallet_ty, + metadata, + )?, + )); + } if pallet_name == "ConvictionVoting" { return Ok(Event::ConvictionVoting( crate::metadata::conviction_voting::Event::decode_with_metadata( @@ -9100,24 +10879,6 @@ pub mod impls { )?, )); } - if pallet_name == "ValidatorSet" { - return Ok(Event::ValidatorSet( - crate::metadata::validator_set::Event::decode_with_metadata( - &mut &*pallet_bytes, - pallet_ty, - metadata, - )?, - )); - } - if pallet_name == "Sudo" { - return Ok(Event::Sudo( - crate::metadata::sudo::Event::decode_with_metadata( - &mut &*pallet_bytes, - pallet_ty, - metadata, - )?, - )); - } if pallet_name == "Scheduler" { return Ok(Event::Scheduler( crate::metadata::scheduler::Event::decode_with_metadata( @@ -9163,9 +10924,45 @@ pub mod impls { )?, )); } - if pallet_name == "Utility" { - return Ok(Event::Utility( - crate::metadata::utility::Event::decode_with_metadata( + if pallet_name == "ElectionProviderMultiPhase" { + return Ok(Event::ElectionProviderMultiPhase( + crate::metadata::election_provider_multi_phase::Event::decode_with_metadata( + &mut &*pallet_bytes, + pallet_ty, + metadata, + )?, + )); + } + if pallet_name == "Offences" { + return Ok(Event::Offences( + crate::metadata::offences::Event::decode_with_metadata( + &mut &*pallet_bytes, + pallet_ty, + metadata, + )?, + )); + } + if pallet_name == "Bounties" { + return Ok(Event::Bounties( + crate::metadata::bounties::Event::decode_with_metadata( + &mut &*pallet_bytes, + pallet_ty, + metadata, + )?, + )); + } + if pallet_name == "ChildBounties" { + return Ok(Event::ChildBounties( + crate::metadata::child_bounties::Event::decode_with_metadata( + &mut &*pallet_bytes, + pallet_ty, + metadata, + )?, + )); + } + if pallet_name == "NominationPools" { + return Ok(Event::NominationPools( + crate::metadata::nomination_pools::Event::decode_with_metadata( &mut &*pallet_bytes, pallet_ty, metadata, @@ -9199,6 +10996,15 @@ pub mod impls { )?, )); } + if pallet_name == "Sudo" { + return Ok(Event::Sudo( + crate::metadata::sudo::Event::decode_with_metadata( + &mut &*pallet_bytes, + pallet_ty, + metadata, + )?, + )); + } if pallet_name == "Airdrop" { return Ok(Event::Airdrop( crate::metadata::airdrop::Event::decode_with_metadata( @@ -9257,6 +11063,9 @@ pub mod exports { pub mod treasury { pub use super::runtime_types::pallet_treasury::pallet::Event; } + pub mod utility { + pub use super::runtime_types::pallet_utility::pallet::Event; + } pub mod conviction_voting { pub use super::runtime_types::pallet_conviction_voting::pallet::Event; } @@ -9272,12 +11081,6 @@ pub mod exports { pub mod whitelist { pub use super::runtime_types::pallet_whitelist::pallet::Event; } - pub mod validator_set { - pub use super::runtime_types::substrate_validator_set::pallet::Event; - } - pub mod sudo { - pub use super::runtime_types::pallet_sudo::pallet::Event; - } pub mod scheduler { pub use super::runtime_types::pallet_scheduler::pallet::Event; } @@ -9293,8 +11096,20 @@ pub mod exports { pub mod multisig { pub use super::runtime_types::pallet_multisig::pallet::Event; } - pub mod utility { - pub use super::runtime_types::pallet_utility::pallet::Event; + pub mod election_provider_multi_phase { + pub use super::runtime_types::pallet_election_provider_multi_phase::pallet::Event; + } + pub mod offences { + pub use super::runtime_types::pallet_offences::pallet::Event; + } + pub mod bounties { + pub use super::runtime_types::pallet_bounties::pallet::Event; + } + pub mod child_bounties { + pub use super::runtime_types::pallet_child_bounties::pallet::Event; + } + pub mod nomination_pools { + pub use super::runtime_types::pallet_nomination_pools::pallet::Event; } pub mod gear { pub use super::runtime_types::pallet_gear::pallet::Event; @@ -9305,6 +11120,9 @@ pub mod exports { pub mod gear_voucher { pub use super::runtime_types::pallet_gear_voucher::pallet::Event; } + pub mod sudo { + pub use super::runtime_types::pallet_sudo::pallet::Event; + } pub mod airdrop { pub use super::runtime_types::pallet_airdrop::pallet::Event; } diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index 61abd2f1280..b769736c653 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -28,10 +28,10 @@ use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; use sp_runtime::{Perbill, Perquintill}; use vara_runtime::{ - constants::currency::UNITS as TOKEN, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, - GenesisConfig, GrandpaConfig, ImOnlineConfig, SessionConfig, SessionKeys, StakerStatus, - StakingConfig, StakingRewardsConfig, SudoConfig, SystemConfig, ValidatorSetConfig, - VestingConfig, WASM_BINARY, + constants::currency::{DOLLARS, UNITS as TOKEN}, + AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, + ImOnlineConfig, NominationPoolsConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, + StakingRewardsConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY, }; // The URL for the telemetry server. @@ -560,8 +560,6 @@ fn testnet_genesis( const STASH: u128 = 100 * TOKEN; const MIN_NOMINATOR_BOND: u128 = 50 * TOKEN; - let _num_endowed_accounts = endowed_accounts.len(); - GenesisConfig { system: SystemConfig { // Add Wasm runtime to storage. @@ -574,12 +572,6 @@ fn testnet_genesis( .chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH))) .collect(), }, - validator_set: ValidatorSetConfig { - initial_validators: initial_authorities - .iter() - .map(|x| x.0.clone()) - .collect::>(), - }, babe: BabeConfig { authorities: Default::default(), epoch_config: Some(vara_runtime::BABE_GENESIS_EPOCH_CONFIG), @@ -619,6 +611,11 @@ fn testnet_genesis( authority_discovery: AuthorityDiscoveryConfig { keys: vec![] }, transaction_payment: Default::default(), treasury: Default::default(), + nomination_pools: NominationPoolsConfig { + min_create_bond: 10 * DOLLARS, + min_join_bond: DOLLARS, + ..Default::default() + }, vesting: VestingConfig { vesting: vec![] }, staking_rewards: StakingRewardsConfig { non_stakeable: Perquintill::from_rational(4108_u64, 10_000_u64), // 41.08% diff --git a/node/testing/src/genesis.rs b/node/testing/src/genesis.rs index 0ae8a5b0741..f5a63aa4629 100644 --- a/node/testing/src/genesis.rs +++ b/node/testing/src/genesis.rs @@ -30,7 +30,7 @@ use sp_runtime::{Perbill, Perquintill}; use vara_runtime::{ constants::currency::*, AccountId, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, SessionConfig, StakerStatus, StakingConfig, StakingRewardsConfig, SudoConfig, SystemConfig, - ValidatorSetConfig, BABE_GENESIS_EPOCH_CONFIG, WASM_BINARY, + BABE_GENESIS_EPOCH_CONFIG, WASM_BINARY, }; fn wasm_binary() -> &'static [u8] { @@ -70,9 +70,6 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> Gen .unwrap_or_else(|| wasm_binary().to_vec()), }, balances: BalancesConfig { balances: endowed }, - validator_set: ValidatorSetConfig { - initial_validators: vec![], - }, babe: BabeConfig { authorities: vec![], epoch_config: Some(BABE_GENESIS_EPOCH_CONFIG), @@ -116,6 +113,7 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> Gen authority_discovery: Default::default(), transaction_payment: Default::default(), treasury: Default::default(), + nomination_pools: Default::default(), vesting: Default::default(), staking_rewards: StakingRewardsConfig { non_stakeable: Perquintill::from_rational(4108_u64, 10_000_u64), // 41.08% diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index f4bf65f4651..4067654e694 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -31,12 +31,17 @@ pallet-authorship.workspace = true pallet-babe.workspace = true pallet-bags-list.workspace = true pallet-balances.workspace = true +pallet-bounties.workspace = true +pallet-child-bounties.workspace = true pallet-conviction-voting.workspace = true pallet-election-provider-multi-phase.workspace = true pallet-grandpa.workspace = true pallet-identity.workspace = true pallet-im-online.workspace = true +pallet-nomination-pools.workspace = true +pallet-nomination-pools-runtime-api.workspace = true pallet-multisig.workspace = true +pallet-offences.workspace = true pallet-preimage.workspace = true pallet-proxy.workspace = true pallet-ranked-collective.workspace = true @@ -94,9 +99,6 @@ pallet-gear-rpc-runtime-api.workspace = true runtime-primitives.workspace = true pallet-airdrop.workspace = true -# Authority add/remove -validator-set.workspace = true - [dev-dependencies] sp-io.workspace = true sp-keyring.workspace = true @@ -128,6 +130,8 @@ std = [ "pallet-babe/std", "pallet-bags-list/std", "pallet-balances/std", + "pallet-bounties/std", + "pallet-child-bounties/std", "pallet-conviction-voting/std", "pallet-election-provider-multi-phase/std", "pallet-gear-gas/std", @@ -141,7 +145,10 @@ std = [ "pallet-grandpa/std", "pallet-identity/std", "pallet-im-online/std", + "pallet-nomination-pools/std", + "pallet-nomination-pools-runtime-api/std", "pallet-multisig/std", + "pallet-offences/std", "pallet-preimage/std", "pallet-proxy/std", "pallet-ranked-collective/std", @@ -177,7 +184,6 @@ std = [ "sp-version/std", "substrate-wasm-builder", "pallet-airdrop/std", - "validator-set/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -219,13 +225,19 @@ try-runtime = [ "pallet-authority-discovery/try-runtime", "pallet-authorship/try-runtime", "pallet-babe/try-runtime", + "pallet-bags-list/try-runtime", "pallet-balances/try-runtime", + "pallet-bounties/try-runtime", + "pallet-child-bounties/try-runtime", "pallet-conviction-voting/try-runtime", + "pallet-election-provider-multi-phase/try-runtime", "pallet-vesting/try-runtime", "pallet-grandpa/try-runtime", "pallet-identity/try-runtime", "pallet-im-online/try-runtime", + "pallet-nomination-pools/try-runtime", "pallet-multisig/try-runtime", + "pallet-offences/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", "pallet-ranked-collective/try-runtime", @@ -242,7 +254,6 @@ try-runtime = [ "pallet-whitelist/try-runtime", "pallet-airdrop/try-runtime", "pallet-bags-list/try-runtime", - "validator-set/try-runtime", ] debug-mode = ["pallet-gear-debug", "pallet-gear-program/debug-mode"] lazy-pages = [ diff --git a/runtime/vara/src/bag_thresholds.rs b/runtime/vara/src/bag_thresholds.rs new file mode 100644 index 00000000000..d3ec1360cf3 --- /dev/null +++ b/runtime/vara/src/bag_thresholds.rs @@ -0,0 +1,241 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Autogenerated bag thresholds. +//! +//! Generated on 2023-08-21T15:38:22.734264+00:00 +//! Arguments +//! Total issuance: 10000000000 +//! Minimum balance: 10000000000000 +//! for the vara runtime. + +#![allow(clippy::all)] + +/// Existential weight for this runtime. +#[cfg(any(test, feature = "std"))] +#[allow(unused)] +pub const EXISTENTIAL_WEIGHT: u64 = 10_000_000_000_000; + +/// Constant ratio between bags for this runtime. +#[cfg(any(test, feature = "std"))] +#[allow(unused)] +pub const CONSTANT_RATIO: f64 = 1.0751944990982600; + +/// Upper thresholds delimiting the bag list. +pub const THRESHOLDS: [u64; 200] = [ + 10_000_000_000_000, + 10_751_944_990_983, + 11_560_432_108_912, + 12_429_713_010_701, + 13_364_359_054_476, + 14_369_285_339_347, + 15_449_776_552_839, + 16_611_514_761_910, + 17_860_609_293_695, + 19_203_628_863_124, + 20_647_636_116_355, + 22_200_224_771_687, + 23_869_559_553_263, + 25_664_419_127_567, + 27_594_242_268_512, + 29_669_177_493_889, + 31_900_136_434_199, + 34_298_851_214_535, + 36_877_936_151_258, + 39_650_954_087_929, + 42_632_487_719_339, + 45_838_216_278_707, + 49_284_997_991_342, + 52_990_958_728_360, + 56_975_587_326_676, + 61_259_838_076_535, + 65_866_240_915_541, + 70_819_019_908_670, + 76_144_220_637_332, + 81_869_847_167_384, + 88_026_009_316_387, + 94_645_080_994_551, + 101_761_870_452_051, + 109_413_803_327_995, + 117_641_119_463_679, + 126_487_084_515_109, + 135_998_217_477_622, + 146_224_535_319_108, + 157_219_816_008_304, + 169_041_881_321_369, + 181_752_900_913_957, + 195_419_719_257_838, + 210_114_207_161_354, + 225_913_639_722_280, + 242_901_102_700_662, + 261_165_929_448_653, + 280_804_170_695_076, + 301_919_099_655_195, + 324_621_755_121_965, + 349_031_525_394_759, + 375_276_776_116_320, + 403_495_525_319_597, + 433_836_169_234_393, + 466_458_262_670_681, + 501_533_358_082_447, + 539_245_907_724_525, + 579_794_233_646_657, + 623_391_570_625_777, + 670_267_187_521_060, + 720_667_592_948_706, + 774_857_831_616_833, + 833_122_878_137_625, + 895_769_135_646_485, + 963_126_047_109_104, + 1_035_547_827_789_960, + 1_113_415_327_992_917, + 1_197_138_035_869_669, + 1_287_156_230_828_364, + 1_383_943_298_866_707, + 1_488_008_222_005_383, + 1_599_898_254_913_170, + 1_720_201_802_799_546, + 1_849_551_515_708_982, + 1_988_627_615_489_147, + 2_138_161_472_928_821, + 2_298_939_453_876_902, + 2_471_807_054_568_403, + 2_657_673_347_904_220, + 2_857_515_764_066_674, + 3_072_385_230_611_050, + 3_303_411_699_063_740, + 3_551_810_087_090_170, + 3_818_886_667_481_063, + 4_106_045_937_555_325, + 4_414_798_005_104_243, + 4_746_766_529_718_054, + 5_103_697_261_256_589, + 5_487_467_220_365_940, + 5_900_094_569_319_478, + 6_343_749_225_091_820, + 6_820_764_270_477_575, + 7_333_648_223_263_445, + 7_885_098_227_974_584, + 8_478_014_239_567_711, + 9_115_514_273_659_920, + 9_800_950_803_490_818, + 10_537_928_389_846_000, + 11_330_322_636_653_804, + 12_182_300_571_938_664, + 13_098_342_561_310_038, + 14_083_265_869_225_166, + 15_142_249_991_929_174, + 16_280_863_895_292_920, + 17_505_095_300_786_418, + 18_821_382_173_596_360, + 20_236_646_578_476_860, + 21_758_331_081_373_944, + 23_394_437_888_251_960, + 25_153_570_926_944_424, + 27_044_981_093_328_568, + 29_078_614_899_763_324, + 31_265_166_781_622_228, + 33_616_135_336_989_872, + 36_143_883_795_274_144, + 38_861_705_032_725_504, + 41_783_891_476_765_632, + 44_925_810_266_737_080, + 48_303_984_066_327_840, + 51_936_177_952_645_696, + 55_841_492_838_872_984, + 60_040_465_921_791_112, + 64_555_178_682_406_344, + 69_409_373_007_628_560, + 74_628_576_043_661_488, + 80_240_234_437_681_024, + 86_273_858_673_749_408, + 92_761_178_261_996_064, + 99_736_308_597_171_264, + 107_235_930_364_045_040, + 115_299_482_433_105_296, + 123_969_369_260_951_280, + 133_291_183_886_055_744, + 143_313_947_692_581_776, + 154_090_368_203_119_712, + 165_677_116_256_019_744, + 178_135_124_024_935_328, + 191_529_905_447_796_768, + 205_931_900_750_280_960, + 221_416_846_875_550_944, + 238_066_175_768_274_144, + 255_967_442_607_407_840, + 275_214_786_239_734_496, + 295_909_424_235_466_048, + 318_160_185_169_306_432, + 342_084_080_926_122_112, + 367_806_922_040_850_496, + 395_463_979_308_585_024, + 425_200_695_144_098_752, + 457_173_448_431_691_200, + 491_550_376_887_536_448, + 528_512_261_259_155_712, + 568_253_476_011_826_688, + 610_983_011_501_381_120, + 656_925_573_008_773_888, + 706_322_762_416_006_144, + 759_434_348_737_577_088, + 816_539_634_188_912_512, + 877_938_922_975_624_320, + 943_955_100_527_642_240, + 1_014_935_331_483_065_984, + 1_091_252_885_351_061_632, + 1_173_309_099_454_565_632, + 1_261_535_489_475_482_368, + 1_356_396_018_701_269_504, + 1_458_389_537_906_385_664, + 1_568_052_408_699_399_168, + 1_685_961_324_131_370_496, + 1_812_736_341_398_468_096, + 1_949_044_142_587_138_304, + 2_095_601_540_609_376_000, + 2_253_179_248_765_040_128, + 2_422_605_933_754_521_088, + 2_604_772_573_455_664_640, + 2_800_637_142_381_549_056, + 3_011_229_649_458_912_256, + 3_237_657_554_619_804_160, + 3_481_111_592_691_138_048, + 3_742_872_035_208_694_272, + 4_024_315_423_085_096_960, + 4_326_921_805_537_383_424, + 4_652_282_523_342_105_600, + 5_002_108_577_348_404_224, + 5_378_239_626_257_227_776, + 5_782_653_660_984_053_760, + 6_217_477_406_480_468_992, + 6_684_997_505_715_516_416, + 7_187_672_544_630_912_000, + 7_728_145_981_306_749_952, + 8_309_260_047_329_342_464, + 8_934_070_694_465_457_152, + 9_605_863_665_244_231_680, + 10_328_171_771_958_448_128, + 11_104_793_474_951_653_376, + 11_939_812_857_890_269_184, + 12_837_621_105_066_293_248, + 13_802_939_593_675_003_904, + 14_840_844_722_504_937_472, + 15_956_794_607_608_752_128, + 17_156_657_785_341_708_288, + 18_446_744_073_709_551_615, +]; diff --git a/runtime/vara/src/governance/fellowship.rs b/runtime/vara/src/governance/fellowship.rs index 2cdfe083dd4..e0e9a39c2c4 100644 --- a/runtime/vara/src/governance/fellowship.rs +++ b/runtime/vara/src/governance/fellowship.rs @@ -310,7 +310,7 @@ impl pallet_referenda::Config for Runtime { pallet_ranked_collective::EnsureMember; type CancelOrigin = FellowshipExperts; type KillOrigin = FellowshipMasters; - type Slash = (); + type Slash = Treasury; type Votes = pallet_ranked_collective::Votes; type Tally = pallet_ranked_collective::TallyOf; type SubmissionDeposit = SubmissionDeposit; diff --git a/runtime/vara/src/governance/mod.rs b/runtime/vara/src/governance/mod.rs index dbeff3420d3..cd3189fc2f4 100644 --- a/runtime/vara/src/governance/mod.rs +++ b/runtime/vara/src/governance/mod.rs @@ -83,7 +83,7 @@ impl pallet_referenda::Config for Runtime { type SubmitOrigin = frame_system::EnsureSigned; type CancelOrigin = ReferendumCanceller; type KillOrigin = ReferendumKiller; - type Slash = (); + type Slash = Treasury; type Votes = pallet_conviction_voting::VotesOf; type Tally = pallet_conviction_voting::TallyOf; type SubmissionDeposit = SubmissionDeposit; diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 4daf00ff2d4..42901ff3677 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -25,7 +25,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); use common::storage::{Mailbox, Messenger}; -use frame_election_provider_support::{onchain, SequentialPhragmen}; +use frame_election_provider_support::{ + onchain, ElectionDataProvider, NposSolution, SequentialPhragmen, VoteWeight, +}; use frame_support::weights::ConstantMultiplier; pub use frame_support::{ codec::{Decode, Encode, MaxEncodedLen}, @@ -51,6 +53,7 @@ use frame_system::{ limits::{BlockLength, BlockWeights}, EnsureRoot, }; +use pallet_election_provider_multi_phase::SolutionAccuracyOf; pub use pallet_gear::manager::{ExtManager, HandleKind}; pub use pallet_gear_payment::{CustomChargeTransactionPayment, DelegateFee}; pub use pallet_gear_staking_rewards::StakingBlackList; @@ -75,7 +78,7 @@ use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, NumberFor, OpaqueKeys}, transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, - ApplyExtrinsicResult, Perbill, Percent, Permill, Perquintill, + ApplyExtrinsicResult, FixedU128, Perbill, Percent, Permill, Perquintill, }; use sp_std::{ convert::{TryFrom, TryInto}, @@ -110,6 +113,9 @@ pub use constants::{currency::*, time::*}; // Weights used in the runtime. mod weights; +// Voters weights +mod bag_thresholds; + pub mod governance; use governance::{pallet_custom_origins, GeneralAdmin, Treasurer, TreasurySpender}; @@ -251,7 +257,8 @@ impl pallet_babe::Config for Runtime { type KeyOwnerProof = >::Proof; - type EquivocationReportSystem = (); + type EquivocationReportSystem = + pallet_babe::EquivocationReportSystem; } impl pallet_grandpa::Config for Runtime { @@ -261,12 +268,13 @@ impl pallet_grandpa::Config for Runtime { type MaxAuthorities = MaxAuthorities; type MaxSetIdSessionEntries = MaxSetIdSessionEntries; type KeyOwnerProof = >::Proof; - type EquivocationReportSystem = (); + type EquivocationReportSystem = + pallet_grandpa::EquivocationReportSystem; } impl pallet_authorship::Config for Runtime { type FindAuthor = pallet_session::FindAccountFromAuthorIndex; - type EventHandler = ImOnline; + type EventHandler = (Staking, ImOnline); } parameter_types! { @@ -345,16 +353,6 @@ impl pallet_transaction_payment::Config for Runtime { type FeeMultiplierUpdate = pallet_gear_payment::GearFeeMultiplier; } -parameter_types! { - pub const MinAuthorities: u32 = 1; -} - -impl validator_set::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type AddRemoveOrigin = EnsureRoot; - type MinAuthorities = MinAuthorities; -} - impl_opaque_keys! { pub struct SessionKeys { pub babe: Babe, @@ -367,10 +365,10 @@ impl_opaque_keys! { impl pallet_session::Config for Runtime { type RuntimeEvent = RuntimeEvent; type ValidatorId = ::AccountId; - type ValidatorIdOf = validator_set::ValidatorOf; + type ValidatorIdOf = pallet_staking::StashOf; type ShouldEndSession = Babe; type NextSessionRotation = Babe; - type SessionManager = ValidatorSet; + type SessionManager = pallet_session_historical::NoteHistoricalRoot; type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type WeightInfo = pallet_session::weights::SubstrateWeight; @@ -445,7 +443,130 @@ impl pallet_gear_staking_rewards::Config for Runtime { type WeightInfo = pallet_gear_staking_rewards::weights::SubstrateWeight; } -// TODO: review staking parameters - currently copying Kusama +parameter_types! { + // phase durations. 1/4 of the last session for each. + pub const SignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; + pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; + + // signed config + pub const SignedRewardBase: Balance = DOLLARS; + pub const SignedDepositBase: Balance = DOLLARS; + pub const SignedDepositByte: Balance = CENTS; + + pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); + + // miner configs + pub const MultiPhaseUnsignedPriority: TransactionPriority = StakingUnsignedPriority::get() - 1u64; + pub MinerMaxWeight: Weight = RuntimeBlockWeights::get() + .get(DispatchClass::Normal) + .max_extrinsic.expect("Normal extrinsics have a weight limit configured; qed") + .saturating_sub(BlockExecutionWeight::get()); + // Solution can occupy 90% of normal block size + pub MinerMaxLength: u32 = Perbill::from_rational(9u32, 10) * + *RuntimeBlockLength::get() + .max + .get(DispatchClass::Normal); +} + +frame_election_provider_support::generate_solution_type!( + #[compact] + pub struct NposSolution16::< + VoterIndex = u32, + TargetIndex = u16, + Accuracy = sp_runtime::PerU16, + MaxVoters = MaxElectingVoters, + >(16) +); + +parameter_types! { + // 16; TODO: Kusama has 24 => which one is more appropriate? + pub MaxNominations: u32 = ::LIMIT as u32; + pub MaxElectingVoters: u32 = 40_000; + pub MaxElectableTargets: u16 = 10_000; + // OnChain values are lower. + pub MaxOnChainElectingVoters: u32 = 5000; + pub MaxOnChainElectableTargets: u16 = 1250; + // The maximum winners that can be elected by the Election pallet which is equivalent to the + // maximum active validators the staking pallet can have. + pub MaxActiveValidators: u32 = 1000; +} + +pub struct OnChainSeqPhragmen; +impl onchain::Config for OnChainSeqPhragmen { + type System = Runtime; + type Solver = SequentialPhragmen< + AccountId, + pallet_election_provider_multi_phase::SolutionAccuracyOf, + >; + type DataProvider = ::DataProvider; + type WeightInfo = frame_election_provider_support::weights::SubstrateWeight; + type MaxWinners = ::MaxWinners; + type VotersBound = MaxOnChainElectingVoters; + type TargetsBound = MaxOnChainElectableTargets; +} + +impl pallet_election_provider_multi_phase::MinerConfig for Runtime { + type AccountId = AccountId; + type MaxLength = MinerMaxLength; + type MaxWeight = MinerMaxWeight; + type Solution = NposSolution16; + type MaxVotesPerVoter = + <::DataProvider as ElectionDataProvider>::MaxVotesPerVoter; + type MaxWinners = MaxActiveValidators; + + // The unsigned submissions have to respect the weight of the submit_unsigned call, thus their + // weight estimate function is wired to this call's weight. + fn solution_weight(v: u32, t: u32, a: u32, d: u32) -> Weight { + < + ::WeightInfo + as + pallet_election_provider_multi_phase::WeightInfo + >::submit_unsigned(v, t, a, d) + } +} +pub struct ElectionProviderBenchmarkConfig; +impl pallet_election_provider_multi_phase::BenchmarkingConfig for ElectionProviderBenchmarkConfig { + const VOTERS: [u32; 2] = [1000, 2000]; + const TARGETS: [u32; 2] = [500, 1000]; + const ACTIVE_VOTERS: [u32; 2] = [500, 800]; + const DESIRED_TARGETS: [u32; 2] = [200, 400]; + const SNAPSHOT_MAXIMUM_VOTERS: u32 = 1000; + const MINER_MAXIMUM_VOTERS: u32 = 1000; + const MAXIMUM_TARGETS: u32 = 300; +} + +impl pallet_election_provider_multi_phase::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type EstimateCallFee = TransactionPayment; + type SignedPhase = SignedPhase; + type UnsignedPhase = UnsignedPhase; + type BetterUnsignedThreshold = BetterUnsignedThreshold; + type BetterSignedThreshold = (); + type OffchainRepeat = OffchainRepeat; + type MinerTxPriority = MultiPhaseUnsignedPriority; + type MinerConfig = Self; + type SignedMaxSubmissions = ConstU32<10>; + type SignedRewardBase = SignedRewardBase; + type SignedDepositBase = SignedDepositBase; + type SignedDepositByte = SignedDepositByte; + type SignedMaxRefunds = ConstU32<3>; + type SignedDepositWeight = (); + type SignedMaxWeight = MinerMaxWeight; + type SlashHandler = (); // burn slashes + type RewardHandler = (); // nothing to do upon rewards + type DataProvider = Staking; + type Fallback = onchain::OnChainExecution; + type GovernanceFallback = onchain::OnChainExecution; + type Solver = SequentialPhragmen, ()>; + type ForceOrigin = EnsureRoot; + type MaxElectableTargets = MaxElectableTargets; + type MaxWinners = MaxActiveValidators; + type MaxElectingVoters = MaxElectingVoters; + type BenchmarkingConfig = ElectionProviderBenchmarkConfig; + type WeightInfo = pallet_election_provider_multi_phase::weights::SubstrateWeight; +} + parameter_types! { // Six sessions in an era (12 hours) pub const SessionsPerEra: sp_staking::SessionIndex = 6; @@ -455,6 +576,8 @@ parameter_types! { pub const SlashDeferDuration: sp_staking::EraIndex = 13; pub const MaxNominatorRewardedPerValidator: u32 = 256; pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17); + // 2 hour session, 30 min unsigned phase, 16 offchain executions. + pub OffchainRepeat: BlockNumber = UnsignedPhase::get() / 16; pub HistoryDepth: u32 = 84; } @@ -467,30 +590,13 @@ impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig { type MaxValidators = ConstU32<1000>; } -parameter_types! { - pub const MaxActiveValidators: u32 = 100; - pub const MaxOnChainElectingVoters: u32 = 500; - pub const MaxOnChainElectableTargets: u16 = 100; -} - -pub struct OnChainSeqPhragmen; -impl onchain::Config for OnChainSeqPhragmen { - type System = Runtime; - type Solver = SequentialPhragmen; - type DataProvider = Staking; - type WeightInfo = frame_election_provider_support::weights::SubstrateWeight; - type MaxWinners = MaxActiveValidators; - type VotersBound = MaxOnChainElectingVoters; - type TargetsBound = MaxOnChainElectableTargets; -} - impl pallet_staking::Config for Runtime { - type MaxNominations = ConstU32<16>; // TODO: review with NPoS enabled + type MaxNominations = MaxNominations; type Currency = Balances; type CurrencyBalance = Balance; type UnixTime = Timestamp; type CurrencyToVote = U128CurrencyToVote; - type ElectionProvider = onchain::OnChainExecution; + type ElectionProvider = ElectionProviderMultiPhase; type GenesisElectionProvider = onchain::OnChainExecution; // Burning the reward remainder for now. // TODO: set remainder back to `RewardsStash` to stop burning `Treasury` part. @@ -508,28 +614,135 @@ impl pallet_staking::Config for Runtime { type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator; type OffendingValidatorsThreshold = OffendingValidatorsThreshold; type VoterList = BagsList; - type MaxUnlockingChunks = ConstU32<32>; - type BenchmarkingConfig = StakingBenchmarkingConfig; - type OnStakerSlash = (); - type WeightInfo = pallet_staking::weights::SubstrateWeight; type TargetList = pallet_staking::UseValidatorsMap; + type MaxUnlockingChunks = ConstU32<32>; type HistoryDepth = HistoryDepth; + type OnStakerSlash = NominationPools; + type WeightInfo = pallet_staking::weights::SubstrateWeight; + type BenchmarkingConfig = StakingBenchmarkingConfig; } -// Mocked threshoulds -const THRESHOLDS: [sp_npos_elections::VoteWeight; 9] = - [10, 20, 30, 40, 50, 60, 1_000, 2_000, 10_000]; parameter_types! { - // TODO: replace mocked thresholds with true ones - pub const BagThresholds: &'static [u64] = &THRESHOLDS; + pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS; } -impl pallet_bags_list::Config for Runtime { +impl pallet_bags_list::Config for Runtime { type RuntimeEvent = RuntimeEvent; type ScoreProvider = Staking; - type WeightInfo = pallet_bags_list::weights::SubstrateWeight; type BagThresholds = BagThresholds; - type Score = sp_npos_elections::VoteWeight; + type Score = VoteWeight; + type WeightInfo = pallet_bags_list::weights::SubstrateWeight; +} + +parameter_types! { + pub const PostUnbondPoolsWindow: u32 = 4; + pub const NominationPoolsPalletId: PalletId = PalletId(*b"py/nopls"); + pub const MaxPointsToBalance: u8 = 10; +} + +use sp_runtime::traits::Convert; +pub struct BalanceToU256; +impl Convert for BalanceToU256 { + fn convert(balance: Balance) -> sp_core::U256 { + sp_core::U256::from(balance) + } +} +pub struct U256ToBalance; +impl Convert for U256ToBalance { + fn convert(n: sp_core::U256) -> Balance { + n.try_into().unwrap_or(Balance::max_value()) + } +} + +impl pallet_nomination_pools::Config for Runtime { + type WeightInfo = (); + type RuntimeEvent = RuntimeEvent; + type Currency = Balances; + type RewardCounter = FixedU128; + type BalanceToU256 = BalanceToU256; + type U256ToBalance = U256ToBalance; + type Staking = Staking; + type PostUnbondingPoolsWindow = PostUnbondPoolsWindow; + type MaxMetadataLen = ConstU32<256>; + type MaxUnbonding = ConstU32<8>; + type PalletId = NominationPoolsPalletId; + type MaxPointsToBalance = MaxPointsToBalance; +} + +impl pallet_offences::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type IdentificationTuple = pallet_session_historical::IdentificationTuple; + type OnOffenceHandler = Staking; +} + +parameter_types! { + pub const ProposalBond: Permill = Permill::from_percent(5); + pub const ProposalBondMinimum: Balance = DOLLARS; + pub const SpendPeriod: BlockNumber = DAYS; + pub const Burn: Permill = Permill::from_percent(50); + pub const TipCountdown: BlockNumber = DAYS; + pub const TipFindersFee: Percent = Percent::from_percent(20); + pub const TipReportDepositBase: Balance = DOLLARS; + pub const DataDepositPerByte: Balance = CENTS; + pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); + pub const MaximumReasonLength: u32 = 300; + pub const MaxApprovals: u32 = 100; +} + +impl pallet_treasury::Config for Runtime { + type PalletId = TreasuryPalletId; + type Currency = Balances; + type ApproveOrigin = EitherOfDiverse, Treasurer>; + type RejectOrigin = EitherOfDiverse, Treasurer>; + type RuntimeEvent = RuntimeEvent; + type OnSlash = (); + type ProposalBond = ProposalBond; + type ProposalBondMinimum = ProposalBondMinimum; + type ProposalBondMaximum = (); + type SpendPeriod = SpendPeriod; + type Burn = Burn; + type BurnDestination = (); + type SpendFunds = Bounties; + type WeightInfo = pallet_treasury::weights::SubstrateWeight; + type MaxApprovals = MaxApprovals; + type SpendOrigin = TreasurySpender; +} + +parameter_types! { + pub const BountyCuratorDeposit: Permill = Permill::from_percent(50); + pub const BountyValueMinimum: Balance = 5 * DOLLARS; + pub const BountyDepositBase: Balance = DOLLARS; + pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); + pub const CuratorDepositMin: Balance = DOLLARS; + pub const CuratorDepositMax: Balance = 100 * DOLLARS; + pub const BountyDepositPayoutDelay: BlockNumber = DAYS; + pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS; +} + +impl pallet_bounties::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type BountyDepositBase = BountyDepositBase; + type BountyDepositPayoutDelay = BountyDepositPayoutDelay; + type BountyUpdatePeriod = BountyUpdatePeriod; + type CuratorDepositMultiplier = CuratorDepositMultiplier; + type CuratorDepositMin = CuratorDepositMin; + type CuratorDepositMax = CuratorDepositMax; + type BountyValueMinimum = BountyValueMinimum; + type DataDepositPerByte = DataDepositPerByte; + type MaximumReasonLength = MaximumReasonLength; + type WeightInfo = pallet_bounties::weights::SubstrateWeight; + type ChildBountyManager = ChildBounties; +} + +parameter_types! { + pub const ChildBountyValueMinimum: Balance = DOLLARS; +} + +impl pallet_child_bounties::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type MaxActiveChildBountyCount = ConstU32<5>; + type ChildBountyValueMinimum = ChildBountyValueMinimum; + type WeightInfo = pallet_child_bounties::weights::SubstrateWeight; } parameter_types! { @@ -583,34 +796,6 @@ impl pallet_identity::Config for Runtime { type WeightInfo = pallet_identity::weights::SubstrateWeight; } -parameter_types! { - pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: Balance = DOLLARS; - pub const SpendPeriod: BlockNumber = DAYS; - pub const Burn: Permill = Permill::from_percent(50); - pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); - pub const MaxApprovals: u32 = 100; -} - -impl pallet_treasury::Config for Runtime { - type PalletId = TreasuryPalletId; - type Currency = Balances; - type ApproveOrigin = EitherOfDiverse, Treasurer>; - type RejectOrigin = EitherOfDiverse, Treasurer>; - type RuntimeEvent = RuntimeEvent; - type OnSlash = (); - type ProposalBond = ProposalBond; - type ProposalBondMinimum = ProposalBondMinimum; - type ProposalBondMaximum = (); - type SpendPeriod = SpendPeriod; - type Burn = Burn; - type BurnDestination = (); - type SpendFunds = (); // TODO: set to Bounties in NPoS - type WeightInfo = pallet_treasury::weights::SubstrateWeight; - type MaxApprovals = MaxApprovals; - type SpendOrigin = TreasurySpender; -} - impl pallet_sudo::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; @@ -925,12 +1110,13 @@ construct_runtime!( Balances: pallet_balances = 5, Vesting: pallet_vesting = 10, TransactionPayment: pallet_transaction_payment = 6, - BagsList: pallet_bags_list = 11, + BagsList: pallet_bags_list:: = 11, ImOnline: pallet_im_online = 12, Staking: pallet_staking = 13, Session: pallet_session = 7, Treasury: pallet_treasury = 14, Historical: pallet_session_historical = 15, + Utility: pallet_utility = 8, // Governance ConvictionVoting: pallet_conviction_voting = 16, @@ -940,16 +1126,18 @@ construct_runtime!( Origins: pallet_custom_origins = 20, Whitelist: pallet_whitelist = 21, - // TODO: Remove in stage 2 - ValidatorSet: validator_set = 98, - Sudo: pallet_sudo = 99, - Scheduler: pallet_scheduler = 22, Preimage: pallet_preimage = 23, Identity: pallet_identity = 24, Proxy: pallet_proxy = 25, Multisig: pallet_multisig = 26, - Utility: pallet_utility = 8, + + ElectionProviderMultiPhase: pallet_election_provider_multi_phase = 27, + Offences: pallet_offences = 28, + Bounties: pallet_bounties = 29, + ChildBounties: pallet_child_bounties = 30, + NominationPools: pallet_nomination_pools = 31, + GearProgram: pallet_gear_program = 100, GearMessenger: pallet_gear_messenger = 101, GearScheduler: pallet_gear_scheduler = 102, @@ -959,6 +1147,9 @@ construct_runtime!( StakingRewards: pallet_gear_staking_rewards = 106, GearVoucher: pallet_gear_voucher = 107, + // TODO: Remove in stage 3 + Sudo: pallet_sudo = 99, + // TODO: remove from production version Airdrop: pallet_airdrop = 198, @@ -983,12 +1174,13 @@ construct_runtime!( Balances: pallet_balances = 5, Vesting: pallet_vesting = 10, TransactionPayment: pallet_transaction_payment = 6, - BagsList: pallet_bags_list = 11, + BagsList: pallet_bags_list:: = 11, ImOnline: pallet_im_online = 12, Staking: pallet_staking = 13, Session: pallet_session = 7, Treasury: pallet_treasury = 14, Historical: pallet_session_historical = 15, + Utility: pallet_utility = 8, // Governance ConvictionVoting: pallet_conviction_voting = 16, @@ -998,16 +1190,18 @@ construct_runtime!( Origins: pallet_custom_origins = 20, Whitelist: pallet_whitelist = 21, - // TODO: Remove in stage 2 - ValidatorSet: validator_set = 98, - Sudo: pallet_sudo = 99, - Scheduler: pallet_scheduler = 22, Preimage: pallet_preimage = 23, Identity: pallet_identity = 24, Proxy: pallet_proxy = 25, Multisig: pallet_multisig = 26, - Utility: pallet_utility = 8, + + ElectionProviderMultiPhase: pallet_election_provider_multi_phase = 27, + Offences: pallet_offences = 28, + Bounties: pallet_bounties = 29, + ChildBounties: pallet_child_bounties = 30, + NominationPools: pallet_nomination_pools = 31, + GearProgram: pallet_gear_program = 100, GearMessenger: pallet_gear_messenger = 101, GearScheduler: pallet_gear_scheduler = 102, @@ -1017,6 +1211,9 @@ construct_runtime!( StakingRewards: pallet_gear_staking_rewards = 106, GearVoucher: pallet_gear_voucher = 107, + // TODO: Remove in stage 3 + Sudo: pallet_sudo = 99, + // TODO: remove from production version Airdrop: pallet_airdrop = 198, } diff --git a/utils/wasm-proc/src/main.rs b/utils/wasm-proc/src/main.rs index 134b058e01f..9f92979bb94 100644 --- a/utils/wasm-proc/src/main.rs +++ b/utils/wasm-proc/src/main.rs @@ -21,7 +21,7 @@ use gear_wasm_builder::optimize::{self, OptType, Optimizer}; use parity_wasm::elements::External; use std::{collections::HashSet, fs, path::PathBuf}; -const RT_ALLOWED_IMPORTS: [&str; 64] = [ +const RT_ALLOWED_IMPORTS: [&str; 66] = [ // From `Allocator` (substrate/primitives/io/src/lib.rs) "ext_allocator_free_version_1", "ext_allocator_malloc_version_1", @@ -67,6 +67,8 @@ const RT_ALLOWED_IMPORTS: [&str; 64] = [ "ext_offchain_network_state_version_1", "ext_offchain_random_seed_version_1", "ext_offchain_submit_transaction_version_1", + "ext_offchain_local_storage_clear_version_1", + "ext_offchain_timestamp_version_1", // From `Sandbox` (substrate/primitives/io/src/lib.rs) "ext_sandbox_get_buff_version_1", "ext_sandbox_get_global_val_version_1", From fffdbac3c5e4c915bb2bad4828c061577fefdf16 Mon Sep 17 00:00:00 2001 From: Shamil <66209982+shamilsan@users.noreply.github.com> Date: Tue, 22 Aug 2023 15:17:34 +0400 Subject: [PATCH 074/165] feat: check runtime imports in `make pre-commit` (#3139) --- Makefile | 6 +++++- scripts/gear.sh | 4 ++++ scripts/src/check.sh | 23 ++++++++++++++++++++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4b96305dc1c..90157490cbc 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ show: @ ./scripts/gear.sh show .PHONY: pre-commit -pre-commit: fmt clippy test +pre-commit: fmt clippy test check-runtime-imports .PHONY: check-spec check-spec: @@ -81,6 +81,10 @@ check: check-release: @ ./scripts/gear.sh check gear --release +.PHONY: check-runtime-imports +check-runtime-imports: + @ ./scripts/gear.sh check runtime-imports + # Clippy section .PHONY: clippy clippy: clippy-gear clippy-examples diff --git a/scripts/gear.sh b/scripts/gear.sh index d6e21e70388..a0aa74b546e 100755 --- a/scripts/gear.sh +++ b/scripts/gear.sh @@ -145,6 +145,10 @@ case "$COMMAND" in header "Checking gear workspace" gear_check "$@"; ;; + runtime-imports) + header "Checking runtime imports" + runtime_imports "$@"; ;; + *) header "Unknown option: '$SUBCOMMAND'" check_usage diff --git a/scripts/src/check.sh b/scripts/src/check.sh index badc9588cfe..e8a13ae8a2b 100755 --- a/scripts/src/check.sh +++ b/scripts/src/check.sh @@ -8,12 +8,13 @@ check_usage() { ./gear.sh check [CARGO FLAGS] Flags: - -h, --help show help message and exit + -h, --help show help message and exit Subcommands: - help show help message and exit + help show help message and exit - gear check gear workspace compile + gear check gear workspace compile + runtime_imports check runtime imports against the whitelist EOF } @@ -25,3 +26,19 @@ gear_check() { echo " >> Check crates that use runtime with 'fuzz' feature" cargo check "$@" -p runtime-fuzzer -p runtime-fuzzer-fuzz } + +runtime_imports() { + if [ ! -f target/debug/wasm-proc ]; then + cargo build -p wasm-proc + fi + + if [ ! -f target/debug/wbuild/gear-runtime/gear_runtime.compact.wasm ]; then + cargo build -p gear-runtime + fi + ./target/debug/wasm-proc --check-runtime-imports target/debug/wbuild/gear-runtime/gear_runtime.compact.wasm + + if [ ! -f target/debug/wbuild/vara-runtime/vara_runtime.compact.wasm ]; then + cargo build -p vara-runtime + fi + ./target/debug/wasm-proc --check-runtime-imports target/debug/wbuild/vara-runtime/vara_runtime.compact.wasm +} From 5cee38f7dd1bb424875de5afb443c33c0e478365 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Tue, 22 Aug 2023 14:59:48 +0300 Subject: [PATCH 075/165] refactor(gstd-codegen): use fully qualified paths (#3143) --- gstd/codegen/src/lib.rs | 42 +++++++++++++++++++------------------- gstd/codegen/src/utils.rs | 13 ++++-------- gstd/src/msg/async.rs | 2 +- gstd/src/msg/basic.rs | 7 +++---- gstd/src/msg/encoded.rs | 3 +-- gstd/src/prog/basic.rs | 9 +------- gstd/src/prog/encoded.rs | 11 ++-------- gstd/src/prog/generator.rs | 10 ++------- 8 files changed, 35 insertions(+), 62 deletions(-) diff --git a/gstd/codegen/src/lib.rs b/gstd/codegen/src/lib.rs index cc5e5a61cb8..cf458290381 100644 --- a/gstd/codegen/src/lib.rs +++ b/gstd/codegen/src/lib.rs @@ -340,7 +340,7 @@ pub fn async_init(attr: TokenStream, item: TokenStream) -> TokenStream { /// payload: T, /// value: u128, /// reply_deposit: u64 -/// ) -> Result { +/// ) -> Result { /// // Function call. /// let waiting_reply_to = send_bytes(program, payload, value)?; /// @@ -350,9 +350,9 @@ pub fn async_init(attr: TokenStream, item: TokenStream) -> TokenStream { /// } /// /// // Registering signal. -/// signals().register_signal(waiting_reply_to); +/// crate::async_runtime::signals().register_signal(waiting_reply_to); /// -/// Ok(MessageFuture { waiting_reply_to }) +/// Ok(crate::msg::MessageFuture { waiting_reply_to }) /// } /// /// /// Same as [`send_bytes`](self::send_bytes), but the program @@ -367,12 +367,12 @@ pub fn async_init(attr: TokenStream, item: TokenStream) -> TokenStream { /// /// /// /// - [`send_bytes_for_reply`](self::send_bytes_for_reply) /// /// - -/// pub fn send_bytes_for_reply_as, D: Decode>( +/// pub fn send_bytes_for_reply_as, D: crate::codec::Decode>( /// program: ActorId, /// payload: T, /// value: u128, /// reply_deposit: u64, -/// ) -> Result> { +/// ) -> Result> { /// // Function call. /// let waiting_reply_to = send_bytes(program, payload, value)?; /// @@ -382,9 +382,9 @@ pub fn async_init(attr: TokenStream, item: TokenStream) -> TokenStream { /// } /// /// // Registering signal. -/// signals().register_signal(waiting_reply_to); +/// crate::async_runtime::signals().register_signal(waiting_reply_to); /// -/// Ok(CodecMessageFuture:: { +/// Ok(crate::msg::CodecMessageFuture:: { /// waiting_reply_to, /// _marker: Default::default(), /// }) @@ -419,7 +419,7 @@ pub fn wait_for_reply(attr: TokenStream, item: TokenStream) -> TokenStream { // Generate generics. let decodable_ty = utils::ident("D"); - let decodable_traits = vec![utils::ident("Decode")]; + let decodable_traits = vec![syn::parse_quote!(crate::codec::Decode)]; let (for_reply_generics, for_reply_as_generics) = ( function.sig.generics.clone(), utils::append_generic( @@ -445,7 +445,7 @@ pub fn wait_for_reply(attr: TokenStream, item: TokenStream) -> TokenStream { #function #[doc = #for_reply_docs] - pub fn #for_reply #for_reply_generics ( #inputs #variadic ) -> Result { + pub fn #for_reply #for_reply_generics ( #inputs #variadic ) -> Result { // Function call. let waiting_reply_to = #ident #args ?; @@ -455,13 +455,13 @@ pub fn wait_for_reply(attr: TokenStream, item: TokenStream) -> TokenStream { } // Registering signal. - signals().register_signal(waiting_reply_to); + crate::async_runtime::signals().register_signal(waiting_reply_to); - Ok(MessageFuture { waiting_reply_to }) + Ok(crate::msg::MessageFuture { waiting_reply_to }) } #[doc = #for_reply_as_docs] - pub fn #for_reply_as #for_reply_as_generics ( #inputs #variadic ) -> Result> { + pub fn #for_reply_as #for_reply_as_generics ( #inputs #variadic ) -> Result> { // Function call. let waiting_reply_to = #ident #args ?; @@ -471,9 +471,9 @@ pub fn wait_for_reply(attr: TokenStream, item: TokenStream) -> TokenStream { } // Registering signal. - signals().register_signal(waiting_reply_to); + crate::async_runtime::signals().register_signal(waiting_reply_to); - Ok(CodecMessageFuture:: { waiting_reply_to, _marker: Default::default() }) + Ok(crate::msg::CodecMessageFuture:: { waiting_reply_to, _marker: Default::default() }) } } .into() @@ -524,7 +524,7 @@ pub fn wait_create_program_for_reply(attr: TokenStream, item: TokenStream) -> To // Generate generics. let decodable_ty = utils::ident("D"); - let decodable_traits = vec![utils::ident("Decode")]; + let decodable_traits = vec![syn::parse_quote!(crate::codec::Decode)]; let (for_reply_generics, for_reply_as_generics) = ( function.sig.generics.clone(), utils::append_generic( @@ -538,7 +538,7 @@ pub fn wait_create_program_for_reply(attr: TokenStream, item: TokenStream) -> To #function #[doc = #for_reply_docs] - pub fn #for_reply #for_reply_generics ( #inputs #variadic ) -> Result { + pub fn #for_reply #for_reply_generics ( #inputs #variadic ) -> Result { // Function call. let (waiting_reply_to, program_id) = #ident #args ?; @@ -548,13 +548,13 @@ pub fn wait_create_program_for_reply(attr: TokenStream, item: TokenStream) -> To } // Registering signal. - signals().register_signal(waiting_reply_to); + crate::async_runtime::signals().register_signal(waiting_reply_to); - Ok(CreateProgramFuture { waiting_reply_to, program_id }) + Ok(crate::msg::CreateProgramFuture { waiting_reply_to, program_id }) } #[doc = #for_reply_as_docs] - pub fn #for_reply_as #for_reply_as_generics ( #inputs #variadic ) -> Result> { + pub fn #for_reply_as #for_reply_as_generics ( #inputs #variadic ) -> Result> { // Function call. let (waiting_reply_to, program_id) = #ident #args ?; @@ -564,9 +564,9 @@ pub fn wait_create_program_for_reply(attr: TokenStream, item: TokenStream) -> To } // Registering signal. - signals().register_signal(waiting_reply_to); + crate::async_runtime::signals().register_signal(waiting_reply_to); - Ok(CodecCreateProgramFuture:: { waiting_reply_to, program_id, _marker: Default::default() }) + Ok(crate::msg::CodecCreateProgramFuture:: { waiting_reply_to, program_id, _marker: Default::default() }) } } .into() diff --git a/gstd/codegen/src/utils.rs b/gstd/codegen/src/utils.rs index 102609cc183..a8f4acd7e8c 100644 --- a/gstd/codegen/src/utils.rs +++ b/gstd/codegen/src/utils.rs @@ -20,8 +20,7 @@ use syn::{ parse_quote, punctuated::Punctuated, token::{Comma, Plus}, - Expr, Generics, Ident, PathArguments, PathSegment, Token, TraitBound, TraitBoundModifier, - TypeParam, TypeParamBound, + Expr, Generics, Ident, Path, Token, TraitBound, TraitBoundModifier, TypeParam, TypeParamBound, }; /// Describes how to output documentation for `_for_reply_(as)` @@ -119,19 +118,15 @@ pub fn wait_for_reply_docs(name: String, style: DocumentationStyle) -> (String, /// # Note /// /// Only supports `TraitBound` for now. -pub fn append_generic(mut generics: Generics, ident: Ident, traits: Vec) -> Generics { +pub fn append_generic(mut generics: Generics, ident: Ident, traits: Vec) -> Generics { let mut bounds: Punctuated = Punctuated::new(); - for t in traits { + for path in traits { bounds.push_value( TraitBound { paren_token: None, modifier: TraitBoundModifier::None, lifetimes: None, - path: PathSegment { - ident: t, - arguments: PathArguments::None, - } - .into(), + path, } .into(), ) diff --git a/gstd/src/msg/async.rs b/gstd/src/msg/async.rs index fcf62633072..9cda3082b6e 100644 --- a/gstd/src/msg/async.rs +++ b/gstd/src/msg/async.rs @@ -20,7 +20,7 @@ use crate::{ async_runtime::{self, signals, Lock, ReplyPoll}, errors::{Error, Result}, msg::macros::impl_futures, - prelude::{convert::AsRef, Vec}, + prelude::Vec, ActorId, Config, MessageId, }; use core::{ diff --git a/gstd/src/msg/basic.rs b/gstd/src/msg/basic.rs index ee296c68dc9..dd04fc7cb0c 100644 --- a/gstd/src/msg/basic.rs +++ b/gstd/src/msg/basic.rs @@ -17,15 +17,14 @@ // along with this program. If not, see . use crate::{ - async_runtime::signals, errors::{Error, IntoResult, Result}, - msg::{utils, CodecMessageFuture, MessageFuture}, - prelude::{convert::AsRef, ops::RangeBounds, vec, Vec}, + msg::utils, + prelude::{ops::RangeBounds, vec, Vec}, ActorId, MessageId, ReservationId, }; use gear_core_errors::{ReplyCode, SignalCode}; use gstd_codegen::wait_for_reply; -use scale_info::scale::{Decode, Output}; +use scale_info::scale::Output; /// Message handle. /// diff --git a/gstd/src/msg/encoded.rs b/gstd/src/msg/encoded.rs index cf57e7d2a29..a26b2b06aad 100644 --- a/gstd/src/msg/encoded.rs +++ b/gstd/src/msg/encoded.rs @@ -21,9 +21,8 @@ //! decoded/encoded via SCALE Codec (). use crate::{ - async_runtime::signals, errors::{Error, IntoResult, Result}, - msg::{utils, CodecMessageFuture, MessageFuture}, + msg::utils, prelude::ops::RangeBounds, util::with_optimized_encode, ActorId, MessageId, ReservationId, diff --git a/gstd/src/prog/basic.rs b/gstd/src/prog/basic.rs index 8f7bfc52fe4..afc46d3b9d8 100644 --- a/gstd/src/prog/basic.rs +++ b/gstd/src/prog/basic.rs @@ -16,15 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::{ - async_runtime::signals, - common::errors::Result, - msg::{CodecCreateProgramFuture, CreateProgramFuture}, - prelude::convert::AsRef, - ActorId, CodeId, MessageId, -}; +use crate::{common::errors::Result, ActorId, CodeId, MessageId}; use gstd_codegen::wait_create_program_for_reply; -use scale_info::scale::Decode; /// Create a new program from the already existing on-chain code identified by /// [`CodeId`]. diff --git a/gstd/src/prog/encoded.rs b/gstd/src/prog/encoded.rs index 1511bc1ddd5..6bd99c6e9e9 100644 --- a/gstd/src/prog/encoded.rs +++ b/gstd/src/prog/encoded.rs @@ -16,16 +16,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::{ - async_runtime::signals, - common::errors::Result, - msg::{CodecCreateProgramFuture, CreateProgramFuture}, - prelude::convert::AsRef, - util::with_optimized_encode, - ActorId, CodeId, MessageId, -}; +use crate::{common::errors::Result, util::with_optimized_encode, ActorId, CodeId, MessageId}; use gstd_codegen::wait_create_program_for_reply; -use scale_info::scale::{Decode, Encode}; +use scale_info::scale::Encode; /// Same as [`create_program_bytes`](super::create_program_bytes), but allows /// initialize program with the encodable payload. diff --git a/gstd/src/prog/generator.rs b/gstd/src/prog/generator.rs index 8acfd231c89..bbaee3958f1 100644 --- a/gstd/src/prog/generator.rs +++ b/gstd/src/prog/generator.rs @@ -19,16 +19,10 @@ //! Program generation module use crate::{ - async_runtime::signals, - common::errors::Result, - msg::{CodecCreateProgramFuture, CreateProgramFuture}, - prelude::convert::AsRef, - prog, - util::with_optimized_encode, - ActorId, CodeId, MessageId, + common::errors::Result, prog, util::with_optimized_encode, ActorId, CodeId, MessageId, }; use gstd_codegen::wait_create_program_for_reply; -use scale_info::scale::{alloc::vec::Vec, Decode, Encode}; +use scale_info::scale::{alloc::vec::Vec, Encode}; /// Helper to create programs without setting the salt manually. pub struct ProgramGenerator(u64); From 23889613124cedd7a8458debfed3db6dccd8d24c Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Tue, 22 Aug 2023 15:36:47 +0300 Subject: [PATCH 076/165] feat(docs): generate link to definition (#3144) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 90157490cbc..7e42d79edf5 100644 --- a/Makefile +++ b/Makefile @@ -248,7 +248,7 @@ test-syscalls-integrity-release: # Misc section .PHONY: doc doc: - @ RUSTDOCFLAGS="--enable-index-page -Zunstable-options -D warnings" cargo doc --no-deps \ + @ RUSTDOCFLAGS="--enable-index-page --generate-link-to-definition -Zunstable-options -D warnings" cargo doc --no-deps \ -p galloc -p gclient -p gcore -p gear-backend-common -p gear-backend-sandbox \ -p gear-core -p gear-core-processor -p gear-lazy-pages -p gear-core-errors \ -p gmeta -p gstd -p gtest -p gear-wasm-builder -p gear-common \ From b25d06b381defaeb5d1409bcbc61418e02bf6ea8 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Tue, 22 Aug 2023 17:18:42 +0400 Subject: [PATCH 077/165] chore(node): Update staging spec (#3147) --- node/res/staging.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/node/res/staging.json b/node/res/staging.json index 0082d356abb..6b3b0b8b7cf 100644 --- a/node/res/staging.json +++ b/node/res/staging.json @@ -3,17 +3,18 @@ "id": "gear_staging_testnet_v7", "chainType": "Live", "bootNodes": [ - "/dns4/testnet-validator-node1.gear-tech.io/tcp/30333/p2p/12D3KooWFqktBAWLLvdySqG5QMcxHnpsDi8vjR9rjCxHotXyXn5R", - "/dns4/testnet-validator-node2.gear-tech.io/tcp/30333/p2p/12D3KooWN2Rv9aLGqJ1RohQ9HoYe1nf88Np1M56SZvyWi8rGon36", - "/dns4/testnet-validator-node3.gear-tech.io/tcp/30333/p2p/12D3KooWEVvqVD2mrLfmgeX1EXZ2caFXXEWWEs4Taa4mWzFUoF34", - "/dns4/testnet-validator-node4.gear-tech.io/tcp/30333/p2p/12D3KooWSf2d69w7RYKtj9mgYpLDs3rqLAz9GHNSHHoCQDLUjeiP", - "/dns4/rpc-node.gear-tech.io/tcp/30333/p2p/12D3KooW9rJTnQff6Jm2sfLzt2ConSzGJNTPhLE4cWXPgiVx6Ete" + "/dns4/testnet-connect-1.gear-tech.io/tcp/30333/p2p/12D3KooWHPdB5EpWQjwT6S1ZbDoS33VxGQb5P4H7NdMa3yVDhtuk", + "/dns4/testnet-connect-2.gear-tech.io/tcp/30333/p2p/12D3KooWMoiw7MNTPYSoxWfULN53rxLMAAFVqWzKL7XUQsXsgKru" ], "telemetryEndpoints": null, "protocolId": null, - "properties": null, + "properties": { + "ss58format": null, + "tokenDecimals": null, + "tokenSymbol": null + }, "forkBlocks": null, - "badBlocks": null, + "badBlocks": [], "lightSyncState": null, "codeSubstitutes": {}, "genesis": { From 33e4583e5ea2e6c80e84c18406a6491f7d0d943a Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Tue, 22 Aug 2023 17:56:40 +0400 Subject: [PATCH 078/165] chore: Version 0.3.0 / 300 in master (#3145) --- Cargo.lock | 44 ++++++++++++++++++++--------------------- Cargo.toml | 2 +- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 51ebe927393..24bc4050337 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3569,14 +3569,14 @@ dependencies = [ [[package]] name = "galloc" -version = "0.2.2" +version = "0.3.0" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "0.2.2" +version = "0.3.0" dependencies = [ "anyhow", "base64 0.21.2", @@ -3615,7 +3615,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.2.2" +version = "0.3.0" dependencies = [ "anyhow", "async-trait", @@ -3659,7 +3659,7 @@ dependencies = [ [[package]] name = "gcore" -version = "0.2.2" +version = "0.3.0" dependencies = [ "galloc", "gear-core-errors", @@ -3714,7 +3714,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.2.2" +version = "0.3.0" dependencies = [ "proc-macro2", "quote", @@ -3723,7 +3723,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.2.2" +version = "0.3.0" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3757,7 +3757,7 @@ dependencies = [ [[package]] name = "gear-backend-wasmi" -version = "0.2.2" +version = "0.3.0" dependencies = [ "derive_more", "gear-backend-common", @@ -3795,7 +3795,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "0.2.2" +version = "0.3.0" dependencies = [ "clap 4.3.21", "frame-benchmarking", @@ -3829,7 +3829,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.2.2" +version = "0.3.0" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3857,7 +3857,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.2.2" +version = "0.3.0" dependencies = [ "quote", "syn 2.0.28", @@ -3865,7 +3865,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.2.2" +version = "0.3.0" dependencies = [ "blake2-rfc", "derive_more", @@ -3886,7 +3886,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.2.2" +version = "0.3.0" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3895,7 +3895,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.2.2" +version = "0.3.0" dependencies = [ "actor-system-error", "derive_more", @@ -3952,7 +3952,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "0.2.2" +version = "0.3.0" dependencies = [ "anyhow", "arbitrary", @@ -4284,7 +4284,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "0.2.2" +version = "0.3.0" dependencies = [ "cc", ] @@ -4372,7 +4372,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.2.2" +version = "0.3.0" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4542,7 +4542,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "0.2.2" +version = "0.3.0" dependencies = [ "blake2-rfc", "derive_more", @@ -4556,7 +4556,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.2.2" +version = "0.3.0" dependencies = [ "gmeta", "gstd", @@ -4580,7 +4580,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.2.2" +version = "0.3.0" dependencies = [ "anyhow", "base64 0.21.2", @@ -4631,7 +4631,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.2.2" +version = "0.3.0" dependencies = [ "proc-macro2", "quote", @@ -4640,7 +4640,7 @@ dependencies = [ [[package]] name = "gstd" -version = "0.2.2" +version = "0.3.0" dependencies = [ "bs58", "futures", @@ -4669,7 +4669,7 @@ dependencies = [ [[package]] name = "gsys" -version = "0.2.2" +version = "0.3.0" [[package]] name = "gtest" diff --git a/Cargo.toml b/Cargo.toml index a49cbeab532..9b340a56b53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.2.2" +version = "0.3.0" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 1ffb58ce9a1..ab9afe913b6 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -121,7 +121,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 220, + spec_version: 300, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 42901ff3677..41cdf8ed853 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 220, + spec_version: 300, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 00e25417476240b18a9f64f85e518b38f430e79b Mon Sep 17 00:00:00 2001 From: nikvolf Date: Tue, 22 Aug 2023 18:21:48 +0400 Subject: [PATCH 079/165] Update labels in release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ef5f48eb8a6..be0f383ce8b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,7 @@ jobs: build: needs: prepare - runs-on: [self-hosted, epyc-4, k8s-runner] + runs-on: [kuberunner, github-runner-01, github-runner-02, github-runner-03] steps: - name: Checkout uses: actions/checkout@v3 From 34959dc8243e94342f6e340d9d75faecb2e65fe6 Mon Sep 17 00:00:00 2001 From: nikvolf Date: Tue, 22 Aug 2023 18:26:34 +0400 Subject: [PATCH 080/165] Update labels in release workflow --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be0f383ce8b..915fb6961dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,7 @@ jobs: build: needs: prepare - runs-on: [kuberunner, github-runner-01, github-runner-02, github-runner-03] + runs-on: [kuberunner] steps: - name: Checkout uses: actions/checkout@v3 From 7acdbc5835ce567a4a0b8064d43bcc229aa7d84b Mon Sep 17 00:00:00 2001 From: Fluid <90795031+fluiderson@users.noreply.github.com> Date: Tue, 22 Aug 2023 18:28:59 +0300 Subject: [PATCH 081/165] refactor(gstd): align gstd reexports & prelude items with `std` (#3047) --- examples/async/src/lib.rs | 2 +- examples/calc-hash/over-blocks/src/code.rs | 2 +- examples/constructor/src/wasm.rs | 2 +- examples/custom/src/btree.rs | 2 +- examples/custom/src/capacitor.rs | 2 +- examples/distributor/src/lib.rs | 2 +- examples/fungible-token/io/src/lib.rs | 2 +- examples/init-wait/src/code.rs | 2 +- examples/program-generator/src/lib.rs | 2 +- examples/rwlock/src/lib.rs | 2 +- examples/wait_wake/src/lib.rs | 2 +- examples/waiter/src/code.rs | 19 ++++--- gmeta/codegen/src/lib.rs | 2 +- gstd/codegen/src/lib.rs | 2 +- gstd/src/async_runtime/locks.rs | 3 +- gstd/src/lib.rs | 2 +- gstd/src/macros/debug.rs | 2 +- gstd/src/prelude.rs | 61 +++++++++++++++------- gstd/src/{lock => sync}/access.rs | 2 +- gstd/src/{lock => sync}/mod.rs | 0 gstd/src/{lock => sync}/mutex.rs | 4 +- gstd/src/{lock => sync}/rwlock.rs | 6 +-- pallets/gear/src/tests.rs | 2 +- 23 files changed, 78 insertions(+), 49 deletions(-) rename gstd/src/{lock => sync}/access.rs (97%) rename gstd/src/{lock => sync}/mod.rs (100%) rename gstd/src/{lock => sync}/mutex.rs (98%) rename gstd/src/{lock => sync}/rwlock.rs (98%) diff --git a/examples/async/src/lib.rs b/examples/async/src/lib.rs index 46759ad8d4b..c193368d6d4 100644 --- a/examples/async/src/lib.rs +++ b/examples/async/src/lib.rs @@ -37,7 +37,7 @@ pub enum Command { #[cfg(not(feature = "std"))] mod wasm { use crate::Command; - use gstd::{lock::Mutex, msg, prelude::*, ActorId}; + use gstd::{msg, prelude::*, sync::Mutex, ActorId}; static mut DESTINATION: ActorId = ActorId::zero(); static MUTEX: Mutex = Mutex::new(0); diff --git a/examples/calc-hash/over-blocks/src/code.rs b/examples/calc-hash/over-blocks/src/code.rs index b266a98c05b..2d304ce3493 100644 --- a/examples/calc-hash/over-blocks/src/code.rs +++ b/examples/calc-hash/over-blocks/src/code.rs @@ -58,7 +58,7 @@ extern "C" fn handle() { mod state { use super::types::Package; - use gstd::BTreeMap; + use gstd::collections::BTreeMap; use shared::PackageId; pub static mut THRESHOLD: Option = None; diff --git a/examples/constructor/src/wasm.rs b/examples/constructor/src/wasm.rs index 2c4b5085ac5..4461952ba8e 100644 --- a/examples/constructor/src/wasm.rs +++ b/examples/constructor/src/wasm.rs @@ -1,5 +1,5 @@ use crate::{Call, Scheme}; -use gstd::{msg, BTreeMap, String, Vec}; +use gstd::{collections::BTreeMap, msg, String, Vec}; pub(crate) static mut DATA: BTreeMap> = BTreeMap::new(); static mut SCHEME: Option = None; diff --git a/examples/custom/src/btree.rs b/examples/custom/src/btree.rs index 9451e0c5fb2..6d4293858f3 100644 --- a/examples/custom/src/btree.rs +++ b/examples/custom/src/btree.rs @@ -45,7 +45,7 @@ pub enum StateRequest { #[cfg(not(feature = "std"))] pub(crate) mod wasm { use super::*; - use gstd::{debug, msg, prelude::*, BTreeMap}; + use gstd::{collections::BTreeMap, debug, msg, prelude::*}; pub(crate) type State = BTreeMap; diff --git a/examples/custom/src/capacitor.rs b/examples/custom/src/capacitor.rs index 79d4b869ebb..ef63d5d6e20 100644 --- a/examples/custom/src/capacitor.rs +++ b/examples/custom/src/capacitor.rs @@ -18,7 +18,7 @@ #[cfg(not(feature = "std"))] pub(crate) mod wasm { - use gstd::{debug, msg, prelude::*, String, Vec}; + use gstd::{debug, msg, prelude::*, str::FromStr, String, Vec}; #[derive(Default)] pub(crate) struct State { diff --git a/examples/distributor/src/lib.rs b/examples/distributor/src/lib.rs index 15ee3f38c2b..0508f3a4d2c 100644 --- a/examples/distributor/src/lib.rs +++ b/examples/distributor/src/lib.rs @@ -57,7 +57,7 @@ mod wasm { use alloc::collections::BTreeSet; use core::future::Future; - use gstd::{debug, lock::Mutex, msg}; + use gstd::{debug, msg, sync::Mutex}; static mut STATE: Option = None; diff --git a/examples/fungible-token/io/src/lib.rs b/examples/fungible-token/io/src/lib.rs index c5af655dc9f..f0b32bc7b47 100644 --- a/examples/fungible-token/io/src/lib.rs +++ b/examples/fungible-token/io/src/lib.rs @@ -20,7 +20,7 @@ use core::ops::Range; use gmeta::{In, InOut, Metadata, Out}; -use gstd::{codec::MaxEncodedLen, prelude::*, ActorId}; +use gstd::{prelude::*, ActorId}; pub struct FungibleTokenMetadata; diff --git a/examples/init-wait/src/code.rs b/examples/init-wait/src/code.rs index a96868dcf27..432a5fe94f1 100644 --- a/examples/init-wait/src/code.rs +++ b/examples/init-wait/src/code.rs @@ -1,4 +1,4 @@ -use gstd::{exec, msg, BTreeMap, MessageId}; +use gstd::{exec, msg, collections::BTreeMap, MessageId}; #[derive(PartialEq, Debug)] enum State { diff --git a/examples/program-generator/src/lib.rs b/examples/program-generator/src/lib.rs index b3aa2869011..aaf1295970a 100644 --- a/examples/program-generator/src/lib.rs +++ b/examples/program-generator/src/lib.rs @@ -39,7 +39,7 @@ pub const CHILD_WAT: &str = r#" #[cfg(not(feature = "std"))] mod wasm { - use gstd::{prelude::*, prog::ProgramGenerator, CodeId}; + use gstd::{collections::BTreeSet, prelude::*, prog::ProgramGenerator, CodeId}; fn check_salt_uniqueness() { let salts: Vec<_> = (0..10).map(|_| ProgramGenerator::get_salt()).collect(); diff --git a/examples/rwlock/src/lib.rs b/examples/rwlock/src/lib.rs index 5382886dbf7..23e073c2fea 100644 --- a/examples/rwlock/src/lib.rs +++ b/examples/rwlock/src/lib.rs @@ -47,7 +47,7 @@ mod wasm { ptr, task::{Context, RawWaker, RawWakerVTable, Waker}, }; - use gstd::{lock::RwLock, msg, prelude::*, ActorId}; + use gstd::{msg, prelude::*, sync::RwLock, ActorId}; static mut DESTINATION: ActorId = ActorId::zero(); static RW_LOCK: RwLock = RwLock::new(0); diff --git a/examples/wait_wake/src/lib.rs b/examples/wait_wake/src/lib.rs index 9820a1211ad..fd86d83b2d5 100644 --- a/examples/wait_wake/src/lib.rs +++ b/examples/wait_wake/src/lib.rs @@ -37,7 +37,7 @@ pub enum Request { #[cfg(not(feature = "std"))] mod wasm { use super::*; - use gstd::{exec, msg, prelude::*, MessageId}; + use gstd::{collections::BTreeMap, exec, msg, prelude::*, MessageId}; static mut ECHOES: Option> = None; diff --git a/examples/waiter/src/code.rs b/examples/waiter/src/code.rs index 77753d70c5f..f50b87702f2 100644 --- a/examples/waiter/src/code.rs +++ b/examples/waiter/src/code.rs @@ -4,13 +4,16 @@ use crate::{ }; use core::ops::{Deref, DerefMut}; use futures::future; -use gstd::{errors::Error, exec, format, lock, msg, MessageId}; +use gstd::{ + exec, format, msg, + sync::{Mutex, MutexGuard, RwLock, RwLockReadGuard, RwLockWriteGuard}, +}; -static mut MUTEX: lock::Mutex<()> = lock::Mutex::new(()); -static mut MUTEX_LOCK_GUARD: Option> = None; -static mut RW_LOCK: lock::RwLock<()> = lock::RwLock::new(()); -static mut R_LOCK_GUARD: Option> = None; -static mut W_LOCK_GUARD: Option> = None; +static mut MUTEX: Mutex<()> = Mutex::new(()); +static mut MUTEX_LOCK_GUARD: Option> = None; +static mut RW_LOCK: RwLock<()> = RwLock::new(()); +static mut R_LOCK_GUARD: Option> = None; +static mut W_LOCK_GUARD: Option> = None; #[gstd::async_main] async fn main() { @@ -134,8 +137,8 @@ fn process_wait_subcommand(subcommand: WaitSubcommand) { } async fn process_mx_lock_continuation( - static_lock_guard: &'static mut Option>, - lock_guard: lock::MutexGuard<'static, ()>, + static_lock_guard: &'static mut Option>, + lock_guard: MutexGuard<'static, ()>, continuation: MxLockContinuation, ) { match continuation { diff --git a/gmeta/codegen/src/lib.rs b/gmeta/codegen/src/lib.rs index d1e5f40e06e..a8c22280901 100644 --- a/gmeta/codegen/src/lib.rs +++ b/gmeta/codegen/src/lib.rs @@ -426,7 +426,7 @@ fn process(module: ItemMod) -> Result { #[no_mangle] extern "C" fn metadata() { - let mut funcs = ::gstd::BTreeMap::new(); + let mut funcs = ::gstd::collections::BTreeMap::new(); let mut registry = ::gmeta::Registry::new(); #(#type_registrations)* diff --git a/gstd/codegen/src/lib.rs b/gstd/codegen/src/lib.rs index cf458290381..71125b3e680 100644 --- a/gstd/codegen/src/lib.rs +++ b/gstd/codegen/src/lib.rs @@ -479,7 +479,7 @@ pub fn wait_for_reply(attr: TokenStream, item: TokenStream) -> TokenStream { .into() } -/// Similar to [`wait_for_reply`], but works with functions that create programs: +/// Similar to [`macro@wait_for_reply`], but works with functions that create programs: /// It returns a message id with a newly created program id. #[proc_macro_attribute] pub fn wait_create_program_for_reply(attr: TokenStream, item: TokenStream) -> TokenStream { diff --git a/gstd/src/async_runtime/locks.rs b/gstd/src/async_runtime/locks.rs index 4fd3aaf2414..758922fd652 100644 --- a/gstd/src/async_runtime/locks.rs +++ b/gstd/src/async_runtime/locks.rs @@ -17,9 +17,10 @@ // along with this program. If not, see . use crate::{ + collections::BTreeMap, config::WaitType, errors::{Error, Result}, - exec, BTreeMap, Config, MessageId, + exec, Config, MessageId, }; use core::cmp::Ordering; use hashbrown::HashMap; diff --git a/gstd/src/lib.rs b/gstd/src/lib.rs index 4f7424bbe28..cc5790ba1ad 100644 --- a/gstd/src/lib.rs +++ b/gstd/src/lib.rs @@ -142,12 +142,12 @@ mod async_runtime; mod common; mod config; pub mod exec; -pub mod lock; mod macros; pub mod msg; pub mod prelude; pub mod prog; mod reservations; +pub mod sync; pub mod util; pub use async_runtime::{handle_signal, message_loop, record_reply}; diff --git a/gstd/src/macros/debug.rs b/gstd/src/macros/debug.rs index 68af96b1735..2d41395c6fa 100644 --- a/gstd/src/macros/debug.rs +++ b/gstd/src/macros/debug.rs @@ -49,7 +49,7 @@ #[macro_export] macro_rules! debug { ($($arg:tt)*) => { - $crate::ext::debug(&$crate::prelude::format!($($arg)*)).unwrap() + $crate::ext::debug(&$crate::format!($($arg)*)).unwrap() }; } diff --git a/gstd/src/prelude.rs b/gstd/src/prelude.rs index a5b3f536a25..17f62c53f67 100644 --- a/gstd/src/prelude.rs +++ b/gstd/src/prelude.rs @@ -19,25 +19,50 @@ //! The `gstd` default prelude. Re-imports default `std` modules and traits. //! `std` can be safely replaced to `gstd` in the Rust programs. -pub use core::prelude::v1::*; +// Reexports from Rust's libraries -// Public module re-exports -pub use alloc::{borrow, boxed, collections, fmt, format, rc, slice, string, vec}; +pub use ::alloc::{ + alloc, borrow, + borrow::ToOwned, + boxed, + boxed::Box, + fmt, format, rc, str, string, + string::{String, ToString}, + vec, + vec::Vec, +}; pub use core::{ - any, cell, clone, cmp, convert, default, future, hash, hint, iter, marker, mem, ops, pin, ptr, + any, array, ascii, assert_eq, assert_ne, cell, char, clone, cmp, convert, debug_assert, + debug_assert_eq, debug_assert_ne, default, future, hash, hint, iter, marker, matches, mem, num, + ops, option, panic, pin, prelude::rust_2021::*, primitive, ptr, result, slice, task, time, + todo, unimplemented, unreachable, write, writeln, }; -// Re-exported types and traits -pub use alloc::str::FromStr; -pub use borrow::ToOwned; -pub use boxed::Box; -pub use collections::{BTreeMap, BTreeSet, VecDeque}; -pub use convert::{Into, TryInto}; -pub use hashbrown::HashMap; -pub use scale_info::{ - self, - scale::{self as codec, Decode, Encode, MaxEncodedLen}, - TypeInfo, -}; -pub use string::{String, ToString}; -pub use vec::Vec; +/// Collection types. +/// +/// See [`alloc::collections`] & [`hashbrown`]. +/// +/// [`alloc::collections`]: ::alloc::collections +pub mod collections { + pub use ::alloc::collections::*; + pub use ::hashbrown::{hash_map, hash_set, HashMap, HashSet}; + + /// Reexports from [`hashbrown`]. + pub mod hashbrown { + pub use hashbrown::{Equivalent, TryReserveError}; + } +} +/// Utilities related to FFI bindings. +/// +/// See [`alloc::ffi`] & [`core::ffi`]. +/// +/// [`alloc::ffi`]: ::alloc::ffi +pub mod ffi { + pub use ::alloc::ffi::*; + pub use core::ffi::*; +} + +// Reexports from third-party libraries + +pub use parity_scale_codec::{self as codec, Decode, Encode, EncodeLike, MaxEncodedLen}; +pub use scale_info::{self, TypeInfo}; diff --git a/gstd/src/lock/access.rs b/gstd/src/sync/access.rs similarity index 97% rename from gstd/src/lock/access.rs rename to gstd/src/sync/access.rs index 5454a40b945..b61e4f4e171 100644 --- a/gstd/src/lock/access.rs +++ b/gstd/src/sync/access.rs @@ -18,7 +18,7 @@ //! This module gives mechanism of waking for async lockers. -use crate::{prelude::VecDeque, MessageId}; +use crate::{collections::VecDeque, MessageId}; use core::cell::UnsafeCell; // Option to make new `const fn` diff --git a/gstd/src/lock/mod.rs b/gstd/src/sync/mod.rs similarity index 100% rename from gstd/src/lock/mod.rs rename to gstd/src/sync/mod.rs diff --git a/gstd/src/lock/mutex.rs b/gstd/src/sync/mutex.rs similarity index 98% rename from gstd/src/lock/mutex.rs rename to gstd/src/sync/mutex.rs index 501d3802eef..c93b4af9513 100644 --- a/gstd/src/lock/mutex.rs +++ b/gstd/src/sync/mutex.rs @@ -44,7 +44,7 @@ use core::{ /// the `PONG` reply from program B and unlocks the mutex. /// /// ``` -/// use gstd::{lock::Mutex, msg, ActorId}; +/// use gstd::{msg, sync::Mutex, ActorId}; /// /// static mut DEST: ActorId = ActorId::zero(); /// static MUTEX: Mutex<()> = Mutex::new(()); @@ -203,7 +203,7 @@ unsafe impl Sync for Mutex {} /// they can be inferred automatically. /// /// ``` -/// use gstd::lock::{Mutex, MutexGuard, MutexLockFuture}; +/// use gstd::sync::{Mutex, MutexGuard, MutexLockFuture}; /// /// #[gstd::async_main] /// async fn main() { diff --git a/gstd/src/lock/rwlock.rs b/gstd/src/sync/rwlock.rs similarity index 98% rename from gstd/src/lock/rwlock.rs rename to gstd/src/sync/rwlock.rs index d384d8be6e0..f2f701954ec 100644 --- a/gstd/src/lock/rwlock.rs +++ b/gstd/src/sync/rwlock.rs @@ -53,7 +53,7 @@ const READERS_LIMIT: ReadersCount = 32; /// case of the `inc` command. /// /// ``` -/// use gstd::{lock::RwLock, msg, ActorId}; +/// use gstd::{msg, sync::RwLock, ActorId}; /// /// static mut DEST: ActorId = ActorId::zero(); /// static RWLOCK: RwLock = RwLock::new(0); @@ -310,7 +310,7 @@ impl DerefMut for RwLockWriteGuard<'_, T> { /// they can be inferred automatically. /// /// ``` -/// use gstd::lock::{RwLock, RwLockReadFuture, RwLockReadGuard}; +/// use gstd::sync::{RwLock, RwLockReadFuture, RwLockReadGuard}; /// /// #[gstd::async_main] /// async fn main() { @@ -334,7 +334,7 @@ pub struct RwLockReadFuture<'a, T> { /// # Examples /// /// ``` -/// use gstd::lock::{RwLock, RwLockWriteFuture, RwLockWriteGuard}; +/// use gstd::sync::{RwLock, RwLockWriteFuture, RwLockWriteGuard}; /// /// #[gstd::async_main] /// async fn main() { diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 9ad53ab2662..e5d7525c62e 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -73,7 +73,7 @@ use gear_core::{ }; use gear_core_errors::*; use gear_wasm_instrument::STACK_END_EXPORT_NAME; -use gstd::{errors::Error as GstdError, BTreeMap}; +use gstd::{collections::BTreeMap, errors::Error as GstdError}; use sp_runtime::{traits::UniqueSaturatedInto, SaturatedConversion}; use sp_std::convert::TryFrom; pub use utils::init_logger; From d8c3fd302d19339eed48ce627b203583a83fe870 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Tue, 22 Aug 2023 20:38:13 +0400 Subject: [PATCH 082/165] bugfix!(runtime): Fix the issue of value counter (#3152) --- core-processor/src/executor.rs | 15 ++++++- examples/constructor/src/builder.rs | 12 ++++++ examples/constructor/src/call.rs | 20 ++++++++++ pallets/gear/src/tests.rs | 61 +++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+), 1 deletion(-) diff --git a/core-processor/src/executor.rs b/core-processor/src/executor.rs index 13942145ff9..df24b6924be 100644 --- a/core-processor/src/executor.rs +++ b/core-processor/src/executor.rs @@ -293,7 +293,20 @@ where let message_context = MessageContext::new(dispatch.clone(), program_id, msg_ctx_settings); // Creating value counter. - let value_counter = ValueCounter::new(balance + dispatch.value()); + // + // NOTE: Value available equals free balance with message value if value + // wasn't transferred to program yet. + // + // In case of second execution (between waits) - message value already + // included in free balance or wasted. + let value_available = balance.saturating_add( + dispatch + .context() + .is_none() + .then(|| dispatch.value()) + .unwrap_or_default(), + ); + let value_counter = ValueCounter::new(value_available); let context = ProcessorContext { gas_counter, diff --git a/examples/constructor/src/builder.rs b/examples/constructor/src/builder.rs index d8316b39b86..3b55569ab8c 100644 --- a/examples/constructor/src/builder.rs +++ b/examples/constructor/src/builder.rs @@ -84,10 +84,18 @@ impl Calls { self.add_call(Call::Value).store(key) } + pub fn value_available(self, key: impl AsRef) -> Self { + self.add_call(Call::ValueAvailable).store(key) + } + pub fn value_as_vec(self, key: impl AsRef) -> Self { self.add_call(Call::Value).store_vec(key) } + pub fn value_available_as_vec(self, key: impl AsRef) -> Self { + self.add_call(Call::ValueAvailable).store_vec(key) + } + pub fn message_id(self, key: impl AsRef) -> Self { self.add_call(Call::MessageId).store(key) } @@ -260,6 +268,10 @@ impl Calls { self.add_call(Call::Wait) } + pub fn wait_for(self, duration: impl Into>) -> Self { + self.add_call(Call::WaitFor(duration.into())) + } + pub fn wake(self, message_id: impl Into>) -> Self { self.add_call(Call::Wake(message_id.into())) } diff --git a/examples/constructor/src/call.rs b/examples/constructor/src/call.rs index 999a040222b..0287abd0db5 100644 --- a/examples/constructor/src/call.rs +++ b/examples/constructor/src/call.rs @@ -21,6 +21,7 @@ pub enum Call { Source, ReplyCode, Value, + ValueAvailable, Send( Arg<[u8; 32]>, Arg>, @@ -37,6 +38,7 @@ pub enum Call { Load, LoadBytes, Wait, + WaitFor(Arg), Wake(Arg<[u8; 32]>), MessageId, Loop, @@ -263,6 +265,12 @@ mod wasm { Some(msg::value().encode()) } + fn value_available(self) -> Option> { + (!matches!(self, Self::ValueAvailable)).then(|| unreachable!()); + + Some(exec::value_available().encode()) + } + fn load(self) -> Option> { (!matches!(self, Self::Load)).then(|| unreachable!()); @@ -281,6 +289,16 @@ mod wasm { exec::wait() } + fn wait_for(self) -> ! { + let Self::WaitFor(duration) = self else { + unreachable!() + }; + + let duration = duration.value(); + + exec::wait_for(duration) + } + fn wake(self) -> Option> { let Self::Wake(message_id) = self else { unreachable!() @@ -320,9 +338,11 @@ mod wasm { Call::Noop => None, Call::IfElse(..) => self.if_else(previous), Call::Value => self.value(), + Call::ValueAvailable => self.value_available(), Call::Load => self.load(), Call::LoadBytes => self.load_bytes(), Call::Wait => self.wait(), + Call::WaitFor(..) => self.wait_for(), Call::Wake(..) => self.wake(), Call::MessageId => self.message_id(), #[allow(clippy::empty_loop)] diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index e5d7525c62e..acad5300ad6 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -81,6 +81,67 @@ use utils::*; type Gas = <::GasProvider as common::GasProvider>::GasTree; +#[test] +fn value_counter_set_correctly_for_interruptions() { + use demo_constructor::{Arg, Calls, Scheme}; + + // Equivalent of: + // + // use gstd::{msg, exec}; + // + // #[no_mangle] + // extern "C" fn handle() { + // msg::send(msg::source(), exec::value_available(), 0).unwrap(); + // msg::send_bytes(Default::default(), [], msg::value()).unwrap(); + // exec::wait_for(1); + // } + // + // Message auto wakes on the next block after execution and + // does everything again from the beginning. + // + // So for the first run we expect source to receive + // `value_available` == `init_value` + msg value. + // For second run we expect just `init_value`. + let handle = Calls::builder() + .source("source_store") + .value("value_store") + .value_available_as_vec("value_available_store") + .send_wgas("source_store", "value_available_store", 0) + .send_value(Arg::new([0u8; 32]), Arg::new(vec![]), "value_store") + .wait_for(1); + + let scheme = Scheme::predefined(Calls::builder().noop(), handle, Calls::builder().noop()); + + init_logger(); + new_test_ext().execute_with(|| { + const INIT_VALUE: u128 = 123_123_123; + const VALUE: u128 = 10_000; + + let (_mid, pid) = init_constructor_with_value(scheme, INIT_VALUE); + + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + Default::default(), + BlockGasLimitOf::::get(), + VALUE, + false + )); + + run_to_next_block(None); + let msg = maybe_last_message(USER_1).expect("Message should be"); + let value_available = + u128::decode(&mut msg.payload_bytes()).expect("Failed to decode value available"); + assert_eq!(value_available, INIT_VALUE + VALUE); + + run_to_next_block(None); + let msg = maybe_last_message(USER_1).expect("Message should be"); + let value_available = + u128::decode(&mut msg.payload_bytes()).expect("Failed to decode value available"); + assert_eq!(value_available, INIT_VALUE); + }); +} + #[test] fn calculate_gas_returns_not_block_limit() { use demo_program_generator::{CHILD_WAT, WASM_BINARY}; From f6a87e50d1553ffa62c75ae39683e50ddb413128 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Tue, 22 Aug 2023 20:38:34 +0400 Subject: [PATCH 083/165] chore: Version 0.3.1 / 310 (#3153) --- Cargo.lock | 44 ++++++++++++++++++++--------------------- Cargo.toml | 2 +- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24bc4050337..8cfd025934f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3569,14 +3569,14 @@ dependencies = [ [[package]] name = "galloc" -version = "0.3.0" +version = "0.3.1" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "base64 0.21.2", @@ -3615,7 +3615,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "async-trait", @@ -3659,7 +3659,7 @@ dependencies = [ [[package]] name = "gcore" -version = "0.3.0" +version = "0.3.1" dependencies = [ "galloc", "gear-core-errors", @@ -3714,7 +3714,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.3.0" +version = "0.3.1" dependencies = [ "proc-macro2", "quote", @@ -3723,7 +3723,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.3.0" +version = "0.3.1" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3757,7 +3757,7 @@ dependencies = [ [[package]] name = "gear-backend-wasmi" -version = "0.3.0" +version = "0.3.1" dependencies = [ "derive_more", "gear-backend-common", @@ -3795,7 +3795,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "0.3.0" +version = "0.3.1" dependencies = [ "clap 4.3.21", "frame-benchmarking", @@ -3829,7 +3829,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.3.0" +version = "0.3.1" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3857,7 +3857,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.3.0" +version = "0.3.1" dependencies = [ "quote", "syn 2.0.28", @@ -3865,7 +3865,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.3.0" +version = "0.3.1" dependencies = [ "blake2-rfc", "derive_more", @@ -3886,7 +3886,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.3.0" +version = "0.3.1" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3895,7 +3895,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.3.0" +version = "0.3.1" dependencies = [ "actor-system-error", "derive_more", @@ -3952,7 +3952,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "arbitrary", @@ -4284,7 +4284,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "0.3.0" +version = "0.3.1" dependencies = [ "cc", ] @@ -4372,7 +4372,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.3.0" +version = "0.3.1" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4542,7 +4542,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "0.3.0" +version = "0.3.1" dependencies = [ "blake2-rfc", "derive_more", @@ -4556,7 +4556,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.3.0" +version = "0.3.1" dependencies = [ "gmeta", "gstd", @@ -4580,7 +4580,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.3.0" +version = "0.3.1" dependencies = [ "anyhow", "base64 0.21.2", @@ -4631,7 +4631,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.3.0" +version = "0.3.1" dependencies = [ "proc-macro2", "quote", @@ -4640,7 +4640,7 @@ dependencies = [ [[package]] name = "gstd" -version = "0.3.0" +version = "0.3.1" dependencies = [ "bs58", "futures", @@ -4669,7 +4669,7 @@ dependencies = [ [[package]] name = "gsys" -version = "0.3.0" +version = "0.3.1" [[package]] name = "gtest" diff --git a/Cargo.toml b/Cargo.toml index 9b340a56b53..50781b4ab99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.3.0" +version = "0.3.1" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index ab9afe913b6..1399506bf3e 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -121,7 +121,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 300, + spec_version: 310, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 41cdf8ed853..03774c08b01 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 300, + spec_version: 310, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 5d8fb07221d187b573b1d68fd7f2445682465ef8 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Tue, 22 Aug 2023 20:38:53 +0400 Subject: [PATCH 084/165] refactor(runtime-interface): Serialize `MemoryInterval`, remove `GasLeft` (#2994) Co-authored-by: Dmitry Novikov --- Cargo.lock | 24 + Cargo.toml | 2 + common/lazy-pages/Cargo.toml | 2 + common/lazy-pages/src/lib.rs | 36 +- core-backend/common/Cargo.toml | 1 + core-backend/common/src/lazy_pages.rs | 2 - core-backend/common/src/memory.rs | 19 +- core/Cargo.toml | 1 + core/src/memory.rs | 27 + lazy-pages/src/common.rs | 44 +- lazy-pages/src/globals.rs | 31 +- lazy-pages/src/host_func.rs | 83 +- lazy-pages/src/lib.rs | 20 +- lazy-pages/src/process.rs | 2 +- lazy-pages/src/signal.rs | 91 +- lazy-pages/src/tests.rs | 8 +- pallets/gear/src/weights.rs | 2850 ++++++++--------- runtime-interface/Cargo.toml | 2 + runtime-interface/src/lib.rs | 88 +- runtime/gear/src/tests.rs | 2 +- runtime/gear/src/weights/frame_system.rs | 78 +- runtime/gear/src/weights/pallet_balances.rs | 58 +- runtime/gear/src/weights/pallet_gear.rs | 2850 ++++++++--------- .../gear/src/weights/pallet_gear_voucher.rs | 10 +- runtime/gear/src/weights/pallet_timestamp.rs | 18 +- runtime/gear/src/weights/pallet_utility.rs | 66 +- runtime/vara/src/tests.rs | 4 +- runtime/vara/src/weights/frame_system.rs | 82 +- runtime/vara/src/weights/pallet_airdrop.rs | 26 +- runtime/vara/src/weights/pallet_balances.rs | 58 +- runtime/vara/src/weights/pallet_gear.rs | 2838 ++++++++-------- .../vara/src/weights/pallet_gear_voucher.rs | 10 +- runtime/vara/src/weights/pallet_timestamp.rs | 18 +- runtime/vara/src/weights/pallet_utility.rs | 66 +- utils/wasm-proc/src/main.rs | 3 +- 35 files changed, 4798 insertions(+), 4722 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8cfd025934f..1aa24e4993d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3734,6 +3734,7 @@ dependencies = [ "gear-wasm-instrument", "gsys", "log", + "num_enum", "parity-scale-codec", "rand 0.8.5", "scale-info", @@ -3868,6 +3869,7 @@ name = "gear-core" version = "0.3.1" dependencies = [ "blake2-rfc", + "byteorder", "derive_more", "enum-iterator 1.4.1", "env_logger", @@ -3940,6 +3942,7 @@ dependencies = [ name = "gear-lazy-pages-common" version = "0.1.0" dependencies = [ + "byteorder", "derive_more", "gear-backend-common", "gear-common", @@ -4134,6 +4137,7 @@ dependencies = [ name = "gear-runtime-interface" version = "0.1.0" dependencies = [ + "byteorder", "derive_more", "gear-backend-common", "gear-core", @@ -6897,6 +6901,26 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.28", +] + [[package]] name = "number_prefix" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index 50781b4ab99..e356bd90e28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -94,6 +94,7 @@ arbitrary = "1.3.0" async-recursion = "1.0.4" async-trait = "0.1.68" base64 = "0.21.0" +byteorder = { version = "1.4.3", default-features = false } blake2-rfc = { version = "0.2.18", default-features = false } bs58 = { version = "0.4.0", default-features = false } clap = { version = "4.3.21" } @@ -117,6 +118,7 @@ jsonrpsee = { version = "^0.16" } lazy_static = "1.4.0" libc = { version = "0.2", default-features = false } log = { version = "0.4.20", default-features = false } +num_enum = { version = "0.6.1", default-features = false } once_cell = "1.17.1" parity-scale-codec = { version = "3.6.4", default-features = false } parity-wasm = "0.45.0" diff --git a/common/lazy-pages/Cargo.toml b/common/lazy-pages/Cargo.toml index f7fe591c665..821f15cef8a 100644 --- a/common/lazy-pages/Cargo.toml +++ b/common/lazy-pages/Cargo.toml @@ -8,6 +8,7 @@ license.workspace = true [dependencies] derive_more.workspace = true log.workspace = true +byteorder.workspace = true gear-core.workspace = true gear-backend-common.workspace = true @@ -24,4 +25,5 @@ std = [ "gear-runtime-interface/std", "sp-std/std", "log/std", + "byteorder/std" ] diff --git a/common/lazy-pages/src/lib.rs b/common/lazy-pages/src/lib.rs index 3186e8bffde..526717ddc61 100644 --- a/common/lazy-pages/src/lib.rs +++ b/common/lazy-pages/src/lib.rs @@ -22,6 +22,7 @@ extern crate alloc; +use byteorder::{ByteOrder, LittleEndian}; use core::fmt; use gear_backend_common::{ lazy_pages::{GlobalsAccessConfig, LazyPagesWeights, Status}, @@ -30,14 +31,13 @@ use gear_backend_common::{ }; use gear_common::Origin; use gear_core::{ - gas::GasLeft, ids::ProgramId, memory::{HostPointer, Memory, MemoryInterval}, pages::{GearPage, PageNumber, PageU32Size, WasmPage}, }; use gear_runtime_interface::{gear_ri, LazyPagesProgramContext, LazyPagesRuntimeContext}; use gear_wasm_instrument::GLOBAL_NAME_GAS; -use sp_std::{vec, vec::Vec}; +use sp_std::{mem, vec, vec::Vec}; fn mprotect_lazy_pages(mem: &mut impl Memory, protect: bool) { if mem.get_buffer_host_addr().is_none() { @@ -155,18 +155,34 @@ pub fn get_status() -> Status { gear_ri::lazy_pages_status().0 } +fn serialize_mem_intervals(intervals: &[MemoryInterval]) -> Vec { + let mut bytes = Vec::with_capacity(mem::size_of_val(intervals)); + for interval in intervals { + bytes.extend_from_slice(&interval.to_bytes()); + } + bytes +} + /// Pre-process memory access in syscalls in lazy-pages. pub fn pre_process_memory_accesses( reads: &[MemoryInterval], writes: &[MemoryInterval], gas_counter: &mut u64, ) -> Result<(), ProcessAccessError> { - let gas_left = GasLeft { - gas: *gas_counter, - allowance: *gas_counter, - }; - let (GasLeft { gas, allowance }, res) = - gear_ri::pre_process_memory_accesses(reads, writes, (gas_left,)); - *gas_counter = gas.min(allowance); - res + let serialized_reads = serialize_mem_intervals(reads); + let serialized_writes = serialize_mem_intervals(writes); + + let mut gas_bytes = [0u8; 8]; + LittleEndian::write_u64(&mut gas_bytes, *gas_counter); + + let res = + gear_ri::pre_process_memory_accesses(&serialized_reads, &serialized_writes, &mut gas_bytes); + + *gas_counter = LittleEndian::read_u64(&gas_bytes); + + // if result can be converted to `ProcessAccessError` then it's an error + if let Ok(err) = ProcessAccessError::try_from(res) { + return Err(err); + } + Ok(()) } diff --git a/core-backend/common/Cargo.toml b/core-backend/common/Cargo.toml index e122604b4c7..9c7d226c5e7 100644 --- a/core-backend/common/Cargo.toml +++ b/core-backend/common/Cargo.toml @@ -20,6 +20,7 @@ blake2-rfc.workspace = true derive_more.workspace = true gsys.workspace = true log.workspace = true +num_enum.workspace = true parity-scale-codec.workspace = true scale-info = { workspace = true, features = ["derive"] } actor-system-error.workspace = true diff --git a/core-backend/common/src/lazy_pages.rs b/core-backend/common/src/lazy_pages.rs index b318de1d1e0..b5cdbd6c142 100644 --- a/core-backend/common/src/lazy_pages.rs +++ b/core-backend/common/src/lazy_pages.rs @@ -107,8 +107,6 @@ pub enum Status { Normal = 0_i64, /// Skips signals processing until the end of execution, set termination reason as `gas limit exceeded`. GasLimitExceeded, - /// Skips signals processing until the end of execution, set termination reason as `gas allowance exceeded`. - GasAllowanceExceeded, } impl Status { diff --git a/core-backend/common/src/memory.rs b/core-backend/common/src/memory.rs index 2224888292c..59a0a0a2fc3 100644 --- a/core-backend/common/src/memory.rs +++ b/core-backend/common/src/memory.rs @@ -36,15 +36,16 @@ use gear_core::{ memory::{Memory, MemoryError, MemoryInterval}, }; use gear_core_errors::MemoryError as FallibleMemoryError; -use scale_info::scale::{self, Decode, DecodeAll, Encode, MaxEncodedLen}; +use num_enum::{IntoPrimitive, TryFromPrimitive}; +use scale_info::scale::{Decode, DecodeAll, MaxEncodedLen}; /// Memory access error during sys-call that lazy-pages have caught. -#[derive(Debug, Clone, Encode, Decode)] -#[codec(crate = scale)] +/// 0 index is reserved for an ok result. +#[derive(Debug, Clone, IntoPrimitive, TryFromPrimitive)] +#[repr(u8)] pub enum ProcessAccessError { - OutOfBounds, - GasLimitExceeded, - GasAllowanceExceeded, + OutOfBounds = 1, + GasLimitExceeded = 2, } #[derive(Debug, Clone, derive_more::From)] @@ -76,9 +77,9 @@ impl BackendSyscallError for MemoryAccessError { // previously it was able to figure out that gas ended up in // pre-process charges: now we need actual counter type, so // it will be parsed and handled further (issue #3018). - MemoryAccessError::ProcessAccess( - ProcessAccessError::GasLimitExceeded | ProcessAccessError::GasAllowanceExceeded, - ) => UndefinedTerminationReason::ProcessAccessErrorResourcesExceed, + MemoryAccessError::ProcessAccess(ProcessAccessError::GasLimitExceeded) => { + UndefinedTerminationReason::ProcessAccessErrorResourcesExceed + } MemoryAccessError::Decode => unreachable!(), } } diff --git a/core/Cargo.toml b/core/Cargo.toml index 84fbdf344d5..2b5cb2e556e 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -24,6 +24,7 @@ hashbrown.workspace = true static_assertions.workspace = true paste = { workspace = true } enum-iterator.workspace = true +byteorder.workspace = true [dev-dependencies] wabt.workspace = true diff --git a/core/src/memory.rs b/core/src/memory.rs index ad0dbcf6e22..3d676e09fee 100644 --- a/core/src/memory.rs +++ b/core/src/memory.rs @@ -24,6 +24,7 @@ use crate::{ pages::{PageU32Size, WasmPage, GEAR_PAGE_SIZE}, }; use alloc::{collections::BTreeSet, format}; +use byteorder::{ByteOrder, LittleEndian}; use core::{ fmt, fmt::Debug, @@ -44,6 +45,32 @@ pub struct MemoryInterval { pub size: u32, } +impl MemoryInterval { + /// Convert `MemoryInterval` to `[u8; 8]` bytes. + /// `0..4` - `offset` + /// `4..8` - `size` + #[inline] + pub fn to_bytes(&self) -> [u8; 8] { + let mut bytes = [0u8; 8]; + LittleEndian::write_u32(&mut bytes[0..4], self.offset); + LittleEndian::write_u32(&mut bytes[4..8], self.size); + bytes + } + + /// Convert `[u8; 8]` bytes to `MemoryInterval`. + /// `0..4` - `offset` + /// `4..8` - `size` + #[inline] + pub fn try_from_bytes(bytes: &[u8]) -> Result { + if bytes.len() != 8 { + return Err("bytes size != 8"); + } + let offset = LittleEndian::read_u32(&bytes[0..4]); + let size = LittleEndian::read_u32(&bytes[4..8]); + Ok(MemoryInterval { offset, size }) + } +} + impl From<(u32, u32)> for MemoryInterval { fn from(val: (u32, u32)) -> Self { MemoryInterval { diff --git a/lazy-pages/src/common.rs b/lazy-pages/src/common.rs index 3ea618bf5ff..07f84200303 100644 --- a/lazy-pages/src/common.rs +++ b/lazy-pages/src/common.rs @@ -24,7 +24,6 @@ use gear_backend_common::{ lazy_pages::{GlobalsAccessError, Status}, LimitedStr, }; -use gear_core::gas::GasLeft; use crate::{globals::GlobalsContext, mprotect::MprotectError}; use gear_core::pages::{GearPage, PageDynSize, PageSizeNo, SizeManager, WasmPage}; @@ -110,7 +109,6 @@ pub(crate) type GlobalNames = Vec>; #[derive(Debug)] pub(crate) struct LazyPagesRuntimeContext { - pub version: LazyPagesVersion, pub page_sizes: PageSizes, pub global_names: GlobalNames, pub pages_storage_prefix: Vec, @@ -118,8 +116,6 @@ pub(crate) struct LazyPagesRuntimeContext { #[derive(Debug)] pub(crate) struct LazyPagesExecutionContext { - /// Lazy-pages impl version. - pub version: LazyPagesVersion, /// Lazy-pages page size. pub page_sizes: PageSizes, /// Lazy-pages accesses weights. @@ -151,16 +147,6 @@ pub(crate) struct LazyPagesExecutionContext { #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum LazyPagesVersion { Version1, - Version2, -} - -impl LazyPagesVersion { - pub const fn globals_count(&self) -> usize { - match self { - Self::Version1 => 2, - Self::Version2 => 1, - } - } } impl SizeManager for LazyPagesExecutionContext { @@ -257,32 +243,26 @@ impl PagePrefix { } #[derive(Debug, Clone)] -pub(crate) struct GasLeftCharger { +pub(crate) struct GasCharger { pub read_cost: u64, pub write_cost: u64, pub write_after_read_cost: u64, pub load_data_cost: u64, } -impl GasLeftCharger { - fn sub_gas(gas_left: &mut GasLeft, amount: u64) -> Status { - let new_gas = gas_left.gas.checked_sub(amount); - let new_allowance = gas_left.allowance.checked_sub(amount); - *gas_left = ( - new_gas.unwrap_or_default(), - new_allowance.unwrap_or_default(), - ) - .into(); - match (new_gas, new_allowance) { - (None, _) => Status::GasLimitExceeded, - (Some(_), None) => Status::GasAllowanceExceeded, - (Some(_), Some(_)) => Status::Normal, +impl GasCharger { + fn sub_gas(gas_counter: &mut u64, amount: u64) -> Status { + let new_gas = gas_counter.checked_sub(amount); + *gas_counter = new_gas.unwrap_or_default(); + match new_gas { + None => Status::GasLimitExceeded, + Some(_) => Status::Normal, } } pub fn charge_for_page_access( &self, - gas_left: &mut GasLeft, + gas_counter: &mut u64, page: GearPage, is_write: bool, is_accessed: bool, @@ -293,11 +273,11 @@ impl GasLeftCharger { (false, false) => self.read_cost, (false, true) => return Err(Error::DoubleReadCharge(page)), }; - Ok(Self::sub_gas(gas_left, amount)) + Ok(Self::sub_gas(gas_counter, amount)) } - pub fn charge_for_page_data_load(&mut self, gas_left: &mut GasLeft) -> Status { - Self::sub_gas(gas_left, self.load_data_cost) + pub fn charge_for_page_data_load(&mut self, gas_counter: &mut u64) -> Status { + Self::sub_gas(gas_counter, self.load_data_cost) } } diff --git a/lazy-pages/src/globals.rs b/lazy-pages/src/globals.rs index 54b0481edfa..a2ac73f6273 100644 --- a/lazy-pages/src/globals.rs +++ b/lazy-pages/src/globals.rs @@ -18,10 +18,7 @@ //! `GlobalsAccessor` realizations for native and wasm runtimes. -use crate::{ - common::{Error, GlobalNames}, - LazyPagesVersion, -}; +use crate::common::{Error, GlobalNames}; use core::any::Any; use gear_backend_common::{ lazy_pages::{GlobalsAccessError, GlobalsAccessMod, GlobalsAccessor}, @@ -33,23 +30,7 @@ use sp_wasm_interface::Value; #[derive(Debug, Clone, Copy)] pub(crate) enum GlobalNo { - Gas, - GasAllowance, -} - -impl GlobalNo { - pub(crate) fn into_idx(self, version: LazyPagesVersion) -> usize { - match self { - GlobalNo::Gas => 0, - GlobalNo::GasAllowance => { - if version == LazyPagesVersion::Version1 { - 1 - } else { - unreachable!("GasAllowance global is deprecated since lazy-pages v2") - } - } - } - } + Gas = 0, } #[derive(Debug)] @@ -126,18 +107,16 @@ fn apply_for_global_internal( } pub(crate) unsafe fn apply_for_global( - version: LazyPagesVersion, globals_ctx: &GlobalsContext, - global_no: GlobalNo, + global_name: &str, f: impl FnMut(u64) -> Result, Error>, ) -> Result { - let name = globals_ctx.names[global_no.into_idx(version)].as_str(); match globals_ctx.access_mod { GlobalsAccessMod::WasmRuntime => { let instance = (globals_ctx.access_ptr as *mut SandboxInstance) .as_mut() .ok_or(Error::HostInstancePointerIsInvalid)?; - apply_for_global_internal(GlobalsAccessWasmRuntime { instance }, name, f) + apply_for_global_internal(GlobalsAccessWasmRuntime { instance }, global_name, f) } GlobalsAccessMod::NativeRuntime => { let inner_access_provider = (globals_ctx.access_ptr as *mut &mut dyn GlobalsAccessor) @@ -147,7 +126,7 @@ pub(crate) unsafe fn apply_for_global( GlobalsAccessNativeRuntime { inner_access_provider, }, - name, + global_name, f, ) } diff --git a/lazy-pages/src/host_func.rs b/lazy-pages/src/host_func.rs index 5784bdacf34..ee997244641 100644 --- a/lazy-pages/src/host_func.rs +++ b/lazy-pages/src/host_func.rs @@ -19,14 +19,13 @@ //! Host function call `pre_process_memory_accesses` support in lazy-pages. use crate::{ - common::{Error, GasLeftCharger, LazyPagesExecutionContext, WeightNo}, + common::{Error, GasCharger, LazyPagesExecutionContext, WeightNo}, process::{self, AccessHandler}, LAZY_PAGES_CONTEXT, }; use gear_backend_common::{lazy_pages::Status, memory::ProcessAccessError}; use gear_core::{ self, - gas::GasLeft, memory::MemoryInterval, pages::{GearPage, PageDynSize}, }; @@ -34,8 +33,8 @@ use std::collections::BTreeSet; pub(crate) struct HostFuncAccessHandler<'a> { pub is_write: bool, - pub gas_left: &'a mut GasLeft, - pub gas_left_charger: GasLeftCharger, + pub gas_counter: &'a mut u64, + pub gas_charger: GasCharger, } impl<'a> AccessHandler for HostFuncAccessHandler<'a> { @@ -70,18 +69,12 @@ impl<'a> AccessHandler for HostFuncAccessHandler<'a> { page: GearPage, is_accessed: bool, ) -> Result { - self.gas_left_charger.charge_for_page_access( - self.gas_left, - page, - self.is_write, - is_accessed, - ) + self.gas_charger + .charge_for_page_access(self.gas_counter, page, self.is_write, is_accessed) } fn charge_for_page_data_loading(&mut self) -> Result { - Ok(self - .gas_left_charger - .charge_for_page_data_load(self.gas_left)) + Ok(self.gas_charger.charge_for_page_data_load(self.gas_counter)) } fn last_page(pages: &Self::Pages) -> Option { @@ -138,7 +131,7 @@ fn accesses_pages( pub fn pre_process_memory_accesses( reads: &[MemoryInterval], writes: &[MemoryInterval], - gas_left: &mut GasLeft, + gas_counter: &mut u64, ) -> Result<(), ProcessAccessError> { log::trace!("host func mem accesses: {reads:?} {writes:?}"); LAZY_PAGES_CONTEXT @@ -146,45 +139,52 @@ pub fn pre_process_memory_accesses( let mut ctx = ctx.borrow_mut(); let ctx = ctx.execution_context_mut()?; - let mut read_pages = BTreeSet::new(); - accesses_pages(ctx, reads, &mut read_pages)?; - - let gas_left_charger = { - GasLeftCharger { + let gas_charger = { + GasCharger { read_cost: ctx.weight(WeightNo::HostFuncRead), write_cost: ctx.weight(WeightNo::HostFuncWrite), write_after_read_cost: ctx.weight(WeightNo::HostFuncWriteAfterRead), load_data_cost: ctx.weight(WeightNo::LoadPageDataFromStorage), } }; - - let status = process::process_lazy_pages( - ctx, - HostFuncAccessHandler { - is_write: false, - gas_left, - gas_left_charger: gas_left_charger.clone(), - }, - read_pages, - )?; + let mut status = Status::Normal; + + if !reads.is_empty() { + let mut read_pages = BTreeSet::new(); + accesses_pages(ctx, reads, &mut read_pages)?; + + status = process::process_lazy_pages( + ctx, + HostFuncAccessHandler { + is_write: false, + gas_counter, + gas_charger: gas_charger.clone(), + }, + read_pages, + )?; + } // Does not process write accesses if gas exceeded. if !matches!(status, Status::Normal) { return Ok(status); } - let mut write_pages = BTreeSet::new(); - accesses_pages(ctx, writes, &mut write_pages)?; - - process::process_lazy_pages( - ctx, - HostFuncAccessHandler { - is_write: true, - gas_left, - gas_left_charger, - }, - write_pages, - ) + if !writes.is_empty() { + let mut write_pages = BTreeSet::new(); + accesses_pages(ctx, writes, &mut write_pages)?; + + status = process::process_lazy_pages( + ctx, + HostFuncAccessHandler { + is_write: true, + gas_counter, + gas_charger, + }, + write_pages, + )?; + } + + Ok(status) }) .map_err(|err| match err { Error::WasmMemAddrIsNotSet | Error::OutOfWasmMemoryAccess => { @@ -195,6 +195,5 @@ pub fn pre_process_memory_accesses( .map(|status| match status { Status::Normal => Ok(()), Status::GasLimitExceeded => Err(ProcessAccessError::GasLimitExceeded), - Status::GasAllowanceExceeded => Err(ProcessAccessError::GasAllowanceExceeded), })? } diff --git a/lazy-pages/src/lib.rs b/lazy-pages/src/lib.rs index eb4c0ca1e02..03e1278ac11 100644 --- a/lazy-pages/src/lib.rs +++ b/lazy-pages/src/lib.rs @@ -49,7 +49,7 @@ mod utils; use crate::{ common::{ContextError, LazyPagesContext, PagePrefix, PageSizes, WeightNo, Weights}, - globals::GlobalsContext, + globals::{GlobalNo, GlobalsContext}, init_flag::InitializationFlag, }; @@ -152,7 +152,6 @@ pub fn initialize_for_program( })?; let execution_ctx = LazyPagesExecutionContext { - version: runtime_ctx.version, page_sizes: runtime_ctx.page_sizes, weights, wasm_mem_addr, @@ -306,8 +305,8 @@ pub fn status() -> Result { pub enum InitError { #[display(fmt = "Wrong page sizes amount: get {_0}, must be {_1}")] WrongSizesAmount(usize, usize), - #[display(fmt = "Wrong global names amount: get {_0}, must be {_1}")] - WrongGlobalNamesAmount(usize, usize), + #[display(fmt = "Wrong global names: expected {_0}, found {_1}")] + WrongGlobalNames(String, String), #[display(fmt = "Not suitable page sizes")] NotSuitablePageSizes, #[display(fmt = "Can not set signal handler: {_0}")] @@ -385,7 +384,7 @@ pub(crate) fn reset_init_flag() { /// Initialize lazy-pages for current thread. fn init_with_handler( - version: LazyPagesVersion, + _version: LazyPagesVersion, page_sizes: Vec, global_names: Vec>, pages_storage_prefix: Vec, @@ -417,10 +416,12 @@ fn init_with_handler( return Err(NotSuitablePageSizes); } - if global_names.len() != version.globals_count() { - return Err(WrongGlobalNamesAmount( - global_names.len(), - version.globals_count(), + // TODO: check globals from context issue #3057 + // we only need to check the globals that are used to keep the state consistent in older runtimes. + if global_names[GlobalNo::Gas as usize].as_str() != "gear_gas" { + return Err(WrongGlobalNames( + "gear_gas".to_string(), + global_names[GlobalNo::Gas as usize].to_string(), )); } @@ -428,7 +429,6 @@ fn init_with_handler( LAZY_PAGES_CONTEXT.with(|ctx| { ctx.borrow_mut() .set_runtime_context(LazyPagesRuntimeContext { - version, page_sizes, global_names, pages_storage_prefix, diff --git a/lazy-pages/src/process.rs b/lazy-pages/src/process.rs index e7f1fe31498..3807841cf8f 100644 --- a/lazy-pages/src/process.rs +++ b/lazy-pages/src/process.rs @@ -115,7 +115,7 @@ pub(crate) fn process_lazy_pages( // about future contract execution correctness, because gas limit or allowance exceed. match status { Status::Normal => Ok(false), - Status::GasLimitExceeded | Status::GasAllowanceExceeded => { + Status::GasLimitExceeded => { log::trace!( "Gas limit or allowance exceed, so removes protection from all wasm memory \ and continues execution until the end of current wasm block" diff --git a/lazy-pages/src/signal.rs b/lazy-pages/src/signal.rs index a2aab12e2ad..5cae9a7e654 100644 --- a/lazy-pages/src/signal.rs +++ b/lazy-pages/src/signal.rs @@ -19,16 +19,13 @@ //! Lazy-pages system signals accesses support. use crate::{ - common::{Error, GasLeftCharger, LazyPagesExecutionContext, WeightNo}, + common::{Error, GasCharger, LazyPagesExecutionContext, WeightNo}, globals::{self, GlobalNo}, process::{self, AccessHandler}, - LazyPagesVersion, LAZY_PAGES_CONTEXT, + LAZY_PAGES_CONTEXT, }; use gear_backend_common::lazy_pages::Status; -use gear_core::{ - gas::GasLeft, - pages::{GearPage, PageDynSize}, -}; +use gear_core::pages::{GearPage, PageDynSize}; use std::convert::TryFrom; pub(crate) trait UserSignalHandler { @@ -80,38 +77,20 @@ unsafe fn user_signal_handler_internal( let page = GearPage::from_offset(ctx, offset); let gas_ctx = if let Some(globals_config) = ctx.globals_context.as_ref() { - let gas_left_charger = GasLeftCharger { + let gas_charger = GasCharger { read_cost: ctx.weight(WeightNo::SignalRead), write_cost: ctx.weight(WeightNo::SignalWrite), write_after_read_cost: ctx.weight(WeightNo::SignalWriteAfterRead), load_data_cost: ctx.weight(WeightNo::LoadPageDataFromStorage), }; - let gas_left = match ctx.version { - LazyPagesVersion::Version1 => { - let gas = - globals::apply_for_global(ctx.version, globals_config, GlobalNo::Gas, |_| { - Ok(None) - })?; - let allowance = globals::apply_for_global( - ctx.version, - globals_config, - GlobalNo::GasAllowance, - |_| Ok(None), - )?; + let gas_counter = globals::apply_for_global( + globals_config, + globals_config.names[GlobalNo::Gas as usize].as_str(), + |_| Ok(None), + )?; - (gas, allowance).into() - } - LazyPagesVersion::Version2 => { - let gas = - globals::apply_for_global(ctx.version, globals_config, GlobalNo::Gas, |_| { - Ok(None) - })?; - (gas, gas).into() - } - }; - - Some((gas_left, gas_left_charger)) + Some((gas_counter, gas_charger)) } else { None }; @@ -133,7 +112,7 @@ pub(crate) unsafe fn user_signal_handler(info: ExceptionInfo) -> Result<(), Erro struct SignalAccessHandler { is_write: bool, - gas_ctx: Option<(GasLeft, GasLeftCharger)>, + gas_ctx: Option<(u64, GasCharger)>, } impl AccessHandler for SignalAccessHandler { @@ -175,19 +154,19 @@ impl AccessHandler for SignalAccessHandler { page: GearPage, is_accessed: bool, ) -> Result { - let (gas_left, gas_left_charger) = match self.gas_ctx.as_mut() { + let (gas_counter, gas_charger) = match self.gas_ctx.as_mut() { Some(ctx) => ctx, None => return Ok(Status::Normal), }; - gas_left_charger.charge_for_page_access(gas_left, page, self.is_write, is_accessed) + gas_charger.charge_for_page_access(gas_counter, page, self.is_write, is_accessed) } fn charge_for_page_data_loading(&mut self) -> Result { - let (gas_left, gas_left_charger) = match self.gas_ctx.as_mut() { + let (gas_counter, gas_charger) = match self.gas_ctx.as_mut() { Some(ctx) => ctx, None => return Ok(Status::Normal), }; - Ok(gas_left_charger.charge_for_page_data_load(gas_left)) + Ok(gas_charger.charge_for_page_data_load(gas_counter)) } fn process_pages( @@ -198,26 +177,30 @@ impl AccessHandler for SignalAccessHandler { } fn into_output(self, ctx: &mut LazyPagesExecutionContext) -> Result { - if let (Some((gas_left, _)), Some(globals_config)) = + if let (Some((gas_counter, _)), Some(globals_config)) = (self.gas_ctx, ctx.globals_context.as_ref()) { - match ctx.version { - LazyPagesVersion::Version1 => unsafe { - globals::apply_for_global(ctx.version, globals_config, GlobalNo::Gas, |_| { - Ok(Some(gas_left.gas)) - })?; - globals::apply_for_global( - ctx.version, - globals_config, - GlobalNo::GasAllowance, - |_| Ok(Some(gas_left.allowance)), - )?; - }, - LazyPagesVersion::Version2 => unsafe { - globals::apply_for_global(ctx.version, globals_config, GlobalNo::Gas, |_| { - Ok(Some(gas_left.gas.min(gas_left.allowance))) - })?; - }, + let mut diff = 0; + unsafe { + globals::apply_for_global( + globals_config, + globals_config.names[GlobalNo::Gas as usize].as_str(), + |current| { + diff = current - gas_counter; + Ok(Some(gas_counter)) + }, + )? + }; + + // support old runtimes + if globals_config.names.len() == 2 + && globals_config.names[1].as_str() == "gear_allowance" + { + unsafe { + globals::apply_for_global(globals_config, "gear_allowance", |current| { + Ok(Some(current.saturating_sub(diff))) + })? + }; } } Ok(()) diff --git a/lazy-pages/src/tests.rs b/lazy-pages/src/tests.rs index 9ffe3d6170a..ae4852df027 100644 --- a/lazy-pages/src/tests.rs +++ b/lazy-pages/src/tests.rs @@ -76,12 +76,12 @@ fn read_write_flag_works() { } init_with_handler::( - LazyPagesVersion::Version2, + LazyPagesVersion::Version1, vec![ ::size(), ::size(), ], - vec![LimitedStr::from_small_str("")], + vec![LimitedStr::from_small_str("gear_gas")], Default::default(), ) .unwrap(); @@ -134,12 +134,12 @@ fn test_mprotect_pages() { env_logger::init(); init_with_handler::( - LazyPagesVersion::Version2, + LazyPagesVersion::Version1, vec![ ::size(), ::size(), ], - vec![LimitedStr::from_small_str("")], + vec![LimitedStr::from_small_str("gear_gas")], Default::default(), ) .unwrap(); diff --git a/pallets/gear/src/weights.rs b/pallets/gear/src/weights.rs index 98d4376cdda..07935956903 100644 --- a/pallets/gear/src/weights.rs +++ b/pallets/gear/src/weights.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -244,10 +244,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 954_000 picoseconds. - Weight::from_parts(1_004_000, 0) - // Standard Error: 802 - .saturating_add(Weight::from_parts(249_956, 0).saturating_mul(c.into())) + // Minimum execution time: 951_000 picoseconds. + Weight::from_parts(1_020_000, 0) + // Standard Error: 722 + .saturating_add(Weight::from_parts(240_031, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -255,10 +255,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_808_000 picoseconds. - Weight::from_parts(2_895_000, 3506) - // Standard Error: 1_086 - .saturating_add(Weight::from_parts(680_150, 0).saturating_mul(c.into())) + // Minimum execution time: 2_762_000 picoseconds. + Weight::from_parts(2_859_000, 3506) + // Standard Error: 813 + .saturating_add(Weight::from_parts(665_139, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -267,17 +267,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_458_000 picoseconds. - Weight::from_parts(84_558_500, 0) - // Standard Error: 7_412 - .saturating_add(Weight::from_parts(2_377_997, 0).saturating_mul(c.into())) + // Minimum execution time: 50_591_000 picoseconds. + Weight::from_parts(61_353_023, 0) + // Standard Error: 9_186 + .saturating_add(Weight::from_parts(2_404_810, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 81_302_000 picoseconds. - Weight::from_parts(83_307_000, 42236) + // Minimum execution time: 81_660_000 picoseconds. + Weight::from_parts(83_840_000, 42236) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -285,8 +285,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 52_219_000 picoseconds. - Weight::from_parts(53_704_000, 21261) + // Minimum execution time: 54_005_000 picoseconds. + Weight::from_parts(55_095_000, 21261) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -294,8 +294,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 28_408_000 picoseconds. - Weight::from_parts(29_714_000, 17070) + // Minimum execution time: 28_880_000 picoseconds. + Weight::from_parts(29_583_000, 17070) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -304,10 +304,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_918_000 picoseconds. - Weight::from_parts(6_745_647, 7640) - // Standard Error: 37_300 - .saturating_add(Weight::from_parts(13_885_473, 0).saturating_mul(c.into())) + // Minimum execution time: 7_744_000 picoseconds. + Weight::from_parts(4_233_092, 7640) + // Standard Error: 39_690 + .saturating_add(Weight::from_parts(14_033_179, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -316,10 +316,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1297 + c * (16389 ±0)` // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 68_486_000 picoseconds. - Weight::from_parts(69_079_000, 40898) - // Standard Error: 164_982 - .saturating_add(Weight::from_parts(55_774_264, 0).saturating_mul(c.into())) + // Minimum execution time: 70_301_000 picoseconds. + Weight::from_parts(70_991_000, 40898) + // Standard Error: 177_223 + .saturating_add(Weight::from_parts(54_687_249, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -330,10 +330,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 61_635_000 picoseconds. - Weight::from_parts(64_537_590, 4990) - // Standard Error: 40_298 - .saturating_add(Weight::from_parts(52_820_238, 0).saturating_mul(c.into())) + // Minimum execution time: 61_715_000 picoseconds. + Weight::from_parts(40_384_385, 4990) + // Standard Error: 57_496 + .saturating_add(Weight::from_parts(53_210_788, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -342,10 +342,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `671` // Estimated: `38638` - // Minimum execution time: 63_344_000 picoseconds. - Weight::from_parts(76_968_021, 38638) + // Minimum execution time: 63_077_000 picoseconds. + Weight::from_parts(96_840_506, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_598, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_609, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -355,12 +355,12 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 10_980_969_000 picoseconds. - Weight::from_parts(301_891_685, 34312) - // Standard Error: 164_203 - .saturating_add(Weight::from_parts(54_383_779, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_548, 0).saturating_mul(s.into())) + // Minimum execution time: 11_049_858_000 picoseconds. + Weight::from_parts(11_090_406_000, 34312) + // Standard Error: 517_330 + .saturating_add(Weight::from_parts(25_497_137, 0).saturating_mul(c.into())) + // Standard Error: 30 + .saturating_add(Weight::from_parts(910, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)) } @@ -369,10 +369,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 53_732_000 picoseconds. - Weight::from_parts(35_204_611, 23853) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_021, 0).saturating_mul(p.into())) + // Minimum execution time: 56_305_000 picoseconds. + Weight::from_parts(38_705_997, 23853) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_034, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -381,32 +381,32 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 82_297_000 picoseconds. - Weight::from_parts(62_302_593, 42227) + // Minimum execution time: 83_033_000 picoseconds. + Weight::from_parts(69_135_468, 42227) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_042, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(_q: u32, ) -> Weight { + fn initial_allocation(q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 298_083_000 picoseconds. - Weight::from_parts(314_192_353, 74319) + // Minimum execution time: 295_535_000 picoseconds. + Weight::from_parts(306_791_413, 74319) + // Standard Error: 1_111 + .saturating_add(Weight::from_parts(1_568, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(q: u32, ) -> Weight { + fn alloc_in_handle(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 312_856_000 picoseconds. - Weight::from_parts(326_607_586, 74319) - // Standard Error: 1_507 - .saturating_add(Weight::from_parts(723, 0).saturating_mul(q.into())) + // Minimum execution time: 309_253_000 picoseconds. + Weight::from_parts(323_694_389, 74319) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -415,10 +415,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_478_000 picoseconds. - Weight::from_parts(45_769_000, 3899) - // Standard Error: 42_221 - .saturating_add(Weight::from_parts(51_492_007, 0).saturating_mul(c.into())) + // Minimum execution time: 44_806_000 picoseconds. + Weight::from_parts(45_498_000, 3899) + // Standard Error: 44_467 + .saturating_add(Weight::from_parts(54_603_581, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -428,630 +428,630 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_248_000 picoseconds. - Weight::from_parts(87_224_000, 0) - // Standard Error: 4_031_043 - .saturating_add(Weight::from_parts(559_145_890, 0).saturating_mul(r.into())) + // Minimum execution time: 82_307_000 picoseconds. + Weight::from_parts(84_226_000, 0) + // Standard Error: 4_203_577 + .saturating_add(Weight::from_parts(574_493_471, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 304_310_000 picoseconds. - Weight::from_parts(240_640_662, 0) - // Standard Error: 7_875 - .saturating_add(Weight::from_parts(30_931_778, 0).saturating_mul(p.into())) + // Minimum execution time: 309_893_000 picoseconds. + Weight::from_parts(234_558_588, 0) + // Standard Error: 7_966 + .saturating_add(Weight::from_parts(32_022_587, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 144_728_000 picoseconds. - Weight::from_parts(127_694_995, 0) - // Standard Error: 344_021 - .saturating_add(Weight::from_parts(63_008_235, 0).saturating_mul(r.into())) + // Minimum execution time: 142_319_000 picoseconds. + Weight::from_parts(121_865_521, 0) + // Standard Error: 314_080 + .saturating_add(Weight::from_parts(64_422_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_763_000 picoseconds. - Weight::from_parts(93_302_515, 0) - // Standard Error: 3_873 - .saturating_add(Weight::from_parts(2_723_217, 0).saturating_mul(r.into())) + // Minimum execution time: 85_527_000 picoseconds. + Weight::from_parts(91_967_528, 0) + // Standard Error: 3_856 + .saturating_add(Weight::from_parts(2_363_669, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 134_987_000 picoseconds. - Weight::from_parts(141_052_149, 0) - // Standard Error: 29_498 - .saturating_add(Weight::from_parts(3_252_053, 0).saturating_mul(r.into())) + // Minimum execution time: 144_133_000 picoseconds. + Weight::from_parts(156_991_945, 0) + // Standard Error: 24_223 + .saturating_add(Weight::from_parts(2_431_525, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_532_000 picoseconds. - Weight::from_parts(111_956_884, 0) - // Standard Error: 420_651 - .saturating_add(Weight::from_parts(124_761_103, 0).saturating_mul(r.into())) + // Minimum execution time: 86_811_000 picoseconds. + Weight::from_parts(101_122_470, 0) + // Standard Error: 303_533 + .saturating_add(Weight::from_parts(92_415_204, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_442_000 picoseconds. - Weight::from_parts(76_262_730, 0) - // Standard Error: 310_067 - .saturating_add(Weight::from_parts(115_334_131, 0).saturating_mul(r.into())) + // Minimum execution time: 84_453_000 picoseconds. + Weight::from_parts(79_049_804, 0) + // Standard Error: 305_992 + .saturating_add(Weight::from_parts(79_382_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_322_000 picoseconds. - Weight::from_parts(71_153_919, 0) - // Standard Error: 293_317 - .saturating_add(Weight::from_parts(115_508_333, 0).saturating_mul(r.into())) + // Minimum execution time: 82_650_000 picoseconds. + Weight::from_parts(79_085_060, 0) + // Standard Error: 293_080 + .saturating_add(Weight::from_parts(77_346_019, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_586_000 picoseconds. - Weight::from_parts(73_401_225, 0) - // Standard Error: 306_089 - .saturating_add(Weight::from_parts(115_530_298, 0).saturating_mul(r.into())) + // Minimum execution time: 83_545_000 picoseconds. + Weight::from_parts(72_777_984, 0) + // Standard Error: 351_302 + .saturating_add(Weight::from_parts(80_634_984, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_537_000 picoseconds. - Weight::from_parts(80_327_682, 0) - // Standard Error: 275_679 - .saturating_add(Weight::from_parts(114_024_859, 0).saturating_mul(r.into())) + // Minimum execution time: 83_245_000 picoseconds. + Weight::from_parts(76_181_868, 0) + // Standard Error: 354_266 + .saturating_add(Weight::from_parts(79_459_120, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_226_000 picoseconds. - Weight::from_parts(74_308_323, 0) - // Standard Error: 291_460 - .saturating_add(Weight::from_parts(115_396_428, 0).saturating_mul(r.into())) + // Minimum execution time: 85_064_000 picoseconds. + Weight::from_parts(77_882_516, 0) + // Standard Error: 377_997 + .saturating_add(Weight::from_parts(78_533_852, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_250_000 picoseconds. - Weight::from_parts(74_761_588, 0) - // Standard Error: 317_797 - .saturating_add(Weight::from_parts(115_173_001, 0).saturating_mul(r.into())) + // Minimum execution time: 83_522_000 picoseconds. + Weight::from_parts(66_328_137, 0) + // Standard Error: 360_143 + .saturating_add(Weight::from_parts(79_838_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_673_000 picoseconds. - Weight::from_parts(70_907_772, 0) - // Standard Error: 347_682 - .saturating_add(Weight::from_parts(118_189_625, 0).saturating_mul(r.into())) + // Minimum execution time: 83_961_000 picoseconds. + Weight::from_parts(72_789_065, 0) + // Standard Error: 366_577 + .saturating_add(Weight::from_parts(79_031_060, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_530_000 picoseconds. - Weight::from_parts(774_384_678, 0) - // Standard Error: 512_748 - .saturating_add(Weight::from_parts(194_331_468, 0).saturating_mul(r.into())) + // Minimum execution time: 700_686_000 picoseconds. + Weight::from_parts(749_297_529, 0) + // Standard Error: 383_897 + .saturating_add(Weight::from_parts(132_242_102, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 866_889_000 picoseconds. - Weight::from_parts(872_993_000, 0) - // Standard Error: 59_048 - .saturating_add(Weight::from_parts(13_399_620, 0).saturating_mul(n.into())) + // Minimum execution time: 830_957_000 picoseconds. + Weight::from_parts(850_017_000, 0) + // Standard Error: 67_693 + .saturating_add(Weight::from_parts(13_570_326, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_291_000 picoseconds. - Weight::from_parts(75_543_485, 0) - // Standard Error: 320_701 - .saturating_add(Weight::from_parts(115_757_456, 0).saturating_mul(r.into())) + // Minimum execution time: 84_261_000 picoseconds. + Weight::from_parts(70_573_139, 0) + // Standard Error: 351_239 + .saturating_add(Weight::from_parts(80_441_776, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_780_000 picoseconds. - Weight::from_parts(68_090_338, 0) - // Standard Error: 330_050 - .saturating_add(Weight::from_parts(117_803_137, 0).saturating_mul(r.into())) + // Minimum execution time: 84_164_000 picoseconds. + Weight::from_parts(70_866_987, 0) + // Standard Error: 346_107 + .saturating_add(Weight::from_parts(82_471_591, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_394_000 picoseconds. - Weight::from_parts(88_472_912, 0) - // Standard Error: 340_524 - .saturating_add(Weight::from_parts(190_044_477, 0).saturating_mul(n.into())) + // Minimum execution time: 81_192_000 picoseconds. + Weight::from_parts(101_814_078, 0) + // Standard Error: 391_508 + .saturating_add(Weight::from_parts(166_873_282, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_081_000 picoseconds. - Weight::from_parts(85_006_000, 0) - // Standard Error: 3_456_961 - .saturating_add(Weight::from_parts(860_188_117, 0).saturating_mul(r.into())) + // Minimum execution time: 84_974_000 picoseconds. + Weight::from_parts(87_244_000, 0) + // Standard Error: 3_619_557 + .saturating_add(Weight::from_parts(749_950_767, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_490_000 picoseconds. - Weight::from_parts(136_619_765, 0) - // Standard Error: 439_674 - .saturating_add(Weight::from_parts(308_552_304, 0).saturating_mul(r.into())) + // Minimum execution time: 81_612_000 picoseconds. + Weight::from_parts(147_822_399, 0) + // Standard Error: 421_408 + .saturating_add(Weight::from_parts(250_730_230, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 386_929_000 picoseconds. - Weight::from_parts(393_325_000, 0) - // Standard Error: 61_932 - .saturating_add(Weight::from_parts(21_101_790, 0).saturating_mul(n.into())) + // Minimum execution time: 332_130_000 picoseconds. + Weight::from_parts(337_780_000, 0) + // Standard Error: 52_652 + .saturating_add(Weight::from_parts(20_743_155, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_625_000 picoseconds. - Weight::from_parts(162_584_483, 0) - // Standard Error: 494_553 - .saturating_add(Weight::from_parts(313_684_139, 0).saturating_mul(r.into())) + // Minimum execution time: 82_722_000 picoseconds. + Weight::from_parts(147_881_270, 0) + // Standard Error: 390_429 + .saturating_add(Weight::from_parts(259_701_373, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 390_932_000 picoseconds. - Weight::from_parts(393_883_000, 0) - // Standard Error: 68_646 - .saturating_add(Weight::from_parts(21_188_381, 0).saturating_mul(n.into())) + // Minimum execution time: 337_753_000 picoseconds. + Weight::from_parts(343_454_000, 0) + // Standard Error: 66_604 + .saturating_add(Weight::from_parts(21_189_034, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 708_623_000 picoseconds. - Weight::from_parts(781_094_266, 0) - // Standard Error: 460_683 - .saturating_add(Weight::from_parts(328_993_362, 0).saturating_mul(r.into())) + // Minimum execution time: 708_454_000 picoseconds. + Weight::from_parts(775_673_824, 0) + // Standard Error: 380_634 + .saturating_add(Weight::from_parts(268_253_890, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 710_228_000 picoseconds. - Weight::from_parts(774_190_634, 0) - // Standard Error: 483_646 - .saturating_add(Weight::from_parts(330_057_876, 0).saturating_mul(r.into())) + // Minimum execution time: 706_799_000 picoseconds. + Weight::from_parts(782_052_003, 0) + // Standard Error: 385_065 + .saturating_add(Weight::from_parts(265_280_556, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_510_000 picoseconds. - Weight::from_parts(64_097_635, 0) - // Standard Error: 358_570 - .saturating_add(Weight::from_parts(126_095_109, 0).saturating_mul(r.into())) + // Minimum execution time: 84_511_000 picoseconds. + Weight::from_parts(61_459_678, 0) + // Standard Error: 362_497 + .saturating_add(Weight::from_parts(87_903_947, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_430_098_000 picoseconds. - Weight::from_parts(2_605_278_898, 0) - // Standard Error: 439_185 - .saturating_add(Weight::from_parts(217_479_981, 0).saturating_mul(r.into())) + // Minimum execution time: 1_676_718_000 picoseconds. + Weight::from_parts(1_838_206_733, 0) + // Standard Error: 440_793 + .saturating_add(Weight::from_parts(156_352_100, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 358_553_000 picoseconds. - Weight::from_parts(364_183_000, 0) - // Standard Error: 51_397 - .saturating_add(Weight::from_parts(30_914_040, 0).saturating_mul(n.into())) + // Minimum execution time: 284_222_000 picoseconds. + Weight::from_parts(293_316_000, 0) + // Standard Error: 54_796 + .saturating_add(Weight::from_parts(30_939_288, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_464_581_000 picoseconds. - Weight::from_parts(2_580_044_243, 0) - // Standard Error: 461_216 - .saturating_add(Weight::from_parts(272_575_116, 0).saturating_mul(r.into())) + // Minimum execution time: 1_682_466_000 picoseconds. + Weight::from_parts(1_829_413_701, 0) + // Standard Error: 510_421 + .saturating_add(Weight::from_parts(216_009_232, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_438_114_000 picoseconds. - Weight::from_parts(2_597_881_615, 0) - // Standard Error: 400_982 - .saturating_add(Weight::from_parts(275_718_502, 0).saturating_mul(r.into())) + // Minimum execution time: 1_681_160_000 picoseconds. + Weight::from_parts(1_819_797_788, 0) + // Standard Error: 453_707 + .saturating_add(Weight::from_parts(215_589_534, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 244_206_000 picoseconds. - Weight::from_parts(321_175_021, 0) - // Standard Error: 460_445 - .saturating_add(Weight::from_parts(322_059_081, 0).saturating_mul(r.into())) + // Minimum execution time: 242_556_000 picoseconds. + Weight::from_parts(314_306_159, 0) + // Standard Error: 376_142 + .saturating_add(Weight::from_parts(260_614_468, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 559_346_000 picoseconds. - Weight::from_parts(571_004_000, 0) - // Standard Error: 59_840 - .saturating_add(Weight::from_parts(21_370_093, 0).saturating_mul(n.into())) + // Minimum execution time: 495_430_000 picoseconds. + Weight::from_parts(502_714_000, 0) + // Standard Error: 52_049 + .saturating_add(Weight::from_parts(21_259_132, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_620_633_000 picoseconds. - Weight::from_parts(2_741_869_292, 0) - // Standard Error: 620_120 - .saturating_add(Weight::from_parts(289_781_719, 0).saturating_mul(r.into())) + // Minimum execution time: 1_809_658_000 picoseconds. + Weight::from_parts(2_002_681_446, 0) + // Standard Error: 414_919 + .saturating_add(Weight::from_parts(227_942_929, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_438_000 picoseconds. - Weight::from_parts(86_817_816, 0) - // Standard Error: 234_731 - .saturating_add(Weight::from_parts(19_849_283, 0).saturating_mul(r.into())) + // Minimum execution time: 80_821_000 picoseconds. + Weight::from_parts(84_783_126, 0) + // Standard Error: 234_696 + .saturating_add(Weight::from_parts(22_124_873, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_002_000 picoseconds. - Weight::from_parts(88_114_999, 0) - // Standard Error: 1_128 - .saturating_add(Weight::from_parts(427_426, 0).saturating_mul(n.into())) + // Minimum execution time: 100_040_000 picoseconds. + Weight::from_parts(92_861_700, 0) + // Standard Error: 1_021 + .saturating_add(Weight::from_parts(419_414, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_436_000 picoseconds. - Weight::from_parts(88_440_285, 0) - // Standard Error: 277_544 - .saturating_add(Weight::from_parts(17_399_914, 0).saturating_mul(r.into())) + // Minimum execution time: 80_986_000 picoseconds. + Weight::from_parts(85_723_530, 0) + // Standard Error: 278_519 + .saturating_add(Weight::from_parts(19_484_469, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 103_800_000 picoseconds. - Weight::from_parts(89_756_983, 0) - // Standard Error: 907 - .saturating_add(Weight::from_parts(428_998, 0).saturating_mul(n.into())) + // Minimum execution time: 104_879_000 picoseconds. + Weight::from_parts(88_056_044, 0) + // Standard Error: 1_087 + .saturating_add(Weight::from_parts(427_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_754_000 picoseconds. - Weight::from_parts(87_296_014, 0) - // Standard Error: 336_747 - .saturating_add(Weight::from_parts(20_299_385, 0).saturating_mul(r.into())) + // Minimum execution time: 80_548_000 picoseconds. + Weight::from_parts(84_139_208, 0) + // Standard Error: 235_150 + .saturating_add(Weight::from_parts(17_533_491, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_952_000 picoseconds. - Weight::from_parts(86_840_575, 0) - // Standard Error: 272_708 - .saturating_add(Weight::from_parts(19_217_524, 0).saturating_mul(r.into())) + // Minimum execution time: 84_118_000 picoseconds. + Weight::from_parts(88_086_604, 0) + // Standard Error: 244_958 + .saturating_add(Weight::from_parts(17_286_195, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_498_000 picoseconds. - Weight::from_parts(126_431_779, 0) - // Standard Error: 460_480 - .saturating_add(Weight::from_parts(198_940_536, 0).saturating_mul(r.into())) + // Minimum execution time: 83_393_000 picoseconds. + Weight::from_parts(132_631_342, 0) + // Standard Error: 436_134 + .saturating_add(Weight::from_parts(141_520_417, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_862_000 picoseconds. - Weight::from_parts(98_611_000, 0) - // Standard Error: 2_677 - .saturating_add(Weight::from_parts(662_266, 0).saturating_mul(n.into())) + // Minimum execution time: 97_567_000 picoseconds. + Weight::from_parts(99_600_000, 0) + // Standard Error: 2_187 + .saturating_add(Weight::from_parts(639_729, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 698_914_000 picoseconds. - Weight::from_parts(718_405_100, 0) - // Standard Error: 1_891_960 - .saturating_add(Weight::from_parts(24_867_800, 0).saturating_mul(r.into())) + // Minimum execution time: 696_739_000 picoseconds. + Weight::from_parts(711_247_336, 0) + // Standard Error: 1_403_605 + .saturating_add(Weight::from_parts(15_869_663, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 699_975_000 picoseconds. - Weight::from_parts(718_806_789, 0) - // Standard Error: 1_919_531 - .saturating_add(Weight::from_parts(51_192_710, 0).saturating_mul(r.into())) + // Minimum execution time: 697_432_000 picoseconds. + Weight::from_parts(712_096_565, 0) + // Standard Error: 1_674_352 + .saturating_add(Weight::from_parts(32_103_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_002_000 picoseconds. - Weight::from_parts(99_331_989, 0) - // Standard Error: 287_602 - .saturating_add(Weight::from_parts(9_719_710, 0).saturating_mul(r.into())) + // Minimum execution time: 92_685_000 picoseconds. + Weight::from_parts(96_156_389, 0) + // Standard Error: 262_969 + .saturating_add(Weight::from_parts(8_983_510, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_501_000 picoseconds. - Weight::from_parts(87_026_327, 0) - // Standard Error: 1_214 - .saturating_add(Weight::from_parts(429_134, 0).saturating_mul(n.into())) + // Minimum execution time: 105_746_000 picoseconds. + Weight::from_parts(89_918_273, 0) + // Standard Error: 1_055 + .saturating_add(Weight::from_parts(427_838, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_228_000 picoseconds. - Weight::from_parts(97_923_691, 0) - // Standard Error: 288_469 - .saturating_add(Weight::from_parts(9_669_908, 0).saturating_mul(r.into())) + // Minimum execution time: 95_634_000 picoseconds. + Weight::from_parts(99_574_926, 0) + // Standard Error: 267_301 + .saturating_add(Weight::from_parts(3_125_673, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_908_000 picoseconds. - Weight::from_parts(87_613_705, 0) - // Standard Error: 1_237 - .saturating_add(Weight::from_parts(431_412, 0).saturating_mul(n.into())) + // Minimum execution time: 99_268_000 picoseconds. + Weight::from_parts(93_140_981, 0) + // Standard Error: 1_101 + .saturating_add(Weight::from_parts(419_078, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_385_000 picoseconds. - Weight::from_parts(74_453_057, 0) - // Standard Error: 309_931 - .saturating_add(Weight::from_parts(117_172_527, 0).saturating_mul(r.into())) + // Minimum execution time: 83_167_000 picoseconds. + Weight::from_parts(80_305_860, 0) + // Standard Error: 357_986 + .saturating_add(Weight::from_parts(80_422_820, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_437_000 picoseconds. - Weight::from_parts(78_951_443, 0) - // Standard Error: 294_227 - .saturating_add(Weight::from_parts(116_066_384, 0).saturating_mul(r.into())) + // Minimum execution time: 81_137_000 picoseconds. + Weight::from_parts(76_881_656, 0) + // Standard Error: 302_504 + .saturating_add(Weight::from_parts(80_036_963, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 704_954_000 picoseconds. - Weight::from_parts(752_735_182, 0) - // Standard Error: 455_998 - .saturating_add(Weight::from_parts(135_154_607, 0).saturating_mul(r.into())) + // Minimum execution time: 707_922_000 picoseconds. + Weight::from_parts(767_820_244, 0) + // Standard Error: 418_647 + .saturating_add(Weight::from_parts(97_993_049, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 724_451_000 picoseconds. - Weight::from_parts(738_722_668, 0) - // Standard Error: 1_014 - .saturating_add(Weight::from_parts(154_329, 0).saturating_mul(n.into())) + // Minimum execution time: 724_683_000 picoseconds. + Weight::from_parts(732_157_836, 0) + // Standard Error: 618 + .saturating_add(Weight::from_parts(151_809, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_092_586_000 picoseconds. - Weight::from_parts(3_231_311_035, 0) - // Standard Error: 506_742 - .saturating_add(Weight::from_parts(159_545_582, 0).saturating_mul(r.into())) + // Minimum execution time: 2_304_055_000 picoseconds. + Weight::from_parts(2_435_844_780, 0) + // Standard Error: 420_214 + .saturating_add(Weight::from_parts(120_405_108, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_299_872_000 picoseconds. - Weight::from_parts(3_317_022_894, 0) - // Standard Error: 8_542 - .saturating_add(Weight::from_parts(13_645_472, 0).saturating_mul(n.into())) + // Minimum execution time: 2_431_524_000 picoseconds. + Weight::from_parts(2_669_711_936, 0) + // Standard Error: 12_819 + .saturating_add(Weight::from_parts(13_546_418, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_966_000 picoseconds. - Weight::from_parts(106_319_310, 0) - // Standard Error: 424_534 - .saturating_add(Weight::from_parts(139_885_203, 0).saturating_mul(r.into())) + // Minimum execution time: 85_238_000 picoseconds. + Weight::from_parts(104_905_012, 0) + // Standard Error: 392_000 + .saturating_add(Weight::from_parts(116_570_175, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 142_910_000 picoseconds. - Weight::from_parts(144_843_000, 0) - // Standard Error: 54_401 - .saturating_add(Weight::from_parts(25_535_472, 0).saturating_mul(n.into())) + // Minimum execution time: 143_132_000 picoseconds. + Weight::from_parts(145_448_000, 0) + // Standard Error: 51_056 + .saturating_add(Weight::from_parts(25_497_066, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_117_000 picoseconds. - Weight::from_parts(80_202_149, 0) - // Standard Error: 296_880 - .saturating_add(Weight::from_parts(114_586_990, 0).saturating_mul(r.into())) + // Minimum execution time: 84_055_000 picoseconds. + Weight::from_parts(75_514_507, 0) + // Standard Error: 342_511 + .saturating_add(Weight::from_parts(78_022_368, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_802_000 picoseconds. - Weight::from_parts(85_064_295, 0) - // Standard Error: 248_874 - .saturating_add(Weight::from_parts(27_314_604, 0).saturating_mul(r.into())) + // Minimum execution time: 83_725_000 picoseconds. + Weight::from_parts(87_574_873, 0) + // Standard Error: 249_331 + .saturating_add(Weight::from_parts(24_890_126, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_854_000 picoseconds. - Weight::from_parts(86_180_314, 0) - // Standard Error: 239_162 - .saturating_add(Weight::from_parts(16_391_885, 0).saturating_mul(r.into())) + // Minimum execution time: 82_761_000 picoseconds. + Weight::from_parts(86_511_404, 0) + // Standard Error: 240_746 + .saturating_add(Weight::from_parts(16_767_395, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_883_000 picoseconds. - Weight::from_parts(87_058_214, 0) - // Standard Error: 256_392 - .saturating_add(Weight::from_parts(13_333_285, 0).saturating_mul(r.into())) + // Minimum execution time: 84_794_000 picoseconds. + Weight::from_parts(88_401_167, 0) + // Standard Error: 217_438 + .saturating_add(Weight::from_parts(11_267_632, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_417_000 picoseconds. - Weight::from_parts(85_403_451, 0) - // Standard Error: 249_767 - .saturating_add(Weight::from_parts(14_474_948, 0).saturating_mul(r.into())) + // Minimum execution time: 83_664_000 picoseconds. + Weight::from_parts(89_193_048, 0) + // Standard Error: 336_699 + .saturating_add(Weight::from_parts(12_350_251, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_020_000 picoseconds. - Weight::from_parts(88_080_622, 0) - // Standard Error: 253_221 - .saturating_add(Weight::from_parts(11_403_277, 0).saturating_mul(r.into())) + // Minimum execution time: 83_815_000 picoseconds. + Weight::from_parts(87_397_869, 0) + // Standard Error: 235_037 + .saturating_add(Weight::from_parts(16_313_030, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 138_317_000 picoseconds. - Weight::from_parts(187_894_162, 0) - // Standard Error: 376_519 - .saturating_add(Weight::from_parts(209_723_429, 0).saturating_mul(r.into())) + // Minimum execution time: 139_190_000 picoseconds. + Weight::from_parts(186_267_428, 0) + // Standard Error: 346_204 + .saturating_add(Weight::from_parts(158_103_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_047_000 picoseconds. - Weight::from_parts(151_715_771, 0) - // Standard Error: 425_606 - .saturating_add(Weight::from_parts(396_733_544, 0).saturating_mul(r.into())) + // Minimum execution time: 96_748_000 picoseconds. + Weight::from_parts(148_556_306, 0) + // Standard Error: 400_680 + .saturating_add(Weight::from_parts(333_100_790, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1059,22 +1059,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_923_081_000 picoseconds. - Weight::from_parts(45_981_736_000, 0) - // Standard Error: 274_662 - .saturating_add(Weight::from_parts(6_858_186, 0).saturating_mul(p.into())) - // Standard Error: 274_649 - .saturating_add(Weight::from_parts(177_291_831, 0).saturating_mul(s.into())) + // Minimum execution time: 44_452_286_000 picoseconds. + Weight::from_parts(44_568_744_000, 0) + // Standard Error: 268_880 + .saturating_add(Weight::from_parts(7_444_126, 0).saturating_mul(p.into())) + // Standard Error: 268_867 + .saturating_add(Weight::from_parts(179_724_917, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_680_000 picoseconds. - Weight::from_parts(157_350_147, 0) - // Standard Error: 440_994 - .saturating_add(Weight::from_parts(402_511_567, 0).saturating_mul(r.into())) + // Minimum execution time: 96_042_000 picoseconds. + Weight::from_parts(163_443_462, 0) + // Standard Error: 381_777 + .saturating_add(Weight::from_parts(338_839_702, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1082,32 +1082,32 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_842_395_000 picoseconds. - Weight::from_parts(42_890_931_000, 0) - // Standard Error: 264_187 - .saturating_add(Weight::from_parts(7_896_879, 0).saturating_mul(p.into())) - // Standard Error: 264_174 - .saturating_add(Weight::from_parts(178_082_248, 0).saturating_mul(s.into())) + // Minimum execution time: 42_724_116_000 picoseconds. + Weight::from_parts(42_849_968_000, 0) + // Standard Error: 263_445 + .saturating_add(Weight::from_parts(8_197_177, 0).saturating_mul(p.into())) + // Standard Error: 263_432 + .saturating_add(Weight::from_parts(180_050_572, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_272_000 picoseconds. - Weight::from_parts(100_008_395, 0) - // Standard Error: 36_430 - .saturating_add(Weight::from_parts(2_544_223, 0).saturating_mul(r.into())) + // Minimum execution time: 86_607_000 picoseconds. + Weight::from_parts(100_957_693, 0) + // Standard Error: 29_067 + .saturating_add(Weight::from_parts(1_762_813, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_139_000 picoseconds. - Weight::from_parts(122_967_835, 1131) - // Standard Error: 6_454 - .saturating_add(Weight::from_parts(11_784_103, 0).saturating_mul(p.into())) + // Minimum execution time: 87_305_000 picoseconds. + Weight::from_parts(108_825_748, 1131) + // Standard Error: 5_956 + .saturating_add(Weight::from_parts(11_809_647, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1116,10 +1116,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_229_000 picoseconds. - Weight::from_parts(83_885_000, 1131) - // Standard Error: 37_558 - .saturating_add(Weight::from_parts(35_503_677, 0).saturating_mul(p.into())) + // Minimum execution time: 87_531_000 picoseconds. + Weight::from_parts(88_749_000, 1131) + // Standard Error: 27_438 + .saturating_add(Weight::from_parts(35_435_114, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1128,10 +1128,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_139_187_000 picoseconds. - Weight::from_parts(5_806_599_304, 5069931) - // Standard Error: 75_881 - .saturating_add(Weight::from_parts(36_513_688, 0).saturating_mul(p.into())) + // Minimum execution time: 6_087_078_000 picoseconds. + Weight::from_parts(5_882_681_000, 5069931) + // Standard Error: 87_545 + .saturating_add(Weight::from_parts(37_047_042, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1139,10 +1139,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_177_000 picoseconds. - Weight::from_parts(83_595_000, 1939) - // Standard Error: 45_778 - .saturating_add(Weight::from_parts(47_155_630, 0).saturating_mul(p.into())) + // Minimum execution time: 85_432_000 picoseconds. + Weight::from_parts(87_001_000, 1939) + // Standard Error: 47_768 + .saturating_add(Weight::from_parts(47_598_234, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1151,10 +1151,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 90_231_000 picoseconds. - Weight::from_parts(95_944_378, 1131) - // Standard Error: 61_821 - .saturating_add(Weight::from_parts(35_941_066, 0).saturating_mul(p.into())) + // Minimum execution time: 92_594_000 picoseconds. + Weight::from_parts(93_795_036, 1131) + // Standard Error: 53_549 + .saturating_add(Weight::from_parts(35_797_869, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1163,10 +1163,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 734_006_000 picoseconds. - Weight::from_parts(717_384_508, 1496) - // Standard Error: 375_292 - .saturating_add(Weight::from_parts(47_930_581, 0).saturating_mul(p.into())) + // Minimum execution time: 769_397_000 picoseconds. + Weight::from_parts(792_321_925, 1496) + // Standard Error: 237_986 + .saturating_add(Weight::from_parts(48_847_504, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1175,10 +1175,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_121_849_000 picoseconds. - Weight::from_parts(1_147_558_033, 317931) - // Standard Error: 373_146 - .saturating_add(Weight::from_parts(45_393_418, 0).saturating_mul(p.into())) + // Minimum execution time: 1_113_735_000 picoseconds. + Weight::from_parts(1_148_020_828, 317931) + // Standard Error: 167_371 + .saturating_add(Weight::from_parts(47_795_831, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1186,885 +1186,885 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_220_392, 0) - // Standard Error: 8_848 - .saturating_add(Weight::from_parts(24_205_605, 0).saturating_mul(r.into())) + // Minimum execution time: 4_154_000 picoseconds. + Weight::from_parts(4_280_364, 0) + // Standard Error: 8_638 + .saturating_add(Weight::from_parts(24_150_721, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_352_664_000 picoseconds. - Weight::from_parts(4_153_366_897, 0) - // Standard Error: 60_193 - .saturating_add(Weight::from_parts(4_722_164, 0).saturating_mul(r.into())) + // Minimum execution time: 4_339_689_000 picoseconds. + Weight::from_parts(4_202_598_633, 0) + // Standard Error: 74_721 + .saturating_add(Weight::from_parts(4_468_109, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_357_649_000 picoseconds. - Weight::from_parts(4_256_499_798, 0) - // Standard Error: 57_942 - .saturating_add(Weight::from_parts(4_200_870, 0).saturating_mul(r.into())) + // Minimum execution time: 4_343_068_000 picoseconds. + Weight::from_parts(4_226_706_212, 0) + // Standard Error: 60_538 + .saturating_add(Weight::from_parts(4_325_162, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_269_998_000 picoseconds. - Weight::from_parts(11_525_100_351, 0) - // Standard Error: 204_230 - .saturating_add(Weight::from_parts(8_423_588, 0).saturating_mul(r.into())) + // Minimum execution time: 11_409_473_000 picoseconds. + Weight::from_parts(11_882_222_938, 0) + // Standard Error: 194_167 + .saturating_add(Weight::from_parts(8_210_890, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_204_810_000 picoseconds. - Weight::from_parts(10_982_673_143, 0) - // Standard Error: 145_327 - .saturating_add(Weight::from_parts(9_198_033, 0).saturating_mul(r.into())) + // Minimum execution time: 10_212_512_000 picoseconds. + Weight::from_parts(10_628_957_808, 0) + // Standard Error: 170_508 + .saturating_add(Weight::from_parts(11_560_237, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_074_000 picoseconds. - Weight::from_parts(2_108_000, 0) - // Standard Error: 9_031 - .saturating_add(Weight::from_parts(3_829_182, 0).saturating_mul(r.into())) + // Minimum execution time: 2_229_000 picoseconds. + Weight::from_parts(2_319_000, 0) + // Standard Error: 9_576 + .saturating_add(Weight::from_parts(3_794_717, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_020_000 picoseconds. - Weight::from_parts(2_118_000, 0) - // Standard Error: 5_295 - .saturating_add(Weight::from_parts(2_980_329, 0).saturating_mul(r.into())) + // Minimum execution time: 2_265_000 picoseconds. + Weight::from_parts(2_353_000, 0) + // Standard Error: 5_018 + .saturating_add(Weight::from_parts(3_059_511, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_032_000 picoseconds. - Weight::from_parts(3_411_359, 0) - // Standard Error: 1_146 - .saturating_add(Weight::from_parts(1_563_906, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(3_531_925, 0) + // Standard Error: 1_167 + .saturating_add(Weight::from_parts(1_569_201, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_096_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 8_349 - .saturating_add(Weight::from_parts(2_904_673, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(2_359_000, 0) + // Standard Error: 9_672 + .saturating_add(Weight::from_parts(2_884_305, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_128_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 8_100 - .saturating_add(Weight::from_parts(5_229_400, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 8_373 + .saturating_add(Weight::from_parts(5_256_648, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_838_000 picoseconds. - Weight::from_parts(5_309_346, 0) - // Standard Error: 2_580 - .saturating_add(Weight::from_parts(129_982, 0).saturating_mul(e.into())) + // Minimum execution time: 7_012_000 picoseconds. + Weight::from_parts(4_938_253, 0) + // Standard Error: 2_214 + .saturating_add(Weight::from_parts(151_870, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(3_593_285, 0) - // Standard Error: 6_648 - .saturating_add(Weight::from_parts(2_597_926, 0).saturating_mul(r.into())) + // Minimum execution time: 2_309_000 picoseconds. + Weight::from_parts(4_232_448, 0) + // Standard Error: 6_359 + .saturating_add(Weight::from_parts(2_596_672, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_597_926 - - 2_429_048, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_596_672 - + 2_404_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_086_000 picoseconds. - Weight::from_parts(3_972_773, 0) - // Standard Error: 12_538 - .saturating_add(Weight::from_parts(2_429_048, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(4_432_470, 0) + // Standard Error: 11_941 + .saturating_add(Weight::from_parts(2_404_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_591_000 picoseconds. - Weight::from_parts(12_798_134, 0) - // Standard Error: 23_023 - .saturating_add(Weight::from_parts(9_786_464, 0).saturating_mul(r.into())) + // Minimum execution time: 2_776_000 picoseconds. + Weight::from_parts(12_954_286, 0) + // Standard Error: 30_568 + .saturating_add(Weight::from_parts(10_260_958, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_274_000 picoseconds. - Weight::from_parts(1_706_188, 0) - // Standard Error: 6_199 - .saturating_add(Weight::from_parts(1_212_443, 0).saturating_mul(p.into())) + // Minimum execution time: 11_935_000 picoseconds. + Weight::from_parts(1_635_475, 0) + // Standard Error: 7_669 + .saturating_add(Weight::from_parts(1_285_084, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_221_000 picoseconds. - Weight::from_parts(5_538_574, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(12, 0).saturating_mul(l.into())) + // Minimum execution time: 5_316_000 picoseconds. + Weight::from_parts(5_699_758, 0) + // Standard Error: 13 + .saturating_add(Weight::from_parts(34, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(1_785_103, 0) - // Standard Error: 2_948 - .saturating_add(Weight::from_parts(249_981, 0).saturating_mul(r.into())) + // Minimum execution time: 2_315_000 picoseconds. + Weight::from_parts(2_460_643, 0) + // Standard Error: 2_850 + .saturating_add(Weight::from_parts(235_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_123_000 picoseconds. - Weight::from_parts(2_187_000, 0) - // Standard Error: 5_664 - .saturating_add(Weight::from_parts(719_187, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 6_150 + .saturating_add(Weight::from_parts(730_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_214_000, 0) - // Standard Error: 5_625 - .saturating_add(Weight::from_parts(709_067, 0).saturating_mul(r.into())) + // Minimum execution time: 2_244_000 picoseconds. + Weight::from_parts(2_338_000, 0) + // Standard Error: 5_205 + .saturating_add(Weight::from_parts(679_669, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_168_000 picoseconds. - Weight::from_parts(2_290_203, 0) - // Standard Error: 8_984 - .saturating_add(Weight::from_parts(761_843, 0).saturating_mul(r.into())) + // Minimum execution time: 6_412_000 picoseconds. + Weight::from_parts(2_087_064, 0) + // Standard Error: 9_824 + .saturating_add(Weight::from_parts(743_737, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_249_000 picoseconds. - Weight::from_parts(6_302_000, 0) - // Standard Error: 8_682 - .saturating_add(Weight::from_parts(1_329_653, 0).saturating_mul(r.into())) + // Minimum execution time: 6_388_000 picoseconds. + Weight::from_parts(6_512_000, 0) + // Standard Error: 7_958 + .saturating_add(Weight::from_parts(1_283_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_791_000 picoseconds. - Weight::from_parts(3_929_000, 0) - // Standard Error: 9_270 - .saturating_add(Weight::from_parts(6_742_685, 0).saturating_mul(r.into())) + // Minimum execution time: 6_885_000 picoseconds. + Weight::from_parts(4_075_795, 0) + // Standard Error: 12_241 + .saturating_add(Weight::from_parts(6_965_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_113_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 6_734 - .saturating_add(Weight::from_parts(3_327_207, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 5_936 + .saturating_add(Weight::from_parts(3_299_707, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_141_000, 0) - // Standard Error: 6_506 - .saturating_add(Weight::from_parts(3_061_891, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 6_255 + .saturating_add(Weight::from_parts(2_999_382, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_108_000 picoseconds. - Weight::from_parts(2_141_000, 0) - // Standard Error: 6_738 - .saturating_add(Weight::from_parts(3_101_844, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_271_000, 0) + // Standard Error: 6_896 + .saturating_add(Weight::from_parts(2_967_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_138_000 picoseconds. - Weight::from_parts(2_155_000, 0) - // Standard Error: 4_379 - .saturating_add(Weight::from_parts(2_613_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_268_000, 0) + // Standard Error: 4_893 + .saturating_add(Weight::from_parts(2_579_110, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_046_000 picoseconds. - Weight::from_parts(2_127_000, 0) - // Standard Error: 3_513 - .saturating_add(Weight::from_parts(525_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_304_000, 0) + // Standard Error: 3_852 + .saturating_add(Weight::from_parts(520_005, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(1_669_179, 0) - // Standard Error: 2_817 - .saturating_add(Weight::from_parts(367_599, 0).saturating_mul(r.into())) + // Minimum execution time: 2_274_000 picoseconds. + Weight::from_parts(1_794_591, 0) + // Standard Error: 3_416 + .saturating_add(Weight::from_parts(359_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 11_816 - .saturating_add(Weight::from_parts(1_810_781, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_287_000, 0) + // Standard Error: 10_307 + .saturating_add(Weight::from_parts(1_833_775, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_087_000 picoseconds. - Weight::from_parts(2_194_000, 0) - // Standard Error: 7_361 - .saturating_add(Weight::from_parts(1_130_773, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(2_349_000, 0) + // Standard Error: 9_393 + .saturating_add(Weight::from_parts(1_178_942, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_061_000 picoseconds. - Weight::from_parts(1_850_477, 0) - // Standard Error: 2_695 - .saturating_add(Weight::from_parts(318_827, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_256_508, 0) + // Standard Error: 3_133 + .saturating_add(Weight::from_parts(326_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_115_000 picoseconds. - Weight::from_parts(1_764_589, 0) - // Standard Error: 2_923 - .saturating_add(Weight::from_parts(329_840, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(1_792_383, 0) + // Standard Error: 2_981 + .saturating_add(Weight::from_parts(325_072, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_109_000 picoseconds. - Weight::from_parts(859_995, 0) - // Standard Error: 4_546 - .saturating_add(Weight::from_parts(467_944, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(236_190, 0) + // Standard Error: 5_791 + .saturating_add(Weight::from_parts(526_784, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_010_000 picoseconds. - Weight::from_parts(2_081_000, 0) - // Standard Error: 3_959 - .saturating_add(Weight::from_parts(472_947, 0).saturating_mul(r.into())) + // Minimum execution time: 2_278_000 picoseconds. + Weight::from_parts(18_346, 0) + // Standard Error: 5_882 + .saturating_add(Weight::from_parts(538_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_105_000 picoseconds. - Weight::from_parts(1_247_124, 0) - // Standard Error: 4_390 - .saturating_add(Weight::from_parts(436_907, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 4_502 + .saturating_add(Weight::from_parts(463_034, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_140_000 picoseconds. - Weight::from_parts(2_251_532, 0) - // Standard Error: 2_995 - .saturating_add(Weight::from_parts(280_490, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(2_193_450, 0) + // Standard Error: 3_655 + .saturating_add(Weight::from_parts(304_226, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_119_000 picoseconds. - Weight::from_parts(2_808_547, 0) - // Standard Error: 1_453 - .saturating_add(Weight::from_parts(143_409, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_803_358, 0) + // Standard Error: 2_256 + .saturating_add(Weight::from_parts(163_489, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_043_000 picoseconds. - Weight::from_parts(2_639_820, 0) - // Standard Error: 1_638 - .saturating_add(Weight::from_parts(159_792, 0).saturating_mul(r.into())) + // Minimum execution time: 2_242_000 picoseconds. + Weight::from_parts(3_087_274, 0) + // Standard Error: 1_907 + .saturating_add(Weight::from_parts(146_988, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_128_000 picoseconds. - Weight::from_parts(2_166_000, 0) - // Standard Error: 11_777 - .saturating_add(Weight::from_parts(1_709_510, 0).saturating_mul(r.into())) + // Minimum execution time: 2_268_000 picoseconds. + Weight::from_parts(2_335_000, 0) + // Standard Error: 9_220 + .saturating_add(Weight::from_parts(1_682_986, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(2_136_000, 0) - // Standard Error: 7_491 - .saturating_add(Weight::from_parts(1_105_807, 0).saturating_mul(r.into())) + // Minimum execution time: 2_244_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 7_751 + .saturating_add(Weight::from_parts(1_073_438, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_088_000 picoseconds. - Weight::from_parts(2_171_000, 0) - // Standard Error: 11_841 - .saturating_add(Weight::from_parts(1_785_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_225_000 picoseconds. + Weight::from_parts(2_297_000, 0) + // Standard Error: 9_887 + .saturating_add(Weight::from_parts(1_746_888, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_042_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 7_479 - .saturating_add(Weight::from_parts(1_086_144, 0).saturating_mul(r.into())) + // Minimum execution time: 2_225_000 picoseconds. + Weight::from_parts(2_305_000, 0) + // Standard Error: 8_241 + .saturating_add(Weight::from_parts(1_123_968, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_109_000 picoseconds. - Weight::from_parts(2_151_000, 0) - // Standard Error: 13_111 - .saturating_add(Weight::from_parts(1_829_000, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(2_368_000, 0) + // Standard Error: 10_199 + .saturating_add(Weight::from_parts(1_754_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_153_000, 0) - // Standard Error: 7_632 - .saturating_add(Weight::from_parts(1_102_522, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 7_885 + .saturating_add(Weight::from_parts(1_054_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_155_000 picoseconds. - Weight::from_parts(2_231_000, 0) - // Standard Error: 11_689 - .saturating_add(Weight::from_parts(1_768_866, 0).saturating_mul(r.into())) + // Minimum execution time: 2_212_000 picoseconds. + Weight::from_parts(2_244_000, 0) + // Standard Error: 11_272 + .saturating_add(Weight::from_parts(1_769_874, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_163_000, 0) - // Standard Error: 7_348 - .saturating_add(Weight::from_parts(1_057_058, 0).saturating_mul(r.into())) + // Minimum execution time: 2_248_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 8_360 + .saturating_add(Weight::from_parts(1_115_362, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_142_000, 0) - // Standard Error: 12_173 - .saturating_add(Weight::from_parts(1_786_184, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 9_424 + .saturating_add(Weight::from_parts(1_807_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 7_244 - .saturating_add(Weight::from_parts(1_066_057, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 7_499 + .saturating_add(Weight::from_parts(1_087_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_090_000 picoseconds. - Weight::from_parts(2_175_000, 0) - // Standard Error: 11_967 - .saturating_add(Weight::from_parts(1_782_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 11_743 + .saturating_add(Weight::from_parts(1_703_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_091_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 7_205 - .saturating_add(Weight::from_parts(1_048_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_254_000, 0) + // Standard Error: 8_099 + .saturating_add(Weight::from_parts(1_080_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_164_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 12_228 - .saturating_add(Weight::from_parts(1_792_751, 0).saturating_mul(r.into())) + // Minimum execution time: 2_183_000 picoseconds. + Weight::from_parts(2_301_000, 0) + // Standard Error: 10_230 + .saturating_add(Weight::from_parts(1_738_567, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_186_000, 0) - // Standard Error: 7_822 - .saturating_add(Weight::from_parts(1_052_385, 0).saturating_mul(r.into())) + // Minimum execution time: 2_209_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 8_536 + .saturating_add(Weight::from_parts(1_161_928, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_055_000 picoseconds. - Weight::from_parts(2_135_000, 0) - // Standard Error: 12_011 - .saturating_add(Weight::from_parts(1_789_504, 0).saturating_mul(r.into())) + // Minimum execution time: 2_208_000 picoseconds. + Weight::from_parts(2_255_000, 0) + // Standard Error: 10_368 + .saturating_add(Weight::from_parts(1_847_441, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_447_000 picoseconds. - Weight::from_parts(2_540_000, 0) - // Standard Error: 7_696 - .saturating_add(Weight::from_parts(1_062_612, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(2_299_000, 0) + // Standard Error: 8_213 + .saturating_add(Weight::from_parts(1_112_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_107_000, 0) - // Standard Error: 12_070 - .saturating_add(Weight::from_parts(1_771_498, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 12_684 + .saturating_add(Weight::from_parts(1_728_765, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_123_000 picoseconds. - Weight::from_parts(2_156_000, 0) - // Standard Error: 7_108 - .saturating_add(Weight::from_parts(1_072_471, 0).saturating_mul(r.into())) + // Minimum execution time: 2_573_000 picoseconds. + Weight::from_parts(2_655_000, 0) + // Standard Error: 7_404 + .saturating_add(Weight::from_parts(1_080_080, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_145_000, 0) - // Standard Error: 11_990 - .saturating_add(Weight::from_parts(1_786_273, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_316_000, 0) + // Standard Error: 9_739 + .saturating_add(Weight::from_parts(1_807_913, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_059_000 picoseconds. - Weight::from_parts(2_122_000, 0) - // Standard Error: 7_164 - .saturating_add(Weight::from_parts(1_070_909, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 7_265 + .saturating_add(Weight::from_parts(1_087_210, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_065_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 7_265 - .saturating_add(Weight::from_parts(1_152_228, 0).saturating_mul(r.into())) + // Minimum execution time: 2_252_000 picoseconds. + Weight::from_parts(2_311_000, 0) + // Standard Error: 7_444 + .saturating_add(Weight::from_parts(1_191_685, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_160_000, 0) - // Standard Error: 5_101 - .saturating_add(Weight::from_parts(578_660, 0).saturating_mul(r.into())) + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(2_320_000, 0) + // Standard Error: 5_023 + .saturating_add(Weight::from_parts(585_667, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_184_000, 0) - // Standard Error: 9_299 - .saturating_add(Weight::from_parts(1_257_633, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_320_000, 0) + // Standard Error: 10_018 + .saturating_add(Weight::from_parts(1_297_791, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_119_000 picoseconds. - Weight::from_parts(2_262_000, 0) - // Standard Error: 3_957 - .saturating_add(Weight::from_parts(557_957, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 4_776 + .saturating_add(Weight::from_parts(612_864, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_045_000 picoseconds. - Weight::from_parts(2_157_000, 0) - // Standard Error: 10_839 - .saturating_add(Weight::from_parts(1_686_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_286_000 picoseconds. + Weight::from_parts(2_356_000, 0) + // Standard Error: 11_619 + .saturating_add(Weight::from_parts(1_743_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 7_276 - .saturating_add(Weight::from_parts(1_096_252, 0).saturating_mul(r.into())) + // Minimum execution time: 2_302_000 picoseconds. + Weight::from_parts(2_343_000, 0) + // Standard Error: 8_638 + .saturating_add(Weight::from_parts(1_136_060, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(1_434_170, 0) - // Standard Error: 21_965 - .saturating_add(Weight::from_parts(2_633_663, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 7_114 + .saturating_add(Weight::from_parts(2_599_346, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_098_000 picoseconds. - Weight::from_parts(2_122_681, 0) - // Standard Error: 10_815 - .saturating_add(Weight::from_parts(2_335_842, 0).saturating_mul(r.into())) + // Minimum execution time: 2_200_000 picoseconds. + Weight::from_parts(3_823_403, 0) + // Standard Error: 18_912 + .saturating_add(Weight::from_parts(2_161_963, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(145_632, 0) - // Standard Error: 12_320 - .saturating_add(Weight::from_parts(2_992_427, 0).saturating_mul(r.into())) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_817_173, 0) + // Standard Error: 17_341 + .saturating_add(Weight::from_parts(2_740_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_142_000 picoseconds. - Weight::from_parts(2_180_000, 0) - // Standard Error: 4_944 - .saturating_add(Weight::from_parts(2_466_854, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(88_235, 0) + // Standard Error: 10_326 + .saturating_add(Weight::from_parts(2_481_087, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_143_000 picoseconds. - Weight::from_parts(2_204_000, 0) - // Standard Error: 14_500 - .saturating_add(Weight::from_parts(9_530_241, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 14_480 + .saturating_add(Weight::from_parts(9_604_981, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_132_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 22_303 - .saturating_add(Weight::from_parts(7_508_848, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 21_926 + .saturating_add(Weight::from_parts(7_501_289, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_133_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 5_407 - .saturating_add(Weight::from_parts(2_948_013, 0).saturating_mul(r.into())) + // Minimum execution time: 2_309_000 picoseconds. + Weight::from_parts(10_308_173, 0) + // Standard Error: 30_680 + .saturating_add(Weight::from_parts(2_288_505, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_124_000 picoseconds. - Weight::from_parts(2_150_000, 0) - // Standard Error: 6_372 - .saturating_add(Weight::from_parts(2_362_416, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 5_007 + .saturating_add(Weight::from_parts(2_516_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 7_670 - .saturating_add(Weight::from_parts(1_174_342, 0).saturating_mul(r.into())) + // Minimum execution time: 2_228_000 picoseconds. + Weight::from_parts(2_300_000, 0) + // Standard Error: 8_948 + .saturating_add(Weight::from_parts(1_264_596, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_109_000, 0) - // Standard Error: 3_988 - .saturating_add(Weight::from_parts(566_949, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_323_000, 0) + // Standard Error: 5_099 + .saturating_add(Weight::from_parts(612_107, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_049_000 picoseconds. - Weight::from_parts(2_117_000, 0) - // Standard Error: 8_393 - .saturating_add(Weight::from_parts(1_160_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(2_326_000, 0) + // Standard Error: 10_004 + .saturating_add(Weight::from_parts(1_278_365, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_152_000, 0) - // Standard Error: 4_769 - .saturating_add(Weight::from_parts(585_265, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 5_578 + .saturating_add(Weight::from_parts(645_196, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_115_000 picoseconds. - Weight::from_parts(2_170_000, 0) - // Standard Error: 7_943 - .saturating_add(Weight::from_parts(1_185_174, 0).saturating_mul(r.into())) + // Minimum execution time: 2_338_000 picoseconds. + Weight::from_parts(2_363_000, 0) + // Standard Error: 8_554 + .saturating_add(Weight::from_parts(1_288_676, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_139_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 4_608 - .saturating_add(Weight::from_parts(563_329, 0).saturating_mul(r.into())) + // Minimum execution time: 2_214_000 picoseconds. + Weight::from_parts(2_332_000, 0) + // Standard Error: 3_999 + .saturating_add(Weight::from_parts(594_484, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_144_000 picoseconds. - Weight::from_parts(2_178_000, 0) - // Standard Error: 6_727 - .saturating_add(Weight::from_parts(1_000_757, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 7_437 + .saturating_add(Weight::from_parts(1_044_306, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_212_000, 0) - // Standard Error: 3_536 - .saturating_add(Weight::from_parts(504_096, 0).saturating_mul(r.into())) + // Minimum execution time: 2_226_000 picoseconds. + Weight::from_parts(2_308_000, 0) + // Standard Error: 4_658 + .saturating_add(Weight::from_parts(537_262, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_218_000, 0) - // Standard Error: 7_170 - .saturating_add(Weight::from_parts(966_365, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 10_254 + .saturating_add(Weight::from_parts(1_154_138, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_149_000 picoseconds. - Weight::from_parts(140_768, 0) - // Standard Error: 5_221 - .saturating_add(Weight::from_parts(551_550, 0).saturating_mul(r.into())) + // Minimum execution time: 2_234_000 picoseconds. + Weight::from_parts(2_313_000, 0) + // Standard Error: 4_960 + .saturating_add(Weight::from_parts(607_930, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 7_621 - .saturating_add(Weight::from_parts(997_420, 0).saturating_mul(r.into())) + // Minimum execution time: 2_279_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 7_909 + .saturating_add(Weight::from_parts(1_094_660, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_069_000 picoseconds. - Weight::from_parts(2_106_000, 0) - // Standard Error: 3_980 - .saturating_add(Weight::from_parts(537_014, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(39_069, 0) + // Standard Error: 6_710 + .saturating_add(Weight::from_parts(599_572, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_097_000 picoseconds. - Weight::from_parts(2_191_000, 0) - // Standard Error: 9_419 - .saturating_add(Weight::from_parts(1_050_292, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 8_785 + .saturating_add(Weight::from_parts(1_060_321, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_051_000 picoseconds. - Weight::from_parts(2_118_000, 0) - // Standard Error: 4_228 - .saturating_add(Weight::from_parts(529_158, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 4_191 + .saturating_add(Weight::from_parts(528_319, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_116_000, 0) - // Standard Error: 7_792 - .saturating_add(Weight::from_parts(1_027_370, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 9_328 + .saturating_add(Weight::from_parts(1_114_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 4_450 - .saturating_add(Weight::from_parts(534_724, 0).saturating_mul(r.into())) + // Minimum execution time: 2_210_000 picoseconds. + Weight::from_parts(390_951, 0) + // Standard Error: 5_316 + .saturating_add(Weight::from_parts(609_568, 0).saturating_mul(r.into())) } } @@ -2089,10 +2089,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 954_000 picoseconds. - Weight::from_parts(1_004_000, 0) - // Standard Error: 802 - .saturating_add(Weight::from_parts(249_956, 0).saturating_mul(c.into())) + // Minimum execution time: 951_000 picoseconds. + Weight::from_parts(1_020_000, 0) + // Standard Error: 722 + .saturating_add(Weight::from_parts(240_031, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -2100,10 +2100,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_808_000 picoseconds. - Weight::from_parts(2_895_000, 3506) - // Standard Error: 1_086 - .saturating_add(Weight::from_parts(680_150, 0).saturating_mul(c.into())) + // Minimum execution time: 2_762_000 picoseconds. + Weight::from_parts(2_859_000, 3506) + // Standard Error: 813 + .saturating_add(Weight::from_parts(665_139, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2112,17 +2112,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_458_000 picoseconds. - Weight::from_parts(84_558_500, 0) - // Standard Error: 7_412 - .saturating_add(Weight::from_parts(2_377_997, 0).saturating_mul(c.into())) + // Minimum execution time: 50_591_000 picoseconds. + Weight::from_parts(61_353_023, 0) + // Standard Error: 9_186 + .saturating_add(Weight::from_parts(2_404_810, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 81_302_000 picoseconds. - Weight::from_parts(83_307_000, 42236) + // Minimum execution time: 81_660_000 picoseconds. + Weight::from_parts(83_840_000, 42236) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2130,8 +2130,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 52_219_000 picoseconds. - Weight::from_parts(53_704_000, 21261) + // Minimum execution time: 54_005_000 picoseconds. + Weight::from_parts(55_095_000, 21261) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2139,8 +2139,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 28_408_000 picoseconds. - Weight::from_parts(29_714_000, 17070) + // Minimum execution time: 28_880_000 picoseconds. + Weight::from_parts(29_583_000, 17070) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2149,10 +2149,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_918_000 picoseconds. - Weight::from_parts(6_745_647, 7640) - // Standard Error: 37_300 - .saturating_add(Weight::from_parts(13_885_473, 0).saturating_mul(c.into())) + // Minimum execution time: 7_744_000 picoseconds. + Weight::from_parts(4_233_092, 7640) + // Standard Error: 39_690 + .saturating_add(Weight::from_parts(14_033_179, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -2161,10 +2161,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1297 + c * (16389 ±0)` // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 68_486_000 picoseconds. - Weight::from_parts(69_079_000, 40898) - // Standard Error: 164_982 - .saturating_add(Weight::from_parts(55_774_264, 0).saturating_mul(c.into())) + // Minimum execution time: 70_301_000 picoseconds. + Weight::from_parts(70_991_000, 40898) + // Standard Error: 177_223 + .saturating_add(Weight::from_parts(54_687_249, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2175,10 +2175,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 61_635_000 picoseconds. - Weight::from_parts(64_537_590, 4990) - // Standard Error: 40_298 - .saturating_add(Weight::from_parts(52_820_238, 0).saturating_mul(c.into())) + // Minimum execution time: 61_715_000 picoseconds. + Weight::from_parts(40_384_385, 4990) + // Standard Error: 57_496 + .saturating_add(Weight::from_parts(53_210_788, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2187,10 +2187,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `671` // Estimated: `38638` - // Minimum execution time: 63_344_000 picoseconds. - Weight::from_parts(76_968_021, 38638) + // Minimum execution time: 63_077_000 picoseconds. + Weight::from_parts(96_840_506, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_598, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_609, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2200,12 +2200,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 10_980_969_000 picoseconds. - Weight::from_parts(301_891_685, 34312) - // Standard Error: 164_203 - .saturating_add(Weight::from_parts(54_383_779, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_548, 0).saturating_mul(s.into())) + // Minimum execution time: 11_049_858_000 picoseconds. + Weight::from_parts(11_090_406_000, 34312) + // Standard Error: 517_330 + .saturating_add(Weight::from_parts(25_497_137, 0).saturating_mul(c.into())) + // Standard Error: 30 + .saturating_add(Weight::from_parts(910, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } @@ -2214,10 +2214,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 53_732_000 picoseconds. - Weight::from_parts(35_204_611, 23853) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_021, 0).saturating_mul(p.into())) + // Minimum execution time: 56_305_000 picoseconds. + Weight::from_parts(38_705_997, 23853) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_034, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -2226,32 +2226,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 82_297_000 picoseconds. - Weight::from_parts(62_302_593, 42227) + // Minimum execution time: 83_033_000 picoseconds. + Weight::from_parts(69_135_468, 42227) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_042, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(_q: u32, ) -> Weight { + fn initial_allocation(q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 298_083_000 picoseconds. - Weight::from_parts(314_192_353, 74319) + // Minimum execution time: 295_535_000 picoseconds. + Weight::from_parts(306_791_413, 74319) + // Standard Error: 1_111 + .saturating_add(Weight::from_parts(1_568, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(q: u32, ) -> Weight { + fn alloc_in_handle(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 312_856_000 picoseconds. - Weight::from_parts(326_607_586, 74319) - // Standard Error: 1_507 - .saturating_add(Weight::from_parts(723, 0).saturating_mul(q.into())) + // Minimum execution time: 309_253_000 picoseconds. + Weight::from_parts(323_694_389, 74319) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2260,10 +2260,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_478_000 picoseconds. - Weight::from_parts(45_769_000, 3899) - // Standard Error: 42_221 - .saturating_add(Weight::from_parts(51_492_007, 0).saturating_mul(c.into())) + // Minimum execution time: 44_806_000 picoseconds. + Weight::from_parts(45_498_000, 3899) + // Standard Error: 44_467 + .saturating_add(Weight::from_parts(54_603_581, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2273,630 +2273,630 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_248_000 picoseconds. - Weight::from_parts(87_224_000, 0) - // Standard Error: 4_031_043 - .saturating_add(Weight::from_parts(559_145_890, 0).saturating_mul(r.into())) + // Minimum execution time: 82_307_000 picoseconds. + Weight::from_parts(84_226_000, 0) + // Standard Error: 4_203_577 + .saturating_add(Weight::from_parts(574_493_471, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 304_310_000 picoseconds. - Weight::from_parts(240_640_662, 0) - // Standard Error: 7_875 - .saturating_add(Weight::from_parts(30_931_778, 0).saturating_mul(p.into())) + // Minimum execution time: 309_893_000 picoseconds. + Weight::from_parts(234_558_588, 0) + // Standard Error: 7_966 + .saturating_add(Weight::from_parts(32_022_587, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 144_728_000 picoseconds. - Weight::from_parts(127_694_995, 0) - // Standard Error: 344_021 - .saturating_add(Weight::from_parts(63_008_235, 0).saturating_mul(r.into())) + // Minimum execution time: 142_319_000 picoseconds. + Weight::from_parts(121_865_521, 0) + // Standard Error: 314_080 + .saturating_add(Weight::from_parts(64_422_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_763_000 picoseconds. - Weight::from_parts(93_302_515, 0) - // Standard Error: 3_873 - .saturating_add(Weight::from_parts(2_723_217, 0).saturating_mul(r.into())) + // Minimum execution time: 85_527_000 picoseconds. + Weight::from_parts(91_967_528, 0) + // Standard Error: 3_856 + .saturating_add(Weight::from_parts(2_363_669, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 134_987_000 picoseconds. - Weight::from_parts(141_052_149, 0) - // Standard Error: 29_498 - .saturating_add(Weight::from_parts(3_252_053, 0).saturating_mul(r.into())) + // Minimum execution time: 144_133_000 picoseconds. + Weight::from_parts(156_991_945, 0) + // Standard Error: 24_223 + .saturating_add(Weight::from_parts(2_431_525, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_532_000 picoseconds. - Weight::from_parts(111_956_884, 0) - // Standard Error: 420_651 - .saturating_add(Weight::from_parts(124_761_103, 0).saturating_mul(r.into())) + // Minimum execution time: 86_811_000 picoseconds. + Weight::from_parts(101_122_470, 0) + // Standard Error: 303_533 + .saturating_add(Weight::from_parts(92_415_204, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_442_000 picoseconds. - Weight::from_parts(76_262_730, 0) - // Standard Error: 310_067 - .saturating_add(Weight::from_parts(115_334_131, 0).saturating_mul(r.into())) + // Minimum execution time: 84_453_000 picoseconds. + Weight::from_parts(79_049_804, 0) + // Standard Error: 305_992 + .saturating_add(Weight::from_parts(79_382_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_322_000 picoseconds. - Weight::from_parts(71_153_919, 0) - // Standard Error: 293_317 - .saturating_add(Weight::from_parts(115_508_333, 0).saturating_mul(r.into())) + // Minimum execution time: 82_650_000 picoseconds. + Weight::from_parts(79_085_060, 0) + // Standard Error: 293_080 + .saturating_add(Weight::from_parts(77_346_019, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_586_000 picoseconds. - Weight::from_parts(73_401_225, 0) - // Standard Error: 306_089 - .saturating_add(Weight::from_parts(115_530_298, 0).saturating_mul(r.into())) + // Minimum execution time: 83_545_000 picoseconds. + Weight::from_parts(72_777_984, 0) + // Standard Error: 351_302 + .saturating_add(Weight::from_parts(80_634_984, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_537_000 picoseconds. - Weight::from_parts(80_327_682, 0) - // Standard Error: 275_679 - .saturating_add(Weight::from_parts(114_024_859, 0).saturating_mul(r.into())) + // Minimum execution time: 83_245_000 picoseconds. + Weight::from_parts(76_181_868, 0) + // Standard Error: 354_266 + .saturating_add(Weight::from_parts(79_459_120, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_226_000 picoseconds. - Weight::from_parts(74_308_323, 0) - // Standard Error: 291_460 - .saturating_add(Weight::from_parts(115_396_428, 0).saturating_mul(r.into())) + // Minimum execution time: 85_064_000 picoseconds. + Weight::from_parts(77_882_516, 0) + // Standard Error: 377_997 + .saturating_add(Weight::from_parts(78_533_852, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_250_000 picoseconds. - Weight::from_parts(74_761_588, 0) - // Standard Error: 317_797 - .saturating_add(Weight::from_parts(115_173_001, 0).saturating_mul(r.into())) + // Minimum execution time: 83_522_000 picoseconds. + Weight::from_parts(66_328_137, 0) + // Standard Error: 360_143 + .saturating_add(Weight::from_parts(79_838_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_673_000 picoseconds. - Weight::from_parts(70_907_772, 0) - // Standard Error: 347_682 - .saturating_add(Weight::from_parts(118_189_625, 0).saturating_mul(r.into())) + // Minimum execution time: 83_961_000 picoseconds. + Weight::from_parts(72_789_065, 0) + // Standard Error: 366_577 + .saturating_add(Weight::from_parts(79_031_060, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_530_000 picoseconds. - Weight::from_parts(774_384_678, 0) - // Standard Error: 512_748 - .saturating_add(Weight::from_parts(194_331_468, 0).saturating_mul(r.into())) + // Minimum execution time: 700_686_000 picoseconds. + Weight::from_parts(749_297_529, 0) + // Standard Error: 383_897 + .saturating_add(Weight::from_parts(132_242_102, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 866_889_000 picoseconds. - Weight::from_parts(872_993_000, 0) - // Standard Error: 59_048 - .saturating_add(Weight::from_parts(13_399_620, 0).saturating_mul(n.into())) + // Minimum execution time: 830_957_000 picoseconds. + Weight::from_parts(850_017_000, 0) + // Standard Error: 67_693 + .saturating_add(Weight::from_parts(13_570_326, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_291_000 picoseconds. - Weight::from_parts(75_543_485, 0) - // Standard Error: 320_701 - .saturating_add(Weight::from_parts(115_757_456, 0).saturating_mul(r.into())) + // Minimum execution time: 84_261_000 picoseconds. + Weight::from_parts(70_573_139, 0) + // Standard Error: 351_239 + .saturating_add(Weight::from_parts(80_441_776, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_780_000 picoseconds. - Weight::from_parts(68_090_338, 0) - // Standard Error: 330_050 - .saturating_add(Weight::from_parts(117_803_137, 0).saturating_mul(r.into())) + // Minimum execution time: 84_164_000 picoseconds. + Weight::from_parts(70_866_987, 0) + // Standard Error: 346_107 + .saturating_add(Weight::from_parts(82_471_591, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_394_000 picoseconds. - Weight::from_parts(88_472_912, 0) - // Standard Error: 340_524 - .saturating_add(Weight::from_parts(190_044_477, 0).saturating_mul(n.into())) + // Minimum execution time: 81_192_000 picoseconds. + Weight::from_parts(101_814_078, 0) + // Standard Error: 391_508 + .saturating_add(Weight::from_parts(166_873_282, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_081_000 picoseconds. - Weight::from_parts(85_006_000, 0) - // Standard Error: 3_456_961 - .saturating_add(Weight::from_parts(860_188_117, 0).saturating_mul(r.into())) + // Minimum execution time: 84_974_000 picoseconds. + Weight::from_parts(87_244_000, 0) + // Standard Error: 3_619_557 + .saturating_add(Weight::from_parts(749_950_767, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_490_000 picoseconds. - Weight::from_parts(136_619_765, 0) - // Standard Error: 439_674 - .saturating_add(Weight::from_parts(308_552_304, 0).saturating_mul(r.into())) + // Minimum execution time: 81_612_000 picoseconds. + Weight::from_parts(147_822_399, 0) + // Standard Error: 421_408 + .saturating_add(Weight::from_parts(250_730_230, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 386_929_000 picoseconds. - Weight::from_parts(393_325_000, 0) - // Standard Error: 61_932 - .saturating_add(Weight::from_parts(21_101_790, 0).saturating_mul(n.into())) + // Minimum execution time: 332_130_000 picoseconds. + Weight::from_parts(337_780_000, 0) + // Standard Error: 52_652 + .saturating_add(Weight::from_parts(20_743_155, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_625_000 picoseconds. - Weight::from_parts(162_584_483, 0) - // Standard Error: 494_553 - .saturating_add(Weight::from_parts(313_684_139, 0).saturating_mul(r.into())) + // Minimum execution time: 82_722_000 picoseconds. + Weight::from_parts(147_881_270, 0) + // Standard Error: 390_429 + .saturating_add(Weight::from_parts(259_701_373, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 390_932_000 picoseconds. - Weight::from_parts(393_883_000, 0) - // Standard Error: 68_646 - .saturating_add(Weight::from_parts(21_188_381, 0).saturating_mul(n.into())) + // Minimum execution time: 337_753_000 picoseconds. + Weight::from_parts(343_454_000, 0) + // Standard Error: 66_604 + .saturating_add(Weight::from_parts(21_189_034, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 708_623_000 picoseconds. - Weight::from_parts(781_094_266, 0) - // Standard Error: 460_683 - .saturating_add(Weight::from_parts(328_993_362, 0).saturating_mul(r.into())) + // Minimum execution time: 708_454_000 picoseconds. + Weight::from_parts(775_673_824, 0) + // Standard Error: 380_634 + .saturating_add(Weight::from_parts(268_253_890, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 710_228_000 picoseconds. - Weight::from_parts(774_190_634, 0) - // Standard Error: 483_646 - .saturating_add(Weight::from_parts(330_057_876, 0).saturating_mul(r.into())) + // Minimum execution time: 706_799_000 picoseconds. + Weight::from_parts(782_052_003, 0) + // Standard Error: 385_065 + .saturating_add(Weight::from_parts(265_280_556, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_510_000 picoseconds. - Weight::from_parts(64_097_635, 0) - // Standard Error: 358_570 - .saturating_add(Weight::from_parts(126_095_109, 0).saturating_mul(r.into())) + // Minimum execution time: 84_511_000 picoseconds. + Weight::from_parts(61_459_678, 0) + // Standard Error: 362_497 + .saturating_add(Weight::from_parts(87_903_947, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_430_098_000 picoseconds. - Weight::from_parts(2_605_278_898, 0) - // Standard Error: 439_185 - .saturating_add(Weight::from_parts(217_479_981, 0).saturating_mul(r.into())) + // Minimum execution time: 1_676_718_000 picoseconds. + Weight::from_parts(1_838_206_733, 0) + // Standard Error: 440_793 + .saturating_add(Weight::from_parts(156_352_100, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 358_553_000 picoseconds. - Weight::from_parts(364_183_000, 0) - // Standard Error: 51_397 - .saturating_add(Weight::from_parts(30_914_040, 0).saturating_mul(n.into())) + // Minimum execution time: 284_222_000 picoseconds. + Weight::from_parts(293_316_000, 0) + // Standard Error: 54_796 + .saturating_add(Weight::from_parts(30_939_288, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_464_581_000 picoseconds. - Weight::from_parts(2_580_044_243, 0) - // Standard Error: 461_216 - .saturating_add(Weight::from_parts(272_575_116, 0).saturating_mul(r.into())) + // Minimum execution time: 1_682_466_000 picoseconds. + Weight::from_parts(1_829_413_701, 0) + // Standard Error: 510_421 + .saturating_add(Weight::from_parts(216_009_232, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_438_114_000 picoseconds. - Weight::from_parts(2_597_881_615, 0) - // Standard Error: 400_982 - .saturating_add(Weight::from_parts(275_718_502, 0).saturating_mul(r.into())) + // Minimum execution time: 1_681_160_000 picoseconds. + Weight::from_parts(1_819_797_788, 0) + // Standard Error: 453_707 + .saturating_add(Weight::from_parts(215_589_534, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 244_206_000 picoseconds. - Weight::from_parts(321_175_021, 0) - // Standard Error: 460_445 - .saturating_add(Weight::from_parts(322_059_081, 0).saturating_mul(r.into())) + // Minimum execution time: 242_556_000 picoseconds. + Weight::from_parts(314_306_159, 0) + // Standard Error: 376_142 + .saturating_add(Weight::from_parts(260_614_468, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 559_346_000 picoseconds. - Weight::from_parts(571_004_000, 0) - // Standard Error: 59_840 - .saturating_add(Weight::from_parts(21_370_093, 0).saturating_mul(n.into())) + // Minimum execution time: 495_430_000 picoseconds. + Weight::from_parts(502_714_000, 0) + // Standard Error: 52_049 + .saturating_add(Weight::from_parts(21_259_132, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_620_633_000 picoseconds. - Weight::from_parts(2_741_869_292, 0) - // Standard Error: 620_120 - .saturating_add(Weight::from_parts(289_781_719, 0).saturating_mul(r.into())) + // Minimum execution time: 1_809_658_000 picoseconds. + Weight::from_parts(2_002_681_446, 0) + // Standard Error: 414_919 + .saturating_add(Weight::from_parts(227_942_929, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_438_000 picoseconds. - Weight::from_parts(86_817_816, 0) - // Standard Error: 234_731 - .saturating_add(Weight::from_parts(19_849_283, 0).saturating_mul(r.into())) + // Minimum execution time: 80_821_000 picoseconds. + Weight::from_parts(84_783_126, 0) + // Standard Error: 234_696 + .saturating_add(Weight::from_parts(22_124_873, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_002_000 picoseconds. - Weight::from_parts(88_114_999, 0) - // Standard Error: 1_128 - .saturating_add(Weight::from_parts(427_426, 0).saturating_mul(n.into())) + // Minimum execution time: 100_040_000 picoseconds. + Weight::from_parts(92_861_700, 0) + // Standard Error: 1_021 + .saturating_add(Weight::from_parts(419_414, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_436_000 picoseconds. - Weight::from_parts(88_440_285, 0) - // Standard Error: 277_544 - .saturating_add(Weight::from_parts(17_399_914, 0).saturating_mul(r.into())) + // Minimum execution time: 80_986_000 picoseconds. + Weight::from_parts(85_723_530, 0) + // Standard Error: 278_519 + .saturating_add(Weight::from_parts(19_484_469, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 103_800_000 picoseconds. - Weight::from_parts(89_756_983, 0) - // Standard Error: 907 - .saturating_add(Weight::from_parts(428_998, 0).saturating_mul(n.into())) + // Minimum execution time: 104_879_000 picoseconds. + Weight::from_parts(88_056_044, 0) + // Standard Error: 1_087 + .saturating_add(Weight::from_parts(427_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_754_000 picoseconds. - Weight::from_parts(87_296_014, 0) - // Standard Error: 336_747 - .saturating_add(Weight::from_parts(20_299_385, 0).saturating_mul(r.into())) + // Minimum execution time: 80_548_000 picoseconds. + Weight::from_parts(84_139_208, 0) + // Standard Error: 235_150 + .saturating_add(Weight::from_parts(17_533_491, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_952_000 picoseconds. - Weight::from_parts(86_840_575, 0) - // Standard Error: 272_708 - .saturating_add(Weight::from_parts(19_217_524, 0).saturating_mul(r.into())) + // Minimum execution time: 84_118_000 picoseconds. + Weight::from_parts(88_086_604, 0) + // Standard Error: 244_958 + .saturating_add(Weight::from_parts(17_286_195, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_498_000 picoseconds. - Weight::from_parts(126_431_779, 0) - // Standard Error: 460_480 - .saturating_add(Weight::from_parts(198_940_536, 0).saturating_mul(r.into())) + // Minimum execution time: 83_393_000 picoseconds. + Weight::from_parts(132_631_342, 0) + // Standard Error: 436_134 + .saturating_add(Weight::from_parts(141_520_417, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_862_000 picoseconds. - Weight::from_parts(98_611_000, 0) - // Standard Error: 2_677 - .saturating_add(Weight::from_parts(662_266, 0).saturating_mul(n.into())) + // Minimum execution time: 97_567_000 picoseconds. + Weight::from_parts(99_600_000, 0) + // Standard Error: 2_187 + .saturating_add(Weight::from_parts(639_729, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 698_914_000 picoseconds. - Weight::from_parts(718_405_100, 0) - // Standard Error: 1_891_960 - .saturating_add(Weight::from_parts(24_867_800, 0).saturating_mul(r.into())) + // Minimum execution time: 696_739_000 picoseconds. + Weight::from_parts(711_247_336, 0) + // Standard Error: 1_403_605 + .saturating_add(Weight::from_parts(15_869_663, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 699_975_000 picoseconds. - Weight::from_parts(718_806_789, 0) - // Standard Error: 1_919_531 - .saturating_add(Weight::from_parts(51_192_710, 0).saturating_mul(r.into())) + // Minimum execution time: 697_432_000 picoseconds. + Weight::from_parts(712_096_565, 0) + // Standard Error: 1_674_352 + .saturating_add(Weight::from_parts(32_103_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_002_000 picoseconds. - Weight::from_parts(99_331_989, 0) - // Standard Error: 287_602 - .saturating_add(Weight::from_parts(9_719_710, 0).saturating_mul(r.into())) + // Minimum execution time: 92_685_000 picoseconds. + Weight::from_parts(96_156_389, 0) + // Standard Error: 262_969 + .saturating_add(Weight::from_parts(8_983_510, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_501_000 picoseconds. - Weight::from_parts(87_026_327, 0) - // Standard Error: 1_214 - .saturating_add(Weight::from_parts(429_134, 0).saturating_mul(n.into())) + // Minimum execution time: 105_746_000 picoseconds. + Weight::from_parts(89_918_273, 0) + // Standard Error: 1_055 + .saturating_add(Weight::from_parts(427_838, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_228_000 picoseconds. - Weight::from_parts(97_923_691, 0) - // Standard Error: 288_469 - .saturating_add(Weight::from_parts(9_669_908, 0).saturating_mul(r.into())) + // Minimum execution time: 95_634_000 picoseconds. + Weight::from_parts(99_574_926, 0) + // Standard Error: 267_301 + .saturating_add(Weight::from_parts(3_125_673, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_908_000 picoseconds. - Weight::from_parts(87_613_705, 0) - // Standard Error: 1_237 - .saturating_add(Weight::from_parts(431_412, 0).saturating_mul(n.into())) + // Minimum execution time: 99_268_000 picoseconds. + Weight::from_parts(93_140_981, 0) + // Standard Error: 1_101 + .saturating_add(Weight::from_parts(419_078, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_385_000 picoseconds. - Weight::from_parts(74_453_057, 0) - // Standard Error: 309_931 - .saturating_add(Weight::from_parts(117_172_527, 0).saturating_mul(r.into())) + // Minimum execution time: 83_167_000 picoseconds. + Weight::from_parts(80_305_860, 0) + // Standard Error: 357_986 + .saturating_add(Weight::from_parts(80_422_820, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_437_000 picoseconds. - Weight::from_parts(78_951_443, 0) - // Standard Error: 294_227 - .saturating_add(Weight::from_parts(116_066_384, 0).saturating_mul(r.into())) + // Minimum execution time: 81_137_000 picoseconds. + Weight::from_parts(76_881_656, 0) + // Standard Error: 302_504 + .saturating_add(Weight::from_parts(80_036_963, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 704_954_000 picoseconds. - Weight::from_parts(752_735_182, 0) - // Standard Error: 455_998 - .saturating_add(Weight::from_parts(135_154_607, 0).saturating_mul(r.into())) + // Minimum execution time: 707_922_000 picoseconds. + Weight::from_parts(767_820_244, 0) + // Standard Error: 418_647 + .saturating_add(Weight::from_parts(97_993_049, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 724_451_000 picoseconds. - Weight::from_parts(738_722_668, 0) - // Standard Error: 1_014 - .saturating_add(Weight::from_parts(154_329, 0).saturating_mul(n.into())) + // Minimum execution time: 724_683_000 picoseconds. + Weight::from_parts(732_157_836, 0) + // Standard Error: 618 + .saturating_add(Weight::from_parts(151_809, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_092_586_000 picoseconds. - Weight::from_parts(3_231_311_035, 0) - // Standard Error: 506_742 - .saturating_add(Weight::from_parts(159_545_582, 0).saturating_mul(r.into())) + // Minimum execution time: 2_304_055_000 picoseconds. + Weight::from_parts(2_435_844_780, 0) + // Standard Error: 420_214 + .saturating_add(Weight::from_parts(120_405_108, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_299_872_000 picoseconds. - Weight::from_parts(3_317_022_894, 0) - // Standard Error: 8_542 - .saturating_add(Weight::from_parts(13_645_472, 0).saturating_mul(n.into())) + // Minimum execution time: 2_431_524_000 picoseconds. + Weight::from_parts(2_669_711_936, 0) + // Standard Error: 12_819 + .saturating_add(Weight::from_parts(13_546_418, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_966_000 picoseconds. - Weight::from_parts(106_319_310, 0) - // Standard Error: 424_534 - .saturating_add(Weight::from_parts(139_885_203, 0).saturating_mul(r.into())) + // Minimum execution time: 85_238_000 picoseconds. + Weight::from_parts(104_905_012, 0) + // Standard Error: 392_000 + .saturating_add(Weight::from_parts(116_570_175, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 142_910_000 picoseconds. - Weight::from_parts(144_843_000, 0) - // Standard Error: 54_401 - .saturating_add(Weight::from_parts(25_535_472, 0).saturating_mul(n.into())) + // Minimum execution time: 143_132_000 picoseconds. + Weight::from_parts(145_448_000, 0) + // Standard Error: 51_056 + .saturating_add(Weight::from_parts(25_497_066, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_117_000 picoseconds. - Weight::from_parts(80_202_149, 0) - // Standard Error: 296_880 - .saturating_add(Weight::from_parts(114_586_990, 0).saturating_mul(r.into())) + // Minimum execution time: 84_055_000 picoseconds. + Weight::from_parts(75_514_507, 0) + // Standard Error: 342_511 + .saturating_add(Weight::from_parts(78_022_368, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_802_000 picoseconds. - Weight::from_parts(85_064_295, 0) - // Standard Error: 248_874 - .saturating_add(Weight::from_parts(27_314_604, 0).saturating_mul(r.into())) + // Minimum execution time: 83_725_000 picoseconds. + Weight::from_parts(87_574_873, 0) + // Standard Error: 249_331 + .saturating_add(Weight::from_parts(24_890_126, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_854_000 picoseconds. - Weight::from_parts(86_180_314, 0) - // Standard Error: 239_162 - .saturating_add(Weight::from_parts(16_391_885, 0).saturating_mul(r.into())) + // Minimum execution time: 82_761_000 picoseconds. + Weight::from_parts(86_511_404, 0) + // Standard Error: 240_746 + .saturating_add(Weight::from_parts(16_767_395, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_883_000 picoseconds. - Weight::from_parts(87_058_214, 0) - // Standard Error: 256_392 - .saturating_add(Weight::from_parts(13_333_285, 0).saturating_mul(r.into())) + // Minimum execution time: 84_794_000 picoseconds. + Weight::from_parts(88_401_167, 0) + // Standard Error: 217_438 + .saturating_add(Weight::from_parts(11_267_632, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_417_000 picoseconds. - Weight::from_parts(85_403_451, 0) - // Standard Error: 249_767 - .saturating_add(Weight::from_parts(14_474_948, 0).saturating_mul(r.into())) + // Minimum execution time: 83_664_000 picoseconds. + Weight::from_parts(89_193_048, 0) + // Standard Error: 336_699 + .saturating_add(Weight::from_parts(12_350_251, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_020_000 picoseconds. - Weight::from_parts(88_080_622, 0) - // Standard Error: 253_221 - .saturating_add(Weight::from_parts(11_403_277, 0).saturating_mul(r.into())) + // Minimum execution time: 83_815_000 picoseconds. + Weight::from_parts(87_397_869, 0) + // Standard Error: 235_037 + .saturating_add(Weight::from_parts(16_313_030, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 138_317_000 picoseconds. - Weight::from_parts(187_894_162, 0) - // Standard Error: 376_519 - .saturating_add(Weight::from_parts(209_723_429, 0).saturating_mul(r.into())) + // Minimum execution time: 139_190_000 picoseconds. + Weight::from_parts(186_267_428, 0) + // Standard Error: 346_204 + .saturating_add(Weight::from_parts(158_103_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_047_000 picoseconds. - Weight::from_parts(151_715_771, 0) - // Standard Error: 425_606 - .saturating_add(Weight::from_parts(396_733_544, 0).saturating_mul(r.into())) + // Minimum execution time: 96_748_000 picoseconds. + Weight::from_parts(148_556_306, 0) + // Standard Error: 400_680 + .saturating_add(Weight::from_parts(333_100_790, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2904,22 +2904,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_923_081_000 picoseconds. - Weight::from_parts(45_981_736_000, 0) - // Standard Error: 274_662 - .saturating_add(Weight::from_parts(6_858_186, 0).saturating_mul(p.into())) - // Standard Error: 274_649 - .saturating_add(Weight::from_parts(177_291_831, 0).saturating_mul(s.into())) + // Minimum execution time: 44_452_286_000 picoseconds. + Weight::from_parts(44_568_744_000, 0) + // Standard Error: 268_880 + .saturating_add(Weight::from_parts(7_444_126, 0).saturating_mul(p.into())) + // Standard Error: 268_867 + .saturating_add(Weight::from_parts(179_724_917, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_680_000 picoseconds. - Weight::from_parts(157_350_147, 0) - // Standard Error: 440_994 - .saturating_add(Weight::from_parts(402_511_567, 0).saturating_mul(r.into())) + // Minimum execution time: 96_042_000 picoseconds. + Weight::from_parts(163_443_462, 0) + // Standard Error: 381_777 + .saturating_add(Weight::from_parts(338_839_702, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2927,32 +2927,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_842_395_000 picoseconds. - Weight::from_parts(42_890_931_000, 0) - // Standard Error: 264_187 - .saturating_add(Weight::from_parts(7_896_879, 0).saturating_mul(p.into())) - // Standard Error: 264_174 - .saturating_add(Weight::from_parts(178_082_248, 0).saturating_mul(s.into())) + // Minimum execution time: 42_724_116_000 picoseconds. + Weight::from_parts(42_849_968_000, 0) + // Standard Error: 263_445 + .saturating_add(Weight::from_parts(8_197_177, 0).saturating_mul(p.into())) + // Standard Error: 263_432 + .saturating_add(Weight::from_parts(180_050_572, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_272_000 picoseconds. - Weight::from_parts(100_008_395, 0) - // Standard Error: 36_430 - .saturating_add(Weight::from_parts(2_544_223, 0).saturating_mul(r.into())) + // Minimum execution time: 86_607_000 picoseconds. + Weight::from_parts(100_957_693, 0) + // Standard Error: 29_067 + .saturating_add(Weight::from_parts(1_762_813, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_139_000 picoseconds. - Weight::from_parts(122_967_835, 1131) - // Standard Error: 6_454 - .saturating_add(Weight::from_parts(11_784_103, 0).saturating_mul(p.into())) + // Minimum execution time: 87_305_000 picoseconds. + Weight::from_parts(108_825_748, 1131) + // Standard Error: 5_956 + .saturating_add(Weight::from_parts(11_809_647, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2961,10 +2961,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_229_000 picoseconds. - Weight::from_parts(83_885_000, 1131) - // Standard Error: 37_558 - .saturating_add(Weight::from_parts(35_503_677, 0).saturating_mul(p.into())) + // Minimum execution time: 87_531_000 picoseconds. + Weight::from_parts(88_749_000, 1131) + // Standard Error: 27_438 + .saturating_add(Weight::from_parts(35_435_114, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2973,10 +2973,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_139_187_000 picoseconds. - Weight::from_parts(5_806_599_304, 5069931) - // Standard Error: 75_881 - .saturating_add(Weight::from_parts(36_513_688, 0).saturating_mul(p.into())) + // Minimum execution time: 6_087_078_000 picoseconds. + Weight::from_parts(5_882_681_000, 5069931) + // Standard Error: 87_545 + .saturating_add(Weight::from_parts(37_047_042, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -2984,10 +2984,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_177_000 picoseconds. - Weight::from_parts(83_595_000, 1939) - // Standard Error: 45_778 - .saturating_add(Weight::from_parts(47_155_630, 0).saturating_mul(p.into())) + // Minimum execution time: 85_432_000 picoseconds. + Weight::from_parts(87_001_000, 1939) + // Standard Error: 47_768 + .saturating_add(Weight::from_parts(47_598_234, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -2996,10 +2996,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 90_231_000 picoseconds. - Weight::from_parts(95_944_378, 1131) - // Standard Error: 61_821 - .saturating_add(Weight::from_parts(35_941_066, 0).saturating_mul(p.into())) + // Minimum execution time: 92_594_000 picoseconds. + Weight::from_parts(93_795_036, 1131) + // Standard Error: 53_549 + .saturating_add(Weight::from_parts(35_797_869, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3008,10 +3008,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 734_006_000 picoseconds. - Weight::from_parts(717_384_508, 1496) - // Standard Error: 375_292 - .saturating_add(Weight::from_parts(47_930_581, 0).saturating_mul(p.into())) + // Minimum execution time: 769_397_000 picoseconds. + Weight::from_parts(792_321_925, 1496) + // Standard Error: 237_986 + .saturating_add(Weight::from_parts(48_847_504, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3020,10 +3020,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_121_849_000 picoseconds. - Weight::from_parts(1_147_558_033, 317931) - // Standard Error: 373_146 - .saturating_add(Weight::from_parts(45_393_418, 0).saturating_mul(p.into())) + // Minimum execution time: 1_113_735_000 picoseconds. + Weight::from_parts(1_148_020_828, 317931) + // Standard Error: 167_371 + .saturating_add(Weight::from_parts(47_795_831, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3031,884 +3031,884 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_220_392, 0) - // Standard Error: 8_848 - .saturating_add(Weight::from_parts(24_205_605, 0).saturating_mul(r.into())) + // Minimum execution time: 4_154_000 picoseconds. + Weight::from_parts(4_280_364, 0) + // Standard Error: 8_638 + .saturating_add(Weight::from_parts(24_150_721, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_352_664_000 picoseconds. - Weight::from_parts(4_153_366_897, 0) - // Standard Error: 60_193 - .saturating_add(Weight::from_parts(4_722_164, 0).saturating_mul(r.into())) + // Minimum execution time: 4_339_689_000 picoseconds. + Weight::from_parts(4_202_598_633, 0) + // Standard Error: 74_721 + .saturating_add(Weight::from_parts(4_468_109, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_357_649_000 picoseconds. - Weight::from_parts(4_256_499_798, 0) - // Standard Error: 57_942 - .saturating_add(Weight::from_parts(4_200_870, 0).saturating_mul(r.into())) + // Minimum execution time: 4_343_068_000 picoseconds. + Weight::from_parts(4_226_706_212, 0) + // Standard Error: 60_538 + .saturating_add(Weight::from_parts(4_325_162, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_269_998_000 picoseconds. - Weight::from_parts(11_525_100_351, 0) - // Standard Error: 204_230 - .saturating_add(Weight::from_parts(8_423_588, 0).saturating_mul(r.into())) + // Minimum execution time: 11_409_473_000 picoseconds. + Weight::from_parts(11_882_222_938, 0) + // Standard Error: 194_167 + .saturating_add(Weight::from_parts(8_210_890, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_204_810_000 picoseconds. - Weight::from_parts(10_982_673_143, 0) - // Standard Error: 145_327 - .saturating_add(Weight::from_parts(9_198_033, 0).saturating_mul(r.into())) + // Minimum execution time: 10_212_512_000 picoseconds. + Weight::from_parts(10_628_957_808, 0) + // Standard Error: 170_508 + .saturating_add(Weight::from_parts(11_560_237, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_074_000 picoseconds. - Weight::from_parts(2_108_000, 0) - // Standard Error: 9_031 - .saturating_add(Weight::from_parts(3_829_182, 0).saturating_mul(r.into())) + // Minimum execution time: 2_229_000 picoseconds. + Weight::from_parts(2_319_000, 0) + // Standard Error: 9_576 + .saturating_add(Weight::from_parts(3_794_717, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_020_000 picoseconds. - Weight::from_parts(2_118_000, 0) - // Standard Error: 5_295 - .saturating_add(Weight::from_parts(2_980_329, 0).saturating_mul(r.into())) + // Minimum execution time: 2_265_000 picoseconds. + Weight::from_parts(2_353_000, 0) + // Standard Error: 5_018 + .saturating_add(Weight::from_parts(3_059_511, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_032_000 picoseconds. - Weight::from_parts(3_411_359, 0) - // Standard Error: 1_146 - .saturating_add(Weight::from_parts(1_563_906, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(3_531_925, 0) + // Standard Error: 1_167 + .saturating_add(Weight::from_parts(1_569_201, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_096_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 8_349 - .saturating_add(Weight::from_parts(2_904_673, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(2_359_000, 0) + // Standard Error: 9_672 + .saturating_add(Weight::from_parts(2_884_305, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_128_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 8_100 - .saturating_add(Weight::from_parts(5_229_400, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 8_373 + .saturating_add(Weight::from_parts(5_256_648, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_838_000 picoseconds. - Weight::from_parts(5_309_346, 0) - // Standard Error: 2_580 - .saturating_add(Weight::from_parts(129_982, 0).saturating_mul(e.into())) + // Minimum execution time: 7_012_000 picoseconds. + Weight::from_parts(4_938_253, 0) + // Standard Error: 2_214 + .saturating_add(Weight::from_parts(151_870, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(3_593_285, 0) - // Standard Error: 6_648 - .saturating_add(Weight::from_parts(2_597_926, 0).saturating_mul(r.into())) + // Minimum execution time: 2_309_000 picoseconds. + Weight::from_parts(4_232_448, 0) + // Standard Error: 6_359 + .saturating_add(Weight::from_parts(2_596_672, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_597_926 - - 2_429_048, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_596_672 - + 2_404_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_086_000 picoseconds. - Weight::from_parts(3_972_773, 0) - // Standard Error: 12_538 - .saturating_add(Weight::from_parts(2_429_048, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(4_432_470, 0) + // Standard Error: 11_941 + .saturating_add(Weight::from_parts(2_404_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_591_000 picoseconds. - Weight::from_parts(12_798_134, 0) - // Standard Error: 23_023 - .saturating_add(Weight::from_parts(9_786_464, 0).saturating_mul(r.into())) + // Minimum execution time: 2_776_000 picoseconds. + Weight::from_parts(12_954_286, 0) + // Standard Error: 30_568 + .saturating_add(Weight::from_parts(10_260_958, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_274_000 picoseconds. - Weight::from_parts(1_706_188, 0) - // Standard Error: 6_199 - .saturating_add(Weight::from_parts(1_212_443, 0).saturating_mul(p.into())) + // Minimum execution time: 11_935_000 picoseconds. + Weight::from_parts(1_635_475, 0) + // Standard Error: 7_669 + .saturating_add(Weight::from_parts(1_285_084, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_221_000 picoseconds. - Weight::from_parts(5_538_574, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(12, 0).saturating_mul(l.into())) + // Minimum execution time: 5_316_000 picoseconds. + Weight::from_parts(5_699_758, 0) + // Standard Error: 13 + .saturating_add(Weight::from_parts(34, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(1_785_103, 0) - // Standard Error: 2_948 - .saturating_add(Weight::from_parts(249_981, 0).saturating_mul(r.into())) + // Minimum execution time: 2_315_000 picoseconds. + Weight::from_parts(2_460_643, 0) + // Standard Error: 2_850 + .saturating_add(Weight::from_parts(235_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_123_000 picoseconds. - Weight::from_parts(2_187_000, 0) - // Standard Error: 5_664 - .saturating_add(Weight::from_parts(719_187, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 6_150 + .saturating_add(Weight::from_parts(730_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_214_000, 0) - // Standard Error: 5_625 - .saturating_add(Weight::from_parts(709_067, 0).saturating_mul(r.into())) + // Minimum execution time: 2_244_000 picoseconds. + Weight::from_parts(2_338_000, 0) + // Standard Error: 5_205 + .saturating_add(Weight::from_parts(679_669, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_168_000 picoseconds. - Weight::from_parts(2_290_203, 0) - // Standard Error: 8_984 - .saturating_add(Weight::from_parts(761_843, 0).saturating_mul(r.into())) + // Minimum execution time: 6_412_000 picoseconds. + Weight::from_parts(2_087_064, 0) + // Standard Error: 9_824 + .saturating_add(Weight::from_parts(743_737, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_249_000 picoseconds. - Weight::from_parts(6_302_000, 0) - // Standard Error: 8_682 - .saturating_add(Weight::from_parts(1_329_653, 0).saturating_mul(r.into())) + // Minimum execution time: 6_388_000 picoseconds. + Weight::from_parts(6_512_000, 0) + // Standard Error: 7_958 + .saturating_add(Weight::from_parts(1_283_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_791_000 picoseconds. - Weight::from_parts(3_929_000, 0) - // Standard Error: 9_270 - .saturating_add(Weight::from_parts(6_742_685, 0).saturating_mul(r.into())) + // Minimum execution time: 6_885_000 picoseconds. + Weight::from_parts(4_075_795, 0) + // Standard Error: 12_241 + .saturating_add(Weight::from_parts(6_965_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_113_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 6_734 - .saturating_add(Weight::from_parts(3_327_207, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 5_936 + .saturating_add(Weight::from_parts(3_299_707, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_141_000, 0) - // Standard Error: 6_506 - .saturating_add(Weight::from_parts(3_061_891, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 6_255 + .saturating_add(Weight::from_parts(2_999_382, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_108_000 picoseconds. - Weight::from_parts(2_141_000, 0) - // Standard Error: 6_738 - .saturating_add(Weight::from_parts(3_101_844, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_271_000, 0) + // Standard Error: 6_896 + .saturating_add(Weight::from_parts(2_967_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_138_000 picoseconds. - Weight::from_parts(2_155_000, 0) - // Standard Error: 4_379 - .saturating_add(Weight::from_parts(2_613_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_268_000, 0) + // Standard Error: 4_893 + .saturating_add(Weight::from_parts(2_579_110, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_046_000 picoseconds. - Weight::from_parts(2_127_000, 0) - // Standard Error: 3_513 - .saturating_add(Weight::from_parts(525_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_304_000, 0) + // Standard Error: 3_852 + .saturating_add(Weight::from_parts(520_005, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(1_669_179, 0) - // Standard Error: 2_817 - .saturating_add(Weight::from_parts(367_599, 0).saturating_mul(r.into())) + // Minimum execution time: 2_274_000 picoseconds. + Weight::from_parts(1_794_591, 0) + // Standard Error: 3_416 + .saturating_add(Weight::from_parts(359_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 11_816 - .saturating_add(Weight::from_parts(1_810_781, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_287_000, 0) + // Standard Error: 10_307 + .saturating_add(Weight::from_parts(1_833_775, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_087_000 picoseconds. - Weight::from_parts(2_194_000, 0) - // Standard Error: 7_361 - .saturating_add(Weight::from_parts(1_130_773, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(2_349_000, 0) + // Standard Error: 9_393 + .saturating_add(Weight::from_parts(1_178_942, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_061_000 picoseconds. - Weight::from_parts(1_850_477, 0) - // Standard Error: 2_695 - .saturating_add(Weight::from_parts(318_827, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_256_508, 0) + // Standard Error: 3_133 + .saturating_add(Weight::from_parts(326_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_115_000 picoseconds. - Weight::from_parts(1_764_589, 0) - // Standard Error: 2_923 - .saturating_add(Weight::from_parts(329_840, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(1_792_383, 0) + // Standard Error: 2_981 + .saturating_add(Weight::from_parts(325_072, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_109_000 picoseconds. - Weight::from_parts(859_995, 0) - // Standard Error: 4_546 - .saturating_add(Weight::from_parts(467_944, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(236_190, 0) + // Standard Error: 5_791 + .saturating_add(Weight::from_parts(526_784, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_010_000 picoseconds. - Weight::from_parts(2_081_000, 0) - // Standard Error: 3_959 - .saturating_add(Weight::from_parts(472_947, 0).saturating_mul(r.into())) + // Minimum execution time: 2_278_000 picoseconds. + Weight::from_parts(18_346, 0) + // Standard Error: 5_882 + .saturating_add(Weight::from_parts(538_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_105_000 picoseconds. - Weight::from_parts(1_247_124, 0) - // Standard Error: 4_390 - .saturating_add(Weight::from_parts(436_907, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 4_502 + .saturating_add(Weight::from_parts(463_034, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_140_000 picoseconds. - Weight::from_parts(2_251_532, 0) - // Standard Error: 2_995 - .saturating_add(Weight::from_parts(280_490, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(2_193_450, 0) + // Standard Error: 3_655 + .saturating_add(Weight::from_parts(304_226, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_119_000 picoseconds. - Weight::from_parts(2_808_547, 0) - // Standard Error: 1_453 - .saturating_add(Weight::from_parts(143_409, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_803_358, 0) + // Standard Error: 2_256 + .saturating_add(Weight::from_parts(163_489, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_043_000 picoseconds. - Weight::from_parts(2_639_820, 0) - // Standard Error: 1_638 - .saturating_add(Weight::from_parts(159_792, 0).saturating_mul(r.into())) + // Minimum execution time: 2_242_000 picoseconds. + Weight::from_parts(3_087_274, 0) + // Standard Error: 1_907 + .saturating_add(Weight::from_parts(146_988, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_128_000 picoseconds. - Weight::from_parts(2_166_000, 0) - // Standard Error: 11_777 - .saturating_add(Weight::from_parts(1_709_510, 0).saturating_mul(r.into())) + // Minimum execution time: 2_268_000 picoseconds. + Weight::from_parts(2_335_000, 0) + // Standard Error: 9_220 + .saturating_add(Weight::from_parts(1_682_986, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(2_136_000, 0) - // Standard Error: 7_491 - .saturating_add(Weight::from_parts(1_105_807, 0).saturating_mul(r.into())) + // Minimum execution time: 2_244_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 7_751 + .saturating_add(Weight::from_parts(1_073_438, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_088_000 picoseconds. - Weight::from_parts(2_171_000, 0) - // Standard Error: 11_841 - .saturating_add(Weight::from_parts(1_785_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_225_000 picoseconds. + Weight::from_parts(2_297_000, 0) + // Standard Error: 9_887 + .saturating_add(Weight::from_parts(1_746_888, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_042_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 7_479 - .saturating_add(Weight::from_parts(1_086_144, 0).saturating_mul(r.into())) + // Minimum execution time: 2_225_000 picoseconds. + Weight::from_parts(2_305_000, 0) + // Standard Error: 8_241 + .saturating_add(Weight::from_parts(1_123_968, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_109_000 picoseconds. - Weight::from_parts(2_151_000, 0) - // Standard Error: 13_111 - .saturating_add(Weight::from_parts(1_829_000, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(2_368_000, 0) + // Standard Error: 10_199 + .saturating_add(Weight::from_parts(1_754_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_153_000, 0) - // Standard Error: 7_632 - .saturating_add(Weight::from_parts(1_102_522, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 7_885 + .saturating_add(Weight::from_parts(1_054_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_155_000 picoseconds. - Weight::from_parts(2_231_000, 0) - // Standard Error: 11_689 - .saturating_add(Weight::from_parts(1_768_866, 0).saturating_mul(r.into())) + // Minimum execution time: 2_212_000 picoseconds. + Weight::from_parts(2_244_000, 0) + // Standard Error: 11_272 + .saturating_add(Weight::from_parts(1_769_874, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_163_000, 0) - // Standard Error: 7_348 - .saturating_add(Weight::from_parts(1_057_058, 0).saturating_mul(r.into())) + // Minimum execution time: 2_248_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 8_360 + .saturating_add(Weight::from_parts(1_115_362, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_142_000, 0) - // Standard Error: 12_173 - .saturating_add(Weight::from_parts(1_786_184, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 9_424 + .saturating_add(Weight::from_parts(1_807_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 7_244 - .saturating_add(Weight::from_parts(1_066_057, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 7_499 + .saturating_add(Weight::from_parts(1_087_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_090_000 picoseconds. - Weight::from_parts(2_175_000, 0) - // Standard Error: 11_967 - .saturating_add(Weight::from_parts(1_782_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 11_743 + .saturating_add(Weight::from_parts(1_703_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_091_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 7_205 - .saturating_add(Weight::from_parts(1_048_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_254_000, 0) + // Standard Error: 8_099 + .saturating_add(Weight::from_parts(1_080_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_164_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 12_228 - .saturating_add(Weight::from_parts(1_792_751, 0).saturating_mul(r.into())) + // Minimum execution time: 2_183_000 picoseconds. + Weight::from_parts(2_301_000, 0) + // Standard Error: 10_230 + .saturating_add(Weight::from_parts(1_738_567, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_186_000, 0) - // Standard Error: 7_822 - .saturating_add(Weight::from_parts(1_052_385, 0).saturating_mul(r.into())) + // Minimum execution time: 2_209_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 8_536 + .saturating_add(Weight::from_parts(1_161_928, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_055_000 picoseconds. - Weight::from_parts(2_135_000, 0) - // Standard Error: 12_011 - .saturating_add(Weight::from_parts(1_789_504, 0).saturating_mul(r.into())) + // Minimum execution time: 2_208_000 picoseconds. + Weight::from_parts(2_255_000, 0) + // Standard Error: 10_368 + .saturating_add(Weight::from_parts(1_847_441, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_447_000 picoseconds. - Weight::from_parts(2_540_000, 0) - // Standard Error: 7_696 - .saturating_add(Weight::from_parts(1_062_612, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(2_299_000, 0) + // Standard Error: 8_213 + .saturating_add(Weight::from_parts(1_112_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_107_000, 0) - // Standard Error: 12_070 - .saturating_add(Weight::from_parts(1_771_498, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 12_684 + .saturating_add(Weight::from_parts(1_728_765, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_123_000 picoseconds. - Weight::from_parts(2_156_000, 0) - // Standard Error: 7_108 - .saturating_add(Weight::from_parts(1_072_471, 0).saturating_mul(r.into())) + // Minimum execution time: 2_573_000 picoseconds. + Weight::from_parts(2_655_000, 0) + // Standard Error: 7_404 + .saturating_add(Weight::from_parts(1_080_080, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_145_000, 0) - // Standard Error: 11_990 - .saturating_add(Weight::from_parts(1_786_273, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_316_000, 0) + // Standard Error: 9_739 + .saturating_add(Weight::from_parts(1_807_913, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_059_000 picoseconds. - Weight::from_parts(2_122_000, 0) - // Standard Error: 7_164 - .saturating_add(Weight::from_parts(1_070_909, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 7_265 + .saturating_add(Weight::from_parts(1_087_210, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_065_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 7_265 - .saturating_add(Weight::from_parts(1_152_228, 0).saturating_mul(r.into())) + // Minimum execution time: 2_252_000 picoseconds. + Weight::from_parts(2_311_000, 0) + // Standard Error: 7_444 + .saturating_add(Weight::from_parts(1_191_685, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_160_000, 0) - // Standard Error: 5_101 - .saturating_add(Weight::from_parts(578_660, 0).saturating_mul(r.into())) + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(2_320_000, 0) + // Standard Error: 5_023 + .saturating_add(Weight::from_parts(585_667, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_184_000, 0) - // Standard Error: 9_299 - .saturating_add(Weight::from_parts(1_257_633, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_320_000, 0) + // Standard Error: 10_018 + .saturating_add(Weight::from_parts(1_297_791, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_119_000 picoseconds. - Weight::from_parts(2_262_000, 0) - // Standard Error: 3_957 - .saturating_add(Weight::from_parts(557_957, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 4_776 + .saturating_add(Weight::from_parts(612_864, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_045_000 picoseconds. - Weight::from_parts(2_157_000, 0) - // Standard Error: 10_839 - .saturating_add(Weight::from_parts(1_686_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_286_000 picoseconds. + Weight::from_parts(2_356_000, 0) + // Standard Error: 11_619 + .saturating_add(Weight::from_parts(1_743_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 7_276 - .saturating_add(Weight::from_parts(1_096_252, 0).saturating_mul(r.into())) + // Minimum execution time: 2_302_000 picoseconds. + Weight::from_parts(2_343_000, 0) + // Standard Error: 8_638 + .saturating_add(Weight::from_parts(1_136_060, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(1_434_170, 0) - // Standard Error: 21_965 - .saturating_add(Weight::from_parts(2_633_663, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 7_114 + .saturating_add(Weight::from_parts(2_599_346, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_098_000 picoseconds. - Weight::from_parts(2_122_681, 0) - // Standard Error: 10_815 - .saturating_add(Weight::from_parts(2_335_842, 0).saturating_mul(r.into())) + // Minimum execution time: 2_200_000 picoseconds. + Weight::from_parts(3_823_403, 0) + // Standard Error: 18_912 + .saturating_add(Weight::from_parts(2_161_963, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(145_632, 0) - // Standard Error: 12_320 - .saturating_add(Weight::from_parts(2_992_427, 0).saturating_mul(r.into())) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_817_173, 0) + // Standard Error: 17_341 + .saturating_add(Weight::from_parts(2_740_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_142_000 picoseconds. - Weight::from_parts(2_180_000, 0) - // Standard Error: 4_944 - .saturating_add(Weight::from_parts(2_466_854, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(88_235, 0) + // Standard Error: 10_326 + .saturating_add(Weight::from_parts(2_481_087, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_143_000 picoseconds. - Weight::from_parts(2_204_000, 0) - // Standard Error: 14_500 - .saturating_add(Weight::from_parts(9_530_241, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 14_480 + .saturating_add(Weight::from_parts(9_604_981, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_132_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 22_303 - .saturating_add(Weight::from_parts(7_508_848, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 21_926 + .saturating_add(Weight::from_parts(7_501_289, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_133_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 5_407 - .saturating_add(Weight::from_parts(2_948_013, 0).saturating_mul(r.into())) + // Minimum execution time: 2_309_000 picoseconds. + Weight::from_parts(10_308_173, 0) + // Standard Error: 30_680 + .saturating_add(Weight::from_parts(2_288_505, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_124_000 picoseconds. - Weight::from_parts(2_150_000, 0) - // Standard Error: 6_372 - .saturating_add(Weight::from_parts(2_362_416, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 5_007 + .saturating_add(Weight::from_parts(2_516_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 7_670 - .saturating_add(Weight::from_parts(1_174_342, 0).saturating_mul(r.into())) + // Minimum execution time: 2_228_000 picoseconds. + Weight::from_parts(2_300_000, 0) + // Standard Error: 8_948 + .saturating_add(Weight::from_parts(1_264_596, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_109_000, 0) - // Standard Error: 3_988 - .saturating_add(Weight::from_parts(566_949, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_323_000, 0) + // Standard Error: 5_099 + .saturating_add(Weight::from_parts(612_107, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_049_000 picoseconds. - Weight::from_parts(2_117_000, 0) - // Standard Error: 8_393 - .saturating_add(Weight::from_parts(1_160_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(2_326_000, 0) + // Standard Error: 10_004 + .saturating_add(Weight::from_parts(1_278_365, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_152_000, 0) - // Standard Error: 4_769 - .saturating_add(Weight::from_parts(585_265, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 5_578 + .saturating_add(Weight::from_parts(645_196, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_115_000 picoseconds. - Weight::from_parts(2_170_000, 0) - // Standard Error: 7_943 - .saturating_add(Weight::from_parts(1_185_174, 0).saturating_mul(r.into())) + // Minimum execution time: 2_338_000 picoseconds. + Weight::from_parts(2_363_000, 0) + // Standard Error: 8_554 + .saturating_add(Weight::from_parts(1_288_676, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_139_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 4_608 - .saturating_add(Weight::from_parts(563_329, 0).saturating_mul(r.into())) + // Minimum execution time: 2_214_000 picoseconds. + Weight::from_parts(2_332_000, 0) + // Standard Error: 3_999 + .saturating_add(Weight::from_parts(594_484, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_144_000 picoseconds. - Weight::from_parts(2_178_000, 0) - // Standard Error: 6_727 - .saturating_add(Weight::from_parts(1_000_757, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 7_437 + .saturating_add(Weight::from_parts(1_044_306, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_212_000, 0) - // Standard Error: 3_536 - .saturating_add(Weight::from_parts(504_096, 0).saturating_mul(r.into())) + // Minimum execution time: 2_226_000 picoseconds. + Weight::from_parts(2_308_000, 0) + // Standard Error: 4_658 + .saturating_add(Weight::from_parts(537_262, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_218_000, 0) - // Standard Error: 7_170 - .saturating_add(Weight::from_parts(966_365, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 10_254 + .saturating_add(Weight::from_parts(1_154_138, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_149_000 picoseconds. - Weight::from_parts(140_768, 0) - // Standard Error: 5_221 - .saturating_add(Weight::from_parts(551_550, 0).saturating_mul(r.into())) + // Minimum execution time: 2_234_000 picoseconds. + Weight::from_parts(2_313_000, 0) + // Standard Error: 4_960 + .saturating_add(Weight::from_parts(607_930, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 7_621 - .saturating_add(Weight::from_parts(997_420, 0).saturating_mul(r.into())) + // Minimum execution time: 2_279_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 7_909 + .saturating_add(Weight::from_parts(1_094_660, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_069_000 picoseconds. - Weight::from_parts(2_106_000, 0) - // Standard Error: 3_980 - .saturating_add(Weight::from_parts(537_014, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(39_069, 0) + // Standard Error: 6_710 + .saturating_add(Weight::from_parts(599_572, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_097_000 picoseconds. - Weight::from_parts(2_191_000, 0) - // Standard Error: 9_419 - .saturating_add(Weight::from_parts(1_050_292, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 8_785 + .saturating_add(Weight::from_parts(1_060_321, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_051_000 picoseconds. - Weight::from_parts(2_118_000, 0) - // Standard Error: 4_228 - .saturating_add(Weight::from_parts(529_158, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 4_191 + .saturating_add(Weight::from_parts(528_319, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_116_000, 0) - // Standard Error: 7_792 - .saturating_add(Weight::from_parts(1_027_370, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 9_328 + .saturating_add(Weight::from_parts(1_114_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 4_450 - .saturating_add(Weight::from_parts(534_724, 0).saturating_mul(r.into())) + // Minimum execution time: 2_210_000 picoseconds. + Weight::from_parts(390_951, 0) + // Standard Error: 5_316 + .saturating_add(Weight::from_parts(609_568, 0).saturating_mul(r.into())) } } diff --git a/runtime-interface/Cargo.toml b/runtime-interface/Cargo.toml index 5bdad24e5a5..15b023165b2 100644 --- a/runtime-interface/Cargo.toml +++ b/runtime-interface/Cargo.toml @@ -23,6 +23,7 @@ derive_more.workspace = true static_assertions.workspace = true region = { workspace = true, optional = true } gear-sandbox-host = { workspace = true, optional = true } +byteorder.workspace = true [target.'cfg(windows)'.dependencies] winapi = { workspace = true, features = ["memoryapi"] } @@ -34,6 +35,7 @@ std = [ "sp-runtime-interface/std", "sp-std/std", "sp-wasm-interface/std", + "byteorder/std", "codec/std", "log", "gear-lazy-pages", diff --git a/runtime-interface/src/lib.rs b/runtime-interface/src/lib.rs index 2608fdcaff4..8c4d41530ac 100644 --- a/runtime-interface/src/lib.rs +++ b/runtime-interface/src/lib.rs @@ -21,6 +21,7 @@ #![allow(useless_deprecated, deprecated)] #![cfg_attr(not(feature = "std"), no_std)] +use byteorder::{ByteOrder, LittleEndian}; use codec::{Decode, Encode}; use gear_backend_common::{ lazy_pages::{GlobalsAccessConfig, Status}, @@ -35,6 +36,7 @@ use sp_runtime_interface::{ pass_by::{Codec, PassBy}, runtime_interface, }; +use sp_std::mem; extern crate alloc; @@ -85,6 +87,22 @@ impl PassBy for LazyPagesRuntimeContext { type PassBy = Codec; } +fn deserialize_mem_intervals(bytes: &[u8], intervals: &mut Vec) { + let mem_interval_size = mem::size_of::(); + for chunk in bytes.chunks_exact(mem_interval_size) { + // can't panic because of chunks_exact + intervals.push(MemoryInterval::try_from_bytes(chunk).unwrap()); + } +} + +#[derive(Debug, Clone, Encode, Decode)] +#[codec(crate = codec)] +pub enum ProcessAccessErrorVer1 { + OutOfBounds, + GasLimitExceeded, + GasAllowanceExceeded, +} + /// Runtime interface for gear node and runtime. /// Note: name is expanded as gear_ri #[runtime_interface] @@ -93,10 +111,58 @@ pub trait GearRI { reads: &[MemoryInterval], writes: &[MemoryInterval], gas_left: (GasLeft,), - ) -> (GasLeft, Result<(), ProcessAccessError>) { + ) -> (GasLeft, Result<(), ProcessAccessErrorVer1>) { let mut gas_left = gas_left.0; - let res = lazy_pages::pre_process_memory_accesses(reads, writes, &mut gas_left); - (gas_left, res) + let gas_before = gas_left.gas; + let res = lazy_pages::pre_process_memory_accesses(reads, writes, &mut gas_left.gas); + + // Support charge for allowance otherwise DB will be corrupted. + gas_left.allowance = gas_left + .allowance + .saturating_sub(gas_before.saturating_sub(gas_left.gas)); + + match res { + Ok(_) => { + if gas_left.allowance > 0 { + (gas_left, Ok(())) + } else { + (gas_left, Err(ProcessAccessErrorVer1::GasAllowanceExceeded)) + } + } + Err(ProcessAccessError::OutOfBounds) => { + (gas_left, Err(ProcessAccessErrorVer1::OutOfBounds)) + } + Err(ProcessAccessError::GasLimitExceeded) => { + (gas_left, Err(ProcessAccessErrorVer1::GasLimitExceeded)) + } + } + } + + #[version(2)] + fn pre_process_memory_accesses(reads: &[u8], writes: &[u8], gas_bytes: &mut [u8; 8]) -> u8 { + let mem_interval_size = mem::size_of::(); + let reads_len = reads.len(); + let writes_len = writes.len(); + + let mut reads_intervals = Vec::with_capacity(reads_len / mem_interval_size); + deserialize_mem_intervals(reads, &mut reads_intervals); + let mut writes_intervals = Vec::with_capacity(writes_len / mem_interval_size); + deserialize_mem_intervals(writes, &mut writes_intervals); + + let mut gas_counter = LittleEndian::read_u64(gas_bytes); + + let res = match lazy_pages::pre_process_memory_accesses( + &reads_intervals, + &writes_intervals, + &mut gas_counter, + ) { + Ok(_) => 0, + Err(err) => err.into(), + }; + + LittleEndian::write_u64(gas_bytes, gas_counter); + + res } fn lazy_pages_status() -> (Status,) { @@ -104,27 +170,13 @@ pub trait GearRI { .unwrap_or_else(|err| unreachable!("Cannot get lazy-pages status: {err}")),) } - fn init_lazy_pages(ctx: LazyPagesRuntimeContext) -> bool { - use lazy_pages::LazyPagesVersion; - - lazy_pages::init( - LazyPagesVersion::Version1, - ctx.page_sizes, - ctx.global_names, - ctx.pages_storage_prefix, - ) - .map_err(|err| log::error!("Cannot initialize lazy-pages: {}", err)) - .is_ok() - } - /// Init lazy-pages. /// Returns whether initialization was successful. - #[version(2)] fn init_lazy_pages(ctx: LazyPagesRuntimeContext) -> bool { use lazy_pages::LazyPagesVersion; lazy_pages::init( - LazyPagesVersion::Version2, + LazyPagesVersion::Version1, ctx.page_sizes, ctx.global_names, ctx.pages_storage_prefix, diff --git a/runtime/gear/src/tests.rs b/runtime/gear/src/tests.rs index 1c3696b1964..bf85a733ec9 100644 --- a/runtime/gear/src/tests.rs +++ b/runtime/gear/src/tests.rs @@ -141,7 +141,7 @@ fn page_costs_heuristic_test() { lazy_pages_signal_write_after_read: 8_624_904.into(), lazy_pages_host_func_read: 29_000_000.into(), lazy_pages_host_func_write: 33_000_000.into(), - lazy_pages_host_func_write_after_read: 8_294_669.into(), + lazy_pages_host_func_write_after_read: 9_245_597.into(), load_page_data: 8_700_000.into(), upload_page_data: 104_000_000.into(), static_page: 100.into(), diff --git a/runtime/gear/src/weights/frame_system.rs b/runtime/gear/src/weights/frame_system.rs index 7c2e30e83c0..37c8734e2c3 100644 --- a/runtime/gear/src/weights/frame_system.rs +++ b/runtime/gear/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_580_000 picoseconds. - Weight::from_parts(959_849, 0) + // Minimum execution time: 1_547_000 picoseconds. + Weight::from_parts(1_156_168, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) } @@ -63,17 +63,17 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_178_000 picoseconds. - Weight::from_parts(6_296_000, 0) + // Minimum execution time: 5_872_000 picoseconds. + Weight::from_parts(6_100_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_429, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_441, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_133_000 picoseconds. - Weight::from_parts(3_263_000, 1485) + // Minimum execution time: 3_110_000 picoseconds. + Weight::from_parts(3_331_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -82,10 +82,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_505_000 picoseconds. - Weight::from_parts(1_600_000, 0) - // Standard Error: 1_014 - .saturating_add(Weight::from_parts(700_338, 0).saturating_mul(i.into())) + // Minimum execution time: 1_474_000 picoseconds. + Weight::from_parts(1_571_000, 0) + // Standard Error: 974 + .saturating_add(Weight::from_parts(687_544, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -93,10 +93,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_547_000 picoseconds. - Weight::from_parts(1_605_000, 0) - // Standard Error: 807 - .saturating_add(Weight::from_parts(534_871, 0).saturating_mul(i.into())) + // Minimum execution time: 1_521_000 picoseconds. + Weight::from_parts(1_570_000, 0) + // Standard Error: 706 + .saturating_add(Weight::from_parts(527_682, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -104,10 +104,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `64 + p * (69 ±0)` // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 3_117_000 picoseconds. - Weight::from_parts(3_239_000, 66) - // Standard Error: 1_390 - .saturating_add(Weight::from_parts(1_127_503, 0).saturating_mul(p.into())) + // Minimum execution time: 3_122_000 picoseconds. + Weight::from_parts(3_256_000, 66) + // Standard Error: 1_528 + .saturating_add(Weight::from_parts(1_112_001, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -121,8 +121,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_580_000 picoseconds. - Weight::from_parts(959_849, 0) + // Minimum execution time: 1_547_000 picoseconds. + Weight::from_parts(1_156_168, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) } @@ -131,17 +131,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_178_000 picoseconds. - Weight::from_parts(6_296_000, 0) + // Minimum execution time: 5_872_000 picoseconds. + Weight::from_parts(6_100_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_429, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_441, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_133_000 picoseconds. - Weight::from_parts(3_263_000, 1485) + // Minimum execution time: 3_110_000 picoseconds. + Weight::from_parts(3_331_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -150,10 +150,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_505_000 picoseconds. - Weight::from_parts(1_600_000, 0) - // Standard Error: 1_014 - .saturating_add(Weight::from_parts(700_338, 0).saturating_mul(i.into())) + // Minimum execution time: 1_474_000 picoseconds. + Weight::from_parts(1_571_000, 0) + // Standard Error: 974 + .saturating_add(Weight::from_parts(687_544, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -161,10 +161,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_547_000 picoseconds. - Weight::from_parts(1_605_000, 0) - // Standard Error: 807 - .saturating_add(Weight::from_parts(534_871, 0).saturating_mul(i.into())) + // Minimum execution time: 1_521_000 picoseconds. + Weight::from_parts(1_570_000, 0) + // Standard Error: 706 + .saturating_add(Weight::from_parts(527_682, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -172,10 +172,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `64 + p * (69 ±0)` // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 3_117_000 picoseconds. - Weight::from_parts(3_239_000, 66) - // Standard Error: 1_390 - .saturating_add(Weight::from_parts(1_127_503, 0).saturating_mul(p.into())) + // Minimum execution time: 3_122_000 picoseconds. + Weight::from_parts(3_256_000, 66) + // Standard Error: 1_528 + .saturating_add(Weight::from_parts(1_112_001, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/runtime/gear/src/weights/pallet_balances.rs b/runtime/gear/src/weights/pallet_balances.rs index 7ac58bc3721..b1991b28d8a 100644 --- a/runtime/gear/src/weights/pallet_balances.rs +++ b/runtime/gear/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_782_000 picoseconds. - Weight::from_parts(30_295_000, 3593) + // Minimum execution time: 29_830_000 picoseconds. + Weight::from_parts(30_268_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -62,8 +62,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 21_396_000 picoseconds. - Weight::from_parts(21_806_000, 3593) + // Minimum execution time: 21_306_000 picoseconds. + Weight::from_parts(21_569_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -71,8 +71,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_457_000 picoseconds. - Weight::from_parts(12_779_000, 3593) + // Minimum execution time: 12_033_000 picoseconds. + Weight::from_parts(12_390_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +80,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_473_000 picoseconds. - Weight::from_parts(15_990_000, 3593) + // Minimum execution time: 14_966_000 picoseconds. + Weight::from_parts(15_395_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -89,8 +89,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 31_071_000 picoseconds. - Weight::from_parts(31_836_000, 6196) + // Minimum execution time: 31_303_000 picoseconds. + Weight::from_parts(31_887_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -98,8 +98,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 27_464_000 picoseconds. - Weight::from_parts(28_112_000, 3593) + // Minimum execution time: 28_222_000 picoseconds. + Weight::from_parts(28_785_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,8 +107,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 11_587_000 picoseconds. - Weight::from_parts(12_013_000, 3593) + // Minimum execution time: 11_871_000 picoseconds. + Weight::from_parts(12_362_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +120,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_782_000 picoseconds. - Weight::from_parts(30_295_000, 3593) + // Minimum execution time: 29_830_000 picoseconds. + Weight::from_parts(30_268_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -129,8 +129,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 21_396_000 picoseconds. - Weight::from_parts(21_806_000, 3593) + // Minimum execution time: 21_306_000 picoseconds. + Weight::from_parts(21_569_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_457_000 picoseconds. - Weight::from_parts(12_779_000, 3593) + // Minimum execution time: 12_033_000 picoseconds. + Weight::from_parts(12_390_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -147,8 +147,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_473_000 picoseconds. - Weight::from_parts(15_990_000, 3593) + // Minimum execution time: 14_966_000 picoseconds. + Weight::from_parts(15_395_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -156,8 +156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 31_071_000 picoseconds. - Weight::from_parts(31_836_000, 6196) + // Minimum execution time: 31_303_000 picoseconds. + Weight::from_parts(31_887_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -165,8 +165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 27_464_000 picoseconds. - Weight::from_parts(28_112_000, 3593) + // Minimum execution time: 28_222_000 picoseconds. + Weight::from_parts(28_785_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -174,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 11_587_000 picoseconds. - Weight::from_parts(12_013_000, 3593) + // Minimum execution time: 11_871_000 picoseconds. + Weight::from_parts(12_362_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/runtime/gear/src/weights/pallet_gear.rs b/runtime/gear/src/weights/pallet_gear.rs index 96cf975fa48..57f8c62db66 100644 --- a/runtime/gear/src/weights/pallet_gear.rs +++ b/runtime/gear/src/weights/pallet_gear.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -244,10 +244,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 954_000 picoseconds. - Weight::from_parts(1_004_000, 0) - // Standard Error: 802 - .saturating_add(Weight::from_parts(249_956, 0).saturating_mul(c.into())) + // Minimum execution time: 951_000 picoseconds. + Weight::from_parts(1_020_000, 0) + // Standard Error: 722 + .saturating_add(Weight::from_parts(240_031, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -255,10 +255,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_808_000 picoseconds. - Weight::from_parts(2_895_000, 3506) - // Standard Error: 1_086 - .saturating_add(Weight::from_parts(680_150, 0).saturating_mul(c.into())) + // Minimum execution time: 2_762_000 picoseconds. + Weight::from_parts(2_859_000, 3506) + // Standard Error: 813 + .saturating_add(Weight::from_parts(665_139, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -267,17 +267,17 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_458_000 picoseconds. - Weight::from_parts(84_558_500, 0) - // Standard Error: 7_412 - .saturating_add(Weight::from_parts(2_377_997, 0).saturating_mul(c.into())) + // Minimum execution time: 50_591_000 picoseconds. + Weight::from_parts(61_353_023, 0) + // Standard Error: 9_186 + .saturating_add(Weight::from_parts(2_404_810, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 81_302_000 picoseconds. - Weight::from_parts(83_307_000, 42236) + // Minimum execution time: 81_660_000 picoseconds. + Weight::from_parts(83_840_000, 42236) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -285,8 +285,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 52_219_000 picoseconds. - Weight::from_parts(53_704_000, 21261) + // Minimum execution time: 54_005_000 picoseconds. + Weight::from_parts(55_095_000, 21261) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -294,8 +294,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 28_408_000 picoseconds. - Weight::from_parts(29_714_000, 17070) + // Minimum execution time: 28_880_000 picoseconds. + Weight::from_parts(29_583_000, 17070) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -304,10 +304,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_918_000 picoseconds. - Weight::from_parts(6_745_647, 7640) - // Standard Error: 37_300 - .saturating_add(Weight::from_parts(13_885_473, 0).saturating_mul(c.into())) + // Minimum execution time: 7_744_000 picoseconds. + Weight::from_parts(4_233_092, 7640) + // Standard Error: 39_690 + .saturating_add(Weight::from_parts(14_033_179, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -316,10 +316,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1297 + c * (16389 ±0)` // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 68_486_000 picoseconds. - Weight::from_parts(69_079_000, 40898) - // Standard Error: 164_982 - .saturating_add(Weight::from_parts(55_774_264, 0).saturating_mul(c.into())) + // Minimum execution time: 70_301_000 picoseconds. + Weight::from_parts(70_991_000, 40898) + // Standard Error: 177_223 + .saturating_add(Weight::from_parts(54_687_249, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -330,10 +330,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 61_635_000 picoseconds. - Weight::from_parts(64_537_590, 4990) - // Standard Error: 40_298 - .saturating_add(Weight::from_parts(52_820_238, 0).saturating_mul(c.into())) + // Minimum execution time: 61_715_000 picoseconds. + Weight::from_parts(40_384_385, 4990) + // Standard Error: 57_496 + .saturating_add(Weight::from_parts(53_210_788, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -342,10 +342,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `671` // Estimated: `38638` - // Minimum execution time: 63_344_000 picoseconds. - Weight::from_parts(76_968_021, 38638) + // Minimum execution time: 63_077_000 picoseconds. + Weight::from_parts(96_840_506, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_598, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_609, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -355,12 +355,12 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 10_980_969_000 picoseconds. - Weight::from_parts(301_891_685, 34312) - // Standard Error: 164_203 - .saturating_add(Weight::from_parts(54_383_779, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_548, 0).saturating_mul(s.into())) + // Minimum execution time: 11_049_858_000 picoseconds. + Weight::from_parts(11_090_406_000, 34312) + // Standard Error: 517_330 + .saturating_add(Weight::from_parts(25_497_137, 0).saturating_mul(c.into())) + // Standard Error: 30 + .saturating_add(Weight::from_parts(910, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)) } @@ -369,10 +369,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 53_732_000 picoseconds. - Weight::from_parts(35_204_611, 23853) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_021, 0).saturating_mul(p.into())) + // Minimum execution time: 56_305_000 picoseconds. + Weight::from_parts(38_705_997, 23853) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_034, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -381,32 +381,32 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 82_297_000 picoseconds. - Weight::from_parts(62_302_593, 42227) + // Minimum execution time: 83_033_000 picoseconds. + Weight::from_parts(69_135_468, 42227) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_042, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(_q: u32, ) -> Weight { + fn initial_allocation(q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 298_083_000 picoseconds. - Weight::from_parts(314_192_353, 74319) + // Minimum execution time: 295_535_000 picoseconds. + Weight::from_parts(306_791_413, 74319) + // Standard Error: 1_111 + .saturating_add(Weight::from_parts(1_568, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(q: u32, ) -> Weight { + fn alloc_in_handle(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 312_856_000 picoseconds. - Weight::from_parts(326_607_586, 74319) - // Standard Error: 1_507 - .saturating_add(Weight::from_parts(723, 0).saturating_mul(q.into())) + // Minimum execution time: 309_253_000 picoseconds. + Weight::from_parts(323_694_389, 74319) .saturating_add(T::DbWeight::get().reads(27_u64)) .saturating_add(T::DbWeight::get().writes(22_u64)) } @@ -415,10 +415,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_478_000 picoseconds. - Weight::from_parts(45_769_000, 3899) - // Standard Error: 42_221 - .saturating_add(Weight::from_parts(51_492_007, 0).saturating_mul(c.into())) + // Minimum execution time: 44_806_000 picoseconds. + Weight::from_parts(45_498_000, 3899) + // Standard Error: 44_467 + .saturating_add(Weight::from_parts(54_603_581, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -428,630 +428,630 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_248_000 picoseconds. - Weight::from_parts(87_224_000, 0) - // Standard Error: 4_031_043 - .saturating_add(Weight::from_parts(559_145_890, 0).saturating_mul(r.into())) + // Minimum execution time: 82_307_000 picoseconds. + Weight::from_parts(84_226_000, 0) + // Standard Error: 4_203_577 + .saturating_add(Weight::from_parts(574_493_471, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 304_310_000 picoseconds. - Weight::from_parts(240_640_662, 0) - // Standard Error: 7_875 - .saturating_add(Weight::from_parts(30_931_778, 0).saturating_mul(p.into())) + // Minimum execution time: 309_893_000 picoseconds. + Weight::from_parts(234_558_588, 0) + // Standard Error: 7_966 + .saturating_add(Weight::from_parts(32_022_587, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 144_728_000 picoseconds. - Weight::from_parts(127_694_995, 0) - // Standard Error: 344_021 - .saturating_add(Weight::from_parts(63_008_235, 0).saturating_mul(r.into())) + // Minimum execution time: 142_319_000 picoseconds. + Weight::from_parts(121_865_521, 0) + // Standard Error: 314_080 + .saturating_add(Weight::from_parts(64_422_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_763_000 picoseconds. - Weight::from_parts(93_302_515, 0) - // Standard Error: 3_873 - .saturating_add(Weight::from_parts(2_723_217, 0).saturating_mul(r.into())) + // Minimum execution time: 85_527_000 picoseconds. + Weight::from_parts(91_967_528, 0) + // Standard Error: 3_856 + .saturating_add(Weight::from_parts(2_363_669, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 134_987_000 picoseconds. - Weight::from_parts(141_052_149, 0) - // Standard Error: 29_498 - .saturating_add(Weight::from_parts(3_252_053, 0).saturating_mul(r.into())) + // Minimum execution time: 144_133_000 picoseconds. + Weight::from_parts(156_991_945, 0) + // Standard Error: 24_223 + .saturating_add(Weight::from_parts(2_431_525, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_532_000 picoseconds. - Weight::from_parts(111_956_884, 0) - // Standard Error: 420_651 - .saturating_add(Weight::from_parts(124_761_103, 0).saturating_mul(r.into())) + // Minimum execution time: 86_811_000 picoseconds. + Weight::from_parts(101_122_470, 0) + // Standard Error: 303_533 + .saturating_add(Weight::from_parts(92_415_204, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_442_000 picoseconds. - Weight::from_parts(76_262_730, 0) - // Standard Error: 310_067 - .saturating_add(Weight::from_parts(115_334_131, 0).saturating_mul(r.into())) + // Minimum execution time: 84_453_000 picoseconds. + Weight::from_parts(79_049_804, 0) + // Standard Error: 305_992 + .saturating_add(Weight::from_parts(79_382_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_322_000 picoseconds. - Weight::from_parts(71_153_919, 0) - // Standard Error: 293_317 - .saturating_add(Weight::from_parts(115_508_333, 0).saturating_mul(r.into())) + // Minimum execution time: 82_650_000 picoseconds. + Weight::from_parts(79_085_060, 0) + // Standard Error: 293_080 + .saturating_add(Weight::from_parts(77_346_019, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_586_000 picoseconds. - Weight::from_parts(73_401_225, 0) - // Standard Error: 306_089 - .saturating_add(Weight::from_parts(115_530_298, 0).saturating_mul(r.into())) + // Minimum execution time: 83_545_000 picoseconds. + Weight::from_parts(72_777_984, 0) + // Standard Error: 351_302 + .saturating_add(Weight::from_parts(80_634_984, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_537_000 picoseconds. - Weight::from_parts(80_327_682, 0) - // Standard Error: 275_679 - .saturating_add(Weight::from_parts(114_024_859, 0).saturating_mul(r.into())) + // Minimum execution time: 83_245_000 picoseconds. + Weight::from_parts(76_181_868, 0) + // Standard Error: 354_266 + .saturating_add(Weight::from_parts(79_459_120, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_226_000 picoseconds. - Weight::from_parts(74_308_323, 0) - // Standard Error: 291_460 - .saturating_add(Weight::from_parts(115_396_428, 0).saturating_mul(r.into())) + // Minimum execution time: 85_064_000 picoseconds. + Weight::from_parts(77_882_516, 0) + // Standard Error: 377_997 + .saturating_add(Weight::from_parts(78_533_852, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_250_000 picoseconds. - Weight::from_parts(74_761_588, 0) - // Standard Error: 317_797 - .saturating_add(Weight::from_parts(115_173_001, 0).saturating_mul(r.into())) + // Minimum execution time: 83_522_000 picoseconds. + Weight::from_parts(66_328_137, 0) + // Standard Error: 360_143 + .saturating_add(Weight::from_parts(79_838_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_673_000 picoseconds. - Weight::from_parts(70_907_772, 0) - // Standard Error: 347_682 - .saturating_add(Weight::from_parts(118_189_625, 0).saturating_mul(r.into())) + // Minimum execution time: 83_961_000 picoseconds. + Weight::from_parts(72_789_065, 0) + // Standard Error: 366_577 + .saturating_add(Weight::from_parts(79_031_060, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_530_000 picoseconds. - Weight::from_parts(774_384_678, 0) - // Standard Error: 512_748 - .saturating_add(Weight::from_parts(194_331_468, 0).saturating_mul(r.into())) + // Minimum execution time: 700_686_000 picoseconds. + Weight::from_parts(749_297_529, 0) + // Standard Error: 383_897 + .saturating_add(Weight::from_parts(132_242_102, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 866_889_000 picoseconds. - Weight::from_parts(872_993_000, 0) - // Standard Error: 59_048 - .saturating_add(Weight::from_parts(13_399_620, 0).saturating_mul(n.into())) + // Minimum execution time: 830_957_000 picoseconds. + Weight::from_parts(850_017_000, 0) + // Standard Error: 67_693 + .saturating_add(Weight::from_parts(13_570_326, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_291_000 picoseconds. - Weight::from_parts(75_543_485, 0) - // Standard Error: 320_701 - .saturating_add(Weight::from_parts(115_757_456, 0).saturating_mul(r.into())) + // Minimum execution time: 84_261_000 picoseconds. + Weight::from_parts(70_573_139, 0) + // Standard Error: 351_239 + .saturating_add(Weight::from_parts(80_441_776, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_780_000 picoseconds. - Weight::from_parts(68_090_338, 0) - // Standard Error: 330_050 - .saturating_add(Weight::from_parts(117_803_137, 0).saturating_mul(r.into())) + // Minimum execution time: 84_164_000 picoseconds. + Weight::from_parts(70_866_987, 0) + // Standard Error: 346_107 + .saturating_add(Weight::from_parts(82_471_591, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_394_000 picoseconds. - Weight::from_parts(88_472_912, 0) - // Standard Error: 340_524 - .saturating_add(Weight::from_parts(190_044_477, 0).saturating_mul(n.into())) + // Minimum execution time: 81_192_000 picoseconds. + Weight::from_parts(101_814_078, 0) + // Standard Error: 391_508 + .saturating_add(Weight::from_parts(166_873_282, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_081_000 picoseconds. - Weight::from_parts(85_006_000, 0) - // Standard Error: 3_456_961 - .saturating_add(Weight::from_parts(860_188_117, 0).saturating_mul(r.into())) + // Minimum execution time: 84_974_000 picoseconds. + Weight::from_parts(87_244_000, 0) + // Standard Error: 3_619_557 + .saturating_add(Weight::from_parts(749_950_767, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_490_000 picoseconds. - Weight::from_parts(136_619_765, 0) - // Standard Error: 439_674 - .saturating_add(Weight::from_parts(308_552_304, 0).saturating_mul(r.into())) + // Minimum execution time: 81_612_000 picoseconds. + Weight::from_parts(147_822_399, 0) + // Standard Error: 421_408 + .saturating_add(Weight::from_parts(250_730_230, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 386_929_000 picoseconds. - Weight::from_parts(393_325_000, 0) - // Standard Error: 61_932 - .saturating_add(Weight::from_parts(21_101_790, 0).saturating_mul(n.into())) + // Minimum execution time: 332_130_000 picoseconds. + Weight::from_parts(337_780_000, 0) + // Standard Error: 52_652 + .saturating_add(Weight::from_parts(20_743_155, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_625_000 picoseconds. - Weight::from_parts(162_584_483, 0) - // Standard Error: 494_553 - .saturating_add(Weight::from_parts(313_684_139, 0).saturating_mul(r.into())) + // Minimum execution time: 82_722_000 picoseconds. + Weight::from_parts(147_881_270, 0) + // Standard Error: 390_429 + .saturating_add(Weight::from_parts(259_701_373, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 390_932_000 picoseconds. - Weight::from_parts(393_883_000, 0) - // Standard Error: 68_646 - .saturating_add(Weight::from_parts(21_188_381, 0).saturating_mul(n.into())) + // Minimum execution time: 337_753_000 picoseconds. + Weight::from_parts(343_454_000, 0) + // Standard Error: 66_604 + .saturating_add(Weight::from_parts(21_189_034, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 708_623_000 picoseconds. - Weight::from_parts(781_094_266, 0) - // Standard Error: 460_683 - .saturating_add(Weight::from_parts(328_993_362, 0).saturating_mul(r.into())) + // Minimum execution time: 708_454_000 picoseconds. + Weight::from_parts(775_673_824, 0) + // Standard Error: 380_634 + .saturating_add(Weight::from_parts(268_253_890, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 710_228_000 picoseconds. - Weight::from_parts(774_190_634, 0) - // Standard Error: 483_646 - .saturating_add(Weight::from_parts(330_057_876, 0).saturating_mul(r.into())) + // Minimum execution time: 706_799_000 picoseconds. + Weight::from_parts(782_052_003, 0) + // Standard Error: 385_065 + .saturating_add(Weight::from_parts(265_280_556, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_510_000 picoseconds. - Weight::from_parts(64_097_635, 0) - // Standard Error: 358_570 - .saturating_add(Weight::from_parts(126_095_109, 0).saturating_mul(r.into())) + // Minimum execution time: 84_511_000 picoseconds. + Weight::from_parts(61_459_678, 0) + // Standard Error: 362_497 + .saturating_add(Weight::from_parts(87_903_947, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_430_098_000 picoseconds. - Weight::from_parts(2_605_278_898, 0) - // Standard Error: 439_185 - .saturating_add(Weight::from_parts(217_479_981, 0).saturating_mul(r.into())) + // Minimum execution time: 1_676_718_000 picoseconds. + Weight::from_parts(1_838_206_733, 0) + // Standard Error: 440_793 + .saturating_add(Weight::from_parts(156_352_100, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 358_553_000 picoseconds. - Weight::from_parts(364_183_000, 0) - // Standard Error: 51_397 - .saturating_add(Weight::from_parts(30_914_040, 0).saturating_mul(n.into())) + // Minimum execution time: 284_222_000 picoseconds. + Weight::from_parts(293_316_000, 0) + // Standard Error: 54_796 + .saturating_add(Weight::from_parts(30_939_288, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_464_581_000 picoseconds. - Weight::from_parts(2_580_044_243, 0) - // Standard Error: 461_216 - .saturating_add(Weight::from_parts(272_575_116, 0).saturating_mul(r.into())) + // Minimum execution time: 1_682_466_000 picoseconds. + Weight::from_parts(1_829_413_701, 0) + // Standard Error: 510_421 + .saturating_add(Weight::from_parts(216_009_232, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_438_114_000 picoseconds. - Weight::from_parts(2_597_881_615, 0) - // Standard Error: 400_982 - .saturating_add(Weight::from_parts(275_718_502, 0).saturating_mul(r.into())) + // Minimum execution time: 1_681_160_000 picoseconds. + Weight::from_parts(1_819_797_788, 0) + // Standard Error: 453_707 + .saturating_add(Weight::from_parts(215_589_534, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 244_206_000 picoseconds. - Weight::from_parts(321_175_021, 0) - // Standard Error: 460_445 - .saturating_add(Weight::from_parts(322_059_081, 0).saturating_mul(r.into())) + // Minimum execution time: 242_556_000 picoseconds. + Weight::from_parts(314_306_159, 0) + // Standard Error: 376_142 + .saturating_add(Weight::from_parts(260_614_468, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 559_346_000 picoseconds. - Weight::from_parts(571_004_000, 0) - // Standard Error: 59_840 - .saturating_add(Weight::from_parts(21_370_093, 0).saturating_mul(n.into())) + // Minimum execution time: 495_430_000 picoseconds. + Weight::from_parts(502_714_000, 0) + // Standard Error: 52_049 + .saturating_add(Weight::from_parts(21_259_132, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_620_633_000 picoseconds. - Weight::from_parts(2_741_869_292, 0) - // Standard Error: 620_120 - .saturating_add(Weight::from_parts(289_781_719, 0).saturating_mul(r.into())) + // Minimum execution time: 1_809_658_000 picoseconds. + Weight::from_parts(2_002_681_446, 0) + // Standard Error: 414_919 + .saturating_add(Weight::from_parts(227_942_929, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_438_000 picoseconds. - Weight::from_parts(86_817_816, 0) - // Standard Error: 234_731 - .saturating_add(Weight::from_parts(19_849_283, 0).saturating_mul(r.into())) + // Minimum execution time: 80_821_000 picoseconds. + Weight::from_parts(84_783_126, 0) + // Standard Error: 234_696 + .saturating_add(Weight::from_parts(22_124_873, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_002_000 picoseconds. - Weight::from_parts(88_114_999, 0) - // Standard Error: 1_128 - .saturating_add(Weight::from_parts(427_426, 0).saturating_mul(n.into())) + // Minimum execution time: 100_040_000 picoseconds. + Weight::from_parts(92_861_700, 0) + // Standard Error: 1_021 + .saturating_add(Weight::from_parts(419_414, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_436_000 picoseconds. - Weight::from_parts(88_440_285, 0) - // Standard Error: 277_544 - .saturating_add(Weight::from_parts(17_399_914, 0).saturating_mul(r.into())) + // Minimum execution time: 80_986_000 picoseconds. + Weight::from_parts(85_723_530, 0) + // Standard Error: 278_519 + .saturating_add(Weight::from_parts(19_484_469, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 103_800_000 picoseconds. - Weight::from_parts(89_756_983, 0) - // Standard Error: 907 - .saturating_add(Weight::from_parts(428_998, 0).saturating_mul(n.into())) + // Minimum execution time: 104_879_000 picoseconds. + Weight::from_parts(88_056_044, 0) + // Standard Error: 1_087 + .saturating_add(Weight::from_parts(427_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_754_000 picoseconds. - Weight::from_parts(87_296_014, 0) - // Standard Error: 336_747 - .saturating_add(Weight::from_parts(20_299_385, 0).saturating_mul(r.into())) + // Minimum execution time: 80_548_000 picoseconds. + Weight::from_parts(84_139_208, 0) + // Standard Error: 235_150 + .saturating_add(Weight::from_parts(17_533_491, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_952_000 picoseconds. - Weight::from_parts(86_840_575, 0) - // Standard Error: 272_708 - .saturating_add(Weight::from_parts(19_217_524, 0).saturating_mul(r.into())) + // Minimum execution time: 84_118_000 picoseconds. + Weight::from_parts(88_086_604, 0) + // Standard Error: 244_958 + .saturating_add(Weight::from_parts(17_286_195, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_498_000 picoseconds. - Weight::from_parts(126_431_779, 0) - // Standard Error: 460_480 - .saturating_add(Weight::from_parts(198_940_536, 0).saturating_mul(r.into())) + // Minimum execution time: 83_393_000 picoseconds. + Weight::from_parts(132_631_342, 0) + // Standard Error: 436_134 + .saturating_add(Weight::from_parts(141_520_417, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_862_000 picoseconds. - Weight::from_parts(98_611_000, 0) - // Standard Error: 2_677 - .saturating_add(Weight::from_parts(662_266, 0).saturating_mul(n.into())) + // Minimum execution time: 97_567_000 picoseconds. + Weight::from_parts(99_600_000, 0) + // Standard Error: 2_187 + .saturating_add(Weight::from_parts(639_729, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 698_914_000 picoseconds. - Weight::from_parts(718_405_100, 0) - // Standard Error: 1_891_960 - .saturating_add(Weight::from_parts(24_867_800, 0).saturating_mul(r.into())) + // Minimum execution time: 696_739_000 picoseconds. + Weight::from_parts(711_247_336, 0) + // Standard Error: 1_403_605 + .saturating_add(Weight::from_parts(15_869_663, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 699_975_000 picoseconds. - Weight::from_parts(718_806_789, 0) - // Standard Error: 1_919_531 - .saturating_add(Weight::from_parts(51_192_710, 0).saturating_mul(r.into())) + // Minimum execution time: 697_432_000 picoseconds. + Weight::from_parts(712_096_565, 0) + // Standard Error: 1_674_352 + .saturating_add(Weight::from_parts(32_103_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_002_000 picoseconds. - Weight::from_parts(99_331_989, 0) - // Standard Error: 287_602 - .saturating_add(Weight::from_parts(9_719_710, 0).saturating_mul(r.into())) + // Minimum execution time: 92_685_000 picoseconds. + Weight::from_parts(96_156_389, 0) + // Standard Error: 262_969 + .saturating_add(Weight::from_parts(8_983_510, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_501_000 picoseconds. - Weight::from_parts(87_026_327, 0) - // Standard Error: 1_214 - .saturating_add(Weight::from_parts(429_134, 0).saturating_mul(n.into())) + // Minimum execution time: 105_746_000 picoseconds. + Weight::from_parts(89_918_273, 0) + // Standard Error: 1_055 + .saturating_add(Weight::from_parts(427_838, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_228_000 picoseconds. - Weight::from_parts(97_923_691, 0) - // Standard Error: 288_469 - .saturating_add(Weight::from_parts(9_669_908, 0).saturating_mul(r.into())) + // Minimum execution time: 95_634_000 picoseconds. + Weight::from_parts(99_574_926, 0) + // Standard Error: 267_301 + .saturating_add(Weight::from_parts(3_125_673, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_908_000 picoseconds. - Weight::from_parts(87_613_705, 0) - // Standard Error: 1_237 - .saturating_add(Weight::from_parts(431_412, 0).saturating_mul(n.into())) + // Minimum execution time: 99_268_000 picoseconds. + Weight::from_parts(93_140_981, 0) + // Standard Error: 1_101 + .saturating_add(Weight::from_parts(419_078, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_385_000 picoseconds. - Weight::from_parts(74_453_057, 0) - // Standard Error: 309_931 - .saturating_add(Weight::from_parts(117_172_527, 0).saturating_mul(r.into())) + // Minimum execution time: 83_167_000 picoseconds. + Weight::from_parts(80_305_860, 0) + // Standard Error: 357_986 + .saturating_add(Weight::from_parts(80_422_820, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_437_000 picoseconds. - Weight::from_parts(78_951_443, 0) - // Standard Error: 294_227 - .saturating_add(Weight::from_parts(116_066_384, 0).saturating_mul(r.into())) + // Minimum execution time: 81_137_000 picoseconds. + Weight::from_parts(76_881_656, 0) + // Standard Error: 302_504 + .saturating_add(Weight::from_parts(80_036_963, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 704_954_000 picoseconds. - Weight::from_parts(752_735_182, 0) - // Standard Error: 455_998 - .saturating_add(Weight::from_parts(135_154_607, 0).saturating_mul(r.into())) + // Minimum execution time: 707_922_000 picoseconds. + Weight::from_parts(767_820_244, 0) + // Standard Error: 418_647 + .saturating_add(Weight::from_parts(97_993_049, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 724_451_000 picoseconds. - Weight::from_parts(738_722_668, 0) - // Standard Error: 1_014 - .saturating_add(Weight::from_parts(154_329, 0).saturating_mul(n.into())) + // Minimum execution time: 724_683_000 picoseconds. + Weight::from_parts(732_157_836, 0) + // Standard Error: 618 + .saturating_add(Weight::from_parts(151_809, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_092_586_000 picoseconds. - Weight::from_parts(3_231_311_035, 0) - // Standard Error: 506_742 - .saturating_add(Weight::from_parts(159_545_582, 0).saturating_mul(r.into())) + // Minimum execution time: 2_304_055_000 picoseconds. + Weight::from_parts(2_435_844_780, 0) + // Standard Error: 420_214 + .saturating_add(Weight::from_parts(120_405_108, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_299_872_000 picoseconds. - Weight::from_parts(3_317_022_894, 0) - // Standard Error: 8_542 - .saturating_add(Weight::from_parts(13_645_472, 0).saturating_mul(n.into())) + // Minimum execution time: 2_431_524_000 picoseconds. + Weight::from_parts(2_669_711_936, 0) + // Standard Error: 12_819 + .saturating_add(Weight::from_parts(13_546_418, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_966_000 picoseconds. - Weight::from_parts(106_319_310, 0) - // Standard Error: 424_534 - .saturating_add(Weight::from_parts(139_885_203, 0).saturating_mul(r.into())) + // Minimum execution time: 85_238_000 picoseconds. + Weight::from_parts(104_905_012, 0) + // Standard Error: 392_000 + .saturating_add(Weight::from_parts(116_570_175, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 142_910_000 picoseconds. - Weight::from_parts(144_843_000, 0) - // Standard Error: 54_401 - .saturating_add(Weight::from_parts(25_535_472, 0).saturating_mul(n.into())) + // Minimum execution time: 143_132_000 picoseconds. + Weight::from_parts(145_448_000, 0) + // Standard Error: 51_056 + .saturating_add(Weight::from_parts(25_497_066, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_117_000 picoseconds. - Weight::from_parts(80_202_149, 0) - // Standard Error: 296_880 - .saturating_add(Weight::from_parts(114_586_990, 0).saturating_mul(r.into())) + // Minimum execution time: 84_055_000 picoseconds. + Weight::from_parts(75_514_507, 0) + // Standard Error: 342_511 + .saturating_add(Weight::from_parts(78_022_368, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_802_000 picoseconds. - Weight::from_parts(85_064_295, 0) - // Standard Error: 248_874 - .saturating_add(Weight::from_parts(27_314_604, 0).saturating_mul(r.into())) + // Minimum execution time: 83_725_000 picoseconds. + Weight::from_parts(87_574_873, 0) + // Standard Error: 249_331 + .saturating_add(Weight::from_parts(24_890_126, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_854_000 picoseconds. - Weight::from_parts(86_180_314, 0) - // Standard Error: 239_162 - .saturating_add(Weight::from_parts(16_391_885, 0).saturating_mul(r.into())) + // Minimum execution time: 82_761_000 picoseconds. + Weight::from_parts(86_511_404, 0) + // Standard Error: 240_746 + .saturating_add(Weight::from_parts(16_767_395, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_883_000 picoseconds. - Weight::from_parts(87_058_214, 0) - // Standard Error: 256_392 - .saturating_add(Weight::from_parts(13_333_285, 0).saturating_mul(r.into())) + // Minimum execution time: 84_794_000 picoseconds. + Weight::from_parts(88_401_167, 0) + // Standard Error: 217_438 + .saturating_add(Weight::from_parts(11_267_632, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_417_000 picoseconds. - Weight::from_parts(85_403_451, 0) - // Standard Error: 249_767 - .saturating_add(Weight::from_parts(14_474_948, 0).saturating_mul(r.into())) + // Minimum execution time: 83_664_000 picoseconds. + Weight::from_parts(89_193_048, 0) + // Standard Error: 336_699 + .saturating_add(Weight::from_parts(12_350_251, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_020_000 picoseconds. - Weight::from_parts(88_080_622, 0) - // Standard Error: 253_221 - .saturating_add(Weight::from_parts(11_403_277, 0).saturating_mul(r.into())) + // Minimum execution time: 83_815_000 picoseconds. + Weight::from_parts(87_397_869, 0) + // Standard Error: 235_037 + .saturating_add(Weight::from_parts(16_313_030, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 138_317_000 picoseconds. - Weight::from_parts(187_894_162, 0) - // Standard Error: 376_519 - .saturating_add(Weight::from_parts(209_723_429, 0).saturating_mul(r.into())) + // Minimum execution time: 139_190_000 picoseconds. + Weight::from_parts(186_267_428, 0) + // Standard Error: 346_204 + .saturating_add(Weight::from_parts(158_103_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_047_000 picoseconds. - Weight::from_parts(151_715_771, 0) - // Standard Error: 425_606 - .saturating_add(Weight::from_parts(396_733_544, 0).saturating_mul(r.into())) + // Minimum execution time: 96_748_000 picoseconds. + Weight::from_parts(148_556_306, 0) + // Standard Error: 400_680 + .saturating_add(Weight::from_parts(333_100_790, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1059,22 +1059,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_923_081_000 picoseconds. - Weight::from_parts(45_981_736_000, 0) - // Standard Error: 274_662 - .saturating_add(Weight::from_parts(6_858_186, 0).saturating_mul(p.into())) - // Standard Error: 274_649 - .saturating_add(Weight::from_parts(177_291_831, 0).saturating_mul(s.into())) + // Minimum execution time: 44_452_286_000 picoseconds. + Weight::from_parts(44_568_744_000, 0) + // Standard Error: 268_880 + .saturating_add(Weight::from_parts(7_444_126, 0).saturating_mul(p.into())) + // Standard Error: 268_867 + .saturating_add(Weight::from_parts(179_724_917, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_680_000 picoseconds. - Weight::from_parts(157_350_147, 0) - // Standard Error: 440_994 - .saturating_add(Weight::from_parts(402_511_567, 0).saturating_mul(r.into())) + // Minimum execution time: 96_042_000 picoseconds. + Weight::from_parts(163_443_462, 0) + // Standard Error: 381_777 + .saturating_add(Weight::from_parts(338_839_702, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1082,32 +1082,32 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_842_395_000 picoseconds. - Weight::from_parts(42_890_931_000, 0) - // Standard Error: 264_187 - .saturating_add(Weight::from_parts(7_896_879, 0).saturating_mul(p.into())) - // Standard Error: 264_174 - .saturating_add(Weight::from_parts(178_082_248, 0).saturating_mul(s.into())) + // Minimum execution time: 42_724_116_000 picoseconds. + Weight::from_parts(42_849_968_000, 0) + // Standard Error: 263_445 + .saturating_add(Weight::from_parts(8_197_177, 0).saturating_mul(p.into())) + // Standard Error: 263_432 + .saturating_add(Weight::from_parts(180_050_572, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_272_000 picoseconds. - Weight::from_parts(100_008_395, 0) - // Standard Error: 36_430 - .saturating_add(Weight::from_parts(2_544_223, 0).saturating_mul(r.into())) + // Minimum execution time: 86_607_000 picoseconds. + Weight::from_parts(100_957_693, 0) + // Standard Error: 29_067 + .saturating_add(Weight::from_parts(1_762_813, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_139_000 picoseconds. - Weight::from_parts(122_967_835, 1131) - // Standard Error: 6_454 - .saturating_add(Weight::from_parts(11_784_103, 0).saturating_mul(p.into())) + // Minimum execution time: 87_305_000 picoseconds. + Weight::from_parts(108_825_748, 1131) + // Standard Error: 5_956 + .saturating_add(Weight::from_parts(11_809_647, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1116,10 +1116,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_229_000 picoseconds. - Weight::from_parts(83_885_000, 1131) - // Standard Error: 37_558 - .saturating_add(Weight::from_parts(35_503_677, 0).saturating_mul(p.into())) + // Minimum execution time: 87_531_000 picoseconds. + Weight::from_parts(88_749_000, 1131) + // Standard Error: 27_438 + .saturating_add(Weight::from_parts(35_435_114, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1128,10 +1128,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_139_187_000 picoseconds. - Weight::from_parts(5_806_599_304, 5069931) - // Standard Error: 75_881 - .saturating_add(Weight::from_parts(36_513_688, 0).saturating_mul(p.into())) + // Minimum execution time: 6_087_078_000 picoseconds. + Weight::from_parts(5_882_681_000, 5069931) + // Standard Error: 87_545 + .saturating_add(Weight::from_parts(37_047_042, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1139,10 +1139,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_177_000 picoseconds. - Weight::from_parts(83_595_000, 1939) - // Standard Error: 45_778 - .saturating_add(Weight::from_parts(47_155_630, 0).saturating_mul(p.into())) + // Minimum execution time: 85_432_000 picoseconds. + Weight::from_parts(87_001_000, 1939) + // Standard Error: 47_768 + .saturating_add(Weight::from_parts(47_598_234, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1151,10 +1151,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 90_231_000 picoseconds. - Weight::from_parts(95_944_378, 1131) - // Standard Error: 61_821 - .saturating_add(Weight::from_parts(35_941_066, 0).saturating_mul(p.into())) + // Minimum execution time: 92_594_000 picoseconds. + Weight::from_parts(93_795_036, 1131) + // Standard Error: 53_549 + .saturating_add(Weight::from_parts(35_797_869, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1163,10 +1163,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 734_006_000 picoseconds. - Weight::from_parts(717_384_508, 1496) - // Standard Error: 375_292 - .saturating_add(Weight::from_parts(47_930_581, 0).saturating_mul(p.into())) + // Minimum execution time: 769_397_000 picoseconds. + Weight::from_parts(792_321_925, 1496) + // Standard Error: 237_986 + .saturating_add(Weight::from_parts(48_847_504, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1175,10 +1175,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_121_849_000 picoseconds. - Weight::from_parts(1_147_558_033, 317931) - // Standard Error: 373_146 - .saturating_add(Weight::from_parts(45_393_418, 0).saturating_mul(p.into())) + // Minimum execution time: 1_113_735_000 picoseconds. + Weight::from_parts(1_148_020_828, 317931) + // Standard Error: 167_371 + .saturating_add(Weight::from_parts(47_795_831, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1186,885 +1186,885 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_220_392, 0) - // Standard Error: 8_848 - .saturating_add(Weight::from_parts(24_205_605, 0).saturating_mul(r.into())) + // Minimum execution time: 4_154_000 picoseconds. + Weight::from_parts(4_280_364, 0) + // Standard Error: 8_638 + .saturating_add(Weight::from_parts(24_150_721, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_352_664_000 picoseconds. - Weight::from_parts(4_153_366_897, 0) - // Standard Error: 60_193 - .saturating_add(Weight::from_parts(4_722_164, 0).saturating_mul(r.into())) + // Minimum execution time: 4_339_689_000 picoseconds. + Weight::from_parts(4_202_598_633, 0) + // Standard Error: 74_721 + .saturating_add(Weight::from_parts(4_468_109, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_357_649_000 picoseconds. - Weight::from_parts(4_256_499_798, 0) - // Standard Error: 57_942 - .saturating_add(Weight::from_parts(4_200_870, 0).saturating_mul(r.into())) + // Minimum execution time: 4_343_068_000 picoseconds. + Weight::from_parts(4_226_706_212, 0) + // Standard Error: 60_538 + .saturating_add(Weight::from_parts(4_325_162, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_269_998_000 picoseconds. - Weight::from_parts(11_525_100_351, 0) - // Standard Error: 204_230 - .saturating_add(Weight::from_parts(8_423_588, 0).saturating_mul(r.into())) + // Minimum execution time: 11_409_473_000 picoseconds. + Weight::from_parts(11_882_222_938, 0) + // Standard Error: 194_167 + .saturating_add(Weight::from_parts(8_210_890, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_204_810_000 picoseconds. - Weight::from_parts(10_982_673_143, 0) - // Standard Error: 145_327 - .saturating_add(Weight::from_parts(9_198_033, 0).saturating_mul(r.into())) + // Minimum execution time: 10_212_512_000 picoseconds. + Weight::from_parts(10_628_957_808, 0) + // Standard Error: 170_508 + .saturating_add(Weight::from_parts(11_560_237, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_074_000 picoseconds. - Weight::from_parts(2_108_000, 0) - // Standard Error: 9_031 - .saturating_add(Weight::from_parts(3_829_182, 0).saturating_mul(r.into())) + // Minimum execution time: 2_229_000 picoseconds. + Weight::from_parts(2_319_000, 0) + // Standard Error: 9_576 + .saturating_add(Weight::from_parts(3_794_717, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_020_000 picoseconds. - Weight::from_parts(2_118_000, 0) - // Standard Error: 5_295 - .saturating_add(Weight::from_parts(2_980_329, 0).saturating_mul(r.into())) + // Minimum execution time: 2_265_000 picoseconds. + Weight::from_parts(2_353_000, 0) + // Standard Error: 5_018 + .saturating_add(Weight::from_parts(3_059_511, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_032_000 picoseconds. - Weight::from_parts(3_411_359, 0) - // Standard Error: 1_146 - .saturating_add(Weight::from_parts(1_563_906, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(3_531_925, 0) + // Standard Error: 1_167 + .saturating_add(Weight::from_parts(1_569_201, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_096_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 8_349 - .saturating_add(Weight::from_parts(2_904_673, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(2_359_000, 0) + // Standard Error: 9_672 + .saturating_add(Weight::from_parts(2_884_305, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_128_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 8_100 - .saturating_add(Weight::from_parts(5_229_400, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 8_373 + .saturating_add(Weight::from_parts(5_256_648, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_838_000 picoseconds. - Weight::from_parts(5_309_346, 0) - // Standard Error: 2_580 - .saturating_add(Weight::from_parts(129_982, 0).saturating_mul(e.into())) + // Minimum execution time: 7_012_000 picoseconds. + Weight::from_parts(4_938_253, 0) + // Standard Error: 2_214 + .saturating_add(Weight::from_parts(151_870, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(3_593_285, 0) - // Standard Error: 6_648 - .saturating_add(Weight::from_parts(2_597_926, 0).saturating_mul(r.into())) + // Minimum execution time: 2_309_000 picoseconds. + Weight::from_parts(4_232_448, 0) + // Standard Error: 6_359 + .saturating_add(Weight::from_parts(2_596_672, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_597_926 - - 2_429_048, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_596_672 - + 2_404_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_086_000 picoseconds. - Weight::from_parts(3_972_773, 0) - // Standard Error: 12_538 - .saturating_add(Weight::from_parts(2_429_048, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(4_432_470, 0) + // Standard Error: 11_941 + .saturating_add(Weight::from_parts(2_404_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_591_000 picoseconds. - Weight::from_parts(12_798_134, 0) - // Standard Error: 23_023 - .saturating_add(Weight::from_parts(9_786_464, 0).saturating_mul(r.into())) + // Minimum execution time: 2_776_000 picoseconds. + Weight::from_parts(12_954_286, 0) + // Standard Error: 30_568 + .saturating_add(Weight::from_parts(10_260_958, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_274_000 picoseconds. - Weight::from_parts(1_706_188, 0) - // Standard Error: 6_199 - .saturating_add(Weight::from_parts(1_212_443, 0).saturating_mul(p.into())) + // Minimum execution time: 11_935_000 picoseconds. + Weight::from_parts(1_635_475, 0) + // Standard Error: 7_669 + .saturating_add(Weight::from_parts(1_285_084, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_221_000 picoseconds. - Weight::from_parts(5_538_574, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(12, 0).saturating_mul(l.into())) + // Minimum execution time: 5_316_000 picoseconds. + Weight::from_parts(5_699_758, 0) + // Standard Error: 13 + .saturating_add(Weight::from_parts(34, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(1_785_103, 0) - // Standard Error: 2_948 - .saturating_add(Weight::from_parts(249_981, 0).saturating_mul(r.into())) + // Minimum execution time: 2_315_000 picoseconds. + Weight::from_parts(2_460_643, 0) + // Standard Error: 2_850 + .saturating_add(Weight::from_parts(235_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_123_000 picoseconds. - Weight::from_parts(2_187_000, 0) - // Standard Error: 5_664 - .saturating_add(Weight::from_parts(719_187, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 6_150 + .saturating_add(Weight::from_parts(730_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_214_000, 0) - // Standard Error: 5_625 - .saturating_add(Weight::from_parts(709_067, 0).saturating_mul(r.into())) + // Minimum execution time: 2_244_000 picoseconds. + Weight::from_parts(2_338_000, 0) + // Standard Error: 5_205 + .saturating_add(Weight::from_parts(679_669, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_168_000 picoseconds. - Weight::from_parts(2_290_203, 0) - // Standard Error: 8_984 - .saturating_add(Weight::from_parts(761_843, 0).saturating_mul(r.into())) + // Minimum execution time: 6_412_000 picoseconds. + Weight::from_parts(2_087_064, 0) + // Standard Error: 9_824 + .saturating_add(Weight::from_parts(743_737, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_249_000 picoseconds. - Weight::from_parts(6_302_000, 0) - // Standard Error: 8_682 - .saturating_add(Weight::from_parts(1_329_653, 0).saturating_mul(r.into())) + // Minimum execution time: 6_388_000 picoseconds. + Weight::from_parts(6_512_000, 0) + // Standard Error: 7_958 + .saturating_add(Weight::from_parts(1_283_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_791_000 picoseconds. - Weight::from_parts(3_929_000, 0) - // Standard Error: 9_270 - .saturating_add(Weight::from_parts(6_742_685, 0).saturating_mul(r.into())) + // Minimum execution time: 6_885_000 picoseconds. + Weight::from_parts(4_075_795, 0) + // Standard Error: 12_241 + .saturating_add(Weight::from_parts(6_965_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_113_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 6_734 - .saturating_add(Weight::from_parts(3_327_207, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 5_936 + .saturating_add(Weight::from_parts(3_299_707, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_141_000, 0) - // Standard Error: 6_506 - .saturating_add(Weight::from_parts(3_061_891, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 6_255 + .saturating_add(Weight::from_parts(2_999_382, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_108_000 picoseconds. - Weight::from_parts(2_141_000, 0) - // Standard Error: 6_738 - .saturating_add(Weight::from_parts(3_101_844, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_271_000, 0) + // Standard Error: 6_896 + .saturating_add(Weight::from_parts(2_967_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_138_000 picoseconds. - Weight::from_parts(2_155_000, 0) - // Standard Error: 4_379 - .saturating_add(Weight::from_parts(2_613_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_268_000, 0) + // Standard Error: 4_893 + .saturating_add(Weight::from_parts(2_579_110, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_046_000 picoseconds. - Weight::from_parts(2_127_000, 0) - // Standard Error: 3_513 - .saturating_add(Weight::from_parts(525_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_304_000, 0) + // Standard Error: 3_852 + .saturating_add(Weight::from_parts(520_005, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(1_669_179, 0) - // Standard Error: 2_817 - .saturating_add(Weight::from_parts(367_599, 0).saturating_mul(r.into())) + // Minimum execution time: 2_274_000 picoseconds. + Weight::from_parts(1_794_591, 0) + // Standard Error: 3_416 + .saturating_add(Weight::from_parts(359_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 11_816 - .saturating_add(Weight::from_parts(1_810_781, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_287_000, 0) + // Standard Error: 10_307 + .saturating_add(Weight::from_parts(1_833_775, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_087_000 picoseconds. - Weight::from_parts(2_194_000, 0) - // Standard Error: 7_361 - .saturating_add(Weight::from_parts(1_130_773, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(2_349_000, 0) + // Standard Error: 9_393 + .saturating_add(Weight::from_parts(1_178_942, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_061_000 picoseconds. - Weight::from_parts(1_850_477, 0) - // Standard Error: 2_695 - .saturating_add(Weight::from_parts(318_827, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_256_508, 0) + // Standard Error: 3_133 + .saturating_add(Weight::from_parts(326_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_115_000 picoseconds. - Weight::from_parts(1_764_589, 0) - // Standard Error: 2_923 - .saturating_add(Weight::from_parts(329_840, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(1_792_383, 0) + // Standard Error: 2_981 + .saturating_add(Weight::from_parts(325_072, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_109_000 picoseconds. - Weight::from_parts(859_995, 0) - // Standard Error: 4_546 - .saturating_add(Weight::from_parts(467_944, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(236_190, 0) + // Standard Error: 5_791 + .saturating_add(Weight::from_parts(526_784, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_010_000 picoseconds. - Weight::from_parts(2_081_000, 0) - // Standard Error: 3_959 - .saturating_add(Weight::from_parts(472_947, 0).saturating_mul(r.into())) + // Minimum execution time: 2_278_000 picoseconds. + Weight::from_parts(18_346, 0) + // Standard Error: 5_882 + .saturating_add(Weight::from_parts(538_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_105_000 picoseconds. - Weight::from_parts(1_247_124, 0) - // Standard Error: 4_390 - .saturating_add(Weight::from_parts(436_907, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 4_502 + .saturating_add(Weight::from_parts(463_034, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_140_000 picoseconds. - Weight::from_parts(2_251_532, 0) - // Standard Error: 2_995 - .saturating_add(Weight::from_parts(280_490, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(2_193_450, 0) + // Standard Error: 3_655 + .saturating_add(Weight::from_parts(304_226, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_119_000 picoseconds. - Weight::from_parts(2_808_547, 0) - // Standard Error: 1_453 - .saturating_add(Weight::from_parts(143_409, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_803_358, 0) + // Standard Error: 2_256 + .saturating_add(Weight::from_parts(163_489, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_043_000 picoseconds. - Weight::from_parts(2_639_820, 0) - // Standard Error: 1_638 - .saturating_add(Weight::from_parts(159_792, 0).saturating_mul(r.into())) + // Minimum execution time: 2_242_000 picoseconds. + Weight::from_parts(3_087_274, 0) + // Standard Error: 1_907 + .saturating_add(Weight::from_parts(146_988, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_128_000 picoseconds. - Weight::from_parts(2_166_000, 0) - // Standard Error: 11_777 - .saturating_add(Weight::from_parts(1_709_510, 0).saturating_mul(r.into())) + // Minimum execution time: 2_268_000 picoseconds. + Weight::from_parts(2_335_000, 0) + // Standard Error: 9_220 + .saturating_add(Weight::from_parts(1_682_986, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(2_136_000, 0) - // Standard Error: 7_491 - .saturating_add(Weight::from_parts(1_105_807, 0).saturating_mul(r.into())) + // Minimum execution time: 2_244_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 7_751 + .saturating_add(Weight::from_parts(1_073_438, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_088_000 picoseconds. - Weight::from_parts(2_171_000, 0) - // Standard Error: 11_841 - .saturating_add(Weight::from_parts(1_785_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_225_000 picoseconds. + Weight::from_parts(2_297_000, 0) + // Standard Error: 9_887 + .saturating_add(Weight::from_parts(1_746_888, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_042_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 7_479 - .saturating_add(Weight::from_parts(1_086_144, 0).saturating_mul(r.into())) + // Minimum execution time: 2_225_000 picoseconds. + Weight::from_parts(2_305_000, 0) + // Standard Error: 8_241 + .saturating_add(Weight::from_parts(1_123_968, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_109_000 picoseconds. - Weight::from_parts(2_151_000, 0) - // Standard Error: 13_111 - .saturating_add(Weight::from_parts(1_829_000, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(2_368_000, 0) + // Standard Error: 10_199 + .saturating_add(Weight::from_parts(1_754_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_153_000, 0) - // Standard Error: 7_632 - .saturating_add(Weight::from_parts(1_102_522, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 7_885 + .saturating_add(Weight::from_parts(1_054_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_155_000 picoseconds. - Weight::from_parts(2_231_000, 0) - // Standard Error: 11_689 - .saturating_add(Weight::from_parts(1_768_866, 0).saturating_mul(r.into())) + // Minimum execution time: 2_212_000 picoseconds. + Weight::from_parts(2_244_000, 0) + // Standard Error: 11_272 + .saturating_add(Weight::from_parts(1_769_874, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_163_000, 0) - // Standard Error: 7_348 - .saturating_add(Weight::from_parts(1_057_058, 0).saturating_mul(r.into())) + // Minimum execution time: 2_248_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 8_360 + .saturating_add(Weight::from_parts(1_115_362, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_142_000, 0) - // Standard Error: 12_173 - .saturating_add(Weight::from_parts(1_786_184, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 9_424 + .saturating_add(Weight::from_parts(1_807_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 7_244 - .saturating_add(Weight::from_parts(1_066_057, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 7_499 + .saturating_add(Weight::from_parts(1_087_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_090_000 picoseconds. - Weight::from_parts(2_175_000, 0) - // Standard Error: 11_967 - .saturating_add(Weight::from_parts(1_782_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 11_743 + .saturating_add(Weight::from_parts(1_703_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_091_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 7_205 - .saturating_add(Weight::from_parts(1_048_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_254_000, 0) + // Standard Error: 8_099 + .saturating_add(Weight::from_parts(1_080_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_164_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 12_228 - .saturating_add(Weight::from_parts(1_792_751, 0).saturating_mul(r.into())) + // Minimum execution time: 2_183_000 picoseconds. + Weight::from_parts(2_301_000, 0) + // Standard Error: 10_230 + .saturating_add(Weight::from_parts(1_738_567, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_186_000, 0) - // Standard Error: 7_822 - .saturating_add(Weight::from_parts(1_052_385, 0).saturating_mul(r.into())) + // Minimum execution time: 2_209_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 8_536 + .saturating_add(Weight::from_parts(1_161_928, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_055_000 picoseconds. - Weight::from_parts(2_135_000, 0) - // Standard Error: 12_011 - .saturating_add(Weight::from_parts(1_789_504, 0).saturating_mul(r.into())) + // Minimum execution time: 2_208_000 picoseconds. + Weight::from_parts(2_255_000, 0) + // Standard Error: 10_368 + .saturating_add(Weight::from_parts(1_847_441, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_447_000 picoseconds. - Weight::from_parts(2_540_000, 0) - // Standard Error: 7_696 - .saturating_add(Weight::from_parts(1_062_612, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(2_299_000, 0) + // Standard Error: 8_213 + .saturating_add(Weight::from_parts(1_112_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_107_000, 0) - // Standard Error: 12_070 - .saturating_add(Weight::from_parts(1_771_498, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 12_684 + .saturating_add(Weight::from_parts(1_728_765, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_123_000 picoseconds. - Weight::from_parts(2_156_000, 0) - // Standard Error: 7_108 - .saturating_add(Weight::from_parts(1_072_471, 0).saturating_mul(r.into())) + // Minimum execution time: 2_573_000 picoseconds. + Weight::from_parts(2_655_000, 0) + // Standard Error: 7_404 + .saturating_add(Weight::from_parts(1_080_080, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_145_000, 0) - // Standard Error: 11_990 - .saturating_add(Weight::from_parts(1_786_273, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_316_000, 0) + // Standard Error: 9_739 + .saturating_add(Weight::from_parts(1_807_913, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_059_000 picoseconds. - Weight::from_parts(2_122_000, 0) - // Standard Error: 7_164 - .saturating_add(Weight::from_parts(1_070_909, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 7_265 + .saturating_add(Weight::from_parts(1_087_210, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_065_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 7_265 - .saturating_add(Weight::from_parts(1_152_228, 0).saturating_mul(r.into())) + // Minimum execution time: 2_252_000 picoseconds. + Weight::from_parts(2_311_000, 0) + // Standard Error: 7_444 + .saturating_add(Weight::from_parts(1_191_685, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_160_000, 0) - // Standard Error: 5_101 - .saturating_add(Weight::from_parts(578_660, 0).saturating_mul(r.into())) + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(2_320_000, 0) + // Standard Error: 5_023 + .saturating_add(Weight::from_parts(585_667, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_184_000, 0) - // Standard Error: 9_299 - .saturating_add(Weight::from_parts(1_257_633, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_320_000, 0) + // Standard Error: 10_018 + .saturating_add(Weight::from_parts(1_297_791, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_119_000 picoseconds. - Weight::from_parts(2_262_000, 0) - // Standard Error: 3_957 - .saturating_add(Weight::from_parts(557_957, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 4_776 + .saturating_add(Weight::from_parts(612_864, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_045_000 picoseconds. - Weight::from_parts(2_157_000, 0) - // Standard Error: 10_839 - .saturating_add(Weight::from_parts(1_686_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_286_000 picoseconds. + Weight::from_parts(2_356_000, 0) + // Standard Error: 11_619 + .saturating_add(Weight::from_parts(1_743_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 7_276 - .saturating_add(Weight::from_parts(1_096_252, 0).saturating_mul(r.into())) + // Minimum execution time: 2_302_000 picoseconds. + Weight::from_parts(2_343_000, 0) + // Standard Error: 8_638 + .saturating_add(Weight::from_parts(1_136_060, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(1_434_170, 0) - // Standard Error: 21_965 - .saturating_add(Weight::from_parts(2_633_663, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 7_114 + .saturating_add(Weight::from_parts(2_599_346, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_098_000 picoseconds. - Weight::from_parts(2_122_681, 0) - // Standard Error: 10_815 - .saturating_add(Weight::from_parts(2_335_842, 0).saturating_mul(r.into())) + // Minimum execution time: 2_200_000 picoseconds. + Weight::from_parts(3_823_403, 0) + // Standard Error: 18_912 + .saturating_add(Weight::from_parts(2_161_963, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(145_632, 0) - // Standard Error: 12_320 - .saturating_add(Weight::from_parts(2_992_427, 0).saturating_mul(r.into())) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_817_173, 0) + // Standard Error: 17_341 + .saturating_add(Weight::from_parts(2_740_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_142_000 picoseconds. - Weight::from_parts(2_180_000, 0) - // Standard Error: 4_944 - .saturating_add(Weight::from_parts(2_466_854, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(88_235, 0) + // Standard Error: 10_326 + .saturating_add(Weight::from_parts(2_481_087, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_143_000 picoseconds. - Weight::from_parts(2_204_000, 0) - // Standard Error: 14_500 - .saturating_add(Weight::from_parts(9_530_241, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 14_480 + .saturating_add(Weight::from_parts(9_604_981, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_132_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 22_303 - .saturating_add(Weight::from_parts(7_508_848, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 21_926 + .saturating_add(Weight::from_parts(7_501_289, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_133_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 5_407 - .saturating_add(Weight::from_parts(2_948_013, 0).saturating_mul(r.into())) + // Minimum execution time: 2_309_000 picoseconds. + Weight::from_parts(10_308_173, 0) + // Standard Error: 30_680 + .saturating_add(Weight::from_parts(2_288_505, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_124_000 picoseconds. - Weight::from_parts(2_150_000, 0) - // Standard Error: 6_372 - .saturating_add(Weight::from_parts(2_362_416, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 5_007 + .saturating_add(Weight::from_parts(2_516_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 7_670 - .saturating_add(Weight::from_parts(1_174_342, 0).saturating_mul(r.into())) + // Minimum execution time: 2_228_000 picoseconds. + Weight::from_parts(2_300_000, 0) + // Standard Error: 8_948 + .saturating_add(Weight::from_parts(1_264_596, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_109_000, 0) - // Standard Error: 3_988 - .saturating_add(Weight::from_parts(566_949, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_323_000, 0) + // Standard Error: 5_099 + .saturating_add(Weight::from_parts(612_107, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_049_000 picoseconds. - Weight::from_parts(2_117_000, 0) - // Standard Error: 8_393 - .saturating_add(Weight::from_parts(1_160_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(2_326_000, 0) + // Standard Error: 10_004 + .saturating_add(Weight::from_parts(1_278_365, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_152_000, 0) - // Standard Error: 4_769 - .saturating_add(Weight::from_parts(585_265, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 5_578 + .saturating_add(Weight::from_parts(645_196, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_115_000 picoseconds. - Weight::from_parts(2_170_000, 0) - // Standard Error: 7_943 - .saturating_add(Weight::from_parts(1_185_174, 0).saturating_mul(r.into())) + // Minimum execution time: 2_338_000 picoseconds. + Weight::from_parts(2_363_000, 0) + // Standard Error: 8_554 + .saturating_add(Weight::from_parts(1_288_676, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_139_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 4_608 - .saturating_add(Weight::from_parts(563_329, 0).saturating_mul(r.into())) + // Minimum execution time: 2_214_000 picoseconds. + Weight::from_parts(2_332_000, 0) + // Standard Error: 3_999 + .saturating_add(Weight::from_parts(594_484, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_144_000 picoseconds. - Weight::from_parts(2_178_000, 0) - // Standard Error: 6_727 - .saturating_add(Weight::from_parts(1_000_757, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 7_437 + .saturating_add(Weight::from_parts(1_044_306, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_212_000, 0) - // Standard Error: 3_536 - .saturating_add(Weight::from_parts(504_096, 0).saturating_mul(r.into())) + // Minimum execution time: 2_226_000 picoseconds. + Weight::from_parts(2_308_000, 0) + // Standard Error: 4_658 + .saturating_add(Weight::from_parts(537_262, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_218_000, 0) - // Standard Error: 7_170 - .saturating_add(Weight::from_parts(966_365, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 10_254 + .saturating_add(Weight::from_parts(1_154_138, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_149_000 picoseconds. - Weight::from_parts(140_768, 0) - // Standard Error: 5_221 - .saturating_add(Weight::from_parts(551_550, 0).saturating_mul(r.into())) + // Minimum execution time: 2_234_000 picoseconds. + Weight::from_parts(2_313_000, 0) + // Standard Error: 4_960 + .saturating_add(Weight::from_parts(607_930, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 7_621 - .saturating_add(Weight::from_parts(997_420, 0).saturating_mul(r.into())) + // Minimum execution time: 2_279_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 7_909 + .saturating_add(Weight::from_parts(1_094_660, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_069_000 picoseconds. - Weight::from_parts(2_106_000, 0) - // Standard Error: 3_980 - .saturating_add(Weight::from_parts(537_014, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(39_069, 0) + // Standard Error: 6_710 + .saturating_add(Weight::from_parts(599_572, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_097_000 picoseconds. - Weight::from_parts(2_191_000, 0) - // Standard Error: 9_419 - .saturating_add(Weight::from_parts(1_050_292, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 8_785 + .saturating_add(Weight::from_parts(1_060_321, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_051_000 picoseconds. - Weight::from_parts(2_118_000, 0) - // Standard Error: 4_228 - .saturating_add(Weight::from_parts(529_158, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 4_191 + .saturating_add(Weight::from_parts(528_319, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_116_000, 0) - // Standard Error: 7_792 - .saturating_add(Weight::from_parts(1_027_370, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 9_328 + .saturating_add(Weight::from_parts(1_114_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 4_450 - .saturating_add(Weight::from_parts(534_724, 0).saturating_mul(r.into())) + // Minimum execution time: 2_210_000 picoseconds. + Weight::from_parts(390_951, 0) + // Standard Error: 5_316 + .saturating_add(Weight::from_parts(609_568, 0).saturating_mul(r.into())) } } @@ -2089,10 +2089,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 954_000 picoseconds. - Weight::from_parts(1_004_000, 0) - // Standard Error: 802 - .saturating_add(Weight::from_parts(249_956, 0).saturating_mul(c.into())) + // Minimum execution time: 951_000 picoseconds. + Weight::from_parts(1_020_000, 0) + // Standard Error: 722 + .saturating_add(Weight::from_parts(240_031, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -2100,10 +2100,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `42 + c * (1024 ±0)` // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_808_000 picoseconds. - Weight::from_parts(2_895_000, 3506) - // Standard Error: 1_086 - .saturating_add(Weight::from_parts(680_150, 0).saturating_mul(c.into())) + // Minimum execution time: 2_762_000 picoseconds. + Weight::from_parts(2_859_000, 3506) + // Standard Error: 813 + .saturating_add(Weight::from_parts(665_139, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2112,17 +2112,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_458_000 picoseconds. - Weight::from_parts(84_558_500, 0) - // Standard Error: 7_412 - .saturating_add(Weight::from_parts(2_377_997, 0).saturating_mul(c.into())) + // Minimum execution time: 50_591_000 picoseconds. + Weight::from_parts(61_353_023, 0) + // Standard Error: 9_186 + .saturating_add(Weight::from_parts(2_404_810, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `979` // Estimated: `42236` - // Minimum execution time: 81_302_000 picoseconds. - Weight::from_parts(83_307_000, 42236) + // Minimum execution time: 81_660_000 picoseconds. + Weight::from_parts(83_840_000, 42236) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2130,8 +2130,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `886` // Estimated: `21261` - // Minimum execution time: 52_219_000 picoseconds. - Weight::from_parts(53_704_000, 21261) + // Minimum execution time: 54_005_000 picoseconds. + Weight::from_parts(55_095_000, 21261) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2139,8 +2139,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `534` // Estimated: `17070` - // Minimum execution time: 28_408_000 picoseconds. - Weight::from_parts(29_714_000, 17070) + // Minimum execution time: 28_880_000 picoseconds. + Weight::from_parts(29_583_000, 17070) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2149,10 +2149,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_918_000 picoseconds. - Weight::from_parts(6_745_647, 7640) - // Standard Error: 37_300 - .saturating_add(Weight::from_parts(13_885_473, 0).saturating_mul(c.into())) + // Minimum execution time: 7_744_000 picoseconds. + Weight::from_parts(4_233_092, 7640) + // Standard Error: 39_690 + .saturating_add(Weight::from_parts(14_033_179, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -2161,10 +2161,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1297 + c * (16389 ±0)` // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 68_486_000 picoseconds. - Weight::from_parts(69_079_000, 40898) - // Standard Error: 164_982 - .saturating_add(Weight::from_parts(55_774_264, 0).saturating_mul(c.into())) + // Minimum execution time: 70_301_000 picoseconds. + Weight::from_parts(70_991_000, 40898) + // Standard Error: 177_223 + .saturating_add(Weight::from_parts(54_687_249, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2175,10 +2175,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `10` // Estimated: `4990` - // Minimum execution time: 61_635_000 picoseconds. - Weight::from_parts(64_537_590, 4990) - // Standard Error: 40_298 - .saturating_add(Weight::from_parts(52_820_238, 0).saturating_mul(c.into())) + // Minimum execution time: 61_715_000 picoseconds. + Weight::from_parts(40_384_385, 4990) + // Standard Error: 57_496 + .saturating_add(Weight::from_parts(53_210_788, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2187,10 +2187,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `671` // Estimated: `38638` - // Minimum execution time: 63_344_000 picoseconds. - Weight::from_parts(76_968_021, 38638) + // Minimum execution time: 63_077_000 picoseconds. + Weight::from_parts(96_840_506, 38638) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_598, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_609, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2200,12 +2200,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `235` // Estimated: `34312` - // Minimum execution time: 10_980_969_000 picoseconds. - Weight::from_parts(301_891_685, 34312) - // Standard Error: 164_203 - .saturating_add(Weight::from_parts(54_383_779, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_548, 0).saturating_mul(s.into())) + // Minimum execution time: 11_049_858_000 picoseconds. + Weight::from_parts(11_090_406_000, 34312) + // Standard Error: 517_330 + .saturating_add(Weight::from_parts(25_497_137, 0).saturating_mul(c.into())) + // Standard Error: 30 + .saturating_add(Weight::from_parts(910, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } @@ -2214,10 +2214,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `348` // Estimated: `23853` - // Minimum execution time: 53_732_000 picoseconds. - Weight::from_parts(35_204_611, 23853) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_021, 0).saturating_mul(p.into())) + // Minimum execution time: 56_305_000 picoseconds. + Weight::from_parts(38_705_997, 23853) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_034, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -2226,32 +2226,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `978` // Estimated: `42227` - // Minimum execution time: 82_297_000 picoseconds. - Weight::from_parts(62_302_593, 42227) + // Minimum execution time: 83_033_000 picoseconds. + Weight::from_parts(69_135_468, 42227) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_042, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(_q: u32, ) -> Weight { + fn initial_allocation(q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 298_083_000 picoseconds. - Weight::from_parts(314_192_353, 74319) + // Minimum execution time: 295_535_000 picoseconds. + Weight::from_parts(306_791_413, 74319) + // Standard Error: 1_111 + .saturating_add(Weight::from_parts(1_568, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(q: u32, ) -> Weight { + fn alloc_in_handle(_q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `760` // Estimated: `74319` - // Minimum execution time: 312_856_000 picoseconds. - Weight::from_parts(326_607_586, 74319) - // Standard Error: 1_507 - .saturating_add(Weight::from_parts(723, 0).saturating_mul(q.into())) + // Minimum execution time: 309_253_000 picoseconds. + Weight::from_parts(323_694_389, 74319) .saturating_add(RocksDbWeight::get().reads(27_u64)) .saturating_add(RocksDbWeight::get().writes(22_u64)) } @@ -2260,10 +2260,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_478_000 picoseconds. - Weight::from_parts(45_769_000, 3899) - // Standard Error: 42_221 - .saturating_add(Weight::from_parts(51_492_007, 0).saturating_mul(c.into())) + // Minimum execution time: 44_806_000 picoseconds. + Weight::from_parts(45_498_000, 3899) + // Standard Error: 44_467 + .saturating_add(Weight::from_parts(54_603_581, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2273,630 +2273,630 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_248_000 picoseconds. - Weight::from_parts(87_224_000, 0) - // Standard Error: 4_031_043 - .saturating_add(Weight::from_parts(559_145_890, 0).saturating_mul(r.into())) + // Minimum execution time: 82_307_000 picoseconds. + Weight::from_parts(84_226_000, 0) + // Standard Error: 4_203_577 + .saturating_add(Weight::from_parts(574_493_471, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 304_310_000 picoseconds. - Weight::from_parts(240_640_662, 0) - // Standard Error: 7_875 - .saturating_add(Weight::from_parts(30_931_778, 0).saturating_mul(p.into())) + // Minimum execution time: 309_893_000 picoseconds. + Weight::from_parts(234_558_588, 0) + // Standard Error: 7_966 + .saturating_add(Weight::from_parts(32_022_587, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 144_728_000 picoseconds. - Weight::from_parts(127_694_995, 0) - // Standard Error: 344_021 - .saturating_add(Weight::from_parts(63_008_235, 0).saturating_mul(r.into())) + // Minimum execution time: 142_319_000 picoseconds. + Weight::from_parts(121_865_521, 0) + // Standard Error: 314_080 + .saturating_add(Weight::from_parts(64_422_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_763_000 picoseconds. - Weight::from_parts(93_302_515, 0) - // Standard Error: 3_873 - .saturating_add(Weight::from_parts(2_723_217, 0).saturating_mul(r.into())) + // Minimum execution time: 85_527_000 picoseconds. + Weight::from_parts(91_967_528, 0) + // Standard Error: 3_856 + .saturating_add(Weight::from_parts(2_363_669, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 134_987_000 picoseconds. - Weight::from_parts(141_052_149, 0) - // Standard Error: 29_498 - .saturating_add(Weight::from_parts(3_252_053, 0).saturating_mul(r.into())) + // Minimum execution time: 144_133_000 picoseconds. + Weight::from_parts(156_991_945, 0) + // Standard Error: 24_223 + .saturating_add(Weight::from_parts(2_431_525, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_532_000 picoseconds. - Weight::from_parts(111_956_884, 0) - // Standard Error: 420_651 - .saturating_add(Weight::from_parts(124_761_103, 0).saturating_mul(r.into())) + // Minimum execution time: 86_811_000 picoseconds. + Weight::from_parts(101_122_470, 0) + // Standard Error: 303_533 + .saturating_add(Weight::from_parts(92_415_204, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_442_000 picoseconds. - Weight::from_parts(76_262_730, 0) - // Standard Error: 310_067 - .saturating_add(Weight::from_parts(115_334_131, 0).saturating_mul(r.into())) + // Minimum execution time: 84_453_000 picoseconds. + Weight::from_parts(79_049_804, 0) + // Standard Error: 305_992 + .saturating_add(Weight::from_parts(79_382_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_322_000 picoseconds. - Weight::from_parts(71_153_919, 0) - // Standard Error: 293_317 - .saturating_add(Weight::from_parts(115_508_333, 0).saturating_mul(r.into())) + // Minimum execution time: 82_650_000 picoseconds. + Weight::from_parts(79_085_060, 0) + // Standard Error: 293_080 + .saturating_add(Weight::from_parts(77_346_019, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_586_000 picoseconds. - Weight::from_parts(73_401_225, 0) - // Standard Error: 306_089 - .saturating_add(Weight::from_parts(115_530_298, 0).saturating_mul(r.into())) + // Minimum execution time: 83_545_000 picoseconds. + Weight::from_parts(72_777_984, 0) + // Standard Error: 351_302 + .saturating_add(Weight::from_parts(80_634_984, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_537_000 picoseconds. - Weight::from_parts(80_327_682, 0) - // Standard Error: 275_679 - .saturating_add(Weight::from_parts(114_024_859, 0).saturating_mul(r.into())) + // Minimum execution time: 83_245_000 picoseconds. + Weight::from_parts(76_181_868, 0) + // Standard Error: 354_266 + .saturating_add(Weight::from_parts(79_459_120, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_226_000 picoseconds. - Weight::from_parts(74_308_323, 0) - // Standard Error: 291_460 - .saturating_add(Weight::from_parts(115_396_428, 0).saturating_mul(r.into())) + // Minimum execution time: 85_064_000 picoseconds. + Weight::from_parts(77_882_516, 0) + // Standard Error: 377_997 + .saturating_add(Weight::from_parts(78_533_852, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_250_000 picoseconds. - Weight::from_parts(74_761_588, 0) - // Standard Error: 317_797 - .saturating_add(Weight::from_parts(115_173_001, 0).saturating_mul(r.into())) + // Minimum execution time: 83_522_000 picoseconds. + Weight::from_parts(66_328_137, 0) + // Standard Error: 360_143 + .saturating_add(Weight::from_parts(79_838_604, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_673_000 picoseconds. - Weight::from_parts(70_907_772, 0) - // Standard Error: 347_682 - .saturating_add(Weight::from_parts(118_189_625, 0).saturating_mul(r.into())) + // Minimum execution time: 83_961_000 picoseconds. + Weight::from_parts(72_789_065, 0) + // Standard Error: 366_577 + .saturating_add(Weight::from_parts(79_031_060, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_530_000 picoseconds. - Weight::from_parts(774_384_678, 0) - // Standard Error: 512_748 - .saturating_add(Weight::from_parts(194_331_468, 0).saturating_mul(r.into())) + // Minimum execution time: 700_686_000 picoseconds. + Weight::from_parts(749_297_529, 0) + // Standard Error: 383_897 + .saturating_add(Weight::from_parts(132_242_102, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 866_889_000 picoseconds. - Weight::from_parts(872_993_000, 0) - // Standard Error: 59_048 - .saturating_add(Weight::from_parts(13_399_620, 0).saturating_mul(n.into())) + // Minimum execution time: 830_957_000 picoseconds. + Weight::from_parts(850_017_000, 0) + // Standard Error: 67_693 + .saturating_add(Weight::from_parts(13_570_326, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_291_000 picoseconds. - Weight::from_parts(75_543_485, 0) - // Standard Error: 320_701 - .saturating_add(Weight::from_parts(115_757_456, 0).saturating_mul(r.into())) + // Minimum execution time: 84_261_000 picoseconds. + Weight::from_parts(70_573_139, 0) + // Standard Error: 351_239 + .saturating_add(Weight::from_parts(80_441_776, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_780_000 picoseconds. - Weight::from_parts(68_090_338, 0) - // Standard Error: 330_050 - .saturating_add(Weight::from_parts(117_803_137, 0).saturating_mul(r.into())) + // Minimum execution time: 84_164_000 picoseconds. + Weight::from_parts(70_866_987, 0) + // Standard Error: 346_107 + .saturating_add(Weight::from_parts(82_471_591, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_394_000 picoseconds. - Weight::from_parts(88_472_912, 0) - // Standard Error: 340_524 - .saturating_add(Weight::from_parts(190_044_477, 0).saturating_mul(n.into())) + // Minimum execution time: 81_192_000 picoseconds. + Weight::from_parts(101_814_078, 0) + // Standard Error: 391_508 + .saturating_add(Weight::from_parts(166_873_282, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_081_000 picoseconds. - Weight::from_parts(85_006_000, 0) - // Standard Error: 3_456_961 - .saturating_add(Weight::from_parts(860_188_117, 0).saturating_mul(r.into())) + // Minimum execution time: 84_974_000 picoseconds. + Weight::from_parts(87_244_000, 0) + // Standard Error: 3_619_557 + .saturating_add(Weight::from_parts(749_950_767, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_490_000 picoseconds. - Weight::from_parts(136_619_765, 0) - // Standard Error: 439_674 - .saturating_add(Weight::from_parts(308_552_304, 0).saturating_mul(r.into())) + // Minimum execution time: 81_612_000 picoseconds. + Weight::from_parts(147_822_399, 0) + // Standard Error: 421_408 + .saturating_add(Weight::from_parts(250_730_230, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 386_929_000 picoseconds. - Weight::from_parts(393_325_000, 0) - // Standard Error: 61_932 - .saturating_add(Weight::from_parts(21_101_790, 0).saturating_mul(n.into())) + // Minimum execution time: 332_130_000 picoseconds. + Weight::from_parts(337_780_000, 0) + // Standard Error: 52_652 + .saturating_add(Weight::from_parts(20_743_155, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_625_000 picoseconds. - Weight::from_parts(162_584_483, 0) - // Standard Error: 494_553 - .saturating_add(Weight::from_parts(313_684_139, 0).saturating_mul(r.into())) + // Minimum execution time: 82_722_000 picoseconds. + Weight::from_parts(147_881_270, 0) + // Standard Error: 390_429 + .saturating_add(Weight::from_parts(259_701_373, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 390_932_000 picoseconds. - Weight::from_parts(393_883_000, 0) - // Standard Error: 68_646 - .saturating_add(Weight::from_parts(21_188_381, 0).saturating_mul(n.into())) + // Minimum execution time: 337_753_000 picoseconds. + Weight::from_parts(343_454_000, 0) + // Standard Error: 66_604 + .saturating_add(Weight::from_parts(21_189_034, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 708_623_000 picoseconds. - Weight::from_parts(781_094_266, 0) - // Standard Error: 460_683 - .saturating_add(Weight::from_parts(328_993_362, 0).saturating_mul(r.into())) + // Minimum execution time: 708_454_000 picoseconds. + Weight::from_parts(775_673_824, 0) + // Standard Error: 380_634 + .saturating_add(Weight::from_parts(268_253_890, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 710_228_000 picoseconds. - Weight::from_parts(774_190_634, 0) - // Standard Error: 483_646 - .saturating_add(Weight::from_parts(330_057_876, 0).saturating_mul(r.into())) + // Minimum execution time: 706_799_000 picoseconds. + Weight::from_parts(782_052_003, 0) + // Standard Error: 385_065 + .saturating_add(Weight::from_parts(265_280_556, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_510_000 picoseconds. - Weight::from_parts(64_097_635, 0) - // Standard Error: 358_570 - .saturating_add(Weight::from_parts(126_095_109, 0).saturating_mul(r.into())) + // Minimum execution time: 84_511_000 picoseconds. + Weight::from_parts(61_459_678, 0) + // Standard Error: 362_497 + .saturating_add(Weight::from_parts(87_903_947, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_430_098_000 picoseconds. - Weight::from_parts(2_605_278_898, 0) - // Standard Error: 439_185 - .saturating_add(Weight::from_parts(217_479_981, 0).saturating_mul(r.into())) + // Minimum execution time: 1_676_718_000 picoseconds. + Weight::from_parts(1_838_206_733, 0) + // Standard Error: 440_793 + .saturating_add(Weight::from_parts(156_352_100, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 358_553_000 picoseconds. - Weight::from_parts(364_183_000, 0) - // Standard Error: 51_397 - .saturating_add(Weight::from_parts(30_914_040, 0).saturating_mul(n.into())) + // Minimum execution time: 284_222_000 picoseconds. + Weight::from_parts(293_316_000, 0) + // Standard Error: 54_796 + .saturating_add(Weight::from_parts(30_939_288, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_464_581_000 picoseconds. - Weight::from_parts(2_580_044_243, 0) - // Standard Error: 461_216 - .saturating_add(Weight::from_parts(272_575_116, 0).saturating_mul(r.into())) + // Minimum execution time: 1_682_466_000 picoseconds. + Weight::from_parts(1_829_413_701, 0) + // Standard Error: 510_421 + .saturating_add(Weight::from_parts(216_009_232, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_438_114_000 picoseconds. - Weight::from_parts(2_597_881_615, 0) - // Standard Error: 400_982 - .saturating_add(Weight::from_parts(275_718_502, 0).saturating_mul(r.into())) + // Minimum execution time: 1_681_160_000 picoseconds. + Weight::from_parts(1_819_797_788, 0) + // Standard Error: 453_707 + .saturating_add(Weight::from_parts(215_589_534, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 244_206_000 picoseconds. - Weight::from_parts(321_175_021, 0) - // Standard Error: 460_445 - .saturating_add(Weight::from_parts(322_059_081, 0).saturating_mul(r.into())) + // Minimum execution time: 242_556_000 picoseconds. + Weight::from_parts(314_306_159, 0) + // Standard Error: 376_142 + .saturating_add(Weight::from_parts(260_614_468, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 559_346_000 picoseconds. - Weight::from_parts(571_004_000, 0) - // Standard Error: 59_840 - .saturating_add(Weight::from_parts(21_370_093, 0).saturating_mul(n.into())) + // Minimum execution time: 495_430_000 picoseconds. + Weight::from_parts(502_714_000, 0) + // Standard Error: 52_049 + .saturating_add(Weight::from_parts(21_259_132, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_620_633_000 picoseconds. - Weight::from_parts(2_741_869_292, 0) - // Standard Error: 620_120 - .saturating_add(Weight::from_parts(289_781_719, 0).saturating_mul(r.into())) + // Minimum execution time: 1_809_658_000 picoseconds. + Weight::from_parts(2_002_681_446, 0) + // Standard Error: 414_919 + .saturating_add(Weight::from_parts(227_942_929, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_438_000 picoseconds. - Weight::from_parts(86_817_816, 0) - // Standard Error: 234_731 - .saturating_add(Weight::from_parts(19_849_283, 0).saturating_mul(r.into())) + // Minimum execution time: 80_821_000 picoseconds. + Weight::from_parts(84_783_126, 0) + // Standard Error: 234_696 + .saturating_add(Weight::from_parts(22_124_873, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_002_000 picoseconds. - Weight::from_parts(88_114_999, 0) - // Standard Error: 1_128 - .saturating_add(Weight::from_parts(427_426, 0).saturating_mul(n.into())) + // Minimum execution time: 100_040_000 picoseconds. + Weight::from_parts(92_861_700, 0) + // Standard Error: 1_021 + .saturating_add(Weight::from_parts(419_414, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_436_000 picoseconds. - Weight::from_parts(88_440_285, 0) - // Standard Error: 277_544 - .saturating_add(Weight::from_parts(17_399_914, 0).saturating_mul(r.into())) + // Minimum execution time: 80_986_000 picoseconds. + Weight::from_parts(85_723_530, 0) + // Standard Error: 278_519 + .saturating_add(Weight::from_parts(19_484_469, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 103_800_000 picoseconds. - Weight::from_parts(89_756_983, 0) - // Standard Error: 907 - .saturating_add(Weight::from_parts(428_998, 0).saturating_mul(n.into())) + // Minimum execution time: 104_879_000 picoseconds. + Weight::from_parts(88_056_044, 0) + // Standard Error: 1_087 + .saturating_add(Weight::from_parts(427_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_754_000 picoseconds. - Weight::from_parts(87_296_014, 0) - // Standard Error: 336_747 - .saturating_add(Weight::from_parts(20_299_385, 0).saturating_mul(r.into())) + // Minimum execution time: 80_548_000 picoseconds. + Weight::from_parts(84_139_208, 0) + // Standard Error: 235_150 + .saturating_add(Weight::from_parts(17_533_491, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_952_000 picoseconds. - Weight::from_parts(86_840_575, 0) - // Standard Error: 272_708 - .saturating_add(Weight::from_parts(19_217_524, 0).saturating_mul(r.into())) + // Minimum execution time: 84_118_000 picoseconds. + Weight::from_parts(88_086_604, 0) + // Standard Error: 244_958 + .saturating_add(Weight::from_parts(17_286_195, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_498_000 picoseconds. - Weight::from_parts(126_431_779, 0) - // Standard Error: 460_480 - .saturating_add(Weight::from_parts(198_940_536, 0).saturating_mul(r.into())) + // Minimum execution time: 83_393_000 picoseconds. + Weight::from_parts(132_631_342, 0) + // Standard Error: 436_134 + .saturating_add(Weight::from_parts(141_520_417, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_862_000 picoseconds. - Weight::from_parts(98_611_000, 0) - // Standard Error: 2_677 - .saturating_add(Weight::from_parts(662_266, 0).saturating_mul(n.into())) + // Minimum execution time: 97_567_000 picoseconds. + Weight::from_parts(99_600_000, 0) + // Standard Error: 2_187 + .saturating_add(Weight::from_parts(639_729, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 698_914_000 picoseconds. - Weight::from_parts(718_405_100, 0) - // Standard Error: 1_891_960 - .saturating_add(Weight::from_parts(24_867_800, 0).saturating_mul(r.into())) + // Minimum execution time: 696_739_000 picoseconds. + Weight::from_parts(711_247_336, 0) + // Standard Error: 1_403_605 + .saturating_add(Weight::from_parts(15_869_663, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 699_975_000 picoseconds. - Weight::from_parts(718_806_789, 0) - // Standard Error: 1_919_531 - .saturating_add(Weight::from_parts(51_192_710, 0).saturating_mul(r.into())) + // Minimum execution time: 697_432_000 picoseconds. + Weight::from_parts(712_096_565, 0) + // Standard Error: 1_674_352 + .saturating_add(Weight::from_parts(32_103_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_002_000 picoseconds. - Weight::from_parts(99_331_989, 0) - // Standard Error: 287_602 - .saturating_add(Weight::from_parts(9_719_710, 0).saturating_mul(r.into())) + // Minimum execution time: 92_685_000 picoseconds. + Weight::from_parts(96_156_389, 0) + // Standard Error: 262_969 + .saturating_add(Weight::from_parts(8_983_510, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_501_000 picoseconds. - Weight::from_parts(87_026_327, 0) - // Standard Error: 1_214 - .saturating_add(Weight::from_parts(429_134, 0).saturating_mul(n.into())) + // Minimum execution time: 105_746_000 picoseconds. + Weight::from_parts(89_918_273, 0) + // Standard Error: 1_055 + .saturating_add(Weight::from_parts(427_838, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_228_000 picoseconds. - Weight::from_parts(97_923_691, 0) - // Standard Error: 288_469 - .saturating_add(Weight::from_parts(9_669_908, 0).saturating_mul(r.into())) + // Minimum execution time: 95_634_000 picoseconds. + Weight::from_parts(99_574_926, 0) + // Standard Error: 267_301 + .saturating_add(Weight::from_parts(3_125_673, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_908_000 picoseconds. - Weight::from_parts(87_613_705, 0) - // Standard Error: 1_237 - .saturating_add(Weight::from_parts(431_412, 0).saturating_mul(n.into())) + // Minimum execution time: 99_268_000 picoseconds. + Weight::from_parts(93_140_981, 0) + // Standard Error: 1_101 + .saturating_add(Weight::from_parts(419_078, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_385_000 picoseconds. - Weight::from_parts(74_453_057, 0) - // Standard Error: 309_931 - .saturating_add(Weight::from_parts(117_172_527, 0).saturating_mul(r.into())) + // Minimum execution time: 83_167_000 picoseconds. + Weight::from_parts(80_305_860, 0) + // Standard Error: 357_986 + .saturating_add(Weight::from_parts(80_422_820, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_437_000 picoseconds. - Weight::from_parts(78_951_443, 0) - // Standard Error: 294_227 - .saturating_add(Weight::from_parts(116_066_384, 0).saturating_mul(r.into())) + // Minimum execution time: 81_137_000 picoseconds. + Weight::from_parts(76_881_656, 0) + // Standard Error: 302_504 + .saturating_add(Weight::from_parts(80_036_963, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 704_954_000 picoseconds. - Weight::from_parts(752_735_182, 0) - // Standard Error: 455_998 - .saturating_add(Weight::from_parts(135_154_607, 0).saturating_mul(r.into())) + // Minimum execution time: 707_922_000 picoseconds. + Weight::from_parts(767_820_244, 0) + // Standard Error: 418_647 + .saturating_add(Weight::from_parts(97_993_049, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 724_451_000 picoseconds. - Weight::from_parts(738_722_668, 0) - // Standard Error: 1_014 - .saturating_add(Weight::from_parts(154_329, 0).saturating_mul(n.into())) + // Minimum execution time: 724_683_000 picoseconds. + Weight::from_parts(732_157_836, 0) + // Standard Error: 618 + .saturating_add(Weight::from_parts(151_809, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_092_586_000 picoseconds. - Weight::from_parts(3_231_311_035, 0) - // Standard Error: 506_742 - .saturating_add(Weight::from_parts(159_545_582, 0).saturating_mul(r.into())) + // Minimum execution time: 2_304_055_000 picoseconds. + Weight::from_parts(2_435_844_780, 0) + // Standard Error: 420_214 + .saturating_add(Weight::from_parts(120_405_108, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_299_872_000 picoseconds. - Weight::from_parts(3_317_022_894, 0) - // Standard Error: 8_542 - .saturating_add(Weight::from_parts(13_645_472, 0).saturating_mul(n.into())) + // Minimum execution time: 2_431_524_000 picoseconds. + Weight::from_parts(2_669_711_936, 0) + // Standard Error: 12_819 + .saturating_add(Weight::from_parts(13_546_418, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_966_000 picoseconds. - Weight::from_parts(106_319_310, 0) - // Standard Error: 424_534 - .saturating_add(Weight::from_parts(139_885_203, 0).saturating_mul(r.into())) + // Minimum execution time: 85_238_000 picoseconds. + Weight::from_parts(104_905_012, 0) + // Standard Error: 392_000 + .saturating_add(Weight::from_parts(116_570_175, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 142_910_000 picoseconds. - Weight::from_parts(144_843_000, 0) - // Standard Error: 54_401 - .saturating_add(Weight::from_parts(25_535_472, 0).saturating_mul(n.into())) + // Minimum execution time: 143_132_000 picoseconds. + Weight::from_parts(145_448_000, 0) + // Standard Error: 51_056 + .saturating_add(Weight::from_parts(25_497_066, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_117_000 picoseconds. - Weight::from_parts(80_202_149, 0) - // Standard Error: 296_880 - .saturating_add(Weight::from_parts(114_586_990, 0).saturating_mul(r.into())) + // Minimum execution time: 84_055_000 picoseconds. + Weight::from_parts(75_514_507, 0) + // Standard Error: 342_511 + .saturating_add(Weight::from_parts(78_022_368, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_802_000 picoseconds. - Weight::from_parts(85_064_295, 0) - // Standard Error: 248_874 - .saturating_add(Weight::from_parts(27_314_604, 0).saturating_mul(r.into())) + // Minimum execution time: 83_725_000 picoseconds. + Weight::from_parts(87_574_873, 0) + // Standard Error: 249_331 + .saturating_add(Weight::from_parts(24_890_126, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_854_000 picoseconds. - Weight::from_parts(86_180_314, 0) - // Standard Error: 239_162 - .saturating_add(Weight::from_parts(16_391_885, 0).saturating_mul(r.into())) + // Minimum execution time: 82_761_000 picoseconds. + Weight::from_parts(86_511_404, 0) + // Standard Error: 240_746 + .saturating_add(Weight::from_parts(16_767_395, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_883_000 picoseconds. - Weight::from_parts(87_058_214, 0) - // Standard Error: 256_392 - .saturating_add(Weight::from_parts(13_333_285, 0).saturating_mul(r.into())) + // Minimum execution time: 84_794_000 picoseconds. + Weight::from_parts(88_401_167, 0) + // Standard Error: 217_438 + .saturating_add(Weight::from_parts(11_267_632, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_417_000 picoseconds. - Weight::from_parts(85_403_451, 0) - // Standard Error: 249_767 - .saturating_add(Weight::from_parts(14_474_948, 0).saturating_mul(r.into())) + // Minimum execution time: 83_664_000 picoseconds. + Weight::from_parts(89_193_048, 0) + // Standard Error: 336_699 + .saturating_add(Weight::from_parts(12_350_251, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_020_000 picoseconds. - Weight::from_parts(88_080_622, 0) - // Standard Error: 253_221 - .saturating_add(Weight::from_parts(11_403_277, 0).saturating_mul(r.into())) + // Minimum execution time: 83_815_000 picoseconds. + Weight::from_parts(87_397_869, 0) + // Standard Error: 235_037 + .saturating_add(Weight::from_parts(16_313_030, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 138_317_000 picoseconds. - Weight::from_parts(187_894_162, 0) - // Standard Error: 376_519 - .saturating_add(Weight::from_parts(209_723_429, 0).saturating_mul(r.into())) + // Minimum execution time: 139_190_000 picoseconds. + Weight::from_parts(186_267_428, 0) + // Standard Error: 346_204 + .saturating_add(Weight::from_parts(158_103_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_047_000 picoseconds. - Weight::from_parts(151_715_771, 0) - // Standard Error: 425_606 - .saturating_add(Weight::from_parts(396_733_544, 0).saturating_mul(r.into())) + // Minimum execution time: 96_748_000 picoseconds. + Weight::from_parts(148_556_306, 0) + // Standard Error: 400_680 + .saturating_add(Weight::from_parts(333_100_790, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2904,22 +2904,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_923_081_000 picoseconds. - Weight::from_parts(45_981_736_000, 0) - // Standard Error: 274_662 - .saturating_add(Weight::from_parts(6_858_186, 0).saturating_mul(p.into())) - // Standard Error: 274_649 - .saturating_add(Weight::from_parts(177_291_831, 0).saturating_mul(s.into())) + // Minimum execution time: 44_452_286_000 picoseconds. + Weight::from_parts(44_568_744_000, 0) + // Standard Error: 268_880 + .saturating_add(Weight::from_parts(7_444_126, 0).saturating_mul(p.into())) + // Standard Error: 268_867 + .saturating_add(Weight::from_parts(179_724_917, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_680_000 picoseconds. - Weight::from_parts(157_350_147, 0) - // Standard Error: 440_994 - .saturating_add(Weight::from_parts(402_511_567, 0).saturating_mul(r.into())) + // Minimum execution time: 96_042_000 picoseconds. + Weight::from_parts(163_443_462, 0) + // Standard Error: 381_777 + .saturating_add(Weight::from_parts(338_839_702, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2927,32 +2927,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_842_395_000 picoseconds. - Weight::from_parts(42_890_931_000, 0) - // Standard Error: 264_187 - .saturating_add(Weight::from_parts(7_896_879, 0).saturating_mul(p.into())) - // Standard Error: 264_174 - .saturating_add(Weight::from_parts(178_082_248, 0).saturating_mul(s.into())) + // Minimum execution time: 42_724_116_000 picoseconds. + Weight::from_parts(42_849_968_000, 0) + // Standard Error: 263_445 + .saturating_add(Weight::from_parts(8_197_177, 0).saturating_mul(p.into())) + // Standard Error: 263_432 + .saturating_add(Weight::from_parts(180_050_572, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_272_000 picoseconds. - Weight::from_parts(100_008_395, 0) - // Standard Error: 36_430 - .saturating_add(Weight::from_parts(2_544_223, 0).saturating_mul(r.into())) + // Minimum execution time: 86_607_000 picoseconds. + Weight::from_parts(100_957_693, 0) + // Standard Error: 29_067 + .saturating_add(Weight::from_parts(1_762_813, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_139_000 picoseconds. - Weight::from_parts(122_967_835, 1131) - // Standard Error: 6_454 - .saturating_add(Weight::from_parts(11_784_103, 0).saturating_mul(p.into())) + // Minimum execution time: 87_305_000 picoseconds. + Weight::from_parts(108_825_748, 1131) + // Standard Error: 5_956 + .saturating_add(Weight::from_parts(11_809_647, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2961,10 +2961,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_229_000 picoseconds. - Weight::from_parts(83_885_000, 1131) - // Standard Error: 37_558 - .saturating_add(Weight::from_parts(35_503_677, 0).saturating_mul(p.into())) + // Minimum execution time: 87_531_000 picoseconds. + Weight::from_parts(88_749_000, 1131) + // Standard Error: 27_438 + .saturating_add(Weight::from_parts(35_435_114, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2973,10 +2973,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_139_187_000 picoseconds. - Weight::from_parts(5_806_599_304, 5069931) - // Standard Error: 75_881 - .saturating_add(Weight::from_parts(36_513_688, 0).saturating_mul(p.into())) + // Minimum execution time: 6_087_078_000 picoseconds. + Weight::from_parts(5_882_681_000, 5069931) + // Standard Error: 87_545 + .saturating_add(Weight::from_parts(37_047_042, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -2984,10 +2984,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_177_000 picoseconds. - Weight::from_parts(83_595_000, 1939) - // Standard Error: 45_778 - .saturating_add(Weight::from_parts(47_155_630, 0).saturating_mul(p.into())) + // Minimum execution time: 85_432_000 picoseconds. + Weight::from_parts(87_001_000, 1939) + // Standard Error: 47_768 + .saturating_add(Weight::from_parts(47_598_234, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -2996,10 +2996,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 90_231_000 picoseconds. - Weight::from_parts(95_944_378, 1131) - // Standard Error: 61_821 - .saturating_add(Weight::from_parts(35_941_066, 0).saturating_mul(p.into())) + // Minimum execution time: 92_594_000 picoseconds. + Weight::from_parts(93_795_036, 1131) + // Standard Error: 53_549 + .saturating_add(Weight::from_parts(35_797_869, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3008,10 +3008,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 734_006_000 picoseconds. - Weight::from_parts(717_384_508, 1496) - // Standard Error: 375_292 - .saturating_add(Weight::from_parts(47_930_581, 0).saturating_mul(p.into())) + // Minimum execution time: 769_397_000 picoseconds. + Weight::from_parts(792_321_925, 1496) + // Standard Error: 237_986 + .saturating_add(Weight::from_parts(48_847_504, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3020,10 +3020,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_121_849_000 picoseconds. - Weight::from_parts(1_147_558_033, 317931) - // Standard Error: 373_146 - .saturating_add(Weight::from_parts(45_393_418, 0).saturating_mul(p.into())) + // Minimum execution time: 1_113_735_000 picoseconds. + Weight::from_parts(1_148_020_828, 317931) + // Standard Error: 167_371 + .saturating_add(Weight::from_parts(47_795_831, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3031,884 +3031,884 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_162_000 picoseconds. - Weight::from_parts(2_220_392, 0) - // Standard Error: 8_848 - .saturating_add(Weight::from_parts(24_205_605, 0).saturating_mul(r.into())) + // Minimum execution time: 4_154_000 picoseconds. + Weight::from_parts(4_280_364, 0) + // Standard Error: 8_638 + .saturating_add(Weight::from_parts(24_150_721, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_352_664_000 picoseconds. - Weight::from_parts(4_153_366_897, 0) - // Standard Error: 60_193 - .saturating_add(Weight::from_parts(4_722_164, 0).saturating_mul(r.into())) + // Minimum execution time: 4_339_689_000 picoseconds. + Weight::from_parts(4_202_598_633, 0) + // Standard Error: 74_721 + .saturating_add(Weight::from_parts(4_468_109, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_357_649_000 picoseconds. - Weight::from_parts(4_256_499_798, 0) - // Standard Error: 57_942 - .saturating_add(Weight::from_parts(4_200_870, 0).saturating_mul(r.into())) + // Minimum execution time: 4_343_068_000 picoseconds. + Weight::from_parts(4_226_706_212, 0) + // Standard Error: 60_538 + .saturating_add(Weight::from_parts(4_325_162, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_269_998_000 picoseconds. - Weight::from_parts(11_525_100_351, 0) - // Standard Error: 204_230 - .saturating_add(Weight::from_parts(8_423_588, 0).saturating_mul(r.into())) + // Minimum execution time: 11_409_473_000 picoseconds. + Weight::from_parts(11_882_222_938, 0) + // Standard Error: 194_167 + .saturating_add(Weight::from_parts(8_210_890, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_204_810_000 picoseconds. - Weight::from_parts(10_982_673_143, 0) - // Standard Error: 145_327 - .saturating_add(Weight::from_parts(9_198_033, 0).saturating_mul(r.into())) + // Minimum execution time: 10_212_512_000 picoseconds. + Weight::from_parts(10_628_957_808, 0) + // Standard Error: 170_508 + .saturating_add(Weight::from_parts(11_560_237, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_074_000 picoseconds. - Weight::from_parts(2_108_000, 0) - // Standard Error: 9_031 - .saturating_add(Weight::from_parts(3_829_182, 0).saturating_mul(r.into())) + // Minimum execution time: 2_229_000 picoseconds. + Weight::from_parts(2_319_000, 0) + // Standard Error: 9_576 + .saturating_add(Weight::from_parts(3_794_717, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_020_000 picoseconds. - Weight::from_parts(2_118_000, 0) - // Standard Error: 5_295 - .saturating_add(Weight::from_parts(2_980_329, 0).saturating_mul(r.into())) + // Minimum execution time: 2_265_000 picoseconds. + Weight::from_parts(2_353_000, 0) + // Standard Error: 5_018 + .saturating_add(Weight::from_parts(3_059_511, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_032_000 picoseconds. - Weight::from_parts(3_411_359, 0) - // Standard Error: 1_146 - .saturating_add(Weight::from_parts(1_563_906, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(3_531_925, 0) + // Standard Error: 1_167 + .saturating_add(Weight::from_parts(1_569_201, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_096_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 8_349 - .saturating_add(Weight::from_parts(2_904_673, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(2_359_000, 0) + // Standard Error: 9_672 + .saturating_add(Weight::from_parts(2_884_305, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_128_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 8_100 - .saturating_add(Weight::from_parts(5_229_400, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 8_373 + .saturating_add(Weight::from_parts(5_256_648, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_838_000 picoseconds. - Weight::from_parts(5_309_346, 0) - // Standard Error: 2_580 - .saturating_add(Weight::from_parts(129_982, 0).saturating_mul(e.into())) + // Minimum execution time: 7_012_000 picoseconds. + Weight::from_parts(4_938_253, 0) + // Standard Error: 2_214 + .saturating_add(Weight::from_parts(151_870, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(3_593_285, 0) - // Standard Error: 6_648 - .saturating_add(Weight::from_parts(2_597_926, 0).saturating_mul(r.into())) + // Minimum execution time: 2_309_000 picoseconds. + Weight::from_parts(4_232_448, 0) + // Standard Error: 6_359 + .saturating_add(Weight::from_parts(2_596_672, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_597_926 - - 2_429_048, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_596_672 - + 2_404_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_086_000 picoseconds. - Weight::from_parts(3_972_773, 0) - // Standard Error: 12_538 - .saturating_add(Weight::from_parts(2_429_048, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(4_432_470, 0) + // Standard Error: 11_941 + .saturating_add(Weight::from_parts(2_404_212, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_591_000 picoseconds. - Weight::from_parts(12_798_134, 0) - // Standard Error: 23_023 - .saturating_add(Weight::from_parts(9_786_464, 0).saturating_mul(r.into())) + // Minimum execution time: 2_776_000 picoseconds. + Weight::from_parts(12_954_286, 0) + // Standard Error: 30_568 + .saturating_add(Weight::from_parts(10_260_958, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_274_000 picoseconds. - Weight::from_parts(1_706_188, 0) - // Standard Error: 6_199 - .saturating_add(Weight::from_parts(1_212_443, 0).saturating_mul(p.into())) + // Minimum execution time: 11_935_000 picoseconds. + Weight::from_parts(1_635_475, 0) + // Standard Error: 7_669 + .saturating_add(Weight::from_parts(1_285_084, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_221_000 picoseconds. - Weight::from_parts(5_538_574, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(12, 0).saturating_mul(l.into())) + // Minimum execution time: 5_316_000 picoseconds. + Weight::from_parts(5_699_758, 0) + // Standard Error: 13 + .saturating_add(Weight::from_parts(34, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(1_785_103, 0) - // Standard Error: 2_948 - .saturating_add(Weight::from_parts(249_981, 0).saturating_mul(r.into())) + // Minimum execution time: 2_315_000 picoseconds. + Weight::from_parts(2_460_643, 0) + // Standard Error: 2_850 + .saturating_add(Weight::from_parts(235_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_123_000 picoseconds. - Weight::from_parts(2_187_000, 0) - // Standard Error: 5_664 - .saturating_add(Weight::from_parts(719_187, 0).saturating_mul(r.into())) + // Minimum execution time: 2_202_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 6_150 + .saturating_add(Weight::from_parts(730_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_214_000, 0) - // Standard Error: 5_625 - .saturating_add(Weight::from_parts(709_067, 0).saturating_mul(r.into())) + // Minimum execution time: 2_244_000 picoseconds. + Weight::from_parts(2_338_000, 0) + // Standard Error: 5_205 + .saturating_add(Weight::from_parts(679_669, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_168_000 picoseconds. - Weight::from_parts(2_290_203, 0) - // Standard Error: 8_984 - .saturating_add(Weight::from_parts(761_843, 0).saturating_mul(r.into())) + // Minimum execution time: 6_412_000 picoseconds. + Weight::from_parts(2_087_064, 0) + // Standard Error: 9_824 + .saturating_add(Weight::from_parts(743_737, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_249_000 picoseconds. - Weight::from_parts(6_302_000, 0) - // Standard Error: 8_682 - .saturating_add(Weight::from_parts(1_329_653, 0).saturating_mul(r.into())) + // Minimum execution time: 6_388_000 picoseconds. + Weight::from_parts(6_512_000, 0) + // Standard Error: 7_958 + .saturating_add(Weight::from_parts(1_283_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_791_000 picoseconds. - Weight::from_parts(3_929_000, 0) - // Standard Error: 9_270 - .saturating_add(Weight::from_parts(6_742_685, 0).saturating_mul(r.into())) + // Minimum execution time: 6_885_000 picoseconds. + Weight::from_parts(4_075_795, 0) + // Standard Error: 12_241 + .saturating_add(Weight::from_parts(6_965_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_113_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 6_734 - .saturating_add(Weight::from_parts(3_327_207, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 5_936 + .saturating_add(Weight::from_parts(3_299_707, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_141_000, 0) - // Standard Error: 6_506 - .saturating_add(Weight::from_parts(3_061_891, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 6_255 + .saturating_add(Weight::from_parts(2_999_382, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_108_000 picoseconds. - Weight::from_parts(2_141_000, 0) - // Standard Error: 6_738 - .saturating_add(Weight::from_parts(3_101_844, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_271_000, 0) + // Standard Error: 6_896 + .saturating_add(Weight::from_parts(2_967_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_138_000 picoseconds. - Weight::from_parts(2_155_000, 0) - // Standard Error: 4_379 - .saturating_add(Weight::from_parts(2_613_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_268_000, 0) + // Standard Error: 4_893 + .saturating_add(Weight::from_parts(2_579_110, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_046_000 picoseconds. - Weight::from_parts(2_127_000, 0) - // Standard Error: 3_513 - .saturating_add(Weight::from_parts(525_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_304_000, 0) + // Standard Error: 3_852 + .saturating_add(Weight::from_parts(520_005, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(1_669_179, 0) - // Standard Error: 2_817 - .saturating_add(Weight::from_parts(367_599, 0).saturating_mul(r.into())) + // Minimum execution time: 2_274_000 picoseconds. + Weight::from_parts(1_794_591, 0) + // Standard Error: 3_416 + .saturating_add(Weight::from_parts(359_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 11_816 - .saturating_add(Weight::from_parts(1_810_781, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_287_000, 0) + // Standard Error: 10_307 + .saturating_add(Weight::from_parts(1_833_775, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_087_000 picoseconds. - Weight::from_parts(2_194_000, 0) - // Standard Error: 7_361 - .saturating_add(Weight::from_parts(1_130_773, 0).saturating_mul(r.into())) + // Minimum execution time: 2_287_000 picoseconds. + Weight::from_parts(2_349_000, 0) + // Standard Error: 9_393 + .saturating_add(Weight::from_parts(1_178_942, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_061_000 picoseconds. - Weight::from_parts(1_850_477, 0) - // Standard Error: 2_695 - .saturating_add(Weight::from_parts(318_827, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_256_508, 0) + // Standard Error: 3_133 + .saturating_add(Weight::from_parts(326_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_115_000 picoseconds. - Weight::from_parts(1_764_589, 0) - // Standard Error: 2_923 - .saturating_add(Weight::from_parts(329_840, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(1_792_383, 0) + // Standard Error: 2_981 + .saturating_add(Weight::from_parts(325_072, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_109_000 picoseconds. - Weight::from_parts(859_995, 0) - // Standard Error: 4_546 - .saturating_add(Weight::from_parts(467_944, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(236_190, 0) + // Standard Error: 5_791 + .saturating_add(Weight::from_parts(526_784, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_010_000 picoseconds. - Weight::from_parts(2_081_000, 0) - // Standard Error: 3_959 - .saturating_add(Weight::from_parts(472_947, 0).saturating_mul(r.into())) + // Minimum execution time: 2_278_000 picoseconds. + Weight::from_parts(18_346, 0) + // Standard Error: 5_882 + .saturating_add(Weight::from_parts(538_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_105_000 picoseconds. - Weight::from_parts(1_247_124, 0) - // Standard Error: 4_390 - .saturating_add(Weight::from_parts(436_907, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 4_502 + .saturating_add(Weight::from_parts(463_034, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_140_000 picoseconds. - Weight::from_parts(2_251_532, 0) - // Standard Error: 2_995 - .saturating_add(Weight::from_parts(280_490, 0).saturating_mul(r.into())) + // Minimum execution time: 2_272_000 picoseconds. + Weight::from_parts(2_193_450, 0) + // Standard Error: 3_655 + .saturating_add(Weight::from_parts(304_226, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_119_000 picoseconds. - Weight::from_parts(2_808_547, 0) - // Standard Error: 1_453 - .saturating_add(Weight::from_parts(143_409, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_803_358, 0) + // Standard Error: 2_256 + .saturating_add(Weight::from_parts(163_489, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_043_000 picoseconds. - Weight::from_parts(2_639_820, 0) - // Standard Error: 1_638 - .saturating_add(Weight::from_parts(159_792, 0).saturating_mul(r.into())) + // Minimum execution time: 2_242_000 picoseconds. + Weight::from_parts(3_087_274, 0) + // Standard Error: 1_907 + .saturating_add(Weight::from_parts(146_988, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_128_000 picoseconds. - Weight::from_parts(2_166_000, 0) - // Standard Error: 11_777 - .saturating_add(Weight::from_parts(1_709_510, 0).saturating_mul(r.into())) + // Minimum execution time: 2_268_000 picoseconds. + Weight::from_parts(2_335_000, 0) + // Standard Error: 9_220 + .saturating_add(Weight::from_parts(1_682_986, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_100_000 picoseconds. - Weight::from_parts(2_136_000, 0) - // Standard Error: 7_491 - .saturating_add(Weight::from_parts(1_105_807, 0).saturating_mul(r.into())) + // Minimum execution time: 2_244_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 7_751 + .saturating_add(Weight::from_parts(1_073_438, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_088_000 picoseconds. - Weight::from_parts(2_171_000, 0) - // Standard Error: 11_841 - .saturating_add(Weight::from_parts(1_785_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_225_000 picoseconds. + Weight::from_parts(2_297_000, 0) + // Standard Error: 9_887 + .saturating_add(Weight::from_parts(1_746_888, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_042_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 7_479 - .saturating_add(Weight::from_parts(1_086_144, 0).saturating_mul(r.into())) + // Minimum execution time: 2_225_000 picoseconds. + Weight::from_parts(2_305_000, 0) + // Standard Error: 8_241 + .saturating_add(Weight::from_parts(1_123_968, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_109_000 picoseconds. - Weight::from_parts(2_151_000, 0) - // Standard Error: 13_111 - .saturating_add(Weight::from_parts(1_829_000, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(2_368_000, 0) + // Standard Error: 10_199 + .saturating_add(Weight::from_parts(1_754_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_153_000, 0) - // Standard Error: 7_632 - .saturating_add(Weight::from_parts(1_102_522, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 7_885 + .saturating_add(Weight::from_parts(1_054_096, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_155_000 picoseconds. - Weight::from_parts(2_231_000, 0) - // Standard Error: 11_689 - .saturating_add(Weight::from_parts(1_768_866, 0).saturating_mul(r.into())) + // Minimum execution time: 2_212_000 picoseconds. + Weight::from_parts(2_244_000, 0) + // Standard Error: 11_272 + .saturating_add(Weight::from_parts(1_769_874, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_163_000, 0) - // Standard Error: 7_348 - .saturating_add(Weight::from_parts(1_057_058, 0).saturating_mul(r.into())) + // Minimum execution time: 2_248_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 8_360 + .saturating_add(Weight::from_parts(1_115_362, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_142_000, 0) - // Standard Error: 12_173 - .saturating_add(Weight::from_parts(1_786_184, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 9_424 + .saturating_add(Weight::from_parts(1_807_643, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_206_000, 0) - // Standard Error: 7_244 - .saturating_add(Weight::from_parts(1_066_057, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 7_499 + .saturating_add(Weight::from_parts(1_087_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_090_000 picoseconds. - Weight::from_parts(2_175_000, 0) - // Standard Error: 11_967 - .saturating_add(Weight::from_parts(1_782_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 11_743 + .saturating_add(Weight::from_parts(1_703_075, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_091_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 7_205 - .saturating_add(Weight::from_parts(1_048_140, 0).saturating_mul(r.into())) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_254_000, 0) + // Standard Error: 8_099 + .saturating_add(Weight::from_parts(1_080_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_164_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 12_228 - .saturating_add(Weight::from_parts(1_792_751, 0).saturating_mul(r.into())) + // Minimum execution time: 2_183_000 picoseconds. + Weight::from_parts(2_301_000, 0) + // Standard Error: 10_230 + .saturating_add(Weight::from_parts(1_738_567, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_186_000, 0) - // Standard Error: 7_822 - .saturating_add(Weight::from_parts(1_052_385, 0).saturating_mul(r.into())) + // Minimum execution time: 2_209_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 8_536 + .saturating_add(Weight::from_parts(1_161_928, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_055_000 picoseconds. - Weight::from_parts(2_135_000, 0) - // Standard Error: 12_011 - .saturating_add(Weight::from_parts(1_789_504, 0).saturating_mul(r.into())) + // Minimum execution time: 2_208_000 picoseconds. + Weight::from_parts(2_255_000, 0) + // Standard Error: 10_368 + .saturating_add(Weight::from_parts(1_847_441, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_447_000 picoseconds. - Weight::from_parts(2_540_000, 0) - // Standard Error: 7_696 - .saturating_add(Weight::from_parts(1_062_612, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(2_299_000, 0) + // Standard Error: 8_213 + .saturating_add(Weight::from_parts(1_112_048, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_107_000, 0) - // Standard Error: 12_070 - .saturating_add(Weight::from_parts(1_771_498, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_270_000, 0) + // Standard Error: 12_684 + .saturating_add(Weight::from_parts(1_728_765, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_123_000 picoseconds. - Weight::from_parts(2_156_000, 0) - // Standard Error: 7_108 - .saturating_add(Weight::from_parts(1_072_471, 0).saturating_mul(r.into())) + // Minimum execution time: 2_573_000 picoseconds. + Weight::from_parts(2_655_000, 0) + // Standard Error: 7_404 + .saturating_add(Weight::from_parts(1_080_080, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_145_000, 0) - // Standard Error: 11_990 - .saturating_add(Weight::from_parts(1_786_273, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_316_000, 0) + // Standard Error: 9_739 + .saturating_add(Weight::from_parts(1_807_913, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_059_000 picoseconds. - Weight::from_parts(2_122_000, 0) - // Standard Error: 7_164 - .saturating_add(Weight::from_parts(1_070_909, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 7_265 + .saturating_add(Weight::from_parts(1_087_210, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_065_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 7_265 - .saturating_add(Weight::from_parts(1_152_228, 0).saturating_mul(r.into())) + // Minimum execution time: 2_252_000 picoseconds. + Weight::from_parts(2_311_000, 0) + // Standard Error: 7_444 + .saturating_add(Weight::from_parts(1_191_685, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_160_000, 0) - // Standard Error: 5_101 - .saturating_add(Weight::from_parts(578_660, 0).saturating_mul(r.into())) + // Minimum execution time: 2_263_000 picoseconds. + Weight::from_parts(2_320_000, 0) + // Standard Error: 5_023 + .saturating_add(Weight::from_parts(585_667, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_130_000 picoseconds. - Weight::from_parts(2_184_000, 0) - // Standard Error: 9_299 - .saturating_add(Weight::from_parts(1_257_633, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_320_000, 0) + // Standard Error: 10_018 + .saturating_add(Weight::from_parts(1_297_791, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_119_000 picoseconds. - Weight::from_parts(2_262_000, 0) - // Standard Error: 3_957 - .saturating_add(Weight::from_parts(557_957, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_312_000, 0) + // Standard Error: 4_776 + .saturating_add(Weight::from_parts(612_864, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_045_000 picoseconds. - Weight::from_parts(2_157_000, 0) - // Standard Error: 10_839 - .saturating_add(Weight::from_parts(1_686_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_286_000 picoseconds. + Weight::from_parts(2_356_000, 0) + // Standard Error: 11_619 + .saturating_add(Weight::from_parts(1_743_809, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 7_276 - .saturating_add(Weight::from_parts(1_096_252, 0).saturating_mul(r.into())) + // Minimum execution time: 2_302_000 picoseconds. + Weight::from_parts(2_343_000, 0) + // Standard Error: 8_638 + .saturating_add(Weight::from_parts(1_136_060, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(1_434_170, 0) - // Standard Error: 21_965 - .saturating_add(Weight::from_parts(2_633_663, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 7_114 + .saturating_add(Weight::from_parts(2_599_346, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_098_000 picoseconds. - Weight::from_parts(2_122_681, 0) - // Standard Error: 10_815 - .saturating_add(Weight::from_parts(2_335_842, 0).saturating_mul(r.into())) + // Minimum execution time: 2_200_000 picoseconds. + Weight::from_parts(3_823_403, 0) + // Standard Error: 18_912 + .saturating_add(Weight::from_parts(2_161_963, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(145_632, 0) - // Standard Error: 12_320 - .saturating_add(Weight::from_parts(2_992_427, 0).saturating_mul(r.into())) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_817_173, 0) + // Standard Error: 17_341 + .saturating_add(Weight::from_parts(2_740_748, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_142_000 picoseconds. - Weight::from_parts(2_180_000, 0) - // Standard Error: 4_944 - .saturating_add(Weight::from_parts(2_466_854, 0).saturating_mul(r.into())) + // Minimum execution time: 2_294_000 picoseconds. + Weight::from_parts(88_235, 0) + // Standard Error: 10_326 + .saturating_add(Weight::from_parts(2_481_087, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_143_000 picoseconds. - Weight::from_parts(2_204_000, 0) - // Standard Error: 14_500 - .saturating_add(Weight::from_parts(9_530_241, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 14_480 + .saturating_add(Weight::from_parts(9_604_981, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_132_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 22_303 - .saturating_add(Weight::from_parts(7_508_848, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_260_000, 0) + // Standard Error: 21_926 + .saturating_add(Weight::from_parts(7_501_289, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_133_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 5_407 - .saturating_add(Weight::from_parts(2_948_013, 0).saturating_mul(r.into())) + // Minimum execution time: 2_309_000 picoseconds. + Weight::from_parts(10_308_173, 0) + // Standard Error: 30_680 + .saturating_add(Weight::from_parts(2_288_505, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_124_000 picoseconds. - Weight::from_parts(2_150_000, 0) - // Standard Error: 6_372 - .saturating_add(Weight::from_parts(2_362_416, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(2_290_000, 0) + // Standard Error: 5_007 + .saturating_add(Weight::from_parts(2_516_076, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 7_670 - .saturating_add(Weight::from_parts(1_174_342, 0).saturating_mul(r.into())) + // Minimum execution time: 2_228_000 picoseconds. + Weight::from_parts(2_300_000, 0) + // Standard Error: 8_948 + .saturating_add(Weight::from_parts(1_264_596, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_109_000, 0) - // Standard Error: 3_988 - .saturating_add(Weight::from_parts(566_949, 0).saturating_mul(r.into())) + // Minimum execution time: 2_213_000 picoseconds. + Weight::from_parts(2_323_000, 0) + // Standard Error: 5_099 + .saturating_add(Weight::from_parts(612_107, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_049_000 picoseconds. - Weight::from_parts(2_117_000, 0) - // Standard Error: 8_393 - .saturating_add(Weight::from_parts(1_160_794, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(2_326_000, 0) + // Standard Error: 10_004 + .saturating_add(Weight::from_parts(1_278_365, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_152_000, 0) - // Standard Error: 4_769 - .saturating_add(Weight::from_parts(585_265, 0).saturating_mul(r.into())) + // Minimum execution time: 2_258_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 5_578 + .saturating_add(Weight::from_parts(645_196, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_115_000 picoseconds. - Weight::from_parts(2_170_000, 0) - // Standard Error: 7_943 - .saturating_add(Weight::from_parts(1_185_174, 0).saturating_mul(r.into())) + // Minimum execution time: 2_338_000 picoseconds. + Weight::from_parts(2_363_000, 0) + // Standard Error: 8_554 + .saturating_add(Weight::from_parts(1_288_676, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_139_000 picoseconds. - Weight::from_parts(2_183_000, 0) - // Standard Error: 4_608 - .saturating_add(Weight::from_parts(563_329, 0).saturating_mul(r.into())) + // Minimum execution time: 2_214_000 picoseconds. + Weight::from_parts(2_332_000, 0) + // Standard Error: 3_999 + .saturating_add(Weight::from_parts(594_484, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_144_000 picoseconds. - Weight::from_parts(2_178_000, 0) - // Standard Error: 6_727 - .saturating_add(Weight::from_parts(1_000_757, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_258_000, 0) + // Standard Error: 7_437 + .saturating_add(Weight::from_parts(1_044_306, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(2_212_000, 0) - // Standard Error: 3_536 - .saturating_add(Weight::from_parts(504_096, 0).saturating_mul(r.into())) + // Minimum execution time: 2_226_000 picoseconds. + Weight::from_parts(2_308_000, 0) + // Standard Error: 4_658 + .saturating_add(Weight::from_parts(537_262, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_218_000, 0) - // Standard Error: 7_170 - .saturating_add(Weight::from_parts(966_365, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_296_000, 0) + // Standard Error: 10_254 + .saturating_add(Weight::from_parts(1_154_138, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_149_000 picoseconds. - Weight::from_parts(140_768, 0) - // Standard Error: 5_221 - .saturating_add(Weight::from_parts(551_550, 0).saturating_mul(r.into())) + // Minimum execution time: 2_234_000 picoseconds. + Weight::from_parts(2_313_000, 0) + // Standard Error: 4_960 + .saturating_add(Weight::from_parts(607_930, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_122_000 picoseconds. - Weight::from_parts(2_159_000, 0) - // Standard Error: 7_621 - .saturating_add(Weight::from_parts(997_420, 0).saturating_mul(r.into())) + // Minimum execution time: 2_279_000 picoseconds. + Weight::from_parts(2_342_000, 0) + // Standard Error: 7_909 + .saturating_add(Weight::from_parts(1_094_660, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_069_000 picoseconds. - Weight::from_parts(2_106_000, 0) - // Standard Error: 3_980 - .saturating_add(Weight::from_parts(537_014, 0).saturating_mul(r.into())) + // Minimum execution time: 2_232_000 picoseconds. + Weight::from_parts(39_069, 0) + // Standard Error: 6_710 + .saturating_add(Weight::from_parts(599_572, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_097_000 picoseconds. - Weight::from_parts(2_191_000, 0) - // Standard Error: 9_419 - .saturating_add(Weight::from_parts(1_050_292, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 8_785 + .saturating_add(Weight::from_parts(1_060_321, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_051_000 picoseconds. - Weight::from_parts(2_118_000, 0) - // Standard Error: 4_228 - .saturating_add(Weight::from_parts(529_158, 0).saturating_mul(r.into())) + // Minimum execution time: 2_257_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 4_191 + .saturating_add(Weight::from_parts(528_319, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_116_000, 0) - // Standard Error: 7_792 - .saturating_add(Weight::from_parts(1_027_370, 0).saturating_mul(r.into())) + // Minimum execution time: 2_256_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 9_328 + .saturating_add(Weight::from_parts(1_114_164, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 4_450 - .saturating_add(Weight::from_parts(534_724, 0).saturating_mul(r.into())) + // Minimum execution time: 2_210_000 picoseconds. + Weight::from_parts(390_951, 0) + // Standard Error: 5_316 + .saturating_add(Weight::from_parts(609_568, 0).saturating_mul(r.into())) } } diff --git a/runtime/gear/src/weights/pallet_gear_voucher.rs b/runtime/gear/src/weights/pallet_gear_voucher.rs index d7bf678ab76..6430deada98 100644 --- a/runtime/gear/src/weights/pallet_gear_voucher.rs +++ b/runtime/gear/src/weights/pallet_gear_voucher.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear_voucher //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -47,8 +47,8 @@ impl pallet_gear_voucher::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 26_245_000 picoseconds. - Weight::from_parts(26_820_000, 6196) + // Minimum execution time: 26_728_000 picoseconds. + Weight::from_parts(27_248_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -60,8 +60,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 26_245_000 picoseconds. - Weight::from_parts(26_820_000, 6196) + // Minimum execution time: 26_728_000 picoseconds. + Weight::from_parts(27_248_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/runtime/gear/src/weights/pallet_timestamp.rs b/runtime/gear/src/weights/pallet_timestamp.rs index 63568a7b1ca..c826119e49e 100644 --- a/runtime/gear/src/weights/pallet_timestamp.rs +++ b/runtime/gear/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 @@ -48,8 +48,8 @@ impl pallet_timestamp::WeightInfo for SubstrateWeight pallet_timestamp::WeightInfo for SubstrateWeight pallet_utility::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_492_000 picoseconds. - Weight::from_parts(16_501_612, 0) - // Standard Error: 5_305 - .saturating_add(Weight::from_parts(3_940_106, 0).saturating_mul(c.into())) + // Minimum execution time: 5_257_000 picoseconds. + Weight::from_parts(4_780_489, 0) + // Standard Error: 5_942 + .saturating_add(Weight::from_parts(4_050_876, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_541_000 picoseconds. - Weight::from_parts(3_734_000, 0) + // Minimum execution time: 3_444_000 picoseconds. + Weight::from_parts(3_651_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_273_000 picoseconds. - Weight::from_parts(19_870_279, 0) - // Standard Error: 3_599 - .saturating_add(Weight::from_parts(4_086_216, 0).saturating_mul(c.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(13_396_792, 0) + // Standard Error: 5_623 + .saturating_add(Weight::from_parts(4_206_823, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_999_000 picoseconds. - Weight::from_parts(7_200_000, 0) + // Minimum execution time: 6_836_000 picoseconds. + Weight::from_parts(7_186_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_391_000 picoseconds. - Weight::from_parts(11_706_819, 0) - // Standard Error: 4_999 - .saturating_add(Weight::from_parts(3_962_138, 0).saturating_mul(c.into())) + // Minimum execution time: 5_427_000 picoseconds. + Weight::from_parts(14_488_578, 0) + // Standard Error: 6_374 + .saturating_add(Weight::from_parts(4_015_154, 0).saturating_mul(c.into())) } } @@ -100,43 +100,43 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_492_000 picoseconds. - Weight::from_parts(16_501_612, 0) - // Standard Error: 5_305 - .saturating_add(Weight::from_parts(3_940_106, 0).saturating_mul(c.into())) + // Minimum execution time: 5_257_000 picoseconds. + Weight::from_parts(4_780_489, 0) + // Standard Error: 5_942 + .saturating_add(Weight::from_parts(4_050_876, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_541_000 picoseconds. - Weight::from_parts(3_734_000, 0) + // Minimum execution time: 3_444_000 picoseconds. + Weight::from_parts(3_651_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_273_000 picoseconds. - Weight::from_parts(19_870_279, 0) - // Standard Error: 3_599 - .saturating_add(Weight::from_parts(4_086_216, 0).saturating_mul(c.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(13_396_792, 0) + // Standard Error: 5_623 + .saturating_add(Weight::from_parts(4_206_823, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_999_000 picoseconds. - Weight::from_parts(7_200_000, 0) + // Minimum execution time: 6_836_000 picoseconds. + Weight::from_parts(7_186_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_391_000 picoseconds. - Weight::from_parts(11_706_819, 0) - // Standard Error: 4_999 - .saturating_add(Weight::from_parts(3_962_138, 0).saturating_mul(c.into())) + // Minimum execution time: 5_427_000 picoseconds. + Weight::from_parts(14_488_578, 0) + // Standard Error: 6_374 + .saturating_add(Weight::from_parts(4_015_154, 0).saturating_mul(c.into())) } } diff --git a/runtime/vara/src/tests.rs b/runtime/vara/src/tests.rs index e74dec9b53b..2dbfc3d0412 100644 --- a/runtime/vara/src/tests.rs +++ b/runtime/vara/src/tests.rs @@ -32,7 +32,7 @@ fn instruction_weights_heuristics_test() { _phantom: core::marker::PhantomData, i64const: 160, - i64load: 7_000, + i64load: 11_575, i32load: 8_000, i64store: 29_000, i32store: 20_000, @@ -141,7 +141,7 @@ fn page_costs_heuristic_test() { lazy_pages_signal_write_after_read: 9_500_000.into(), lazy_pages_host_func_read: 29_000_000.into(), lazy_pages_host_func_write: 33_000_000.into(), - lazy_pages_host_func_write_after_read: 8_700_000.into(), + lazy_pages_host_func_write_after_read: 10_687_730.into(), load_page_data: 8_700_000.into(), upload_page_data: 104_000_000.into(), static_page: 100.into(), diff --git a/runtime/vara/src/weights/frame_system.rs b/runtime/vara/src/weights/frame_system.rs index 3592fb36d2d..4a96c3b0457 100644 --- a/runtime/vara/src/weights/frame_system.rs +++ b/runtime/vara/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -53,27 +53,27 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_503_000 picoseconds. - Weight::from_parts(1_491_824, 0) + // Minimum execution time: 1_619_000 picoseconds. + Weight::from_parts(1_222_978, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(459, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 1310720]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_709_000 picoseconds. - Weight::from_parts(5_959_000, 0) + // Minimum execution time: 6_210_000 picoseconds. + Weight::from_parts(6_305_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_440, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_438, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_908_000 picoseconds. - Weight::from_parts(3_176_000, 1485) + // Minimum execution time: 3_022_000 picoseconds. + Weight::from_parts(3_351_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -82,10 +82,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_503_000 picoseconds. - Weight::from_parts(1_602_000, 0) - // Standard Error: 1_020 - .saturating_add(Weight::from_parts(676_199, 0).saturating_mul(i.into())) + // Minimum execution time: 1_529_000 picoseconds. + Weight::from_parts(1_573_000, 0) + // Standard Error: 997 + .saturating_add(Weight::from_parts(684_007, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -93,10 +93,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_477_000 picoseconds. - Weight::from_parts(1_606_000, 0) - // Standard Error: 751 - .saturating_add(Weight::from_parts(523_999, 0).saturating_mul(i.into())) + // Minimum execution time: 1_611_000 picoseconds. + Weight::from_parts(1_646_000, 0) + // Standard Error: 813 + .saturating_add(Weight::from_parts(531_452, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -104,10 +104,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `82 + p * (69 ±0)` // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 3_270_000 picoseconds. - Weight::from_parts(3_354_000, 83) - // Standard Error: 1_375 - .saturating_add(Weight::from_parts(1_112_948, 0).saturating_mul(p.into())) + // Minimum execution time: 3_424_000 picoseconds. + Weight::from_parts(3_487_000, 83) + // Standard Error: 1_821 + .saturating_add(Weight::from_parts(1_126_082, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -121,27 +121,27 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_503_000 picoseconds. - Weight::from_parts(1_491_824, 0) + // Minimum execution time: 1_619_000 picoseconds. + Weight::from_parts(1_222_978, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(459, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 1310720]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_709_000 picoseconds. - Weight::from_parts(5_959_000, 0) + // Minimum execution time: 6_210_000 picoseconds. + Weight::from_parts(6_305_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_440, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_438, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 2_908_000 picoseconds. - Weight::from_parts(3_176_000, 1485) + // Minimum execution time: 3_022_000 picoseconds. + Weight::from_parts(3_351_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -150,10 +150,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_503_000 picoseconds. - Weight::from_parts(1_602_000, 0) - // Standard Error: 1_020 - .saturating_add(Weight::from_parts(676_199, 0).saturating_mul(i.into())) + // Minimum execution time: 1_529_000 picoseconds. + Weight::from_parts(1_573_000, 0) + // Standard Error: 997 + .saturating_add(Weight::from_parts(684_007, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -161,10 +161,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_477_000 picoseconds. - Weight::from_parts(1_606_000, 0) - // Standard Error: 751 - .saturating_add(Weight::from_parts(523_999, 0).saturating_mul(i.into())) + // Minimum execution time: 1_611_000 picoseconds. + Weight::from_parts(1_646_000, 0) + // Standard Error: 813 + .saturating_add(Weight::from_parts(531_452, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. @@ -172,10 +172,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `82 + p * (69 ±0)` // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 3_270_000 picoseconds. - Weight::from_parts(3_354_000, 83) - // Standard Error: 1_375 - .saturating_add(Weight::from_parts(1_112_948, 0).saturating_mul(p.into())) + // Minimum execution time: 3_424_000 picoseconds. + Weight::from_parts(3_487_000, 83) + // Standard Error: 1_821 + .saturating_add(Weight::from_parts(1_126_082, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/runtime/vara/src/weights/pallet_airdrop.rs b/runtime/vara/src/weights/pallet_airdrop.rs index 86ac421788d..a61092155c8 100644 --- a/runtime/vara/src/weights/pallet_airdrop.rs +++ b/runtime/vara/src/weights/pallet_airdrop.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_airdrop //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -49,18 +49,20 @@ impl pallet_airdrop::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 24_965_000 picoseconds. - Weight::from_parts(26_088_278, 6196) + // Minimum execution time: 25_544_000 picoseconds. + Weight::from_parts(26_559_640, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// The range of component `q` is `[1, 256]`. - fn transfer_vested(_q: u32, ) -> Weight { + fn transfer_vested(q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `550` // Estimated: `15482` - // Minimum execution time: 65_471_000 picoseconds. - Weight::from_parts(67_416_608, 15482) + // Minimum execution time: 65_922_000 picoseconds. + Weight::from_parts(67_728_019, 15482) + // Standard Error: 331 + .saturating_add(Weight::from_parts(501, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -73,18 +75,20 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 24_965_000 picoseconds. - Weight::from_parts(26_088_278, 6196) + // Minimum execution time: 25_544_000 picoseconds. + Weight::from_parts(26_559_640, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// The range of component `q` is `[1, 256]`. - fn transfer_vested(_q: u32, ) -> Weight { + fn transfer_vested(q: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `550` // Estimated: `15482` - // Minimum execution time: 65_471_000 picoseconds. - Weight::from_parts(67_416_608, 15482) + // Minimum execution time: 65_922_000 picoseconds. + Weight::from_parts(67_728_019, 15482) + // Standard Error: 331 + .saturating_add(Weight::from_parts(501, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } diff --git a/runtime/vara/src/weights/pallet_balances.rs b/runtime/vara/src/weights/pallet_balances.rs index a9486cc0e2e..22130616509 100644 --- a/runtime/vara/src/weights/pallet_balances.rs +++ b/runtime/vara/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_934_000 picoseconds. - Weight::from_parts(30_505_000, 3593) + // Minimum execution time: 30_481_000 picoseconds. + Weight::from_parts(31_107_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -62,8 +62,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 21_441_000 picoseconds. - Weight::from_parts(22_000_000, 3593) + // Minimum execution time: 21_607_000 picoseconds. + Weight::from_parts(22_313_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -71,8 +71,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_250_000 picoseconds. - Weight::from_parts(12_703_000, 3593) + // Minimum execution time: 12_411_000 picoseconds. + Weight::from_parts(12_689_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +80,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_163_000 picoseconds. - Weight::from_parts(15_565_000, 3593) + // Minimum execution time: 14_986_000 picoseconds. + Weight::from_parts(15_531_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -89,8 +89,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 31_518_000 picoseconds. - Weight::from_parts(31_923_000, 6196) + // Minimum execution time: 31_713_000 picoseconds. + Weight::from_parts(32_359_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -98,8 +98,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 27_693_000 picoseconds. - Weight::from_parts(28_166_000, 3593) + // Minimum execution time: 28_362_000 picoseconds. + Weight::from_parts(29_064_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,8 +107,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 11_670_000 picoseconds. - Weight::from_parts(12_112_000, 3593) + // Minimum execution time: 11_971_000 picoseconds. + Weight::from_parts(12_309_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +120,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_934_000 picoseconds. - Weight::from_parts(30_505_000, 3593) + // Minimum execution time: 30_481_000 picoseconds. + Weight::from_parts(31_107_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -129,8 +129,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 21_441_000 picoseconds. - Weight::from_parts(22_000_000, 3593) + // Minimum execution time: 21_607_000 picoseconds. + Weight::from_parts(22_313_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_250_000 picoseconds. - Weight::from_parts(12_703_000, 3593) + // Minimum execution time: 12_411_000 picoseconds. + Weight::from_parts(12_689_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -147,8 +147,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 15_163_000 picoseconds. - Weight::from_parts(15_565_000, 3593) + // Minimum execution time: 14_986_000 picoseconds. + Weight::from_parts(15_531_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -156,8 +156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 31_518_000 picoseconds. - Weight::from_parts(31_923_000, 6196) + // Minimum execution time: 31_713_000 picoseconds. + Weight::from_parts(32_359_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -165,8 +165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 27_693_000 picoseconds. - Weight::from_parts(28_166_000, 3593) + // Minimum execution time: 28_362_000 picoseconds. + Weight::from_parts(29_064_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -174,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 11_670_000 picoseconds. - Weight::from_parts(12_112_000, 3593) + // Minimum execution time: 11_971_000 picoseconds. + Weight::from_parts(12_309_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/runtime/vara/src/weights/pallet_gear.rs b/runtime/vara/src/weights/pallet_gear.rs index 356ab963620..35229a049ee 100644 --- a/runtime/vara/src/weights/pallet_gear.rs +++ b/runtime/vara/src/weights/pallet_gear.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -244,10 +244,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_017_000 picoseconds. - Weight::from_parts(1_119_000, 0) - // Standard Error: 761 - .saturating_add(Weight::from_parts(209_074, 0).saturating_mul(c.into())) + // Minimum execution time: 1_012_000 picoseconds. + Weight::from_parts(1_102_000, 0) + // Standard Error: 721 + .saturating_add(Weight::from_parts(207_628, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -255,10 +255,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `113 + c * (1024 ±0)` // Estimated: `3577 + c * (1024 ±0)` - // Minimum execution time: 3_299_000 picoseconds. - Weight::from_parts(3_409_000, 3577) - // Standard Error: 809 - .saturating_add(Weight::from_parts(667_635, 0).saturating_mul(c.into())) + // Minimum execution time: 3_309_000 picoseconds. + Weight::from_parts(3_406_000, 3577) + // Standard Error: 759 + .saturating_add(Weight::from_parts(674_106, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -267,17 +267,17 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 50_278_000 picoseconds. - Weight::from_parts(73_427_731, 0) - // Standard Error: 6_473 - .saturating_add(Weight::from_parts(2_331_768, 0).saturating_mul(c.into())) + // Minimum execution time: 52_127_000 picoseconds. + Weight::from_parts(74_742_938, 0) + // Standard Error: 5_397 + .saturating_add(Weight::from_parts(2_342_205, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1050` // Estimated: `42875` - // Minimum execution time: 81_857_000 picoseconds. - Weight::from_parts(83_494_000, 42875) + // Minimum execution time: 84_245_000 picoseconds. + Weight::from_parts(85_847_000, 42875) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -285,8 +285,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `958` // Estimated: `21477` - // Minimum execution time: 53_880_000 picoseconds. - Weight::from_parts(55_703_000, 21477) + // Minimum execution time: 55_566_000 picoseconds. + Weight::from_parts(57_030_000, 21477) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -294,8 +294,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `605` // Estimated: `17354` - // Minimum execution time: 28_976_000 picoseconds. - Weight::from_parts(30_055_000, 17354) + // Minimum execution time: 29_403_000 picoseconds. + Weight::from_parts(30_422_000, 17354) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -304,10 +304,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_954_000 picoseconds. - Weight::from_parts(9_206_629, 7640) - // Standard Error: 40_915 - .saturating_add(Weight::from_parts(13_218_946, 0).saturating_mul(c.into())) + // Minimum execution time: 7_886_000 picoseconds. + Weight::from_parts(5_577_548, 7640) + // Standard Error: 36_666 + .saturating_add(Weight::from_parts(13_383_280, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -316,10 +316,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1439 + c * (16389 ±0)` // Estimated: `42034 + c * (131112 ±0)` - // Minimum execution time: 69_036_000 picoseconds. - Weight::from_parts(70_072_000, 42034) - // Standard Error: 149_794 - .saturating_add(Weight::from_parts(52_674_750, 0).saturating_mul(c.into())) + // Minimum execution time: 71_129_000 picoseconds. + Weight::from_parts(71_867_000, 42034) + // Standard Error: 194_431 + .saturating_add(Weight::from_parts(53_622_369, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -330,10 +330,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `80` // Estimated: `5270` - // Minimum execution time: 61_042_000 picoseconds. - Weight::from_parts(42_647_149, 5270) - // Standard Error: 41_151 - .saturating_add(Weight::from_parts(51_906_843, 0).saturating_mul(c.into())) + // Minimum execution time: 63_441_000 picoseconds. + Weight::from_parts(69_716_978, 5270) + // Standard Error: 32_301 + .saturating_add(Weight::from_parts(51_458_430, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -342,10 +342,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `742` // Estimated: `39419` - // Minimum execution time: 62_956_000 picoseconds. - Weight::from_parts(74_593_794, 39419) + // Minimum execution time: 64_601_000 picoseconds. + Weight::from_parts(94_970_592, 39419) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_594, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_577, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -355,12 +355,12 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `306` // Estimated: `35235` - // Minimum execution time: 10_939_548_000 picoseconds. - Weight::from_parts(505_483_291, 35235) - // Standard Error: 158_935 - .saturating_add(Weight::from_parts(51_999_053, 0).saturating_mul(c.into())) + // Minimum execution time: 10_884_487_000 picoseconds. + Weight::from_parts(321_953_387, 35235) + // Standard Error: 164_114 + .saturating_add(Weight::from_parts(51_946_894, 0).saturating_mul(c.into())) // Standard Error: 9 - .saturating_add(Weight::from_parts(2_500, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_506, 0).saturating_mul(s.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(14_u64)) } @@ -369,10 +369,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `349` // Estimated: `23860` - // Minimum execution time: 54_714_000 picoseconds. - Weight::from_parts(39_682_905, 23860) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_012, 0).saturating_mul(p.into())) + // Minimum execution time: 55_131_000 picoseconds. + Weight::from_parts(30_192_078, 23860) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_039, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(9_u64)) .saturating_add(T::DbWeight::get().writes(8_u64)) } @@ -381,10 +381,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1049` // Estimated: `42866` - // Minimum execution time: 82_073_000 picoseconds. - Weight::from_parts(66_860_069, 42866) + // Minimum execution time: 85_069_000 picoseconds. + Weight::from_parts(72_149_865, 42866) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_036, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(13_u64)) .saturating_add(T::DbWeight::get().writes(10_u64)) } @@ -393,10 +393,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85981` - // Minimum execution time: 316_122_000 picoseconds. - Weight::from_parts(330_387_653, 85981) - // Standard Error: 1_030 - .saturating_add(Weight::from_parts(2_167, 0).saturating_mul(q.into())) + // Minimum execution time: 323_286_000 picoseconds. + Weight::from_parts(335_875_612, 85981) + // Standard Error: 1_331 + .saturating_add(Weight::from_parts(1_294, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().writes(23_u64)) } @@ -405,8 +405,8 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85905` - // Minimum execution time: 327_296_000 picoseconds. - Weight::from_parts(344_778_587, 85905) + // Minimum execution time: 333_261_000 picoseconds. + Weight::from_parts(348_059_151, 85905) .saturating_add(T::DbWeight::get().reads(29_u64)) .saturating_add(T::DbWeight::get().writes(23_u64)) } @@ -415,10 +415,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_031_000 picoseconds. - Weight::from_parts(45_572_000, 3899) - // Standard Error: 24_669 - .saturating_add(Weight::from_parts(50_090_777, 0).saturating_mul(c.into())) + // Minimum execution time: 45_732_000 picoseconds. + Weight::from_parts(46_437_000, 3899) + // Standard Error: 40_834 + .saturating_add(Weight::from_parts(51_504_684, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -428,630 +428,630 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_663_000 picoseconds. - Weight::from_parts(84_983_000, 0) - // Standard Error: 4_066_232 - .saturating_add(Weight::from_parts(564_447_416, 0).saturating_mul(r.into())) + // Minimum execution time: 84_890_000 picoseconds. + Weight::from_parts(87_488_000, 0) + // Standard Error: 4_218_353 + .saturating_add(Weight::from_parts(584_751_765, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 311_448_000 picoseconds. - Weight::from_parts(245_631_815, 0) - // Standard Error: 7_937 - .saturating_add(Weight::from_parts(30_896_737, 0).saturating_mul(p.into())) + // Minimum execution time: 319_127_000 picoseconds. + Weight::from_parts(258_635_809, 0) + // Standard Error: 13_905 + .saturating_add(Weight::from_parts(32_129_635, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 149_067_000 picoseconds. - Weight::from_parts(130_181_921, 0) - // Standard Error: 294_281 - .saturating_add(Weight::from_parts(60_998_326, 0).saturating_mul(r.into())) + // Minimum execution time: 145_346_000 picoseconds. + Weight::from_parts(132_224_327, 0) + // Standard Error: 318_914 + .saturating_add(Weight::from_parts(64_020_177, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_222_000 picoseconds. - Weight::from_parts(94_195_714, 0) - // Standard Error: 3_616 - .saturating_add(Weight::from_parts(2_672_494, 0).saturating_mul(r.into())) + // Minimum execution time: 86_899_000 picoseconds. + Weight::from_parts(93_463_487, 0) + // Standard Error: 3_525 + .saturating_add(Weight::from_parts(2_288_372, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_429_000 picoseconds. - Weight::from_parts(171_049_360, 0) - // Standard Error: 31_588 - .saturating_add(Weight::from_parts(2_923_269, 0).saturating_mul(r.into())) + // Minimum execution time: 138_092_000 picoseconds. + Weight::from_parts(169_806_344, 0) + // Standard Error: 26_882 + .saturating_add(Weight::from_parts(2_254_783, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_992_000 picoseconds. - Weight::from_parts(115_936_976, 0) - // Standard Error: 414_340 - .saturating_add(Weight::from_parts(116_785_346, 0).saturating_mul(r.into())) + // Minimum execution time: 85_599_000 picoseconds. + Weight::from_parts(98_793_759, 0) + // Standard Error: 347_287 + .saturating_add(Weight::from_parts(87_526_184, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_790_000 picoseconds. - Weight::from_parts(90_746_200, 0) - // Standard Error: 270_835 - .saturating_add(Weight::from_parts(107_416_174, 0).saturating_mul(r.into())) + // Minimum execution time: 85_991_000 picoseconds. + Weight::from_parts(83_685_254, 0) + // Standard Error: 318_877 + .saturating_add(Weight::from_parts(76_389_253, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_210_000 picoseconds. - Weight::from_parts(91_082_335, 0) - // Standard Error: 211_867 - .saturating_add(Weight::from_parts(104_318_383, 0).saturating_mul(r.into())) + // Minimum execution time: 85_968_000 picoseconds. + Weight::from_parts(82_459_314, 0) + // Standard Error: 319_709 + .saturating_add(Weight::from_parts(76_181_704, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_806_000 picoseconds. - Weight::from_parts(85_438_969, 0) - // Standard Error: 248_652 - .saturating_add(Weight::from_parts(105_330_427, 0).saturating_mul(r.into())) + // Minimum execution time: 81_819_000 picoseconds. + Weight::from_parts(72_371_983, 0) + // Standard Error: 300_686 + .saturating_add(Weight::from_parts(76_316_802, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_654_000 picoseconds. - Weight::from_parts(82_257_210, 0) - // Standard Error: 336_548 - .saturating_add(Weight::from_parts(106_454_200, 0).saturating_mul(r.into())) + // Minimum execution time: 84_717_000 picoseconds. + Weight::from_parts(76_355_783, 0) + // Standard Error: 285_260 + .saturating_add(Weight::from_parts(75_781_825, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_452_000 picoseconds. - Weight::from_parts(82_661_045, 0) - // Standard Error: 286_452 - .saturating_add(Weight::from_parts(105_467_642, 0).saturating_mul(r.into())) + // Minimum execution time: 86_121_000 picoseconds. + Weight::from_parts(80_173_266, 0) + // Standard Error: 370_111 + .saturating_add(Weight::from_parts(77_146_163, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_893_000 picoseconds. - Weight::from_parts(81_216_834, 0) - // Standard Error: 315_266 - .saturating_add(Weight::from_parts(107_016_702, 0).saturating_mul(r.into())) + // Minimum execution time: 86_040_000 picoseconds. + Weight::from_parts(77_052_017, 0) + // Standard Error: 323_675 + .saturating_add(Weight::from_parts(75_764_467, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_282_000 picoseconds. - Weight::from_parts(82_548_887, 0) - // Standard Error: 341_172 - .saturating_add(Weight::from_parts(105_504_622, 0).saturating_mul(r.into())) + // Minimum execution time: 86_130_000 picoseconds. + Weight::from_parts(76_139_106, 0) + // Standard Error: 362_545 + .saturating_add(Weight::from_parts(80_573_769, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 556_352_000 picoseconds. - Weight::from_parts(607_493_748, 0) - // Standard Error: 448_674 - .saturating_add(Weight::from_parts(184_670_390, 0).saturating_mul(r.into())) + // Minimum execution time: 558_591_000 picoseconds. + Weight::from_parts(605_772_233, 0) + // Standard Error: 457_089 + .saturating_add(Weight::from_parts(135_861_811, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_496_000 picoseconds. - Weight::from_parts(722_520_000, 0) - // Standard Error: 46_538 - .saturating_add(Weight::from_parts(13_033_234, 0).saturating_mul(n.into())) + // Minimum execution time: 699_603_000 picoseconds. + Weight::from_parts(703_289_000, 0) + // Standard Error: 59_520 + .saturating_add(Weight::from_parts(12_949_265, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_627_000 picoseconds. - Weight::from_parts(85_563_243, 0) - // Standard Error: 311_752 - .saturating_add(Weight::from_parts(105_877_332, 0).saturating_mul(r.into())) + // Minimum execution time: 85_014_000 picoseconds. + Weight::from_parts(77_731_097, 0) + // Standard Error: 304_273 + .saturating_add(Weight::from_parts(75_976_070, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_852_000 picoseconds. - Weight::from_parts(84_860_381, 0) - // Standard Error: 321_988 - .saturating_add(Weight::from_parts(105_008_310, 0).saturating_mul(r.into())) + // Minimum execution time: 86_408_000 picoseconds. + Weight::from_parts(73_174_939, 0) + // Standard Error: 383_139 + .saturating_add(Weight::from_parts(76_484_364, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_396_000 picoseconds. - Weight::from_parts(89_972_413, 0) - // Standard Error: 338_324 - .saturating_add(Weight::from_parts(184_316_536, 0).saturating_mul(n.into())) + // Minimum execution time: 85_197_000 picoseconds. + Weight::from_parts(88_845_708, 0) + // Standard Error: 389_513 + .saturating_add(Weight::from_parts(171_448_634, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_385_000 picoseconds. - Weight::from_parts(90_760_000, 0) - // Standard Error: 4_378_367 - .saturating_add(Weight::from_parts(914_427_461, 0).saturating_mul(r.into())) + // Minimum execution time: 86_264_000 picoseconds. + Weight::from_parts(88_018_000, 0) + // Standard Error: 4_124_330 + .saturating_add(Weight::from_parts(805_432_550, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_060_000 picoseconds. - Weight::from_parts(138_647_807, 0) - // Standard Error: 449_220 - .saturating_add(Weight::from_parts(301_188_566, 0).saturating_mul(r.into())) + // Minimum execution time: 82_295_000 picoseconds. + Weight::from_parts(140_527_286, 0) + // Standard Error: 405_229 + .saturating_add(Weight::from_parts(251_699_250, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 391_797_000 picoseconds. - Weight::from_parts(394_943_000, 0) - // Standard Error: 58_663 - .saturating_add(Weight::from_parts(21_187_774, 0).saturating_mul(n.into())) + // Minimum execution time: 327_394_000 picoseconds. + Weight::from_parts(330_315_000, 0) + // Standard Error: 62_193 + .saturating_add(Weight::from_parts(21_097_102, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_418_000 picoseconds. - Weight::from_parts(149_848_797, 0) - // Standard Error: 459_492 - .saturating_add(Weight::from_parts(308_230_219, 0).saturating_mul(r.into())) + // Minimum execution time: 83_900_000 picoseconds. + Weight::from_parts(158_459_938, 0) + // Standard Error: 440_264 + .saturating_add(Weight::from_parts(252_444_195, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 390_635_000 picoseconds. - Weight::from_parts(395_782_000, 0) - // Standard Error: 61_326 - .saturating_add(Weight::from_parts(20_818_419, 0).saturating_mul(n.into())) + // Minimum execution time: 337_208_000 picoseconds. + Weight::from_parts(341_169_000, 0) + // Standard Error: 59_076 + .saturating_add(Weight::from_parts(20_945_135, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 561_280_000 picoseconds. - Weight::from_parts(634_390_717, 0) - // Standard Error: 473_236 - .saturating_add(Weight::from_parts(316_661_157, 0).saturating_mul(r.into())) + // Minimum execution time: 556_175_000 picoseconds. + Weight::from_parts(627_050_994, 0) + // Standard Error: 426_100 + .saturating_add(Weight::from_parts(261_080_337, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 559_804_000 picoseconds. - Weight::from_parts(650_695_494, 0) - // Standard Error: 489_218 - .saturating_add(Weight::from_parts(321_789_584, 0).saturating_mul(r.into())) + // Minimum execution time: 557_564_000 picoseconds. + Weight::from_parts(641_256_689, 0) + // Standard Error: 460_579 + .saturating_add(Weight::from_parts(266_649_825, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_345_000 picoseconds. - Weight::from_parts(74_080_057, 0) - // Standard Error: 328_119 - .saturating_add(Weight::from_parts(116_742_827, 0).saturating_mul(r.into())) + // Minimum execution time: 82_507_000 picoseconds. + Weight::from_parts(67_761_917, 0) + // Standard Error: 379_455 + .saturating_add(Weight::from_parts(86_652_007, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_307_192_000 picoseconds. - Weight::from_parts(2_419_334_440, 0) - // Standard Error: 484_032 - .saturating_add(Weight::from_parts(211_293_866, 0).saturating_mul(r.into())) + // Minimum execution time: 1_683_177_000 picoseconds. + Weight::from_parts(1_794_013_374, 0) + // Standard Error: 387_018 + .saturating_add(Weight::from_parts(156_399_549, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 346_160_000 picoseconds. - Weight::from_parts(348_777_000, 0) - // Standard Error: 58_661 - .saturating_add(Weight::from_parts(29_434_095, 0).saturating_mul(n.into())) + // Minimum execution time: 288_797_000 picoseconds. + Weight::from_parts(293_289_000, 0) + // Standard Error: 63_168 + .saturating_add(Weight::from_parts(29_577_277, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_292_607_000 picoseconds. - Weight::from_parts(2_434_102_108, 0) - // Standard Error: 502_502 - .saturating_add(Weight::from_parts(264_859_383, 0).saturating_mul(r.into())) + // Minimum execution time: 1_691_333_000 picoseconds. + Weight::from_parts(1_801_253_735, 0) + // Standard Error: 474_792 + .saturating_add(Weight::from_parts(209_949_939, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_289_426_000 picoseconds. - Weight::from_parts(2_437_443_919, 0) - // Standard Error: 471_320 - .saturating_add(Weight::from_parts(268_510_540, 0).saturating_mul(r.into())) + // Minimum execution time: 1_683_041_000 picoseconds. + Weight::from_parts(1_822_549_872, 0) + // Standard Error: 425_077 + .saturating_add(Weight::from_parts(211_798_367, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 242_827_000 picoseconds. - Weight::from_parts(291_906_943, 0) - // Standard Error: 419_132 - .saturating_add(Weight::from_parts(316_375_969, 0).saturating_mul(r.into())) + // Minimum execution time: 247_656_000 picoseconds. + Weight::from_parts(317_794_229, 0) + // Standard Error: 388_223 + .saturating_add(Weight::from_parts(266_464_404, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 554_876_000 picoseconds. - Weight::from_parts(559_277_000, 0) - // Standard Error: 59_610 - .saturating_add(Weight::from_parts(21_490_976, 0).saturating_mul(n.into())) + // Minimum execution time: 512_971_000 picoseconds. + Weight::from_parts(524_580_000, 0) + // Standard Error: 57_807 + .saturating_add(Weight::from_parts(21_296_153, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_443_317_000 picoseconds. - Weight::from_parts(2_625_227_536, 0) - // Standard Error: 511_289 - .saturating_add(Weight::from_parts(283_117_268, 0).saturating_mul(r.into())) + // Minimum execution time: 1_827_786_000 picoseconds. + Weight::from_parts(1_938_199_639, 0) + // Standard Error: 481_292 + .saturating_add(Weight::from_parts(230_397_609, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_099_000 picoseconds. - Weight::from_parts(88_574_604, 0) - // Standard Error: 274_173 - .saturating_add(Weight::from_parts(20_834_495, 0).saturating_mul(r.into())) + // Minimum execution time: 83_205_000 picoseconds. + Weight::from_parts(87_841_924, 0) + // Standard Error: 284_081 + .saturating_add(Weight::from_parts(20_304_775, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_246_000 picoseconds. - Weight::from_parts(90_382_254, 0) - // Standard Error: 1_257 - .saturating_add(Weight::from_parts(428_781, 0).saturating_mul(n.into())) + // Minimum execution time: 103_357_000 picoseconds. + Weight::from_parts(89_286_787, 0) + // Standard Error: 1_068 + .saturating_add(Weight::from_parts(423_323, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_454_000 picoseconds. - Weight::from_parts(90_235_951, 0) - // Standard Error: 256_364 - .saturating_add(Weight::from_parts(14_555_548, 0).saturating_mul(r.into())) + // Minimum execution time: 82_492_000 picoseconds. + Weight::from_parts(86_217_226, 0) + // Standard Error: 241_578 + .saturating_add(Weight::from_parts(18_632_173, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_189_000 picoseconds. - Weight::from_parts(91_177_961, 0) - // Standard Error: 1_127 - .saturating_add(Weight::from_parts(424_751, 0).saturating_mul(n.into())) + // Minimum execution time: 101_997_000 picoseconds. + Weight::from_parts(93_566_446, 0) + // Standard Error: 1_152 + .saturating_add(Weight::from_parts(421_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_893_000 picoseconds. - Weight::from_parts(88_684_789, 0) - // Standard Error: 287_468 - .saturating_add(Weight::from_parts(16_661_810, 0).saturating_mul(r.into())) + // Minimum execution time: 81_647_000 picoseconds. + Weight::from_parts(85_634_187, 0) + // Standard Error: 241_527 + .saturating_add(Weight::from_parts(16_147_912, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_534_000 picoseconds. - Weight::from_parts(88_923_020, 0) - // Standard Error: 249_896 - .saturating_add(Weight::from_parts(19_208_979, 0).saturating_mul(r.into())) + // Minimum execution time: 82_801_000 picoseconds. + Weight::from_parts(89_403_918, 0) + // Standard Error: 269_595 + .saturating_add(Weight::from_parts(13_226_181, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_229_000 picoseconds. - Weight::from_parts(120_908_395, 0) - // Standard Error: 327_109 - .saturating_add(Weight::from_parts(190_143_835, 0).saturating_mul(r.into())) + // Minimum execution time: 84_685_000 picoseconds. + Weight::from_parts(132_414_219, 0) + // Standard Error: 497_457 + .saturating_add(Weight::from_parts(145_777_097, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_549_000 picoseconds. - Weight::from_parts(100_553_000, 0) - // Standard Error: 2_727 - .saturating_add(Weight::from_parts(616_949, 0).saturating_mul(n.into())) + // Minimum execution time: 97_574_000 picoseconds. + Weight::from_parts(100_165_000, 0) + // Standard Error: 2_652 + .saturating_add(Weight::from_parts(625_145, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 553_918_000 picoseconds. - Weight::from_parts(572_988_848, 0) - // Standard Error: 2_210_952 - .saturating_add(Weight::from_parts(30_333_551, 0).saturating_mul(r.into())) + // Minimum execution time: 553_039_000 picoseconds. + Weight::from_parts(596_067_157, 0) + // Standard Error: 7_999_654 + .saturating_add(Weight::from_parts(49_166_442, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 552_664_000 picoseconds. - Weight::from_parts(571_824_067, 0) - // Standard Error: 1_981_598 - .saturating_add(Weight::from_parts(28_343_432, 0).saturating_mul(r.into())) + // Minimum execution time: 560_077_000 picoseconds. + Weight::from_parts(599_598_873, 0) + // Standard Error: 4_500_003 + .saturating_add(Weight::from_parts(54_967_826, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_114_000 picoseconds. - Weight::from_parts(99_799_695, 0) - // Standard Error: 263_342 - .saturating_add(Weight::from_parts(5_959_704, 0).saturating_mul(r.into())) + // Minimum execution time: 92_238_000 picoseconds. + Weight::from_parts(96_280_512, 0) + // Standard Error: 270_962 + .saturating_add(Weight::from_parts(10_382_887, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_595_000 picoseconds. - Weight::from_parts(94_900_895, 0) - // Standard Error: 1_221 - .saturating_add(Weight::from_parts(425_729, 0).saturating_mul(n.into())) + // Minimum execution time: 102_112_000 picoseconds. + Weight::from_parts(88_433_773, 0) + // Standard Error: 839 + .saturating_add(Weight::from_parts(426_982, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 94_123_000 picoseconds. - Weight::from_parts(99_068_002, 0) - // Standard Error: 278_340 - .saturating_add(Weight::from_parts(6_056_397, 0).saturating_mul(r.into())) + // Minimum execution time: 91_989_000 picoseconds. + Weight::from_parts(96_225_993, 0) + // Standard Error: 279_323 + .saturating_add(Weight::from_parts(12_960_106, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 106_148_000 picoseconds. - Weight::from_parts(93_583_351, 0) - // Standard Error: 1_048 - .saturating_add(Weight::from_parts(420_112, 0).saturating_mul(n.into())) + // Minimum execution time: 101_178_000 picoseconds. + Weight::from_parts(90_738_187, 0) + // Standard Error: 1_202 + .saturating_add(Weight::from_parts(427_278, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_951_000 picoseconds. - Weight::from_parts(80_983_069, 0) - // Standard Error: 260_297 - .saturating_add(Weight::from_parts(114_164_207, 0).saturating_mul(r.into())) + // Minimum execution time: 84_732_000 picoseconds. + Weight::from_parts(75_405_776, 0) + // Standard Error: 330_490 + .saturating_add(Weight::from_parts(78_457_591, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_991_000 picoseconds. - Weight::from_parts(83_808_552, 0) - // Standard Error: 291_596 - .saturating_add(Weight::from_parts(107_977_269, 0).saturating_mul(r.into())) + // Minimum execution time: 84_077_000 picoseconds. + Weight::from_parts(86_563_786, 0) + // Standard Error: 230_585 + .saturating_add(Weight::from_parts(75_198_113, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 555_192_000 picoseconds. - Weight::from_parts(637_741_196, 0) - // Standard Error: 498_770 - .saturating_add(Weight::from_parts(126_311_515, 0).saturating_mul(r.into())) + // Minimum execution time: 561_889_000 picoseconds. + Weight::from_parts(581_183_882, 0) + // Standard Error: 419_713 + .saturating_add(Weight::from_parts(98_014_698, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 567_642_000 picoseconds. - Weight::from_parts(587_862_774, 0) - // Standard Error: 1_100 - .saturating_add(Weight::from_parts(120_318, 0).saturating_mul(n.into())) + // Minimum execution time: 573_200_000 picoseconds. + Weight::from_parts(600_501_979, 0) + // Standard Error: 2_551 + .saturating_add(Weight::from_parts(132_221, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_764_152_000 picoseconds. - Weight::from_parts(2_885_803_691, 0) - // Standard Error: 562_616 - .saturating_add(Weight::from_parts(154_883_526, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_491_000 picoseconds. + Weight::from_parts(2_303_909_860, 0) + // Standard Error: 546_745 + .saturating_add(Weight::from_parts(116_603_682, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_942_765_000 picoseconds. - Weight::from_parts(2_852_597_513, 0) - // Standard Error: 14_069 - .saturating_add(Weight::from_parts(12_388_759, 0).saturating_mul(n.into())) + // Minimum execution time: 2_276_723_000 picoseconds. + Weight::from_parts(2_217_739_410, 0) + // Standard Error: 14_370 + .saturating_add(Weight::from_parts(12_459_132, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_236_000 picoseconds. - Weight::from_parts(108_121_903, 0) - // Standard Error: 338_552 - .saturating_add(Weight::from_parts(130_391_399, 0).saturating_mul(r.into())) + // Minimum execution time: 84_311_000 picoseconds. + Weight::from_parts(110_540_924, 0) + // Standard Error: 396_634 + .saturating_add(Weight::from_parts(112_631_557, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 143_555_000 picoseconds. - Weight::from_parts(145_256_000, 0) - // Standard Error: 61_456 - .saturating_add(Weight::from_parts(25_766_308, 0).saturating_mul(n.into())) + // Minimum execution time: 147_382_000 picoseconds. + Weight::from_parts(148_605_000, 0) + // Standard Error: 51_888 + .saturating_add(Weight::from_parts(25_568_730, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_706_000 picoseconds. - Weight::from_parts(82_734_112, 0) - // Standard Error: 323_634 - .saturating_add(Weight::from_parts(107_133_410, 0).saturating_mul(r.into())) + // Minimum execution time: 84_124_000 picoseconds. + Weight::from_parts(74_488_011, 0) + // Standard Error: 336_019 + .saturating_add(Weight::from_parts(76_615_014, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_050_000 picoseconds. - Weight::from_parts(88_261_802, 0) - // Standard Error: 247_640 - .saturating_add(Weight::from_parts(23_580_197, 0).saturating_mul(r.into())) + // Minimum execution time: 83_719_000 picoseconds. + Weight::from_parts(89_610_961, 0) + // Standard Error: 278_492 + .saturating_add(Weight::from_parts(19_580_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_558_000 picoseconds. - Weight::from_parts(90_338_028, 0) - // Standard Error: 270_999 - .saturating_add(Weight::from_parts(15_249_771, 0).saturating_mul(r.into())) + // Minimum execution time: 81_624_000 picoseconds. + Weight::from_parts(87_152_636, 0) + // Standard Error: 283_157 + .saturating_add(Weight::from_parts(13_618_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_250_000 picoseconds. - Weight::from_parts(90_448_269, 0) - // Standard Error: 274_039 - .saturating_add(Weight::from_parts(12_874_930, 0).saturating_mul(r.into())) + // Minimum execution time: 81_833_000 picoseconds. + Weight::from_parts(85_635_155, 0) + // Standard Error: 260_060 + .saturating_add(Weight::from_parts(16_305_744, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_278_000 picoseconds. - Weight::from_parts(88_025_842, 0) - // Standard Error: 274_359 - .saturating_add(Weight::from_parts(11_610_357, 0).saturating_mul(r.into())) + // Minimum execution time: 81_742_000 picoseconds. + Weight::from_parts(87_140_859, 0) + // Standard Error: 385_164 + .saturating_add(Weight::from_parts(11_568_440, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_849_000 picoseconds. - Weight::from_parts(87_858_273, 0) - // Standard Error: 263_624 - .saturating_add(Weight::from_parts(14_636_926, 0).saturating_mul(r.into())) + // Minimum execution time: 81_910_000 picoseconds. + Weight::from_parts(85_444_924, 0) + // Standard Error: 294_573 + .saturating_add(Weight::from_parts(16_073_775, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 134_444_000 picoseconds. - Weight::from_parts(198_654_906, 0) - // Standard Error: 409_120 - .saturating_add(Weight::from_parts(200_669_427, 0).saturating_mul(r.into())) + // Minimum execution time: 137_851_000 picoseconds. + Weight::from_parts(184_343_853, 0) + // Standard Error: 304_576 + .saturating_add(Weight::from_parts(157_917_607, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_737_000 picoseconds. - Weight::from_parts(162_389_592, 0) - // Standard Error: 437_002 - .saturating_add(Weight::from_parts(385_229_944, 0).saturating_mul(r.into())) + // Minimum execution time: 97_606_000 picoseconds. + Weight::from_parts(153_936_115, 0) + // Standard Error: 400_073 + .saturating_add(Weight::from_parts(335_598_380, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1059,22 +1059,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 44_710_614_000 picoseconds. - Weight::from_parts(44_848_530_000, 0) - // Standard Error: 271_081 - .saturating_add(Weight::from_parts(7_518_236, 0).saturating_mul(p.into())) - // Standard Error: 271_067 - .saturating_add(Weight::from_parts(176_484_363, 0).saturating_mul(s.into())) + // Minimum execution time: 42_747_420_000 picoseconds. + Weight::from_parts(42_968_891_000, 0) + // Standard Error: 252_454 + .saturating_add(Weight::from_parts(7_443_047, 0).saturating_mul(p.into())) + // Standard Error: 252_442 + .saturating_add(Weight::from_parts(177_458_321, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_935_000 picoseconds. - Weight::from_parts(155_283_975, 0) - // Standard Error: 398_331 - .saturating_add(Weight::from_parts(394_750_144, 0).saturating_mul(r.into())) + // Minimum execution time: 94_879_000 picoseconds. + Weight::from_parts(157_991_694, 0) + // Standard Error: 362_276 + .saturating_add(Weight::from_parts(340_199_652, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1082,32 +1082,32 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_166_105_000 picoseconds. - Weight::from_parts(43_210_411_000, 0) - // Standard Error: 273_792 - .saturating_add(Weight::from_parts(7_685_961, 0).saturating_mul(p.into())) - // Standard Error: 273_779 - .saturating_add(Weight::from_parts(177_206_473, 0).saturating_mul(s.into())) + // Minimum execution time: 45_940_234_000 picoseconds. + Weight::from_parts(45_999_634_000, 0) + // Standard Error: 269_136 + .saturating_add(Weight::from_parts(7_028_589, 0).saturating_mul(p.into())) + // Standard Error: 269_123 + .saturating_add(Weight::from_parts(176_610_610, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_385_000 picoseconds. - Weight::from_parts(100_368_488, 0) - // Standard Error: 25_882 - .saturating_add(Weight::from_parts(2_517_495, 0).saturating_mul(r.into())) + // Minimum execution time: 86_303_000 picoseconds. + Weight::from_parts(100_845_158, 0) + // Standard Error: 28_180 + .saturating_add(Weight::from_parts(1_828_410, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 86_723_000 picoseconds. - Weight::from_parts(112_959_650, 1131) - // Standard Error: 5_171 - .saturating_add(Weight::from_parts(11_884_248, 0).saturating_mul(p.into())) + // Minimum execution time: 86_742_000 picoseconds. + Weight::from_parts(110_790_993, 1131) + // Standard Error: 6_233 + .saturating_add(Weight::from_parts(11_802_147, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1116,10 +1116,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_367_000 picoseconds. - Weight::from_parts(86_968_000, 1131) - // Standard Error: 35_935 - .saturating_add(Weight::from_parts(35_294_476, 0).saturating_mul(p.into())) + // Minimum execution time: 83_916_000 picoseconds. + Weight::from_parts(85_870_000, 1131) + // Standard Error: 27_705 + .saturating_add(Weight::from_parts(35_450_394, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1128,10 +1128,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_166_740_000 picoseconds. - Weight::from_parts(5_878_966_706, 5069931) - // Standard Error: 72_748 - .saturating_add(Weight::from_parts(35_598_278, 0).saturating_mul(p.into())) + // Minimum execution time: 6_097_917_000 picoseconds. + Weight::from_parts(5_604_890_798, 5069931) + // Standard Error: 98_374 + .saturating_add(Weight::from_parts(36_989_630, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1139,10 +1139,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 84_509_000 picoseconds. - Weight::from_parts(86_396_000, 1939) - // Standard Error: 37_909 - .saturating_add(Weight::from_parts(46_229_201, 0).saturating_mul(p.into())) + // Minimum execution time: 82_707_000 picoseconds. + Weight::from_parts(84_791_000, 1939) + // Standard Error: 37_959 + .saturating_add(Weight::from_parts(47_195_271, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1151,10 +1151,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 89_570_000 picoseconds. - Weight::from_parts(91_679_907, 1131) - // Standard Error: 74_102 - .saturating_add(Weight::from_parts(36_034_356, 0).saturating_mul(p.into())) + // Minimum execution time: 89_993_000 picoseconds. + Weight::from_parts(89_503_538, 1131) + // Standard Error: 59_714 + .saturating_add(Weight::from_parts(36_297_330, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1163,10 +1163,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 581_516_000 picoseconds. - Weight::from_parts(574_828_964, 1496) - // Standard Error: 226_535 - .saturating_add(Weight::from_parts(44_029_625, 0).saturating_mul(p.into())) + // Minimum execution time: 592_496_000 picoseconds. + Weight::from_parts(565_533_871, 1496) + // Standard Error: 314_500 + .saturating_add(Weight::from_parts(55_506_484, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1175,10 +1175,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 984_554_000 picoseconds. - Weight::from_parts(1_010_300_775, 317931) - // Standard Error: 330_750 - .saturating_add(Weight::from_parts(45_768_209, 0).saturating_mul(p.into())) + // Minimum execution time: 993_621_000 picoseconds. + Weight::from_parts(1_012_993_434, 317931) + // Standard Error: 387_880 + .saturating_add(Weight::from_parts(53_105_611, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1186,883 +1186,885 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_399_000 picoseconds. - Weight::from_parts(2_513_898, 0) - // Standard Error: 22_468 - .saturating_add(Weight::from_parts(24_974_238, 0).saturating_mul(r.into())) + // Minimum execution time: 2_180_000 picoseconds. + Weight::from_parts(2_367_513, 0) + // Standard Error: 8_775 + .saturating_add(Weight::from_parts(24_100_608, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_354_805_000 picoseconds. - Weight::from_parts(4_247_725_842, 0) - // Standard Error: 49_167 - .saturating_add(Weight::from_parts(4_375_644, 0).saturating_mul(r.into())) + // Minimum execution time: 4_344_543_000 picoseconds. + Weight::from_parts(4_032_382_572, 0) + // Standard Error: 99_537 + .saturating_add(Weight::from_parts(5_787_910, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_344_769_000 picoseconds. - Weight::from_parts(4_143_583_164, 0) - // Standard Error: 64_865 - .saturating_add(Weight::from_parts(4_885_201, 0).saturating_mul(r.into())) + // Minimum execution time: 4_337_766_000 picoseconds. + Weight::from_parts(3_999_679_120, 0) + // Standard Error: 103_253 + .saturating_add(Weight::from_parts(5_927_871, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_321_597_000 picoseconds. - Weight::from_parts(10_856_474_625, 0) - // Standard Error: 228_480 - .saturating_add(Weight::from_parts(13_648_467, 0).saturating_mul(r.into())) + // Minimum execution time: 10_550_469_000 picoseconds. + Weight::from_parts(11_379_288_782, 0) + // Standard Error: 199_762 + .saturating_add(Weight::from_parts(12_085_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_444_861_000 picoseconds. - Weight::from_parts(11_811_924_847, 0) - // Standard Error: 220_732 - .saturating_add(Weight::from_parts(8_104_347, 0).saturating_mul(r.into())) + // Minimum execution time: 10_371_806_000 picoseconds. + Weight::from_parts(11_315_025_252, 0) + // Standard Error: 196_400 + .saturating_add(Weight::from_parts(9_868_462, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(2_199_000, 0) - // Standard Error: 8_145 - .saturating_add(Weight::from_parts(3_817_860, 0).saturating_mul(r.into())) + // Minimum execution time: 2_296_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 8_522 + .saturating_add(Weight::from_parts(3_812_287, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_084_000 picoseconds. - Weight::from_parts(2_171_000, 0) - // Standard Error: 5_734 - .saturating_add(Weight::from_parts(3_044_285, 0).saturating_mul(r.into())) + // Minimum execution time: 2_250_000 picoseconds. + Weight::from_parts(2_293_000, 0) + // Standard Error: 5_596 + .saturating_add(Weight::from_parts(3_015_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_074_000 picoseconds. - Weight::from_parts(3_341_361, 0) - // Standard Error: 1_168 - .saturating_add(Weight::from_parts(1_569_364, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(3_286_665, 0) + // Standard Error: 1_124 + .saturating_add(Weight::from_parts(1_572_972, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_562 - .saturating_add(Weight::from_parts(2_914_810, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 8_691 + .saturating_add(Weight::from_parts(2_934_320, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(99_037, 0) - // Standard Error: 11_949 - .saturating_add(Weight::from_parts(5_173_684, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(1_393_237, 0) + // Standard Error: 11_704 + .saturating_add(Weight::from_parts(5_179_849, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_992_000 picoseconds. - Weight::from_parts(6_256_207, 0) - // Standard Error: 1_332 - .saturating_add(Weight::from_parts(161_069, 0).saturating_mul(e.into())) + // Minimum execution time: 7_013_000 picoseconds. + Weight::from_parts(5_664_804, 0) + // Standard Error: 2_473 + .saturating_add(Weight::from_parts(127_877, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_106_000 picoseconds. - Weight::from_parts(4_233_365, 0) - // Standard Error: 7_839 - .saturating_add(Weight::from_parts(2_631_387, 0).saturating_mul(r.into())) + // Minimum execution time: 2_351_000 picoseconds. + Weight::from_parts(4_248_352, 0) + // Standard Error: 5_303 + .saturating_add(Weight::from_parts(2_564_771, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_631_387 - - 2_404_882, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_564_771 - + 2_417_980, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(4_830_171, 0) - // Standard Error: 12_370 - .saturating_add(Weight::from_parts(2_404_882, 0).saturating_mul(r.into())) + // Minimum execution time: 2_275_000 picoseconds. + Weight::from_parts(4_116_849, 0) + // Standard Error: 12_318 + .saturating_add(Weight::from_parts(2_417_980, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_413_000 picoseconds. - Weight::from_parts(16_855_535, 0) - // Standard Error: 25_880 - .saturating_add(Weight::from_parts(10_029_290, 0).saturating_mul(r.into())) + // Minimum execution time: 2_739_000 picoseconds. + Weight::from_parts(8_247_555, 0) + // Standard Error: 21_570 + .saturating_add(Weight::from_parts(10_290_172, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_145_000 picoseconds. - Weight::from_parts(4_520_615, 0) - // Standard Error: 6_765 - .saturating_add(Weight::from_parts(1_202_471, 0).saturating_mul(p.into())) + // Minimum execution time: 11_969_000 picoseconds. + Weight::from_parts(462_240, 0) + // Standard Error: 7_690 + .saturating_add(Weight::from_parts(1_320_559, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(_l: u32, ) -> Weight { + fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_133_000 picoseconds. - Weight::from_parts(5_476_163, 0) + // Minimum execution time: 5_385_000 picoseconds. + Weight::from_parts(5_731_863, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(7, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_117_000 picoseconds. - Weight::from_parts(1_458_597, 0) - // Standard Error: 3_356 - .saturating_add(Weight::from_parts(265_574, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(1_509_226, 0) + // Standard Error: 3_855 + .saturating_add(Weight::from_parts(289_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_135_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 5_214 - .saturating_add(Weight::from_parts(766_010, 0).saturating_mul(r.into())) + // Minimum execution time: 2_290_000 picoseconds. + Weight::from_parts(2_403_000, 0) + // Standard Error: 6_135 + .saturating_add(Weight::from_parts(808_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_078_000 picoseconds. - Weight::from_parts(2_218_000, 0) - // Standard Error: 5_801 - .saturating_add(Weight::from_parts(743_573, 0).saturating_mul(r.into())) + // Minimum execution time: 2_206_000 picoseconds. + Weight::from_parts(2_259_000, 0) + // Standard Error: 6_737 + .saturating_add(Weight::from_parts(815_196, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_226_000 picoseconds. - Weight::from_parts(2_093_625, 0) - // Standard Error: 7_678 - .saturating_add(Weight::from_parts(824_956, 0).saturating_mul(r.into())) + // Minimum execution time: 6_514_000 picoseconds. + Weight::from_parts(2_989_795, 0) + // Standard Error: 8_020 + .saturating_add(Weight::from_parts(785_708, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_201_000 picoseconds. - Weight::from_parts(154_770, 0) - // Standard Error: 9_398 - .saturating_add(Weight::from_parts(1_480_245, 0).saturating_mul(r.into())) + // Minimum execution time: 6_390_000 picoseconds. + Weight::from_parts(6_462_000, 0) + // Standard Error: 8_592 + .saturating_add(Weight::from_parts(1_340_863, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_989_000 picoseconds. - Weight::from_parts(2_628_082, 0) - // Standard Error: 12_268 - .saturating_add(Weight::from_parts(6_921_043, 0).saturating_mul(r.into())) + // Minimum execution time: 4_894_000 picoseconds. + Weight::from_parts(1_962_792, 0) + // Standard Error: 10_808 + .saturating_add(Weight::from_parts(6_909_000, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_086_000 picoseconds. - Weight::from_parts(2_156_000, 0) - // Standard Error: 5_477 - .saturating_add(Weight::from_parts(3_348_027, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 9_270 + .saturating_add(Weight::from_parts(3_370_154, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(2_163_000, 0) - // Standard Error: 6_833 - .saturating_add(Weight::from_parts(3_134_916, 0).saturating_mul(r.into())) + // Minimum execution time: 2_214_000 picoseconds. + Weight::from_parts(2_328_000, 0) + // Standard Error: 6_565 + .saturating_add(Weight::from_parts(3_096_942, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_209_000, 0) - // Standard Error: 7_612 - .saturating_add(Weight::from_parts(3_170_404, 0).saturating_mul(r.into())) + // Minimum execution time: 2_301_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 5_842 + .saturating_add(Weight::from_parts(3_131_625, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_124_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 4_823 - .saturating_add(Weight::from_parts(2_668_874, 0).saturating_mul(r.into())) + // Minimum execution time: 2_290_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 5_456 + .saturating_add(Weight::from_parts(2_643_149, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_159_000 picoseconds. - Weight::from_parts(2_240_000, 0) - // Standard Error: 3_992 - .saturating_add(Weight::from_parts(559_604, 0).saturating_mul(r.into())) + // Minimum execution time: 2_207_000 picoseconds. + Weight::from_parts(2_259_000, 0) + // Standard Error: 4_151 + .saturating_add(Weight::from_parts(559_292, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(1_178_239, 0) - // Standard Error: 3_346 - .saturating_add(Weight::from_parts(416_704, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(1_656_873, 0) + // Standard Error: 3_537 + .saturating_add(Weight::from_parts(394_264, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 11_707 - .saturating_add(Weight::from_parts(1_918_501, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_300_000, 0) + // Standard Error: 13_227 + .saturating_add(Weight::from_parts(1_891_285, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 7_593 - .saturating_add(Weight::from_parts(1_219_931, 0).saturating_mul(r.into())) + // Minimum execution time: 2_197_000 picoseconds. + Weight::from_parts(2_297_000, 0) + // Standard Error: 9_416 + .saturating_add(Weight::from_parts(1_195_412, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_124_000 picoseconds. - Weight::from_parts(726_401, 0) - // Standard Error: 4_086 - .saturating_add(Weight::from_parts(424_161, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(1_244_456, 0) + // Standard Error: 3_993 + .saturating_add(Weight::from_parts(393_631, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(1_225_918, 0) - // Standard Error: 3_748 - .saturating_add(Weight::from_parts(392_373, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(1_710_108, 0) + // Standard Error: 3_705 + .saturating_add(Weight::from_parts(357_471, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(11_174, 0) - // Standard Error: 5_816 - .saturating_add(Weight::from_parts(594_467, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_350_000, 0) + // Standard Error: 4_034 + .saturating_add(Weight::from_parts(496_786, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_138_000 picoseconds. - Weight::from_parts(12_680, 0) - // Standard Error: 5_830 - .saturating_add(Weight::from_parts(595_552, 0).saturating_mul(r.into())) + // Minimum execution time: 2_251_000 picoseconds. + Weight::from_parts(143_742, 0) + // Standard Error: 5_409 + .saturating_add(Weight::from_parts(551_665, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(172_344, 0) - // Standard Error: 5_372 - .saturating_add(Weight::from_parts(537_510, 0).saturating_mul(r.into())) + // Minimum execution time: 2_250_000 picoseconds. + Weight::from_parts(210_302, 0) + // Standard Error: 5_693 + .saturating_add(Weight::from_parts(526_432, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_171_000 picoseconds. - Weight::from_parts(459_682, 0) - // Standard Error: 5_533 - .saturating_add(Weight::from_parts(421_155, 0).saturating_mul(r.into())) + // Minimum execution time: 2_246_000 picoseconds. + Weight::from_parts(1_582_329, 0) + // Standard Error: 3_448 + .saturating_add(Weight::from_parts(348_194, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_640_857, 0) - // Standard Error: 2_132 - .saturating_add(Weight::from_parts(175_772, 0).saturating_mul(r.into())) + // Minimum execution time: 2_350_000 picoseconds. + Weight::from_parts(2_836_265, 0) + // Standard Error: 1_916 + .saturating_add(Weight::from_parts(158_153, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_149_000 picoseconds. - Weight::from_parts(2_625_890, 0) - // Standard Error: 2_246 - .saturating_add(Weight::from_parts(177_728, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_997_599, 0) + // Standard Error: 1_870 + .saturating_add(Weight::from_parts(155_117, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_082_000 picoseconds. - Weight::from_parts(2_193_000, 0) - // Standard Error: 9_664 - .saturating_add(Weight::from_parts(1_832_396, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 11_719 + .saturating_add(Weight::from_parts(1_911_693, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_029_000 picoseconds. - Weight::from_parts(2_185_000, 0) - // Standard Error: 7_691 - .saturating_add(Weight::from_parts(1_203_465, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_323_000, 0) + // Standard Error: 7_734 + .saturating_add(Weight::from_parts(1_135_022, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_146_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 10_390 - .saturating_add(Weight::from_parts(1_868_795, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_254_000, 0) + // Standard Error: 13_208 + .saturating_add(Weight::from_parts(1_839_828, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_082_000 picoseconds. - Weight::from_parts(2_133_000, 0) - // Standard Error: 8_282 - .saturating_add(Weight::from_parts(1_199_983, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 7_621 + .saturating_add(Weight::from_parts(1_164_880, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_145_000 picoseconds. - Weight::from_parts(2_178_000, 0) - // Standard Error: 10_175 - .saturating_add(Weight::from_parts(1_943_386, 0).saturating_mul(r.into())) + // Minimum execution time: 2_238_000 picoseconds. + Weight::from_parts(2_291_000, 0) + // Standard Error: 10_468 + .saturating_add(Weight::from_parts(1_846_638, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_168_000, 0) - // Standard Error: 6_923 - .saturating_add(Weight::from_parts(1_125_091, 0).saturating_mul(r.into())) + // Minimum execution time: 2_240_000 picoseconds. + Weight::from_parts(2_308_000, 0) + // Standard Error: 7_502 + .saturating_add(Weight::from_parts(1_112_456, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 11_944 - .saturating_add(Weight::from_parts(1_852_545, 0).saturating_mul(r.into())) + // Minimum execution time: 2_192_000 picoseconds. + Weight::from_parts(2_283_000, 0) + // Standard Error: 12_282 + .saturating_add(Weight::from_parts(1_806_513, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_121_000, 0) - // Standard Error: 7_914 - .saturating_add(Weight::from_parts(1_171_461, 0).saturating_mul(r.into())) + // Minimum execution time: 2_250_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 8_080 + .saturating_add(Weight::from_parts(1_114_020, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_171_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 10_701 - .saturating_add(Weight::from_parts(1_859_283, 0).saturating_mul(r.into())) + // Minimum execution time: 2_270_000 picoseconds. + Weight::from_parts(2_319_000, 0) + // Standard Error: 11_947 + .saturating_add(Weight::from_parts(1_858_303, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_209_000, 0) - // Standard Error: 7_361 - .saturating_add(Weight::from_parts(1_182_113, 0).saturating_mul(r.into())) + // Minimum execution time: 2_204_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 9_452 + .saturating_add(Weight::from_parts(1_236_546, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_239_000, 0) - // Standard Error: 12_468 - .saturating_add(Weight::from_parts(1_847_236, 0).saturating_mul(r.into())) + // Minimum execution time: 2_222_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 9_388 + .saturating_add(Weight::from_parts(1_920_612, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_072_000 picoseconds. - Weight::from_parts(2_164_000, 0) - // Standard Error: 8_208 - .saturating_add(Weight::from_parts(1_117_969, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(2_316_000, 0) + // Standard Error: 7_906 + .saturating_add(Weight::from_parts(1_147_958, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_155_000, 0) - // Standard Error: 9_963 - .saturating_add(Weight::from_parts(1_877_035, 0).saturating_mul(r.into())) + // Minimum execution time: 2_233_000 picoseconds. + Weight::from_parts(2_278_000, 0) + // Standard Error: 14_090 + .saturating_add(Weight::from_parts(1_923_509, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 7_561 - .saturating_add(Weight::from_parts(1_124_600, 0).saturating_mul(r.into())) + // Minimum execution time: 2_216_000 picoseconds. + Weight::from_parts(2_271_000, 0) + // Standard Error: 9_629 + .saturating_add(Weight::from_parts(1_197_507, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_210_000, 0) - // Standard Error: 11_998 - .saturating_add(Weight::from_parts(1_829_852, 0).saturating_mul(r.into())) + // Minimum execution time: 2_268_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 10_951 + .saturating_add(Weight::from_parts(1_915_569, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_098_000 picoseconds. - Weight::from_parts(2_189_000, 0) - // Standard Error: 8_286 - .saturating_add(Weight::from_parts(1_189_196, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 8_283 + .saturating_add(Weight::from_parts(1_212_268, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_125_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 10_056 - .saturating_add(Weight::from_parts(1_829_185, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_283_000, 0) + // Standard Error: 11_398 + .saturating_add(Weight::from_parts(1_932_092, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_065_000 picoseconds. - Weight::from_parts(2_174_000, 0) - // Standard Error: 8_171 - .saturating_add(Weight::from_parts(1_176_701, 0).saturating_mul(r.into())) + // Minimum execution time: 2_278_000 picoseconds. + Weight::from_parts(2_324_000, 0) + // Standard Error: 8_582 + .saturating_add(Weight::from_parts(1_170_243, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_141_000 picoseconds. - Weight::from_parts(2_220_000, 0) - // Standard Error: 9_910 - .saturating_add(Weight::from_parts(1_871_442, 0).saturating_mul(r.into())) + // Minimum execution time: 2_216_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 13_115 + .saturating_add(Weight::from_parts(1_902_257, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_024_000 picoseconds. - Weight::from_parts(2_166_000, 0) - // Standard Error: 7_933 - .saturating_add(Weight::from_parts(1_156_214, 0).saturating_mul(r.into())) + // Minimum execution time: 2_277_000 picoseconds. + Weight::from_parts(2_358_000, 0) + // Standard Error: 9_006 + .saturating_add(Weight::from_parts(1_220_902, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_068_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 7_815 - .saturating_add(Weight::from_parts(1_353_927, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_316_000, 0) + // Standard Error: 8_357 + .saturating_add(Weight::from_parts(1_302_969, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_208_000, 0) - // Standard Error: 4_587 - .saturating_add(Weight::from_parts(635_023, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(2_275_000, 0) + // Standard Error: 5_837 + .saturating_add(Weight::from_parts(637_533, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_080_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 8_399 - .saturating_add(Weight::from_parts(1_278_782, 0).saturating_mul(r.into())) + // Minimum execution time: 2_182_000 picoseconds. + Weight::from_parts(2_253_000, 0) + // Standard Error: 7_474 + .saturating_add(Weight::from_parts(1_274_444, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_069_000 picoseconds. - Weight::from_parts(2_233_000, 0) - // Standard Error: 6_395 - .saturating_add(Weight::from_parts(682_415, 0).saturating_mul(r.into())) + // Minimum execution time: 2_268_000 picoseconds. + Weight::from_parts(2_314_000, 0) + // Standard Error: 4_787 + .saturating_add(Weight::from_parts(598_295, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_206_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 9_477 - .saturating_add(Weight::from_parts(1_819_764, 0).saturating_mul(r.into())) + // Minimum execution time: 2_184_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 13_111 + .saturating_add(Weight::from_parts(1_764_139, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 7_615 - .saturating_add(Weight::from_parts(1_207_931, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 8_531 + .saturating_add(Weight::from_parts(1_233_195, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_108_000 picoseconds. - Weight::from_parts(1_363_438, 0) - // Standard Error: 18_139 - .saturating_add(Weight::from_parts(2_743_512, 0).saturating_mul(r.into())) + // Minimum execution time: 2_215_000 picoseconds. + Weight::from_parts(2_308_000, 0) + // Standard Error: 8_554 + .saturating_add(Weight::from_parts(2_787_034, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(726_043, 0) - // Standard Error: 12_539 - .saturating_add(Weight::from_parts(2_447_643, 0).saturating_mul(r.into())) + // Minimum execution time: 2_285_000 picoseconds. + Weight::from_parts(2_336_000, 0) + // Standard Error: 8_016 + .saturating_add(Weight::from_parts(2_444_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_118_000 picoseconds. - Weight::from_parts(1_113_814, 0) - // Standard Error: 15_837 - .saturating_add(Weight::from_parts(2_939_546, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_266_000, 0) + // Standard Error: 9_336 + .saturating_add(Weight::from_parts(3_001_762, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_121_000 picoseconds. - Weight::from_parts(2_089_486, 0) - // Standard Error: 15_833 - .saturating_add(Weight::from_parts(2_447_304, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_279_000, 0) + // Standard Error: 8_838 + .saturating_add(Weight::from_parts(2_479_926, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(2_235_000, 0) - // Standard Error: 16_089 - .saturating_add(Weight::from_parts(9_370_736, 0).saturating_mul(r.into())) + // Minimum execution time: 2_222_000 picoseconds. + Weight::from_parts(2_251_000, 0) + // Standard Error: 15_694 + .saturating_add(Weight::from_parts(9_400_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_191_000 picoseconds. - Weight::from_parts(3_207_641, 0) - // Standard Error: 45_758 - .saturating_add(Weight::from_parts(7_437_894, 0).saturating_mul(r.into())) + // Minimum execution time: 2_177_000 picoseconds. + Weight::from_parts(2_262_000, 0) + // Standard Error: 24_148 + .saturating_add(Weight::from_parts(7_553_495, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_118_000 picoseconds. - Weight::from_parts(588_160, 0) - // Standard Error: 17_384 - .saturating_add(Weight::from_parts(2_989_240, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 8_791 + .saturating_add(Weight::from_parts(2_956_458, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_135_000 picoseconds. - Weight::from_parts(4_961_665, 0) - // Standard Error: 26_016 - .saturating_add(Weight::from_parts(2_253_733, 0).saturating_mul(r.into())) + // Minimum execution time: 2_280_000 picoseconds. + Weight::from_parts(2_297_000, 0) + // Standard Error: 7_657 + .saturating_add(Weight::from_parts(2_477_698, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 8_661 - .saturating_add(Weight::from_parts(1_328_375, 0).saturating_mul(r.into())) + // Minimum execution time: 2_206_000 picoseconds. + Weight::from_parts(2_261_000, 0) + // Standard Error: 8_702 + .saturating_add(Weight::from_parts(1_265_825, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(2_225_000, 0) - // Standard Error: 4_778 - .saturating_add(Weight::from_parts(648_611, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_243_000, 0) + // Standard Error: 5_815 + .saturating_add(Weight::from_parts(639_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_125_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 8_338 - .saturating_add(Weight::from_parts(1_260_241, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(2_299_000, 0) + // Standard Error: 8_918 + .saturating_add(Weight::from_parts(1_302_162, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(2_233_000, 0) - // Standard Error: 5_007 - .saturating_add(Weight::from_parts(642_088, 0).saturating_mul(r.into())) + // Minimum execution time: 2_278_000 picoseconds. + Weight::from_parts(2_329_000, 0) + // Standard Error: 4_483 + .saturating_add(Weight::from_parts(628_991, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_267_000, 0) - // Standard Error: 8_196 - .saturating_add(Weight::from_parts(1_328_828, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(2_264_000, 0) + // Standard Error: 9_628 + .saturating_add(Weight::from_parts(1_310_707, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_135_000 picoseconds. - Weight::from_parts(2_211_000, 0) - // Standard Error: 5_376 - .saturating_add(Weight::from_parts(693_541, 0).saturating_mul(r.into())) + // Minimum execution time: 2_197_000 picoseconds. + Weight::from_parts(2_261_000, 0) + // Standard Error: 4_478 + .saturating_add(Weight::from_parts(645_751, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_208_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 7_393 - .saturating_add(Weight::from_parts(1_144_418, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_327_000, 0) + // Standard Error: 8_607 + .saturating_add(Weight::from_parts(1_149_332, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 3_890 - .saturating_add(Weight::from_parts(589_899, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_263_000, 0) + // Standard Error: 4_008 + .saturating_add(Weight::from_parts(590_180, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_129_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 7_182 - .saturating_add(Weight::from_parts(1_101_585, 0).saturating_mul(r.into())) + // Minimum execution time: 2_158_000 picoseconds. + Weight::from_parts(2_285_000, 0) + // Standard Error: 8_280 + .saturating_add(Weight::from_parts(1_079_846, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_126_000, 0) - // Standard Error: 3_865 - .saturating_add(Weight::from_parts(588_357, 0).saturating_mul(r.into())) + // Minimum execution time: 2_310_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 3_875 + .saturating_add(Weight::from_parts(547_245, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_129_000 picoseconds. - Weight::from_parts(2_215_000, 0) - // Standard Error: 8_265 - .saturating_add(Weight::from_parts(1_152_496, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_315_000, 0) + // Standard Error: 9_477 + .saturating_add(Weight::from_parts(1_110_046, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_103_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 3_989 - .saturating_add(Weight::from_parts(614_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_305_000, 0) + // Standard Error: 4_474 + .saturating_add(Weight::from_parts(564_322, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_133_000 picoseconds. - Weight::from_parts(2_175_000, 0) - // Standard Error: 6_506 - .saturating_add(Weight::from_parts(1_096_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_271_000 picoseconds. + Weight::from_parts(2_318_000, 0) + // Standard Error: 8_819 + .saturating_add(Weight::from_parts(1_132_561, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_088_000 picoseconds. - Weight::from_parts(2_154_000, 0) - // Standard Error: 4_053 - .saturating_add(Weight::from_parts(582_323, 0).saturating_mul(r.into())) + // Minimum execution time: 2_240_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 4_113 + .saturating_add(Weight::from_parts(601_692, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_120_000 picoseconds. - Weight::from_parts(2_213_000, 0) - // Standard Error: 6_472 - .saturating_add(Weight::from_parts(1_056_569, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_253_000, 0) + // Standard Error: 7_294 + .saturating_add(Weight::from_parts(1_106_781, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_097_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 3_800 - .saturating_add(Weight::from_parts(579_517, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_268_000, 0) + // Standard Error: 4_653 + .saturating_add(Weight::from_parts(587_731, 0).saturating_mul(r.into())) } } @@ -2087,10 +2089,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_017_000 picoseconds. - Weight::from_parts(1_119_000, 0) - // Standard Error: 761 - .saturating_add(Weight::from_parts(209_074, 0).saturating_mul(c.into())) + // Minimum execution time: 1_012_000 picoseconds. + Weight::from_parts(1_102_000, 0) + // Standard Error: 721 + .saturating_add(Weight::from_parts(207_628, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. @@ -2098,10 +2100,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `113 + c * (1024 ±0)` // Estimated: `3577 + c * (1024 ±0)` - // Minimum execution time: 3_299_000 picoseconds. - Weight::from_parts(3_409_000, 3577) - // Standard Error: 809 - .saturating_add(Weight::from_parts(667_635, 0).saturating_mul(c.into())) + // Minimum execution time: 3_309_000 picoseconds. + Weight::from_parts(3_406_000, 3577) + // Standard Error: 759 + .saturating_add(Weight::from_parts(674_106, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2110,17 +2112,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 50_278_000 picoseconds. - Weight::from_parts(73_427_731, 0) - // Standard Error: 6_473 - .saturating_add(Weight::from_parts(2_331_768, 0).saturating_mul(c.into())) + // Minimum execution time: 52_127_000 picoseconds. + Weight::from_parts(74_742_938, 0) + // Standard Error: 5_397 + .saturating_add(Weight::from_parts(2_342_205, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: // Measured: `1050` // Estimated: `42875` - // Minimum execution time: 81_857_000 picoseconds. - Weight::from_parts(83_494_000, 42875) + // Minimum execution time: 84_245_000 picoseconds. + Weight::from_parts(85_847_000, 42875) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2128,8 +2130,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `958` // Estimated: `21477` - // Minimum execution time: 53_880_000 picoseconds. - Weight::from_parts(55_703_000, 21477) + // Minimum execution time: 55_566_000 picoseconds. + Weight::from_parts(57_030_000, 21477) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -2137,8 +2139,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `605` // Estimated: `17354` - // Minimum execution time: 28_976_000 picoseconds. - Weight::from_parts(30_055_000, 17354) + // Minimum execution time: 29_403_000 picoseconds. + Weight::from_parts(30_422_000, 17354) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2147,10 +2149,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_954_000 picoseconds. - Weight::from_parts(9_206_629, 7640) - // Standard Error: 40_915 - .saturating_add(Weight::from_parts(13_218_946, 0).saturating_mul(c.into())) + // Minimum execution time: 7_886_000 picoseconds. + Weight::from_parts(5_577_548, 7640) + // Standard Error: 36_666 + .saturating_add(Weight::from_parts(13_383_280, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -2159,10 +2161,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1439 + c * (16389 ±0)` // Estimated: `42034 + c * (131112 ±0)` - // Minimum execution time: 69_036_000 picoseconds. - Weight::from_parts(70_072_000, 42034) - // Standard Error: 149_794 - .saturating_add(Weight::from_parts(52_674_750, 0).saturating_mul(c.into())) + // Minimum execution time: 71_129_000 picoseconds. + Weight::from_parts(71_867_000, 42034) + // Standard Error: 194_431 + .saturating_add(Weight::from_parts(53_622_369, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2173,10 +2175,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `80` // Estimated: `5270` - // Minimum execution time: 61_042_000 picoseconds. - Weight::from_parts(42_647_149, 5270) - // Standard Error: 41_151 - .saturating_add(Weight::from_parts(51_906_843, 0).saturating_mul(c.into())) + // Minimum execution time: 63_441_000 picoseconds. + Weight::from_parts(69_716_978, 5270) + // Standard Error: 32_301 + .saturating_add(Weight::from_parts(51_458_430, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2185,10 +2187,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `742` // Estimated: `39419` - // Minimum execution time: 62_956_000 picoseconds. - Weight::from_parts(74_593_794, 39419) + // Minimum execution time: 64_601_000 picoseconds. + Weight::from_parts(94_970_592, 39419) // Standard Error: 0 - .saturating_add(Weight::from_parts(2_594, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_577, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2198,12 +2200,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `306` // Estimated: `35235` - // Minimum execution time: 10_939_548_000 picoseconds. - Weight::from_parts(505_483_291, 35235) - // Standard Error: 158_935 - .saturating_add(Weight::from_parts(51_999_053, 0).saturating_mul(c.into())) + // Minimum execution time: 10_884_487_000 picoseconds. + Weight::from_parts(321_953_387, 35235) + // Standard Error: 164_114 + .saturating_add(Weight::from_parts(51_946_894, 0).saturating_mul(c.into())) // Standard Error: 9 - .saturating_add(Weight::from_parts(2_500, 0).saturating_mul(s.into())) + .saturating_add(Weight::from_parts(2_506, 0).saturating_mul(s.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } @@ -2212,10 +2214,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `349` // Estimated: `23860` - // Minimum execution time: 54_714_000 picoseconds. - Weight::from_parts(39_682_905, 23860) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1_012, 0).saturating_mul(p.into())) + // Minimum execution time: 55_131_000 picoseconds. + Weight::from_parts(30_192_078, 23860) + // Standard Error: 1 + .saturating_add(Weight::from_parts(1_039, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(9_u64)) .saturating_add(RocksDbWeight::get().writes(8_u64)) } @@ -2224,10 +2226,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1049` // Estimated: `42866` - // Minimum execution time: 82_073_000 picoseconds. - Weight::from_parts(66_860_069, 42866) + // Minimum execution time: 85_069_000 picoseconds. + Weight::from_parts(72_149_865, 42866) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) + .saturating_add(Weight::from_parts(1_036, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(13_u64)) .saturating_add(RocksDbWeight::get().writes(10_u64)) } @@ -2236,10 +2238,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85981` - // Minimum execution time: 316_122_000 picoseconds. - Weight::from_parts(330_387_653, 85981) - // Standard Error: 1_030 - .saturating_add(Weight::from_parts(2_167, 0).saturating_mul(q.into())) + // Minimum execution time: 323_286_000 picoseconds. + Weight::from_parts(335_875_612, 85981) + // Standard Error: 1_331 + .saturating_add(Weight::from_parts(1_294, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().writes(23_u64)) } @@ -2248,8 +2250,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1066` // Estimated: `85905` - // Minimum execution time: 327_296_000 picoseconds. - Weight::from_parts(344_778_587, 85905) + // Minimum execution time: 333_261_000 picoseconds. + Weight::from_parts(348_059_151, 85905) .saturating_add(RocksDbWeight::get().reads(29_u64)) .saturating_add(RocksDbWeight::get().writes(23_u64)) } @@ -2258,10 +2260,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_031_000 picoseconds. - Weight::from_parts(45_572_000, 3899) - // Standard Error: 24_669 - .saturating_add(Weight::from_parts(50_090_777, 0).saturating_mul(c.into())) + // Minimum execution time: 45_732_000 picoseconds. + Weight::from_parts(46_437_000, 3899) + // Standard Error: 40_834 + .saturating_add(Weight::from_parts(51_504_684, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2271,630 +2273,630 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_663_000 picoseconds. - Weight::from_parts(84_983_000, 0) - // Standard Error: 4_066_232 - .saturating_add(Weight::from_parts(564_447_416, 0).saturating_mul(r.into())) + // Minimum execution time: 84_890_000 picoseconds. + Weight::from_parts(87_488_000, 0) + // Standard Error: 4_218_353 + .saturating_add(Weight::from_parts(584_751_765, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 311_448_000 picoseconds. - Weight::from_parts(245_631_815, 0) - // Standard Error: 7_937 - .saturating_add(Weight::from_parts(30_896_737, 0).saturating_mul(p.into())) + // Minimum execution time: 319_127_000 picoseconds. + Weight::from_parts(258_635_809, 0) + // Standard Error: 13_905 + .saturating_add(Weight::from_parts(32_129_635, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 149_067_000 picoseconds. - Weight::from_parts(130_181_921, 0) - // Standard Error: 294_281 - .saturating_add(Weight::from_parts(60_998_326, 0).saturating_mul(r.into())) + // Minimum execution time: 145_346_000 picoseconds. + Weight::from_parts(132_224_327, 0) + // Standard Error: 318_914 + .saturating_add(Weight::from_parts(64_020_177, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_222_000 picoseconds. - Weight::from_parts(94_195_714, 0) - // Standard Error: 3_616 - .saturating_add(Weight::from_parts(2_672_494, 0).saturating_mul(r.into())) + // Minimum execution time: 86_899_000 picoseconds. + Weight::from_parts(93_463_487, 0) + // Standard Error: 3_525 + .saturating_add(Weight::from_parts(2_288_372, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_429_000 picoseconds. - Weight::from_parts(171_049_360, 0) - // Standard Error: 31_588 - .saturating_add(Weight::from_parts(2_923_269, 0).saturating_mul(r.into())) + // Minimum execution time: 138_092_000 picoseconds. + Weight::from_parts(169_806_344, 0) + // Standard Error: 26_882 + .saturating_add(Weight::from_parts(2_254_783, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_992_000 picoseconds. - Weight::from_parts(115_936_976, 0) - // Standard Error: 414_340 - .saturating_add(Weight::from_parts(116_785_346, 0).saturating_mul(r.into())) + // Minimum execution time: 85_599_000 picoseconds. + Weight::from_parts(98_793_759, 0) + // Standard Error: 347_287 + .saturating_add(Weight::from_parts(87_526_184, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 87_790_000 picoseconds. - Weight::from_parts(90_746_200, 0) - // Standard Error: 270_835 - .saturating_add(Weight::from_parts(107_416_174, 0).saturating_mul(r.into())) + // Minimum execution time: 85_991_000 picoseconds. + Weight::from_parts(83_685_254, 0) + // Standard Error: 318_877 + .saturating_add(Weight::from_parts(76_389_253, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_210_000 picoseconds. - Weight::from_parts(91_082_335, 0) - // Standard Error: 211_867 - .saturating_add(Weight::from_parts(104_318_383, 0).saturating_mul(r.into())) + // Minimum execution time: 85_968_000 picoseconds. + Weight::from_parts(82_459_314, 0) + // Standard Error: 319_709 + .saturating_add(Weight::from_parts(76_181_704, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_806_000 picoseconds. - Weight::from_parts(85_438_969, 0) - // Standard Error: 248_652 - .saturating_add(Weight::from_parts(105_330_427, 0).saturating_mul(r.into())) + // Minimum execution time: 81_819_000 picoseconds. + Weight::from_parts(72_371_983, 0) + // Standard Error: 300_686 + .saturating_add(Weight::from_parts(76_316_802, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_654_000 picoseconds. - Weight::from_parts(82_257_210, 0) - // Standard Error: 336_548 - .saturating_add(Weight::from_parts(106_454_200, 0).saturating_mul(r.into())) + // Minimum execution time: 84_717_000 picoseconds. + Weight::from_parts(76_355_783, 0) + // Standard Error: 285_260 + .saturating_add(Weight::from_parts(75_781_825, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_452_000 picoseconds. - Weight::from_parts(82_661_045, 0) - // Standard Error: 286_452 - .saturating_add(Weight::from_parts(105_467_642, 0).saturating_mul(r.into())) + // Minimum execution time: 86_121_000 picoseconds. + Weight::from_parts(80_173_266, 0) + // Standard Error: 370_111 + .saturating_add(Weight::from_parts(77_146_163, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_893_000 picoseconds. - Weight::from_parts(81_216_834, 0) - // Standard Error: 315_266 - .saturating_add(Weight::from_parts(107_016_702, 0).saturating_mul(r.into())) + // Minimum execution time: 86_040_000 picoseconds. + Weight::from_parts(77_052_017, 0) + // Standard Error: 323_675 + .saturating_add(Weight::from_parts(75_764_467, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_282_000 picoseconds. - Weight::from_parts(82_548_887, 0) - // Standard Error: 341_172 - .saturating_add(Weight::from_parts(105_504_622, 0).saturating_mul(r.into())) + // Minimum execution time: 86_130_000 picoseconds. + Weight::from_parts(76_139_106, 0) + // Standard Error: 362_545 + .saturating_add(Weight::from_parts(80_573_769, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 556_352_000 picoseconds. - Weight::from_parts(607_493_748, 0) - // Standard Error: 448_674 - .saturating_add(Weight::from_parts(184_670_390, 0).saturating_mul(r.into())) + // Minimum execution time: 558_591_000 picoseconds. + Weight::from_parts(605_772_233, 0) + // Standard Error: 457_089 + .saturating_add(Weight::from_parts(135_861_811, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 714_496_000 picoseconds. - Weight::from_parts(722_520_000, 0) - // Standard Error: 46_538 - .saturating_add(Weight::from_parts(13_033_234, 0).saturating_mul(n.into())) + // Minimum execution time: 699_603_000 picoseconds. + Weight::from_parts(703_289_000, 0) + // Standard Error: 59_520 + .saturating_add(Weight::from_parts(12_949_265, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_627_000 picoseconds. - Weight::from_parts(85_563_243, 0) - // Standard Error: 311_752 - .saturating_add(Weight::from_parts(105_877_332, 0).saturating_mul(r.into())) + // Minimum execution time: 85_014_000 picoseconds. + Weight::from_parts(77_731_097, 0) + // Standard Error: 304_273 + .saturating_add(Weight::from_parts(75_976_070, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_852_000 picoseconds. - Weight::from_parts(84_860_381, 0) - // Standard Error: 321_988 - .saturating_add(Weight::from_parts(105_008_310, 0).saturating_mul(r.into())) + // Minimum execution time: 86_408_000 picoseconds. + Weight::from_parts(73_174_939, 0) + // Standard Error: 383_139 + .saturating_add(Weight::from_parts(76_484_364, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_396_000 picoseconds. - Weight::from_parts(89_972_413, 0) - // Standard Error: 338_324 - .saturating_add(Weight::from_parts(184_316_536, 0).saturating_mul(n.into())) + // Minimum execution time: 85_197_000 picoseconds. + Weight::from_parts(88_845_708, 0) + // Standard Error: 389_513 + .saturating_add(Weight::from_parts(171_448_634, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 89_385_000 picoseconds. - Weight::from_parts(90_760_000, 0) - // Standard Error: 4_378_367 - .saturating_add(Weight::from_parts(914_427_461, 0).saturating_mul(r.into())) + // Minimum execution time: 86_264_000 picoseconds. + Weight::from_parts(88_018_000, 0) + // Standard Error: 4_124_330 + .saturating_add(Weight::from_parts(805_432_550, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_060_000 picoseconds. - Weight::from_parts(138_647_807, 0) - // Standard Error: 449_220 - .saturating_add(Weight::from_parts(301_188_566, 0).saturating_mul(r.into())) + // Minimum execution time: 82_295_000 picoseconds. + Weight::from_parts(140_527_286, 0) + // Standard Error: 405_229 + .saturating_add(Weight::from_parts(251_699_250, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 391_797_000 picoseconds. - Weight::from_parts(394_943_000, 0) - // Standard Error: 58_663 - .saturating_add(Weight::from_parts(21_187_774, 0).saturating_mul(n.into())) + // Minimum execution time: 327_394_000 picoseconds. + Weight::from_parts(330_315_000, 0) + // Standard Error: 62_193 + .saturating_add(Weight::from_parts(21_097_102, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_418_000 picoseconds. - Weight::from_parts(149_848_797, 0) - // Standard Error: 459_492 - .saturating_add(Weight::from_parts(308_230_219, 0).saturating_mul(r.into())) + // Minimum execution time: 83_900_000 picoseconds. + Weight::from_parts(158_459_938, 0) + // Standard Error: 440_264 + .saturating_add(Weight::from_parts(252_444_195, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 390_635_000 picoseconds. - Weight::from_parts(395_782_000, 0) - // Standard Error: 61_326 - .saturating_add(Weight::from_parts(20_818_419, 0).saturating_mul(n.into())) + // Minimum execution time: 337_208_000 picoseconds. + Weight::from_parts(341_169_000, 0) + // Standard Error: 59_076 + .saturating_add(Weight::from_parts(20_945_135, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 561_280_000 picoseconds. - Weight::from_parts(634_390_717, 0) - // Standard Error: 473_236 - .saturating_add(Weight::from_parts(316_661_157, 0).saturating_mul(r.into())) + // Minimum execution time: 556_175_000 picoseconds. + Weight::from_parts(627_050_994, 0) + // Standard Error: 426_100 + .saturating_add(Weight::from_parts(261_080_337, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 559_804_000 picoseconds. - Weight::from_parts(650_695_494, 0) - // Standard Error: 489_218 - .saturating_add(Weight::from_parts(321_789_584, 0).saturating_mul(r.into())) + // Minimum execution time: 557_564_000 picoseconds. + Weight::from_parts(641_256_689, 0) + // Standard Error: 460_579 + .saturating_add(Weight::from_parts(266_649_825, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_345_000 picoseconds. - Weight::from_parts(74_080_057, 0) - // Standard Error: 328_119 - .saturating_add(Weight::from_parts(116_742_827, 0).saturating_mul(r.into())) + // Minimum execution time: 82_507_000 picoseconds. + Weight::from_parts(67_761_917, 0) + // Standard Error: 379_455 + .saturating_add(Weight::from_parts(86_652_007, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_307_192_000 picoseconds. - Weight::from_parts(2_419_334_440, 0) - // Standard Error: 484_032 - .saturating_add(Weight::from_parts(211_293_866, 0).saturating_mul(r.into())) + // Minimum execution time: 1_683_177_000 picoseconds. + Weight::from_parts(1_794_013_374, 0) + // Standard Error: 387_018 + .saturating_add(Weight::from_parts(156_399_549, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 346_160_000 picoseconds. - Weight::from_parts(348_777_000, 0) - // Standard Error: 58_661 - .saturating_add(Weight::from_parts(29_434_095, 0).saturating_mul(n.into())) + // Minimum execution time: 288_797_000 picoseconds. + Weight::from_parts(293_289_000, 0) + // Standard Error: 63_168 + .saturating_add(Weight::from_parts(29_577_277, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_292_607_000 picoseconds. - Weight::from_parts(2_434_102_108, 0) - // Standard Error: 502_502 - .saturating_add(Weight::from_parts(264_859_383, 0).saturating_mul(r.into())) + // Minimum execution time: 1_691_333_000 picoseconds. + Weight::from_parts(1_801_253_735, 0) + // Standard Error: 474_792 + .saturating_add(Weight::from_parts(209_949_939, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_289_426_000 picoseconds. - Weight::from_parts(2_437_443_919, 0) - // Standard Error: 471_320 - .saturating_add(Weight::from_parts(268_510_540, 0).saturating_mul(r.into())) + // Minimum execution time: 1_683_041_000 picoseconds. + Weight::from_parts(1_822_549_872, 0) + // Standard Error: 425_077 + .saturating_add(Weight::from_parts(211_798_367, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 242_827_000 picoseconds. - Weight::from_parts(291_906_943, 0) - // Standard Error: 419_132 - .saturating_add(Weight::from_parts(316_375_969, 0).saturating_mul(r.into())) + // Minimum execution time: 247_656_000 picoseconds. + Weight::from_parts(317_794_229, 0) + // Standard Error: 388_223 + .saturating_add(Weight::from_parts(266_464_404, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 554_876_000 picoseconds. - Weight::from_parts(559_277_000, 0) - // Standard Error: 59_610 - .saturating_add(Weight::from_parts(21_490_976, 0).saturating_mul(n.into())) + // Minimum execution time: 512_971_000 picoseconds. + Weight::from_parts(524_580_000, 0) + // Standard Error: 57_807 + .saturating_add(Weight::from_parts(21_296_153, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_443_317_000 picoseconds. - Weight::from_parts(2_625_227_536, 0) - // Standard Error: 511_289 - .saturating_add(Weight::from_parts(283_117_268, 0).saturating_mul(r.into())) + // Minimum execution time: 1_827_786_000 picoseconds. + Weight::from_parts(1_938_199_639, 0) + // Standard Error: 481_292 + .saturating_add(Weight::from_parts(230_397_609, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_099_000 picoseconds. - Weight::from_parts(88_574_604, 0) - // Standard Error: 274_173 - .saturating_add(Weight::from_parts(20_834_495, 0).saturating_mul(r.into())) + // Minimum execution time: 83_205_000 picoseconds. + Weight::from_parts(87_841_924, 0) + // Standard Error: 284_081 + .saturating_add(Weight::from_parts(20_304_775, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_246_000 picoseconds. - Weight::from_parts(90_382_254, 0) - // Standard Error: 1_257 - .saturating_add(Weight::from_parts(428_781, 0).saturating_mul(n.into())) + // Minimum execution time: 103_357_000 picoseconds. + Weight::from_parts(89_286_787, 0) + // Standard Error: 1_068 + .saturating_add(Weight::from_parts(423_323, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_454_000 picoseconds. - Weight::from_parts(90_235_951, 0) - // Standard Error: 256_364 - .saturating_add(Weight::from_parts(14_555_548, 0).saturating_mul(r.into())) + // Minimum execution time: 82_492_000 picoseconds. + Weight::from_parts(86_217_226, 0) + // Standard Error: 241_578 + .saturating_add(Weight::from_parts(18_632_173, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_189_000 picoseconds. - Weight::from_parts(91_177_961, 0) - // Standard Error: 1_127 - .saturating_add(Weight::from_parts(424_751, 0).saturating_mul(n.into())) + // Minimum execution time: 101_997_000 picoseconds. + Weight::from_parts(93_566_446, 0) + // Standard Error: 1_152 + .saturating_add(Weight::from_parts(421_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_893_000 picoseconds. - Weight::from_parts(88_684_789, 0) - // Standard Error: 287_468 - .saturating_add(Weight::from_parts(16_661_810, 0).saturating_mul(r.into())) + // Minimum execution time: 81_647_000 picoseconds. + Weight::from_parts(85_634_187, 0) + // Standard Error: 241_527 + .saturating_add(Weight::from_parts(16_147_912, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_534_000 picoseconds. - Weight::from_parts(88_923_020, 0) - // Standard Error: 249_896 - .saturating_add(Weight::from_parts(19_208_979, 0).saturating_mul(r.into())) + // Minimum execution time: 82_801_000 picoseconds. + Weight::from_parts(89_403_918, 0) + // Standard Error: 269_595 + .saturating_add(Weight::from_parts(13_226_181, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_229_000 picoseconds. - Weight::from_parts(120_908_395, 0) - // Standard Error: 327_109 - .saturating_add(Weight::from_parts(190_143_835, 0).saturating_mul(r.into())) + // Minimum execution time: 84_685_000 picoseconds. + Weight::from_parts(132_414_219, 0) + // Standard Error: 497_457 + .saturating_add(Weight::from_parts(145_777_097, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 98_549_000 picoseconds. - Weight::from_parts(100_553_000, 0) - // Standard Error: 2_727 - .saturating_add(Weight::from_parts(616_949, 0).saturating_mul(n.into())) + // Minimum execution time: 97_574_000 picoseconds. + Weight::from_parts(100_165_000, 0) + // Standard Error: 2_652 + .saturating_add(Weight::from_parts(625_145, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 553_918_000 picoseconds. - Weight::from_parts(572_988_848, 0) - // Standard Error: 2_210_952 - .saturating_add(Weight::from_parts(30_333_551, 0).saturating_mul(r.into())) + // Minimum execution time: 553_039_000 picoseconds. + Weight::from_parts(596_067_157, 0) + // Standard Error: 7_999_654 + .saturating_add(Weight::from_parts(49_166_442, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 552_664_000 picoseconds. - Weight::from_parts(571_824_067, 0) - // Standard Error: 1_981_598 - .saturating_add(Weight::from_parts(28_343_432, 0).saturating_mul(r.into())) + // Minimum execution time: 560_077_000 picoseconds. + Weight::from_parts(599_598_873, 0) + // Standard Error: 4_500_003 + .saturating_add(Weight::from_parts(54_967_826, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_114_000 picoseconds. - Weight::from_parts(99_799_695, 0) - // Standard Error: 263_342 - .saturating_add(Weight::from_parts(5_959_704, 0).saturating_mul(r.into())) + // Minimum execution time: 92_238_000 picoseconds. + Weight::from_parts(96_280_512, 0) + // Standard Error: 270_962 + .saturating_add(Weight::from_parts(10_382_887, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_595_000 picoseconds. - Weight::from_parts(94_900_895, 0) - // Standard Error: 1_221 - .saturating_add(Weight::from_parts(425_729, 0).saturating_mul(n.into())) + // Minimum execution time: 102_112_000 picoseconds. + Weight::from_parts(88_433_773, 0) + // Standard Error: 839 + .saturating_add(Weight::from_parts(426_982, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 94_123_000 picoseconds. - Weight::from_parts(99_068_002, 0) - // Standard Error: 278_340 - .saturating_add(Weight::from_parts(6_056_397, 0).saturating_mul(r.into())) + // Minimum execution time: 91_989_000 picoseconds. + Weight::from_parts(96_225_993, 0) + // Standard Error: 279_323 + .saturating_add(Weight::from_parts(12_960_106, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 106_148_000 picoseconds. - Weight::from_parts(93_583_351, 0) - // Standard Error: 1_048 - .saturating_add(Weight::from_parts(420_112, 0).saturating_mul(n.into())) + // Minimum execution time: 101_178_000 picoseconds. + Weight::from_parts(90_738_187, 0) + // Standard Error: 1_202 + .saturating_add(Weight::from_parts(427_278, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_951_000 picoseconds. - Weight::from_parts(80_983_069, 0) - // Standard Error: 260_297 - .saturating_add(Weight::from_parts(114_164_207, 0).saturating_mul(r.into())) + // Minimum execution time: 84_732_000 picoseconds. + Weight::from_parts(75_405_776, 0) + // Standard Error: 330_490 + .saturating_add(Weight::from_parts(78_457_591, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_991_000 picoseconds. - Weight::from_parts(83_808_552, 0) - // Standard Error: 291_596 - .saturating_add(Weight::from_parts(107_977_269, 0).saturating_mul(r.into())) + // Minimum execution time: 84_077_000 picoseconds. + Weight::from_parts(86_563_786, 0) + // Standard Error: 230_585 + .saturating_add(Weight::from_parts(75_198_113, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 555_192_000 picoseconds. - Weight::from_parts(637_741_196, 0) - // Standard Error: 498_770 - .saturating_add(Weight::from_parts(126_311_515, 0).saturating_mul(r.into())) + // Minimum execution time: 561_889_000 picoseconds. + Weight::from_parts(581_183_882, 0) + // Standard Error: 419_713 + .saturating_add(Weight::from_parts(98_014_698, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 567_642_000 picoseconds. - Weight::from_parts(587_862_774, 0) - // Standard Error: 1_100 - .saturating_add(Weight::from_parts(120_318, 0).saturating_mul(n.into())) + // Minimum execution time: 573_200_000 picoseconds. + Weight::from_parts(600_501_979, 0) + // Standard Error: 2_551 + .saturating_add(Weight::from_parts(132_221, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_764_152_000 picoseconds. - Weight::from_parts(2_885_803_691, 0) - // Standard Error: 562_616 - .saturating_add(Weight::from_parts(154_883_526, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_491_000 picoseconds. + Weight::from_parts(2_303_909_860, 0) + // Standard Error: 546_745 + .saturating_add(Weight::from_parts(116_603_682, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_942_765_000 picoseconds. - Weight::from_parts(2_852_597_513, 0) - // Standard Error: 14_069 - .saturating_add(Weight::from_parts(12_388_759, 0).saturating_mul(n.into())) + // Minimum execution time: 2_276_723_000 picoseconds. + Weight::from_parts(2_217_739_410, 0) + // Standard Error: 14_370 + .saturating_add(Weight::from_parts(12_459_132, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_236_000 picoseconds. - Weight::from_parts(108_121_903, 0) - // Standard Error: 338_552 - .saturating_add(Weight::from_parts(130_391_399, 0).saturating_mul(r.into())) + // Minimum execution time: 84_311_000 picoseconds. + Weight::from_parts(110_540_924, 0) + // Standard Error: 396_634 + .saturating_add(Weight::from_parts(112_631_557, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 143_555_000 picoseconds. - Weight::from_parts(145_256_000, 0) - // Standard Error: 61_456 - .saturating_add(Weight::from_parts(25_766_308, 0).saturating_mul(n.into())) + // Minimum execution time: 147_382_000 picoseconds. + Weight::from_parts(148_605_000, 0) + // Standard Error: 51_888 + .saturating_add(Weight::from_parts(25_568_730, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 88_706_000 picoseconds. - Weight::from_parts(82_734_112, 0) - // Standard Error: 323_634 - .saturating_add(Weight::from_parts(107_133_410, 0).saturating_mul(r.into())) + // Minimum execution time: 84_124_000 picoseconds. + Weight::from_parts(74_488_011, 0) + // Standard Error: 336_019 + .saturating_add(Weight::from_parts(76_615_014, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_050_000 picoseconds. - Weight::from_parts(88_261_802, 0) - // Standard Error: 247_640 - .saturating_add(Weight::from_parts(23_580_197, 0).saturating_mul(r.into())) + // Minimum execution time: 83_719_000 picoseconds. + Weight::from_parts(89_610_961, 0) + // Standard Error: 278_492 + .saturating_add(Weight::from_parts(19_580_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_558_000 picoseconds. - Weight::from_parts(90_338_028, 0) - // Standard Error: 270_999 - .saturating_add(Weight::from_parts(15_249_771, 0).saturating_mul(r.into())) + // Minimum execution time: 81_624_000 picoseconds. + Weight::from_parts(87_152_636, 0) + // Standard Error: 283_157 + .saturating_add(Weight::from_parts(13_618_763, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_250_000 picoseconds. - Weight::from_parts(90_448_269, 0) - // Standard Error: 274_039 - .saturating_add(Weight::from_parts(12_874_930, 0).saturating_mul(r.into())) + // Minimum execution time: 81_833_000 picoseconds. + Weight::from_parts(85_635_155, 0) + // Standard Error: 260_060 + .saturating_add(Weight::from_parts(16_305_744, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_278_000 picoseconds. - Weight::from_parts(88_025_842, 0) - // Standard Error: 274_359 - .saturating_add(Weight::from_parts(11_610_357, 0).saturating_mul(r.into())) + // Minimum execution time: 81_742_000 picoseconds. + Weight::from_parts(87_140_859, 0) + // Standard Error: 385_164 + .saturating_add(Weight::from_parts(11_568_440, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_849_000 picoseconds. - Weight::from_parts(87_858_273, 0) - // Standard Error: 263_624 - .saturating_add(Weight::from_parts(14_636_926, 0).saturating_mul(r.into())) + // Minimum execution time: 81_910_000 picoseconds. + Weight::from_parts(85_444_924, 0) + // Standard Error: 294_573 + .saturating_add(Weight::from_parts(16_073_775, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 134_444_000 picoseconds. - Weight::from_parts(198_654_906, 0) - // Standard Error: 409_120 - .saturating_add(Weight::from_parts(200_669_427, 0).saturating_mul(r.into())) + // Minimum execution time: 137_851_000 picoseconds. + Weight::from_parts(184_343_853, 0) + // Standard Error: 304_576 + .saturating_add(Weight::from_parts(157_917_607, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_737_000 picoseconds. - Weight::from_parts(162_389_592, 0) - // Standard Error: 437_002 - .saturating_add(Weight::from_parts(385_229_944, 0).saturating_mul(r.into())) + // Minimum execution time: 97_606_000 picoseconds. + Weight::from_parts(153_936_115, 0) + // Standard Error: 400_073 + .saturating_add(Weight::from_parts(335_598_380, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2902,22 +2904,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 44_710_614_000 picoseconds. - Weight::from_parts(44_848_530_000, 0) - // Standard Error: 271_081 - .saturating_add(Weight::from_parts(7_518_236, 0).saturating_mul(p.into())) - // Standard Error: 271_067 - .saturating_add(Weight::from_parts(176_484_363, 0).saturating_mul(s.into())) + // Minimum execution time: 42_747_420_000 picoseconds. + Weight::from_parts(42_968_891_000, 0) + // Standard Error: 252_454 + .saturating_add(Weight::from_parts(7_443_047, 0).saturating_mul(p.into())) + // Standard Error: 252_442 + .saturating_add(Weight::from_parts(177_458_321, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 93_935_000 picoseconds. - Weight::from_parts(155_283_975, 0) - // Standard Error: 398_331 - .saturating_add(Weight::from_parts(394_750_144, 0).saturating_mul(r.into())) + // Minimum execution time: 94_879_000 picoseconds. + Weight::from_parts(157_991_694, 0) + // Standard Error: 362_276 + .saturating_add(Weight::from_parts(340_199_652, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2925,32 +2927,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 43_166_105_000 picoseconds. - Weight::from_parts(43_210_411_000, 0) - // Standard Error: 273_792 - .saturating_add(Weight::from_parts(7_685_961, 0).saturating_mul(p.into())) - // Standard Error: 273_779 - .saturating_add(Weight::from_parts(177_206_473, 0).saturating_mul(s.into())) + // Minimum execution time: 45_940_234_000 picoseconds. + Weight::from_parts(45_999_634_000, 0) + // Standard Error: 269_136 + .saturating_add(Weight::from_parts(7_028_589, 0).saturating_mul(p.into())) + // Standard Error: 269_123 + .saturating_add(Weight::from_parts(176_610_610, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_385_000 picoseconds. - Weight::from_parts(100_368_488, 0) - // Standard Error: 25_882 - .saturating_add(Weight::from_parts(2_517_495, 0).saturating_mul(r.into())) + // Minimum execution time: 86_303_000 picoseconds. + Weight::from_parts(100_845_158, 0) + // Standard Error: 28_180 + .saturating_add(Weight::from_parts(1_828_410, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 86_723_000 picoseconds. - Weight::from_parts(112_959_650, 1131) - // Standard Error: 5_171 - .saturating_add(Weight::from_parts(11_884_248, 0).saturating_mul(p.into())) + // Minimum execution time: 86_742_000 picoseconds. + Weight::from_parts(110_790_993, 1131) + // Standard Error: 6_233 + .saturating_add(Weight::from_parts(11_802_147, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2959,10 +2961,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 85_367_000 picoseconds. - Weight::from_parts(86_968_000, 1131) - // Standard Error: 35_935 - .saturating_add(Weight::from_parts(35_294_476, 0).saturating_mul(p.into())) + // Minimum execution time: 83_916_000 picoseconds. + Weight::from_parts(85_870_000, 1131) + // Standard Error: 27_705 + .saturating_add(Weight::from_parts(35_450_394, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2971,10 +2973,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_166_740_000 picoseconds. - Weight::from_parts(5_878_966_706, 5069931) - // Standard Error: 72_748 - .saturating_add(Weight::from_parts(35_598_278, 0).saturating_mul(p.into())) + // Minimum execution time: 6_097_917_000 picoseconds. + Weight::from_parts(5_604_890_798, 5069931) + // Standard Error: 98_374 + .saturating_add(Weight::from_parts(36_989_630, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -2982,10 +2984,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 84_509_000 picoseconds. - Weight::from_parts(86_396_000, 1939) - // Standard Error: 37_909 - .saturating_add(Weight::from_parts(46_229_201, 0).saturating_mul(p.into())) + // Minimum execution time: 82_707_000 picoseconds. + Weight::from_parts(84_791_000, 1939) + // Standard Error: 37_959 + .saturating_add(Weight::from_parts(47_195_271, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -2994,10 +2996,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 89_570_000 picoseconds. - Weight::from_parts(91_679_907, 1131) - // Standard Error: 74_102 - .saturating_add(Weight::from_parts(36_034_356, 0).saturating_mul(p.into())) + // Minimum execution time: 89_993_000 picoseconds. + Weight::from_parts(89_503_538, 1131) + // Standard Error: 59_714 + .saturating_add(Weight::from_parts(36_297_330, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3006,10 +3008,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 581_516_000 picoseconds. - Weight::from_parts(574_828_964, 1496) - // Standard Error: 226_535 - .saturating_add(Weight::from_parts(44_029_625, 0).saturating_mul(p.into())) + // Minimum execution time: 592_496_000 picoseconds. + Weight::from_parts(565_533_871, 1496) + // Standard Error: 314_500 + .saturating_add(Weight::from_parts(55_506_484, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3018,10 +3020,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 984_554_000 picoseconds. - Weight::from_parts(1_010_300_775, 317931) - // Standard Error: 330_750 - .saturating_add(Weight::from_parts(45_768_209, 0).saturating_mul(p.into())) + // Minimum execution time: 993_621_000 picoseconds. + Weight::from_parts(1_012_993_434, 317931) + // Standard Error: 387_880 + .saturating_add(Weight::from_parts(53_105_611, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3029,882 +3031,884 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_399_000 picoseconds. - Weight::from_parts(2_513_898, 0) - // Standard Error: 22_468 - .saturating_add(Weight::from_parts(24_974_238, 0).saturating_mul(r.into())) + // Minimum execution time: 2_180_000 picoseconds. + Weight::from_parts(2_367_513, 0) + // Standard Error: 8_775 + .saturating_add(Weight::from_parts(24_100_608, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_354_805_000 picoseconds. - Weight::from_parts(4_247_725_842, 0) - // Standard Error: 49_167 - .saturating_add(Weight::from_parts(4_375_644, 0).saturating_mul(r.into())) + // Minimum execution time: 4_344_543_000 picoseconds. + Weight::from_parts(4_032_382_572, 0) + // Standard Error: 99_537 + .saturating_add(Weight::from_parts(5_787_910, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_344_769_000 picoseconds. - Weight::from_parts(4_143_583_164, 0) - // Standard Error: 64_865 - .saturating_add(Weight::from_parts(4_885_201, 0).saturating_mul(r.into())) + // Minimum execution time: 4_337_766_000 picoseconds. + Weight::from_parts(3_999_679_120, 0) + // Standard Error: 103_253 + .saturating_add(Weight::from_parts(5_927_871, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_321_597_000 picoseconds. - Weight::from_parts(10_856_474_625, 0) - // Standard Error: 228_480 - .saturating_add(Weight::from_parts(13_648_467, 0).saturating_mul(r.into())) + // Minimum execution time: 10_550_469_000 picoseconds. + Weight::from_parts(11_379_288_782, 0) + // Standard Error: 199_762 + .saturating_add(Weight::from_parts(12_085_908, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_444_861_000 picoseconds. - Weight::from_parts(11_811_924_847, 0) - // Standard Error: 220_732 - .saturating_add(Weight::from_parts(8_104_347, 0).saturating_mul(r.into())) + // Minimum execution time: 10_371_806_000 picoseconds. + Weight::from_parts(11_315_025_252, 0) + // Standard Error: 196_400 + .saturating_add(Weight::from_parts(9_868_462, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(2_199_000, 0) - // Standard Error: 8_145 - .saturating_add(Weight::from_parts(3_817_860, 0).saturating_mul(r.into())) + // Minimum execution time: 2_296_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 8_522 + .saturating_add(Weight::from_parts(3_812_287, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_084_000 picoseconds. - Weight::from_parts(2_171_000, 0) - // Standard Error: 5_734 - .saturating_add(Weight::from_parts(3_044_285, 0).saturating_mul(r.into())) + // Minimum execution time: 2_250_000 picoseconds. + Weight::from_parts(2_293_000, 0) + // Standard Error: 5_596 + .saturating_add(Weight::from_parts(3_015_385, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_074_000 picoseconds. - Weight::from_parts(3_341_361, 0) - // Standard Error: 1_168 - .saturating_add(Weight::from_parts(1_569_364, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(3_286_665, 0) + // Standard Error: 1_124 + .saturating_add(Weight::from_parts(1_572_972, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_562 - .saturating_add(Weight::from_parts(2_914_810, 0).saturating_mul(r.into())) + // Minimum execution time: 2_223_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 8_691 + .saturating_add(Weight::from_parts(2_934_320, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(99_037, 0) - // Standard Error: 11_949 - .saturating_add(Weight::from_parts(5_173_684, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(1_393_237, 0) + // Standard Error: 11_704 + .saturating_add(Weight::from_parts(5_179_849, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_992_000 picoseconds. - Weight::from_parts(6_256_207, 0) - // Standard Error: 1_332 - .saturating_add(Weight::from_parts(161_069, 0).saturating_mul(e.into())) + // Minimum execution time: 7_013_000 picoseconds. + Weight::from_parts(5_664_804, 0) + // Standard Error: 2_473 + .saturating_add(Weight::from_parts(127_877, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_106_000 picoseconds. - Weight::from_parts(4_233_365, 0) - // Standard Error: 7_839 - .saturating_add(Weight::from_parts(2_631_387, 0).saturating_mul(r.into())) + // Minimum execution time: 2_351_000 picoseconds. + Weight::from_parts(4_248_352, 0) + // Standard Error: 5_303 + .saturating_add(Weight::from_parts(2_564_771, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_631_387 - - 2_404_882, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_564_771 - + 2_417_980, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(4_830_171, 0) - // Standard Error: 12_370 - .saturating_add(Weight::from_parts(2_404_882, 0).saturating_mul(r.into())) + // Minimum execution time: 2_275_000 picoseconds. + Weight::from_parts(4_116_849, 0) + // Standard Error: 12_318 + .saturating_add(Weight::from_parts(2_417_980, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_413_000 picoseconds. - Weight::from_parts(16_855_535, 0) - // Standard Error: 25_880 - .saturating_add(Weight::from_parts(10_029_290, 0).saturating_mul(r.into())) + // Minimum execution time: 2_739_000 picoseconds. + Weight::from_parts(8_247_555, 0) + // Standard Error: 21_570 + .saturating_add(Weight::from_parts(10_290_172, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_145_000 picoseconds. - Weight::from_parts(4_520_615, 0) - // Standard Error: 6_765 - .saturating_add(Weight::from_parts(1_202_471, 0).saturating_mul(p.into())) + // Minimum execution time: 11_969_000 picoseconds. + Weight::from_parts(462_240, 0) + // Standard Error: 7_690 + .saturating_add(Weight::from_parts(1_320_559, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(_l: u32, ) -> Weight { + fn instr_call_per_local(l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_133_000 picoseconds. - Weight::from_parts(5_476_163, 0) + // Minimum execution time: 5_385_000 picoseconds. + Weight::from_parts(5_731_863, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(7, 0).saturating_mul(l.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_117_000 picoseconds. - Weight::from_parts(1_458_597, 0) - // Standard Error: 3_356 - .saturating_add(Weight::from_parts(265_574, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(1_509_226, 0) + // Standard Error: 3_855 + .saturating_add(Weight::from_parts(289_461, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_135_000 picoseconds. - Weight::from_parts(2_223_000, 0) - // Standard Error: 5_214 - .saturating_add(Weight::from_parts(766_010, 0).saturating_mul(r.into())) + // Minimum execution time: 2_290_000 picoseconds. + Weight::from_parts(2_403_000, 0) + // Standard Error: 6_135 + .saturating_add(Weight::from_parts(808_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_078_000 picoseconds. - Weight::from_parts(2_218_000, 0) - // Standard Error: 5_801 - .saturating_add(Weight::from_parts(743_573, 0).saturating_mul(r.into())) + // Minimum execution time: 2_206_000 picoseconds. + Weight::from_parts(2_259_000, 0) + // Standard Error: 6_737 + .saturating_add(Weight::from_parts(815_196, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_226_000 picoseconds. - Weight::from_parts(2_093_625, 0) - // Standard Error: 7_678 - .saturating_add(Weight::from_parts(824_956, 0).saturating_mul(r.into())) + // Minimum execution time: 6_514_000 picoseconds. + Weight::from_parts(2_989_795, 0) + // Standard Error: 8_020 + .saturating_add(Weight::from_parts(785_708, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_201_000 picoseconds. - Weight::from_parts(154_770, 0) - // Standard Error: 9_398 - .saturating_add(Weight::from_parts(1_480_245, 0).saturating_mul(r.into())) + // Minimum execution time: 6_390_000 picoseconds. + Weight::from_parts(6_462_000, 0) + // Standard Error: 8_592 + .saturating_add(Weight::from_parts(1_340_863, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_989_000 picoseconds. - Weight::from_parts(2_628_082, 0) - // Standard Error: 12_268 - .saturating_add(Weight::from_parts(6_921_043, 0).saturating_mul(r.into())) + // Minimum execution time: 4_894_000 picoseconds. + Weight::from_parts(1_962_792, 0) + // Standard Error: 10_808 + .saturating_add(Weight::from_parts(6_909_000, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_086_000 picoseconds. - Weight::from_parts(2_156_000, 0) - // Standard Error: 5_477 - .saturating_add(Weight::from_parts(3_348_027, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(2_309_000, 0) + // Standard Error: 9_270 + .saturating_add(Weight::from_parts(3_370_154, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_102_000 picoseconds. - Weight::from_parts(2_163_000, 0) - // Standard Error: 6_833 - .saturating_add(Weight::from_parts(3_134_916, 0).saturating_mul(r.into())) + // Minimum execution time: 2_214_000 picoseconds. + Weight::from_parts(2_328_000, 0) + // Standard Error: 6_565 + .saturating_add(Weight::from_parts(3_096_942, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_209_000, 0) - // Standard Error: 7_612 - .saturating_add(Weight::from_parts(3_170_404, 0).saturating_mul(r.into())) + // Minimum execution time: 2_301_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 5_842 + .saturating_add(Weight::from_parts(3_131_625, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_124_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 4_823 - .saturating_add(Weight::from_parts(2_668_874, 0).saturating_mul(r.into())) + // Minimum execution time: 2_290_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 5_456 + .saturating_add(Weight::from_parts(2_643_149, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_159_000 picoseconds. - Weight::from_parts(2_240_000, 0) - // Standard Error: 3_992 - .saturating_add(Weight::from_parts(559_604, 0).saturating_mul(r.into())) + // Minimum execution time: 2_207_000 picoseconds. + Weight::from_parts(2_259_000, 0) + // Standard Error: 4_151 + .saturating_add(Weight::from_parts(559_292, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_127_000 picoseconds. - Weight::from_parts(1_178_239, 0) - // Standard Error: 3_346 - .saturating_add(Weight::from_parts(416_704, 0).saturating_mul(r.into())) + // Minimum execution time: 2_282_000 picoseconds. + Weight::from_parts(1_656_873, 0) + // Standard Error: 3_537 + .saturating_add(Weight::from_parts(394_264, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 11_707 - .saturating_add(Weight::from_parts(1_918_501, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_300_000, 0) + // Standard Error: 13_227 + .saturating_add(Weight::from_parts(1_891_285, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_131_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 7_593 - .saturating_add(Weight::from_parts(1_219_931, 0).saturating_mul(r.into())) + // Minimum execution time: 2_197_000 picoseconds. + Weight::from_parts(2_297_000, 0) + // Standard Error: 9_416 + .saturating_add(Weight::from_parts(1_195_412, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_124_000 picoseconds. - Weight::from_parts(726_401, 0) - // Standard Error: 4_086 - .saturating_add(Weight::from_parts(424_161, 0).saturating_mul(r.into())) + // Minimum execution time: 2_254_000 picoseconds. + Weight::from_parts(1_244_456, 0) + // Standard Error: 3_993 + .saturating_add(Weight::from_parts(393_631, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_107_000 picoseconds. - Weight::from_parts(1_225_918, 0) - // Standard Error: 3_748 - .saturating_add(Weight::from_parts(392_373, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(1_710_108, 0) + // Standard Error: 3_705 + .saturating_add(Weight::from_parts(357_471, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(11_174, 0) - // Standard Error: 5_816 - .saturating_add(Weight::from_parts(594_467, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_350_000, 0) + // Standard Error: 4_034 + .saturating_add(Weight::from_parts(496_786, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_138_000 picoseconds. - Weight::from_parts(12_680, 0) - // Standard Error: 5_830 - .saturating_add(Weight::from_parts(595_552, 0).saturating_mul(r.into())) + // Minimum execution time: 2_251_000 picoseconds. + Weight::from_parts(143_742, 0) + // Standard Error: 5_409 + .saturating_add(Weight::from_parts(551_665, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_163_000 picoseconds. - Weight::from_parts(172_344, 0) - // Standard Error: 5_372 - .saturating_add(Weight::from_parts(537_510, 0).saturating_mul(r.into())) + // Minimum execution time: 2_250_000 picoseconds. + Weight::from_parts(210_302, 0) + // Standard Error: 5_693 + .saturating_add(Weight::from_parts(526_432, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_171_000 picoseconds. - Weight::from_parts(459_682, 0) - // Standard Error: 5_533 - .saturating_add(Weight::from_parts(421_155, 0).saturating_mul(r.into())) + // Minimum execution time: 2_246_000 picoseconds. + Weight::from_parts(1_582_329, 0) + // Standard Error: 3_448 + .saturating_add(Weight::from_parts(348_194, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_640_857, 0) - // Standard Error: 2_132 - .saturating_add(Weight::from_parts(175_772, 0).saturating_mul(r.into())) + // Minimum execution time: 2_350_000 picoseconds. + Weight::from_parts(2_836_265, 0) + // Standard Error: 1_916 + .saturating_add(Weight::from_parts(158_153, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_149_000 picoseconds. - Weight::from_parts(2_625_890, 0) - // Standard Error: 2_246 - .saturating_add(Weight::from_parts(177_728, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_997_599, 0) + // Standard Error: 1_870 + .saturating_add(Weight::from_parts(155_117, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_082_000 picoseconds. - Weight::from_parts(2_193_000, 0) - // Standard Error: 9_664 - .saturating_add(Weight::from_parts(1_832_396, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 11_719 + .saturating_add(Weight::from_parts(1_911_693, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_029_000 picoseconds. - Weight::from_parts(2_185_000, 0) - // Standard Error: 7_691 - .saturating_add(Weight::from_parts(1_203_465, 0).saturating_mul(r.into())) + // Minimum execution time: 2_259_000 picoseconds. + Weight::from_parts(2_323_000, 0) + // Standard Error: 7_734 + .saturating_add(Weight::from_parts(1_135_022, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_146_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 10_390 - .saturating_add(Weight::from_parts(1_868_795, 0).saturating_mul(r.into())) + // Minimum execution time: 2_189_000 picoseconds. + Weight::from_parts(2_254_000, 0) + // Standard Error: 13_208 + .saturating_add(Weight::from_parts(1_839_828, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_082_000 picoseconds. - Weight::from_parts(2_133_000, 0) - // Standard Error: 8_282 - .saturating_add(Weight::from_parts(1_199_983, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_306_000, 0) + // Standard Error: 7_621 + .saturating_add(Weight::from_parts(1_164_880, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_145_000 picoseconds. - Weight::from_parts(2_178_000, 0) - // Standard Error: 10_175 - .saturating_add(Weight::from_parts(1_943_386, 0).saturating_mul(r.into())) + // Minimum execution time: 2_238_000 picoseconds. + Weight::from_parts(2_291_000, 0) + // Standard Error: 10_468 + .saturating_add(Weight::from_parts(1_846_638, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_094_000 picoseconds. - Weight::from_parts(2_168_000, 0) - // Standard Error: 6_923 - .saturating_add(Weight::from_parts(1_125_091, 0).saturating_mul(r.into())) + // Minimum execution time: 2_240_000 picoseconds. + Weight::from_parts(2_308_000, 0) + // Standard Error: 7_502 + .saturating_add(Weight::from_parts(1_112_456, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(2_250_000, 0) - // Standard Error: 11_944 - .saturating_add(Weight::from_parts(1_852_545, 0).saturating_mul(r.into())) + // Minimum execution time: 2_192_000 picoseconds. + Weight::from_parts(2_283_000, 0) + // Standard Error: 12_282 + .saturating_add(Weight::from_parts(1_806_513, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_121_000, 0) - // Standard Error: 7_914 - .saturating_add(Weight::from_parts(1_171_461, 0).saturating_mul(r.into())) + // Minimum execution time: 2_250_000 picoseconds. + Weight::from_parts(2_310_000, 0) + // Standard Error: 8_080 + .saturating_add(Weight::from_parts(1_114_020, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_171_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 10_701 - .saturating_add(Weight::from_parts(1_859_283, 0).saturating_mul(r.into())) + // Minimum execution time: 2_270_000 picoseconds. + Weight::from_parts(2_319_000, 0) + // Standard Error: 11_947 + .saturating_add(Weight::from_parts(1_858_303, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_167_000 picoseconds. - Weight::from_parts(2_209_000, 0) - // Standard Error: 7_361 - .saturating_add(Weight::from_parts(1_182_113, 0).saturating_mul(r.into())) + // Minimum execution time: 2_204_000 picoseconds. + Weight::from_parts(2_322_000, 0) + // Standard Error: 9_452 + .saturating_add(Weight::from_parts(1_236_546, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_239_000, 0) - // Standard Error: 12_468 - .saturating_add(Weight::from_parts(1_847_236, 0).saturating_mul(r.into())) + // Minimum execution time: 2_222_000 picoseconds. + Weight::from_parts(2_289_000, 0) + // Standard Error: 9_388 + .saturating_add(Weight::from_parts(1_920_612, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_072_000 picoseconds. - Weight::from_parts(2_164_000, 0) - // Standard Error: 8_208 - .saturating_add(Weight::from_parts(1_117_969, 0).saturating_mul(r.into())) + // Minimum execution time: 2_267_000 picoseconds. + Weight::from_parts(2_316_000, 0) + // Standard Error: 7_906 + .saturating_add(Weight::from_parts(1_147_958, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_155_000, 0) - // Standard Error: 9_963 - .saturating_add(Weight::from_parts(1_877_035, 0).saturating_mul(r.into())) + // Minimum execution time: 2_233_000 picoseconds. + Weight::from_parts(2_278_000, 0) + // Standard Error: 14_090 + .saturating_add(Weight::from_parts(1_923_509, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 7_561 - .saturating_add(Weight::from_parts(1_124_600, 0).saturating_mul(r.into())) + // Minimum execution time: 2_216_000 picoseconds. + Weight::from_parts(2_271_000, 0) + // Standard Error: 9_629 + .saturating_add(Weight::from_parts(1_197_507, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_210_000, 0) - // Standard Error: 11_998 - .saturating_add(Weight::from_parts(1_829_852, 0).saturating_mul(r.into())) + // Minimum execution time: 2_268_000 picoseconds. + Weight::from_parts(2_341_000, 0) + // Standard Error: 10_951 + .saturating_add(Weight::from_parts(1_915_569, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_098_000 picoseconds. - Weight::from_parts(2_189_000, 0) - // Standard Error: 8_286 - .saturating_add(Weight::from_parts(1_189_196, 0).saturating_mul(r.into())) + // Minimum execution time: 2_218_000 picoseconds. + Weight::from_parts(2_276_000, 0) + // Standard Error: 8_283 + .saturating_add(Weight::from_parts(1_212_268, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_125_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 10_056 - .saturating_add(Weight::from_parts(1_829_185, 0).saturating_mul(r.into())) + // Minimum execution time: 2_221_000 picoseconds. + Weight::from_parts(2_283_000, 0) + // Standard Error: 11_398 + .saturating_add(Weight::from_parts(1_932_092, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_065_000 picoseconds. - Weight::from_parts(2_174_000, 0) - // Standard Error: 8_171 - .saturating_add(Weight::from_parts(1_176_701, 0).saturating_mul(r.into())) + // Minimum execution time: 2_278_000 picoseconds. + Weight::from_parts(2_324_000, 0) + // Standard Error: 8_582 + .saturating_add(Weight::from_parts(1_170_243, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_141_000 picoseconds. - Weight::from_parts(2_220_000, 0) - // Standard Error: 9_910 - .saturating_add(Weight::from_parts(1_871_442, 0).saturating_mul(r.into())) + // Minimum execution time: 2_216_000 picoseconds. + Weight::from_parts(2_294_000, 0) + // Standard Error: 13_115 + .saturating_add(Weight::from_parts(1_902_257, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_024_000 picoseconds. - Weight::from_parts(2_166_000, 0) - // Standard Error: 7_933 - .saturating_add(Weight::from_parts(1_156_214, 0).saturating_mul(r.into())) + // Minimum execution time: 2_277_000 picoseconds. + Weight::from_parts(2_358_000, 0) + // Standard Error: 9_006 + .saturating_add(Weight::from_parts(1_220_902, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_068_000 picoseconds. - Weight::from_parts(2_169_000, 0) - // Standard Error: 7_815 - .saturating_add(Weight::from_parts(1_353_927, 0).saturating_mul(r.into())) + // Minimum execution time: 2_255_000 picoseconds. + Weight::from_parts(2_316_000, 0) + // Standard Error: 8_357 + .saturating_add(Weight::from_parts(1_302_969, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_157_000 picoseconds. - Weight::from_parts(2_208_000, 0) - // Standard Error: 4_587 - .saturating_add(Weight::from_parts(635_023, 0).saturating_mul(r.into())) + // Minimum execution time: 2_227_000 picoseconds. + Weight::from_parts(2_275_000, 0) + // Standard Error: 5_837 + .saturating_add(Weight::from_parts(637_533, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_080_000 picoseconds. - Weight::from_parts(2_140_000, 0) - // Standard Error: 8_399 - .saturating_add(Weight::from_parts(1_278_782, 0).saturating_mul(r.into())) + // Minimum execution time: 2_182_000 picoseconds. + Weight::from_parts(2_253_000, 0) + // Standard Error: 7_474 + .saturating_add(Weight::from_parts(1_274_444, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_069_000 picoseconds. - Weight::from_parts(2_233_000, 0) - // Standard Error: 6_395 - .saturating_add(Weight::from_parts(682_415, 0).saturating_mul(r.into())) + // Minimum execution time: 2_268_000 picoseconds. + Weight::from_parts(2_314_000, 0) + // Standard Error: 4_787 + .saturating_add(Weight::from_parts(598_295, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_206_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 9_477 - .saturating_add(Weight::from_parts(1_819_764, 0).saturating_mul(r.into())) + // Minimum execution time: 2_184_000 picoseconds. + Weight::from_parts(2_286_000, 0) + // Standard Error: 13_111 + .saturating_add(Weight::from_parts(1_764_139, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_095_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 7_615 - .saturating_add(Weight::from_parts(1_207_931, 0).saturating_mul(r.into())) + // Minimum execution time: 2_247_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 8_531 + .saturating_add(Weight::from_parts(1_233_195, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_108_000 picoseconds. - Weight::from_parts(1_363_438, 0) - // Standard Error: 18_139 - .saturating_add(Weight::from_parts(2_743_512, 0).saturating_mul(r.into())) + // Minimum execution time: 2_215_000 picoseconds. + Weight::from_parts(2_308_000, 0) + // Standard Error: 8_554 + .saturating_add(Weight::from_parts(2_787_034, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(726_043, 0) - // Standard Error: 12_539 - .saturating_add(Weight::from_parts(2_447_643, 0).saturating_mul(r.into())) + // Minimum execution time: 2_285_000 picoseconds. + Weight::from_parts(2_336_000, 0) + // Standard Error: 8_016 + .saturating_add(Weight::from_parts(2_444_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_118_000 picoseconds. - Weight::from_parts(1_113_814, 0) - // Standard Error: 15_837 - .saturating_add(Weight::from_parts(2_939_546, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_266_000, 0) + // Standard Error: 9_336 + .saturating_add(Weight::from_parts(3_001_762, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_121_000 picoseconds. - Weight::from_parts(2_089_486, 0) - // Standard Error: 15_833 - .saturating_add(Weight::from_parts(2_447_304, 0).saturating_mul(r.into())) + // Minimum execution time: 2_230_000 picoseconds. + Weight::from_parts(2_279_000, 0) + // Standard Error: 8_838 + .saturating_add(Weight::from_parts(2_479_926, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(2_235_000, 0) - // Standard Error: 16_089 - .saturating_add(Weight::from_parts(9_370_736, 0).saturating_mul(r.into())) + // Minimum execution time: 2_222_000 picoseconds. + Weight::from_parts(2_251_000, 0) + // Standard Error: 15_694 + .saturating_add(Weight::from_parts(9_400_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_191_000 picoseconds. - Weight::from_parts(3_207_641, 0) - // Standard Error: 45_758 - .saturating_add(Weight::from_parts(7_437_894, 0).saturating_mul(r.into())) + // Minimum execution time: 2_177_000 picoseconds. + Weight::from_parts(2_262_000, 0) + // Standard Error: 24_148 + .saturating_add(Weight::from_parts(7_553_495, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_118_000 picoseconds. - Weight::from_parts(588_160, 0) - // Standard Error: 17_384 - .saturating_add(Weight::from_parts(2_989_240, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_344_000, 0) + // Standard Error: 8_791 + .saturating_add(Weight::from_parts(2_956_458, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_135_000 picoseconds. - Weight::from_parts(4_961_665, 0) - // Standard Error: 26_016 - .saturating_add(Weight::from_parts(2_253_733, 0).saturating_mul(r.into())) + // Minimum execution time: 2_280_000 picoseconds. + Weight::from_parts(2_297_000, 0) + // Standard Error: 7_657 + .saturating_add(Weight::from_parts(2_477_698, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_198_000, 0) - // Standard Error: 8_661 - .saturating_add(Weight::from_parts(1_328_375, 0).saturating_mul(r.into())) + // Minimum execution time: 2_206_000 picoseconds. + Weight::from_parts(2_261_000, 0) + // Standard Error: 8_702 + .saturating_add(Weight::from_parts(1_265_825, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_168_000 picoseconds. - Weight::from_parts(2_225_000, 0) - // Standard Error: 4_778 - .saturating_add(Weight::from_parts(648_611, 0).saturating_mul(r.into())) + // Minimum execution time: 2_198_000 picoseconds. + Weight::from_parts(2_243_000, 0) + // Standard Error: 5_815 + .saturating_add(Weight::from_parts(639_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_125_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 8_338 - .saturating_add(Weight::from_parts(1_260_241, 0).saturating_mul(r.into())) + // Minimum execution time: 2_243_000 picoseconds. + Weight::from_parts(2_299_000, 0) + // Standard Error: 8_918 + .saturating_add(Weight::from_parts(1_302_162, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_153_000 picoseconds. - Weight::from_parts(2_233_000, 0) - // Standard Error: 5_007 - .saturating_add(Weight::from_parts(642_088, 0).saturating_mul(r.into())) + // Minimum execution time: 2_278_000 picoseconds. + Weight::from_parts(2_329_000, 0) + // Standard Error: 4_483 + .saturating_add(Weight::from_parts(628_991, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_267_000, 0) - // Standard Error: 8_196 - .saturating_add(Weight::from_parts(1_328_828, 0).saturating_mul(r.into())) + // Minimum execution time: 2_211_000 picoseconds. + Weight::from_parts(2_264_000, 0) + // Standard Error: 9_628 + .saturating_add(Weight::from_parts(1_310_707, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_135_000 picoseconds. - Weight::from_parts(2_211_000, 0) - // Standard Error: 5_376 - .saturating_add(Weight::from_parts(693_541, 0).saturating_mul(r.into())) + // Minimum execution time: 2_197_000 picoseconds. + Weight::from_parts(2_261_000, 0) + // Standard Error: 4_478 + .saturating_add(Weight::from_parts(645_751, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_208_000 picoseconds. - Weight::from_parts(2_224_000, 0) - // Standard Error: 7_393 - .saturating_add(Weight::from_parts(1_144_418, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_327_000, 0) + // Standard Error: 8_607 + .saturating_add(Weight::from_parts(1_149_332, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_161_000 picoseconds. - Weight::from_parts(2_237_000, 0) - // Standard Error: 3_890 - .saturating_add(Weight::from_parts(589_899, 0).saturating_mul(r.into())) + // Minimum execution time: 2_245_000 picoseconds. + Weight::from_parts(2_263_000, 0) + // Standard Error: 4_008 + .saturating_add(Weight::from_parts(590_180, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_129_000 picoseconds. - Weight::from_parts(2_219_000, 0) - // Standard Error: 7_182 - .saturating_add(Weight::from_parts(1_101_585, 0).saturating_mul(r.into())) + // Minimum execution time: 2_158_000 picoseconds. + Weight::from_parts(2_285_000, 0) + // Standard Error: 8_280 + .saturating_add(Weight::from_parts(1_079_846, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_038_000 picoseconds. - Weight::from_parts(2_126_000, 0) - // Standard Error: 3_865 - .saturating_add(Weight::from_parts(588_357, 0).saturating_mul(r.into())) + // Minimum execution time: 2_310_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 3_875 + .saturating_add(Weight::from_parts(547_245, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_129_000 picoseconds. - Weight::from_parts(2_215_000, 0) - // Standard Error: 8_265 - .saturating_add(Weight::from_parts(1_152_496, 0).saturating_mul(r.into())) + // Minimum execution time: 2_231_000 picoseconds. + Weight::from_parts(2_315_000, 0) + // Standard Error: 9_477 + .saturating_add(Weight::from_parts(1_110_046, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_103_000 picoseconds. - Weight::from_parts(2_181_000, 0) - // Standard Error: 3_989 - .saturating_add(Weight::from_parts(614_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_174_000 picoseconds. + Weight::from_parts(2_305_000, 0) + // Standard Error: 4_474 + .saturating_add(Weight::from_parts(564_322, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_133_000 picoseconds. - Weight::from_parts(2_175_000, 0) - // Standard Error: 6_506 - .saturating_add(Weight::from_parts(1_096_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_271_000 picoseconds. + Weight::from_parts(2_318_000, 0) + // Standard Error: 8_819 + .saturating_add(Weight::from_parts(1_132_561, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_088_000 picoseconds. - Weight::from_parts(2_154_000, 0) - // Standard Error: 4_053 - .saturating_add(Weight::from_parts(582_323, 0).saturating_mul(r.into())) + // Minimum execution time: 2_240_000 picoseconds. + Weight::from_parts(2_292_000, 0) + // Standard Error: 4_113 + .saturating_add(Weight::from_parts(601_692, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_120_000 picoseconds. - Weight::from_parts(2_213_000, 0) - // Standard Error: 6_472 - .saturating_add(Weight::from_parts(1_056_569, 0).saturating_mul(r.into())) + // Minimum execution time: 2_236_000 picoseconds. + Weight::from_parts(2_253_000, 0) + // Standard Error: 7_294 + .saturating_add(Weight::from_parts(1_106_781, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_097_000 picoseconds. - Weight::from_parts(2_192_000, 0) - // Standard Error: 3_800 - .saturating_add(Weight::from_parts(579_517, 0).saturating_mul(r.into())) + // Minimum execution time: 2_193_000 picoseconds. + Weight::from_parts(2_268_000, 0) + // Standard Error: 4_653 + .saturating_add(Weight::from_parts(587_731, 0).saturating_mul(r.into())) } } diff --git a/runtime/vara/src/weights/pallet_gear_voucher.rs b/runtime/vara/src/weights/pallet_gear_voucher.rs index 2abb7e94df3..a6028a41c75 100644 --- a/runtime/vara/src/weights/pallet_gear_voucher.rs +++ b/runtime/vara/src/weights/pallet_gear_voucher.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear_voucher //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -47,8 +47,8 @@ impl pallet_gear_voucher::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 26_637_000 picoseconds. - Weight::from_parts(27_302_000, 6196) + // Minimum execution time: 26_236_000 picoseconds. + Weight::from_parts(26_891_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -60,8 +60,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 26_637_000 picoseconds. - Weight::from_parts(27_302_000, 6196) + // Minimum execution time: 26_236_000 picoseconds. + Weight::from_parts(26_891_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/runtime/vara/src/weights/pallet_timestamp.rs b/runtime/vara/src/weights/pallet_timestamp.rs index aa716bcc65c..aa0808323f6 100644 --- a/runtime/vara/src/weights/pallet_timestamp.rs +++ b/runtime/vara/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -48,8 +48,8 @@ impl pallet_timestamp::WeightInfo for SubstrateWeight pallet_timestamp::WeightInfo for SubstrateWeight pallet_utility::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_390_000 picoseconds. - Weight::from_parts(15_138_158, 0) - // Standard Error: 2_071 - .saturating_add(Weight::from_parts(3_958_890, 0).saturating_mul(c.into())) + // Minimum execution time: 5_430_000 picoseconds. + Weight::from_parts(6_278_690, 0) + // Standard Error: 4_027 + .saturating_add(Weight::from_parts(4_089_487, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_614_000 picoseconds. - Weight::from_parts(3_757_000, 0) + // Minimum execution time: 3_676_000 picoseconds. + Weight::from_parts(3_933_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_187_000 picoseconds. - Weight::from_parts(12_724_758, 0) - // Standard Error: 1_830 - .saturating_add(Weight::from_parts(4_146_725, 0).saturating_mul(c.into())) + // Minimum execution time: 5_177_000 picoseconds. + Weight::from_parts(11_177_183, 0) + // Standard Error: 4_061 + .saturating_add(Weight::from_parts(4_284_675, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_937_000 picoseconds. - Weight::from_parts(7_217_000, 0) + // Minimum execution time: 7_036_000 picoseconds. + Weight::from_parts(7_341_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_197_000 picoseconds. - Weight::from_parts(12_700_602, 0) - // Standard Error: 2_607 - .saturating_add(Weight::from_parts(3_964_305, 0).saturating_mul(c.into())) + // Minimum execution time: 5_427_000 picoseconds. + Weight::from_parts(5_742_970, 0) + // Standard Error: 3_854 + .saturating_add(Weight::from_parts(4_084_209, 0).saturating_mul(c.into())) } } @@ -100,43 +100,43 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_390_000 picoseconds. - Weight::from_parts(15_138_158, 0) - // Standard Error: 2_071 - .saturating_add(Weight::from_parts(3_958_890, 0).saturating_mul(c.into())) + // Minimum execution time: 5_430_000 picoseconds. + Weight::from_parts(6_278_690, 0) + // Standard Error: 4_027 + .saturating_add(Weight::from_parts(4_089_487, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_614_000 picoseconds. - Weight::from_parts(3_757_000, 0) + // Minimum execution time: 3_676_000 picoseconds. + Weight::from_parts(3_933_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_187_000 picoseconds. - Weight::from_parts(12_724_758, 0) - // Standard Error: 1_830 - .saturating_add(Weight::from_parts(4_146_725, 0).saturating_mul(c.into())) + // Minimum execution time: 5_177_000 picoseconds. + Weight::from_parts(11_177_183, 0) + // Standard Error: 4_061 + .saturating_add(Weight::from_parts(4_284_675, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_937_000 picoseconds. - Weight::from_parts(7_217_000, 0) + // Minimum execution time: 7_036_000 picoseconds. + Weight::from_parts(7_341_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_197_000 picoseconds. - Weight::from_parts(12_700_602, 0) - // Standard Error: 2_607 - .saturating_add(Weight::from_parts(3_964_305, 0).saturating_mul(c.into())) + // Minimum execution time: 5_427_000 picoseconds. + Weight::from_parts(5_742_970, 0) + // Standard Error: 3_854 + .saturating_add(Weight::from_parts(4_084_209, 0).saturating_mul(c.into())) } } diff --git a/utils/wasm-proc/src/main.rs b/utils/wasm-proc/src/main.rs index 9f92979bb94..a2585655fcf 100644 --- a/utils/wasm-proc/src/main.rs +++ b/utils/wasm-proc/src/main.rs @@ -21,7 +21,7 @@ use gear_wasm_builder::optimize::{self, OptType, Optimizer}; use parity_wasm::elements::External; use std::{collections::HashSet, fs, path::PathBuf}; -const RT_ALLOWED_IMPORTS: [&str; 66] = [ +const RT_ALLOWED_IMPORTS: [&str; 67] = [ // From `Allocator` (substrate/primitives/io/src/lib.rs) "ext_allocator_free_version_1", "ext_allocator_malloc_version_1", @@ -37,6 +37,7 @@ const RT_ALLOWED_IMPORTS: [&str; 66] = [ "ext_crypto_start_batch_verify_version_1", // From `GearRI` (runtime-interface/scr/lib.rs) "ext_gear_ri_pre_process_memory_accesses_version_1", + "ext_gear_ri_pre_process_memory_accesses_version_2", "ext_gear_ri_lazy_pages_status_version_1", "ext_gear_ri_write_accessed_pages_version_1", "ext_gear_ri_init_lazy_pages_version_1", From fa0078854861b9df0ea855c116acec1121f76d64 Mon Sep 17 00:00:00 2001 From: Shamil <66209982+shamilsan@users.noreply.github.com> Date: Wed, 23 Aug 2023 19:08:38 +0400 Subject: [PATCH 085/165] fix(gsdk): update test after the node upgrade (#3161) --- gsdk/tests/rpc.rs | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/gsdk/tests/rpc.rs b/gsdk/tests/rpc.rs index ec375c5b6d0..c458cee94e8 100644 --- a/gsdk/tests/rpc.rs +++ b/gsdk/tests/rpc.rs @@ -22,11 +22,12 @@ use gear_core::ids::{CodeId, ProgramId}; use gsdk::{ ext::{sp_core::crypto::Ss58Codec, sp_runtime::AccountId32}, testing::Node, - Api, Result, + Api, Error, Result, }; +use jsonrpsee::types::error::{CallError, ErrorObject}; use parity_scale_codec::Encode; use std::{borrow::Cow, process::Command, str::FromStr}; -use subxt::config::Header; +use subxt::{config::Header, error::RpcError, Error as SubxtError}; fn dev_node() -> Node { // Use release build because of performance reasons. @@ -238,7 +239,12 @@ async fn test_runtime_wasm_blob_version() -> Result<()> { let mut finalized_blocks = api.finalized_blocks().await?; let wasm_blob_version_1 = api.runtime_wasm_blob_version(None).await?; - assert!(wasm_blob_version_1.ends_with(git_commit_hash.as_ref())); + assert!( + wasm_blob_version_1.ends_with(git_commit_hash.as_ref()), + "The WASM blob version {} does not end with the git commit hash {}", + wasm_blob_version_1, + git_commit_hash + ); let block_hash_1 = finalized_blocks.next_events().await.unwrap()?.block_hash(); let wasm_blob_version_2 = api.runtime_wasm_blob_version(Some(block_hash_1)).await?; @@ -254,7 +260,7 @@ async fn test_runtime_wasm_blob_version() -> Result<()> { #[tokio::test] async fn test_runtime_wasm_blob_version_history() -> Result<()> { - let api = Api::new(Some("wss://rpc.vara-network.io:443")).await?; + let api = Api::new(Some("wss://archive-rpc.vara-network.io:443")).await?; { let no_method_block_hash = sp_core::H256::from_str( @@ -266,11 +272,18 @@ async fn test_runtime_wasm_blob_version_history() -> Result<()> { .runtime_wasm_blob_version(Some(no_method_block_hash)) .await; - assert!(wasm_blob_version_result.is_err()); - let error_msg = wasm_blob_version_result.unwrap_err().to_string(); - assert!(error_msg.starts_with( - "Rpc error: RPC error: RPC call failed: ErrorObject { code: MethodNotFound" + let err = CallError::Custom(ErrorObject::owned( + 9000, + "Unable to find WASM blob version in WASM blob", + None::, )); + assert!( + matches!( + &wasm_blob_version_result, + Err(Error::Subxt(SubxtError::Rpc(RpcError::ClientError(e)))) if e.to_string() == err.to_string() + ), + "Error does not match: {wasm_blob_version_result:?}" + ); } Ok(()) From 140675c5854a1419d1b2ad61a31525718fbc7119 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Wed, 23 Aug 2023 22:09:14 +0400 Subject: [PATCH 086/165] Replace log::error! with log::trace! (#3154) --- sandbox/sandbox/src/embedded_executor.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sandbox/sandbox/src/embedded_executor.rs b/sandbox/sandbox/src/embedded_executor.rs index 8a73ef00989..207ebd08ee8 100644 --- a/sandbox/sandbox/src/embedded_executor.rs +++ b/sandbox/sandbox/src/embedded_executor.rs @@ -250,7 +250,7 @@ impl super::SandboxInstance for Instance { env_def_builder: &Self::EnvironmentBuilder, ) -> Result, Error> { let module = Module::new(store.engine(), code).map_err(|e| { - log::error!(target: TARGET, "Failed to create module: {e}"); + log::trace!(target: TARGET, "Failed to create module: {e}"); Error::Module })?; let mut linker = Linker::new(store.engine()); @@ -348,11 +348,11 @@ impl super::SandboxInstance for Instance { } let instance_pre = linker.instantiate(&mut store, &module).map_err(|e| { - log::error!(target: TARGET, "Error instantiating module: {:?}", e); + log::trace!(target: TARGET, "Error instantiating module: {:?}", e); Error::Module })?; let instance = instance_pre.start(&mut store).map_err(|e| { - log::error!(target: TARGET, "Error starting module: {:?}", e); + log::trace!(target: TARGET, "Error starting module: {:?}", e); Error::Module })?; @@ -380,7 +380,7 @@ impl super::SandboxInstance for Instance { vec![RuntimeValue::ExternRef(wasmi::ExternRef::null()); func_ty.results().len()]; func.call(&mut store, &args, &mut results).map_err(|e| { - log::error!(target: TARGET, "invocation error: {e}"); + log::trace!(target: TARGET, "invocation error: {e}"); Error::Execution })?; @@ -522,7 +522,7 @@ mod tests { (module (import "env" "assert" (func $assert (param i32))) (global (;0;) (mut i64) (i64.const 0x20000)) - (export "{GLOBAL_NAME_GAS}" (global 0)) + (export "{GLOBAL_NAME_GAS}" (global 0)) (func (export "call") (param $x i32) (param $y i64) ;; assert that $x = 0x12345678 @@ -558,8 +558,8 @@ mod tests { r#" (module (global (;0;) (mut i64) (i64.const 0x20000)) - (export "{GLOBAL_NAME_GAS}" (global 0)) - + (export "{GLOBAL_NAME_GAS}" (global 0)) + (func (export "call") (param $x i32) (result i32) (i32.add (get_local $x) @@ -596,7 +596,7 @@ mod tests { ;; It's actually returns i32, but imported as if it returned i64 (import "env" "returns_i32" (func $returns_i32 (result i64))) (global (;0;) (mut i64) (i64.const 0x20000)) - (export "{GLOBAL_NAME_GAS}" (global 0)) + (export "{GLOBAL_NAME_GAS}" (global 0)) (func (export "call") (drop From 21763e2959054a7b5e9e878795e0c73146785858 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Wed, 23 Aug 2023 22:09:36 +0400 Subject: [PATCH 087/165] refactor(wasm-gen): Remove prints from `gear-wasm-gen` (#3159) --- utils/runtime-fuzzer/fuzz/fuzz_targets/main.rs | 2 -- utils/runtime-fuzzer/src/arbitrary_call.rs | 3 --- utils/runtime-fuzzer/src/lib.rs | 2 -- utils/wasm-gen/src/config/syscalls/param.rs | 2 +- utils/wasm-gen/src/generator/syscalls/invocator.rs | 4 ---- utils/wasm-gen/src/lib.rs | 3 --- 6 files changed, 1 insertion(+), 15 deletions(-) diff --git a/utils/runtime-fuzzer/fuzz/fuzz_targets/main.rs b/utils/runtime-fuzzer/fuzz/fuzz_targets/main.rs index 73908b7df23..658db9b1d7c 100644 --- a/utils/runtime-fuzzer/fuzz/fuzz_targets/main.rs +++ b/utils/runtime-fuzzer/fuzz/fuzz_targets/main.rs @@ -24,8 +24,6 @@ use runtime_fuzzer::GearCalls; fuzz_target!(|gear_calls: GearCalls| { gear_utils::init_default_logger(); - // Newline to easily browse logs. - println!(); log::info!("Executing generated gear calls"); runtime_fuzzer::run(gear_calls); }); diff --git a/utils/runtime-fuzzer/src/arbitrary_call.rs b/utils/runtime-fuzzer/src/arbitrary_call.rs index d01cb920197..e8eb10c5c70 100644 --- a/utils/runtime-fuzzer/src/arbitrary_call.rs +++ b/utils/runtime-fuzzer/src/arbitrary_call.rs @@ -71,9 +71,6 @@ impl GearCalls { impl<'a> Arbitrary<'a> for GearCalls { fn arbitrary(u: &mut Unstructured<'a>) -> Result { - // Newline to easily browse logs. - println!("\n"); - log::trace!("New GearCalls generation: random data received {}", u.len()); if u.len() < MIN_GEAR_CALLS_BYTES { diff --git a/utils/runtime-fuzzer/src/lib.rs b/utils/runtime-fuzzer/src/lib.rs index 893ccc676e8..41e826a43bc 100644 --- a/utils/runtime-fuzzer/src/lib.rs +++ b/utils/runtime-fuzzer/src/lib.rs @@ -53,8 +53,6 @@ fn run_impl(GearCalls(gear_calls): GearCalls) -> sp_io::TestExternalities { for gear_call in gear_calls { let call_res = execute_gear_call(sender.clone(), gear_call); - // Newline to easily browse logs. - println!(); log::info!("Extrinsic result: {call_res:?}"); // Run task and message queues with max possible gas limit. diff --git a/utils/wasm-gen/src/config/syscalls/param.rs b/utils/wasm-gen/src/config/syscalls/param.rs index 3573ce113c6..69826b9550f 100644 --- a/utils/wasm-gen/src/config/syscalls/param.rs +++ b/utils/wasm-gen/src/config/syscalls/param.rs @@ -54,7 +54,7 @@ impl Default for SysCallsParamsConfig { (ParamType::Ptr(None), (0..=513 * 0x10000 - 1).into()), (ParamType::Gas, (0..=250_000_000_000).into()), (ParamType::MessagePosition, (0..=10).into()), - (ParamType::Duration, (0..=100).into()), + (ParamType::Duration, (1..=8).into()), (ParamType::Delay, (0..=4).into()), (ParamType::Handler, (0..=100).into()), (ParamType::Alloc, (0..=512).into()), diff --git a/utils/wasm-gen/src/generator/syscalls/invocator.rs b/utils/wasm-gen/src/generator/syscalls/invocator.rs index 59344a01d50..5ecedf35f3c 100644 --- a/utils/wasm-gen/src/generator/syscalls/invocator.rs +++ b/utils/wasm-gen/src/generator/syscalls/invocator.rs @@ -167,8 +167,6 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { invocable: InvocableSysCall, call_indexes_handle: CallIndexesHandle, ) -> Result> { - // Newline to easily browse logs. - println!(); log::trace!( "Random data before building {} sys-call invoke instructions - {}", invocable.to_str(), @@ -414,8 +412,6 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { } fn resolves_calls_indexes(&mut self) { - // Newline to easily browse logs. - println!(); log::trace!("Resolving calls indexes"); let imports_num = self.module.count_import_funcs() as u32; diff --git a/utils/wasm-gen/src/lib.rs b/utils/wasm-gen/src/lib.rs index 079bff124c1..64bd9e4bfc3 100644 --- a/utils/wasm-gen/src/lib.rs +++ b/utils/wasm-gen/src/lib.rs @@ -52,13 +52,10 @@ pub fn generate_gear_program_code( let bytes = parity_wasm::serialize(module).expect("unable to serialize pw module"); - // Newline to easily browse logs. - println!(); log::trace!( "{}", wasmprinter::print_bytes(&bytes).expect("internal error: failed printing bytes") ); - println!(); Ok(bytes) } From f7d9f90736be2e963021c1051a7fe9e46d670ba7 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Wed, 23 Aug 2023 22:09:52 +0400 Subject: [PATCH 088/165] feat!(runtime): Introduce `pallet-gear-bank` (#3052) Co-authored-by: nikvolf --- .github/workflows/check.yml | 2 - Cargo.lock | 30 +- Cargo.toml | 1 + common/src/gas_provider/node.rs | 15 + common/src/lib.rs | 16 +- gclient/src/api/calls.rs | 83 + gclient/src/api/storage/mod.rs | 15 +- gclient/src/utils.rs | 8 + gsdk/src/metadata/generated.rs | 55 +- gsdk/src/signer/calls.rs | 16 +- gsdk/src/storage.rs | 20 +- node/service/src/chain_spec/gear.rs | 31 +- node/service/src/chain_spec/vara.rs | 29 +- pallets/airdrop/Cargo.toml | 2 + pallets/airdrop/src/benchmarking.rs | 4 +- pallets/airdrop/src/lib.rs | 4 +- pallets/airdrop/src/mock.rs | 14 +- pallets/airdrop/src/tests.rs | 42 +- pallets/gas/Cargo.toml | 1 - pallets/gear-bank/Cargo.toml | 46 + pallets/gear-bank/src/lib.rs | 425 +++++ pallets/gear-bank/src/mock.rs | 157 ++ pallets/gear-bank/src/tests.rs | 1512 +++++++++++++++++ pallets/gear-debug/Cargo.toml | 1 + pallets/gear-debug/src/mock.rs | 9 +- pallets/gear-messenger/src/lib.rs | 8 +- pallets/gear-scheduler/Cargo.toml | 1 + pallets/gear-scheduler/src/mock.rs | 27 +- pallets/gear-scheduler/src/tests.rs | 36 +- pallets/gear-voucher/src/benchmarking.rs | 4 +- pallets/gear-voucher/src/lib.rs | 15 +- pallets/gear-voucher/src/tests.rs | 9 +- pallets/gear/Cargo.toml | 2 + pallets/gear/src/benchmarking/mod.rs | 60 +- .../benchmarking/tests/syscalls_integrity.rs | 16 +- pallets/gear/src/internal.rs | 91 +- pallets/gear/src/lib.rs | 119 +- pallets/gear/src/manager/journal.rs | 12 +- pallets/gear/src/mock.rs | 12 +- pallets/gear/src/tests.rs | 110 +- pallets/payment/Cargo.toml | 1 + pallets/payment/src/mock.rs | 9 +- runtime/common/Cargo.toml | 16 + runtime/common/src/constants.rs | 3 + runtime/common/src/lib.rs | 1 + runtime/common/src/migrations.rs | 142 ++ runtime/gear/Cargo.toml | 4 + runtime/gear/src/lib.rs | 10 +- runtime/gear/src/migrations.rs | 4 +- runtime/vara/Cargo.toml | 4 + runtime/vara/src/integration_tests.rs | 40 +- runtime/vara/src/lib.rs | 10 +- utils/runtime-fuzzer/src/runtime/mod.rs | 9 +- 53 files changed, 2941 insertions(+), 372 deletions(-) create mode 100644 pallets/gear-bank/Cargo.toml create mode 100644 pallets/gear-bank/src/lib.rs create mode 100644 pallets/gear-bank/src/mock.rs create mode 100644 pallets/gear-bank/src/tests.rs create mode 100644 runtime/common/src/migrations.rs diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 481b4fc4f8e..c193a2031bf 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -89,5 +89,3 @@ jobs: - name: "Check fuzzer reproduction" run: ./scripts/gear.sh test fuzz-repr - - - run: sccache --show-stats diff --git a/Cargo.lock b/Cargo.lock index 1aa24e4993d..50b33ee6f38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4075,6 +4075,7 @@ dependencies = [ "pallet-babe", "pallet-balances", "pallet-gear", + "pallet-gear-bank", "pallet-gear-debug", "pallet-gear-gas", "pallet-gear-messenger", @@ -4121,12 +4122,16 @@ dependencies = [ "frame-system-benchmarking", "gear-backend-common", "gear-common", + "gear-core", "gear-core-processor", "gear-runtime-primitives", "log", "pallet-authorship", "pallet-balances", "pallet-gear", + "pallet-gear-bank", + "pallet-gear-gas", + "pallet-gear-messenger", "pallet-session", "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", @@ -7086,6 +7091,7 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-gear", + "pallet-gear-bank", "pallet-gear-gas", "pallet-gear-messenger", "pallet-gear-program", @@ -7353,6 +7359,7 @@ dependencies = [ "page_size 0.5.0", "pallet-authorship", "pallet-balances", + "pallet-gear-bank", "pallet-gear-gas", "pallet-gear-messenger", "pallet-gear-proc-macro", @@ -7379,6 +7386,24 @@ dependencies = [ "wabt", ] +[[package]] +name = "pallet-gear-bank" +version = "1.0.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "gear-common", + "log", + "pallet-authorship", + "pallet-balances", + "parity-scale-codec", + "primitive-types", + "scale-info", + "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", +] + [[package]] name = "pallet-gear-debug" version = "2.0.0" @@ -7398,6 +7423,7 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-gear", + "pallet-gear-bank", "pallet-gear-gas", "pallet-gear-messenger", "pallet-gear-program", @@ -7428,7 +7454,6 @@ dependencies = [ "log", "pallet-authorship", "pallet-balances", - "pallet-gear", "pallet-gear-messenger", "pallet-gear-program", "pallet-gear-scheduler", @@ -7483,6 +7508,7 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-gear", + "pallet-gear-bank", "pallet-gear-gas", "pallet-gear-messenger", "pallet-gear-program", @@ -7579,6 +7605,7 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-gear", + "pallet-gear-bank", "pallet-gear-gas", "pallet-gear-messenger", "pallet-gear-program", @@ -13418,6 +13445,7 @@ dependencies = [ "pallet-conviction-voting", "pallet-election-provider-multi-phase", "pallet-gear", + "pallet-gear-bank", "pallet-gear-debug", "pallet-gear-gas", "pallet-gear-messenger", diff --git a/Cargo.toml b/Cargo.toml index e356bd90e28..70d408e6b6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -233,6 +233,7 @@ pallet-gear-rpc-runtime-api = { version = "2.0.0", path = "pallets/gear/rpc/runt pallet-gear-scheduler = { path = "pallets/gear-scheduler", default-features = false } pallet-gear-staking-rewards = { version = "1.0.0", path = "pallets/staking-rewards", default-features = false } pallet-gear-voucher = { version = "1.0.0", path = "pallets/gear-voucher", default-features = false } +pallet-gear-bank = { version = "1.0.0", path = "pallets/gear-bank", default-features = false } runtime-common = { package = "gear-runtime-common", path = "runtime/common", default-features = false } runtime-primitives = { package = "gear-runtime-primitives", path = "runtime/primitives", version = "0.1.0", default-features = false } service = { package = "gear-service", path = "node/service", default-features = false } diff --git a/common/src/gas_provider/node.rs b/common/src/gas_provider/node.rs index f003c365268..b0a6d26115a 100644 --- a/common/src/gas_provider/node.rs +++ b/common/src/gas_provider/node.rs @@ -203,6 +203,21 @@ pub struct ChildrenRefs { unspec_refs: u32, } +impl< + ExternalId: Clone, + Id: Clone + Copy, + Balance: Default + Zero + Clone + Copy + sp_runtime::traits::Saturating, + > GasNode +{ + /// Returns total gas value inside GasNode. + pub fn total_value(&self) -> Balance { + self.value() + .unwrap_or_default() + .saturating_add(self.lock().total_locked()) + .saturating_add(self.system_reserve().unwrap_or_default()) + } +} + impl GasNode { diff --git a/common/src/lib.rs b/common/src/lib.rs index 5ac47a9eef3..2ca0c1104d8 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -316,22 +316,14 @@ pub trait PaymentVoucher { type VoucherId; type Error; - fn redeem_with_id( - who: AccountId, - program: ProgramId, - amount: Balance, - ) -> Result; + fn voucher_id(who: AccountId, program: ProgramId) -> Self::VoucherId; } -impl PaymentVoucher for () { +impl PaymentVoucher for () { type VoucherId = AccountId; type Error = &'static str; - fn redeem_with_id( - _who: AccountId, - _program: ProgramId, - _amount: Balance, - ) -> Result { - Err("Payment vouchers are not supported") + fn voucher_id(_who: AccountId, _program: ProgramId) -> Self::VoucherId { + unimplemented!() } } diff --git a/gclient/src/api/calls.rs b/gclient/src/api/calls.rs index bf4cee2aee7..69e93065b9e 100644 --- a/gclient/src/api/calls.rs +++ b/gclient/src/api/calls.rs @@ -43,6 +43,7 @@ use gsdk::{ }, pallet_balances::{pallet::Call as BalancesCall, AccountData}, pallet_gear::pallet::Call as GearCall, + pallet_gear_bank::pallet::BankAccount, sp_weights::weight_v2::Weight, }, system::Event as SystemEvent, @@ -295,6 +296,33 @@ impl GearApi { } })?; + let src_program_account_bank_data = self + .bank_data_at(src_program_id, src_block_hash) + .await + .or_else(|e| { + if let Error::GearSDK(GsdkError::StorageNotFound) = e { + Ok(BankAccount { gas: 0, value: 0 }) + } else { + Err(e) + } + })?; + + let src_bank_account_data = self + .account_data_at(crate::bank_address(), src_block_hash) + .await + .or_else(|e| { + if let Error::GearSDK(GsdkError::StorageNotFound) = e { + Ok(AccountData { + free: 0u128, + reserved: 0, + misc_frozen: 0, + fee_frozen: 0, + }) + } else { + Err(e) + } + })?; + let mut src_program = self .0 .api() @@ -356,6 +384,23 @@ impl GearApi { ) .await?; + dest_node_api + .set_balance( + crate::bank_address(), + src_bank_account_data.free, + src_bank_account_data.reserved, + ) + .await?; + + dest_node_api + .0 + .storage + .set_bank_account_storage( + src_program_id.into_account_id(), + src_program_account_bank_data, + ) + .await?; + dest_node_api .0 .storage @@ -378,6 +423,17 @@ impl GearApi { let src_account_data = self .account_data_at(account_with_reserved_funds, src_block_hash) .await?; + let src_account_bank_data = self + .bank_data_at(account_with_reserved_funds, src_block_hash) + .await + .or_else(|e| { + if let Error::GearSDK(GsdkError::StorageNotFound) = e { + Ok(BankAccount { gas: 0, value: 0 }) + } else { + Err(e) + } + })?; + let dest_account_data = dest_node_api .account_data(account_with_reserved_funds) .await @@ -393,6 +449,17 @@ impl GearApi { Err(e) } })?; + let dest_account_bank_data = self + .bank_data_at(account_with_reserved_funds, None) + .await + .or_else(|e| { + if let Error::GearSDK(GsdkError::StorageNotFound) = e { + Ok(BankAccount { gas: 0, value: 0 }) + } else { + Err(e) + } + })?; + dest_node_api .set_balance( account_with_reserved_funds.into_account_id(), @@ -402,6 +469,22 @@ impl GearApi { .saturating_add(src_account_data.reserved), ) .await?; + + dest_node_api + .0 + .storage + .set_bank_account_storage( + account_with_reserved_funds.into_account_id(), + BankAccount { + gas: src_account_bank_data + .gas + .saturating_add(dest_account_bank_data.gas), + value: src_account_bank_data + .value + .saturating_add(dest_account_bank_data.value), + }, + ) + .await?; } let dest_gas_total_issuance = diff --git a/gclient/src/api/storage/mod.rs b/gclient/src/api/storage/mod.rs index 55e8c4498c9..52efb1e3ea2 100644 --- a/gclient/src/api/storage/mod.rs +++ b/gclient/src/api/storage/mod.rs @@ -29,7 +29,7 @@ use gsdk::{ ext::sp_core::{crypto::Ss58Codec, H256}, metadata::runtime_types::{ gear_common::storage::primitives::Interval, gear_core::message::user, - pallet_balances::AccountData, + pallet_balances::AccountData, pallet_gear_bank::pallet::BankAccount, }, }; @@ -104,6 +104,19 @@ impl GearApi { .data) } + /// Get bank account data by `account_id` at specified block. + pub(crate) async fn bank_data_at( + &self, + account_id: impl IntoAccountId32, + block_hash: Option, + ) -> Result> { + Ok(self + .0 + .api() + .bank_info_at(account_id.into_account_id(), block_hash) + .await?) + } + /// Get the total balance of the account identified by `account_id`. /// /// Total balance includes free and reserved funds. diff --git a/gclient/src/utils.rs b/gclient/src/utils.rs index be0cb85844e..df4c817269a 100644 --- a/gclient/src/utils.rs +++ b/gclient/src/utils.rs @@ -18,6 +18,7 @@ use crate::{Error, Result}; pub use gear_utils::now_micros; +use gsdk::ext::sp_runtime::AccountId32; use std::{fs, path::Path}; use wabt::Wat2Wasm; @@ -64,3 +65,10 @@ pub fn code_from_os(path: impl AsRef) -> Result> { pub fn hex_to_vec(string: impl AsRef) -> Result> { hex::decode(string.as_ref().trim_start_matches("0x")).map_err(Into::into) } + +/// Returns default bank address. +pub fn bank_address() -> AccountId32 { + const BANK_ADDRESS: [u8; 32] = *b"gearbankgearbankgearbankgearbank"; + + BANK_ADDRESS.into() +} diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index 5e5cc446c7a..868e93a71ce 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -2700,18 +2700,15 @@ pub mod runtime_types { #[doc = "Value doesn't cover ExistentialDeposit."] ValueLessThanMinimal, #[codec(index = 11)] - #[doc = "Messages storage corrupted."] - MessagesStorageCorrupted, - #[codec(index = 12)] #[doc = "Message queue processing is disabled."] MessageQueueProcessingDisabled, - #[codec(index = 13)] + #[codec(index = 12)] #[doc = "Block count doesn't cover MinimalResumePeriod."] ResumePeriodLessThanMinimal, - #[codec(index = 14)] + #[codec(index = 13)] #[doc = "Program with the specified id is not found."] ProgramNotFound, - #[codec(index = 15)] + #[codec(index = 14)] #[doc = "Voucher can't be redemmed"] FailureRedeemingVoucher, } @@ -3024,6 +3021,38 @@ pub mod runtime_types { } } } + pub mod pallet_gear_bank { + use super::runtime_types; + pub mod pallet { + use super::runtime_types; + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub struct BankAccount<_0> { + pub gas: _0, + pub value: _0, + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + #[doc = "\n\t\t\tCustom [dispatch errors](https://docs.substrate.io/main-docs/build/events-errors/)\n\t\t\tof this pallet.\n\t\t\t"] + pub enum Error { + #[codec(index = 0)] + #[doc = "Insufficient user balance."] + InsufficientBalance, + #[codec(index = 1)] + #[doc = "Insufficient user's bank account gas balance."] + InsufficientGasBalance, + #[codec(index = 2)] + #[doc = "Insufficient user's bank account gas balance."] + InsufficientValueBalance, + #[codec(index = 3)] + #[doc = "Insufficient bank account balance."] + #[doc = "**Must be unreachable in Gear main protocol.**"] + InsufficientBankBalance, + #[codec(index = 4)] + #[doc = "Deposit of funds that will not keep bank account alive."] + #[doc = "**Must be unreachable in Gear main protocol.**"] + InsufficientDeposit, + } + } + } pub mod pallet_gear_debug { use super::runtime_types; pub mod pallet { @@ -10150,6 +10179,20 @@ pub mod storage { } } } + #[doc = "Storage of pallet `GearBank`."] + pub enum GearBankStorage { + Bank, + UnusedValue, + } + impl StorageInfo for GearBankStorage { + const PALLET: &'static str = "GearBank"; + fn storage_name(&self) -> &'static str { + match self { + Self::Bank => "Bank", + Self::UnusedValue => "UnusedValue", + } + } + } #[doc = "Storage of pallet `GearDebug`."] pub enum GearDebugStorage { DebugMode, diff --git a/gsdk/src/signer/calls.rs b/gsdk/src/signer/calls.rs index d148d92af2a..2dc3d2bece5 100644 --- a/gsdk/src/signer/calls.rs +++ b/gsdk/src/signer/calls.rs @@ -27,9 +27,10 @@ use crate::{ frame_system::pallet::Call, gear_common::{ActiveProgram, Program}, gear_core::code::InstrumentedCode, + pallet_gear_bank::pallet::BankAccount, sp_weights::weight_v2::Weight, }, - storage::{GearGasStorage, GearProgramStorage}, + storage::{GearBankStorage, GearGasStorage, GearProgramStorage}, sudo::Event as SudoEvent, Event, }, @@ -294,6 +295,19 @@ impl SignerStorage { } } +// pallet-gear-bank +impl SignerStorage { + /// Writes given BankAccount info into storage at `AccountId32`. + pub async fn set_bank_account_storage( + &self, + dest: impl Into, + value: BankAccount, + ) -> EventsResult { + let addr = Api::storage(GearBankStorage::Bank, vec![Value::from_bytes(dest.into())]); + self.set_storage(&[(addr, value)]).await + } +} + // pallet-gear-program impl SignerStorage { /// Writes `InstrumentedCode` length into storage at `CodeId` diff --git a/gsdk/src/storage.rs b/gsdk/src/storage.rs index 974787f026e..7a4f3acb61e 100644 --- a/gsdk/src/storage.rs +++ b/gsdk/src/storage.rs @@ -25,10 +25,11 @@ use crate::{ gear_common::{storage::primitives::Interval, ActiveProgram, Program}, gear_core::{code::InstrumentedCode, message::user::UserStoredMessage}, pallet_balances::AccountData, + pallet_gear_bank::pallet::BankAccount, }, storage::{ - GearGasStorage, GearMessengerStorage, GearProgramStorage, GearStorage, SessionStorage, - SystemStorage, TimestampStorage, + GearBankStorage, GearGasStorage, GearMessengerStorage, GearProgramStorage, GearStorage, + SessionStorage, SystemStorage, TimestampStorage, }, }, result::{Error, Result}, @@ -197,6 +198,21 @@ impl Api { } } +// pallet-gear-bank +impl Api { + /// Get Gear bank account data at specified block. + #[storage_fetch] + pub async fn bank_info_at( + &self, + account_id: AccountId32, + block_hash: Option, + ) -> Result> { + let addr = Self::storage(GearBankStorage::Bank, vec![Value::from_bytes(account_id)]); + + self.fetch_storage_at(&addr, block_hash).await + } +} + // pallet-gear impl Api { /// Check whether the message queue processing is stopped or not. diff --git a/node/service/src/chain_spec/gear.rs b/node/service/src/chain_spec/gear.rs index 4c638b31565..89c4fd29c96 100644 --- a/node/service/src/chain_spec/gear.rs +++ b/node/service/src/chain_spec/gear.rs @@ -18,18 +18,17 @@ use crate::chain_spec::{get_account_id_from_seed, get_from_seed, AccountId, Extensions}; use gear_runtime::{ - BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, SessionConfig, SessionKeys, - SudoConfig, SystemConfig, ValidatorSetConfig, WASM_BINARY, + constants::currency::EXISTENTIAL_DEPOSIT, BabeConfig, BalancesConfig, GenesisConfig, + GrandpaConfig, SessionConfig, SessionKeys, SudoConfig, SystemConfig, ValidatorSetConfig, + WASM_BINARY, }; +use gear_runtime_common::constants::BANK_ADDRESS; use hex_literal::hex; use sc_service::ChainType; use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; -// The URL for the telemetry server. -// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; - /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. pub type ChainSpec = sc_service::GenericChainSpec; @@ -65,6 +64,7 @@ pub fn development_config() -> Result { get_account_id_from_seed::("Alice//stash"), get_account_id_from_seed::("Bob//stash"), ], + BANK_ADDRESS.into(), true, ) }, @@ -117,6 +117,7 @@ pub fn local_testnet_config() -> Result { get_account_id_from_seed::("Eve//stash"), get_account_id_from_seed::("Ferdie//stash"), ], + BANK_ADDRESS.into(), true, ) }, @@ -202,6 +203,7 @@ pub fn staging_testnet_config() -> Result { // root_key hex!["2455655ad2a1f9fbe510699026fc810a2b3cb91d432c141db54a9968da944955"].into(), ], + BANK_ADDRESS.into(), true, ) }, @@ -227,21 +229,24 @@ fn testnet_genesis( initial_authorities: Vec<(AccountId, BabeId, GrandpaId)>, root_key: AccountId, endowed_accounts: Vec, + bank_account: AccountId, _enable_println: bool, ) -> GenesisConfig { + // Configure endowed accounts with initial balance of 1 << 60. + let mut balances = endowed_accounts + .iter() + .cloned() + .map(|k| (k, 1u128 << 60)) + .collect::>(); + + balances.push((bank_account, EXISTENTIAL_DEPOSIT)); + GenesisConfig { system: SystemConfig { // Add Wasm runtime to storage. code: wasm_binary.to_vec(), }, - balances: BalancesConfig { - // Configure endowed accounts with initial balance of 1 << 60. - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, 1 << 60)) - .collect(), - }, + balances: BalancesConfig { balances }, validator_set: ValidatorSetConfig { initial_validators: initial_authorities .iter() diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index b769736c653..b6522ae114a 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -17,7 +17,7 @@ // along with this program. If not, see . use crate::chain_spec::{get_account_id_from_seed, get_from_seed, AccountId, Extensions}; -use gear_runtime_common; +use gear_runtime_common::{self, constants::BANK_ADDRESS}; use hex_literal::hex; use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use sc_chain_spec::Properties; @@ -28,15 +28,12 @@ use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; use sp_runtime::{Perbill, Perquintill}; use vara_runtime::{ - constants::currency::{DOLLARS, UNITS as TOKEN}, + constants::currency::{DOLLARS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, ImOnlineConfig, NominationPoolsConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, StakingRewardsConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY, }; -// The URL for the telemetry server. -// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/"; - /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. pub type ChainSpec = sc_service::GenericChainSpec; @@ -115,6 +112,7 @@ pub fn development_config() -> Result { get_account_id_from_seed::("Alice"), get_account_id_from_seed::("Bob"), ], + BANK_ADDRESS.into(), true, ) }, @@ -161,6 +159,7 @@ pub fn local_testnet_config() -> Result { get_account_id_from_seed::("Eve"), get_account_id_from_seed::("Ferdie"), ], + BANK_ADDRESS.into(), true, ) }, @@ -522,6 +521,7 @@ pub fn main() -> Result { // root_key hex!["2455655ad2a1f9fbe510699026fc810a2b3cb91d432c141db54a9968da944955"].into(), ], + BANK_ADDRESS.into(), true, ) }, @@ -554,24 +554,29 @@ fn testnet_genesis( )>, root_key: AccountId, endowed_accounts: Vec, + bank_account: AccountId, _enable_println: bool, ) -> GenesisConfig { const ENDOWMENT: u128 = 1_000_000 * TOKEN; const STASH: u128 = 100 * TOKEN; const MIN_NOMINATOR_BOND: u128 = 50 * TOKEN; + let _num_endowed_accounts = endowed_accounts.len(); + + let mut balances = endowed_accounts + .iter() + .map(|k: &AccountId| (k.clone(), ENDOWMENT)) + .chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH))) + .collect::>(); + + balances.push((bank_account, EXISTENTIAL_DEPOSIT)); + GenesisConfig { system: SystemConfig { // Add Wasm runtime to storage. code: wasm_binary.to_vec(), }, - balances: BalancesConfig { - balances: endowed_accounts - .iter() - .map(|k: &AccountId| (k.clone(), ENDOWMENT)) - .chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH))) - .collect(), - }, + balances: BalancesConfig { balances }, babe: BabeConfig { authorities: Default::default(), epoch_config: Some(vara_runtime::BABE_GENESIS_EPOCH_CONFIG), diff --git a/pallets/airdrop/Cargo.toml b/pallets/airdrop/Cargo.toml index 56bcc784523..35f74034b41 100644 --- a/pallets/airdrop/Cargo.toml +++ b/pallets/airdrop/Cargo.toml @@ -20,6 +20,7 @@ log.workspace = true # Internal deps common.workspace = true pallet-gear.workspace = true +pallet-gear-bank.workspace = true # Substrate deps frame-support.workspace = true @@ -58,6 +59,7 @@ std = [ "pallet-balances/std", "pallet-vesting/std", "pallet-gear/std", + "pallet-gear-bank/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/pallets/airdrop/src/benchmarking.rs b/pallets/airdrop/src/benchmarking.rs index e93b2e13738..68064fca290 100644 --- a/pallets/airdrop/src/benchmarking.rs +++ b/pallets/airdrop/src/benchmarking.rs @@ -35,7 +35,7 @@ benchmarks! { let q in 1 .. 256; let source: T::AccountId = benchmarking::account("source", 0, 0); - ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); + ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); let recipient: T::AccountId = benchmarking::account("recipient", 0, 0); // Keeping in mind the existential deposit let amount = 10_000_000_000_000_u128.saturating_add(10_u128.saturating_mul(q.into())); @@ -50,7 +50,7 @@ benchmarks! { let source: T::AccountId = benchmarking::account("source", 0, 0); let source_lookup = T::Lookup::unlookup(source.clone()); - ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); + ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); let recipient: T::AccountId = benchmarking::account("recipient", 0, 0); let amount = ::MinVestedTransfer::get().saturating_mul(q.into()); diff --git a/pallets/airdrop/src/lib.rs b/pallets/airdrop/src/lib.rs index a47401e7c1e..7609271c50e 100644 --- a/pallets/airdrop/src/lib.rs +++ b/pallets/airdrop/src/lib.rs @@ -37,7 +37,7 @@ mod mock; #[cfg(test)] mod tests; -pub(crate) type BalanceOf = <::Currency as Currency< +pub(crate) type BalanceOf = <::Currency as Currency< ::AccountId, >>::Balance; @@ -118,7 +118,7 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { ensure_root(origin)?; - <::Currency as Currency<_>>::transfer( + <::Currency as Currency<_>>::transfer( &source, &dest, amount, diff --git a/pallets/airdrop/src/mock.rs b/pallets/airdrop/src/mock.rs index c4ec16432f8..837e63fccd5 100644 --- a/pallets/airdrop/src/mock.rs +++ b/pallets/airdrop/src/mock.rs @@ -56,6 +56,7 @@ construct_runtime!( GearMessenger: pallet_gear_messenger, GearScheduler: pallet_gear_scheduler, GearGas: pallet_gear_gas, + GearBank: pallet_gear_bank, Gear: pallet_gear, Airdrop: pallet_airdrop, Vesting: pallet_vesting, @@ -152,12 +153,17 @@ parameter_types! { pub RentCostPerBlock: Balance = 11; pub ResumeMinimalPeriod: BlockNumber = 100; pub ResumeSessionDuration: BlockNumber = 1_000; + pub const BankAddress: AccountId = 15082001; +} + +impl pallet_gear_bank::Config for Test { + type Currency = Balances; + type BankAddress = BankAddress; } impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type Currency = Balances; type GasPrice = GasConverter; type WeightInfo = (); type Schedule = GearSchedule; @@ -221,7 +227,11 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .unwrap(); pallet_balances::GenesisConfig:: { - balances: vec![(ROOT, 100_000_000_u128), (BOB, 100_000_000_u128)], + balances: vec![ + (ROOT, 100_000_000_u128), + (BOB, 100_000_000_u128), + (BankAddress::get(), ExistentialDeposit::get()), + ], } .assimilate_storage(&mut t) .unwrap(); diff --git a/pallets/airdrop/src/tests.rs b/pallets/airdrop/src/tests.rs index 3e57371758c..420b8c05930 100644 --- a/pallets/airdrop/src/tests.rs +++ b/pallets/airdrop/src/tests.rs @@ -18,8 +18,8 @@ use super::*; use crate::mock::{ - new_test_ext, Airdrop, AirdropCall, AirdropError, Balances, RuntimeCall, RuntimeOrigin, Sudo, - Test, Vesting, VestingError, ALICE, BOB, ROOT, + new_test_ext, Airdrop, AirdropCall, AirdropError, Balances, BankAddress, ExistentialDeposit, + RuntimeCall, RuntimeOrigin, Sudo, Test, Vesting, VestingError, ALICE, BOB, ROOT, }; use frame_support::{assert_err, assert_noop, assert_ok}; use frame_system::Config; @@ -29,7 +29,10 @@ use pallet_vesting::VestingInfo; fn test_setup_works() { new_test_ext().execute_with(|| { assert_eq!(Sudo::key(), Some(ROOT)); - assert_eq!(Balances::total_issuance(), 200_000_000); + assert_eq!( + Balances::total_issuance(), + 200_000_000 + ExistentialDeposit::get() + ); }); } @@ -44,7 +47,14 @@ fn sudo_call_works() { assert_ok!(Sudo::sudo(RuntimeOrigin::signed(ROOT), call)); assert_eq!(Balances::total_balance(&ALICE), 10_000_000); assert_eq!(Balances::total_balance(&ROOT), 90_000_000); - assert_eq!(Balances::total_issuance(), 200_000_000); + assert_eq!( + Balances::total_balance(&BankAddress::get()), + ExistentialDeposit::get() + ); + assert_eq!( + Balances::total_issuance(), + 200_000_000 + ExistentialDeposit::get() + ); assert_eq!(Balances::locks(BOB).len(), 1); let call = Box::new(RuntimeCall::Airdrop(AirdropCall::transfer_vested { @@ -57,7 +67,10 @@ fn sudo_call_works() { assert_eq!(Balances::total_balance(&BOB), 0); assert_eq!(Balances::locks(BOB), vec![]); assert_eq!(Balances::total_balance(&ALICE), 110_000_000); - assert_eq!(Balances::total_issuance(), 200_000_000); + assert_eq!( + Balances::total_issuance(), + 200_000_000 + ExistentialDeposit::get() + ); }); } #[test] @@ -75,7 +88,14 @@ fn vesting_transfer_works() { assert_eq!(Balances::total_balance(&ALICE), 0); assert_eq!(Balances::total_balance(&BOB), 100_000_000); assert_eq!(Balances::total_balance(&ROOT), 100_000_000); - assert_eq!(Balances::total_issuance(), 200_000_000); + assert_eq!( + Balances::total_balance(&BankAddress::get()), + ExistentialDeposit::get() + ); + assert_eq!( + Balances::total_issuance(), + 200_000_000 + ExistentialDeposit::get() + ); // Vesting must exist on the source account assert_err!( @@ -113,7 +133,10 @@ fn vesting_transfer_works() { ); assert_eq!(Balances::total_balance(&BOB), 90_000_000); assert_eq!(Balances::free_balance(ALICE), 10_000_000); - assert_eq!(Balances::total_issuance(), 200_000_000); + assert_eq!( + Balances::total_issuance(), + 200_000_000 + ExistentialDeposit::get() + ); // Transfer all of vested funds to ALICE assert_ok!(Airdrop::transfer_vested( @@ -128,7 +151,10 @@ fn vesting_transfer_works() { assert_eq!(Vesting::vesting(BOB), None); assert_eq!(Balances::total_balance(&BOB), 0); assert_eq!(Balances::free_balance(ALICE), 100_000_000); - assert_eq!(Balances::total_issuance(), 200_000_000); + assert_eq!( + Balances::total_issuance(), + 200_000_000 + ExistentialDeposit::get() + ); }); } diff --git a/pallets/gas/Cargo.toml b/pallets/gas/Cargo.toml index 0935e898035..765924dc01c 100644 --- a/pallets/gas/Cargo.toml +++ b/pallets/gas/Cargo.toml @@ -41,7 +41,6 @@ sp-io = { workspace = true, features = ["std"] } frame-support-test = { workspace = true, features = ["std"] } pallet-authorship = { workspace = true, features = ["std"] } pallet-timestamp = { workspace = true, features = ["std"] } -pallet-gear = { workspace = true, features = ["std"] } pallet-gear-program = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } pallet-gear-scheduler = { workspace = true, features = ["std"] } diff --git a/pallets/gear-bank/Cargo.toml b/pallets/gear-bank/Cargo.toml new file mode 100644 index 00000000000..0872ba22114 --- /dev/null +++ b/pallets/gear-bank/Cargo.toml @@ -0,0 +1,46 @@ +[package] +name = "pallet-gear-bank" +version = "1.0.0" +authors.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +parity-scale-codec = { workspace = true, features = ["derive"] } +scale-info = { workspace = true, features = ["derive"] } +log.workspace = true + +# Internal deps +common.workspace = true + +# Substrate deps +frame-support.workspace = true +frame-system.workspace = true +frame-benchmarking = { workspace = true, optional = true } +pallet-authorship.workspace = true +sp-runtime.workspace = true + +[dev-dependencies] +primitive-types.workspace = true + +# Substrate deps +pallet-authorship = { workspace = true, features = ["std"] } +pallet-balances = { workspace = true, features = ["std"] } +sp-io = { workspace = true, features = ["std"] } + +[features] +default = ['std'] +std = [ + "common/std", + "frame-support/std", + "frame-system/std", + "pallet-authorship/std", + "sp-runtime/std", +] +runtime-benchmarks = [ + "frame-benchmarking/runtime-benchmarks", + "frame-system/runtime-benchmarks", + "frame-support/runtime-benchmarks", + "common/runtime-benchmarks", +] +try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/gear-bank/src/lib.rs b/pallets/gear-bank/src/lib.rs new file mode 100644 index 00000000000..37e37dbe6e6 --- /dev/null +++ b/pallets/gear-bank/src/lib.rs @@ -0,0 +1,425 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! # Gear Bank Pallet. + +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(test)] +mod mock; + +#[cfg(test)] +mod tests; + +pub use pallet::*; + +use frame_support::traits::{Currency, StorageVersion}; + +pub(crate) type AccountIdOf = ::AccountId; +pub(crate) type BalanceOf = as Currency>>::Balance; +pub(crate) type CurrencyOf = ::Currency; + +/// The current storage version. +pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + +#[frame_support::pallet] +pub mod pallet { + use super::*; + use common::GasPrice; + use core::ops::Add; + use frame_support::{ + ensure, + pallet_prelude::{StorageMap, StorageValue, ValueQuery}, + sp_runtime::{traits::CheckedSub, Saturating}, + traits::{ExistenceRequirement, Get, ReservableCurrency, WithdrawReasons}, + Identity, + }; + use pallet_authorship::Pallet as Authorship; + use parity_scale_codec::{Decode, Encode, MaxEncodedLen}; + use scale_info::TypeInfo; + use sp_runtime::traits::Zero; + + // Funds pallet struct itself. + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] + pub struct Pallet(_); + + // Funds pallets config. + #[pallet::config] + pub trait Config: frame_system::Config + pallet_authorship::Config { + /// Balances management trait for gas/value migrations. + type Currency: ReservableCurrency>; + + #[pallet::constant] + /// Bank account address, that will keep all reserved funds. + type BankAddress: Get>; + } + + // Funds pallets error. + #[pallet::error] + pub enum Error { + /// Insufficient user balance. + InsufficientBalance, + /// Insufficient user's bank account gas balance. + InsufficientGasBalance, + /// Insufficient user's bank account gas balance. + InsufficientValueBalance, + /// Insufficient bank account balance. + /// **Must be unreachable in Gear main protocol.** + InsufficientBankBalance, + /// Deposit of funds that will not keep bank account alive. + /// **Must be unreachable in Gear main protocol.** + InsufficientDeposit, + } + + /// Type containing info of locked in special address funds of each account. + #[derive( + Debug, + Default, + Clone, + Copy, + PartialEq, + Eq, + PartialOrd, + Ord, + MaxEncodedLen, + Encode, + Decode, + TypeInfo, + )] + pub struct BankAccount { + /// Balance locked for gas purchase. + pub gas: Balance, + /// Balance locked for future transfer. + pub value: Balance, + } + + impl + Saturating> BankAccount { + pub fn total(self) -> Balance { + self.gas.saturating_add(self.value) + } + } + + // Required by Zero trait impl. + impl> Add for BankAccount { + type Output = Self; + + fn add(self, rhs: Self) -> Self::Output { + Self { + gas: self.gas + rhs.gas, + value: self.value + rhs.value, + } + } + } + + impl Zero for BankAccount { + fn zero() -> Self { + Self { + gas: Zero::zero(), + value: Zero::zero(), + } + } + + fn is_zero(&self) -> bool { + self.gas.is_zero() && self.value.is_zero() + } + } + + // Private storage that keeps account bank details. + #[pallet::storage] + #[pallet::getter(fn account)] + pub type Bank = StorageMap<_, Identity, AccountIdOf, BankAccount>>; + + // Private storage that keeps amount of value that wasn't sent because owner is inexistent account. + #[pallet::storage] + #[pallet::getter(fn unused_value)] + pub type UnusedValue = StorageValue<_, BalanceOf, ValueQuery>; + + impl Pallet { + /// Transfers value from `account_id` to bank address. + fn deposit(account_id: &AccountIdOf, value: BalanceOf) -> Result<(), Error> { + let bank_address = T::BankAddress::get(); + + ensure!( + CurrencyOf::::free_balance(&bank_address).saturating_add(value) + >= CurrencyOf::::minimum_balance(), + Error::InsufficientDeposit + ); + + // Check on zero value is inside `pallet_balances` implementation. + CurrencyOf::::transfer( + account_id, + &bank_address, + value, + ExistenceRequirement::AllowDeath, + ) + .map_err(|_| Error::::InsufficientBalance) + } + + /// Ensures that bank account is able to transfer requested value. + fn ensure_bank_can_transfer(value: BalanceOf) -> Result<(), Error> { + let bank_address = T::BankAddress::get(); + + CurrencyOf::::free_balance(&bank_address) + .checked_sub(&value) + .map_or(false, |new_balance| { + CurrencyOf::::ensure_can_withdraw( + &bank_address, + value, + WithdrawReasons::TRANSFER, + new_balance, + ) + .is_ok() + }) + .then_some(()) + .ok_or(Error::::InsufficientBankBalance) + } + + /// Transfers value from bank address to `account_id`. + fn withdraw(account_id: &AccountIdOf, value: BalanceOf) -> Result<(), Error> { + Self::ensure_bank_can_transfer(value)?; + + // The check is similar to one that used in transfer implementation. + // It allows us define if we cannot transfer funds on early stage + // to be able mean any transfer error as insufficient bank + // account balance, because other conditions are checked + // here and in other caller places. + if CurrencyOf::::free_balance(account_id).saturating_add(value) + < CurrencyOf::::minimum_balance() + { + UnusedValue::::mutate(|unused_value| { + *unused_value = unused_value.saturating_add(value); + }); + + return Ok(()); + } + + // Check on zero value is inside `pallet_balances` implementation. + CurrencyOf::::transfer( + &T::BankAddress::get(), + account_id, + value, + // We always require bank account to be alive. + ExistenceRequirement::KeepAlive, + ) + .map_err(|_| Error::::InsufficientBankBalance) + } + + /// Transfers value from bank address to current block author. + fn reward_block_author(value: BalanceOf) -> Result<(), Error> { + let block_author = Authorship::::author() + .unwrap_or_else(|| unreachable!("Failed to find block author!")); + + Self::withdraw(&block_author, value) + } + + pub fn deposit_gas>>( + account_id: &AccountIdOf, + amount: u64, + ) -> Result<(), Error> { + if amount.is_zero() { + return Ok(()); + } + + let value = P::gas_price(amount); + + Self::deposit(account_id, value)?; + + Bank::::mutate(account_id, |details| { + let details = details.get_or_insert_with(Default::default); + // There is no reason to return any errors on overflow, because + // total value issuance is always lower than numeric MAX. + // + // Using saturating addition for code consistency. + details.gas = details.gas.saturating_add(value); + }); + + Ok(()) + } + + fn withdraw_gas_no_transfer>>( + account_id: &AccountIdOf, + amount: u64, + ) -> Result, Error> { + let value = P::gas_price(amount); + + let gas_balance = Self::account_gas(account_id); + + ensure!( + gas_balance.is_some() && gas_balance.expect("Checked before") >= value, + Error::::InsufficientGasBalance + ); + + Self::ensure_bank_can_transfer(value)?; + + Bank::::mutate(account_id, |details_opt| { + let details = details_opt.as_mut().expect("Checked above"); + + // Insufficient case checked above. + details.gas = details.gas.saturating_sub(value); + + if details.is_zero() { + *details_opt = None; + } + }); + + Ok(value) + } + + pub fn withdraw_gas>>( + account_id: &AccountIdOf, + amount: u64, + ) -> Result<(), Error> { + if amount.is_zero() { + return Ok(()); + } + + let value = Self::withdraw_gas_no_transfer::

(account_id, amount)?; + + // All the checks and internal values withdrawals performed in + // `*_no_transfer` function above. + // + // This call does only currency trait final transfer. + Self::withdraw(account_id, value).unwrap_or_else(|e| unreachable!("qed above: {e:?}")); + + Ok(()) + } + + pub fn spend_gas>>( + account_id: &AccountIdOf, + amount: u64, + ) -> Result<(), Error> { + if amount.is_zero() { + return Ok(()); + } + + let value = Self::withdraw_gas_no_transfer::

(account_id, amount)?; + + // All the checks and internal values withdrawals performed in + // `*_no_transfer` function above. + // + // This call does only currency trait final transfer. + Self::reward_block_author(value).unwrap_or_else(|e| unreachable!("qed above: {e:?}")); + + Ok(()) + } + + pub fn deposit_value( + account_id: &AccountIdOf, + value: BalanceOf, + ) -> Result<(), Error> { + if value.is_zero() { + return Ok(()); + } + + Self::deposit(account_id, value)?; + + Bank::::mutate(account_id, |details| { + let details = details.get_or_insert_with(Default::default); + // There is no reason to return any errors on overflow, because + // total value issuance is always lower than numeric MAX. + // + // Using saturating addition for code consistency. + details.value = details.value.saturating_add(value); + }); + + Ok(()) + } + + fn withdraw_value_no_transfer( + account_id: &AccountIdOf, + value: BalanceOf, + ) -> Result<(), Error> { + let value_balance = Self::account_value(account_id); + + ensure!( + value_balance.is_some() && value_balance.expect("Checked before") >= value, + Error::::InsufficientValueBalance + ); + + Self::ensure_bank_can_transfer(value)?; + + Bank::::mutate(account_id, |details_opt| { + let details = details_opt.as_mut().expect("Checked above"); + + // Insufficient case checked above. + details.value = details.value.saturating_sub(value); + + if details.is_zero() { + *details_opt = None; + } + }); + + Ok(()) + } + + pub fn withdraw_value( + account_id: &AccountIdOf, + value: BalanceOf, + ) -> Result<(), Error> { + if value.is_zero() { + return Ok(()); + } + + Self::withdraw_value_no_transfer(account_id, value)?; + + // All the checks and internal values withdrawals performed in + // `*_no_transfer` function above. + // + // This call does only currency trait final transfer. + Self::withdraw(account_id, value).unwrap_or_else(|e| unreachable!("qed above: {e:?}")); + + Ok(()) + } + + // TODO: take care on this fn impl in case of bump ED (issue #3115). + pub fn transfer_value( + account_id: &AccountIdOf, + destination: &AccountIdOf, + value: BalanceOf, + ) -> Result<(), Error> { + if value.is_zero() { + return Ok(()); + } + + Self::withdraw_value_no_transfer(account_id, value)?; + + // All the checks and internal values withdrawals performed in + // `*_no_transfer` function above. + // + // This call does only currency trait final transfer. + Self::withdraw(destination, value).unwrap_or_else(|e| unreachable!("qed above: {e:?}")); + + Ok(()) + } + + pub fn account_gas(account_id: &AccountIdOf) -> Option> { + Self::account(account_id).map(|v| v.gas) + } + + pub fn account_value(account_id: &AccountIdOf) -> Option> { + Self::account(account_id).map(|v| v.value) + } + + pub fn account_total(account_id: &AccountIdOf) -> BalanceOf { + Self::account(account_id) + .map(|v| v.total()) + .unwrap_or_default() + } + } +} diff --git a/pallets/gear-bank/src/mock.rs b/pallets/gear-bank/src/mock.rs new file mode 100644 index 00000000000..733bb770a72 --- /dev/null +++ b/pallets/gear-bank/src/mock.rs @@ -0,0 +1,157 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate as pallet_gear_bank; +use frame_support::{ + construct_runtime, parameter_types, + traits::{Everything, FindAuthor}, + weights::constants::RocksDbWeight, +}; +use frame_system::mocking::{MockBlock, MockUncheckedExtrinsic}; +use pallet_balances::AccountData; +use primitive_types::H256; +use sp_io::TestExternalities; +use sp_runtime::{ + testing::Header, + traits::{BlakeTwo256, ConstU32, IdentityLookup}, +}; + +pub type AccountId = u8; +pub type Balance = u128; + +mod consts { + #![allow(unused)] + + use super::*; + + pub const ALICE: AccountId = 1; + pub const ALICE_BALANCE: Balance = 100_000_000_000; + + pub const BOB: AccountId = 2; + pub const BOB_BALANCE: Balance = 150_000_000; + + pub const BLOCK_AUTHOR: AccountId = 255; + + pub const BANK_ADDRESS: AccountId = 137; + + pub const CHARLIE: AccountId = 3; + pub const EVE: AccountId = 4; + + pub const EXISTENTIAL_DEPOSIT: Balance = 100_000; +} + +pub use consts::*; + +parameter_types! { + pub const BankAddress: AccountId = BANK_ADDRESS; + pub const BlockHashCount: u64 = 250; + pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT; +} + +construct_runtime!( + pub enum Test where + Block = MockBlock, + NodeBlock = MockBlock, + UncheckedExtrinsic = MockUncheckedExtrinsic, + { + System: frame_system, + Authorship: pallet_authorship, + Balances: pallet_balances, + GearBank: pallet_gear_bank, + } +); + +impl frame_system::Config for Test { + type BaseCallFilter = Everything; + type BlockWeights = (); + type BlockLength = (); + type DbWeight = RocksDbWeight; + type RuntimeOrigin = RuntimeOrigin; + type RuntimeCall = RuntimeCall; + type Index = u64; + type BlockNumber = u64; + type Hash = H256; + type Hashing = BlakeTwo256; + type AccountId = AccountId; + type Lookup = IdentityLookup; + type Header = Header; + type RuntimeEvent = RuntimeEvent; + type BlockHashCount = BlockHashCount; + type Version = (); + type PalletInfo = PalletInfo; + type AccountData = AccountData; + type OnNewAccount = (); + type OnKilledAccount = (); + type SystemWeightInfo = (); + type SS58Prefix = (); + type OnSetCode = (); + type MaxConsumers = ConstU32<16>; +} + +pub struct FixedBlockAuthor; + +impl FindAuthor for FixedBlockAuthor { + fn find_author<'a, I: 'a>(_: I) -> Option { + Some(BLOCK_AUTHOR) + } +} + +impl pallet_authorship::Config for Test { + type FindAuthor = FixedBlockAuthor; + type EventHandler = (); +} + +impl pallet_balances::Config for Test { + type MaxLocks = (); + type MaxReserves = (); + type ReserveIdentifier = [u8; 8]; + type Balance = Balance; + type DustRemoval = (); + type RuntimeEvent = RuntimeEvent; + type ExistentialDeposit = ExistentialDeposit; + type AccountStore = System; + type WeightInfo = (); +} + +impl pallet_gear_bank::Config for Test { + type Currency = Balances; + type BankAddress = BankAddress; +} + +pub fn new_test_ext() -> TestExternalities { + let mut storage = frame_system::GenesisConfig::default() + .build_storage::() + .unwrap(); + + let balances = vec![ + (ALICE, ALICE_BALANCE), + (BOB, BOB_BALANCE), + (BANK_ADDRESS, EXISTENTIAL_DEPOSIT), + (BLOCK_AUTHOR, EXISTENTIAL_DEPOSIT), + (CHARLIE, EXISTENTIAL_DEPOSIT), + (EVE, EXISTENTIAL_DEPOSIT), + ]; + + pallet_balances::GenesisConfig:: { balances } + .assimilate_storage(&mut storage) + .unwrap(); + + let mut ext = TestExternalities::new(storage); + ext.execute_with(|| System::set_block_number(1)); + ext +} diff --git a/pallets/gear-bank/src/tests.rs b/pallets/gear-bank/src/tests.rs new file mode 100644 index 00000000000..814981cf8ef --- /dev/null +++ b/pallets/gear-bank/src/tests.rs @@ -0,0 +1,1512 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{mock::*, *}; +use common::GasPrice; +use frame_support::{assert_noop, assert_ok}; +use sp_runtime::traits::{ConstU128, Zero}; +use utils::*; + +#[test] +fn deposit_gas_different_users() { + new_test_ext().execute_with(|| { + assert_bank_balance(0, 0); + + assert_balance(&ALICE, ALICE_BALANCE); + assert_balance(&BOB, BOB_BALANCE); + + const ALICE_GAS: u64 = 1_234_567; + assert_ok!(GearBank::deposit_gas::(&ALICE, ALICE_GAS)); + + assert_bank_balance(ALICE_GAS, 0); + + assert_alice_dec(GasConverter::gas_price(ALICE_GAS)); + assert_gas_value(&ALICE, ALICE_GAS, 0); + + const BOB_GAS: u64 = 56_789; + assert_ok!(GearBank::deposit_gas::(&BOB, BOB_GAS)); + + assert_bank_balance(ALICE_GAS + BOB_GAS, 0); + + assert_alice_dec(GasConverter::gas_price(ALICE_GAS)); + assert_gas_value(&ALICE, ALICE_GAS, 0); + + assert_bob_dec(GasConverter::gas_price(BOB_GAS)); + assert_gas_value(&BOB, BOB_GAS, 0); + }) +} + +#[test] +fn deposit_gas_single_user() { + new_test_ext().execute_with(|| { + const GAS_1: u64 = 123_456; + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_1)); + + assert_bank_balance(GAS_1, 0); + + assert_alice_dec(GasConverter::gas_price(GAS_1)); + assert_gas_value(&ALICE, GAS_1, 0); + + const GAS_2: u64 = 67_890; + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_2)); + + assert_bank_balance(GAS_1 + GAS_2, 0); + + assert_alice_dec(GasConverter::gas_price(GAS_1 + GAS_2)); + assert_gas_value(&ALICE, GAS_1 + GAS_2, 0); + }) +} + +#[test] +fn deposit_gas_user_account_deleted() { + new_test_ext().execute_with(|| { + const ALICE_TO_DUST_BALANCE: Balance = EXISTENTIAL_DEPOSIT - VALUE_PER_GAS; + + const BALANCE_DIFF: Balance = ALICE_BALANCE - ALICE_TO_DUST_BALANCE; + const GAS_AMOUNT: u64 = (BALANCE_DIFF / VALUE_PER_GAS) as u64; + + assert_eq!(GasConverter::gas_price(GAS_AMOUNT), BALANCE_DIFF); + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_bank_balance(GAS_AMOUNT, 0); + + assert_balance(&ALICE, 0); + assert_gas_value(&ALICE, GAS_AMOUNT, 0); + }) +} + +#[test] +fn deposit_gas_zero() { + new_test_ext().execute_with(|| { + let h = frame_support::storage_root(frame_support::StateVersion::V1); + + assert_ok!(GearBank::deposit_gas::(&ALICE, 0)); + + assert_ok!(GearBank::deposit_gas::(&Zero::zero(), 0)); + + // No-op operation assertion. + assert_eq!( + h, + frame_support::storage_root(frame_support::StateVersion::V1), + "storage has been mutated" + ); + }) +} + +#[test] +fn deposit_gas_insufficient_balance() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = u64::MAX; + + assert!(GasConverter::gas_price(GAS_AMOUNT) > Balances::free_balance(ALICE)); + + assert_noop!( + GearBank::deposit_gas::(&ALICE, GAS_AMOUNT), + Error::::InsufficientBalance + ); + }) +} + +#[test] +fn deposit_gas_insufficient_deposit() { + // Unreachable case for Gear protocol. + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 1; + + assert!(GasConverter::gas_price(GAS_AMOUNT) < CurrencyOf::::minimum_balance()); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(BANK_ADDRESS), + Zero::zero(), + false, + )); + + assert_noop!( + GearBank::deposit_gas::(&ALICE, GAS_AMOUNT), + Error::::InsufficientDeposit + ); + }) +} + +#[test] +fn withdraw_gas_different_users() { + new_test_ext().execute_with(|| { + const ALICE_GAS: u64 = 1_234_567; + assert_ok!(GearBank::deposit_gas::(&ALICE, ALICE_GAS)); + + const BOB_GAS: u64 = 56_789; + assert_ok!(GearBank::deposit_gas::(&BOB, BOB_GAS)); + + const ALICE_WITHDRAW: u64 = ALICE_GAS - 123_456; + assert_ok!(GearBank::withdraw_gas::(&ALICE, ALICE_WITHDRAW)); + + assert_bank_balance(ALICE_GAS - ALICE_WITHDRAW + BOB_GAS, 0); + + assert_alice_dec(GasConverter::gas_price(ALICE_GAS - ALICE_WITHDRAW)); + assert_gas_value(&ALICE, ALICE_GAS - ALICE_WITHDRAW, 0); + + assert_bob_dec(GasConverter::gas_price(BOB_GAS)); + assert_gas_value(&BOB, BOB_GAS, 0); + + const BOB_WITHDRAW: u64 = BOB_GAS - 1_234; + assert_ok!(GearBank::withdraw_gas::(&BOB, BOB_WITHDRAW)); + + assert_bank_balance(ALICE_GAS - ALICE_WITHDRAW + BOB_GAS - BOB_WITHDRAW, 0); + + assert_alice_dec(GasConverter::gas_price(ALICE_GAS - ALICE_WITHDRAW)); + assert_gas_value(&ALICE, ALICE_GAS - ALICE_WITHDRAW, 0); + + assert_bob_dec(GasConverter::gas_price(BOB_GAS - BOB_WITHDRAW)); + assert_gas_value(&BOB, BOB_GAS - BOB_WITHDRAW, 0); + }) +} + +#[test] +fn withdraw_gas_single_user() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + const WITHDRAW_1: u64 = GAS_AMOUNT - 23_456; + assert_ok!(GearBank::withdraw_gas::(&ALICE, WITHDRAW_1)); + + assert_bank_balance(GAS_AMOUNT - WITHDRAW_1, 0); + + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT - WITHDRAW_1)); + assert_gas_value(&ALICE, GAS_AMOUNT - WITHDRAW_1, 0); + + const WITHDRAW_2: u64 = GAS_AMOUNT - WITHDRAW_1 - 10_000; + assert_ok!(GearBank::withdraw_gas::(&ALICE, WITHDRAW_2)); + + assert_bank_balance(GAS_AMOUNT - WITHDRAW_1 - WITHDRAW_2, 0); + + assert_alice_dec(GasConverter::gas_price( + GAS_AMOUNT - WITHDRAW_1 - WITHDRAW_2, + )); + assert_gas_value(&ALICE, GAS_AMOUNT - WITHDRAW_1 - WITHDRAW_2, 0); + }) +} + +#[test] +fn withdraw_gas_all_balance() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + + assert_bank_balance(0, 0); + + assert_alice_dec(0); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn withdraw_gas_all_balance_user_account_deleted() { + new_test_ext().execute_with(|| { + const ALICE_TO_DUST_BALANCE: Balance = EXISTENTIAL_DEPOSIT - VALUE_PER_GAS; + + const BALANCE_DIFF: Balance = ALICE_BALANCE - ALICE_TO_DUST_BALANCE; + const GAS_AMOUNT: u64 = (BALANCE_DIFF / VALUE_PER_GAS) as u64; + + assert_eq!(GasConverter::gas_price(GAS_AMOUNT), BALANCE_DIFF); + assert!(BALANCE_DIFF > CurrencyOf::::minimum_balance()); + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + + assert_bank_balance(0, 0); + + assert_alice_dec(ALICE_TO_DUST_BALANCE); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn withdraw_gas_small_amount() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = ((EXISTENTIAL_DEPOSIT - VALUE_PER_GAS) / VALUE_PER_GAS) as u64; + + assert!(GasConverter::gas_price(GAS_AMOUNT) < CurrencyOf::::minimum_balance()); + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + + assert_bank_balance(0, 0); + + assert_alice_dec(0); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn withdraw_gas_small_amount_user_account_deleted() { + new_test_ext().execute_with(|| { + const GAS_VALUE_AMOUNT: Balance = EXISTENTIAL_DEPOSIT - VALUE_PER_GAS; + assert!(GAS_VALUE_AMOUNT < CurrencyOf::::minimum_balance()); + + const GAS_AMOUNT: u64 = (GAS_VALUE_AMOUNT / VALUE_PER_GAS) as u64; + assert_eq!(GasConverter::gas_price(GAS_AMOUNT), GAS_VALUE_AMOUNT); + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(ALICE), + Zero::zero(), + false, + )); + + assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + + assert_eq!(GearBank::unused_value(), GAS_VALUE_AMOUNT); + assert_balance(&BANK_ADDRESS, EXISTENTIAL_DEPOSIT + GAS_VALUE_AMOUNT); + + assert_bank_balance(0, 0); + + assert_balance(&ALICE, 0); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn withdraw_gas_zero() { + new_test_ext().execute_with(|| { + let h = frame_support::storage_root(frame_support::StateVersion::V1); + + assert_ok!(GearBank::withdraw_gas::(&ALICE, 0)); + + assert_ok!(GearBank::withdraw_gas::(&Zero::zero(), 0)); + + // No-op operation assertion. + assert_eq!( + h, + frame_support::storage_root(frame_support::StateVersion::V1), + "storage has been mutated" + ); + }) +} + +#[test] +fn withdraw_gas_insufficient_bank_balance() { + // Unreachable case for Gear protocol. + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(BANK_ADDRESS), + Zero::zero(), + false, + )); + + assert_noop!( + GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT), + Error::::InsufficientBankBalance + ); + }) +} + +#[test] +fn withdraw_gas_insufficient_gas_balance() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_noop!( + GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT + 1), + Error::::InsufficientGasBalance + ); + + assert_ok!(GearBank::deposit_gas::(&BOB, GAS_AMOUNT)); + + assert_noop!( + GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT + 1), + Error::::InsufficientGasBalance + ); + }) +} + +#[test] +fn withdraw_gas_insufficient_inexistent_gas_balance() { + new_test_ext().execute_with(|| { + assert_noop!( + GearBank::withdraw_gas::(&ALICE, 1), + Error::::InsufficientGasBalance + ); + + assert_noop!( + GearBank::withdraw_gas::(&Zero::zero(), 1), + Error::::InsufficientGasBalance + ); + + const GAS_AMOUNT: u64 = 123_456; + + assert_ok!(GearBank::deposit_gas::(&BOB, GAS_AMOUNT)); + + assert_noop!( + GearBank::withdraw_gas::(&ALICE, 1), + Error::::InsufficientGasBalance + ); + + assert_noop!( + GearBank::withdraw_gas::(&Zero::zero(), 1), + Error::::InsufficientGasBalance + ); + }) +} + +#[test] +fn spend_gas_different_users() { + new_test_ext().execute_with(|| { + const ALICE_GAS: u64 = 1_234_567; + assert_ok!(GearBank::deposit_gas::(&ALICE, ALICE_GAS)); + + const BOB_GAS: u64 = 56_789; + assert_ok!(GearBank::deposit_gas::(&BOB, BOB_GAS)); + + const ALICE_BURN: u64 = ALICE_GAS - 123_456; + assert_ok!(GearBank::spend_gas::(&ALICE, ALICE_BURN)); + + assert_bank_balance(ALICE_GAS - ALICE_BURN + BOB_GAS, 0); + + assert_block_author_inc(GasConverter::gas_price(ALICE_BURN)); + + assert_alice_dec(GasConverter::gas_price(ALICE_GAS)); + assert_gas_value(&ALICE, ALICE_GAS - ALICE_BURN, 0); + + assert_bob_dec(GasConverter::gas_price(BOB_GAS)); + assert_gas_value(&BOB, BOB_GAS, 0); + + const BOB_BURN: u64 = BOB_GAS - 1_234; + assert_ok!(GearBank::spend_gas::(&BOB, BOB_BURN)); + + assert_bank_balance(ALICE_GAS - ALICE_BURN + BOB_GAS - BOB_BURN, 0); + + assert_block_author_inc(GasConverter::gas_price(ALICE_BURN + BOB_BURN)); + + assert_alice_dec(GasConverter::gas_price(ALICE_GAS)); + assert_gas_value(&ALICE, ALICE_GAS - ALICE_BURN, 0); + + assert_bob_dec(GasConverter::gas_price(BOB_GAS)); + assert_gas_value(&BOB, BOB_GAS - BOB_BURN, 0); + }) +} + +#[test] +fn spend_gas_single_user() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + const BURN_1: u64 = GAS_AMOUNT - 23_456; + assert_ok!(GearBank::spend_gas::(&ALICE, BURN_1)); + + assert_bank_balance(GAS_AMOUNT - BURN_1, 0); + + assert_block_author_inc(GasConverter::gas_price(BURN_1)); + + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_gas_value(&ALICE, GAS_AMOUNT - BURN_1, 0); + + const BURN_2: u64 = GAS_AMOUNT - BURN_1 - 10_000; + assert_ok!(GearBank::spend_gas::(&ALICE, BURN_2)); + + assert_bank_balance(GAS_AMOUNT - BURN_1 - BURN_2, 0); + + assert_block_author_inc(GasConverter::gas_price(BURN_1 + BURN_2)); + + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_gas_value(&ALICE, GAS_AMOUNT - BURN_1 - BURN_2, 0); + }) +} + +#[test] +fn spend_gas_all_balance() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + + assert_bank_balance(0, 0); + + assert_block_author_inc(GasConverter::gas_price(GAS_AMOUNT)); + + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn spend_gas_all_balance_validator_account_deleted() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + + assert!(GasConverter::gas_price(GAS_AMOUNT) >= CurrencyOf::::minimum_balance()); + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(BLOCK_AUTHOR), + Zero::zero(), + false, + )); + + assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + + assert_bank_balance(0, 0); + + assert_balance(&BLOCK_AUTHOR, GasConverter::gas_price(GAS_AMOUNT)); + + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn spend_gas_small_amount() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = ((EXISTENTIAL_DEPOSIT - VALUE_PER_GAS) / VALUE_PER_GAS) as u64; + + assert!(GasConverter::gas_price(GAS_AMOUNT) < CurrencyOf::::minimum_balance()); + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + + assert_bank_balance(0, 0); + + assert_block_author_inc(GasConverter::gas_price(GAS_AMOUNT)); + + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn spend_gas_small_amount_validator_account_deleted() { + new_test_ext().execute_with(|| { + const GAS_VALUE_AMOUNT: Balance = EXISTENTIAL_DEPOSIT - VALUE_PER_GAS; + assert!(GAS_VALUE_AMOUNT < CurrencyOf::::minimum_balance()); + + const GAS_AMOUNT: u64 = (GAS_VALUE_AMOUNT / VALUE_PER_GAS) as u64; + assert_eq!(GasConverter::gas_price(GAS_AMOUNT), GAS_VALUE_AMOUNT); + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(BLOCK_AUTHOR), + Zero::zero(), + false, + )); + + assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + + assert_eq!(GearBank::unused_value(), GAS_VALUE_AMOUNT); + assert_balance(&BANK_ADDRESS, EXISTENTIAL_DEPOSIT + GAS_VALUE_AMOUNT); + + assert_bank_balance(0, 0); + + assert_balance(&BLOCK_AUTHOR, 0); + + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn spend_gas_zero() { + new_test_ext().execute_with(|| { + let h = frame_support::storage_root(frame_support::StateVersion::V1); + + assert_ok!(GearBank::spend_gas::(&ALICE, 0)); + + assert_ok!(GearBank::spend_gas::(&Zero::zero(), 0)); + + // No-op operation assertion. + assert_eq!( + h, + frame_support::storage_root(frame_support::StateVersion::V1), + "storage has been mutated" + ); + }) +} + +#[test] +fn spend_gas_insufficient_bank_balance() { + // Unreachable case for Gear protocol. + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(BANK_ADDRESS), + Zero::zero(), + false, + )); + + assert_balance(&BANK_ADDRESS, 0); + + assert_noop!( + GearBank::spend_gas::(&ALICE, GAS_AMOUNT), + Error::::InsufficientBankBalance + ); + }) +} + +#[test] +fn spend_gas_insufficient_gas_balance() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_noop!( + GearBank::spend_gas::(&ALICE, GAS_AMOUNT + 1), + Error::::InsufficientGasBalance + ); + + assert_ok!(GearBank::deposit_gas::(&BOB, GAS_AMOUNT)); + + assert_noop!( + GearBank::spend_gas::(&ALICE, GAS_AMOUNT + 1), + Error::::InsufficientGasBalance + ); + }) +} + +#[test] +fn spend_gas_insufficient_inexistent_gas_balance() { + new_test_ext().execute_with(|| { + assert_noop!( + GearBank::spend_gas::(&ALICE, 1), + Error::::InsufficientGasBalance + ); + + assert_noop!( + GearBank::spend_gas::(&Zero::zero(), 1), + Error::::InsufficientGasBalance + ); + + const GAS_AMOUNT: u64 = 123_456; + assert_ok!(GearBank::deposit_gas::(&BOB, GAS_AMOUNT)); + + assert_noop!( + GearBank::spend_gas::(&ALICE, 1), + Error::::InsufficientGasBalance + ); + + assert_noop!( + GearBank::spend_gas::(&Zero::zero(), 1), + Error::::InsufficientGasBalance + ); + }) +} + +#[test] +fn deposit_value_different_users() { + new_test_ext().execute_with(|| { + const ALICE_VALUE: Balance = 1_234_567_000; + assert_ok!(GearBank::deposit_value(&ALICE, ALICE_VALUE)); + + assert_bank_balance(0, ALICE_VALUE); + + assert_alice_dec(ALICE_VALUE); + assert_gas_value(&ALICE, 0, ALICE_VALUE); + + const BOB_VALUE: Balance = 56_789_000; + assert_ok!(GearBank::deposit_value(&BOB, BOB_VALUE)); + + assert_bank_balance(0, ALICE_VALUE + BOB_VALUE); + + assert_alice_dec(ALICE_VALUE); + assert_gas_value(&ALICE, 0, ALICE_VALUE); + + assert_bob_dec(BOB_VALUE); + assert_gas_value(&BOB, 0, BOB_VALUE); + }) +} + +#[test] +fn deposit_value_single_user() { + new_test_ext().execute_with(|| { + const VALUE_1: Balance = 123_456_000; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE_1)); + + assert_bank_balance(0, VALUE_1); + + assert_alice_dec(VALUE_1); + assert_gas_value(&ALICE, 0, VALUE_1); + + const VALUE_2: Balance = 67_890_000; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE_2)); + + assert_bank_balance(0, VALUE_1 + VALUE_2); + + assert_alice_dec(VALUE_1 + VALUE_2); + assert_gas_value(&ALICE, 0, VALUE_1 + VALUE_2); + }) +} + +#[test] +fn deposit_value_user_account_deleted() { + new_test_ext().execute_with(|| { + const ALICE_TO_DUST_BALANCE: Balance = EXISTENTIAL_DEPOSIT - 1; + + const VALUE: Balance = ALICE_BALANCE - ALICE_TO_DUST_BALANCE; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_bank_balance(0, VALUE); + + assert_balance(&ALICE, 0); + assert_gas_value(&ALICE, 0, VALUE); + }) +} + +#[test] +fn deposit_value_zero() { + new_test_ext().execute_with(|| { + let h = frame_support::storage_root(frame_support::StateVersion::V1); + + assert_ok!(GearBank::deposit_value(&ALICE, 0)); + + assert_ok!(GearBank::deposit_value(&Zero::zero(), 0)); + + // No-op operation assertion. + assert_eq!( + h, + frame_support::storage_root(frame_support::StateVersion::V1), + "storage has been mutated" + ); + }) +} + +#[test] +fn deposit_value_insufficient_balance() { + new_test_ext().execute_with(|| { + const VALUE: Balance = Balance::MAX; + + assert!(VALUE > Balances::free_balance(ALICE)); + + assert_noop!( + GearBank::deposit_value(&ALICE, VALUE), + Error::::InsufficientBalance + ); + }) +} + +#[test] +fn deposit_value_insufficient_deposit() { + // Unreachable case for Gear protocol. + new_test_ext().execute_with(|| { + const VALUE: Balance = EXISTENTIAL_DEPOSIT - 1; + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(BANK_ADDRESS), + Zero::zero(), + false, + )); + + assert_noop!( + GearBank::deposit_value(&ALICE, VALUE), + Error::::InsufficientDeposit + ); + }) +} + +#[test] +fn withdraw_value_different_users() { + new_test_ext().execute_with(|| { + const ALICE_VALUE: Balance = 1_234_567_000; + assert_ok!(GearBank::deposit_value(&ALICE, ALICE_VALUE)); + + const BOB_VALUE: Balance = 56_789_000; + assert_ok!(GearBank::deposit_value(&BOB, BOB_VALUE)); + + const ALICE_WITHDRAW: Balance = ALICE_VALUE - 123_456_000; + assert_ok!(GearBank::withdraw_value(&ALICE, ALICE_WITHDRAW)); + + assert_bank_balance(0, ALICE_VALUE - ALICE_WITHDRAW + BOB_VALUE); + + assert_alice_dec(ALICE_VALUE - ALICE_WITHDRAW); + assert_gas_value(&ALICE, 0, ALICE_VALUE - ALICE_WITHDRAW); + + assert_bob_dec(BOB_VALUE); + assert_gas_value(&BOB, 0, BOB_VALUE); + + const BOB_WITHDRAW: Balance = BOB_VALUE - 1_234_000; + assert_ok!(GearBank::withdraw_value(&BOB, BOB_WITHDRAW)); + + assert_bank_balance(0, ALICE_VALUE - ALICE_WITHDRAW + BOB_VALUE - BOB_WITHDRAW); + + assert_alice_dec(ALICE_VALUE - ALICE_WITHDRAW); + assert_gas_value(&ALICE, 0, ALICE_VALUE - ALICE_WITHDRAW); + + assert_bob_dec(BOB_VALUE - BOB_WITHDRAW); + assert_gas_value(&BOB, 0, BOB_VALUE - BOB_WITHDRAW); + }) +} + +#[test] +fn withdraw_value_single_user() { + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + const WITHDRAW_1: Balance = VALUE - 23_456_000; + assert_ok!(GearBank::withdraw_value(&ALICE, WITHDRAW_1)); + + assert_bank_balance(0, VALUE - WITHDRAW_1); + + assert_alice_dec(VALUE - WITHDRAW_1); + assert_gas_value(&ALICE, 0, VALUE - WITHDRAW_1); + + const WITHDRAW_2: Balance = VALUE - WITHDRAW_1 - 10_000_000; + assert_ok!(GearBank::withdraw_value(&ALICE, WITHDRAW_2)); + + assert_bank_balance(0, VALUE - WITHDRAW_1 - WITHDRAW_2); + + assert_alice_dec(VALUE - WITHDRAW_1 - WITHDRAW_2); + assert_gas_value(&ALICE, 0, VALUE - WITHDRAW_1 - WITHDRAW_2); + }) +} + +#[test] +fn withdraw_value_all_balance() { + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(GearBank::withdraw_value(&ALICE, VALUE)); + + assert_bank_balance(0, 0); + + assert_alice_dec(0); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn withdraw_value_all_balance_user_account_deleted() { + new_test_ext().execute_with(|| { + const ALICE_TO_DUST_BALANCE: Balance = EXISTENTIAL_DEPOSIT - 1; + + const VALUE: Balance = ALICE_BALANCE - ALICE_TO_DUST_BALANCE; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + assert_ok!(GearBank::withdraw_value(&ALICE, VALUE)); + + assert_bank_balance(0, 0); + + assert_alice_dec(ALICE_TO_DUST_BALANCE); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn withdraw_value_small_amount() { + new_test_ext().execute_with(|| { + const VALUE: u128 = EXISTENTIAL_DEPOSIT - 1; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(GearBank::withdraw_value(&ALICE, VALUE)); + + assert_bank_balance(0, 0); + + assert_alice_dec(0); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn withdraw_value_small_amount_user_account_deleted() { + new_test_ext().execute_with(|| { + const VALUE: Balance = EXISTENTIAL_DEPOSIT - 1; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(ALICE), + Zero::zero(), + false, + )); + + assert_ok!(GearBank::withdraw_value(&ALICE, VALUE)); + + assert_eq!(GearBank::unused_value(), VALUE); + assert_balance(&BANK_ADDRESS, EXISTENTIAL_DEPOSIT + VALUE); + + assert_bank_balance(0, 0); + + assert_balance(&ALICE, 0); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn withdraw_value_zero() { + new_test_ext().execute_with(|| { + let h = frame_support::storage_root(frame_support::StateVersion::V1); + + assert_ok!(GearBank::withdraw_value(&ALICE, 0)); + + assert_ok!(GearBank::withdraw_value(&Zero::zero(), 0)); + + // No-op operation assertion. + assert_eq!( + h, + frame_support::storage_root(frame_support::StateVersion::V1), + "storage has been mutated" + ); + }) +} + +#[test] +fn withdraw_value_insufficient_bank_balance() { + // Unreachable case for Gear protocol. + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(BANK_ADDRESS), + Zero::zero(), + false, + )); + + assert_noop!( + GearBank::withdraw_value(&ALICE, VALUE), + Error::::InsufficientBankBalance + ); + }) +} + +#[test] +fn withdraw_value_insufficient_value_balance() { + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_noop!( + GearBank::withdraw_value(&ALICE, VALUE + 1), + Error::::InsufficientValueBalance + ); + + assert_ok!(GearBank::deposit_value(&BOB, VALUE)); + + assert_noop!( + GearBank::withdraw_value(&ALICE, VALUE + 1), + Error::::InsufficientValueBalance + ); + }) +} + +#[test] +fn withdraw_value_insufficient_inexistent_value_balance() { + new_test_ext().execute_with(|| { + assert_noop!( + GearBank::withdraw_value(&ALICE, 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::withdraw_value(&Zero::zero(), 1), + Error::::InsufficientValueBalance + ); + + const VALUE: Balance = 123_456_000; + + assert_ok!(GearBank::deposit_value(&BOB, VALUE)); + + assert_noop!( + GearBank::withdraw_value(&ALICE, 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::withdraw_value(&Zero::zero(), 1), + Error::::InsufficientValueBalance + ); + }) +} + +#[test] +fn transfer_value_different_users() { + new_test_ext().execute_with(|| { + const ALICE_VALUE: Balance = 1_234_567_000; + assert_ok!(GearBank::deposit_value(&ALICE, ALICE_VALUE)); + + const BOB_VALUE: Balance = 56_789_000; + assert_ok!(GearBank::deposit_value(&BOB, BOB_VALUE)); + + const ALICE_TRANSFER: Balance = ALICE_VALUE - 123_456_000; + assert_ok!(GearBank::transfer_value(&ALICE, &CHARLIE, ALICE_TRANSFER)); + + assert_bank_balance(0, ALICE_VALUE - ALICE_TRANSFER + BOB_VALUE); + + assert_charlie_inc(ALICE_TRANSFER); + + assert_alice_dec(ALICE_VALUE); + assert_gas_value(&ALICE, 0, ALICE_VALUE - ALICE_TRANSFER); + + assert_bob_dec(BOB_VALUE); + assert_gas_value(&BOB, 0, BOB_VALUE); + + const BOB_TRANSFER: Balance = BOB_VALUE - 1_234_000; + assert_ok!(GearBank::transfer_value(&BOB, &CHARLIE, BOB_TRANSFER)); + + assert_bank_balance(0, ALICE_VALUE - ALICE_TRANSFER + BOB_VALUE - BOB_TRANSFER); + + assert_charlie_inc(ALICE_TRANSFER + BOB_TRANSFER); + + assert_alice_dec(ALICE_VALUE); + assert_gas_value(&ALICE, 0, ALICE_VALUE - ALICE_TRANSFER); + + assert_bob_dec(BOB_VALUE); + assert_gas_value(&BOB, 0, BOB_VALUE - BOB_TRANSFER); + }) +} + +#[test] +fn transfer_value_single_user() { + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + const TRANSFER_1: Balance = VALUE - 23_456_000; + assert_ok!(GearBank::transfer_value(&ALICE, &CHARLIE, TRANSFER_1)); + + assert_bank_balance(0, VALUE - TRANSFER_1); + + assert_charlie_inc(TRANSFER_1); + + assert_alice_dec(VALUE); + assert_gas_value(&ALICE, 0, VALUE - TRANSFER_1); + + const TRANSFER_2: Balance = VALUE - TRANSFER_1 - 10_000_000; + assert_ok!(GearBank::transfer_value(&ALICE, &EVE, TRANSFER_2)); + + assert_bank_balance(0, VALUE - TRANSFER_1 - TRANSFER_2); + + assert_charlie_inc(TRANSFER_1); + assert_eve_inc(TRANSFER_2); + + assert_alice_dec(VALUE); + assert_gas_value(&ALICE, 0, VALUE - TRANSFER_1 - TRANSFER_2); + }) +} + +#[test] +fn transfer_value_self() { + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + const TRANSFER_1: Balance = VALUE - 23_456_000; + assert_ok!(GearBank::transfer_value(&ALICE, &ALICE, TRANSFER_1)); + + assert_bank_balance(0, VALUE - TRANSFER_1); + + assert_alice_dec(VALUE - TRANSFER_1); + assert_gas_value(&ALICE, 0, VALUE - TRANSFER_1); + + const TRANSFER_2: Balance = VALUE - TRANSFER_1 - 10_000_000; + assert_ok!(GearBank::transfer_value(&ALICE, &ALICE, TRANSFER_2)); + + assert_bank_balance(0, VALUE - TRANSFER_1 - TRANSFER_2); + + assert_alice_dec(VALUE - TRANSFER_1 - TRANSFER_2); + assert_gas_value(&ALICE, 0, VALUE - TRANSFER_1 - TRANSFER_2); + }) +} + +#[test] +fn transfer_balance_all_balance() { + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(GearBank::transfer_value(&ALICE, &CHARLIE, VALUE)); + + assert_bank_balance(0, 0); + + assert_charlie_inc(VALUE); + + assert_alice_dec(VALUE); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn transfer_value_all_balance_destination_account_deleted() { + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(CHARLIE), + Zero::zero(), + false, + )); + + assert_ok!(GearBank::transfer_value(&ALICE, &CHARLIE, VALUE)); + + assert_bank_balance(0, 0); + + assert_balance(&CHARLIE, VALUE); + + assert_alice_dec(VALUE); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn transfer_value_all_balance_self_account_deleted() { + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(ALICE), + Zero::zero(), + false, + )); + + assert_ok!(GearBank::transfer_value(&ALICE, &ALICE, VALUE)); + + assert_bank_balance(0, 0); + + assert_balance(&ALICE, VALUE); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn transfer_value_small_amount() { + new_test_ext().execute_with(|| { + const VALUE: Balance = EXISTENTIAL_DEPOSIT - 1; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(GearBank::transfer_value(&ALICE, &CHARLIE, VALUE)); + + assert_bank_balance(0, 0); + + assert_charlie_inc(VALUE); + + assert_alice_dec(VALUE); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn transfer_value_small_amount_destination_account_deleted() { + new_test_ext().execute_with(|| { + const VALUE: Balance = EXISTENTIAL_DEPOSIT - 1; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(CHARLIE), + Zero::zero(), + false, + )); + + assert_ok!(GearBank::transfer_value(&ALICE, &CHARLIE, VALUE)); + + assert_eq!(GearBank::unused_value(), VALUE); + assert_balance(&BANK_ADDRESS, EXISTENTIAL_DEPOSIT + VALUE); + + assert_bank_balance(0, 0); + + assert_balance(&CHARLIE, 0); + + assert_alice_dec(VALUE); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn transfer_value_small_amount_self_account_deleted() { + new_test_ext().execute_with(|| { + const VALUE: Balance = EXISTENTIAL_DEPOSIT - 1; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(ALICE), + Zero::zero(), + false, + )); + + assert_ok!(GearBank::transfer_value(&ALICE, &ALICE, VALUE)); + + assert_eq!(GearBank::unused_value(), VALUE); + assert_balance(&BANK_ADDRESS, EXISTENTIAL_DEPOSIT + VALUE); + + assert_bank_balance(0, 0); + + assert_balance(&ALICE, 0); + assert_gas_value(&ALICE, 0, 0); + }) +} + +#[test] +fn transfer_value_zero() { + new_test_ext().execute_with(|| { + let h = frame_support::storage_root(frame_support::StateVersion::V1); + + assert_ok!(GearBank::transfer_value(&ALICE, &ALICE, 0)); + assert_ok!(GearBank::transfer_value(&ALICE, &CHARLIE, 0)); + assert_ok!(GearBank::transfer_value(&ALICE, &Zero::zero(), 0)); + + assert_ok!(GearBank::transfer_value(&Zero::zero(), &CHARLIE, 0)); + assert_ok!(GearBank::transfer_value(&Zero::zero(), &Zero::zero(), 0)); + + // No-op operation assertion. + assert_eq!( + h, + frame_support::storage_root(frame_support::StateVersion::V1), + "storage has been mutated" + ); + }) +} + +#[test] +fn transfer_value_insufficient_bank_balance() { + // Unreachable case for Gear protocol. + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_ok!(Balances::transfer_all( + RuntimeOrigin::signed(BANK_ADDRESS), + Zero::zero(), + false, + )); + + assert_balance(&BANK_ADDRESS, 0); + + assert_noop!( + GearBank::transfer_value(&ALICE, &CHARLIE, VALUE), + Error::::InsufficientBankBalance + ); + + assert_noop!( + GearBank::transfer_value(&ALICE, &ALICE, VALUE), + Error::::InsufficientBankBalance + ); + }) +} + +#[test] +fn transfer_value_insufficient_value_balance() { + new_test_ext().execute_with(|| { + const VALUE: Balance = 123_456_000; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_noop!( + GearBank::transfer_value(&ALICE, &CHARLIE, VALUE + 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::transfer_value(&ALICE, &ALICE, VALUE + 1), + Error::::InsufficientValueBalance + ); + + assert_ok!(GearBank::deposit_value(&BOB, VALUE)); + + assert_noop!( + GearBank::transfer_value(&ALICE, &CHARLIE, VALUE + 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::transfer_value(&ALICE, &ALICE, VALUE + 1), + Error::::InsufficientValueBalance + ); + }) +} + +#[test] +fn transfer_value_insufficient_inexistent_value_balance() { + new_test_ext().execute_with(|| { + assert_noop!( + GearBank::transfer_value(&ALICE, &ALICE, 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::transfer_value(&ALICE, &CHARLIE, 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::transfer_value(&Zero::zero(), &Zero::zero(), 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::transfer_value(&Zero::zero(), &CHARLIE, 1), + Error::::InsufficientValueBalance + ); + + const VALUE: Balance = 123_456_000; + + assert_ok!(GearBank::deposit_value(&BOB, VALUE)); + + assert_noop!( + GearBank::transfer_value(&ALICE, &ALICE, 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::transfer_value(&ALICE, &CHARLIE, 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::transfer_value(&Zero::zero(), &Zero::zero(), 1), + Error::::InsufficientValueBalance + ); + + assert_noop!( + GearBank::transfer_value(&Zero::zero(), &CHARLIE, 1), + Error::::InsufficientValueBalance + ); + }) +} + +#[test] +fn empty_accounts_deleted() { + new_test_ext().execute_with(|| { + assert!(GearBank::account(ALICE).is_none()); + + const GAS_AMOUNT: u64 = 123_456; + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert!(GearBank::account(ALICE).is_some()); + + assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + assert!(GearBank::account(ALICE).is_none()); + + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert!(GearBank::account(ALICE).is_some()); + + assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + assert!(GearBank::account(ALICE).is_none()); + + const VALUE: Balance = 123_456_000; + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + assert!(GearBank::account(ALICE).is_some()); + + assert_ok!(GearBank::withdraw_value(&ALICE, VALUE)); + assert!(GearBank::account(ALICE).is_none()); + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + assert!(GearBank::account(ALICE).is_some()); + + assert_ok!(GearBank::transfer_value(&ALICE, &CHARLIE, VALUE)); + assert!(GearBank::account(ALICE).is_none()); + + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + assert!(GearBank::account(ALICE).is_some()); + + assert_ok!(GearBank::transfer_value(&ALICE, &ALICE, VALUE)); + assert!(GearBank::account(ALICE).is_none()); + }) +} + +#[test] +fn empty_zero_accounts_deleted() { + new_test_ext().execute_with(|| { + assert!(GearBank::account(::zero()).is_none()); + + assert_ok!(GearBank::deposit_gas::(&Zero::zero(), 0)); + assert!(GearBank::account(::zero()).is_none()); + + assert_ok!(GearBank::withdraw_gas::(&Zero::zero(), 0)); + assert!(GearBank::account(::zero()).is_none()); + + assert_ok!(GearBank::spend_gas::(&Zero::zero(), 0)); + assert!(GearBank::account(::zero()).is_none()); + + assert_ok!(GearBank::deposit_value(&Zero::zero(), 0)); + assert!(GearBank::account(::zero()).is_none()); + + assert_ok!(GearBank::withdraw_value(&Zero::zero(), 0)); + assert!(GearBank::account(::zero()).is_none()); + + assert_ok!(GearBank::transfer_value(&Zero::zero(), &ALICE, 0)); + assert!(GearBank::account(::zero()).is_none()); + + assert_ok!(GearBank::transfer_value(&Zero::zero(), &Zero::zero(), 0)); + assert!(GearBank::account(::zero()).is_none()); + }) +} + +#[test] +fn empty_composite_accounts_deleted() { + new_test_ext().execute_with(|| { + const GAS_AMOUNT: u64 = 123_456; + assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + + assert_bank_balance(GAS_AMOUNT, 0); + + assert!(GearBank::account(ALICE).is_some()); + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_gas_value(&ALICE, GAS_AMOUNT, 0); + + const VALUE: Balance = 234_567_000; + assert_ok!(GearBank::deposit_value(&ALICE, VALUE)); + + assert_bank_balance(GAS_AMOUNT, VALUE); + + assert!(GearBank::account(ALICE).is_some()); + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT) + VALUE); + assert_gas_value(&ALICE, GAS_AMOUNT, VALUE); + + const GAS_BURN: u64 = GAS_AMOUNT / 2; + + assert_ok!(GearBank::spend_gas::(&ALICE, GAS_BURN)); + + assert_bank_balance(GAS_AMOUNT - GAS_BURN, VALUE); + + assert!(GearBank::account(ALICE).is_some()); + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT) + VALUE); + assert_gas_value(&ALICE, GAS_AMOUNT - GAS_BURN, VALUE); + + assert_ok!(GearBank::withdraw_value(&ALICE, VALUE)); + + assert_bank_balance(GAS_AMOUNT - GAS_BURN, 0); + + assert!(GearBank::account(ALICE).is_some()); + assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_gas_value(&ALICE, GAS_AMOUNT - GAS_BURN, 0); + + assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT - GAS_BURN)); + + assert_bank_balance(0, 0); + + assert!(GearBank::account(ALICE).is_none()); + assert_alice_dec(GasConverter::gas_price(GAS_BURN)); + assert_gas_value(&ALICE, 0, 0); + }) +} + +mod utils { + use super::*; + + pub const VALUE_PER_GAS: u128 = 1_000; + + pub struct GasConverter; + impl common::GasPrice for GasConverter { + type Balance = Balance; + type GasToBalanceMultiplier = ConstU128; + } + + pub type GC = GasConverter; + + // For some reason `assert_noop!` doesnt work for the pallet fns. + impl PartialEq for Error { + fn eq(&self, other: &Self) -> bool { + match self { + Self::InsufficientBalance => matches!(other, Self::InsufficientBalance), + Self::InsufficientBankBalance => matches!(other, Self::InsufficientBankBalance), + Self::InsufficientGasBalance => matches!(other, Self::InsufficientGasBalance), + Self::InsufficientValueBalance => matches!(other, Self::InsufficientValueBalance), + Self::InsufficientDeposit => matches!(other, Self::InsufficientDeposit), + _ => unimplemented!(), + } + } + } + + #[test] + fn __existential_deposit() { + new_test_ext().execute_with(|| { + assert_eq!(EXISTENTIAL_DEPOSIT, CurrencyOf::::minimum_balance()); + }) + } + + #[track_caller] + pub fn assert_balance(account_id: &AccountId, value: Balance) { + assert_eq!(Balances::total_balance(account_id), value); + assert!(Balances::reserved_balance(account_id).is_zero()); + } + + #[track_caller] + pub fn assert_bank_balance(gas: u64, value: Balance) { + let gas_value = GasConverter::gas_price(gas); + assert_balance( + &BANK_ADDRESS, + CurrencyOf::::minimum_balance() + GearBank::unused_value() + gas_value + value, + ); + } + + #[track_caller] + pub fn assert_gas_value(account_id: &AccountId, expected_gas: u64, expected_value: Balance) { + let BankAccount { gas, value } = GearBank::account(account_id).unwrap_or_default(); + + assert_eq!(gas, GasConverter::gas_price(expected_gas)); + assert_eq!(value, expected_value); + } + + // Asserts Alice balance decrease. + #[track_caller] + pub fn assert_alice_dec(diff: Balance) { + assert_balance(&ALICE, ALICE_BALANCE - diff) + } + + // Asserts Bob balance decrease. + #[track_caller] + pub fn assert_bob_dec(diff: Balance) { + assert_balance(&BOB, BOB_BALANCE - diff) + } + + // Asserts block author balance inc. + #[track_caller] + pub fn assert_block_author_inc(diff: Balance) { + assert_balance(&BLOCK_AUTHOR, EXISTENTIAL_DEPOSIT + diff) + } + + // Asserts Charlie balance inc. + #[track_caller] + pub fn assert_charlie_inc(diff: Balance) { + assert_balance(&CHARLIE, EXISTENTIAL_DEPOSIT + diff) + } + + // Asserts Eve balance inc. + #[track_caller] + pub fn assert_eve_inc(diff: Balance) { + assert_balance(&EVE, EXISTENTIAL_DEPOSIT + diff) + } +} diff --git a/pallets/gear-debug/Cargo.toml b/pallets/gear-debug/Cargo.toml index 65c7e9d0ec1..42403487e00 100644 --- a/pallets/gear-debug/Cargo.toml +++ b/pallets/gear-debug/Cargo.toml @@ -42,6 +42,7 @@ gear-backend-sandbox.workspace = true hex-literal.workspace = true frame-support-test = { workspace = true, features = ["std"] } pallet-timestamp = { workspace = true, features = ["std"] } +pallet-gear-bank = { workspace = true, features = ["std"] } pallet-gear-gas = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } pallet-gear-scheduler = { workspace = true, features = ["std"] } diff --git a/pallets/gear-debug/src/mock.rs b/pallets/gear-debug/src/mock.rs index b6d3703c601..14b7fb1f58f 100644 --- a/pallets/gear-debug/src/mock.rs +++ b/pallets/gear-debug/src/mock.rs @@ -141,12 +141,17 @@ parameter_types! { pub RentCostPerBlock: Balance = 11; pub ResumeMinimalPeriod: BlockNumber = 100; pub ResumeSessionDuration: BlockNumber = 1_000; + pub const BankAddress: AccountId = 15082001; +} + +impl pallet_gear_bank::Config for Test { + type Currency = Balances; + type BankAddress = BankAddress; } impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type Currency = Balances; type GasPrice = GasConverter; type WeightInfo = (); type OutgoingLimit = OutgoingLimit; @@ -201,6 +206,7 @@ construct_runtime!( GearProgram: pallet_gear_program, GearMessenger: pallet_gear_messenger, GearScheduler: pallet_gear_scheduler, + GearBank: pallet_gear_bank, Gear: pallet_gear, GearGas: pallet_gear_gas, } @@ -217,6 +223,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { (1, 100_000_000_000_000_u128), (2, 2_000_u128), (BLOCK_AUTHOR, 1_000_u128), + (BankAddress::get(), ExistentialDeposit::get()), ], } .assimilate_storage(&mut t) diff --git a/pallets/gear-messenger/src/lib.rs b/pallets/gear-messenger/src/lib.rs index 762ed75d8f7..302926e8514 100644 --- a/pallets/gear-messenger/src/lib.rs +++ b/pallets/gear-messenger/src/lib.rs @@ -309,7 +309,7 @@ pub mod pallet { // Private storage for queue's elements. #[pallet::storage] - pub(crate) type Dispatches = + pub type Dispatches = CountedStorageMap<_, Identity, MessageId, LinkedNode>; // Public wrap of the queue's elements. @@ -334,7 +334,7 @@ pub mod pallet { // Private storage for mailbox elements. #[pallet::storage] - pub(crate) type Mailbox = StorageDoubleMap< + pub type Mailbox = StorageDoubleMap< _, Identity, T::AccountId, @@ -388,7 +388,7 @@ pub mod pallet { // Private storage for waitlist elements. #[pallet::storage] - pub(crate) type Waitlist = StorageDoubleMap< + pub type Waitlist = StorageDoubleMap< _, Identity, ProgramId, @@ -411,7 +411,7 @@ pub mod pallet { // Private storage for dispatch stash elements. #[pallet::storage] - pub(crate) type DispatchStash = + pub type DispatchStash = StorageMap<_, Identity, MessageId, (StoredDispatch, Interval)>; // Public wrap of the dispatch stash elements. diff --git a/pallets/gear-scheduler/Cargo.toml b/pallets/gear-scheduler/Cargo.toml index 51b8b3a06cb..58b1be5353f 100644 --- a/pallets/gear-scheduler/Cargo.toml +++ b/pallets/gear-scheduler/Cargo.toml @@ -32,6 +32,7 @@ sp-io.workspace = true [dev-dependencies] core-processor.workspace = true +pallet-gear-bank = { workspace = true, features = ["std"] } pallet-gear = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } pallet-gear-program = { workspace = true, features = ["std"] } diff --git a/pallets/gear-scheduler/src/mock.rs b/pallets/gear-scheduler/src/mock.rs index a5372349d42..2e9a6747993 100644 --- a/pallets/gear-scheduler/src/mock.rs +++ b/pallets/gear-scheduler/src/mock.rs @@ -55,15 +55,16 @@ construct_runtime!( NodeBlock = Block, UncheckedExtrinsic = UncheckedExtrinsic, { - System: system::{Pallet, Call, Config, Storage, Event}, - GearProgram: pallet_gear_program::{Pallet, Storage}, - GearMessenger: pallet_gear_messenger::{Pallet}, - GearScheduler: pallet_gear_scheduler::{Pallet}, - Gear: pallet_gear::{Pallet, Call, Storage, Event}, - GearGas: pallet_gear_gas::{Pallet}, - Balances: pallet_balances::{Pallet, Call, Storage, Config, Event}, - Authorship: pallet_authorship::{Pallet, Storage}, - Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent}, + System: system, + Timestamp: pallet_timestamp, + Authorship: pallet_authorship, + Balances: pallet_balances, + GearProgram: pallet_gear_program, + GearMessenger: pallet_gear_messenger, + GearScheduler: pallet_gear_scheduler, + GearBank: pallet_gear_bank, + Gear: pallet_gear, + GearGas: pallet_gear_gas, } ); @@ -131,12 +132,17 @@ parameter_types! { pub RentCostPerBlock: Balance = 11; pub ResumeMinimalPeriod: BlockNumber = 100; pub ResumeSessionDuration: BlockNumber = 1_000; + pub const BankAddress: AccountId = 15082001; +} + +impl pallet_gear_bank::Config for Test { + type Currency = Balances; + type BankAddress = BankAddress; } impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type Currency = Balances; type GasPrice = GasConverter; type WeightInfo = (); type Schedule = GearSchedule; @@ -217,6 +223,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { (USER_3, 500_000_000_000_000_u128), (LOW_BALANCE_USER, 1_000_000_u128), (BLOCK_AUTHOR, 500_000_u128), + (BankAddress::get(), ExistentialDeposit::get()), ], } .assimilate_storage(&mut t) diff --git a/pallets/gear-scheduler/src/tests.rs b/pallets/gear-scheduler/src/tests.rs index f7941a98311..e592d00c163 100644 --- a/pallets/gear-scheduler/src/tests.rs +++ b/pallets/gear-scheduler/src/tests.rs @@ -22,7 +22,6 @@ extern crate alloc; use crate::{mock::*, *}; use common::{scheduler::*, storage::*, GasPrice as _, GasTree, LockId, LockableTree as _, Origin}; -use frame_support::traits::ReservableCurrency; use gear_core::{ids::*, message::*}; use gear_core_errors::ErrorReplyReason; use pallet_gear::{GasAllowanceOf, GasHandlerOf}; @@ -71,7 +70,8 @@ fn populate_wl_from( TaskPoolOf::::add(bn, ScheduledTask::RemoveFromWaitlist(pid, mid)) .expect("Failed to insert task"); WaitlistOf::::insert(dispatch, bn).expect("Failed to insert to waitlist"); - Balances::reserve(&src, GasPrice::gas_price(DEFAULT_GAS)).expect("Cannot reserve gas"); + GearBank::deposit_gas::<::GasPrice>(&src, DEFAULT_GAS) + .expect("Cannot reserve gas"); GasHandlerOf::::create(src, mid, DEFAULT_GAS).expect("Failed to create gas handler"); // Locking funds for holding. GasHandlerOf::::lock( @@ -151,11 +151,11 @@ fn gear_handles_tasks() { // Block producer initial balance. let block_author_balance = Balances::free_balance(BLOCK_AUTHOR); - assert_eq!(Balances::reserved_balance(BLOCK_AUTHOR), 0); + assert_eq!(GearBank::account_total(&BLOCK_AUTHOR), 0); // USER_1 initial balance. let user1_balance = Balances::free_balance(USER_1); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::account_total(&USER_1), 0); // Appending task and message to wl. let bn = 5; @@ -170,7 +170,7 @@ fn gear_handles_tasks() { user1_balance - GasPrice::gas_price(DEFAULT_GAS) ); assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::account_total(&USER_1), GasPrice::gas_price(DEFAULT_GAS) ); @@ -193,7 +193,7 @@ fn gear_handles_tasks() { user1_balance - GasPrice::gas_price(DEFAULT_GAS) ); assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::account_total(&USER_1), GasPrice::gas_price(DEFAULT_GAS) ); @@ -216,7 +216,7 @@ fn gear_handles_tasks() { block_author_balance + cost ); assert_eq!(Balances::free_balance(USER_1), user1_balance - cost); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::account_total(&USER_1), 0); }); } @@ -239,15 +239,15 @@ fn gear_handles_outdated_tasks() { // Block producer initial balance. let block_author_balance = Balances::free_balance(BLOCK_AUTHOR); - assert_eq!(Balances::reserved_balance(BLOCK_AUTHOR), 0); + assert_eq!(GearBank::account_total(&BLOCK_AUTHOR), 0); // USER_1 initial balance. let user1_balance = Balances::free_balance(USER_1); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::account_total(&USER_1), 0); // USER_2 initial balance. let user2_balance = Balances::free_balance(USER_2); - assert_eq!(Balances::reserved_balance(USER_2), 0); + assert_eq!(GearBank::account_total(&USER_2), 0); // Appending twice task and message to wl. let bn = 5; @@ -265,7 +265,7 @@ fn gear_handles_outdated_tasks() { user1_balance - GasPrice::gas_price(DEFAULT_GAS) ); assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::account_total(&USER_1), GasPrice::gas_price(DEFAULT_GAS) ); assert_eq!( @@ -273,7 +273,7 @@ fn gear_handles_outdated_tasks() { user2_balance - GasPrice::gas_price(DEFAULT_GAS) ); assert_eq!( - Balances::reserved_balance(USER_2), + GearBank::account_total(&USER_2), GasPrice::gas_price(DEFAULT_GAS) ); @@ -297,7 +297,7 @@ fn gear_handles_outdated_tasks() { user1_balance - GasPrice::gas_price(DEFAULT_GAS) ); assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::account_total(&USER_1), GasPrice::gas_price(DEFAULT_GAS) ); assert_eq!( @@ -305,7 +305,7 @@ fn gear_handles_outdated_tasks() { user2_balance - GasPrice::gas_price(DEFAULT_GAS) ); assert_eq!( - Balances::reserved_balance(USER_2), + GearBank::account_total(&USER_2), GasPrice::gas_price(DEFAULT_GAS) ); @@ -323,13 +323,13 @@ fn gear_handles_outdated_tasks() { assert!(!out_of_rent_reply_exists(USER_1, mid1, pid1)); assert!(out_of_rent_reply_exists(USER_2, mid2, pid2)); assert_eq!(Balances::free_balance(USER_2), user2_balance - cost1); - assert_eq!(Balances::reserved_balance(USER_2), 0); + assert_eq!(GearBank::account_total(&USER_2), 0); } else { assert!(task_and_wl_message_exist(mid2, pid2, bn)); assert!(out_of_rent_reply_exists(USER_1, mid1, pid1)); assert!(!out_of_rent_reply_exists(USER_2, mid2, pid2)); assert_eq!(Balances::free_balance(USER_1), user1_balance - cost1); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::account_total(&USER_1), 0); } assert_eq!( @@ -361,7 +361,7 @@ fn gear_handles_outdated_tasks() { Balances::free_balance(USER_1) + Balances::free_balance(USER_2), user1_balance + user2_balance - cost1 - cost2 ); - assert_eq!(Balances::reserved_balance(USER_1), 0); - assert_eq!(Balances::reserved_balance(USER_2), 0); + assert_eq!(GearBank::account_total(&USER_1), 0); + assert_eq!(GearBank::account_total(&USER_2), 0); }); } diff --git a/pallets/gear-voucher/src/benchmarking.rs b/pallets/gear-voucher/src/benchmarking.rs index cc5cb18c26c..38aac81bf34 100644 --- a/pallets/gear-voucher/src/benchmarking.rs +++ b/pallets/gear-voucher/src/benchmarking.rs @@ -27,6 +27,8 @@ use frame_support::traits::Currency; use frame_system::RawOrigin; use sp_runtime::traits::UniqueSaturatedInto; +pub(crate) type CurrencyOf = ::Currency; + benchmarks! { where_clause { where T::AccountId: Origin, @@ -34,7 +36,7 @@ benchmarks! { issue { let issuer = benchmarking::account::("caller", 0, 0); - ::Currency::deposit_creating( + CurrencyOf::::deposit_creating( &issuer, 100_000_000_000_000_u128.unique_saturated_into() ); diff --git a/pallets/gear-voucher/src/lib.rs b/pallets/gear-voucher/src/lib.rs index 01e4d80954e..d9858db437e 100644 --- a/pallets/gear-voucher/src/lib.rs +++ b/pallets/gear-voucher/src/lib.rs @@ -75,7 +75,6 @@ pub use pallet::*; pub(crate) type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; -pub(crate) type CurrencyOf = ::Currency; type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; /// The current storage version. @@ -188,16 +187,8 @@ impl PaymentVoucher> for Pallet type VoucherId = T::AccountId; type Error = DispatchError; - fn redeem_with_id( - who: T::AccountId, - program: ProgramId, - amount: BalanceOf, - ) -> Result { - let voucher_id = Self::voucher_account_id(&who, &program); - CurrencyOf::::reserve(&voucher_id, amount).map_err(|e| { - log::debug!("Failed to reserve funds from the voucher account: {:?}", e); - Error::::FailureToRedeemVoucher - })?; - Ok(voucher_id) + #[inline] + fn voucher_id(who: T::AccountId, program: ProgramId) -> Self::VoucherId { + Self::voucher_account_id(&who, &program) } } diff --git a/pallets/gear-voucher/src/tests.rs b/pallets/gear-voucher/src/tests.rs index a44d2b5588e..a46cfe97ac4 100644 --- a/pallets/gear-voucher/src/tests.rs +++ b/pallets/gear-voucher/src/tests.rs @@ -68,12 +68,15 @@ fn voucher_redemption_works() { assert_eq!(Balances::free_balance(synthesized), 5_000); // Redemption ok - assert_ok!(Voucher::redeem_with_id(BOB, program_id, 2_000,)); + assert_ok!(Balances::reserve( + &Voucher::voucher_id(BOB, program_id), + 2_000 + )); // Redemption fails assert_noop!( - Voucher::redeem_with_id(BOB, program_id, 100_000_000), - Error::::FailureToRedeemVoucher + Balances::reserve(&Voucher::voucher_id(BOB, program_id), 100_000_000), + pallet_balances::Error::::InsufficientBalance ); }); } diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index aaa9e5c9053..d95d742196f 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -35,6 +35,7 @@ gear-backend-wasmi = { workspace = true, optional = true } pallet-gear-proc-macro = { version = "2.0.0", path = "proc-macro" } gsys = { workspace = true, optional = true } pallet-gear-voucher.workspace = true +pallet-gear-bank.workspace = true # Substrate deps frame-support.workspace = true @@ -145,6 +146,7 @@ std = [ "pallet-gear-scheduler/std", "pallet-gear-program/std", "pallet-gear-voucher/std", + "pallet-gear-bank/std", "pallet-gear-proc-macro/full", "primitive-types/std", "serde/std", diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 3e48b7ef458..1f34ababd94 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -57,9 +57,9 @@ use crate::{ manager::ExtManager, pallet, schedule::{API_BENCHMARK_BATCH_SIZE, INSTR_BENCHMARK_BATCH_SIZE}, - BalanceOf, BenchmarkStorage, Call, Config, Event, ExecutionEnvironment, Ext as Externalities, - GasHandlerOf, MailboxOf, Pallet as Gear, Pallet, ProgramStorageOf, QueueOf, RentFreePeriodOf, - ResumeMinimalPeriodOf, Schedule, + BalanceOf, BenchmarkStorage, Call, Config, CurrencyOf, Event, ExecutionEnvironment, + Ext as Externalities, GasHandlerOf, GearBank, MailboxOf, Pallet as Gear, Pallet, + ProgramStorageOf, QueueOf, RentFreePeriodOf, ResumeMinimalPeriodOf, Schedule, }; use ::alloc::{ collections::{BTreeMap, BTreeSet}, @@ -69,7 +69,7 @@ use common::{ self, benchmarking, paused_program_storage::SessionId, storage::{Counter, *}, - ActiveProgram, CodeMetadata, CodeStorage, GasPrice, GasTree, Origin, PausedProgramStorage, + ActiveProgram, CodeMetadata, CodeStorage, GasTree, Origin, PausedProgramStorage, ProgramStorage, ReservableTree, }; use core_processor::{ @@ -80,7 +80,7 @@ use core_processor::{ use frame_benchmarking::{benchmarks, whitelisted_caller}; use frame_support::{ codec::Encode, - traits::{Currency, Get, Hooks, ReservableCurrency}, + traits::{Currency, Get, Hooks}, }; use frame_system::{Pallet as SystemPallet, RawOrigin}; use gear_backend_common::Environment; @@ -317,8 +317,8 @@ where module: WasmModule, data: Vec, ) -> Result, &'static str> { - let value = ::Currency::minimum_balance(); - ::Currency::make_free_balance_be(&caller, caller_funding::()); + let value = CurrencyOf::::minimum_balance(); + CurrencyOf::::make_free_balance_be(&caller, caller_funding::()); let salt = vec![0xff]; let addr = ProgramId::generate(module.hash, &salt).into_origin(); @@ -445,16 +445,17 @@ benchmarks! { claim_value { let caller = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); + CurrencyOf::::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); let program_id = benchmarking::account::("program", 0, 100); - ::Currency::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into()); + CurrencyOf::::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into()); let code = benchmarking::generate_wasm2(16.into()).unwrap(); benchmarking::set_program::, _>(ProgramId::from_origin(program_id.clone().into_origin()), code, 1.into()); let original_message_id = MessageId::from_origin(benchmarking::account::("message", 0, 100).into_origin()); let gas_limit = 50000; let value = 10000u32.into(); GasHandlerOf::::create(program_id.clone(), original_message_id, gas_limit).expect("Failed to create gas handler"); - ::Currency::reserve(&program_id, ::GasPrice::gas_price(gas_limit) + value).expect("Failed to reserve"); + GearBank::::deposit_gas::(&program_id, gas_limit).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); + GearBank::::deposit_value(&program_id, value).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); MailboxOf::::insert(gear_core::message::StoredMessage::new( original_message_id, ProgramId::from_origin(program_id.into_origin()), @@ -475,8 +476,8 @@ benchmarks! { pay_program_rent { let caller = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); - let minimum_balance = ::Currency::minimum_balance(); + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + let minimum_balance = CurrencyOf::::minimum_balance(); let code = benchmarking::generate_wasm2(16.into()).unwrap(); let salt = vec![]; let program_id = ProgramId::generate(CodeId::generate(&code), &salt); @@ -496,7 +497,7 @@ benchmarks! { resume_session_init { let caller = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); let code = benchmarking::generate_wasm2(16.into()).unwrap(); let salt = vec![]; let program_id = ProgramId::generate(CodeId::generate(&code), &salt); @@ -521,7 +522,7 @@ benchmarks! { resume_session_push { let c in 0 .. 16 * (WASM_PAGE_SIZE / GEAR_PAGE_SIZE) as u32; let caller = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); let code = benchmarking::generate_wasm2(16.into()).unwrap(); let salt = vec![]; let program_id = ProgramId::generate(CodeId::generate(&code), &salt); @@ -557,7 +558,7 @@ benchmarks! { resume_session_commit { let c in 0 .. (MAX_PAGES - 1) * (WASM_PAGE_SIZE / GEAR_PAGE_SIZE) as u32; let caller = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, 400_000_000_000_000u128.unique_saturated_into()); + CurrencyOf::::deposit_creating(&caller, 400_000_000_000_000u128.unique_saturated_into()); let code = benchmarking::generate_wasm2(0.into()).unwrap(); let salt = vec![]; let program_id = ProgramId::generate(CodeId::generate(&code), &salt); @@ -603,9 +604,9 @@ benchmarks! { // `c`: Size of the code in kilobytes. upload_code { let c in 0 .. Perbill::from_percent(49).mul_ceil(T::Schedule::get().limits.code_len) / 1024; - let value = ::Currency::minimum_balance(); + let value = CurrencyOf::::minimum_balance(); let caller = whitelisted_caller(); - ::Currency::make_free_balance_be(&caller, caller_funding::()); + CurrencyOf::::make_free_balance_be(&caller, caller_funding::()); let WasmModule { code, hash: code_id, .. } = WasmModule::::sized(c * 1024, Location::Handle); let origin = RawOrigin::Signed(caller); @@ -629,9 +630,9 @@ benchmarks! { Gear::::upload_code(origin.into(), code).expect("submit code failed"); let salt = vec![42u8; s as usize]; - let value = ::Currency::minimum_balance(); + let value = CurrencyOf::::minimum_balance(); let caller = whitelisted_caller(); - ::Currency::make_free_balance_be(&caller, caller_funding::()); + CurrencyOf::::make_free_balance_be(&caller, caller_funding::()); let origin = RawOrigin::Signed(caller); init_block::(None); @@ -656,9 +657,9 @@ benchmarks! { let c in 0 .. Perbill::from_percent(49).mul_ceil(T::Schedule::get().limits.code_len) / 1024; let s in 0 .. code::max_pages::() as u32 * 64 * 128; let salt = vec![42u8; s as usize]; - let value = ::Currency::minimum_balance(); + let value = CurrencyOf::::minimum_balance(); let caller = whitelisted_caller(); - ::Currency::make_free_balance_be(&caller, caller_funding::()); + CurrencyOf::::make_free_balance_be(&caller, caller_funding::()); let WasmModule { code, hash, .. } = WasmModule::::sized(c * 1024, Location::Handle); let origin = RawOrigin::Signed(caller); @@ -671,8 +672,8 @@ benchmarks! { send_message { let p in 0 .. MAX_PAYLOAD_LEN; let caller = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); - let minimum_balance = ::Currency::minimum_balance(); + CurrencyOf::::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); + let minimum_balance = CurrencyOf::::minimum_balance(); let program_id = ProgramId::from_origin(benchmarking::account::("program", 0, 100).into_origin()); let code = benchmarking::generate_wasm2(16.into()).unwrap(); benchmarking::set_program::, _>(program_id, code, 1.into()); @@ -688,17 +689,18 @@ benchmarks! { send_reply { let p in 0 .. MAX_PAYLOAD_LEN; let caller = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); - let minimum_balance = ::Currency::minimum_balance(); + CurrencyOf::::deposit_creating(&caller, 100_000_000_000_000_u128.unique_saturated_into()); + let minimum_balance = CurrencyOf::::minimum_balance(); let program_id = benchmarking::account::("program", 0, 100); - ::Currency::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into()); + CurrencyOf::::deposit_creating(&program_id, 100_000_000_000_000_u128.unique_saturated_into()); let code = benchmarking::generate_wasm2(16.into()).unwrap(); benchmarking::set_program::, _>(ProgramId::from_origin(program_id.clone().into_origin()), code, 1.into()); let original_message_id = MessageId::from_origin(benchmarking::account::("message", 0, 100).into_origin()); let gas_limit = 50000; let value = (p % 2).into(); GasHandlerOf::::create(program_id.clone(), original_message_id, gas_limit).expect("Failed to create gas handler"); - ::Currency::reserve(&program_id, ::GasPrice::gas_price(gas_limit) + value).expect("Failed to reserve"); + GearBank::::deposit_gas::(&program_id, gas_limit).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); + GearBank::::deposit_value(&program_id, value).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); MailboxOf::::insert(gear_core::message::StoredMessage::new( original_message_id, ProgramId::from_origin(program_id.into_origin()), @@ -721,7 +723,7 @@ benchmarks! { let q in 1 .. MAX_PAGES; let q = q as u16; let caller: T::AccountId = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, (1u128 << 60).unique_saturated_into()); + CurrencyOf::::deposit_creating(&caller, (1u128 << 60).unique_saturated_into()); let code = benchmarking::generate_wasm(q.into()).unwrap(); let salt = vec![255u8; 32]; }: { @@ -736,7 +738,7 @@ benchmarks! { let q in 0 .. MAX_PAGES; let q = q as u16; let caller: T::AccountId = benchmarking::account("caller", 0, 0); - ::Currency::deposit_creating(&caller, (1_u128 << 60).unique_saturated_into()); + CurrencyOf::::deposit_creating(&caller, (1_u128 << 60).unique_saturated_into()); let code = benchmarking::generate_wasm2(q.into()).unwrap(); let salt = vec![255u8; 32]; }: { diff --git a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs index 2b92e986150..73792debfef 100644 --- a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs +++ b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs @@ -29,7 +29,7 @@ use super::*; -use crate::{Event, RentCostPerBlockOf, WaitlistOf}; +use crate::{CurrencyOf, Event, RentCostPerBlockOf, WaitlistOf}; use frame_support::traits::Randomness; use gear_core::ids::{CodeId, ReservationId}; use gear_core_errors::{ReplyCode, SuccessReplyReason}; @@ -112,7 +112,7 @@ where { run_tester::(|tester_pid, _| { let default_account = utils::default_account(); - ::Currency::deposit_creating( + CurrencyOf::::deposit_creating( &default_account, 100_000_000_000_000_u128.unique_saturated_into(), ); @@ -302,7 +302,7 @@ where let wasm_module = alloc_free_test_wasm::(); let default_account = utils::default_account(); - ::Currency::deposit_creating( + CurrencyOf::::deposit_creating( &default_account, 100_000_000_000_000_u128.unique_saturated_into(), ); @@ -391,7 +391,7 @@ where { run_tester::(|_, _| { let message_sender = benchmarking::account::("some_user", 0, 0); - ::Currency::deposit_creating( + CurrencyOf::::deposit_creating( &message_sender, 50_000_000_000_000_u128.unique_saturated_into(), ); @@ -886,7 +886,7 @@ where // Deploy program with valid code hash let child_deployer = benchmarking::account::("child_deployer", 0, 0); - ::Currency::deposit_creating( + CurrencyOf::::deposit_creating( &child_deployer, 100_000_000_000_000_u128.unique_saturated_into(), ); @@ -902,7 +902,7 @@ where // Set default code-hash for create program calls let default_account = utils::default_account(); - ::Currency::deposit_creating( + CurrencyOf::::deposit_creating( &default_account, 100_000_000_000_000_u128.unique_saturated_into(), ); @@ -962,9 +962,9 @@ where // Manually reset the storage Gear::::reset(); - ::Currency::slash( + CurrencyOf::::slash( &Id::from_origin(tester_pid.into_origin()), - ::Currency::free_balance(&Id::from_origin(tester_pid.into_origin())), + CurrencyOf::::free_balance(&Id::from_origin(tester_pid.into_origin())), ); } diff --git a/pallets/gear/src/internal.rs b/pallets/gear/src/internal.rs index 21a93f74a2f..c00a5436009 100644 --- a/pallets/gear/src/internal.rs +++ b/pallets/gear/src/internal.rs @@ -19,9 +19,9 @@ //! Internal details of Gear Pallet implementation. use crate::{ - Authorship, BalanceOf, Config, CostsPerBlockOf, CurrencyOf, DispatchStashOf, Event, ExtManager, - GasBalanceOf, GasHandlerOf, GasNodeIdOf, MailboxOf, Pallet, QueueOf, SchedulingCostOf, - TaskPoolOf, WaitlistOf, + Authorship, Config, CostsPerBlockOf, CurrencyOf, DispatchStashOf, Event, ExtManager, + GasBalanceOf, GasHandlerOf, GasNodeIdOf, GearBank, MailboxOf, Pallet, QueueOf, + SchedulingCostOf, TaskPoolOf, WaitlistOf, }; use alloc::collections::BTreeSet; use common::{ @@ -33,11 +33,11 @@ use common::{ gas_provider::{GasNodeId, Imbalance}, scheduler::*, storage::*, - ActiveProgram, GasPrice, GasTree, LockId, LockableTree, Origin, + ActiveProgram, GasTree, LockId, LockableTree, Origin, }; use core::cmp::{Ord, Ordering}; use core_processor::common::ActorExecutionErrorReplyReason; -use frame_support::traits::{BalanceStatus, Currency, ExistenceRequirement, ReservableCurrency}; +use frame_support::traits::{Currency, ExistenceRequirement}; use frame_system::pallet_prelude::BlockNumberFor; use gear_core::{ ids::{MessageId, ProgramId, ReservationId}, @@ -211,51 +211,6 @@ where ::Messenger::reset(); } - // TODO (issue #1239): - // - Consider usage of `Balance` instead of gas conversions. - // - Consider usage of some tolerance here. Missed due to identity fee. - // - If tolerance applied, consider unreserve excess funds, while - // converting gas into value. - /// Moves reserved funds from account to freed funds of another account. - pub(crate) fn transfer_reserved(from: &T::AccountId, to: &T::AccountId, value: BalanceOf) { - // If value is zero, nothing to do. - if value.is_zero() { - return; - } - - // If destination account can reserve minimum balance, it means that - // account exists and can receive repatriation of reserved funds. - // - // Otherwise need to transfer them directly. - - // Checking balance existence of destination address. - if CurrencyOf::::can_reserve(to, CurrencyOf::::minimum_balance()) { - // Repatriating reserved to existent account. - let unrevealed = - CurrencyOf::::repatriate_reserved(from, to, value, BalanceStatus::Free) - .unwrap_or_else(|e| { - unreachable!("Failed to repatriate reserved funds: {:?}", e) - }); - - // Validating unrevealed funds after repatriation. - if !unrevealed.is_zero() { - unreachable!("Reserved funds wasn't fully repatriated: {:?}", unrevealed) - } - } else { - // Unreserving funds from sender to transfer them directly. - let unrevealed = CurrencyOf::::unreserve(from, value); - - // Validating unrevealed funds after unreserve. - if !unrevealed.is_zero() { - unreachable!("Not all requested value was unreserved"); - } - - // Transfer to inexistent account. - CurrencyOf::::transfer(from, to, value, ExistenceRequirement::AllowDeath) - .unwrap_or_else(|e| unreachable!("Failed to transfer value: {:?}", e)); - } - } - /// Spends given amount of gas from given `MessageId` in `GasTree`. /// /// Represents logic of burning gas by transferring gas from @@ -276,15 +231,9 @@ where let external = GasHandlerOf::::get_external(id) .unwrap_or_else(|e| unreachable!("GasTree corrupted! {:?}", e)); - // Querying actual block author to reward. - let block_author = Authorship::::author() - .unwrap_or_else(|| unreachable!("Failed to find block author!")); - - // Converting gas amount into value. - let value = T::GasPrice::gas_price(amount); - // Transferring reserved funds from external user to block author. - Self::transfer_reserved(&external, &block_author, value); + GearBank::::spend_gas::(&external, amount) + .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); } /// Consumes message by given `MessageId` or gas reservation by `ReservationId`. @@ -308,16 +257,8 @@ where "Consumed message {id}. Unreserving {gas_left} (gas) from {external:?}" ); - // Converting gas amount into value. - let value = T::GasPrice::gas_price(gas_left); - - // Unreserving funds. - let unrevealed = CurrencyOf::::unreserve(&external, value); - - // Validating unrevealed funds after unreserve. - if !unrevealed.is_zero() { - unreachable!("Not all requested value was unreserved"); - } + GearBank::::withdraw_gas::(&external, gas_left) + .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); } } } @@ -529,7 +470,8 @@ where let from = ::from_origin(mailboxed.source().into_origin()); // Transferring reserved funds, associated with the message. - Self::transfer_reserved(&from, &user_id, mailboxed.value().unique_saturated_into()); + GearBank::::transfer_value(&from, &user_id, mailboxed.value().unique_saturated_into()) + .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); // Depositing appropriate event. Pallet::::deposit_event(Event::UserMessageRead { @@ -710,8 +652,8 @@ where if !dispatch.value().is_zero() { // Reserving value from source for future transfer or unreserve. - CurrencyOf::::reserve(&from, value) - .unwrap_or_else(|e| unreachable!("Unable to reserve requested value {:?}", e)); + GearBank::::deposit_value(&from, value) + .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); } // Saving id to allow moving dispatch further. @@ -817,8 +759,8 @@ where .unwrap_or_else(|e| unreachable!("GasTree corrupted! {:?}", e)); // Reserving value from source for future transfer or unreserve. - CurrencyOf::::reserve(&from, value) - .unwrap_or_else(|e| unreachable!("Unable to reserve requested value {:?}", e)); + GearBank::::deposit_value(&from, value) + .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); // Lock the entire `gas_limit` since the only purpose of it is payment for storage. GasHandlerOf::::lock(message.id(), LockId::Mailbox, gas_limit) @@ -952,7 +894,8 @@ where Some(hold.expected()) } else { // Transferring reserved funds. - Self::transfer_reserved(&from, &to, value); + GearBank::::transfer_value(&from, &to, value) + .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); // Message is never reply here, because delayed reply sending forbidden. if message.details().is_none() { diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 1ccd629e1d2..dbce52d2b54 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -64,10 +64,7 @@ use frame_support::{ dispatch::{DispatchError, DispatchResultWithPostInfo, PostDispatchInfo}, ensure, pallet_prelude::*, - traits::{ - ConstBool, Currency, ExistenceRequirement, Get, LockableCurrency, Randomness, - ReservableCurrency, StorageVersion, - }, + traits::{ConstBool, Currency, ExistenceRequirement, Get, Randomness, StorageVersion}, weights::Weight, }; use frame_system::pallet_prelude::{BlockNumberFor, *}; @@ -101,9 +98,9 @@ use core_processor::Ext; type ExecutionEnvironment = gear_backend_sandbox::SandboxEnvironment; -pub(crate) type CurrencyOf = ::Currency; -pub(crate) type BalanceOf = - <::Currency as Currency<::AccountId>>::Balance; +pub(crate) type AccountIdOf = ::AccountId; +pub(crate) type CurrencyOf = ::Currency; +pub(crate) type BalanceOf = as Currency>>::Balance; pub(crate) type SentOf = <::Messenger as Messenger>::Sent; pub(crate) type DbWeightOf = ::DbWeight; pub(crate) type DequeuedOf = <::Messenger as Messenger>::Dequeued; @@ -130,6 +127,7 @@ pub type RentCostPerBlockOf = ::ProgramRentCostPerBlock; pub type ResumeMinimalPeriodOf = ::ProgramResumeMinimalRentPeriod; pub type ResumeSessionDurationOf = ::ProgramResumeSessionDuration; pub(crate) type VoucherOf = ::Voucher; +pub(crate) type GearBank = pallet_gear_bank::Pallet; /// The current storage version. const GEAR_STORAGE_VERSION: StorageVersion = StorageVersion::new(1); @@ -179,7 +177,10 @@ pub mod pallet { #[pallet::config] pub trait Config: - frame_system::Config + pallet_authorship::Config + pallet_timestamp::Config + frame_system::Config + + pallet_authorship::Config + + pallet_timestamp::Config + + pallet_gear_bank::Config { /// Because this pallet emits events, it depends on the runtime's definition of an event. type RuntimeEvent: From> @@ -189,9 +190,6 @@ pub mod pallet { /// The generator used to supply randomness to contracts through `seal_random` type Randomness: Randomness; - /// Balances management trait for gas/value migrations. - type Currency: LockableCurrency + ReservableCurrency; - /// Gas to Currency converter type GasPrice: GasPrice>; @@ -463,8 +461,6 @@ pub mod pallet { ProgramConstructionFailed, /// Value doesn't cover ExistentialDeposit. ValueLessThanMinimal, - /// Messages storage corrupted. - MessagesStorageCorrupted, /// Message queue processing is disabled. MessageQueueProcessingDisabled, /// Block count doesn't cover MinimalResumePeriod. @@ -620,12 +616,10 @@ pub mod pallet { Error::::ProgramAlreadyExists ); - let reserve_fee = T::GasPrice::gas_price(gas_limit); - // First we reserve enough funds on the account to pay for `gas_limit` // and to transfer declared value. - CurrencyOf::::reserve(&who, reserve_fee + value) - .map_err(|_| Error::::InsufficientBalance)?; + GearBank::::deposit_gas::(&who, gas_limit)?; + GearBank::::deposit_value(&who, value)?; let origin = who.clone().into_origin(); @@ -663,7 +657,8 @@ pub mod pallet { .into_dispatch(ProgramId::from_origin(origin)) .into_stored(); - QueueOf::::queue(dispatch).map_err(|_| Error::::MessagesStorageCorrupted)?; + QueueOf::::queue(dispatch) + .unwrap_or_else(|e| unreachable!("Messages storage corrupted: {e:?}")); Self::deposit_event(Event::MessageQueued { id: message_id, @@ -1213,12 +1208,10 @@ pub mod pallet { Error::::ProgramAlreadyExists ); - let reserve_fee = T::GasPrice::gas_price(gas_limit); - // First we reserve enough funds on the account to pay for `gas_limit` // and to transfer declared value. - ::Currency::reserve(&who, reserve_fee + value) - .map_err(|_| Error::::InsufficientBalance)?; + GearBank::::deposit_gas::(&who, gas_limit)?; + GearBank::::deposit_value(&who, value)?; Ok(packet) } @@ -1268,7 +1261,8 @@ pub mod pallet { entry: MessageEntry::Init, }; - QueueOf::::queue(dispatch).map_err(|_| Error::::MessagesStorageCorrupted)?; + QueueOf::::queue(dispatch) + .unwrap_or_else(|e| unreachable!("Messages storage corrupted: {e:?}")); let task = ScheduledTask::PauseProgram(program_id); TaskPoolOf::::add(expiration_block, task) @@ -1518,29 +1512,27 @@ pub mod pallet { // Message is not guaranteed to be executed, that's why value is not immediately transferred. // That's because destination can fail to be initialized, while this dispatch message is next // in the queue. - // Note: reservaton is always made against the user's account regardless whether + // Note: reservation is always made against the user's account regardless whether // a voucher exists. The latter can only be used to pay for gas or transaction fee. - CurrencyOf::::reserve(&who, value.unique_saturated_into()) - .map_err(|_| Error::::InsufficientBalance)?; - - let gas_limit_reserve = T::GasPrice::gas_price(gas_limit); + GearBank::::deposit_value(&who, value)?; let external_node = if prepaid { // If voucher is used, we attempt to reserve funds on the respective account. // If no such voucher exists, the call is invalidated. - VoucherOf::::redeem_with_id(who.clone(), destination, gas_limit_reserve) - .map_err(|_| { - log::error!( - "Failed to redeem voucher for user {:?} and program {:?}", - who, - destination, - ); - Error::::FailureRedeemingVoucher - })? + let voucher_id = VoucherOf::::voucher_id(who.clone(), destination); + + GearBank::::deposit_gas::(&voucher_id, gas_limit).map_err(|e| { + log::debug!( + "Failed to redeem voucher for user {who:?} and program {destination:?}: {e:?}" + ); + Error::::FailureRedeemingVoucher + })?; + + voucher_id } else { // If voucher is not used, we reserve gas limit on the user's account. - CurrencyOf::::reserve(&who, gas_limit_reserve) - .map_err(|_| Error::::InsufficientBalance)?; + GearBank::::deposit_gas::(&who, gas_limit)?; + who.clone() }; @@ -1555,7 +1547,8 @@ pub mod pallet { entry: MessageEntry::Handle, }); - QueueOf::::queue(message).map_err(|_| Error::::MessagesStorageCorrupted)?; + QueueOf::::queue(message) + .unwrap_or_else(|e| unreachable!("Messages storage corrupted: {e:?}")); } else { let message = message.into_stored(ProgramId::from_origin(origin)); let message: UserMessage = message @@ -1569,8 +1562,7 @@ pub mod pallet { ), value.unique_saturated_into(), ExistenceRequirement::AllowDeath, - ) - .map_err(|_| Error::::InsufficientBalance)?; + )?; Pallet::::deposit_event(Event::UserMessageSent { message, @@ -1646,33 +1638,25 @@ pub mod pallet { gas_limit }; - // Converting applied gas limit into value to reserve. - let gas_limit_reserve = T::GasPrice::gas_price(gas_limit); + GearBank::::deposit_value(&origin, value)?; let external_node = if prepaid { - // Reserving funds for sending `value` on the sender's account - // even though a voucher is supposed to be used. - // - // Note, that message is not guaranteed to be successfully executed, - // that's why value is not immediately transferred. - CurrencyOf::::reserve(&origin, value) - .map_err(|_| Error::::InsufficientBalance)?; - VoucherOf::::redeem_with_id(origin.clone(), destination, gas_limit_reserve) - .map_err(|_| { - log::error!( - "Failed to redeem voucher for user {:?} and program {:?}", - origin, - destination, - ); - Error::::FailureRedeemingVoucher - })? + // If voucher is used, we attempt to reserve funds on the respective account. + // If no such voucher exists, the call is invalidated. + let voucher_id = VoucherOf::::voucher_id(origin.clone(), destination); + + GearBank::::deposit_gas::(&voucher_id, gas_limit).map_err(|e| { + log::debug!( + "Failed to redeem voucher for user {origin:?} and program {destination:?}: {e:?}" + ); + Error::::FailureRedeemingVoucher + })?; + + voucher_id } else { - // Reserving funds for both gas limit and value sending on the sender's account. - // - // Note, that message is not guaranteed to be successfully executed, - // that's why value is not immediately transferred. - CurrencyOf::::reserve(&origin, gas_limit_reserve + value) - .map_err(|_| Error::::InsufficientBalance)?; + // If voucher is not used, we reserve gas limit on the user's account. + GearBank::::deposit_gas::(&origin, gas_limit)?; + origin.clone() }; @@ -1957,8 +1941,7 @@ pub mod pallet { &block_author, rent_fee, ExistenceRequirement::AllowDeath, - ) - .unwrap_or_else(|e| unreachable!("Failed to transfer rent: {:?}", e)); + )?; Self::deposit_event(Event::ProgramChanged { id: program_id, diff --git a/pallets/gear/src/manager/journal.rs b/pallets/gear/src/manager/journal.rs index 5fb98f3faca..b60e65d147f 100644 --- a/pallets/gear/src/manager/journal.rs +++ b/pallets/gear/src/manager/journal.rs @@ -19,7 +19,7 @@ use crate::{ internal::HoldBoundBuilder, manager::{CodeInfo, ExtManager}, - Config, CurrencyOf, Event, GasAllowanceOf, GasHandlerOf, GasTree, Pallet, ProgramStorageOf, + Config, Event, GasAllowanceOf, GasHandlerOf, GasTree, GearBank, Pallet, ProgramStorageOf, QueueOf, RentFreePeriodOf, TaskPoolOf, WaitlistOf, }; use common::{ @@ -29,7 +29,7 @@ use common::{ CodeStorage, LockableTree, Origin, Program, ProgramState, ProgramStorage, ReservableTree, }; use core_processor::common::{DispatchOutcome as CoreDispatchOutcome, JournalHandler}; -use frame_support::{sp_runtime::Saturating, traits::ReservableCurrency}; +use frame_support::sp_runtime::Saturating; use frame_system::pallet_prelude::BlockNumberFor; use gear_core::{ ids::{CodeId, MessageId, ProgramId, ReservationId}, @@ -223,10 +223,11 @@ where ); if dispatch.value() != 0 { - CurrencyOf::::reserve( + GearBank::::deposit_value( &::from_origin(dispatch.source().into_origin()), dispatch.value().unique_saturated_into(), - ).unwrap_or_else(|_| unreachable!("Value reservation can't fail due to value sending rules. For more info, see module docs.")); + ) + .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); } match (gas_limit, reservation) { @@ -365,7 +366,8 @@ where let from = ::from_origin(from.into_origin()); let value = value.unique_saturated_into(); - Pallet::::transfer_reserved(&from, &to, value); + GearBank::::transfer_value(&from, &to, value) + .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); } fn store_new_programs(&mut self, code_id: CodeId, candidates: Vec<(MessageId, ProgramId)>) { diff --git a/pallets/gear/src/mock.rs b/pallets/gear/src/mock.rs index d86e232871e..04a7d914fdb 100644 --- a/pallets/gear/src/mock.rs +++ b/pallets/gear/src/mock.rs @@ -81,6 +81,7 @@ construct_runtime!( GearProgram: pallet_gear_program, GearMessenger: pallet_gear_messenger, GearScheduler: pallet_gear_scheduler, + GearBank: pallet_gear_bank, Gear: pallet_gear, GearGas: pallet_gear_gas, GearVoucher: pallet_gear_voucher, @@ -205,10 +206,18 @@ impl Drop for DynamicScheduleReset { } } +parameter_types! { + pub const BankAddress: AccountId = 15082001; +} + +impl pallet_gear_bank::Config for Test { + type Currency = Balances; + type BankAddress = BankAddress; +} + impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type Currency = Balances; type GasPrice = GasConverter; type WeightInfo = pallet_gear::weights::SubstrateWeight; type Schedule = DynamicSchedule; @@ -300,6 +309,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { (USER_3, 500_000_000_000_000_u128), (LOW_BALANCE_USER, 1_000_000_u128), (BLOCK_AUTHOR, 500_000_u128), + (BankAddress::get(), ExistentialDeposit::get()), ], } .assimilate_storage(&mut t) diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index acad5300ad6..eff79074ed7 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -16,7 +16,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::runtime_api::RUNTIME_API_BLOCK_LIMITS_COUNT; use crate::{ internal::HoldBoundBuilder, manager::HandleKind, @@ -44,10 +43,12 @@ use crate::{ USER_2, USER_3, }, - pallet, BlockGasLimitOf, Config, CostsPerBlockOf, CurrencyOf, DbWeightOf, Error, Event, - GasAllowanceOf, GasBalanceOf, GasHandlerOf, GasInfo, MailboxOf, ProgramStorageOf, QueueOf, - RentCostPerBlockOf, RentFreePeriodOf, ReservableCurrency, ResumeMinimalPeriodOf, - ResumeSessionDurationOf, Schedule, TaskPoolOf, WaitlistOf, + pallet, + runtime_api::RUNTIME_API_BLOCK_LIMITS_COUNT, + BlockGasLimitOf, Config, CostsPerBlockOf, CurrencyOf, DbWeightOf, Error, Event, GasAllowanceOf, + GasBalanceOf, GasHandlerOf, GasInfo, GearBank, MailboxOf, ProgramStorageOf, QueueOf, + RentCostPerBlockOf, RentFreePeriodOf, ResumeMinimalPeriodOf, ResumeSessionDurationOf, Schedule, + TaskPoolOf, WaitlistOf, }; use common::{ event::*, scheduler::*, storage::*, ActiveProgram, CodeStorage, GasPrice as _, GasTree, LockId, @@ -1353,8 +1354,9 @@ fn delayed_send_user_message_payment() { ); // Gas should be reserved while message is being held in storage. - assert_eq!(Balances::reserved_balance(USER_1), delay_holding_fee); - let total_balance = Balances::free_balance(USER_1) + Balances::reserved_balance(USER_1); + assert_eq!(GearBank::::account_total(&USER_1), delay_holding_fee); + let total_balance = + Balances::free_balance(USER_1) + GearBank::::account_total(&USER_1); // Run blocks before sending message. run_to_block(delay + 2, None); @@ -1383,7 +1385,7 @@ fn delayed_send_user_message_payment() { assert!(MailboxOf::::is_empty(&USER_2)); // Check balances match and gas charging is correct. - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); assert_eq!( total_balance - delay_holding_fee + reserve_for_fee, Balances::free_balance(USER_1) @@ -1458,7 +1460,7 @@ fn delayed_send_user_message_with_reservation() { // `delay` + 1 locked for using dispatch stash storage. // Other gas nodes have been consumed with all gas released to the user. assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::::account_total(&USER_1), mailbox_gas_threshold + delay_holding_fee ); @@ -1499,7 +1501,7 @@ fn delayed_send_user_message_with_reservation() { // for the `delay` number of blocks spent in the dispatch stash so that the "+ 1" security // margin remained unused and was simply added back to the `Cut` node value. assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::::account_total(&USER_1), mailbox_gas_threshold + reserve_for_fee ); } @@ -1561,8 +1563,9 @@ fn delayed_send_program_message_payment() { ); // Gas should be reserved while message is being held in storage. - assert_eq!(Balances::reserved_balance(USER_1), delay_holding_fee); - let total_balance = Balances::free_balance(USER_1) + Balances::reserved_balance(USER_1); + assert_eq!(GearBank::::account_total(&USER_1), delay_holding_fee); + let total_balance = + Balances::free_balance(USER_1) + GearBank::::account_total(&USER_1); // Run blocks to release message. run_to_block(delay + 2, None); @@ -1582,7 +1585,7 @@ fn delayed_send_program_message_payment() { assert_last_dequeued(2); // Check that gas was charged correctly. - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); assert_eq!( total_balance - delay_holding_fee + reserve_for_fee, Balances::free_balance(USER_1) @@ -1678,7 +1681,7 @@ fn delayed_send_program_message_with_reservation() { // Gas should be reserved while message is being held in storage. assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::::account_total(&USER_1), GasPrice::gas_price(reservation_amount) + reservation_holding_fee ); @@ -1697,7 +1700,7 @@ fn delayed_send_program_message_with_reservation() { // Check that last event is MessagesDispatched. assert_last_dequeued(2); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); } init_logger(); @@ -1789,7 +1792,7 @@ fn delayed_send_program_message_with_low_reservation() { // Gas should be reserved while message is being held in storage. assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::::account_total(&USER_1), GasPrice::gas_price(reservation_amount) + reservation_holding_fee ); @@ -1808,7 +1811,7 @@ fn delayed_send_program_message_with_low_reservation() { // Check that last event is MessagesDispatched. assert_last_dequeued(2); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); } init_logger(); @@ -1874,7 +1877,7 @@ fn delayed_program_creation_no_code() { )); let free_balance = Balances::free_balance(USER_1); - let reserved_balance = Balances::reserved_balance(USER_1); + let reserved_balance = GearBank::::account_total(&USER_1); run_to_next_block(None); // Delayed message sent. @@ -1902,7 +1905,7 @@ fn delayed_program_creation_no_code() { - delay_holding_fee - GasPrice::gas_price(DbWeightOf::::get().reads(1).ref_time()) ); - assert!(Balances::reserved_balance(USER_1).is_zero()); + assert!(GearBank::::account_total(&USER_1).is_zero()); }) } @@ -2246,14 +2249,14 @@ fn mailbox_rent_out_of_rent() { for data in cases { let user_1_balance = Balances::free_balance(USER_1); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); let user_2_balance = Balances::free_balance(USER_2); - assert_eq!(Balances::reserved_balance(USER_2), 0); + assert_eq!(GearBank::::account_total(&USER_2), 0); let prog_balance = Balances::free_balance(AccountId::from_origin(sender.into_origin())); assert_eq!( - Balances::reserved_balance(AccountId::from_origin(sender.into_origin())), + GearBank::::account_total(&AccountId::from_origin(sender.into_origin())), 0 ); @@ -2341,14 +2344,14 @@ fn mailbox_rent_claimed() { for (data, duration) in cases { let user_1_balance = Balances::free_balance(USER_1); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); let user_2_balance = Balances::free_balance(USER_2); - assert_eq!(Balances::reserved_balance(USER_2), 0); + assert_eq!(GearBank::::account_total(&USER_2), 0); let prog_balance = Balances::free_balance(AccountId::from_origin(sender.into_origin())); assert_eq!( - Balances::reserved_balance(AccountId::from_origin(sender.into_origin())), + GearBank::::account_total(&AccountId::from_origin(sender.into_origin())), 0 ); @@ -2430,14 +2433,14 @@ fn mailbox_sending_instant_transfer() { for (gas_limit, value) in cases { let user_1_balance = Balances::free_balance(USER_1); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); let user_2_balance = Balances::free_balance(USER_2); - assert_eq!(Balances::reserved_balance(USER_2), 0); + assert_eq!(GearBank::::account_total(&USER_2), 0); let prog_balance = Balances::free_balance(AccountId::from_origin(sender.into_origin())); assert_eq!( - Balances::reserved_balance(AccountId::from_origin(sender.into_origin())), + GearBank::::account_total(&AccountId::from_origin(sender.into_origin())), 0 ); @@ -2506,12 +2509,12 @@ fn upload_program_expected_failure() { DEFAULT_GAS_LIMIT, balance + 1 ), - Error::::InsufficientBalance + pallet_gear_bank::Error::::InsufficientBalance ); assert_noop!( upload_program_default(LOW_BALANCE_USER, ProgramCodeKind::Default), - Error::::InsufficientBalance + pallet_gear_bank::Error::::InsufficientBalance ); // Gas limit is too high @@ -2771,7 +2774,7 @@ fn send_message_expected_failure() { assert_noop!( call_default_message(program_id).dispatch(RuntimeOrigin::signed(LOW_BALANCE_USER)), - Error::::InsufficientBalance + pallet_gear_bank::Error::::InsufficientBalance ); let low_balance_user_balance = Balances::free_balance(LOW_BALANCE_USER); @@ -2907,7 +2910,7 @@ fn unused_gas_released_back_works() { user1_initial_balance - user1_potential_msgs_spends ); assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::::account_total(&USER_1), user1_potential_msgs_spends ); @@ -3670,7 +3673,7 @@ fn mailbox_works() { let reply_to_id = setup_mailbox_test_state(USER_1); assert_eq!( - Balances::reserved_balance(USER_1), + GearBank::::account_total(&USER_1), GasPrice::gas_price(OUTGOING_WITH_VALUE_IN_HANDLE_VALUE_GAS) ); @@ -4044,18 +4047,18 @@ fn send_reply_value_claiming_works() { next_block += 1; let user_balance = Balances::free_balance(USER_1); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); assert!(MailboxOf::::contains(&USER_1, &reply_to_id)); assert_eq!( - Balances::reserved_balance(USER_2), + GearBank::::account_total(&USER_2), GasPrice::gas_price(OUTGOING_WITH_VALUE_IN_HANDLE_VALUE_GAS) ); // nothing changed assert_eq!(Balances::free_balance(USER_1), user_balance); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); // auto-claim of "locked_value" + send is here assert_ok!(Gear::send_reply( @@ -4073,8 +4076,8 @@ fn send_reply_value_claiming_works() { Balances::free_balance(USER_1), user_balance + locked_value - currently_sent ); - assert_eq!(Balances::reserved_balance(USER_1), currently_sent); - assert_eq!(Balances::reserved_balance(USER_2), 0,); + assert_eq!(GearBank::::account_total(&USER_1), currently_sent); + assert_eq!(GearBank::::account_total(&USER_2), 0,); } }) } @@ -4087,9 +4090,9 @@ fn claim_value_works() { init_logger(); new_test_ext().execute_with(|| { let sender_balance = Balances::free_balance(USER_2); - assert_eq!(Balances::reserved_balance(USER_2), 0); + assert_eq!(GearBank::::account_total(&USER_2), 0); let claimer_balance = Balances::free_balance(USER_1); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); let gas_sent = 10_000_000_000; let value_sent = 1000; @@ -4133,8 +4136,8 @@ fn claim_value_works() { reply_to_id, )); - assert_eq!(Balances::reserved_balance(USER_1), 0); - assert_eq!(Balances::reserved_balance(USER_2), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_2), 0); let expected_claimer_balance = claimer_balance + value_sent; assert_eq!(Balances::free_balance(USER_1), expected_claimer_balance); @@ -6433,6 +6436,7 @@ fn resume_program_works() { btree::{Reply, Request}, InitMessage, WASM_BINARY, }; + use frame_support::traits::ReservableCurrency; let code = WASM_BINARY; let program_id = generate_program_id(code, DEFAULT_SALT); @@ -7428,7 +7432,7 @@ fn no_redundant_gas_value_after_exiting() { // before execution let free_after_send = Balances::free_balance(USER_1); - let reserved_after_send = Balances::reserved_balance(USER_1); + let reserved_after_send = GearBank::::account_total(&USER_1); assert_eq!(reserved_after_send, GasPrice::gas_price(gas_spent)); run_to_block(3, None); @@ -7447,7 +7451,7 @@ fn no_redundant_gas_value_after_exiting() { ); // reserved balance after execution is zero - let reserved_after_execution = Balances::reserved_balance(USER_1); + let reserved_after_execution = GearBank::::account_total(&USER_1); assert!(reserved_after_execution.is_zero()); }) } @@ -8602,7 +8606,7 @@ fn cascading_messages_with_value_do_not_overcharge() { assert_eq!(user_balance_before_calculating, user_initial_balance); // Zero because no message added into mailbox. - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); assert!(MailboxOf::::is_empty(&USER_1)); assert_ok!(Gear::send_message( @@ -8644,14 +8648,14 @@ fn free_storage_hold_on_scheduler_overwhelm() { let reserve_for = CostsPerBlockOf::::reserve_for(); let user_1_balance = Balances::free_balance(USER_1); - assert_eq!(Balances::reserved_balance(USER_1), 0); + assert_eq!(GearBank::::account_total(&USER_1), 0); let user_2_balance = Balances::free_balance(USER_2); - assert_eq!(Balances::reserved_balance(USER_2), 0); + assert_eq!(GearBank::::account_total(&USER_2), 0); let prog_balance = Balances::free_balance(AccountId::from_origin(sender.into_origin())); assert_eq!( - Balances::reserved_balance(AccountId::from_origin(sender.into_origin())), + GearBank::::account_total(&AccountId::from_origin(sender.into_origin())), 0 ); @@ -13765,7 +13769,8 @@ mod utils { }; use crate::{ mock::{run_to_next_block, Balances, Gear, System, USER_1}, - BalanceOf, BlockGasLimitOf, GasInfo, HandleKind, ProgramStorageOf, SentOf, + BalanceOf, BlockGasLimitOf, CurrencyOf, GasInfo, GearBank, HandleKind, ProgramStorageOf, + SentOf, }; use common::{ event::*, @@ -13871,7 +13876,10 @@ mod utils { ) { let account_id = AccountId::from_origin(origin.into_origin()); assert_eq!(Balances::free_balance(account_id), free.into()); - assert_eq!(Balances::reserved_balance(account_id), reserved.into()); + assert_eq!( + GearBank::::account_total(&account_id), + reserved.into() + ); } #[track_caller] @@ -13909,7 +13917,7 @@ mod utils { } pub(super) fn get_ed() -> u128 { - ::Currency::minimum_balance().unique_saturated_into() + CurrencyOf::::minimum_balance().unique_saturated_into() } #[track_caller] diff --git a/pallets/payment/Cargo.toml b/pallets/payment/Cargo.toml index c332571d839..bb6f5903037 100644 --- a/pallets/payment/Cargo.toml +++ b/pallets/payment/Cargo.toml @@ -40,6 +40,7 @@ gear-core.workspace = true sp-io = { workspace = true, features = ["std"] } frame-support-test = { workspace = true, features = ["std"] } pallet-timestamp = { workspace = true, features = ["std"] } +pallet-gear-bank = { workspace = true, features = ["std"] } pallet-gear = { workspace = true, features = ["std"] } pallet-gear-gas = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } diff --git a/pallets/payment/src/mock.rs b/pallets/payment/src/mock.rs index 4ad92101b9c..b72f8a6bb4b 100644 --- a/pallets/payment/src/mock.rs +++ b/pallets/payment/src/mock.rs @@ -70,6 +70,7 @@ construct_runtime!( GearPayment: pallet_gear_payment, GearProgram: pallet_gear_program, GearVoucher: pallet_gear_voucher, + GearBank: pallet_gear_bank, } ); @@ -177,12 +178,17 @@ parameter_types! { pub RentCostPerBlock: Balance = 11; pub ResumeMinimalPeriod: BlockNumber = 100; pub ResumeSessionDuration: BlockNumber = 1_000; + pub const BankAddress: AccountId = 15082001; +} + +impl pallet_gear_bank::Config for Test { + type Currency = Balances; + type BankAddress = BankAddress; } impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type Currency = Balances; type GasPrice = GasConverter; type WeightInfo = (); type Schedule = GearSchedule; @@ -318,6 +324,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { (BOB, 1_000u128), (BLOCK_AUTHOR, 1_000u128), (FEE_PAYER, 10_000_000u128), + (BankAddress::get(), ExistentialDeposit::get()), ], } .assimilate_storage(&mut t) diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 0a56e8aeb1f..ab712a38152 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -30,7 +30,11 @@ runtime-primitives.workspace = true gear-common.workspace = true gear-backend-common.workspace = true gear-core-processor.workspace = true +gear-core.workspace = true pallet-gear.workspace = true +pallet-gear-gas.workspace = true +pallet-gear-bank.workspace = true +pallet-gear-messenger.workspace = true # Utils log.workspace = true @@ -44,6 +48,10 @@ std = [ "pallet-authorship/std", "pallet-balances/std", "pallet-session/std", + "pallet-gear/std", + "pallet-gear-gas/std", + "pallet-gear-bank/std", + "pallet-gear-messenger/std", "runtime-primitives/std", "sp-runtime/std", "sp-std/std", @@ -55,11 +63,19 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-gear/runtime-benchmarks", + "pallet-gear-gas/runtime-benchmarks", + "pallet-gear-bank/runtime-benchmarks", + "pallet-gear-messenger/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] try-runtime = [ "frame-system/try-runtime", "pallet-balances/try-runtime", + "pallet-gear/try-runtime", + "pallet-gear-gas/try-runtime", + "pallet-gear-bank/try-runtime", + "pallet-gear-messenger/try-runtime", "pallet-session/try-runtime", "validator-set/try-runtime", ] diff --git a/runtime/common/src/constants.rs b/runtime/common/src/constants.rs index d80d49b3efe..b585d59bc23 100644 --- a/runtime/common/src/constants.rs +++ b/runtime/common/src/constants.rs @@ -32,3 +32,6 @@ pub const RENT_RESUME_WEEK_FACTOR: BlockNumber = 4; /// The amount of blocks for processing resume session represented as a factor of hours. pub const RESUME_SESSION_DURATION_HOUR_FACTOR: BlockNumber = 1; + +/// Address of bank account represented as 32 bytes. +pub const BANK_ADDRESS: [u8; 32] = *b"gearbankgearbankgearbankgearbank"; diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 8620bd086fd..8f2a074d3b1 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -20,6 +20,7 @@ mod apis; pub mod constants; +pub mod migrations; pub mod weights; use frame_support::{ diff --git a/runtime/common/src/migrations.rs b/runtime/common/src/migrations.rs new file mode 100644 index 00000000000..21c4ec60290 --- /dev/null +++ b/runtime/common/src/migrations.rs @@ -0,0 +1,142 @@ +use frame_support::{ + pallet_prelude::Weight, + traits::{Currency, OnRuntimeUpgrade, ReservableCurrency}, +}; +use frame_system::AccountInfo; +use gear_common::{storage::LinkedNode, GasPrice, GasProvider, GasTree, Origin}; +use gear_core::ids::ProgramId; +use sp_runtime::traits::{Get, UniqueSaturatedInto, Zero}; +#[cfg(feature = "try-runtime")] +use sp_std::vec::Vec; + +type AccountIdOf = ::AccountId; +type Balances = pallet_balances::Pallet; +type GearGas = pallet_gear_gas::Pallet; +type GearBank = pallet_gear_bank::Pallet; +type GasHandlerOf = as GasProvider>::GasTree; +type GasNodesOf = pallet_gear_gas::GasNodes; +type AccountsOf = frame_system::Account; +type CurrencyOf = ::Currency; +type BalanceOf = as Currency>>::Balance; +type DispatchesOf = pallet_gear_messenger::Dispatches; +type MailboxOf = pallet_gear_messenger::Mailbox; +type WaitlistOf = pallet_gear_messenger::Waitlist; +type DispatchStashOf = pallet_gear_messenger::DispatchStash; + +pub struct MigrateToGearBank(sp_std::marker::PhantomData<(T, P)>) +where + T: frame_system::Config>> + + pallet_balances::Config> + + pallet_gear_gas::Config + + pallet_gear_bank::Config + + pallet_gear_messenger::Config, + P: GasPrice>, + AccountIdOf: Origin; + +impl OnRuntimeUpgrade for MigrateToGearBank +where + T: frame_system::Config>> + + pallet_balances::Config> + + pallet_gear_gas::Config + + pallet_gear_bank::Config + + pallet_gear_messenger::Config, + P: GasPrice>, + AccountIdOf: Origin, +{ + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + Ok(Default::default()) + } + + fn on_runtime_upgrade() -> Weight { + let version = T::Version::get().spec_version; + + log::info!("🚚 Running migration to gear-bank with current spec version {version:?}"); + + // TODO: consider version here. + if version <= 220 { + let mut ops = 0u64; + + // Depositing gas from gas nodes. + let gas_nodes_iter = GasNodesOf::::iter(); + for (node_id, gas_node) in gas_nodes_iter { + let external = GasHandlerOf::::get_external(node_id) + .expect("Failed to get external id of the node"); + let gas_amount = gas_node.total_value(); + + let gas_price = P::gas_price(gas_amount); + Balances::::unreserve(&external, gas_price); + GearBank::::deposit_gas::

+Program to be uploaded + +```rust +#![no_std] + +use gstd::{ + ActorId, + errors::{SignalCode, SimpleExecutionError}, + exec, + msg, + prelude::* +}; + +static mut INITIATOR: ActorId = ActorId::zero(); + +#[no_mangle] +extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; +} + +#[no_mangle] +extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + panic!("Gotcha!"); +} + +#[no_mangle] +extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::Execution(SimpleExecutionError::UserspacePanic) { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } +} +``` + +
+ +
+Test + +```rust +const USER_1: AccountId = 1; +const DEFAULT_SALT: &[u8; 4] = b"salt"; +const GAS_LIMIT: u64 = 10_000_000_000; + +#[test] +fn test_userspace_panic_works() { + use demo_signal_panic::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + run_to_next_block(None); + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); +} +``` +
+ +#### Ran out of gas + + +This signal is sent when the trap `TrapExplanation::GasLimitExceeded` occurs. This trap may be caused by: +- Failing to charge gas during the program's execution because the gas runs out + + When this happens, the syscall `out_of_gas` gets called. This case can be tested simply by running empty loop in the program. + +
+ Program to be uploaded + + ```rust + #![no_std] + + use gstd::{ + ActorId, + errors::{SignalCode, SimpleExecutionError}, + exec, + prelude::*, + msg, + }; + + static mut INITIATOR: ActorId = ActorId::zero(); + + #[no_mangle] + extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; + } + + #[no_mangle] + extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + #[allow(clippy::empty_loop)] + loop {} + } + + #[no_mangle] + extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::Execution(SimpleExecutionError::RanOutOfGas) { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } + } + ``` + +
+ +
+ Test + + ```rust + const USER_1: AccountId = 1; + const DEFAULT_SALT: &[u8; 4] = b"salt"; + const GAS_LIMIT: u64 = 10_000_000_000; + + #[test] + fn test_signal_run_out_of_gas_works() { + use demo_signal_run_out_of_gas::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + run_to_next_block(None); + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); + } + ``` +
+- Gas runs out during plain or lazy pages memory access. + + This case can be tested by creating a program, that _only_ accesses memory, calculating gas for this program, and then running it with gass limit that is less than the calculated gas amount by a small margin. This will ensure that the program will run out of gas during memory access. + +
+ Program to be uploaded + + ```rust + #![no_std] + + use gstd::{ + ActorId, + errors::{SignalCode, SimpleExecutionError}, + exec, + prelude::*, + msg, + }; + + static mut INITIATOR: ActorId = ActorId::zero(); + + #[no_mangle] + extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; + } + + #[no_mangle] + extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + const ARRAY_SIZE: usize = 1_000_000; + let arr = [42u8; ARRAY_SIZE]; + + for i in 0..ARRAY_SIZE { + let value = arr[i]; + } + } + + #[no_mangle] + extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::Execution(SimpleExecutionError::RanOutOfGas) { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } + } + ``` + +
+ +
+ Test + + ```rust + const USER_1: AccountId = 1; + const DEFAULT_SALT: &[u8; 4] = b"salt"; + const GAS_LIMIT: u64 = 10_000_000_000; + + #[test] + fn test_signal_run_out_of_gas_memory_access_works() { + use demo_signal_run_out_of_gas_memory_access::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Calculate gas for this action + let GasInfo { min_limit, .. } = Gear::calculate_gas_info( + USER_1.into_origin(), + HandleKind::Handle(pid), + [].into(), + 0, + true, + true, + ) + .expect("calculate_gas_info failed"); + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + min_limit - 1, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + run_to_next_block(None); + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); + } + ``` +
+ +#### Backend error + + +There are two cases of fails when this signal code is sent: +- `TrapExplanation::ForbiddenFunction` + + This case is sent when: + - One of forbidden syscalls are called. + + In this case the syscall `gr_forbidden` will be called, resulting in execution stop. As of now, the only forbidden syscall are `gas_available` while calculating gas amount, so there is no way to test this case, because the message sent from the program won't be sent while calculating gas amount. + + + - Some interactions with system actor are made: + - Sending message + - Sending message using reservation + - Replying to message + - Replying to message using reservation + - Creating a new program with System ID as Program ID + + Below is the test for sending message to the system actor. +
+ Program to be uploaded + + ```rust + #![no_std] + + use gear_core::ids::ProgramId; + use gstd::{ + ActorId, + errors::{SignalCode, SimpleExecutionError}, + exec, + prelude::*, + msg, + }; + + static mut INITIATOR: ActorId = ActorId::zero(); + + #[no_mangle] + extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; + } + + #[no_mangle] + extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + msg::send(ActorId::new(ProgramId::SYSTEM.into()), "hello", 0) + .expect("cannot send message"); + } + + #[no_mangle] + extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::Execution(SimpleExecutionError::BackendError) { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } + } + ``` + +
+ +
+ Test + + ```rust + const USER_1: AccountId = 1; + const DEFAULT_SALT: &[u8; 4] = b"salt"; + const GAS_LIMIT: u64 = 10_000_000_000; + + #[test] + fn test_signal_backend_error_system_actor_sending_works() { + use demo_signal_backend_error_system_actor_sending::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + run_to_next_block(None); + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); + } + ``` +
+ +- `TrapExplanation::UnrecoverableExt` + + This case is sent when: + - A syscall `debug` gets called with invalid string. + + This test will not work in the `release` mode until the `gstd` crate is imported into the contract code using the `debug` feature. Otherwise, the `gr_debug` syscall will be optimized out. + +
+ Program to be uploaded + + ```rust + #![no_std] + + use gstd::{ + ActorId, + debug, + errors::{SignalCode, SimpleExecutionError}, + exec, + prelude::*, + msg, + }; + + static mut INITIATOR: ActorId = ActorId::zero(); + + #[no_mangle] + extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; + } + + #[no_mangle] + extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + #[allow(clippy::invalid_utf8_in_unchecked)] + let invalid_string = unsafe { core::str::from_utf8_unchecked(&[0, 159, 146, 150]) }; + debug!("{}", invalid_string); + } + + #[no_mangle] + extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::Execution(SimpleExecutionError::BackendError) { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } + } + ``` + +
+ +
+ Test + + ```rust + const USER_1: AccountId = 1; + const DEFAULT_SALT: &[u8; 4] = b"salt"; + const GAS_LIMIT: u64 = 10_000_000_000; + + #[test] + fn test_signal_backend_error_incorrect_debug_string_works() { + use demo_signal_backend_error_incorrect_debug_string::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + run_to_next_block(None); + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); + } + ``` +
+ - Whenever `UnrecoverableExtError` happens, i.e. when `wait_up_to` called with 0 as parameter. + +
+ Program to be uploaded + + ```rust + #![no_std] + + use gstd::{ + ActorId, + errors::{SignalCode, SimpleExecutionError}, + exec, + prelude::*, + msg, + }; + + static mut INITIATOR: ActorId = ActorId::zero(); + + #[no_mangle] + extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; + } + + #[no_mangle] + extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + exec::wait_up_to(0); + } + + #[no_mangle] + extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::Execution(SimpleExecutionError::BackendError) { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } + } + ``` + +
+ +
+ Test + + ```rust + const USER_1: AccountId = 1; + const DEFAULT_SALT: &[u8; 4] = b"salt"; + const GAS_LIMIT: u64 = 10_000_000_000; + + #[test] + fn test_signal_backend_error_unrecoverable_ext_works() { + use demo_signal_backend_error_unrecoverable_ext::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + run_to_next_block(None); + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); + } + ``` +
+ + - When memory accessed out of bounds during lazy pages access. + + This case will be hard to test as there is no way to intentionally trigger lazy pages reading inside the program, so the test is not provided here. + +#### Memory overflow + + +This signal is sent when the `oom_panic` syscall gets called. This occurs when the program attempts to allocate more memory than it is allowed to, leading to `oom_panic` syscall and then to `TrapExplanation::ProgramAllocOutOfBounds` trap. To test this signal code, one can directly call the `oom_panic` syscall. + +
+Program to be uploaded + +```rust +#![no_std] + +use gstd::{ + ActorId, + errors::{SignalCode, SimpleExecutionError}, + exec, + ext::oom_panic, + prelude::*, + msg, +}; + +static mut INITIATOR: ActorId = ActorId::zero(); + +#[no_mangle] +extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; +} + +#[no_mangle] +extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + oom_panic(); +} + +#[no_mangle] +extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::Execution(SimpleExecutionError::MemoryOverflow) { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } +} +``` + +
+ +
+Test + +```rust +const USER_1: AccountId = 1; +const DEFAULT_SALT: &[u8; 4] = b"salt"; +const GAS_LIMIT: u64 = 10_000_000_000; + +#[test] +fn test_signal_memory_overflow_works() { + use demo_signal_memory_overflow::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + run_to_next_block(None); + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); +} +``` +
+ +#### Unreachable instruction + + +This signal is sent when the `TrapExplanation::Unknown` trap is triggered. This can occur when: +- There's an attempt to free memory that hasn't been allocated. + + This error gets explicitly returned when the `free` syscall gets called with number of memory page that was not allocated. To test this case, one can simply call the `free` syscall using an invalid page number. + + Since `free` syscall is not explicitly exported in any of user-space libraries, the `extern "C"` function import must be used to call it. + + For this test, `usize::MAX` is used as invalid page number. In our memory system, `0` is considered a valid page number, whereas the `usize::MAX` page number is reserved. + +
+ Program to be uploaded + + ```rust + #![no_std] + + use gstd::{ + ActorId, + errors::{SignalCode, SimpleExecutionError}, + exec, + prelude::*, + msg, + }; + + static mut INITIATOR: ActorId = ActorId::zero(); + + extern "C" { + fn free(ptr: *mut u8) -> *mut u8; + } + + #[no_mangle] + extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; + } + + #[no_mangle] + extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + unsafe { + free(usize::MAX as *mut u8); + } + } + + #[no_mangle] + extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::Execution(SimpleExecutionError::UnreachableInstruction) { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } + } + ``` + +
+ +
+ Test + + ```rust + const USER_1: AccountId = 1; + const DEFAULT_SALT: &[u8; 4] = b"salt"; + const GAS_LIMIT: u64 = 10_000_000_000; + + #[test] + fn test_signal_unreachable_instruction_incorrect_free_works() { + use demo_signal_unreachable_instruction_incorrect_free::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + run_to_next_block(None); + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); + } + ``` +
+ + +- Terminating backend with `failure` reason and failed executor. + + To test this case, a `success` termination reason must be received during a backend failure. This case cannot be triggered by the program itself, so the test is not provided here. +- Called plain `unreachable` WASM instruction. + + > Please note that `unreachable!()` Rust macro is not the same as `unreachable` WASM instruction. The Rust macro simply calls `panic!()` and will not cause this signal code to be sent. + +
+ Program to be uploaded + + ```rust + #![no_std] + + use gstd::{ + ActorId, + errors::{SignalCode, SimpleExecutionError}, + exec, + prelude::*, + msg, + }; + + static mut INITIATOR: ActorId = ActorId::zero(); + + #[no_mangle] + extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; + } + + #[no_mangle] + extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + #[cfg(target_arch = "wasm32")] + core::arch::wasm32::unreachable(); + } + + #[no_mangle] + extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::Execution(SimpleExecutionError::UnreachableInstruction) { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } + } + ``` + +
+ +
+ Test + + ```rust + const USER_1: AccountId = 1; + const DEFAULT_SALT: &[u8; 4] = b"salt"; + const GAS_LIMIT: u64 = 10_000_000_000; + + #[test] + fn test_signal_unreachable_instruction_wasm_works() { + use demo_signal_unreachable_instruction_wasm::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + run_to_next_block(None); + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); + } + ``` +
+ +### Non-execution signal codes + + +#### Removed from waitlist (`SignalCode::RemovedFromWaitlist`) + + +This signal will be sent whenever the `remove_from_waitlist` method of `TaskHandler` is called (refer to the `gear` pallet, `manager.rs`). To test this, one can trigger wait in program. Once the waiting period expires, `remove_from_waitlist` will be invoked and will result in the sending of the signal. + + +
+Program to be uploaded + +```rust +#![no_std] + +use gstd::{ + ActorId, + errors::{SignalCode, SimpleExecutionError}, + exec, + prelude::*, + msg, +}; + +static mut INITIATOR: ActorId = ActorId::zero(); + +#[no_mangle] +extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; +} + +#[no_mangle] +extern "C" fn handle() { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + exec::wait(); +} + +#[no_mangle] +extern "C" fn handle_signal() { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == SignalCode::RemovedFromWaitlist { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } +} +``` + +
+ +
+Test + +```rust +const USER_1: AccountId = 1; +const DEFAULT_SALT: &[u8; 4] = b"salt"; +const GAS_LIMIT: u64 = 10_000_000_000; + +#[test] +fn test_signal_removed_from_waitlist() { + use demo_signal_removed_from_waitlist::{WASM_BINARY}; + + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + 0.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Send the message to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + [].into(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + let mid = get_last_message_id(); + + // Ensuring that gas is reserved + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + + // Getting block number when waitlist expiration should happen + let mut expiration = None; + + System::events().iter().for_each(|e| { + if let MockRuntimeEvent::Gear(Event::MessageWaited { + expiration: exp, .. + }) = e.event + { + expiration = Some(exp); + } + }); + + let expiration = expiration.unwrap(); + + // Hack to fast spend blocks till expiration + System::set_block_number(expiration - 1); + Gear::set_block_number(expiration - 1); + + // Expiring that message + run_to_next_block(None); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); +} +``` +
diff --git a/core-errors/src/simple.rs b/core-errors/src/simple.rs index a6f87f16317..5f2ba39b816 100644 --- a/core-errors/src/simple.rs +++ b/core-errors/src/simple.rs @@ -331,6 +331,9 @@ impl SimpleProgramCreationError { )] #[cfg_attr(feature = "codec", derive(Encode, Decode, TypeInfo, Sequence), codec(crate = scale), allow(clippy::unnecessary_cast))] /// Enum representing signal code and reason of its creation. +/// +/// # Testing +/// See [this document](../signal-code-testing.md). pub enum SignalCode { /// Signal was sent due to some execution errors. #[display(fmt = "Signal message sent due to execution error ({_0})")] diff --git a/examples/signal-entry/Cargo.toml b/examples/signal-entry/Cargo.toml index 4216fab2909..4dca39ea3ef 100644 --- a/examples/signal-entry/Cargo.toml +++ b/examples/signal-entry/Cargo.toml @@ -7,8 +7,12 @@ license = "GPL-3.0" workspace = "../../" [dependencies] -gstd.workspace = true +gstd = { workspace = true, features = [ + "debug", +] } # debug is used here, because `signal_backend_error_invalid_debug_works` test in `pallet-gear` requires it to be working correctly in release mode parity-scale-codec = { workspace = true, features = ["derive"] } +gear-core.workspace = true +gsys.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/signal-entry/src/lib.rs b/examples/signal-entry/src/lib.rs index a3bd551041a..dcf9c054f97 100644 --- a/examples/signal-entry/src/lib.rs +++ b/examples/signal-entry/src/lib.rs @@ -18,6 +18,7 @@ #![cfg_attr(not(feature = "std"), no_std)] +use gstd::errors::SignalCode; use parity_scale_codec::{Decode, Encode}; #[cfg(feature = "std")] @@ -44,6 +45,15 @@ pub enum HandleAction { AcrossWaits, ZeroReserve, ForbiddenCallInSignal([u8; 32]), + ForbiddenAction, + SaveSignal(SignalCode), + ExceedMemory, + UnreachableInstruction, + InvalidDebugCall, + UnrecoverableExt, + IncorrectFree, + WaitWithoutSendingMessage, + MemoryAccess, } pub const WAIT_AND_RESERVE_WITH_PANIC_GAS: u64 = 10_000_000_000; @@ -51,9 +61,13 @@ pub const WAIT_AND_RESERVE_WITH_PANIC_GAS: u64 = 10_000_000_000; #[cfg(not(feature = "std"))] mod wasm { use super::*; + use gear_core::ids::ProgramId; use gstd::{ + debug, errors::{ExtError, ReservationError, SignalCode, SimpleExecutionError}, - exec, msg, + exec, + ext::oom_panic, + msg, prelude::*, ActorId, MessageId, }; @@ -68,6 +82,7 @@ mod wasm { Normal, Panic, ForbiddenCall([u8; 32]), + Assert(SignalCode), } #[no_mangle] @@ -187,6 +202,67 @@ mod wasm { exec::system_reserve_gas(1_000_000_000).unwrap(); exec::wait(); } + HandleAction::ForbiddenAction => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + msg::send(ActorId::new(ProgramId::SYSTEM.into()), "hello", 0) + .expect("cannot send message"); + } + HandleAction::SaveSignal(signal_received) => { + debug!("handle: signal_received={:?}", signal_received); + + unsafe { HANDLE_SIGNAL_STATE = HandleSignalState::Assert(signal_received) }; + } + HandleAction::ExceedMemory => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + oom_panic(); + } + HandleAction::UnreachableInstruction => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + #[cfg(target_arch = "wasm32")] + core::arch::wasm32::unreachable(); + } + HandleAction::InvalidDebugCall => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + #[allow(clippy::invalid_utf8_in_unchecked)] + let invalid_string = unsafe { core::str::from_utf8_unchecked(&[0, 159, 146, 150]) }; + debug!("{}", invalid_string); + } + HandleAction::UnrecoverableExt => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + exec::wait_up_to(0); + } + HandleAction::IncorrectFree => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + extern "C" { + fn free(ptr: *mut u8) -> *mut u8; + } + + unsafe { + free(usize::MAX as *mut u8); + } + } + HandleAction::WaitWithoutSendingMessage => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + exec::wait(); + } + HandleAction::MemoryAccess => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + const ARRAY_SIZE: usize = 1_000_000; + let arr = [42u8; ARRAY_SIZE]; + + #[allow(clippy::needless_range_loop)] + for i in 0..ARRAY_SIZE { + let _value = arr[i]; + } + } } } @@ -221,6 +297,17 @@ mod wasm { msg::send_bytes((*user).into(), b"handle_signal_forbidden_call", 0).unwrap(); let _ = msg::source(); } + HandleSignalState::Assert(signal_saved) => { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == *signal_saved { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } + } } } diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index f770797b74b..f5a3e04406d 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -10420,42 +10420,210 @@ fn signal_async_wait_works() { } #[test] -fn signal_gas_limit_exceeded_works() { +fn signal_run_out_of_gas_works() { + test_signal_code_works( + SimpleExecutionError::RanOutOfGas.into(), + demo_signal_entry::HandleAction::OutOfGas, + ); +} + +#[test] +fn signal_run_out_of_gas_memory_access_works() { use demo_signal_entry::{HandleAction, WASM_BINARY}; + const GAS_LIMIT: u64 = 10_000_000_000; + init_logger(); new_test_ext().execute_with(|| { + // Upload program assert_ok!(Gear::upload_program( RuntimeOrigin::signed(USER_1), WASM_BINARY.to_vec(), DEFAULT_SALT.to_vec(), USER_1.encode(), - 10_000_000_000, + GAS_LIMIT, 0, )); let pid = get_last_program_id(); - run_to_block(2, None); + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + // Save signal code to be compared with assert_ok!(Gear::send_message( RuntimeOrigin::signed(USER_1), pid, - HandleAction::OutOfGas.encode(), - 10_000_000_000, + HandleAction::SaveSignal(SimpleExecutionError::RanOutOfGas.into()).encode(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + // Calculate gas limit for this action + let GasInfo { min_limit, .. } = Gear::calculate_gas_info( + USER_1.into_origin(), + HandleKind::Handle(pid), + demo_signal_entry::HandleAction::MemoryAccess.encode(), + 0, + true, + true, + ) + .expect("calculate_gas_info failed"); + + // Send the action to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + demo_signal_entry::HandleAction::MemoryAccess.encode(), + min_limit - 1, 0, false, )); let mid = get_last_message_id(); - run_to_block(3, None); + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + + run_to_next_block(None); assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); - // check signal dispatch executed + // Ensure that signal code sent is signal code we saved let mail_msg = get_last_mail(USER_1); - assert_eq!(mail_msg.payload_bytes(), b"handle_signal"); + assert_eq!(mail_msg.payload_bytes(), true.encode()); + }); +} + +#[test] +fn signal_userspace_panic_works() { + test_signal_code_works( + SimpleExecutionError::UserspacePanic.into(), + demo_signal_entry::HandleAction::Panic, + ); +} + +#[test] +fn signal_backend_error_forbidden_action_works() { + test_signal_code_works( + SimpleExecutionError::BackendError.into(), + demo_signal_entry::HandleAction::ForbiddenAction, + ); +} + +#[test] +fn signal_backend_error_invalid_debug_works() { + test_signal_code_works( + SimpleExecutionError::BackendError.into(), + demo_signal_entry::HandleAction::InvalidDebugCall, + ); +} + +#[test] +fn signal_backend_error_unrecoverable_ext_works() { + test_signal_code_works( + SimpleExecutionError::BackendError.into(), + demo_signal_entry::HandleAction::UnrecoverableExt, + ); +} + +#[test] +fn signal_unreachable_instruction_works() { + test_signal_code_works( + SimpleExecutionError::UnreachableInstruction.into(), + demo_signal_entry::HandleAction::UnreachableInstruction, + ); +} + +#[test] +fn signal_unreachable_instruction_incorrect_free_works() { + test_signal_code_works( + SimpleExecutionError::UnreachableInstruction.into(), + demo_signal_entry::HandleAction::IncorrectFree, + ); +} + +#[test] +fn signal_memory_overflow_works() { + test_signal_code_works( + SimpleExecutionError::MemoryOverflow.into(), + demo_signal_entry::HandleAction::ExceedMemory, + ); +} + +#[test] +fn signal_removed_from_waitlist_works() { + const GAS_LIMIT: u64 = 10_000_000_000; + use demo_signal_entry::{HandleAction, WASM_BINARY}; + + init_logger(); + new_test_ext().execute_with(|| { + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + USER_1.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Save signal code to be compared with + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + HandleAction::SaveSignal(SignalCode::RemovedFromWaitlist).encode(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + // Send the action to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + HandleAction::WaitWithoutSendingMessage.encode(), + GAS_LIMIT, + 0, + false, + )); + + let mid = get_last_message_id(); + + run_to_next_block(None); + + // Ensuring that gas is reserved + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + + // Getting block number when waitlist expiration should happen + let expiration = get_waitlist_expiration(mid); + + // Hack to fast spend blocks till expiration + System::set_block_number(expiration - 1); + Gear::set_block_number(expiration - 1); + + // Expiring that message + run_to_next_block(None); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); }); } @@ -13852,14 +14020,14 @@ mod utils { }; use crate::{ mock::{run_to_next_block, Balances, Gear, System, USER_1}, - BalanceOf, BlockGasLimitOf, CurrencyOf, GasInfo, GearBank, HandleKind, ProgramStorageOf, - SentOf, + BalanceOf, BlockGasLimitOf, CurrencyOf, GasHandlerOf, GasInfo, GearBank, HandleKind, + ProgramStorageOf, SentOf, }; use common::{ event::*, paused_program_storage::SessionId, storage::{CountedByKey, Counter, IterableByKeyMap}, - Origin, ProgramStorage, + Origin, ProgramStorage, ReservableTree, }; use core::fmt::Display; use core_processor::common::ActorExecutionErrorReplyReason; @@ -14704,4 +14872,71 @@ mod utils { assert_eq!(res, assertions); } + + #[track_caller] + pub(super) fn test_signal_code_works( + signal_code: SignalCode, + action: demo_signal_entry::HandleAction, + ) { + use crate::tests::new_test_ext; + use demo_signal_entry::{HandleAction, WASM_BINARY}; + + const GAS_LIMIT: u64 = 10_000_000_000; + + init_logger(); + new_test_ext().execute_with(|| { + // Upload program + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WASM_BINARY.to_vec(), + DEFAULT_SALT.to_vec(), + USER_1.encode(), + GAS_LIMIT, + 0, + )); + + let pid = get_last_program_id(); + + run_to_next_block(None); + + // Ensure that program is uploaded and initialized correctly + assert!(Gear::is_active(pid)); + assert!(Gear::is_initialized(pid)); + + // Save signal code to be compared with + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + HandleAction::SaveSignal(signal_code).encode(), + GAS_LIMIT, + 0, + false, + )); + + run_to_next_block(None); + + // Send the action to trigger signal sending + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(USER_1), + pid, + action.encode(), + GAS_LIMIT, + 0, + false, + )); + + let mid = get_last_message_id(); + + // Assert that system reserve gas node is removed + assert_ok!(GasHandlerOf::::get_system_reserve(mid)); + + run_to_next_block(None); + + assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); + + // Ensure that signal code sent is signal code we saved + let mail_msg = get_last_mail(USER_1); + assert_eq!(mail_msg.payload_bytes(), true.encode()); + }); + } } From 32982c8154edd586a2c17320d79c491cfc1d0c4c Mon Sep 17 00:00:00 2001 From: ekovalev Date: Wed, 30 Aug 2023 09:48:03 +0300 Subject: [PATCH 105/165] chore(runtime): Adjust target inflation value (#3176) --- pallets/staking-rewards/src/inflation.rs | 126 +++++++++++------------ pallets/staking-rewards/src/lib.rs | 23 +++-- pallets/staking-rewards/src/migration.rs | 94 +++++++++++++++-- pallets/staking-rewards/src/mock.rs | 5 - pallets/staking-rewards/src/tests.rs | 51 +++++++++ runtime/vara/src/migrations.rs | 1 + 6 files changed, 215 insertions(+), 85 deletions(-) diff --git a/pallets/staking-rewards/src/inflation.rs b/pallets/staking-rewards/src/inflation.rs index 3e3cb7fc707..c91eacd5700 100644 --- a/pallets/staking-rewards/src/inflation.rs +++ b/pallets/staking-rewards/src/inflation.rs @@ -118,10 +118,10 @@ mod test { } static TTS: u128 = 10_000_000_000; - static STAKEABLE: u128 = 4_250_000_000; // 42.5% of TTS + static STAKEABLE: u128 = 4_849_000_000; // 48.49% of TTS static IDEAL_STAKE: Perquintill = Perquintill::from_percent(85); static MIN_INFLATION: Perquintill = Perquintill::from_percent(1); - static MAX_INFLATION: Perquintill = Perquintill::from_parts(57_800_000_000_000_000_u64); // 5.78% + static MAX_INFLATION: Perquintill = Perquintill::from_parts(60_000_000_000_000_000_u64); // 6.00% static FALLOFF: Perquintill = Perquintill::from_percent(2); static MAX_ROI: Perquintill = Perquintill::from_percent(30); static MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; @@ -136,26 +136,26 @@ mod test { let expected_payouts = vec![ (0, 100_000_000), - (63_750_000, 64_367_647), - (127_500_000, 28_735_294), - (184_352_941, 0), - (212_470_588, 0), - (240_588_235, 0), - (268_705_882, 0), - (296_823_529, 0), - (324_941_176, 0), - (353_058_824, 0), - (381_176_471, 0), - (409_294_118, 0), - (437_411_765, 0), - (465_529_412, 0), - (493_647_059, 0), - (521_764_706, 0), - (549_882_353, 0), - (578_000_000, 0), - (184_499_260, 0), - (114_937_500, 0), - (102_640_602, 0), + (72_735_000, 56_676_765), + (145_470_000, 13_353_529), + (188_235_294, 0), + (217_647_059, 0), + (247_058_824, 0), + (276_470_588, 0), + (305_882_353, 0), + (335_294_118, 0), + (364_705_882, 0), + (394_117_647, 0), + (423_529_412, 0), + (452_941_176, 0), + (482_352_941, 0), + (511_764_706, 0), + (541_176_471, 0), + (570_588_235, 0), + (600_000_000, 0), + (188_388_348, 0), + (115_625_000, 0), + (102_762_136, 0), ]; assert_eq!(staked.len(), expected_payouts.len()); @@ -188,26 +188,26 @@ mod test { let expected_payouts = vec![ (0, 273_785), - (174_538, 176_229), - (349_076, 78_673), - (504_731, 0), - (581_713, 0), - (658_695, 0), - (735_677, 0), - (812_659, 0), - (889_640, 0), - (966_622, 0), - (1_043_604, 0), - (1_120_586, 0), - (1_197_568, 0), - (1_274_550, 0), - (1_351_532, 0), - (1_428_514, 0), - (1_505_496, 0), - (1_582_478, 0), - (505_131, 0), - (314_682, 0), - (281_015, 0), + (199_138, 155_172), + (398_275, 36_560), + (515_360, 0), + (595_885, 0), + (676_410, 0), + (756_935, 0), + (837_460, 0), + (917_985, 0), + (998_510, 0), + (1_079_035, 0), + (1_159_560, 0), + (1_240_085, 0), + (1_320_610, 0), + (1_401_135, 0), + (1_481_660, 0), + (1_562_185, 0), + (1_642_710, 0), + (515_779, 0), + (316_564, 0), + (281_347, 0), ]; assert_eq!(staked.len(), expected_payouts.len()); @@ -239,27 +239,27 @@ mod test { .collect::>(); let expected_payouts = vec![ - (0, 45_631), - (29_090, 29_372), - (58_179, 13_112), - (84_122, 0), - (96_952, 0), - (109_782, 0), - (122_613, 0), - (135_443, 0), - (148_273, 0), - (161_104, 0), - (173_934, 0), - (186_764, 0), - (199_595, 0), - (212_425, 0), - (225_255, 0), - (238_086, 0), - (250_916, 0), - (263_746, 0), - (84_189, 0), - (52_447, 0), - (46_836, 0), + (0, 45_630), + (33_189, 25_862), + (66_379, 6_093), + (85_893, 0), + (99_314, 0), + (112_735, 0), + (126_155, 0), + (139_576, 0), + (152_997, 0), + (166_418, 0), + (179_839, 0), + (193_260, 0), + (206_680, 0), + (220_101, 0), + (233_522, 0), + (246_943, 0), + (260_364, 0), + (273_785, 0), + (85_963, 0), + (52_760, 0), + (46_891, 0), ]; assert_eq!(staked.len(), expected_payouts.len()); diff --git a/pallets/staking-rewards/src/lib.rs b/pallets/staking-rewards/src/lib.rs index 6bd166a94ea..0a93180a964 100644 --- a/pallets/staking-rewards/src/lib.rs +++ b/pallets/staking-rewards/src/lib.rs @@ -86,7 +86,7 @@ pub mod pallet { use frame_system::pallet_prelude::*; /// The current storage version. - const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); #[pallet::pallet] #[pallet::storage_version(STORAGE_VERSION)] @@ -367,19 +367,22 @@ impl OnUnbalanced> for Pallet { fn on_nonzero_unbalanced(minted: PositiveImbalanceOf) { let amount = minted.peek(); - let burned = T::Currency::withdraw( + if let Ok(burned) = T::Currency::withdraw( &Self::account_id(), amount, WithdrawReasons::TRANSFER, ExistenceRequirement::KeepAlive, - ) - .unwrap_or_else(|_| NegativeImbalanceOf::::zero()); - - // Offsetting rewards against rewards pool until the latter is not depleted. - // After that the positive imbalance is dropped adding up to the total supply. - let _ = minted.offset(burned); - - Self::deposit_event(Event::Burned { amount }); + ) { + // Offsetting rewards against rewards pool until the latter is not depleted. + // After that the positive imbalance is dropped adding up to the total supply. + let _ = minted.offset(burned); + + Self::deposit_event(Event::Burned { amount }); + } else { + log::warn!( + "Staking rewards pool has insufficient balance to burn minted rewards. The currency total supply may grow." + ); + }; } } diff --git a/pallets/staking-rewards/src/migration.rs b/pallets/staking-rewards/src/migration.rs index 32e6901fdf2..28933c1380c 100644 --- a/pallets/staking-rewards/src/migration.rs +++ b/pallets/staking-rewards/src/migration.rs @@ -16,14 +16,94 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::{Config, Pallet, Weight}; +use crate::{pallet, Config, Pallet, Weight}; +use frame_support::traits::{Get, GetStorageVersion, OnRuntimeUpgrade}; +use sp_runtime::Perquintill; +use sp_std::marker::PhantomData; +#[cfg(feature = "try-runtime")] +use sp_std::vec::Vec; -/// Wrapper for all migrations of this pallet, based on `StorageVersion`. -pub fn migrate() -> Weight { - use frame_support::traits::GetStorageVersion; +pub struct MigrateToV2(PhantomData); - let _onchain = Pallet::::on_chain_storage_version(); - let weight: Weight = Weight::zero(); +impl OnRuntimeUpgrade for MigrateToV2 { + fn on_runtime_upgrade() -> Weight { + let current = Pallet::::current_storage_version(); + let onchain = Pallet::::on_chain_storage_version(); - weight + log::info!( + "🚚 Running migration with current storage version {:?} / onchain {:?}", + current, + onchain + ); + + let mut weight = T::DbWeight::get().reads(1); // 1 read for on chain storage version. + + if current == 2 && onchain == 1 { + // Adjusted target inflation parameter: 6.00% + let adjusted_inflation: Perquintill = Perquintill::from_percent(6); + pallet::TargetInflation::::put(adjusted_inflation); + + current.put::>(); + + log::info!("Successfully migrated storage from v1 to v2"); + + // 1 write for `TargetInflation` + 1 write for `StorageVersion` + weight += T::DbWeight::get().writes(2) + } else { + log::info!("❌ Migration did not execute. This probably should be removed"); + } + + weight + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + use parity_scale_codec::Encode; + + let inflation = pallet::TargetInflation::::get(); + assert_eq!(inflation, Perquintill::from_rational(578_u64, 10_000_u64)); + Ok(inflation.encode()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(state: Vec) -> Result<(), &'static str> { + use parity_scale_codec::Decode; + + let old_inflation: Perquintill = Decode::decode(&mut &state[..]).unwrap(); + let new_inflation = pallet::TargetInflation::::get(); + assert_ne!(old_inflation, new_inflation); + assert_eq!(new_inflation, Perquintill::from_percent(6)); + Ok(()) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::mock::*; + use frame_support::traits::StorageVersion; + + #[test] + fn migrate_to_v2() { + ExtBuilder::default() + .initial_authorities(vec![(VAL_1_STASH, VAL_1_CONTROLLER, VAL_1_AUTH_ID)]) + .stash(VALIDATOR_STAKE) + .endowment(ENDOWMENT) + .target_inflation(Perquintill::from_rational(578_u64, 10_000_u64)) + .build() + .execute_with(|| { + StorageVersion::new(1).put::>(); + + let weight = MigrateToV2::::on_runtime_upgrade(); + assert_eq!( + weight, + ::DbWeight::get().reads_writes(1, 2) + ); + + assert_eq!( + pallet::TargetInflation::::get(), + Perquintill::from_percent(6), + ); + }) + } } diff --git a/pallets/staking-rewards/src/mock.rs b/pallets/staking-rewards/src/mock.rs index d257504f23c..d491261680b 100644 --- a/pallets/staking-rewards/src/mock.rs +++ b/pallets/staking-rewards/src/mock.rs @@ -612,20 +612,15 @@ pub(crate) fn run_for_n_blocks(n: u64) { // Run on_initialize hooks in order as they appear in AllPalletsWithSystem. pub(crate) fn on_initialize(new_block_number: BlockNumberFor) { - System::on_initialize(new_block_number); Timestamp::set_timestamp(new_block_number.saturating_mul(MILLISECS_PER_BLOCK)); - Balances::on_initialize(new_block_number); Authorship::on_initialize(new_block_number); Session::on_initialize(new_block_number); - Staking::on_initialize(new_block_number); } // Run on_finalize hooks (in pallets reverse order, as they appear in AllPalletsWithSystem) pub(crate) fn on_finalize(current_blk: BlockNumberFor) { Staking::on_finalize(current_blk); Authorship::on_finalize(current_blk); - Balances::on_finalize(current_blk); - System::on_finalize(current_blk); } pub fn default_test_ext() -> sp_io::TestExternalities { diff --git a/pallets/staking-rewards/src/tests.rs b/pallets/staking-rewards/src/tests.rs index 74ba782673e..e1f1a230ff7 100644 --- a/pallets/staking-rewards/src/tests.rs +++ b/pallets/staking-rewards/src/tests.rs @@ -1183,6 +1183,57 @@ fn unclaimed_rewards_burn() { }); } +#[test] +fn empty_rewards_pool_causes_inflation() { + let (target_inflation, ideal_stake, _, non_stakeable) = sensible_defaults(); + let pool_balance = 0; // empty rewards pool + let mut ext = with_parameters(target_inflation, ideal_stake, pool_balance, non_stakeable); + ext.execute_with(|| { + // Getting up-to-date data on era duration (they may differ from runtime constants) + let sessions_per_era = ::SessionsPerEra::get() as u64; + let epoch_duration = SESSION_DURATION; + let era_duration = sessions_per_era * epoch_duration; + + let (initial_total_issuance, _, _, initial_rewards_pool_balance) = chain_state(); + assert_eq!(initial_rewards_pool_balance, 0); // ED is auto-deducted by the getter function + + // Running chain until era rollover + run_to_block(era_duration + 1); + + // No payout is expected for era #0 anyway because the "official" staked amount is 0 + assert_eq!( + Staking::eras_validator_reward(0) + .expect("ErasValidatorReward storage must exist after era end; qed"), + 0 + ); + + // Running chain until the next era rollover + run_to_block(2 * era_duration + 1); + + // Claim rewards to trigger rewards minting + for era in 0_u32..2 { + pallet_staking::Validators::::iter().for_each(|(stash_id, _)| { + assert_ok!(Staking::payout_stakers( + RuntimeOrigin::signed(SIGNER), + stash_id, + era + )); + }); + } + + // Take up-to-date measurements of the chain stats + let (total_issuance, _, _, rewards_pool_balance) = chain_state(); + + // The rewards pool balance is still 0: we should have failed to offset any rewards + assert_eq!(initial_rewards_pool_balance, rewards_pool_balance); + // Staker rewards for eras 0 and 1 + let actual_rewards = Staking::eras_validator_reward(1) + .expect("ErasValidatorReward storage must exist after era end; qed"); + // Total issuance grew accordingly have changed + assert_eq!(total_issuance, initial_total_issuance + actual_rewards); + }); +} + fn sensible_defaults() -> (Perquintill, Perquintill, u128, Perquintill) { ( Perquintill::from_rational(578_u64, 10_000_u64), diff --git a/runtime/vara/src/migrations.rs b/runtime/vara/src/migrations.rs index 70cb9d3171e..cf92a300c39 100644 --- a/runtime/vara/src/migrations.rs +++ b/runtime/vara/src/migrations.rs @@ -5,4 +5,5 @@ pub type Migrations = ( pallet_gear_scheduler::migration::MigrateToV2, pallet_gear_gas::migrations::v2::MigrateToV2, pallet_gear_messenger::migrations::MigrateToV2, + pallet_gear_staking_rewards::migration::MigrateToV2, ); From a9a70e9662eea22914595e8efeaedcecfc6203c2 Mon Sep 17 00:00:00 2001 From: Georgy Shepelev Date: Wed, 30 Aug 2023 20:22:45 +0400 Subject: [PATCH 106/165] chore: Disable program rent logic (#3140) --- Cargo.lock | 1 + gsdk/src/metadata/generated.rs | 3 + pallets/airdrop/src/mock.rs | 4 +- pallets/gear-debug/Cargo.toml | 2 + pallets/gear-debug/src/mock.rs | 8 +- .../gear-debug/src/{tests.rs => tests/mod.rs} | 169 ++++++++++++++---- pallets/gear-debug/src/tests/utils.rs | 59 ++++++ pallets/gear-program/src/migration.rs | 34 ++-- pallets/gear-scheduler/src/mock.rs | 4 +- pallets/gear/src/internal.rs | 4 + pallets/gear/src/lib.rs | 33 +++- pallets/gear/src/manager/task.rs | 26 ++- pallets/gear/src/mock.rs | 2 + pallets/payment/src/mock.rs | 4 +- runtime/common/src/constants.rs | 7 + runtime/gear/src/constants.rs | 10 +- runtime/gear/src/lib.rs | 17 +- runtime/vara/src/constants.rs | 4 +- runtime/vara/src/lib.rs | 17 +- 19 files changed, 330 insertions(+), 78 deletions(-) rename pallets/gear-debug/src/{tests.rs => tests/mod.rs} (85%) create mode 100644 pallets/gear-debug/src/tests/utils.rs diff --git a/Cargo.lock b/Cargo.lock index d665b6eb0af..6e70e6aa170 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7462,6 +7462,7 @@ dependencies = [ "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", + "test-syscalls", "wabt", ] diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index 61587b0a6af..a6801edc06c 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -2714,6 +2714,9 @@ pub mod runtime_types { #[codec(index = 15)] #[doc = "Gear::run() already included in current block."] GearRunAlreadyInBlock, + #[codec(index = 16)] + #[doc = "The program rent logic is disabled."] + ProgramRentDisabled, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] diff --git a/pallets/airdrop/src/mock.rs b/pallets/airdrop/src/mock.rs index 837e63fccd5..edfcd314f3b 100644 --- a/pallets/airdrop/src/mock.rs +++ b/pallets/airdrop/src/mock.rs @@ -23,7 +23,7 @@ use frame_support::{ }; use frame_support_test::TestRandomness; use frame_system as system; -use sp_core::ConstU128; +use sp_core::{ConstBool, ConstU128}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, ConvertInto, IdentityLookup}, @@ -183,6 +183,8 @@ impl pallet_gear::Config for Test { type ProgramResumeMinimalRentPeriod = ResumeMinimalPeriod; type ProgramRentCostPerBlock = RentCostPerBlock; type ProgramResumeSessionDuration = ResumeSessionDuration; + type ProgramRentEnabled = ConstBool; + type ProgramRentDisabledDelta = RentFreePeriod; } impl pallet_gear_scheduler::Config for Test { diff --git a/pallets/gear-debug/Cargo.toml b/pallets/gear-debug/Cargo.toml index 42403487e00..b50cc788401 100644 --- a/pallets/gear-debug/Cargo.toml +++ b/pallets/gear-debug/Cargo.toml @@ -49,6 +49,7 @@ pallet-gear-scheduler = { workspace = true, features = ["std"] } pallet-gear-program = { workspace = true, features = ["debug-mode", "std"] } gear-wasm-instrument.workspace = true demo-vec.workspace = true +test-syscalls.workspace = true [features] default = ['std'] @@ -68,6 +69,7 @@ std = [ "pallet-authorship/std", "primitive-types/std", "pallet-gear/std", + "test-syscalls/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/pallets/gear-debug/src/mock.rs b/pallets/gear-debug/src/mock.rs index eca1476f51d..573ac4a31d8 100644 --- a/pallets/gear-debug/src/mock.rs +++ b/pallets/gear-debug/src/mock.rs @@ -27,7 +27,7 @@ use frame_support_test::TestRandomness; use frame_system::{self as system, limits::BlockWeights}; use pallet_gear::GasAllowanceOf; use primitive_types::H256; -use sp_core::ConstU128; +use sp_core::{ConstBool, ConstU128}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, ConstU64, IdentityLookup}, @@ -36,8 +36,8 @@ use sp_std::convert::{TryFrom, TryInto}; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; type Block = frame_system::mocking::MockBlock; -type AccountId = u64; -type BlockNumber = u64; +pub type AccountId = u64; +pub type BlockNumber = u64; type Balance = u128; pub const BLOCK_AUTHOR: AccountId = 255; @@ -171,6 +171,8 @@ impl pallet_gear::Config for Test { type ProgramResumeMinimalRentPeriod = ResumeMinimalPeriod; type ProgramRentCostPerBlock = RentCostPerBlock; type ProgramResumeSessionDuration = ResumeSessionDuration; + type ProgramRentEnabled = ConstBool; + type ProgramRentDisabledDelta = RentFreePeriod; } impl pallet_gear_messenger::Config for Test { diff --git a/pallets/gear-debug/src/tests.rs b/pallets/gear-debug/src/tests/mod.rs similarity index 85% rename from pallets/gear-debug/src/tests.rs rename to pallets/gear-debug/src/tests/mod.rs index 364135ee09b..66d5b8b57ef 100644 --- a/pallets/gear-debug/src/tests.rs +++ b/pallets/gear-debug/src/tests/mod.rs @@ -18,8 +18,13 @@ use super::*; use crate::mock::*; -use common::{self, event::MessageEntry, CodeStorage, Origin as _}; -use frame_support::assert_ok; +use common::{ + self, + event::MessageEntry, + scheduler::{ScheduledTask, TaskPool}, + ActiveProgram, CodeStorage, Origin as _, PausedProgramStorage, ProgramStorage, +}; +use frame_support::{assert_err, assert_ok}; #[cfg(feature = "lazy-pages")] use gear_core::pages::GearPage; use gear_core::{ @@ -29,32 +34,17 @@ use gear_core::{ pages::{PageNumber, PageU32Size, WasmPage}, }; use gear_wasm_instrument::STACK_END_EXPORT_NAME; -use pallet_gear::{DebugInfo, Event, Pallet as PalletGear}; +use pallet_gear::{ + DebugInfo, Event, Pallet as PalletGear, ProgramStorageOf, RentCostPerBlockOf, TaskPoolOf, +}; use parity_scale_codec::Encode; -use sp_core::H256; +use sp_core::{Get, H256}; use sp_std::collections::{btree_map::BTreeMap, btree_set::BTreeSet}; -const DEFAULT_SALT: &[u8] = b"salt"; - -pub(crate) fn init_logger() { - let _ = env_logger::Builder::from_default_env() - .format_module_path(false) - .format_level(true) - .try_init(); -} - -fn parse_wat(source: &str) -> Vec { - wabt::Wat2Wasm::new() - .validate(true) - .convert(source) - .expect("failed to parse module") - .as_ref() - .to_vec() -} +mod utils; +use utils::*; -fn h256_code_hash(code: &[u8]) -> H256 { - CodeId::generate(code).into_origin() -} +const DEFAULT_SALT: &[u8] = b"salt"; #[test] fn vec() { @@ -153,8 +143,8 @@ fn debug_mode_works() { init_logger(); new_test_ext().execute_with(|| { - let code_1 = parse_wat(wat_1); - let code_2 = parse_wat(wat_2); + let code_1 = utils::parse_wat(wat_1); + let code_2 = utils::parse_wat(wat_2); let program_id_1 = ProgramId::generate(CodeId::generate(&code_1), DEFAULT_SALT); let program_id_2 = ProgramId::generate(CodeId::generate(&code_2), DEFAULT_SALT); @@ -186,7 +176,7 @@ fn debug_mode_works() { state: crate::ProgramState::Active(crate::ProgramInfo { static_pages, persistent_pages: Default::default(), - code_hash: h256_code_hash(&code_1), + code_hash: utils::h256_code_hash(&code_1), }), }], }) @@ -216,7 +206,7 @@ fn debug_mode_works() { state: crate::ProgramState::Active(crate::ProgramInfo { static_pages, persistent_pages: Default::default(), - code_hash: h256_code_hash(&code_1), + code_hash: utils::h256_code_hash(&code_1), }), }, crate::ProgramDetails { @@ -224,7 +214,7 @@ fn debug_mode_works() { state: crate::ProgramState::Active(crate::ProgramInfo { static_pages, persistent_pages: Default::default(), - code_hash: h256_code_hash(&code_2), + code_hash: utils::h256_code_hash(&code_2), }), }, ], @@ -294,7 +284,7 @@ fn debug_mode_works() { state: crate::ProgramState::Active(crate::ProgramInfo { static_pages, persistent_pages: Default::default(), - code_hash: h256_code_hash(&code_1), + code_hash: utils::h256_code_hash(&code_1), }), }, crate::ProgramDetails { @@ -302,7 +292,7 @@ fn debug_mode_works() { state: crate::ProgramState::Active(crate::ProgramInfo { static_pages, persistent_pages: Default::default(), - code_hash: h256_code_hash(&code_2), + code_hash: utils::h256_code_hash(&code_2), }), }, ], @@ -323,7 +313,7 @@ fn debug_mode_works() { state: crate::ProgramState::Active(crate::ProgramInfo { static_pages, persistent_pages: Default::default(), - code_hash: h256_code_hash(&code_1), + code_hash: utils::h256_code_hash(&code_1), }), }, crate::ProgramDetails { @@ -331,7 +321,7 @@ fn debug_mode_works() { state: crate::ProgramState::Active(crate::ProgramInfo { static_pages, persistent_pages: Default::default(), - code_hash: h256_code_hash(&code_2), + code_hash: utils::h256_code_hash(&code_2), }), }, ], @@ -883,7 +873,7 @@ fn check_gear_stack_end() { init_logger(); new_test_ext().execute_with(|| { - let code = parse_wat(wat.as_str()); + let code = utils::parse_wat(wat.as_str()); let program_id = ProgramId::generate(CodeId::generate(&code), DEFAULT_SALT); let origin = RuntimeOrigin::signed(1); @@ -927,7 +917,7 @@ fn check_gear_stack_end() { state: crate::ProgramState::Active(crate::ProgramInfo { static_pages: 4.into(), persistent_pages, - code_hash: h256_code_hash(&code), + code_hash: utils::h256_code_hash(&code), }), }], }) @@ -935,3 +925,112 @@ fn check_gear_stack_end() { ); }) } + +#[test] +fn disabled_program_rent() { + use test_syscalls::{Kind, WASM_BINARY as TEST_SYSCALLS_BINARY}; + + assert!(!<::ProgramRentEnabled as Get>::get()); + assert!(::ProgramRentDisabledDelta::get() > 0); + + init_logger(); + new_test_ext().execute_with(|| { + let salt = b"salt".to_vec(); + let pay_rent_id = ProgramId::generate(CodeId::generate(TEST_SYSCALLS_BINARY), &salt); + + let program_value = 10_000_000; + assert_ok!(Gear::upload_program( + RuntimeOrigin::signed(1), + TEST_SYSCALLS_BINARY.to_vec(), + salt, + pay_rent_id.into_bytes().to_vec(), + 20_000_000_000, + program_value, + )); + + run_to_next_block(None); + + let old_block = utils::get_active_program(pay_rent_id).expiration_block; + + let block_count = 2_000u32; + let rent = RentCostPerBlockOf::::get() * u128::from(block_count); + let pay_rent_account_id = AccountId::from_origin(pay_rent_id.into_origin()); + let balance_before = Balances::free_balance(pay_rent_account_id); + assert_ok!(Gear::send_message( + RuntimeOrigin::signed(1), + pay_rent_id, + vec![Kind::PayProgramRent( + pay_rent_id.into_origin().into(), + rent, + None + )] + .encode(), + 20_000_000_000, + 0, + false, + )); + + run_to_next_block(None); + + assert_eq!(utils::maybe_last_message(1).unwrap().payload_bytes(), b"ok"); + + // check that syscall does nothing + assert_eq!( + old_block, + utils::get_active_program(pay_rent_id).expiration_block + ); + assert_eq!(balance_before, Balances::free_balance(pay_rent_account_id)); + + assert!(!ProgramStorageOf::::paused_program_exists( + &pay_rent_id + )); + + // extrinsic should fail + let block_count = 10_000; + assert_err!( + Gear::pay_program_rent(RuntimeOrigin::signed(2), pay_rent_id, block_count), + pallet_gear::Error::::ProgramRentDisabled + ); + + // resume extrinsic should also fail + assert_err!( + Gear::resume_session_init( + RuntimeOrigin::signed(2), + pay_rent_id, + Default::default(), + Default::default(), + ), + pallet_gear::Error::::ProgramRentDisabled + ); + assert_err!( + Gear::resume_session_push(RuntimeOrigin::signed(2), 5, Default::default(),), + pallet_gear::Error::::ProgramRentDisabled + ); + assert_err!( + Gear::resume_session_commit(RuntimeOrigin::signed(2), 5, Default::default(),), + pallet_gear::Error::::ProgramRentDisabled + ); + + let expected_block = utils::get_active_program(pay_rent_id).expiration_block; + + System::set_block_number(expected_block - 1); + Gear::set_block_number(expected_block as u32 - 1); + + run_to_next_block(None); + + assert!(!ProgramStorageOf::::paused_program_exists( + &pay_rent_id + )); + + let program = utils::get_active_program(pay_rent_id); + + assert_eq!( + expected_block + ::ProgramRentDisabledDelta::get(), + program.expiration_block + ); + assert!(TaskPoolOf::::contains( + &program.expiration_block, + &ScheduledTask::PauseProgram(pay_rent_id) + )); + }) +} diff --git a/pallets/gear-debug/src/tests/utils.rs b/pallets/gear-debug/src/tests/utils.rs new file mode 100644 index 00000000000..8cd1750e85a --- /dev/null +++ b/pallets/gear-debug/src/tests/utils.rs @@ -0,0 +1,59 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use super::*; + +pub fn init_logger() { + let _ = env_logger::Builder::from_default_env() + .format_module_path(false) + .format_level(true) + .try_init(); +} + +pub fn parse_wat(source: &str) -> Vec { + wabt::Wat2Wasm::new() + .validate(true) + .convert(source) + .expect("failed to parse module") + .as_ref() + .to_vec() +} + +pub fn h256_code_hash(code: &[u8]) -> H256 { + CodeId::generate(code).into_origin() +} + +#[track_caller] +pub fn get_active_program(program_id: ProgramId) -> ActiveProgram { + ProgramStorageOf::::get_program(program_id) + .and_then(|p| ActiveProgram::try_from(p).ok()) + .expect("program should exist") +} + +#[track_caller] +pub(super) fn maybe_last_message(account: AccountId) -> Option { + System::events() + .into_iter() + .rev() + .find_map(|e| match e.event { + RuntimeEvent::Gear(Event::UserMessageSent { message, .. }) => { + (message.destination() == account.into()).then_some(message) + } + _ => None, + }) +} diff --git a/pallets/gear-program/src/migration.rs b/pallets/gear-program/src/migration.rs index bf7c482024e..b590f86df10 100644 --- a/pallets/gear-program/src/migration.rs +++ b/pallets/gear-program/src/migration.rs @@ -72,23 +72,25 @@ impl OnRuntimeUpgrade for MigrateToV2 { |program_id, (program, _bn): (v1::Program, ::BlockNumber)| { weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1)); - let block_number = T::CurrentBlockNumber::get(); - let expiration_block = block_number.saturating_add(FREE_PERIOD.into()); - let task = ScheduledTask::PauseProgram(program_id); - TaskPoolOf::::add(expiration_block, task) - .unwrap_or_else(|e| unreachable!("Scheduling logic invalidated! {:?}", e)); - Some(match program { - v1::Program::Active(p) => Program::Active(common::ActiveProgram { - allocations: p.allocations, - pages_with_data: p.pages_with_data, - gas_reservation_map: p.gas_reservation_map, - code_hash: p.code_hash, - code_exports: p.code_exports, - static_pages: p.static_pages, - state: p.state, - expiration_block, - }), + v1::Program::Active(p) => { + let block_number = T::CurrentBlockNumber::get(); + let expiration_block = block_number.saturating_add(FREE_PERIOD.into()); + let task = ScheduledTask::PauseProgram(program_id); + TaskPoolOf::::add(expiration_block, task) + .unwrap_or_else(|e| unreachable!("Scheduling logic invalidated! {:?}", e)); + + Program::Active(common::ActiveProgram { + allocations: p.allocations, + pages_with_data: p.pages_with_data, + gas_reservation_map: p.gas_reservation_map, + code_hash: p.code_hash, + code_exports: p.code_exports, + static_pages: p.static_pages, + state: p.state, + expiration_block, + }) + } v1::Program::Exited(id) => Program::Exited(id), v1::Program::Terminated(id) => Program::Terminated(id), }) diff --git a/pallets/gear-scheduler/src/mock.rs b/pallets/gear-scheduler/src/mock.rs index e13eec3dcdf..b28e986a095 100644 --- a/pallets/gear-scheduler/src/mock.rs +++ b/pallets/gear-scheduler/src/mock.rs @@ -28,7 +28,7 @@ use frame_support::{ use frame_support_test::TestRandomness; use frame_system::{self as system, limits::BlockWeights}; use pallet_gear::GasAllowanceOf; -use sp_core::{ConstU128, H256}; +use sp_core::{ConstBool, ConstU128, H256}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, @@ -162,6 +162,8 @@ impl pallet_gear::Config for Test { type ProgramResumeMinimalRentPeriod = ResumeMinimalPeriod; type ProgramRentCostPerBlock = RentCostPerBlock; type ProgramResumeSessionDuration = ResumeSessionDuration; + type ProgramRentEnabled = ConstBool; + type ProgramRentDisabledDelta = RentFreePeriod; } impl pallet_gear_scheduler::Config for Test { diff --git a/pallets/gear/src/internal.rs b/pallets/gear/src/internal.rs index c00a5436009..3b8a04ee4cc 100644 --- a/pallets/gear/src/internal.rs +++ b/pallets/gear/src/internal.rs @@ -964,6 +964,10 @@ where from: &T::AccountId, block_count: BlockNumberFor, ) -> Result<(), DispatchError> { + if !::ProgramRentEnabled::get() { + return Ok(()); + } + let old_expiration_block = program.expiration_block; let (new_expiration_block, blocks_to_pay) = old_expiration_block .checked_add(&block_count) diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 0378c728232..7b7f7407c2a 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -109,7 +109,7 @@ pub(crate) type QueueOf = <::Messenger as Messenger>::Queue; pub(crate) type MailboxOf = <::Messenger as Messenger>::Mailbox; pub(crate) type WaitlistOf = <::Messenger as Messenger>::Waitlist; pub(crate) type MessengerCapacityOf = <::Messenger as Messenger>::Capacity; -pub(crate) type TaskPoolOf = <::Scheduler as Scheduler>::TaskPool; +pub type TaskPoolOf = <::Scheduler as Scheduler>::TaskPool; pub(crate) type FirstIncompleteTasksBlockOf = <::Scheduler as Scheduler>::FirstIncompleteTasksBlock; pub(crate) type CostsPerBlockOf = <::Scheduler as Scheduler>::CostsPerBlock; @@ -289,6 +289,15 @@ pub mod pallet { /// The amount of blocks for processing resume session. #[pallet::constant] type ProgramResumeSessionDuration: Get>; + + /// The flag determines if program rent mechanism enabled. + #[pallet::constant] + type ProgramRentEnabled: Get; + + /// The constant defines value that is added if the program + /// rent is disabled. + #[pallet::constant] + type ProgramRentDisabledDelta: Get>; } #[pallet::pallet] @@ -471,6 +480,8 @@ pub mod pallet { FailureRedeemingVoucher, /// Gear::run() already included in current block. GearRunAlreadyInBlock, + /// The program rent logic is disabled. + ProgramRentDisabled, } #[cfg(feature = "runtime-benchmarks")] @@ -1815,6 +1826,11 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; + ensure!( + ::ProgramRentEnabled::get(), + Error::::ProgramRentDisabled, + ); + ProgramStorageOf::::update_active_program( program_id, |program| -> Result<(), Error> { @@ -1844,6 +1860,11 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; + ensure!( + ::ProgramRentEnabled::get(), + Error::::ProgramRentDisabled + ); + let session_end_block = Self::block_number().saturating_add(ResumeSessionDurationOf::::get()); let session_id = ProgramStorageOf::::resume_session_init( @@ -1884,6 +1905,11 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; + ensure!( + ::ProgramRentEnabled::get(), + Error::::ProgramRentDisabled + ); + ProgramStorageOf::::resume_session_push(session_id, who, memory_pages)?; Ok(().into()) @@ -1905,6 +1931,11 @@ pub mod pallet { ) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; + ensure!( + ::ProgramRentEnabled::get(), + Error::::ProgramRentDisabled + ); + ensure!( block_count >= ResumeMinimalPeriodOf::::get(), Error::::ResumePeriodLessThanMinimal diff --git a/pallets/gear/src/manager/task.rs b/pallets/gear/src/manager/task.rs index af518386f67..41a399265f2 100644 --- a/pallets/gear/src/manager/task.rs +++ b/pallets/gear/src/manager/task.rs @@ -18,7 +18,7 @@ use crate::{ manager::ExtManager, Config, DispatchStashOf, Event, Pallet, ProgramStorageOf, QueueOf, - WaitlistOf, + TaskPoolOf, WaitlistOf, }; use alloc::string::ToString; use common::{ @@ -36,13 +36,35 @@ use gear_core::{ message::{DispatchKind, ReplyMessage}, }; use gear_core_errors::{ErrorReplyReason, SignalCode}; +use sp_core::Get; +use sp_runtime::Saturating; impl TaskHandler for ExtManager where T::AccountId: Origin, { fn pause_program(&mut self, program_id: ProgramId) { - log::debug!("pause_program; id = {:?}", program_id); + if !::ProgramRentEnabled::get() { + log::debug!("Program rent logic is disabled."); + + let expiration_block = + ProgramStorageOf::::update_active_program(program_id, |program| { + program.expiration_block = program + .expiration_block + .saturating_add(::ProgramRentDisabledDelta::get()); + + program.expiration_block + }) + .unwrap_or_else(|e| { + unreachable!("PauseProgram task executes only for an active program: {e:?}.") + }); + + let task = ScheduledTask::PauseProgram(program_id); + TaskPoolOf::::add(expiration_block, task) + .unwrap_or_else(|e| unreachable!("Scheduling logic invalidated! {:?}", e)); + + return; + } let program = ProgramStorageOf::::get_program(program_id) .unwrap_or_else(|| unreachable!("Program to pause not found.")); diff --git a/pallets/gear/src/mock.rs b/pallets/gear/src/mock.rs index 38ec31a3144..416861336c1 100644 --- a/pallets/gear/src/mock.rs +++ b/pallets/gear/src/mock.rs @@ -237,6 +237,8 @@ impl pallet_gear::Config for Test { type ProgramResumeMinimalRentPeriod = ResumeMinimalPeriod; type ProgramRentCostPerBlock = RentCostPerBlock; type ProgramResumeSessionDuration = ResumeSessionDuration; + type ProgramRentEnabled = ConstBool; + type ProgramRentDisabledDelta = RentFreePeriod; } impl pallet_gear_scheduler::Config for Test { diff --git a/pallets/payment/src/mock.rs b/pallets/payment/src/mock.rs index b72f8a6bb4b..3cc35c361b9 100644 --- a/pallets/payment/src/mock.rs +++ b/pallets/payment/src/mock.rs @@ -32,7 +32,7 @@ use pallet_transaction_payment::CurrencyAdapter; use primitive_types::H256; use sp_runtime::{ testing::{Header, TestXt}, - traits::{BlakeTwo256, ConstU64, IdentityLookup}, + traits::{BlakeTwo256, ConstBool, ConstU64, IdentityLookup}, }; use sp_std::{ convert::{TryFrom, TryInto}, @@ -208,6 +208,8 @@ impl pallet_gear::Config for Test { type ProgramResumeMinimalRentPeriod = ResumeMinimalPeriod; type ProgramRentCostPerBlock = RentCostPerBlock; type ProgramResumeSessionDuration = ResumeSessionDuration; + type ProgramRentEnabled = ConstBool; + type ProgramRentDisabledDelta = RentFreePeriod; } impl pallet_gear_program::Config for Test { diff --git a/runtime/common/src/constants.rs b/runtime/common/src/constants.rs index b585d59bc23..1efc6972680 100644 --- a/runtime/common/src/constants.rs +++ b/runtime/common/src/constants.rs @@ -35,3 +35,10 @@ pub const RESUME_SESSION_DURATION_HOUR_FACTOR: BlockNumber = 1; /// Address of bank account represented as 32 bytes. pub const BANK_ADDRESS: [u8; 32] = *b"gearbankgearbankgearbankgearbank"; + +/// The free of charge period of rent represented as a factor of months. +pub const RENT_FREE_PERIOD_MONTH_FACTOR: BlockNumber = 6; + +/// The amount of blocks on which tasks of pausing program shifted +/// in a case of disabled program rent logic, represented as a factor of weeks. +pub const RENT_DISABLED_DELTA_WEEK_FACTOR: BlockNumber = 1; diff --git a/runtime/gear/src/constants.rs b/runtime/gear/src/constants.rs index dc62ebd44b9..35c4873d511 100644 --- a/runtime/gear/src/constants.rs +++ b/runtime/gear/src/constants.rs @@ -64,6 +64,7 @@ pub mod time { pub const HOURS: BlockNumber = MINUTES * 60; pub const DAYS: BlockNumber = HOURS * 24; pub const WEEKS: BlockNumber = DAYS * 7; + pub const MONTHS: BlockNumber = WEEKS * 4; // NOTE: Currently it is not possible to change the epoch duration after the chain has started. // Attempting to do so will brick block production. @@ -71,13 +72,4 @@ pub mod time { // 1 in 4 blocks (on average, not counting collisions) will be primary BABE blocks. pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); - - // The free of charge period of rent. - pub const RENT_FREE_PERIOD: BlockNumber = pallet_gear_program::migration::FREE_PERIOD; - - // The minimal amount of blocks to resume. - pub const RENT_RESUME_PERIOD: BlockNumber = 86_400; - - // The amount of blocks for processing resume session. - pub const RESUME_SESSION_DURATION: BlockNumber = 21_600; } diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index af2ce7c48ca..980b0ccfdb7 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -56,7 +56,10 @@ use pallet_grandpa::{ pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier}; use runtime_common::constants::BANK_ADDRESS; pub use runtime_common::{ - constants::{RENT_RESUME_WEEK_FACTOR, RESUME_SESSION_DURATION_HOUR_FACTOR}, + constants::{ + RENT_DISABLED_DELTA_WEEK_FACTOR, RENT_FREE_PERIOD_MONTH_FACTOR, RENT_RESUME_WEEK_FACTOR, + RESUME_SESSION_DURATION_HOUR_FACTOR, + }, impl_runtime_apis_plus_common, BlockHashCount, DealWithFees, GasConverter, AVERAGE_ON_INITIALIZE_RATIO, GAS_LIMIT_MIN_PERCENTAGE_NUM, NORMAL_DISPATCH_RATIO, VALUE_PER_GAS, @@ -64,7 +67,7 @@ pub use runtime_common::{ pub use runtime_primitives::{AccountId, Signature}; use runtime_primitives::{Balance, BlockNumber, Hash, Index, Moment}; use sp_api::impl_runtime_apis; -use sp_core::{crypto::KeyTypeId, ConstU64, OpaqueMetadata, H256}; +use sp_core::{crypto::KeyTypeId, ConstBool, ConstU64, OpaqueMetadata, H256}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, NumberFor, OpaqueKeys}, @@ -478,10 +481,18 @@ impl pallet_gear::Config for Runtime { type Scheduler = GearScheduler; type QueueRunner = Gear; type Voucher = GearVoucher; - type ProgramRentFreePeriod = ConstU32; + type ProgramRentFreePeriod = ConstU32<{ MONTHS * RENT_FREE_PERIOD_MONTH_FACTOR }>; type ProgramResumeMinimalRentPeriod = ConstU32<{ WEEKS * RENT_RESUME_WEEK_FACTOR }>; type ProgramRentCostPerBlock = ConstU128; type ProgramResumeSessionDuration = ConstU32<{ HOURS * RESUME_SESSION_DURATION_HOUR_FACTOR }>; + + #[cfg(feature = "runtime-benchmarks")] + type ProgramRentEnabled = ConstBool; + + #[cfg(not(feature = "runtime-benchmarks"))] + type ProgramRentEnabled = ConstBool; + + type ProgramRentDisabledDelta = ConstU32<{ WEEKS * RENT_DISABLED_DELTA_WEEK_FACTOR }>; } #[cfg(feature = "debug-mode")] diff --git a/runtime/vara/src/constants.rs b/runtime/vara/src/constants.rs index 4d5b4ccff03..75f273a42ee 100644 --- a/runtime/vara/src/constants.rs +++ b/runtime/vara/src/constants.rs @@ -75,6 +75,7 @@ pub mod time { pub const HOURS: BlockNumber = MINUTES * 60; pub const DAYS: BlockNumber = HOURS * 24; pub const WEEKS: BlockNumber = DAYS * 7; + pub const MONTHS: BlockNumber = WEEKS * 4; // NOTE: Currently it is not possible to change the epoch duration after the chain has started. // Attempting to do so will brick block production. @@ -87,7 +88,4 @@ pub mod time { // 1 in 4 blocks (on average, not counting collisions) will be primary BABE blocks. pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); - - // The free of charge period of rent. - pub const RENT_FREE_PERIOD: BlockNumber = pallet_gear_program::migration::FREE_PERIOD; } diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index e72c4f703ad..0e7b4d9e2f6 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -66,7 +66,10 @@ pub use pallet_timestamp::Call as TimestampCall; pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier}; use runtime_common::constants::BANK_ADDRESS; pub use runtime_common::{ - constants::{RENT_RESUME_WEEK_FACTOR, RESUME_SESSION_DURATION_HOUR_FACTOR}, + constants::{ + RENT_DISABLED_DELTA_WEEK_FACTOR, RENT_FREE_PERIOD_MONTH_FACTOR, RENT_RESUME_WEEK_FACTOR, + RESUME_SESSION_DURATION_HOUR_FACTOR, + }, impl_runtime_apis_plus_common, BlockHashCount, DealWithFees, GasConverter, AVERAGE_ON_INITIALIZE_RATIO, GAS_LIMIT_MIN_PERCENTAGE_NUM, NORMAL_DISPATCH_RATIO, VALUE_PER_GAS, @@ -74,7 +77,7 @@ pub use runtime_common::{ pub use runtime_primitives::{AccountId, Signature}; use runtime_primitives::{Balance, BlockNumber, Hash, Index, Moment}; use sp_api::impl_runtime_apis; -use sp_core::{crypto::KeyTypeId, ConstU64, OpaqueMetadata, H256}; +use sp_core::{crypto::KeyTypeId, ConstBool, ConstU64, OpaqueMetadata, H256}; use sp_runtime::{ create_runtime_str, generic, impl_opaque_keys, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, NumberFor, OpaqueKeys}, @@ -974,10 +977,18 @@ impl pallet_gear::Config for Runtime { type Scheduler = GearScheduler; type QueueRunner = Gear; type Voucher = GearVoucher; - type ProgramRentFreePeriod = ConstU32; + type ProgramRentFreePeriod = ConstU32<{ MONTHS * RENT_FREE_PERIOD_MONTH_FACTOR }>; type ProgramResumeMinimalRentPeriod = ConstU32<{ WEEKS * RENT_RESUME_WEEK_FACTOR }>; type ProgramRentCostPerBlock = ConstU128; type ProgramResumeSessionDuration = ConstU32<{ HOURS * RESUME_SESSION_DURATION_HOUR_FACTOR }>; + + #[cfg(feature = "runtime-benchmarks")] + type ProgramRentEnabled = ConstBool; + + #[cfg(not(feature = "runtime-benchmarks"))] + type ProgramRentEnabled = ConstBool; + + type ProgramRentDisabledDelta = ConstU32<{ WEEKS * RENT_DISABLED_DELTA_WEEK_FACTOR }>; } #[cfg(feature = "debug-mode")] From 9103e6f5bc459cb3bae4ba13851a29f79ddc7d7c Mon Sep 17 00:00:00 2001 From: mertwole <33563701+mertwole@users.noreply.github.com> Date: Thu, 31 Aug 2023 15:48:40 +0400 Subject: [PATCH 107/165] feat(wasm-gen): generate instructions handling fallible sys-calls results (#3114) --- Cargo.lock | 4 + core-processor/Cargo.toml | 1 + core-processor/src/ext.rs | 89 +++---- utils/wasm-gen/Cargo.toml | 5 + utils/wasm-gen/src/config.rs | 24 +- utils/wasm-gen/src/config/module.rs | 39 +-- utils/wasm-gen/src/config/syscalls.rs | 16 +- utils/wasm-gen/src/config/syscalls/param.rs | 48 +++- utils/wasm-gen/src/generator/syscalls.rs | 68 ++++++ .../src/generator/syscalls/imports.rs | 42 +++- .../src/generator/syscalls/invocator.rs | 226 ++++++++++++++---- utils/wasm-gen/src/tests.rs | 164 ++++++++++++- 12 files changed, 605 insertions(+), 121 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6e70e6aa170..03f8a5c479b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4405,7 +4405,10 @@ name = "gear-wasm-gen" version = "0.1.0" dependencies = [ "arbitrary", + "gear-backend-common", + "gear-backend-sandbox", "gear-core", + "gear-core-processor", "gear-utils", "gear-wasm-instrument", "gsys", @@ -4413,6 +4416,7 @@ dependencies = [ "log", "proptest", "rand 0.8.5", + "static_assertions", "wasm-smith", "wasmparser-nostd 0.100.1", "wasmprinter", diff --git a/core-processor/Cargo.toml b/core-processor/Cargo.toml index 179e98ee664..7230e40a335 100644 --- a/core-processor/Cargo.toml +++ b/core-processor/Cargo.toml @@ -29,3 +29,4 @@ enum-iterator.workspace = true [features] strict = [] +mock = [] \ No newline at end of file diff --git a/core-processor/src/ext.rs b/core-processor/src/ext.rs index 607e7fa957e..923cdab2ecb 100644 --- a/core-processor/src/ext.rs +++ b/core-processor/src/ext.rs @@ -43,8 +43,8 @@ use gear_core::{ NoopGrowHandler, PageBuf, }, message::{ - ContextOutcomeDrain, GasLimit, HandlePacket, InitPacket, MessageContext, Packet, - ReplyPacket, + ContextOutcomeDrain, ContextSettings, GasLimit, HandlePacket, IncomingDispatch, InitPacket, + MessageContext, Packet, ReplyPacket, }, pages::{GearPage, PageU32Size, WasmPage}, reservation::GasReserver, @@ -106,6 +106,50 @@ pub struct ProcessorContext { pub rent_cost: u128, } +#[cfg(any(feature = "mock", test))] +impl ProcessorContext { + /// Create new mock [`ProcessorContext`] for usage in tests. + pub fn new_mock() -> ProcessorContext { + ProcessorContext { + gas_counter: GasCounter::new(0), + gas_allowance_counter: GasAllowanceCounter::new(0), + gas_reserver: GasReserver::new( + &::default(), + Default::default(), + Default::default(), + ), + system_reservation: None, + value_counter: ValueCounter::new(0), + allocations_context: AllocationsContext::new( + Default::default(), + Default::default(), + Default::default(), + ), + message_context: MessageContext::new( + Default::default(), + Default::default(), + ContextSettings::new(0, 0, 0, 0, 0, 0), + ), + block_info: Default::default(), + max_pages: 512.into(), + page_costs: Default::default(), + existential_deposit: 0, + program_id: Default::default(), + program_candidates_data: Default::default(), + program_rents: Default::default(), + host_fn_weights: Default::default(), + forbidden_funcs: Default::default(), + mailbox_threshold: 0, + waitlist_cost: 0, + dispatch_hold_cost: 0, + reserve_for: 0, + reservation: 0, + random_data: ([0u8; 32].to_vec(), 0), + rent_cost: 0, + } + } +} + /// Trait to which ext must have to work in processor wasm executor. /// Currently used only for lazy-pages support. pub trait ProcessorExternalities { @@ -1127,45 +1171,10 @@ mod tests { impl ProcessorContextBuilder { fn new() -> Self { - let default_pc = ProcessorContext { - gas_counter: GasCounter::new(0), - gas_allowance_counter: GasAllowanceCounter::new(0), - gas_reserver: GasReserver::new( - &::default(), - Default::default(), - Default::default(), - ), - system_reservation: None, - value_counter: ValueCounter::new(0), - allocations_context: AllocationsContext::new( - Default::default(), - Default::default(), - Default::default(), - ), - message_context: MessageContext::new( - Default::default(), - Default::default(), - ContextSettings::new(0, 0, 0, 0, 0, 0), - ), - block_info: Default::default(), - max_pages: 512.into(), + Self(ProcessorContext { page_costs: PageCosts::new_for_tests(), - existential_deposit: 0, - program_id: Default::default(), - program_candidates_data: Default::default(), - program_rents: Default::default(), - host_fn_weights: Default::default(), - forbidden_funcs: Default::default(), - mailbox_threshold: 0, - waitlist_cost: 0, - dispatch_hold_cost: 0, - reserve_for: 0, - reservation: 0, - random_data: ([0u8; 32].to_vec(), 0), - rent_cost: 0, - }; - - Self(default_pc) + ..ProcessorContext::new_mock() + }) } fn build(self) -> ProcessorContext { diff --git a/utils/wasm-gen/Cargo.toml b/utils/wasm-gen/Cargo.toml index 1f59ba47d9a..5d16b4f2efc 100644 --- a/utils/wasm-gen/Cargo.toml +++ b/utils/wasm-gen/Cargo.toml @@ -15,9 +15,14 @@ gsys.workspace = true gear-utils.workspace = true gear-core.workspace = true wasmparser.workspace = true +static_assertions.workspace = true [dev-dependencies] rand = { workspace = true, features = ["small_rng"] } wat.workspace = true indicatif.workspace = true proptest.workspace = true + +gear-backend-sandbox = { workspace = true, features = ["std"] } +gear-backend-common = { workspace = true, features = ["mock"] } +gear-core-processor = { workspace = true, features = ["mock"] } diff --git a/utils/wasm-gen/src/config.rs b/utils/wasm-gen/src/config.rs index 242470bcfff..e07b62de0e7 100644 --- a/utils/wasm-gen/src/config.rs +++ b/utils/wasm-gen/src/config.rs @@ -26,7 +26,21 @@ //! use arbitrary::{Arbitrary, Result, Unstructured}; //! //! fn my_config<'a>(u: &'a mut Unstructured<'a>) -> Result { -//! let selectable_params = SelectableParams { call_indirect_enabled: false }; +//! let selectable_params = SelectableParams { +//! call_indirect_enabled: false, +//! allowed_instructions: vec![ +//! InstructionKind::Numeric, +//! InstructionKind::Reference, +//! InstructionKind::Parametric, +//! InstructionKind::Variable, +//! InstructionKind::Table, +//! InstructionKind::Memory, +//! InstructionKind::Control, +//! ], +//! max_instructions: 100_000, +//! min_funcs: 15, +//! max_funcs: 30 +//! }; //! let arbitrary = ArbitraryParams::arbitrary(u)?; //! Ok((selectable_params, arbitrary).into()) //! } @@ -107,6 +121,13 @@ impl ConfigsBundle for () { } } +/// The fully controllable implementation of ConfigsBundle. +impl ConfigsBundle for (GearWasmGeneratorConfig, SelectableParams) { + fn into_parts(self) -> (GearWasmGeneratorConfig, SelectableParams) { + self + } +} + /// Standard set of configurational data which is used to generate always /// valid gear-wasm using generators of the current crate. #[derive(Debug, Clone)] @@ -154,6 +175,7 @@ impl> ConfigsBundle for StandardGearWasmConfigsBundle { let selectable_params = SelectableParams { call_indirect_enabled, + ..SelectableParams::default() }; let mut sys_calls_config_builder = SysCallsConfigBuilder::new(injection_amounts); diff --git a/utils/wasm-gen/src/config/module.rs b/utils/wasm-gen/src/config/module.rs index 34c716871d3..7b0323deed4 100644 --- a/utils/wasm-gen/src/config/module.rs +++ b/utils/wasm-gen/src/config/module.rs @@ -24,6 +24,7 @@ //! and [`ConstantParams`]. use arbitrary::{Arbitrary, Result, Unstructured}; +pub use wasm_smith::InstructionKind; use wasm_smith::{InstructionKind::*, InstructionKinds, SwarmConfig}; /// Wasm module generation config. @@ -58,13 +59,11 @@ impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { exceptions_enabled, max_exports, max_imports, - max_instructions, max_memories, min_memories, max_tables, memory64_enabled, min_exports, - max_funcs, min_imports, multi_value_enabled, reference_types_enabled, @@ -73,9 +72,7 @@ impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { sign_extension_enabled, simd_enabled, float_enabled, - allowed_instructions, memory_grow_enabled, - min_funcs, max_data_segments, min_data_segments, max_types, @@ -84,6 +81,10 @@ impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { let SelectableParams { call_indirect_enabled, + allowed_instructions, + max_instructions, + min_funcs, + max_funcs, } = selectable_params; let ArbitraryParams { @@ -115,6 +116,8 @@ impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { max_memory_pages, } = arbitrary_params; + let allowed_instructions = InstructionKinds::new(&allowed_instructions); + Self(SwarmConfig { allow_start_export, available_imports, @@ -284,14 +287,12 @@ pub struct ConstantParams { max_exports: usize, max_imports: usize, max_types: usize, - max_instructions: usize, max_memories: usize, min_memories: u32, max_tables: usize, memory64_enabled: bool, min_exports: usize, min_data_segments: usize, - max_funcs: usize, min_imports: usize, multi_value_enabled: bool, reference_types_enabled: bool, @@ -300,18 +301,13 @@ pub struct ConstantParams { sign_extension_enabled: bool, simd_enabled: bool, float_enabled: bool, - allowed_instructions: InstructionKinds, memory_grow_enabled: bool, - min_funcs: usize, min_types: usize, } impl Default for ConstantParams { fn default() -> Self { ConstantParams { - allowed_instructions: InstructionKinds::new(&[ - Numeric, Reference, Parametric, Variable, Table, Memory, Control, - ]), bulk_memory_enabled: false, sign_extension_enabled: false, saturating_float_to_int_enabled: false, @@ -332,9 +328,6 @@ impl Default for ConstantParams { max_exports: 0, min_imports: 0, max_imports: 0, - max_instructions: 100_000, - min_funcs: 15, - max_funcs: 30, max_data_segments: 0, min_data_segments: 0, max_types: 100, @@ -349,12 +342,30 @@ pub struct SelectableParams { /// Flag signalizing whether `call_indirect` instruction /// must be used or not. pub call_indirect_enabled: bool, + /// Set of [`InstructionKind`], that are allowed to + /// be generated by `wasm-gen`. + pub allowed_instructions: Vec, + /// Maximum amount of instructions that `wasm-gen` + /// can generate before inserting syscalls. + pub max_instructions: usize, + /// Minimum amount of functions `wasm-gen` will insert + /// into generated wasm. + pub min_funcs: usize, + /// Maximum amount of functions `wasm-gen` will insert + /// into generated wasm. + pub max_funcs: usize, } impl Default for SelectableParams { fn default() -> Self { Self { call_indirect_enabled: true, + allowed_instructions: vec![ + Numeric, Reference, Parametric, Variable, Table, Memory, Control, + ], + max_instructions: 100_000, + min_funcs: 15, + max_funcs: 30, } } } diff --git a/utils/wasm-gen/src/config/syscalls.rs b/utils/wasm-gen/src/config/syscalls.rs index d79b95480f0..3dbc167e8a6 100644 --- a/utils/wasm-gen/src/config/syscalls.rs +++ b/utils/wasm-gen/src/config/syscalls.rs @@ -40,6 +40,7 @@ impl SysCallsConfigBuilder { injection_amounts, params_config: SysCallsParamsConfig::default(), sending_message_destination: MessageDestination::default(), + ignore_fallible_syscall_errors: true, log_info: None, }) } @@ -83,6 +84,13 @@ impl SysCallsConfigBuilder { self } + /// Enable/disable processing of errors returned from fallible syscalls. + pub fn set_ignore_fallible_syscall_errors(mut self, ignore: bool) -> Self { + self.0.ignore_fallible_syscall_errors = ignore; + + self + } + fn enable_sys_call(&mut self, name: SysCallName) { let range = self.0.injection_amounts.get(name); @@ -105,6 +113,7 @@ pub struct SysCallsConfig { injection_amounts: SysCallsInjectionAmounts, params_config: SysCallsParamsConfig, sending_message_destination: MessageDestination, + ignore_fallible_syscall_errors: bool, log_info: Option, } @@ -128,10 +137,15 @@ impl SysCallsConfig { self.log_info.as_ref() } - /// Gen sys-calls params config. + /// Get sys-calls params config. pub fn params_config(&self) -> &SysCallsParamsConfig { &self.params_config } + + /// Should we ignore error processing of fallible syscalls? + pub fn ignore_fallible_syscall_errors(&self) -> bool { + self.ignore_fallible_syscall_errors + } } /// Message destination choice. diff --git a/utils/wasm-gen/src/config/syscalls/param.rs b/utils/wasm-gen/src/config/syscalls/param.rs index 69826b9550f..81b94c3e90b 100644 --- a/utils/wasm-gen/src/config/syscalls/param.rs +++ b/utils/wasm-gen/src/config/syscalls/param.rs @@ -29,10 +29,38 @@ use std::{collections::HashMap, ops::RangeInclusive}; /// This is basically a map, which creates a relationship between each kind of /// param, that a sys-call can have, and allowed values ("rules") for each of /// the params. +/// +/// # Note: +/// +/// Configs with some [`ParamType`] variants will not be applied, as we select +/// values for all memory-related operations in accordance to generated WASM +/// module parameters: +/// - [`ParamType::Alloc`] and [`ParamType::Ptr`] will always be ignored. +/// - [`ParamType::Size`] will be ignored when it means length of some in-memory +/// array. #[derive(Debug, Clone)] pub struct SysCallsParamsConfig(HashMap); impl SysCallsParamsConfig { + /// New [`SysCallsParamsConfig`] with all rules set to produce one constant value. + pub fn all_constant_value(value: i64) -> Self { + let allowed_values: SysCallParamAllowedValues = (value..=value).into(); + Self( + [ + ParamType::Size, + ParamType::Gas, + ParamType::MessagePosition, + ParamType::Duration, + ParamType::Delay, + ParamType::Handler, + ParamType::Free, + ] + .into_iter() + .map(|param_type| (param_type, allowed_values.clone())) + .collect(), + ) + } + /// Get allowed values for the `param`. pub fn get_rule(&self, param: &ParamType) -> Option { self.0.get(param).cloned() @@ -40,6 +68,9 @@ impl SysCallsParamsConfig { /// Set allowed values for the `param`. pub fn add_rule(&mut self, param: ParamType, allowed_values: SysCallParamAllowedValues) { + matches!(param, ParamType::Ptr(..)) + .then(|| panic!("ParamType::Ptr(..) isn't supported in SysCallsParamsConfig")); + self.0.insert(param, allowed_values); } } @@ -49,19 +80,16 @@ impl Default for SysCallsParamsConfig { Self( [ (ParamType::Size, (0..=0x10000).into()), - // There are no rules for memory arrays as they are chose in accordance - // to memory pages config. - (ParamType::Ptr(None), (0..=513 * 0x10000 - 1).into()), + // There are no rules for memory arrays and pointers as they are chosen + // in accordance to memory pages config. (ParamType::Gas, (0..=250_000_000_000).into()), (ParamType::MessagePosition, (0..=10).into()), (ParamType::Duration, (1..=8).into()), (ParamType::Delay, (0..=4).into()), (ParamType::Handler, (0..=100).into()), - (ParamType::Alloc, (0..=512).into()), (ParamType::Free, (0..=512).into()), ] - .iter() - .cloned() + .into_iter() .collect(), ) } @@ -85,6 +113,14 @@ impl SysCallParamAllowedValues { pub fn zero() -> Self { Self(0..=0) } + + /// Constant param value. + /// + /// That means that for particular param `value` will be always + /// it's value. + pub fn constant(value: i64) -> Self { + Self(value..=value) + } } impl Default for SysCallParamAllowedValues { diff --git a/utils/wasm-gen/src/generator/syscalls.rs b/utils/wasm-gen/src/generator/syscalls.rs index 8bdb22d6694..f285968db21 100644 --- a/utils/wasm-gen/src/generator/syscalls.rs +++ b/utils/wasm-gen/src/generator/syscalls.rs @@ -82,9 +82,77 @@ impl InvocableSysCall { ParamType::Delay, // Number of blocks to delay the sending for ParamType::Gas, // Amount of gas to reserve ParamType::Duration, // Duration of the reservation + ParamType::Ptr(None), // Address of error returned ]), _ => unimplemented!(), }, } } + + // If syscall changes from fallible into infallible or vice versa in future, + // we'll see it by analyzing code coverage stats produced by fuzzer. + pub(crate) fn is_fallible(&self) -> bool { + let underlying_syscall = match *self { + Self::Loose(sc) => sc, + Self::Precise(sc) => sc, + }; + + match underlying_syscall { + SysCallName::BlockHeight + | SysCallName::BlockTimestamp + | SysCallName::Debug + | SysCallName::Panic + | SysCallName::OomPanic + | SysCallName::Exit + | SysCallName::GasAvailable + | SysCallName::Leave + | SysCallName::MessageId + | SysCallName::ProgramId + | SysCallName::Random + | SysCallName::Size + | SysCallName::Source + | SysCallName::ValueAvailable + | SysCallName::Value + | SysCallName::WaitFor + | SysCallName::WaitUpTo + | SysCallName::Wait + | SysCallName::Alloc + | SysCallName::Free + | SysCallName::OutOfGas => false, + SysCallName::CreateProgramWGas + | SysCallName::CreateProgram + | SysCallName::ReplyDeposit + | SysCallName::ReplyCode + | SysCallName::SignalCode + | SysCallName::PayProgramRent + | SysCallName::Read + | SysCallName::ReplyCommitWGas + | SysCallName::ReplyCommit + | SysCallName::ReplyPush + | SysCallName::ReplyPushInput + | SysCallName::ReplyTo + | SysCallName::SignalFrom + | SysCallName::ReplyInputWGas + | SysCallName::ReplyWGas + | SysCallName::Reply + | SysCallName::ReplyInput + | SysCallName::ReservationReplyCommit + | SysCallName::ReservationReply + | SysCallName::ReservationSendCommit + | SysCallName::ReservationSend + | SysCallName::ReserveGas + | SysCallName::SendCommitWGas + | SysCallName::SendCommit + | SysCallName::SendInit + | SysCallName::SendPush + | SysCallName::SendPushInput + | SysCallName::SendInputWGas + | SysCallName::SendWGas + | SysCallName::Send + | SysCallName::SendInput + | SysCallName::SystemReserveGas + | SysCallName::UnreserveGas + | SysCallName::Wake => true, + } + } } diff --git a/utils/wasm-gen/src/generator/syscalls/imports.rs b/utils/wasm-gen/src/generator/syscalls/imports.rs index 6cfd6620697..7ba7a55adcc 100644 --- a/utils/wasm-gen/src/generator/syscalls/imports.rs +++ b/utils/wasm-gen/src/generator/syscalls/imports.rs @@ -34,7 +34,7 @@ use gear_wasm_instrument::{ }, syscalls::SysCallName, }; -use gsys::{ErrorWithHash, HashWithValue, Length}; +use gsys::Hash; use std::{collections::BTreeMap, mem}; /// Gear sys-calls imports generator. @@ -335,28 +335,44 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { .into(); initial_mem_size.memory_size() }; + // subtract to be sure we are in memory boundaries. - let reserve_gas_result_ptr = memory_size_in_bytes.saturating_sub(100) as i32; - let rid_pid_value_ptr = reserve_gas_result_ptr + mem::size_of::() as i32; - let pid_value_ptr = reserve_gas_result_ptr + mem::size_of::() as i32; - let reservation_send_result_ptr = pid_value_ptr + mem::size_of::() as i32; + let rid_pid_value_ptr = memory_size_in_bytes.saturating_sub(100) as i32; + let pid_value_ptr = rid_pid_value_ptr + mem::size_of::() as i32; let func_instructions = Instructions::new(vec![ // Amount of gas to reserve Instruction::GetLocal(4), // Duration of the reservation Instruction::GetLocal(5), - // Pointer to the LengthWithHash struct - Instruction::I32Const(reserve_gas_result_ptr), + // Pointer to the ErrorWithHash struct + Instruction::GetLocal(6), Instruction::Call(reserve_gas_idx as u32), - // Pointer to the LengthWithHash struct - Instruction::I32Const(reserve_gas_result_ptr), - // Load LengthWithHash.length + // Pointer to the ErrorWithHash struct + Instruction::GetLocal(6), + // Load ErrorWithHash.error Instruction::I32Load(2, 0), - // Check if LengthWithHash.length == 0 + // Check if ErrorWithHash.error == 0 Instruction::I32Eqz, - // If LengthWithHash.length == 0 + // If ErrorWithHash.error == 0 Instruction::If(BlockType::NoResult), + // Copy the Hash struct (32 bytes) containing the reservation id. + Instruction::I32Const(rid_pid_value_ptr), + Instruction::GetLocal(6), + Instruction::I64Load(3, 4), + Instruction::I64Store(3, 0), + Instruction::I32Const(rid_pid_value_ptr), + Instruction::GetLocal(6), + Instruction::I64Load(3, 12), + Instruction::I64Store(3, 8), + Instruction::I32Const(rid_pid_value_ptr), + Instruction::GetLocal(6), + Instruction::I64Load(3, 20), + Instruction::I64Store(3, 16), + Instruction::I32Const(rid_pid_value_ptr), + Instruction::GetLocal(6), + Instruction::I64Load(3, 28), + Instruction::I64Store(3, 24), // Copy the HashWithValue struct (48 bytes) containing // the recipient and value after the obtained reservation ID Instruction::I32Const(pid_value_ptr), @@ -392,7 +408,7 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { // Number of blocks to delay the sending for Instruction::GetLocal(3), // Pointer to the result of the reservation send - Instruction::I32Const(reservation_send_result_ptr), + Instruction::GetLocal(6), Instruction::Call(reservation_send_idx as u32), Instruction::End, Instruction::End, diff --git a/utils/wasm-gen/src/generator/syscalls/invocator.rs b/utils/wasm-gen/src/generator/syscalls/invocator.rs index 5ecedf35f3c..0cdf9da6590 100644 --- a/utils/wasm-gen/src/generator/syscalls/invocator.rs +++ b/utils/wasm-gen/src/generator/syscalls/invocator.rs @@ -28,8 +28,8 @@ use crate::{ }; use arbitrary::{Result, Unstructured}; use gear_wasm_instrument::{ - parity_wasm::elements::{Instruction, Internal, ValueType}, - syscalls::{ParamType, SysCallName}, + parity_wasm::elements::{BlockType, Instruction, Internal, ValueType}, + syscalls::{ParamType, SysCallName, SysCallSignature}, }; use std::{collections::BTreeMap, iter}; @@ -63,6 +63,7 @@ pub(crate) fn process_sys_call_params( // because it will be chosen in accordance to the wasm module // memory pages config. skip_next_param = true; + ProcessedSysCallParams::MemoryArray }) .unwrap_or(ProcessedSysCallParams::MemoryPtrValue), @@ -123,6 +124,40 @@ impl<'a, 'b> } } +/// Newtype used to mark that some instruction is used to push values to stack before syscall execution. +#[derive(Clone)] +struct ParamSetter(Instruction); + +impl ParamSetter { + fn new_i32(value: i32) -> Self { + Self(Instruction::I32Const(value)) + } + + fn new_i64(value: i64) -> Self { + Self(Instruction::I64Const(value)) + } + + fn into_ix(self) -> Instruction { + self.0 + } + + fn as_i32(&self) -> Option { + if let Instruction::I32Const(value) = self.0 { + Some(value) + } else { + None + } + } + + fn get_value(&self) -> i64 { + match self.0 { + Instruction::I32Const(value) => value as i64, + Instruction::I64Const(value) => value, + _ => unimplemented!("Incorrect instruction found"), + } + } +} + impl<'a, 'b> SysCallsInvocator<'a, 'b> { /// Insert sys-calls invokes. /// @@ -173,24 +208,27 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { self.unstructured.len() ); - let signature = invocable.into_signature(); + let (fallible, mut signature) = (invocable.is_fallible(), invocable.into_signature()); + if self.is_not_send_sys_call(invocable) { log::trace!( " -- Generating build call for non-send sys-call {}", invocable.to_str() ); - return self.build_call(&signature.params, &signature.results, call_indexes_handle); + return self.build_call(signature, fallible, call_indexes_handle); } log::trace!( " -- Generating build call for send sys-call {}", invocable.to_str() ); - let mut call_without_destination_instrs = self.build_call( - &signature.params[1..], - &signature.results, - call_indexes_handle, - )?; + + // The value for the first param is chosen from config. + // It's either the result of `gr_source`, some existing address (set in the data section) or a completely random value. + signature.params.remove(0); + let mut call_without_destination_instrs = + self.build_call(signature, fallible, call_indexes_handle)?; + let res = if self.config.sending_message_destination().is_source() { log::trace!(" -- Message destination is result of `gr_source`"); @@ -227,7 +265,7 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { let address_offset = match self.offsets.as_mut() { Some(offsets) => { - debug_assert!(self + assert!(self .config .sending_message_destination() .is_existing_addresses()); @@ -236,7 +274,7 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { offsets.next_offset() } None => { - debug_assert!(self.config.sending_message_destination().is_random()); + assert!(self.config.sending_message_destination().is_random()); log::trace!(" -- Message destination is a random address"); self.unstructured.arbitrary()? @@ -266,17 +304,37 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { fn build_call( &mut self, - params: &[ParamType], - results: &[ValueType], + signature: SysCallSignature, + fallible: bool, call_indexes_handle: CallIndexesHandle, ) -> Result> { + let param_setters = self.build_param_setters(&signature.params)?; + let mut instructions: Vec<_> = param_setters + .iter() + .cloned() + .map(ParamSetter::into_ix) + .collect(); + + instructions.push(Instruction::Call(call_indexes_handle as u32)); + + let mut result_processing = if self.config.ignore_fallible_syscall_errors() { + Self::build_result_processing_ignored(signature) + } else if fallible { + Self::build_result_processing_fallible(signature, ¶m_setters) + } else { + Self::build_result_processing_infallible(signature) + }; + instructions.append(&mut result_processing); + + Ok(instructions) + } + + fn build_param_setters(&mut self, params: &[ParamType]) -> Result> { log::trace!( - " ---- Random data before SysCallsInvocator::build_call - {}", + " ---- Random data before SysCallsInvocator::build_param_setters - {}", self.unstructured.len() ); - let results = results.iter().map(|_| Instruction::Drop); - let mem_size_pages = self .module .initial_mem_size() @@ -285,19 +343,18 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { .expect("generator is instantiated with a memory import generation proof"); let mem_size = Into::::into(mem_size_pages).memory_size(); - // + 1 for call instruction. - let mut instructions = Vec::with_capacity(params.len() * 2 + results.len() + 1); + let mut setters = Vec::with_capacity(params.len()); for processed_param in process_sys_call_params(params, self.config.params_config()) { match processed_param { ProcessedSysCallParams::Alloc => { let pages_to_alloc = self .unstructured .int_in_range(0..=mem_size_pages.saturating_sub(1))?; - let instr = Instruction::I32Const(pages_to_alloc as i32); + let setter = ParamSetter::new_i32(pages_to_alloc as i32); - log::trace!(" ---- Allocate memory - {instr}"); + log::trace!(" ---- Allocate memory - {pages_to_alloc}"); - instructions.push(instr); + setters.push(setter); } ProcessedSysCallParams::Value { value_type, @@ -310,57 +367,136 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { panic!("gear wasm must not have any floating nums") } }; - let instr = if let Some(allowed_values) = allowed_values { + let setter = if let Some(allowed_values) = allowed_values { if is_i32 { - Instruction::I32Const(allowed_values.get_i32(self.unstructured)?) + ParamSetter::new_i32(allowed_values.get_i32(self.unstructured)?) } else { - Instruction::I64Const(allowed_values.get_i64(self.unstructured)?) + ParamSetter::new_i64(allowed_values.get_i64(self.unstructured)?) } } else if is_i32 { - Instruction::I32Const(self.unstructured.arbitrary()?) + ParamSetter::new_i32(self.unstructured.arbitrary()?) } else { - Instruction::I64Const(self.unstructured.arbitrary()?) + ParamSetter::new_i64(self.unstructured.arbitrary()?) }; - log::trace!(" ---- Pointer value - {instr}"); + log::trace!(" ---- Pointer value - {}", setter.get_value()); - instructions.push(instr); + setters.push(setter); } ProcessedSysCallParams::MemoryArray => { - let upper_limit = mem_size.saturating_sub(1); + let upper_limit = mem_size.saturating_sub(1) as i32; - let pointer_beyond = self.unstructured.int_in_range(0..=upper_limit)?; - let offset = self.unstructured.int_in_range(0..=pointer_beyond)?; + let offset = self.unstructured.int_in_range(0..=upper_limit)?; + let length = self.unstructured.int_in_range(0..=(upper_limit - offset))?; - let first = Instruction::I32Const(offset as i32); - let second = Instruction::I32Const((pointer_beyond - offset) as i32); - log::trace!(" ---- Memory array {first}, {second}"); + log::trace!(" ---- Memory array {offset}, {length}"); - instructions.push(first); - instructions.push(second); + setters.push(ParamSetter::new_i32(offset)); + setters.push(ParamSetter::new_i32(length)); } ProcessedSysCallParams::MemoryPtrValue => { // Subtract a bit more so entities from `gsys` fit. let upper_limit = mem_size.saturating_sub(100); - let offset = self.unstructured.int_in_range(0..=upper_limit)?; + let offset = self.unstructured.int_in_range(0..=upper_limit)? as i32; - let instr = Instruction::I32Const(offset as i32); - log::trace!(" ---- Memory pointer value - {instr}"); + let setter = ParamSetter::new_i32(offset); + log::trace!(" ---- Memory pointer value - {offset}"); - instructions.push(instr); + setters.push(setter); } } } - instructions.push(Instruction::Call(call_indexes_handle as u32)); - instructions.extend(results); - log::trace!( - " ---- Random data after SysCallsInvocator::build_call - {}", + " ---- Random data after SysCallsInvocator::build_param_setters - {}", self.unstructured.len() ); - Ok(instructions) + assert_eq!(setters.len(), params.len()); + + Ok(setters) + } + + fn build_result_processing_ignored(signature: SysCallSignature) -> Vec { + iter::repeat(Instruction::Drop) + .take(signature.results.len()) + .collect() + } + + fn build_result_processing_fallible( + signature: SysCallSignature, + param_setters: &[ParamSetter], + ) -> Vec { + // TODO: #3129. + // Assume here that: + // 1. All the fallible syscalls write error to the pointer located in the last argument in syscall. + // 2. All the errors contain `ErrorCode` in the start of memory where pointer points. + + static_assertions::assert_eq_size!(gsys::ErrorCode, u32); + assert_eq!(gsys::ErrorCode::default(), 0); + + let params = signature.params; + assert!(matches!( + params + .last() + .expect("The last argument of fallible syscall must be pointer to error code"), + ParamType::Ptr(None) + )); + assert_eq!(params.len(), param_setters.len()); + + if let Some(ptr) = param_setters + .last() + .expect("At least one argument in fallible syscall") + .as_i32() + { + vec![ + Instruction::I32Const(ptr), + Instruction::I32Load(2, 0), + Instruction::I32Const(0), + Instruction::I32Ne, + Instruction::If(BlockType::NoResult), + Instruction::Unreachable, + Instruction::End, + ] + } else { + panic!("Incorrect last parameter type: expected pointer"); + } + } + + fn build_result_processing_infallible(signature: SysCallSignature) -> Vec { + // TODO: #3129 + // For now we don't check anywhere that `alloc` and `free` return + // error codes as described here. Also we don't assert that only `alloc` and `free` + // will have their first arguments equal to `ParamType::Alloc` and `ParamType::Free`. + let results_len = signature.results.len(); + + if results_len == 0 { + return vec![]; + } + + assert_eq!(results_len, 1); + + let error_code = match signature.params[0] { + ParamType::Alloc => { + // Alloc syscall: returns u32::MAX (= -1i32) in case of error. + -1 + } + ParamType::Free => { + // Free syscall: returns 1 in case of error. + 1 + } + _ => { + unimplemented!("Only alloc and free are supported for now") + } + }; + + vec![ + Instruction::I32Const(error_code), + Instruction::I32Eq, + Instruction::If(BlockType::NoResult), + Instruction::Unreachable, + Instruction::End, + ] } fn insert_sys_call_instructions(&mut self, instructions: &[Instruction]) -> Result<()> { diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index a7a048f11ef..a52571ec4b2 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -18,7 +18,13 @@ use super::*; use arbitrary::Unstructured; -use gear_core::{code::Code, pages::WASM_PAGE_SIZE}; +use gear_backend_common::{TerminationReason, TrapExplanation}; +use gear_core::{ + code::Code, + memory::Memory, + message::{IncomingMessage, ReplyPacket}, + pages::WASM_PAGE_SIZE, +}; use gear_utils::NonEmpty; use gear_wasm_instrument::parity_wasm::{ self, @@ -157,6 +163,162 @@ fn injecting_addresses_works() { assert_eq!(*ptr, size + (stack_end_page * WASM_PAGE_SIZE as u32) as i32); } +#[test] +fn error_processing_works_for_fallible_syscalls() { + use gear_backend_common::ActorTerminationReason; + + let fallible_syscalls = SysCallName::instrumentable() + .into_iter() + .filter(|sc| InvocableSysCall::Loose(*sc).is_fallible()); + + for syscall in fallible_syscalls { + let (params_config, initial_memory_write) = get_params_for_syscall_to_fail(&syscall); + + // Assert that syscalls results will be processed. + let termination_reason = execute_wasm_with_syscall_injected( + syscall, + false, + params_config.clone(), + initial_memory_write.clone(), + ); + + assert_eq!( + termination_reason, + TerminationReason::Actor(ActorTerminationReason::Trap(TrapExplanation::Unknown)), + "syscall: {}", + syscall.to_str() + ); + + // Assert that syscall results will be ignored. + let termination_reason = + execute_wasm_with_syscall_injected(syscall, true, params_config, initial_memory_write); + + assert_eq!( + termination_reason, + TerminationReason::Actor(ActorTerminationReason::Success), + "syscall: {}", + syscall.to_str() + ); + } +} + +#[derive(Clone)] +struct MemoryWrite { + offset: u32, + content: Vec, +} + +fn get_params_for_syscall_to_fail( + syscall: &SysCallName, +) -> (SysCallsParamsConfig, Option) { + let memory_write = match *syscall { + SysCallName::PayProgramRent => Some(MemoryWrite { + offset: 0, + content: vec![255; WASM_PAGE_SIZE], + }), + _ => None, + }; + + ( + SysCallsParamsConfig::all_constant_value(i32::MAX as i64), + memory_write, + ) +} + +fn execute_wasm_with_syscall_injected( + syscall: SysCallName, + ignore_fallible_errors: bool, + params_config: SysCallsParamsConfig, + initial_memory_write: Option, +) -> TerminationReason { + use gear_backend_common::{BackendReport, Environment}; + use gear_backend_sandbox::SandboxEnvironment; + use gear_core::message::{ContextSettings, DispatchKind, IncomingDispatch, MessageContext}; + use gear_core_processor::{ProcessorContext, ProcessorExternalities}; + use gear_wasm_instrument::rules::CustomConstantCostRules; + + const INITIAL_PAGES: u16 = 1; + const INJECTED_SYSCALLS: u32 = 8; + + // We create Unstructured from zeroes here as we just need any + let buf = vec![0; UNSTRUCTURED_SIZE]; + let mut unstructured = Unstructured::new(&buf); + + let mut injection_amounts = SysCallsInjectionAmounts::all_never(); + injection_amounts.set(syscall, INJECTED_SYSCALLS, INJECTED_SYSCALLS); + + let gear_config = ( + GearWasmGeneratorConfigBuilder::new() + .with_memory_config(MemoryPagesConfig { + initial_size: INITIAL_PAGES as u32, + ..MemoryPagesConfig::default() + }) + .with_sys_calls_config( + SysCallsConfigBuilder::new(injection_amounts) + .with_params_config(params_config) + .set_ignore_fallible_syscall_errors(ignore_fallible_errors) + .build(), + ) + .with_entry_points_config(EntryPointsSet::Init) + .build(), + SelectableParams { + call_indirect_enabled: false, + allowed_instructions: vec![], + max_instructions: 0, + min_funcs: 1, + max_funcs: 1, + }, + ); + + let code = + generate_gear_program_code(&mut unstructured, gear_config).expect("failed wasm generation"); + let code = Code::try_new(code, 1, |_| CustomConstantCostRules::new(0, 0, 0), None) + .expect("Failed to create Code"); + + let mut message_context = MessageContext::new( + IncomingDispatch::new(DispatchKind::Init, IncomingMessage::default(), None), + Default::default(), + ContextSettings::new(0, 0, 0, 0, 0, 0), + ); + // Imitate that reply was already sent. + let _ = message_context.reply_commit(ReplyPacket::auto(), None); + + let processor_context = ProcessorContext { + message_context, + max_pages: INITIAL_PAGES.into(), + rent_cost: 10, + ..ProcessorContext::new_mock() + }; + + let ext = gear_core_processor::Ext::new(processor_context); + let env = SandboxEnvironment::new( + ext, + code.code(), + DispatchKind::Init, + vec![DispatchKind::Init].into_iter().collect(), + INITIAL_PAGES.into(), + ) + .expect("Failed to create environment"); + + let report = env + .execute(|mem, _, _| -> Result<(), u32> { + if let Some(mem_write) = initial_memory_write { + return mem + .write(mem_write.offset, &mem_write.content) + .map_err(|_| 1); + }; + + Ok(()) + }) + .expect("Failed to execute WASM module"); + + let BackendReport { + termination_reason, .. + } = report; + + termination_reason +} + proptest! { #![proptest_config(ProptestConfig::with_cases(100))] #[test] From e9b6d89cf5cbbd86506458754f3e686856d5dded Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Thu, 31 Aug 2023 16:16:48 +0400 Subject: [PATCH 108/165] fix(migrations): Adjust versions of migration run (#3197) --- runtime/common/src/migrations.rs | 41 ++++++++++++++++++++++++-------- runtime/vara/src/migrations.rs | 1 + 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/runtime/common/src/migrations.rs b/runtime/common/src/migrations.rs index bd16325cb63..56d6da5ad7a 100644 --- a/runtime/common/src/migrations.rs +++ b/runtime/common/src/migrations.rs @@ -53,20 +53,35 @@ where log::info!("🚚 Running migration to gear-bank with current spec version {version:?}"); - if version < 320 { + if version <= 320 { let mut ops = 0u64; // Depositing gas from gas nodes. let gas_nodes_iter = GasNodesOf::::iter(); for (node_id, gas_node) in gas_nodes_iter { - let external = GasHandlerOf::::get_external(node_id) - .expect("Failed to get external id of the node"); + let Ok(external) = GasHandlerOf::::get_external(node_id) else { + log::error!("Failed to get external id of {node_id:?}"); + continue; + }; + let gas_amount = gas_node.total_value(); let gas_price = P::gas_price(gas_amount); - Balances::::unreserve(&external, gas_price); - GearBank::::deposit_gas::

(&external, gas_amount) - .expect("Failed to deposit gas"); + log::debug!("Gas nodes: {node_id:?} = {gas_amount} ({gas_price:?})"); + log::debug!( + "Gas nodes external: {external:?} = {:?}; {:?}", + Balances::::free_balance(&external), + Balances::::reserved_balance(&external) + ); + if !Balances::::unreserve(&external, gas_price).is_zero() { + log::error!( + "Failed to unreserve all requested value: {external:?} ({gas_price:?})" + ) + } + if let Err(err) = GearBank::::deposit_gas::

(&external, gas_amount) { + log::error!("Failed to deposit gas {err:?}: {external:?} ({gas_amount:?})"); + continue; + }; // Just random approximate amount of operations, // that will be meant as write operations. @@ -80,8 +95,12 @@ where let mut deposit = |source: ProgramId, value: u128| { let source = AccountIdOf::::from_origin(source.into_origin()); let value = value.unique_saturated_into(); - Balances::::unreserve(&source, value); - GearBank::::deposit_value(&source, value).expect("Failed to deposit value"); + if !Balances::::unreserve(&source, value).is_zero() { + log::error!("Failed to unreserve all requested value: {source:?} ({value:?})"); + } + if let Err(err) = GearBank::::deposit_value(&source, value) { + log::error!("Failed to deposit value {err:?}: {source:?} ({value:?})"); + }; // Just random approximate amount of operations, // that will be meant as write operations. @@ -119,8 +138,10 @@ where let accounts_iter = AccountsOf::::iter(); for (account_id, AccountInfo { data, .. }) in accounts_iter { let reserve = data.reserved; - if !reserve.is_zero() { - Balances::::unreserve(&account_id, reserve); + if !reserve.is_zero() && !Balances::::unreserve(&account_id, reserve).is_zero() { + log::error!( + "Failed to unreserve all requested value: {account_id:?} ({reserve:?})" + ); } } diff --git a/runtime/vara/src/migrations.rs b/runtime/vara/src/migrations.rs index cf92a300c39..6e9415dd776 100644 --- a/runtime/vara/src/migrations.rs +++ b/runtime/vara/src/migrations.rs @@ -6,4 +6,5 @@ pub type Migrations = ( pallet_gear_gas::migrations::v2::MigrateToV2, pallet_gear_messenger::migrations::MigrateToV2, pallet_gear_staking_rewards::migration::MigrateToV2, + runtime_common::migrations::MigrateToGearBank, ); From b4497e3c0edacde23318d5fdeee4aa1e5951f6c6 Mon Sep 17 00:00:00 2001 From: Shamil <66209982+shamilsan@users.noreply.github.com> Date: Fri, 1 Sep 2023 13:49:25 +0300 Subject: [PATCH 109/165] feat(runtime): make transaction cost multiplier smoother (#3198) --- pallets/payment/src/lib.rs | 6 ++---- pallets/payment/src/tests.rs | 24 ++++++++++++------------ runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/pallets/payment/src/lib.rs b/pallets/payment/src/lib.rs index edfe4272034..6f7fcf428f9 100644 --- a/pallets/payment/src/lib.rs +++ b/pallets/payment/src/lib.rs @@ -217,10 +217,8 @@ where let len_step = S::get().max(1); // Avoiding division by 0. let queue_len: u128 = QueueOf::::len().saturated_into(); - // min(30) in order to not goes into negative multiplier or UB. - // 30 is the last not negative bit in i32. - let pow = queue_len.saturating_div(len_step).min(30); - Multiplier::saturating_from_integer(1 << pow) + let multiplier = queue_len.saturating_div(len_step).saturating_add(1); + Multiplier::saturating_from_integer(multiplier) } } diff --git a/pallets/payment/src/tests.rs b/pallets/payment/src/tests.rs index 39a315a4e36..8f908ce0fc4 100644 --- a/pallets/payment/src/tests.rs +++ b/pallets/payment/src/tests.rs @@ -102,19 +102,19 @@ fn custom_fee_multiplier_updated_per_block() { populate_message_queue::(10); run_to_block(2); - // CustomFeeMultiplier is 2^(10 / 5) == 4 + // CustomFeeMultiplier is (10 / 5 + 1) == 3 assert_eq!( TransactionPayment::next_fee_multiplier(), - Multiplier::saturating_from_integer(4) + Multiplier::saturating_from_integer(3) ); populate_message_queue::(33); run_to_block(3); - // CustomFeeMultiplier is 2^(33 / 5) == 64 + // CustomFeeMultiplier is (33 / 5 + 1) == 7 assert_eq!( TransactionPayment::next_fee_multiplier(), - Multiplier::saturating_from_integer(64) + Multiplier::saturating_from_integer(7) ); }); } @@ -261,14 +261,14 @@ fn mq_size_affecting_fee_works() { let alice_initial_balance = Balances::free_balance(ALICE); let author_initial_balance = Balances::free_balance(BLOCK_AUTHOR); - // Fee multiplier should have been set to 16 + // Fee multiplier should have been set to 5 let pre = CustomChargeTransactionPayment::::from(0) .pre_dispatch(&ALICE, call, &info_from_weight(weight), len) .unwrap(); assert_eq!( Balances::free_balance(ALICE), - alice_initial_balance - (fee_weight * 16 + fee_length) + alice_initial_balance - (fee_weight * 5 + fee_length) ); assert_ok!(CustomChargeTransactionPayment::::post_dispatch( @@ -280,11 +280,11 @@ fn mq_size_affecting_fee_works() { )); assert_eq!( Balances::free_balance(ALICE), - alice_initial_balance - (fee_weight * 16 + fee_length) + alice_initial_balance - (fee_weight * 5 + fee_length) ); assert_eq!( Balances::free_balance(BLOCK_AUTHOR), - author_initial_balance + (fee_weight * 16 + fee_length) + author_initial_balance + (fee_weight * 5 + fee_length) ); }); } @@ -492,7 +492,7 @@ fn query_info_and_fee_details_work() { populate_message_queue::(20); run_to_block(2); - // Extra fee multiplier is now 2^(20 / 5) == 16 + // Extra fee multiplier is now (20 / 5 + 1) == 5 assert_eq!( GearPayment::query_info(xt_affecting_mq.clone(), len_affecting_mq), RuntimeDispatchInfo { @@ -500,13 +500,13 @@ fn query_info_and_fee_details_work() { class: info_affecting_mq.class, partial_fee: 0 /* base_fee */ + fee_affecting_length /* len * 1 */ - + fee_affecting_weight * 16u128 /* weight * 16 */ + + fee_affecting_weight * 5u128 /* weight * 5 */ }, ); // Extra fee not applicable => fee should be exactly what it was for empty MQ // However, we must account for the rounding error in this case - let rounding_error = WeightToFeeFor::::weight_to_fee(&Weight::from_parts(16, 0)); + let rounding_error = WeightToFeeFor::::weight_to_fee(&Weight::from_parts(5, 0)); assert_eq!( GearPayment::query_info(xt_not_affecting_mq.clone(), len_not_affecting_mq), RuntimeDispatchInfo { @@ -533,7 +533,7 @@ fn query_info_and_fee_details_work() { inclusion_fee: Some(InclusionFee { base_fee: 0, len_fee: fee_affecting_length, - adjusted_weight_fee: fee_affecting_weight * 16u128, + adjusted_weight_fee: fee_affecting_weight * 5u128, }), tip: 0, }, diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 980b0ccfdb7..5d38f62871a 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -278,7 +278,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { pub const TransactionByteFee: Balance = 1; - pub const QueueLengthStep: u128 = 10; + pub const QueueLengthStep: u128 = 1000; pub const OperationalFeeMultiplier: u8 = 5; } diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 0e7b4d9e2f6..f7f240c1303 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -346,7 +346,7 @@ impl pallet_balances::Config for Runtime { parameter_types! { pub const TransactionByteFee: Balance = 1; - pub const QueueLengthStep: u128 = 10; + pub const QueueLengthStep: u128 = 1000; pub const OperationalFeeMultiplier: u8 = 5; } From 9d25d5ab6ba063f1abac455f1ebd0933ccd2bdd6 Mon Sep 17 00:00:00 2001 From: Gregory Sobol Date: Sun, 3 Sep 2023 00:20:38 +0400 Subject: [PATCH 110/165] feat(node): Add debug runtime interface for benchmarks (#3195) --- node/service/src/client.rs | 2 ++ pallets/gear/Cargo.toml | 3 ++- runtime-interface/src/lib.rs | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/node/service/src/client.rs b/node/service/src/client.rs index 86a9ef37013..284686c4cb3 100644 --- a/node/service/src/client.rs +++ b/node/service/src/client.rs @@ -52,6 +52,8 @@ impl sc_executor::NativeExecutionDispatch for GearExecutorDispatch { /// Only enable the benchmarking host functions when we actually want to benchmark. #[cfg(feature = "runtime-benchmarks")] type ExtendHostFunctions = ( + // Only for runtime-benchmarks host functions. + gear_ri::gear_debug::HostFunctions, frame_benchmarking::benchmarking::HostFunctions, gear_ri::gear_ri::HostFunctions, gear_ri::sandbox::HostFunctions, diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index 74e5051b16b..aee4f66d0ff 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -25,6 +25,7 @@ static_assertions.workspace = true # Internal deps common.workspace = true +gear-runtime-interface = { workspace = true } gear-lazy-pages-common = { workspace = true, optional = true } core-processor.workspace = true gear-core.workspace = true @@ -114,7 +115,6 @@ pallet-gear-messenger = { workspace = true, features = ["std"] } pallet-gear-scheduler = { workspace = true, features = ["std"] } pallet-gear-program = { workspace = true, features = ["std"] } pallet-gear-voucher = { workspace = true, features = ["std"] } -gear-runtime-interface = { workspace = true, features = ["std"] } gmeta.workspace = true [features] @@ -152,6 +152,7 @@ std = [ "sp-consensus-babe/std", "test-syscalls?/std", "demo-proxy?/std", + "gear-runtime-interface/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/runtime-interface/src/lib.rs b/runtime-interface/src/lib.rs index 8c4d41530ac..e7e1d3329e4 100644 --- a/runtime-interface/src/lib.rs +++ b/runtime-interface/src/lib.rs @@ -231,3 +231,38 @@ pub trait GearRI { // Bellow goes deprecated runtime interface functions. } + +/// For debug using in benchmarks testing. +/// In wasm runtime is impossible to interact with OS functionality, +/// this interface allows to do it partially. +#[runtime_interface] +pub trait GearDebug { + fn println(msg: &[u8]) { + println!("{}", sp_std::str::from_utf8(msg).unwrap()); + } + + fn file_write(path: &str, data: Vec) { + use std::{fs::File, io::Write}; + + let mut file = File::create(path).unwrap(); + file.write_all(&data).unwrap(); + } + + fn file_read(path: &str) -> Vec { + use std::{fs::File, io::Read}; + + let mut file = File::open(path).unwrap(); + let mut data = Vec::new(); + file.read_to_end(&mut data).unwrap(); + data + } + + fn time_in_nanos() -> u128 { + use std::time::SystemTime; + + SystemTime::now() + .duration_since(SystemTime::UNIX_EPOCH) + .unwrap() + .as_nanos() + } +} From 01b34e01fed568a4ca54985f70fe469a4ea76e0f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 3 Sep 2023 10:53:16 +0300 Subject: [PATCH 111/165] deps: combine dependabot's PRs (#3207) --- Cargo.lock | 74 ++++++++++++++++++++++++++---------------------------- Cargo.toml | 6 ++--- 2 files changed, 39 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 03f8a5c479b..1bc26f8c3f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -545,9 +545,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" [[package]] name = "base64ct" @@ -982,9 +982,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "95ed24df0632f708f5f6d8082675bef2596f7084dee3dd55f632290bf35bfe0f" dependencies = [ "android-tzdata", "iana-time-zone", @@ -992,7 +992,7 @@ dependencies = [ "num-traits", "time 0.1.45", "wasm-bindgen", - "winapi", + "windows-targets 0.48.5", ] [[package]] @@ -1066,20 +1066,19 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" +checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6" dependencies = [ "clap_builder", - "clap_derive 4.4.0", - "once_cell", + "clap_derive 4.4.2", ] [[package]] name = "clap_builder" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" +checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08" dependencies = [ "anstream", "anstyle", @@ -1102,9 +1101,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", @@ -2908,9 +2907,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", @@ -3178,7 +3177,7 @@ dependencies = [ "Inflector", "array-bytes", "chrono", - "clap 4.4.0", + "clap 4.4.2", "comfy-table", "frame-benchmarking", "frame-support", @@ -3632,8 +3631,8 @@ name = "gcli" version = "0.3.2" dependencies = [ "anyhow", - "base64 0.21.2", - "clap 4.4.0", + "base64 0.21.3", + "clap 4.4.2", "color-eyre", "demo-messager", "demo-new-meta", @@ -3813,7 +3812,7 @@ dependencies = [ name = "gear-bags-thresholds" version = "1.0.0" dependencies = [ - "clap 4.4.0", + "clap 4.4.2", "generate-bags", "vara-runtime", ] @@ -3837,7 +3836,7 @@ dependencies = [ name = "gear-cli" version = "0.3.2" dependencies = [ - "clap 4.4.0", + "clap 4.4.2", "frame-benchmarking", "frame-benchmarking-cli", "frame-system", @@ -3966,7 +3965,7 @@ dependencies = [ "libc", "log", "mach", - "nix 0.26.2", + "nix 0.26.4", "once_cell", "region", "sc-executor-common", @@ -3998,7 +3997,7 @@ version = "0.3.2" dependencies = [ "anyhow", "arbitrary", - "clap 4.4.0", + "clap 4.4.2", "dyn-clonable", "futures", "futures-timer", @@ -4067,7 +4066,7 @@ dependencies = [ name = "gear-replay-cli" version = "1.0.0" dependencies = [ - "clap 4.4.0", + "clap 4.4.2", "frame-remote-externalities", "frame-system", "gear-runtime", @@ -4356,7 +4355,7 @@ dependencies = [ name = "gear-validator-checks" version = "0.1.0" dependencies = [ - "clap 4.4.0", + "clap 4.4.2", "env_logger", "futures", "gsdk", @@ -4440,7 +4439,7 @@ dependencies = [ name = "gear-weight-diff" version = "1.0.0" dependencies = [ - "clap 4.4.0", + "clap 4.4.2", "frame-support", "gear-runtime", "indexmap 2.0.0", @@ -4636,7 +4635,7 @@ name = "gsdk" version = "0.3.2" dependencies = [ "anyhow", - "base64 0.21.2", + "base64 0.21.3", "demo-messager", "demo-new-meta", "demo-waiter", @@ -6793,16 +6792,15 @@ dependencies = [ [[package]] name = "nix" -version = "0.26.2" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.7.1", "pin-utils", - "static_assertions", ] [[package]] @@ -9123,7 +9121,7 @@ dependencies = [ name = "regression-analysis" version = "0.1.0" dependencies = [ - "clap 4.4.0", + "clap 4.4.2", "frame-support", "gear-runtime", "junit-common", @@ -9150,7 +9148,7 @@ version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" dependencies = [ - "base64 0.21.2", + "base64 0.21.3", "bytes", "encoding_rs", "futures-core", @@ -9324,7 +9322,7 @@ version = "0.1.0" dependencies = [ "anyhow", "arbitrary", - "clap 4.4.0", + "clap 4.4.2", "frame-support", "frame-system", "gear-call-gen", @@ -9498,7 +9496,7 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ - "base64 0.21.2", + "base64 0.21.3", ] [[package]] @@ -9654,7 +9652,7 @@ source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0 dependencies = [ "array-bytes", "chrono", - "clap 4.4.0", + "clap 4.4.2", "fdlimit", "futures", "libp2p", @@ -10432,7 +10430,7 @@ name = "sc-storage-monitor" version = "0.1.0" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" dependencies = [ - "clap 4.4.0", + "clap 4.4.2", "fs4", "futures", "log", @@ -13261,7 +13259,7 @@ version = "0.10.0-dev" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" dependencies = [ "async-trait", - "clap 4.4.0", + "clap 4.4.2", "frame-remote-externalities", "frame-try-runtime", "hex", @@ -13754,7 +13752,7 @@ dependencies = [ name = "wasm-info" version = "0.1.0" dependencies = [ - "clap 4.4.0", + "clap 4.4.2", "hex", "parity-wasm 0.45.0", ] @@ -13812,7 +13810,7 @@ dependencies = [ name = "wasm-proc" version = "0.1.0" dependencies = [ - "clap 4.4.0", + "clap 4.4.2", "env_logger", "gear-wasm-builder", "log", diff --git a/Cargo.toml b/Cargo.toml index b4861fc1807..822c24513d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,11 +93,11 @@ anyhow = "1.0.75" arbitrary = "1.3.0" async-recursion = "1.0.4" async-trait = "0.1.73" -base64 = "0.21.0" +base64 = "0.21.3" byteorder = { version = "1.4.3", default-features = false } blake2-rfc = { version = "0.2.18", default-features = false } bs58 = { version = "0.4.0", default-features = false } -clap = { version = "4.3.21" } +clap = { version = "4.4.2" } codec = { package = "parity-scale-codec", version = "3.6.4", default-features = false } color-eyre = "0.6.2" colored = "2.0.0" @@ -425,7 +425,7 @@ keyring = "1.2.1" # gcli libp2p = "=0.50.1" # gcli (same version as sc-consensus) mimalloc = { version = "0.1.34", default-features = false } # node/cli nacl = "0.5.3" # gcli -nix = "0.26.2" # gear-lazy-pages +nix = "0.26.4" # gear-lazy-pages nonempty = "0.8.1" # utils/utils libfuzzer-sys = "0.4" # utils/runtime-fuzzer/fuzz pwasm-utils = "0.19.0" # utils/wasm-builder From ec462c3e0dabbca665e2a4d51fbf244f1f73c085 Mon Sep 17 00:00:00 2001 From: Dennis Diatlov Date: Mon, 4 Sep 2023 09:22:03 +0100 Subject: [PATCH 112/165] feat(gstd): Introduce max ownership time for Mutex (#2912) --- examples/waiter/src/code.rs | 17 +- examples/waiter/src/lib.rs | 16 +- examples/waiter/tests/mx_lock_access.rs | 5 +- gcore/src/lib.rs | 2 + gstd/src/async_runtime/futures.rs | 15 ++ gstd/src/common/errors.rs | 3 + gstd/src/config.rs | 42 +++- gstd/src/lib.rs | 2 +- gstd/src/sync/mutex.rs | 156 ++++++++++---- gsys/src/lib.rs | 3 + pallets/gear/Cargo.toml | 2 +- pallets/gear/src/tests.rs | 260 +++++++++++++++++++++++- 12 files changed, 461 insertions(+), 62 deletions(-) diff --git a/examples/waiter/src/code.rs b/examples/waiter/src/code.rs index f50b87702f2..9bc91cb726d 100644 --- a/examples/waiter/src/code.rs +++ b/examples/waiter/src/code.rs @@ -83,8 +83,14 @@ async fn main() { Command::WakeUp(msg_id) => { exec::wake(msg_id.into()).expect("Failed to wake up the message"); } - Command::MxLock(continuation) => { - let lock_guard = unsafe { MUTEX.lock().await }; + Command::MxLock(lock_duration, continuation) => { + let lock_guard = unsafe { + MUTEX + .lock() + .own_up_for(lock_duration) + .expect("Failed to set mx ownership duration") + .await + }; process_mx_lock_continuation( unsafe { &mut MUTEX_LOCK_GUARD }, lock_guard, @@ -142,6 +148,9 @@ async fn process_mx_lock_continuation( continuation: MxLockContinuation, ) { match continuation { + MxLockContinuation::Lock => unsafe { + MUTEX.lock().await; + }, MxLockContinuation::General(continuation) => { process_lock_continuation(static_lock_guard, lock_guard, continuation).await } @@ -171,6 +180,10 @@ async fn process_lock_continuation( LockContinuation::MoveToStatic => unsafe { *static_lock_guard = Some(lock_guard); }, + LockContinuation::Wait => exec::wait(), + LockContinuation::Forget => { + gstd::mem::forget(lock_guard); + } } } diff --git a/examples/waiter/src/lib.rs b/examples/waiter/src/lib.rs index d02e5988083..1e744113065 100644 --- a/examples/waiter/src/lib.rs +++ b/examples/waiter/src/lib.rs @@ -60,11 +60,13 @@ pub enum LockContinuation { Nothing, SleepFor(u32), MoveToStatic, + Wait, + Forget, } #[derive(Debug, Encode, Decode)] pub enum MxLockContinuation { - // Here will be Lock + Lock, General(LockContinuation), } @@ -92,14 +94,14 @@ pub enum RwLockContinuation { #[derive(Debug, Encode, Decode)] pub enum Command { Wait(WaitSubcommand), - SendFor(ActorId, u32), - SendUpTo(ActorId, u32), - SendUpToWait(ActorId, u32), - SendAndWaitFor(u32, ActorId), + SendFor(ActorId, gstd::BlockCount), + SendUpTo(ActorId, gstd::BlockCount), + SendUpToWait(ActorId, gstd::BlockCount), + SendAndWaitFor(gstd::BlockCount, ActorId), ReplyAndWait(WaitSubcommand), - SleepFor(Vec, SleepForWaitType), + SleepFor(Vec, SleepForWaitType), WakeUp([u8; 32]), - MxLock(MxLockContinuation), + MxLock(gstd::BlockCount, MxLockContinuation), MxLockStaticAccess(LockStaticAccessSubcommand), RwLock(RwLockType, RwLockContinuation), RwLockStaticAccess(RwLockType, LockStaticAccessSubcommand), diff --git a/examples/waiter/tests/mx_lock_access.rs b/examples/waiter/tests/mx_lock_access.rs index ce6bb9c2a43..4b0bd15c9eb 100644 --- a/examples/waiter/tests/mx_lock_access.rs +++ b/examples/waiter/tests/mx_lock_access.rs @@ -55,7 +55,10 @@ fn init_fixture(system: &System) -> (Program<'_>, MessageId) { program.send_bytes(USER_ID, []); let lock_result = program.send( USER_ID, - Command::MxLock(MxLockContinuation::General(LockContinuation::MoveToStatic)), + Command::MxLock( + u32::MAX, + MxLockContinuation::General(LockContinuation::MoveToStatic), + ), ); (program, lock_result.sent_message_id()) } diff --git a/gcore/src/lib.rs b/gcore/src/lib.rs index 22e8392853b..6fd5369e7f8 100644 --- a/gcore/src/lib.rs +++ b/gcore/src/lib.rs @@ -75,6 +75,8 @@ pub use general::*; mod utils; pub use utils::ext; +pub use gsys::{BlockCount, BlockNumber}; + use core::mem::size_of; use static_assertions::const_assert; diff --git a/gstd/src/async_runtime/futures.rs b/gstd/src/async_runtime/futures.rs index f806dfb3711..bcf5f01e441 100644 --- a/gstd/src/async_runtime/futures.rs +++ b/gstd/src/async_runtime/futures.rs @@ -36,6 +36,7 @@ type PinnedFuture = Pin + 'static>>; pub struct Task { waker: Waker, future: PinnedFuture, + lock_exceeded: bool, } impl Task { @@ -46,8 +47,13 @@ impl Task { Self { waker: super::waker::empty(), future: future.boxed_local(), + lock_exceeded: false, } } + + pub(crate) fn set_lock_exceeded(&mut self) { + self.lock_exceeded = true; + } } /// The main asynchronous message handling loop. @@ -67,6 +73,15 @@ where Task::new(future) }); + if task.lock_exceeded { + // Futures and locks for the message will be cleaned up by + // the async_runtime::handle_signal function + panic!( + "Message 0x{} has exceeded lock ownership time", + hex::encode(msg_id) + ); + } + let mut cx = Context::from_waker(&task.waker); if Pin::new(&mut task.future).poll(&mut cx).is_ready() { diff --git a/gstd/src/common/errors.rs b/gstd/src/common/errors.rs index d00cdfd1dee..1b09d131992 100644 --- a/gstd/src/common/errors.rs +++ b/gstd/src/common/errors.rs @@ -51,6 +51,8 @@ pub enum Error { /// function (see /// [Config::set_system_reserve](crate::Config::set_system_reserve)). ZeroSystemReservationAmount, + /// This error occurs when providing zero duration to mutex lock function + ZeroMxLockDuration, } impl Error { @@ -74,6 +76,7 @@ impl fmt::Display for Error { Error::ZeroSystemReservationAmount => { write!(f, "System reservation amount can not be zero in config.") } + Error::ZeroMxLockDuration => write!(f, "Mutex lock duration can not be zero."), } } } diff --git a/gstd/src/config.rs b/gstd/src/config.rs index bd0a32bfaa5..905d0711bc0 100644 --- a/gstd/src/config.rs +++ b/gstd/src/config.rs @@ -20,7 +20,10 @@ //! Gear libs are `#![no_std]`, which makes them lightweight. //! This module is for configuring `gstd` inside gear programs. -use crate::errors::{Error, Result}; +use crate::{ + errors::{Error, Result}, + BlockCount, +}; /// Wait types. #[derive(Clone, Copy, Default)] @@ -39,12 +42,17 @@ pub struct Config { /// count. /// /// Initial value: **100 blocks** - pub wait_up_to: u32, + pub wait_up_to: BlockCount, /// Default wait duration for `wait_for` messages expressed in block count. /// /// Initial value: **100 blocks** - pub wait_for: u32, + pub wait_for: BlockCount, + + /// Default amount of blocks a mutex lock can be owned for by a message. + /// + /// Initial value: **100 blocks** + pub mx_lock_duration: BlockCount, /// Default gas amount reserved for system purposes. /// @@ -59,6 +67,7 @@ impl Config { Self { wait_up_to: 100, wait_for: 100, + mx_lock_duration: 100, system_reserve: 1_000_000_000, wait_type: WaitType::WaitUpTo, } @@ -69,22 +78,27 @@ impl Config { } /// Get the `wait_for` duration (in blocks). - pub fn wait_for() -> u32 { + pub fn wait_for() -> BlockCount { unsafe { CONFIG.wait_for } } /// Get the `wait_up_to` duration (in blocks). - pub fn wait_up_to() -> u32 { + pub fn wait_up_to() -> BlockCount { unsafe { CONFIG.wait_up_to } } + /// Get the `mx_lock_duration` duration (in blocks). + pub fn mx_lock_duration() -> BlockCount { + unsafe { CONFIG.mx_lock_duration } + } + /// Get the `system_reserve` gas amount. pub fn system_reserve() -> u64 { unsafe { CONFIG.system_reserve } } /// Set `wait_for` duration (in blocks). - pub fn set_wait_for(duration: u32) -> Result<()> { + pub fn set_wait_for(duration: BlockCount) -> Result<()> { if duration == 0 { return Err(Error::EmptyWaitDuration); } @@ -97,7 +111,7 @@ impl Config { /// /// Calling this function forces all async functions that wait for some /// condition to wait exactly for `duration` blocks. - pub fn set_default_wait_for(duration: u32) -> Result<()> { + pub fn set_default_wait_for(duration: BlockCount) -> Result<()> { Self::set_wait_for(duration)?; unsafe { CONFIG.wait_type = WaitType::WaitFor }; @@ -105,7 +119,7 @@ impl Config { } /// Set the `wait_up_to` duration (in blocks). - pub fn set_wait_up_to(duration: u32) -> Result<()> { + pub fn set_wait_up_to(duration: BlockCount) -> Result<()> { if duration == 0 { return Err(Error::EmptyWaitDuration); } @@ -118,13 +132,23 @@ impl Config { /// /// Calling this function forces all async functions that wait for some /// condition to wait not more than `duration` blocks. - pub fn set_default_wait_up_to(duration: u32) -> Result<()> { + pub fn set_default_wait_up_to(duration: BlockCount) -> Result<()> { Self::set_wait_up_to(duration)?; unsafe { CONFIG.wait_type = WaitType::WaitUpTo }; Ok(()) } + /// Set `mx_lock_duration_max` duration (in blocks). + pub fn set_mx_lock_duration(duration: BlockCount) -> Result<()> { + if duration == 0 { + return Err(Error::ZeroMxLockDuration); + } + + unsafe { CONFIG.mx_lock_duration = duration }; + Ok(()) + } + /// Set `system_reserve` gas amount. pub fn set_system_reserve(amount: u64) -> Result<()> { if amount == 0 { diff --git a/gstd/src/lib.rs b/gstd/src/lib.rs index 1b48cde9657..ab5aa335cc4 100644 --- a/gstd/src/lib.rs +++ b/gstd/src/lib.rs @@ -151,7 +151,7 @@ pub mod util; pub use async_runtime::{handle_signal, message_loop, record_reply}; pub use common::{errors, primitives::*}; pub use config::Config; -pub use gcore::ext; +pub use gcore::{ext, BlockCount, BlockNumber}; pub use gstd_codegen::{async_init, async_main}; pub use prelude::*; pub use reservations::*; diff --git a/gstd/src/sync/mutex.rs b/gstd/src/sync/mutex.rs index c93b4af9513..b56457fe8af 100644 --- a/gstd/src/sync/mutex.rs +++ b/gstd/src/sync/mutex.rs @@ -17,7 +17,11 @@ // along with this program. If not, see . use super::access::AccessQueue; -use crate::{exec, msg, MessageId}; +use crate::{ + async_runtime, + errors::{Error, Result}, + exec, format, msg, BlockCount, BlockNumber, Config, MessageId, +}; use core::{ cell::UnsafeCell, future::Future, @@ -77,7 +81,7 @@ use core::{ /// # fn main() {} /// ``` pub struct Mutex { - locked: UnsafeCell>, + locked: UnsafeCell>, value: UnsafeCell, queue: AccessQueue, } @@ -102,7 +106,20 @@ impl Mutex { /// returned to allow scoped unlock of the lock. When the guard goes out /// of scope, the mutex will be unlocked. pub fn lock(&self) -> MutexLockFuture<'_, T> { - MutexLockFuture { mutex: self } + MutexLockFuture { + mutex: self, + own_up_for: None, + } + } + + // Returns a mutable reference to the mutex lock owner. The function uses unsafe + // code because it is called from the places where there is only non-mutable + // reference to the mutex exists, and the latter can't be turned into a + // mutable one as it will break logic around the `Mutex.lock` function which + // must be called on a non-mutable reference to the mutex. + #[allow(clippy::mut_from_ref)] + fn locked_by_mut(&self) -> &mut Option<(MessageId, BlockNumber)> { + unsafe { &mut *self.locked.get() } } } @@ -120,6 +137,7 @@ pub struct MutexGuard<'a, T> { } impl<'a, T> MutexGuard<'a, T> { + #[track_caller] fn ensure_access_by_holder(&self) { let current_msg_id = msg::id(); if self.holder_msg_id != current_msg_id { @@ -134,26 +152,31 @@ impl<'a, T> MutexGuard<'a, T> { impl<'a, T> Drop for MutexGuard<'a, T> { fn drop(&mut self) { - self.ensure_access_by_holder(); - unsafe { - let locked_by = &mut *self.mutex.locked.get(); - let owner_msg_id = locked_by.unwrap_or_else(|| { - panic!( - "Mutex guard held by message 0x{} is being dropped for non-existing lock", - hex::encode(self.holder_msg_id), - ); - }); - if owner_msg_id != self.holder_msg_id { - panic!( - "Mutex guard held by message 0x{} does not match lock owner message 0x{}", - hex::encode(self.holder_msg_id), - hex::encode(owner_msg_id), - ); - } - *locked_by = None; + let is_holder_msg_signal_handler = msg::signal_from() == Ok(self.holder_msg_id); + if !is_holder_msg_signal_handler { + self.ensure_access_by_holder(); + } + + let locked_by = self.mutex.locked_by_mut(); + let owner_msg_id = locked_by.map(|v| v.0); + + if owner_msg_id != Some(self.holder_msg_id) && !is_holder_msg_signal_handler { + // If owner_msg_id is None or not equal to the holder_msg_id, firstly, it means + // we are in the message signal handler and, secondly, the lock was seized by + // some other message. In this case, the next rival message was + // awoken by the ousting mechanism in the MutexLockFuture::poll + panic!( + "Mutex guard held by message 0x{} does not match lock owner message {}", + hex::encode(self.holder_msg_id), + owner_msg_id.map_or("None".into(), |v| format!("0x{}", hex::encode(v))) + ); + } + + if owner_msg_id == Some(self.holder_msg_id) { if let Some(message_id) = self.mutex.queue.dequeue() { exec::wake(message_id).expect("Failed to wake the message"); } + *locked_by = None; } } } @@ -217,6 +240,51 @@ unsafe impl Sync for Mutex {} /// ``` pub struct MutexLockFuture<'a, T> { mutex: &'a Mutex, + // The maximum number of blocks the mutex lock can be owned. + // If the value is None, the default value taken from the `Config::mx_lock_duration` is used. + own_up_for: Option, +} + +impl<'a, T> MutexLockFuture<'a, T> { + /// Sets the maximum number of blocks the mutex lock can be owned by + /// some message before the ownership can be seized by another rival + pub fn own_up_for(self, block_count: BlockCount) -> Result { + if block_count == 0 { + Err(Error::ZeroMxLockDuration) + } else { + Ok(MutexLockFuture { + mutex: self.mutex, + own_up_for: Some(block_count), + }) + } + } + + fn acquire_lock_ownership( + &mut self, + owner_msg_id: MessageId, + current_block: BlockNumber, + ) -> Poll> { + let locked_by = self.mutex.locked_by_mut(); + *locked_by = Some(( + owner_msg_id, + current_block.saturating_add(self.own_up_for.unwrap_or_else(Config::mx_lock_duration)), + )); + Poll::Ready(MutexGuard { + mutex: self.mutex, + holder_msg_id: owner_msg_id, + }) + } + + fn queue_for_lock_ownership(&mut self, rival_msg_id: MessageId) -> Poll> { + // If the message is already in the access queue, and we come here, + // it means the message has just been woken up from the waitlist. + // In that case we do not want to register yet another access attempt + // and just go back to the waitlist. + if !self.mutex.queue.contains(&rival_msg_id) { + self.mutex.queue.enqueue(rival_msg_id); + } + Poll::Pending + } } impl<'a, T> Future for MutexLockFuture<'a, T> { @@ -226,22 +294,40 @@ impl<'a, T> Future for MutexLockFuture<'a, T> { // mutex can be taken, else it waits (goes into *waiting queue*). fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll { let current_msg_id = msg::id(); - let lock = unsafe { &mut *self.mutex.locked.get() }; - if lock.is_none() { - *lock = Some(current_msg_id); - Poll::Ready(MutexGuard { - mutex: self.mutex, - holder_msg_id: current_msg_id, - }) - } else { - // If the message is already in the access queue, and we come here, - // it means the message has just been woken up from the waitlist. - // In that case we do not want to register yet another access attempt - // and just go back to the waitlist. - if !self.mutex.queue.contains(¤t_msg_id) { - self.mutex.queue.enqueue(current_msg_id); + let current_block = exec::block_height(); + let locked_by = self.mutex.locked_by_mut(); + + if locked_by.is_none() { + return self + .get_mut() + .acquire_lock_ownership(current_msg_id, current_block); + } + + let (lock_owner_msg_id, deadline_block) = + (*locked_by).unwrap_or_else(|| unreachable!("Checked above")); + + if current_block < deadline_block { + return self.get_mut().queue_for_lock_ownership(current_msg_id); + } + + if let Some(msg_future_task) = async_runtime::futures().get_mut(&lock_owner_msg_id) { + msg_future_task.set_lock_exceeded(); + exec::wake(lock_owner_msg_id).expect("Failed to wake the message"); + } + + while let Some(next_msg_id) = self.mutex.queue.dequeue() { + if next_msg_id == lock_owner_msg_id { + continue; + } + if next_msg_id == current_msg_id { + break; } - Poll::Pending + exec::wake(next_msg_id).expect("Failed to wake the message"); + *locked_by = None; + return self.get_mut().queue_for_lock_ownership(current_msg_id); } + + self.get_mut() + .acquire_lock_ownership(current_msg_id, current_block) } } diff --git a/gsys/src/lib.rs b/gsys/src/lib.rs index 46c21e6b971..e3165248b78 100644 --- a/gsys/src/lib.rs +++ b/gsys/src/lib.rs @@ -28,6 +28,9 @@ pub type ErrorCode = u32; /// Represents block number type. pub type BlockNumber = u32; +/// Represents block count type. +pub type BlockCount = u32; + /// Represents block number type. pub type BlockTimestamp = u64; diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index aee4f66d0ff..618be304e11 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -92,7 +92,7 @@ demo-compose.workspace = true demo-constructor.workspace = true demo-mul-by-const.workspace = true demo-wait.workspace = true -demo-waiter.workspace = true +demo-waiter = { workspace = true, features = ["debug"] } # The 'debug' feature is required for some assertion in tests demo-wait-timeout.workspace = true demo-wait-wake.workspace = true demo-reserve-gas.workspace = true diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index f5a3e04406d..5c2b93fd50d 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -8963,7 +8963,7 @@ fn waking_message_waiting_for_mx_lock_does_not_lead_to_deadlock() { Command as WaiterCommand, LockContinuation, MxLockContinuation, WASM_BINARY as WAITER_WASM, }; - let execution = || { + fn execution() { System::reset_events(); Gear::upload_program( @@ -8995,17 +8995,21 @@ fn waking_message_waiting_for_mx_lock_does_not_lead_to_deadlock() { (msg_id, msg_block_number) }; - let (lock_owner_msg_id, _lock_owner_msg_block_number) = send_command_to_waiter( - WaiterCommand::MxLock(MxLockContinuation::General(LockContinuation::SleepFor(4))), - ); + let (lock_owner_msg_id, _lock_owner_msg_block_number) = + send_command_to_waiter(WaiterCommand::MxLock( + u32::MAX, + MxLockContinuation::General(LockContinuation::SleepFor(4)), + )); let (lock_rival_1_msg_id, _) = send_command_to_waiter(WaiterCommand::MxLock( + u32::MAX, MxLockContinuation::General(LockContinuation::Nothing), )); send_command_to_waiter(WaiterCommand::WakeUp(lock_rival_1_msg_id.into())); let (lock_rival_2_msg_id, _) = send_command_to_waiter(WaiterCommand::MxLock( + u32::MAX, MxLockContinuation::General(LockContinuation::Nothing), )); @@ -9030,7 +9034,7 @@ fn waking_message_waiting_for_mx_lock_does_not_lead_to_deadlock() { assert_succeed(lock_owner_msg_id); assert_succeed(lock_rival_1_msg_id); assert_succeed(lock_rival_2_msg_id); - }; + } init_logger(); new_test_ext().execute_with(execution); @@ -9043,7 +9047,7 @@ fn waking_message_waiting_for_rw_lock_does_not_lead_to_deadlock() { WASM_BINARY as WAITER_WASM, }; - let execution = || { + fn execution() { System::reset_events(); Gear::upload_program( @@ -9160,8 +9164,252 @@ fn waking_message_waiting_for_rw_lock_does_not_lead_to_deadlock() { assert_succeed(lock_rival_1_msg_id); assert_succeed(lock_rival_2_msg_id); } + } + + init_logger(); + new_test_ext().execute_with(execution); +} + +#[test] +fn mx_lock_ownership_exceedance() { + use demo_waiter::{ + Command as WaiterCommand, LockContinuation, MxLockContinuation, WASM_BINARY as WAITER_WASM, }; + const LOCK_HOLD_DURATION: u32 = 3; + + fn execution() { + System::reset_events(); + + Gear::upload_program( + RuntimeOrigin::signed(USER_1), + WAITER_WASM.to_vec(), + DEFAULT_SALT.to_vec(), + EMPTY_PAYLOAD.to_vec(), + BlockGasLimitOf::::get(), + 0, + ) + .expect("Failed to upload Waiter"); + let waiter_prog_id = get_last_program_id(); + run_to_next_block(None); + + // Helper functions (collapse the block) + let (run_test_case, get_lock_ownership_exceeded_trap) = { + let send_command_to_waiter = |command: WaiterCommand| { + MailboxOf::::clear(); + Gear::send_message( + RuntimeOrigin::signed(USER_1), + waiter_prog_id, + command.encode(), + BlockGasLimitOf::::get(), + 0, + false, + ) + .unwrap_or_else(|_| panic!("Failed to send command {:?} to Waiter", command)); + let msg_id = get_last_message_id(); + let msg_block_number = System::block_number() + 1; + run_to_next_block(None); + (msg_id, msg_block_number) + }; + + let run_test_case = + move |command: WaiterCommand, + run_for_blocks_before_lock_assert: u32, + assert_command_result: &dyn Fn(MessageId), + assert_lock_result: &dyn Fn(MessageId, MessageId)| { + let (command_msg_id, _) = send_command_to_waiter(command); + + // Subtract 1 because sending command to waiter below adds 1 block + run_for_blocks(run_for_blocks_before_lock_assert - 1, None); + + assert_command_result(command_msg_id); + + let (lock_msg_id, _) = send_command_to_waiter(WaiterCommand::MxLock( + 1, + MxLockContinuation::General(LockContinuation::Nothing), + )); + + assert_lock_result(command_msg_id, lock_msg_id); + }; + + let get_lock_ownership_exceeded_trap = |command_msg_id| { + ActorExecutionErrorReplyReason::Trap(TrapExplanation::Panic( + format!( + "Message 0x{} has exceeded lock ownership time", + hex::encode(command_msg_id) + ) + .into(), + )) + }; + + (run_test_case, get_lock_ownership_exceeded_trap) + }; + + // Msg1 acquires lock and goes into waitlist + // Msg2 acquires the lock after Msg1's lock ownership time has exceeded + run_test_case( + WaiterCommand::MxLock( + LOCK_HOLD_DURATION, + MxLockContinuation::General(LockContinuation::Wait), + ), + LOCK_HOLD_DURATION, + &|command_msg_id| { + assert!(WaitlistOf::::contains( + &waiter_prog_id, + &command_msg_id + )); + }, + &|command_msg_id, lock_msg_id| { + assert_failed( + command_msg_id, + get_lock_ownership_exceeded_trap(command_msg_id), + ); + assert_succeed(lock_msg_id); + }, + ); + + // Msg1 acquires lock and goes into waitlist + // Msg2 fails to acquire the lock because Msg1's lock ownership time has not exceeded + run_test_case( + WaiterCommand::MxLock( + LOCK_HOLD_DURATION, + MxLockContinuation::General(LockContinuation::Wait), + ), + LOCK_HOLD_DURATION - 1, + &|command_msg_id| { + assert!(WaitlistOf::::contains( + &waiter_prog_id, + &command_msg_id + )); + }, + &|command_msg_id, lock_msg_id| { + assert!(WaitlistOf::::contains( + &waiter_prog_id, + &command_msg_id + )); + assert!(WaitlistOf::::contains(&waiter_prog_id, &lock_msg_id)); + }, + ); + + // Msg1 acquires lock and forgets its lock guard + // Msg2 acquires the lock after Msg1's lock ownership time has exceeded + run_test_case( + WaiterCommand::MxLock( + LOCK_HOLD_DURATION, + MxLockContinuation::General(LockContinuation::Forget), + ), + LOCK_HOLD_DURATION, + &|command_msg_id| { + assert_succeed(command_msg_id); + }, + &|_command_msg_id, lock_msg_id| { + assert_succeed(lock_msg_id); + }, + ); + + // Msg1 acquires lock and forgets its lock guard + // Msg2 fails to acquire the lock because Msg1's lock ownership time has not exceeded + run_test_case( + WaiterCommand::MxLock( + LOCK_HOLD_DURATION, + MxLockContinuation::General(LockContinuation::Forget), + ), + LOCK_HOLD_DURATION - 1, + &|command_msg_id| { + assert_succeed(command_msg_id); + }, + &|_command_msg_id, lock_msg_id| { + assert!(WaitlistOf::::contains(&waiter_prog_id, &lock_msg_id)); + }, + ); + + // Msg1 acquires lock and goes into sleep for longer than its lock ownership time + // Msg2 acquires the lock after Msg1's lock ownership time has exceeded + run_test_case( + WaiterCommand::MxLock( + LOCK_HOLD_DURATION, + MxLockContinuation::General(LockContinuation::SleepFor(LOCK_HOLD_DURATION * 2)), + ), + LOCK_HOLD_DURATION, + &|command_msg_id| { + assert!(WaitlistOf::::contains( + &waiter_prog_id, + &command_msg_id + )); + }, + &|command_msg_id, lock_msg_id| { + assert_failed( + command_msg_id, + get_lock_ownership_exceeded_trap(command_msg_id), + ); + assert_succeed(lock_msg_id); + }, + ); + + // Msg1 acquires lock and goes into sleep for longer than its lock ownership time + // Msg2 fails to acquire the lock because Msg1's lock ownership time has not exceeded + run_test_case( + WaiterCommand::MxLock( + LOCK_HOLD_DURATION, + MxLockContinuation::General(LockContinuation::SleepFor(LOCK_HOLD_DURATION * 2)), + ), + LOCK_HOLD_DURATION - 1, + &|command_msg_id| { + assert!(WaitlistOf::::contains( + &waiter_prog_id, + &command_msg_id + )); + }, + &|command_msg_id, lock_msg_id| { + assert!(WaitlistOf::::contains( + &waiter_prog_id, + &command_msg_id + )); + assert!(WaitlistOf::::contains(&waiter_prog_id, &lock_msg_id)); + }, + ); + + // Msg1 acquires lock and tries to re-enter the same lock + // Msg2 acquires the lock after Msg1's lock ownership time has exceeded + run_test_case( + WaiterCommand::MxLock(LOCK_HOLD_DURATION, MxLockContinuation::Lock), + LOCK_HOLD_DURATION, + &|command_msg_id| { + assert!(WaitlistOf::::contains( + &waiter_prog_id, + &command_msg_id + )); + }, + &|command_msg_id, lock_msg_id| { + assert_failed( + command_msg_id, + get_lock_ownership_exceeded_trap(command_msg_id), + ); + assert_succeed(lock_msg_id); + }, + ); + + // Msg1 acquires lock and tries to re-enter the same lock + // Msg2 fails to acquire the lock because Msg1's lock ownership time has not exceeded + run_test_case( + WaiterCommand::MxLock(LOCK_HOLD_DURATION, MxLockContinuation::Lock), + LOCK_HOLD_DURATION - 1, + &|command_msg_id| { + assert!(WaitlistOf::::contains( + &waiter_prog_id, + &command_msg_id + )); + }, + &|command_msg_id, lock_msg_id| { + assert!(WaitlistOf::::contains( + &waiter_prog_id, + &command_msg_id + )); + assert!(WaitlistOf::::contains(&waiter_prog_id, &lock_msg_id)); + }, + ); + } + init_logger(); new_test_ext().execute_with(execution); } From ae511cee465ebed1e9c15a70f1cf61d555c4a6f7 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Mon, 4 Sep 2023 15:19:25 +0400 Subject: [PATCH 113/165] chore(after-release): Clean up and versioning (#3211) --- core-processor/src/ext.rs | 6 +- pallets/gas/src/lib.rs | 2 - pallets/gas/src/migrations/mod.rs | 20 - pallets/gas/src/migrations/v1.rs | 355 ---------------- pallets/gas/src/migrations/v2.rs | 263 ------------ pallets/gear-messenger/src/lib.rs | 3 - pallets/gear-messenger/src/migrations.rs | 507 ----------------------- pallets/gear-program/src/lib.rs | 5 - pallets/gear-program/src/migration.rs | 237 ----------- pallets/gear-scheduler/src/lib.rs | 3 - pallets/gear-scheduler/src/migration.rs | 146 ------- pallets/gear-voucher/src/lib.rs | 1 - pallets/gear-voucher/src/migration.rs | 31 -- pallets/gear/src/lib.rs | 1 - pallets/gear/src/migration.rs | 29 -- pallets/staking-rewards/src/lib.rs | 4 +- pallets/staking-rewards/src/migration.rs | 109 ----- runtime/common/src/lib.rs | 1 - runtime/common/src/migrations.rs | 162 -------- runtime/gear/src/lib.rs | 2 +- runtime/gear/src/migrations.rs | 3 +- runtime/vara/src/lib.rs | 2 +- runtime/vara/src/migrations.rs | 28 +- 23 files changed, 30 insertions(+), 1890 deletions(-) delete mode 100644 pallets/gas/src/migrations/mod.rs delete mode 100644 pallets/gas/src/migrations/v1.rs delete mode 100644 pallets/gas/src/migrations/v2.rs delete mode 100644 pallets/gear-messenger/src/migrations.rs delete mode 100644 pallets/gear-program/src/migration.rs delete mode 100644 pallets/gear-scheduler/src/migration.rs delete mode 100644 pallets/gear-voucher/src/migration.rs delete mode 100644 pallets/gear/src/migration.rs delete mode 100644 pallets/staking-rewards/src/migration.rs delete mode 100644 runtime/common/src/migrations.rs diff --git a/core-processor/src/ext.rs b/core-processor/src/ext.rs index 923cdab2ecb..7ae0201f712 100644 --- a/core-processor/src/ext.rs +++ b/core-processor/src/ext.rs @@ -30,6 +30,8 @@ use gear_backend_common::{ UnrecoverableExecutionError, UnrecoverableExtError as UnrecoverableExtErrorCore, UnrecoverableWaitError, }; +#[cfg(any(feature = "mock", test))] +use gear_core::message::{ContextSettings, IncomingDispatch}; use gear_core::{ costs::{HostFnWeights, RuntimeCosts}, env::{Externalities, PayloadSliceLock, UnlockPayloadBound}, @@ -43,8 +45,8 @@ use gear_core::{ NoopGrowHandler, PageBuf, }, message::{ - ContextOutcomeDrain, ContextSettings, GasLimit, HandlePacket, IncomingDispatch, InitPacket, - MessageContext, Packet, ReplyPacket, + ContextOutcomeDrain, GasLimit, HandlePacket, InitPacket, MessageContext, Packet, + ReplyPacket, }, pages::{GearPage, PageU32Size, WasmPage}, reservation::GasReserver, diff --git a/pallets/gas/src/lib.rs b/pallets/gas/src/lib.rs index b9e8353fc49..79069af5103 100644 --- a/pallets/gas/src/lib.rs +++ b/pallets/gas/src/lib.rs @@ -139,8 +139,6 @@ mod mock; #[cfg(test)] mod tests; -pub mod migrations; - type BlockGasLimitOf = ::BlockGasLimit; type AccountIdOf = ::AccountId; diff --git a/pallets/gas/src/migrations/mod.rs b/pallets/gas/src/migrations/mod.rs deleted file mode 100644 index b36d19e65a1..00000000000 --- a/pallets/gas/src/migrations/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pub mod v1; -pub mod v2; diff --git a/pallets/gas/src/migrations/v1.rs b/pallets/gas/src/migrations/v1.rs deleted file mode 100644 index b864ca72c20..00000000000 --- a/pallets/gas/src/migrations/v1.rs +++ /dev/null @@ -1,355 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{AccountIdOf, Balance, Config, Pallet}; -use common::{ - gas_provider::{ChildrenRefs, GasNodeId, NodeLock}, - storage::MapStorage, - LockId, -}; -use frame_support::{ - pallet_prelude::*, - storage::{storage_prefix, KeyPrefixIterator}, - traits::{Get, GetStorageVersion, OnRuntimeUpgrade, PalletInfo}, -}; -use gear_core::ids::{MessageId, ProgramId, ReservationId}; -use sp_runtime::traits::{Saturating, Zero}; -use sp_std::collections::btree_set::BTreeSet; -#[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; - -pub const PALLET_GEAR_MESSENGER_NAME: &str = "GearMessenger"; -pub const WAITLIST_STORAGE_NAME: &str = "Waitlist"; -pub const MAILBOX_STORAGE_NAME: &str = "Mailbox"; -pub const DISPATCH_STASH_STORAGE_NAME: &str = "DispatchStash"; - -#[derive(Decode, Encode)] -pub enum OldGasNode { - External { - id: ExternalId, - value: Balance, - lock: Balance, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - Cut { - id: ExternalId, - value: Balance, - lock: Balance, - }, - Reserved { - id: ExternalId, - value: Balance, - lock: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - SpecifiedLocal { - parent: Id, - value: Balance, - lock: Balance, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - UnspecifiedLocal { - parent: Id, - lock: Balance, - system_reserve: Balance, - }, -} - -#[derive(Decode, Encode)] -pub enum GasNode { - External { - id: ExternalId, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - Cut { - id: ExternalId, - value: Balance, - lock: NodeLock, - }, - Reserved { - id: ExternalId, - value: Balance, - lock: NodeLock, - refs: ChildrenRefs, - consumed: bool, - }, - SpecifiedLocal { - parent: Id, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - UnspecifiedLocal { - parent: Id, - lock: NodeLock, - system_reserve: Balance, - }, -} - -#[derive(Decode, Default)] -pub struct WaitlistKey((ProgramId, MessageId)); -impl From for MessageId { - fn from(val: WaitlistKey) -> Self { - val.0 .1 - } -} - -#[derive(Decode, Default)] -pub struct MailboxKey((T::AccountId, MessageId)); -impl From> for MessageId { - fn from(val: MailboxKey) -> Self { - val.0 .1 - } -} - -pub type DispatchStashKey = MessageId; -pub(crate) type NodeId = GasNodeId; - -pub struct GasNodesPrefix(PhantomData<(T,)>); - -impl frame_support::traits::StorageInstance for GasNodesPrefix { - fn pallet_prefix() -> &'static str { - <::PalletInfo as PalletInfo>::name::>().expect("No name found for the pallet in the runtime! This usually means that the pallet wasn't added to `construct_runtime!`.") - } - const STORAGE_PREFIX: &'static str = "GasNodes"; -} - -pub type Key = GasNodeId; -pub type NodeOf = GasNode, Key, Balance>; - -// Private storage for missed blocks collection. -pub type GasNodes = StorageMap, Identity, Key, NodeOf>; - -// Public wrap of the missed blocks collection. -common::wrap_storage_map!( - storage: GasNodes, - name: GasNodesWrap, - key: Key, - value: NodeOf -); - -pub struct MigrateToV1(sp_std::marker::PhantomData); -impl OnRuntimeUpgrade for MigrateToV1 { - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - let version = >::on_chain_storage_version(); - - Ok(version.encode()) - } - - fn on_runtime_upgrade() -> Weight { - let current = StorageVersion::new(1); - let onchain = Pallet::::on_chain_storage_version(); - - log::info!( - "🚚 Running migration with current storage version {:?} / onchain {:?}", - current, - onchain - ); - - let mut db_reads = 1_u64; // already accessed onchain storage - if current == 1 && onchain == 0 { - let waitlist_storage_prefix = storage_prefix( - PALLET_GEAR_MESSENGER_NAME.as_bytes(), - WAITLIST_STORAGE_NAME.as_bytes(), - ); - let waitlist_keys = KeyPrefixIterator::new( - waitlist_storage_prefix.to_vec(), - waitlist_storage_prefix.to_vec(), - |mut key| Ok(WaitlistKey::decode(&mut key)?.into()), - ) - .collect::>(); - - let mailbox_storage_prefix = storage_prefix( - PALLET_GEAR_MESSENGER_NAME.as_bytes(), - MAILBOX_STORAGE_NAME.as_bytes(), - ); - let mailbox_keys = KeyPrefixIterator::new( - mailbox_storage_prefix.to_vec(), - mailbox_storage_prefix.to_vec(), - |mut key| Ok(MailboxKey::::decode(&mut key)?.into()), - ) - .collect::>(); - - let dispatch_stash_storage_prefix = storage_prefix( - PALLET_GEAR_MESSENGER_NAME.as_bytes(), - DISPATCH_STASH_STORAGE_NAME.as_bytes(), - ); - let dispatch_stash_keys = KeyPrefixIterator::new( - dispatch_stash_storage_prefix.to_vec(), - dispatch_stash_storage_prefix.to_vec(), - |mut key| DispatchStashKey::decode(&mut key), - ) - .collect::>(); - - db_reads = db_reads - .saturating_add(waitlist_keys.len() as u64) - .saturating_add(mailbox_keys.len() as u64) - .saturating_add(dispatch_stash_keys.len() as u64); - - // A function that tries to derive the actual lock type through storages scan - // Caveat: for simplicity sake we do not scan programs reservation maps: - // - assuming a lock to be a `Reservation` if the key is not found in other storages. - let appropriate_lock_id = |node_id: &NodeId| -> LockId { - match node_id { - NodeId::Node(msg_id) => { - if mailbox_keys.contains(msg_id) { - LockId::Mailbox - } else if waitlist_keys.contains(msg_id) { - LockId::Waitlist - } else if dispatch_stash_keys.contains(msg_id) { - LockId::DispatchStash - } else { - // Likely unreachable branch - LockId::Reservation - } - } - _ => LockId::Reservation, - } - }; - - let mut translated = 0_u64; - GasNodes::::translate::, NodeId, Balance>, _>( - |key, old_value| { - let mut new_lock = NodeLock::::zero(); - let new_value = match old_value { - OldGasNode::External { - id, - value, - lock, - system_reserve, - refs, - consumed, - } => { - if !lock.is_zero() { - new_lock[appropriate_lock_id(&key)] = lock; - } - GasNode::External { - id, - value, - lock: new_lock, - system_reserve, - refs, - consumed, - } - } - OldGasNode::Cut { id, value, lock } => { - if !lock.is_zero() { - new_lock[appropriate_lock_id(&key)] = lock; - } - GasNode::Cut { - id, - value, - lock: new_lock, - } - } - OldGasNode::Reserved { - id, - value, - lock, - refs, - consumed, - } => { - if !lock.is_zero() { - new_lock[appropriate_lock_id(&key)] = lock; - } - GasNode::Reserved { - id, - value, - lock: new_lock, - refs, - consumed, - } - } - OldGasNode::SpecifiedLocal { - parent, - value, - lock, - system_reserve, - refs, - consumed, - } => { - if !lock.is_zero() { - new_lock[appropriate_lock_id(&key)] = lock; - } - GasNode::SpecifiedLocal { - parent, - value, - lock: new_lock, - system_reserve, - refs, - consumed, - } - } - OldGasNode::UnspecifiedLocal { - parent, - lock, - system_reserve, - } => { - if !lock.is_zero() { - new_lock[appropriate_lock_id(&key)] = lock; - } - GasNode::UnspecifiedLocal { - parent, - lock: new_lock, - system_reserve, - } - } - }; - translated.saturating_inc(); - Some(new_value) - }, - ); - current.put::>(); - log::info!( - "Upgraded {} gas nodes, storage to version {:?}", - translated, - current - ); - T::DbWeight::get().reads_writes(translated + db_reads, translated + 1) - } else { - log::info!("❌ Migration did not execute. This probably should be removed"); - T::DbWeight::get().reads(db_reads) - } - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { - let old_version: StorageVersion = - Decode::decode(&mut state.as_ref()).map_err(|_| "Cannot decode version")?; - let onchain_version = Pallet::::on_chain_storage_version(); - assert_ne!( - onchain_version, old_version, - "must have upgraded from version 0 to 1." - ); - - log::info!("Storage successfully migrated."); - Ok(()) - } -} diff --git a/pallets/gas/src/migrations/v2.rs b/pallets/gas/src/migrations/v2.rs deleted file mode 100644 index d9428c487a6..00000000000 --- a/pallets/gas/src/migrations/v2.rs +++ /dev/null @@ -1,263 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{AccountIdOf, Balance, Config, GasNodes, Pallet}; -use common::gas_provider::{ChildrenRefs, GasNode, GasNodeId, NodeLock}; -use frame_support::{ - pallet_prelude::*, - traits::{Get, GetStorageVersion, OnRuntimeUpgrade}, -}; -use gear_core::ids::{MessageId, ReservationId}; -use sp_runtime::traits::Saturating; -#[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; - -pub(crate) type NodeId = GasNodeId; - -#[derive(Decode, Encode)] -pub enum OldGasNode { - External { - id: ExternalId, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - Cut { - id: ExternalId, - value: Balance, - lock: NodeLock, - }, - Reserved { - id: ExternalId, - value: Balance, - lock: NodeLock, - refs: ChildrenRefs, - consumed: bool, - }, - SpecifiedLocal { - parent: Id, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - UnspecifiedLocal { - parent: Id, - lock: NodeLock, - system_reserve: Balance, - }, -} - -pub struct MigrateToV2(sp_std::marker::PhantomData); -impl OnRuntimeUpgrade for MigrateToV2 { - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - let version = >::on_chain_storage_version(); - - Ok(version.encode()) - } - - fn on_runtime_upgrade() -> Weight { - let current = Pallet::::current_storage_version(); - let onchain = Pallet::::on_chain_storage_version(); - - log::info!( - "🚚 Running migration with current storage version {:?} / onchain {:?}", - current, - onchain - ); - - if current == 2 && onchain == 1 { - let mut translated = 0_u64; - GasNodes::::translate::, NodeId, Balance>, _>( - |_key, old_value| { - let new_value = match old_value { - OldGasNode::Cut { id, value, lock } => GasNode::Cut { id, value, lock }, - OldGasNode::External { - id, - value, - lock, - system_reserve, - refs, - consumed, - } => GasNode::External { - id, - value, - lock, - system_reserve, - refs, - consumed, - deposit: false, - }, - OldGasNode::Reserved { - id, - value, - lock, - refs, - consumed, - } => GasNode::Reserved { - id, - value, - lock, - refs, - consumed, - }, - OldGasNode::SpecifiedLocal { - parent, - value, - lock, - system_reserve, - refs, - consumed, - } => GasNode::SpecifiedLocal { - parent, - value, - lock, - system_reserve, - refs, - consumed, - }, - OldGasNode::UnspecifiedLocal { - parent, - lock, - system_reserve, - } => GasNode::UnspecifiedLocal { - parent, - lock, - system_reserve, - }, - }; - - translated.saturating_inc(); - Some(new_value) - }, - ); - current.put::>(); - log::info!( - "Upgraded {} gas nodes, storage to version {:?}", - translated, - current - ); - T::DbWeight::get().reads_writes(translated + 1, translated + 1) - } else { - log::info!("❌ Migration did not execute. This probably should be removed"); - T::DbWeight::get().reads(1) - } - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { - let old_version: StorageVersion = - Decode::decode(&mut state.as_ref()).map_err(|_| "Cannot decode version")?; - let onchain_version = Pallet::::on_chain_storage_version(); - assert_ne!( - onchain_version, old_version, - "must have upgraded from version 1 to 2." - ); - - log::info!("Storage successfully migrated."); - Ok(()) - } -} - -#[cfg(feature = "try-runtime")] -#[cfg(test)] -pub mod test_v2 { - use super::*; - use crate::{mock::*, AccountIdOf, Balance, GasNodes, Pallet}; - use common::{gas_provider::GasNode, Origin as _}; - use frame_support::{ - codec::Encode, - storage::{storage_prefix, unhashed}, - traits::{OnRuntimeUpgrade, PalletInfoAccess}, - Identity, StorageHasher, - }; - use gear_core::ids::MessageId; - use sp_core::H256; - use sp_runtime::traits::Zero; - - fn gas_nodes_storage_map_final_key(key: &NodeId) -> Vec { - let storage_prefix = storage_prefix(>::name().as_bytes(), b"GasNodes"); - let key_hashed = key.using_encoded(Identity::hash); - - [storage_prefix.as_ref(), key_hashed.as_ref()].concat() - } - - #[test] - fn migration_to_v2_works() { - let _ = env_logger::try_init(); - new_test_ext().execute_with(|| { - StorageVersion::new(1).put::>(); - - let nodes_amount = 25; - let message_ids = (0..nodes_amount) - .map(|_| MessageId::from_origin(H256::random())) - .collect::>(); - - // Populate gas nodes with old gas node type - message_ids.into_iter().for_each(|msg_id| { - let node_id = NodeId::Node(msg_id); - let key = gas_nodes_storage_map_final_key(&node_id); - let mut factor_bytes = [0_u8; 8]; - factor_bytes.copy_from_slice(&msg_id.as_ref()[0..8]); - let random_factor = u64::from_le_bytes(factor_bytes); - // Decide the node type - let node = match random_factor % 3 { - 0 => OldGasNode::, NodeId, Balance>::External { - id: 1_u64, - value: Balance::zero(), - lock: Zero::zero(), - system_reserve: Default::default(), - refs: Default::default(), - consumed: false, - }, - 1 => OldGasNode::, NodeId, Balance>::SpecifiedLocal { - parent: NodeId::Node(MessageId::from_origin(H256::random())), - value: Balance::zero(), - lock: Zero::zero(), - system_reserve: Default::default(), - refs: Default::default(), - consumed: false, - }, - _ => OldGasNode::, NodeId, Balance>::UnspecifiedLocal { - parent: NodeId::Node(MessageId::from_origin(H256::random())), - lock: Zero::zero(), - system_reserve: Default::default(), - }, - }; - - unhashed::put(&key[..], &node); - }); - - // run migration from v1 to v2. - let weight = MigrateToV2::::on_runtime_upgrade(); - assert_ne!(weight.ref_time(), 0); - - for (_key, node) in GasNodes::::iter() { - if let GasNode::External { deposit, .. } = node { - assert!(!deposit, "Incorrect migration"); - } - } - - assert_eq!(GasNodes::::iter().count(), nodes_amount) - }); - } -} diff --git a/pallets/gear-messenger/src/lib.rs b/pallets/gear-messenger/src/lib.rs index 302926e8514..cc32d5e3a8b 100644 --- a/pallets/gear-messenger/src/lib.rs +++ b/pallets/gear-messenger/src/lib.rs @@ -134,9 +134,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -// Database migration module. -pub mod migrations; - // Runtime mock for running tests. #[cfg(test)] mod mock; diff --git a/pallets/gear-messenger/src/migrations.rs b/pallets/gear-messenger/src/migrations.rs deleted file mode 100644 index cc00c3c8d20..00000000000 --- a/pallets/gear-messenger/src/migrations.rs +++ /dev/null @@ -1,507 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{Config, Pallet}; -use frame_support::{ - traits::{Get, GetStorageVersion, OnRuntimeUpgrade}, - weights::Weight, -}; -use sp_std::marker::PhantomData; - -#[cfg(feature = "try-runtime")] -use { - frame_support::{ - codec::{Decode, Encode}, - traits::StorageVersion, - }, - sp_std::vec::Vec, -}; - -pub struct MigrateToV2(PhantomData); - -impl OnRuntimeUpgrade for MigrateToV2 { - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - // Currently running on chain storage version of the pallets storage. - let version = >::on_chain_storage_version(); - - Ok(version.encode()) - } - - fn on_runtime_upgrade() -> Weight { - // Versions query. - let current = Pallet::::current_storage_version(); - let onchain = Pallet::::on_chain_storage_version(); - - // Debug information. - log::info!( - "🚚 Running migration with current storage version {:?} / onchain {:?}", - current, - onchain - ); - - // Total weight of migration. - // - // Starts from single read: query of current storages version above. - let mut weight = T::DbWeight::get().reads(1); - - // Function of increasing weight per each translated value in storage. - // - // Firstly we read each value, then process it inside - // `translate` closure, writing new value afterward. - let mut add_translated = || { - weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1)); - }; - - // Check defining should we execute migrations or not. - if current == 2 && onchain == 1 { - // Translation of `Dispatches` storage. - crate::Dispatches::::translate_values(|value| { - add_translated(); - Some(transition::dispatches(value)) - }); - - // Translation of `Mailbox` storage. - crate::Mailbox::::translate_values(|value| { - add_translated(); - Some(transition::mailbox::(value)) - }); - - // Translation of `Waitlist` storage. - crate::Waitlist::::translate_values(|value| { - add_translated(); - Some(transition::waitlist::(value)) - }); - - // Translation of `DispatchStash` storage. - crate::DispatchStash::::translate_values(|value| { - add_translated(); - Some(transition::dispatch_stash::(value)) - }); - - // Adding weight for write of newly updated storage version. - weight = weight.saturating_add(T::DbWeight::get().writes(1)); - current.put::>(); - - // Success debug information. - log::info!("Successfully migrated storage from v1 to v2"); - } else { - // Skipped debug information. - log::info!("❌ Migration did not execute. This probably should be removed"); - } - - // Total weight of migration. - weight - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { - // Query of pre-runtime upgrade version of pallets storage. - let old_version: StorageVersion = - Decode::decode(&mut state.as_ref()).map_err(|_| "Cannot decode version")?; - - // Query of newly updated on chain version of pallets storage. - let onchain_version = Pallet::::on_chain_storage_version(); - - // Assertion that version changed. - assert_ne!( - onchain_version, old_version, - "must have upgraded from version 1 to 2." - ); - - // Debug information. - log::info!("Storage successfully migrated."); - Ok(()) - } -} - -mod v1 { - use frame_support::{ - codec::{self, Decode, Encode}, - scale_info::{self, TypeInfo}, - storage_alias, Identity, - }; - - // Pay attention that these types were taken from - // actual codebase due to changes absence. - use common::storage::{Interval, LinkedNode}; - use gear_core::{ - ids::{MessageId, ProgramId}, - message::{ContextStore, DispatchKind, Payload}, - }; - - #[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] - #[codec(crate = codec)] - #[scale_info(crate = scale_info)] - pub enum MessageDetails { - Reply(ReplyDetails), - Signal(SignalDetails), - } - - #[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] - #[codec(crate = codec)] - #[scale_info(crate = scale_info)] - pub struct ReplyDetails { - pub reply_to: MessageId, - pub status_code: i32, - } - - #[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] - #[codec(crate = codec)] - #[scale_info(crate = scale_info)] - pub struct SignalDetails { - pub from: MessageId, - pub status_code: i32, - } - - #[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] - #[codec(crate = codec)] - #[scale_info(crate = scale_info)] - pub struct StoredMessage { - pub id: MessageId, - pub source: ProgramId, - pub destination: ProgramId, - pub payload: Payload, - #[codec(compact)] - pub value: u128, - pub details: Option, - } - - #[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] - #[codec(crate = codec)] - #[scale_info(crate = scale_info)] - pub struct StoredDispatch { - pub kind: DispatchKind, - pub message: StoredMessage, - pub context: Option, - } - - #[storage_alias] - pub type Dispatches = CountedStorageMap< - crate::Pallet, - Identity, - MessageId, - LinkedNode, - >; - - #[storage_alias] - pub type Mailbox = StorageDoubleMap< - crate::Pallet, - Identity, - ::AccountId, - Identity, - MessageId, - ( - StoredMessage, - Interval<::BlockNumber>, - ), - >; - - #[storage_alias] - pub type Waitlist = StorageDoubleMap< - crate::Pallet, - Identity, - ProgramId, - Identity, - MessageId, - ( - StoredDispatch, - Interval<::BlockNumber>, - ), - >; - - #[storage_alias] - pub type DispatchStash = StorageMap< - crate::Pallet, - Identity, - MessageId, - ( - StoredDispatch, - Interval<::BlockNumber>, - ), - >; -} - -mod transition { - use crate::Config; - - // Old types. - use super::v1; - - // Actual and unchanged types. - use common::storage::{Interval, LinkedNode}; - use gear_core::{ - ids::MessageId, - message::{ - MessageDetails, ReplyDetails, SignalDetails, StoredDispatch, StoredMessage, - UserStoredMessage, - }, - }; - use gear_core_errors::{ - ErrorReplyReason, ReplyCode, SignalCode, SimpleExecutionError, SuccessReplyReason, - }; - - fn reply_details(old_details: v1::ReplyDetails) -> ReplyDetails { - let to = old_details.reply_to; - - let code = if old_details.status_code == 0 { - ReplyCode::Success(SuccessReplyReason::Unsupported) - } else { - ReplyCode::Error(ErrorReplyReason::Unsupported) - }; - - ReplyDetails::new(to, code) - } - - fn signal_details(old_details: v1::SignalDetails) -> SignalDetails { - let to = old_details.from; - - let code = SignalCode::Execution(SimpleExecutionError::Unsupported); - - SignalDetails::new(to, code) - } - - fn message_details(old_details: v1::MessageDetails) -> MessageDetails { - match old_details { - v1::MessageDetails::Reply(old_reply_details) => { - MessageDetails::Reply(reply_details(old_reply_details)) - } - v1::MessageDetails::Signal(old_signal_details) => { - MessageDetails::Signal(signal_details(old_signal_details)) - } - } - } - - fn stored_message(old_message: v1::StoredMessage) -> StoredMessage { - StoredMessage::new( - old_message.id, - old_message.source, - old_message.destination, - old_message.payload, - old_message.value, - old_message.details.map(message_details), - ) - } - - fn stored_dispatch(old_dispatch: v1::StoredDispatch) -> StoredDispatch { - StoredDispatch::new( - old_dispatch.kind, - stored_message(old_dispatch.message), - old_dispatch.context, - ) - } - - fn user_stored_message(old_message: v1::StoredMessage) -> UserStoredMessage { - let stored_message = stored_message(old_message); - - stored_message - .try_into() - .unwrap_or_else(|_| unreachable!("Signal messages must never be sent to user!")) - } - - pub fn dispatches( - old_value: LinkedNode, - ) -> LinkedNode { - LinkedNode { - next: old_value.next, - value: stored_dispatch(old_value.value), - } - } - - pub fn mailbox( - old_value: (v1::StoredMessage, Interval), - ) -> (UserStoredMessage, Interval) { - (user_stored_message(old_value.0), old_value.1) - } - - pub fn waitlist( - old_value: (v1::StoredDispatch, Interval), - ) -> (StoredDispatch, Interval) { - (stored_dispatch(old_value.0), old_value.1) - } - - pub fn dispatch_stash( - old_value: (v1::StoredDispatch, Interval), - ) -> (StoredDispatch, Interval) { - (stored_dispatch(old_value.0), old_value.1) - } -} - -#[cfg(all(test, feature = "try-runtime"))] -mod tests { - use super::v1; - use crate::mock; - use common::{ - storage::{Interval, LinkedNode}, - Origin as _, - }; - use frame_support::{ - traits::{Get, GetStorageVersion, OnRuntimeUpgrade, StorageVersion}, - weights::RuntimeDbWeight, - }; - use gear_core::{ - ids::{MessageId, ProgramId}, - message::DispatchKind, - }; - use primitive_types::H256; - - fn generate_dispatch() -> v1::StoredDispatch { - let id = H256::random(); - let byte: u8 = id.as_ref()[0]; - - v1::StoredDispatch { - kind: match byte % 4 { - 0 => DispatchKind::Init, - 1 => DispatchKind::Handle, - 2 => DispatchKind::Reply, - _ => DispatchKind::Signal, - }, - message: v1::StoredMessage { - id: MessageId::from_origin(id), - source: ProgramId::from_origin(H256::random()), - destination: ProgramId::from_origin(H256::random()), - payload: H256::random() - .as_ref() - .to_vec() - .try_into() - .expect("Infallible"), - value: byte as u128 * 12_345, - details: match byte % 4 { - 0 | 1 => None, - 2 => Some(v1::MessageDetails::Reply(v1::ReplyDetails { - reply_to: MessageId::from_origin(H256::random()), - status_code: byte as i32 % 2, - })), - _ => Some(v1::MessageDetails::Signal(v1::SignalDetails { - from: MessageId::from_origin(H256::random()), - status_code: byte as i32, - })), - }, - }, - context: (byte % 2 == 0).then(Default::default), - } - } - - #[test] - fn migrate_v1_to_v2() { - let _ = env_logger::try_init(); - - mock::new_test_ext().execute_with(|| { - // Setting previous storage version. - StorageVersion::new(1).put::(); - - let interval = Interval::<::BlockNumber> { - start: 1, - finish: 101, - }; - - // `Dispatches` insertion. - let dispatches = (0..10).map(|_| generate_dispatch()).collect::>(); - - for dispatch in dispatches.clone() { - v1::Dispatches::::insert( - dispatch.message.id, - LinkedNode { - next: None, - value: dispatch, - }, - ); - } - - // `Waitlist` insertion. - let waitlisted = (0..10).map(|_| generate_dispatch()).collect::>(); - - for dispatch in waitlisted.clone() { - v1::Waitlist::::insert( - dispatch.message.destination, - dispatch.message.id, - (dispatch, interval.clone()), - ); - } - - // `DispatchStash` insertion. - let stashed = (0..10).map(|_| generate_dispatch()).collect::>(); - - for dispatch in stashed.clone() { - v1::DispatchStash::::insert( - dispatch.message.id, - (dispatch, interval.clone()), - ); - } - - // `Mailbox` insertion. - let mailboxed = (0..40) - .filter_map(|_| { - let dispatch = generate_dispatch(); - (dispatch.kind == DispatchKind::Handle).then_some(dispatch.message) - }) - .collect::>(); - - for message in mailboxed.clone() { - v1::Mailbox::::insert( - ::AccountId::from_origin( - message.id.into_origin(), - ), - message.id, - (message, interval.clone()), - ); - } - - // Total count of messages. - let transmuted = dispatches.len() + waitlisted.len() + stashed.len() + mailboxed.len(); - // Total amount of read writes equals total count of messages and version read and write. - let total = (transmuted + 1) - .try_into() - .expect("Read-writes count overflow"); - let expected_weight = - <::DbWeight as Get>::get() - .reads_writes(total, total); - - let state = - super::MigrateToV2::::pre_upgrade().expect("pre_upgrade failed"); - let weight = super::MigrateToV2::::on_runtime_upgrade(); - - assert_eq!(weight.ref_time(), expected_weight.ref_time()); - - super::MigrateToV2::::post_upgrade(state).unwrap(); - - // Asserting amount of messages. - assert_eq!( - crate::Dispatches::::iter().count(), - dispatches.len() - ); - assert_eq!( - crate::Waitlist::::iter().count(), - waitlisted.len() - ); - assert_eq!( - crate::DispatchStash::::iter().count(), - stashed.len() - ); - assert_eq!( - crate::Mailbox::::iter().count(), - mailboxed.len() - ); - // Asserting version set. - assert_eq!( - mock::GearMessenger::on_chain_storage_version(), - crate::MESSENGER_STORAGE_VERSION - ); - }); - } -} diff --git a/pallets/gear-program/src/lib.rs b/pallets/gear-program/src/lib.rs index 57fc602e7e0..8d6e8c0cea3 100644 --- a/pallets/gear-program/src/lib.rs +++ b/pallets/gear-program/src/lib.rs @@ -133,14 +133,9 @@ use sp_std::{convert::TryInto, prelude::*}; pub use pallet::*; -pub mod migration; - #[cfg(test)] mod mock; -pub(crate) type TaskPoolOf = - <::Scheduler as common::scheduler::Scheduler>::TaskPool; - #[frame_support::pallet] pub mod pallet { use super::*; diff --git a/pallets/gear-program/src/migration.rs b/pallets/gear-program/src/migration.rs deleted file mode 100644 index b590f86df10..00000000000 --- a/pallets/gear-program/src/migration.rs +++ /dev/null @@ -1,237 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{Config, Pallet, ProgramStorage, TaskPoolOf}; -use common::{scheduler::*, Program}; -use frame_support::{ - traits::{Get, GetStorageVersion, OnRuntimeUpgrade}, - weights::Weight, -}; -use sp_runtime::Saturating; -use sp_std::marker::PhantomData; - -#[cfg(feature = "try-runtime")] -use { - frame_support::{ - codec::{Decode, Encode}, - traits::StorageVersion, - }, - sp_std::vec::Vec, -}; - -// almost 2 month for networks with 1-second block production -pub const FREE_PERIOD: u32 = 5_000_000; -static_assertions::const_assert!(FREE_PERIOD > 0); - -pub struct MigrateToV2(PhantomData); - -impl OnRuntimeUpgrade for MigrateToV2 { - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - assert_eq!( - StorageVersion::get::>(), - 1, - "Can only upgrade from version 1" - ); - - let count = ProgramStorage::::iter_keys().count() as u64; - - Ok(count.encode()) - } - - fn on_runtime_upgrade() -> Weight { - let current = Pallet::::current_storage_version(); - let onchain = Pallet::::on_chain_storage_version(); - - log::info!( - "🚚 Running migration with current storage version {:?} / onchain {:?}", - current, - onchain - ); - - // 1 read for on chain storage version - let mut weight = T::DbWeight::get().reads(1); - - if current == 2 && onchain == 1 { - ProgramStorage::::translate( - |program_id, (program, _bn): (v1::Program, ::BlockNumber)| { - weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1)); - - Some(match program { - v1::Program::Active(p) => { - let block_number = T::CurrentBlockNumber::get(); - let expiration_block = block_number.saturating_add(FREE_PERIOD.into()); - let task = ScheduledTask::PauseProgram(program_id); - TaskPoolOf::::add(expiration_block, task) - .unwrap_or_else(|e| unreachable!("Scheduling logic invalidated! {:?}", e)); - - Program::Active(common::ActiveProgram { - allocations: p.allocations, - pages_with_data: p.pages_with_data, - gas_reservation_map: p.gas_reservation_map, - code_hash: p.code_hash, - code_exports: p.code_exports, - static_pages: p.static_pages, - state: p.state, - expiration_block, - }) - } - v1::Program::Exited(id) => Program::Exited(id), - v1::Program::Terminated(id) => Program::Terminated(id), - }) - }, - ); - - current.put::>(); - - log::info!("Successfully migrated storage from v1 to v2"); - } else { - log::info!("❌ Migration did not execute. This probably should be removed"); - } - - weight - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { - assert_eq!(StorageVersion::get::>(), 2, "Must upgrade"); - - // Check that everything decoded fine. - let count = ProgramStorage::::iter_keys().fold(0u64, |i, k| { - let Ok(program) = ProgramStorage::::try_get(k) else { - unreachable!("Cannot decode v2 Program"); - }; - - if let Program::Active(p) = program { - assert!(p.expiration_block >= FREE_PERIOD.into()); - } - - i + 1 - }); - - let old_count: u64 = - Decode::decode(&mut &state[..]).expect("pre_upgrade provides a valid state; qed"); - assert_eq!(count, old_count); - - Ok(()) - } -} - -mod v1 { - use common::ProgramState; - use frame_support::{ - codec::{self, Decode, Encode}, - scale_info::{self, TypeInfo}, - }; - use gear_core::{ - ids::ProgramId, - message::DispatchKind, - pages::{GearPage, WasmPage}, - reservation::GasReservationMap, - }; - use primitive_types::H256; - use sp_std::{collections::btree_set::BTreeSet, prelude::*}; - - #[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] - #[codec(crate = codec)] - #[scale_info(crate = scale_info)] - pub struct ActiveProgram { - pub allocations: BTreeSet, - pub pages_with_data: BTreeSet, - pub gas_reservation_map: GasReservationMap, - pub code_hash: H256, - pub code_exports: BTreeSet, - pub static_pages: WasmPage, - pub state: ProgramState, - } - - #[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] - #[codec(crate = codec)] - #[scale_info(crate = scale_info)] - pub enum Program { - Active(ActiveProgram), - Exited(ProgramId), - Terminated(ProgramId), - } -} - -#[cfg(test)] -#[cfg(feature = "try-runtime")] -mod test { - use super::*; - use crate::mock::*; - use common::ProgramState; - use frame_support::{migration, Hashable, StoragePrefixedMap}; - use frame_system::pallet_prelude::BlockNumberFor; - use gear_core::ids::ProgramId; - - #[test] - fn migration_to_v2_works() { - new_test_ext().execute_with(|| { - StorageVersion::new(1).put::(); - - let module = ProgramStorage::::module_prefix(); - let item = ProgramStorage::::storage_prefix(); - - // add active program - let program_id = ProgramId::from(1u64); - let block_number: BlockNumberFor = 0u32.into(); - let program = v1::Program::Active(v1::ActiveProgram { - allocations: Default::default(), - pages_with_data: Default::default(), - gas_reservation_map: Default::default(), - code_hash: Default::default(), - code_exports: Default::default(), - static_pages: 13.into(), - state: ProgramState::Initialized, - }); - migration::put_storage_value( - module, - item, - &program_id.identity(), - (program, block_number), - ); - - // add exited program - let program = v1::Program::Exited(program_id); - let program_id = ProgramId::from(2u64); - migration::put_storage_value( - module, - item, - &program_id.identity(), - (program, block_number), - ); - - // add terminated program - let program = v1::Program::Terminated(program_id); - let program_id = ProgramId::from(3u64); - migration::put_storage_value( - module, - item, - &program_id.identity(), - (program, block_number), - ); - - let state = MigrateToV2::::pre_upgrade().unwrap(); - let _w = MigrateToV2::::on_runtime_upgrade(); - MigrateToV2::::post_upgrade(state).unwrap(); - - assert_eq!(StorageVersion::get::(), 2); - }) - } -} diff --git a/pallets/gear-scheduler/src/lib.rs b/pallets/gear-scheduler/src/lib.rs index ebd7ceb1486..eadecd43ca0 100644 --- a/pallets/gear-scheduler/src/lib.rs +++ b/pallets/gear-scheduler/src/lib.rs @@ -20,9 +20,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -// Database migration module. -pub mod migration; - // Runtime mock for running tests. #[cfg(test)] mod mock; diff --git a/pallets/gear-scheduler/src/migration.rs b/pallets/gear-scheduler/src/migration.rs deleted file mode 100644 index f67011c922e..00000000000 --- a/pallets/gear-scheduler/src/migration.rs +++ /dev/null @@ -1,146 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Database migration module. - -use crate::{pallet, Config, Pallet, Weight}; -use frame_support::traits::{Get, GetStorageVersion, OnRuntimeUpgrade}; -use sp_std::marker::PhantomData; -#[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; - -mod v1 { - use crate::{Config, Pallet}; - use common::storage::ValueStorage; - use frame_support::{pallet_prelude::StorageValue, traits::PalletInfo}; - use frame_system::pallet_prelude::BlockNumberFor; - use sp_std::{collections::btree_set::BTreeSet, marker::PhantomData}; - - // BTreeSet used to exclude duplicates and always keep collection sorted. - /// Missed blocks collection type. - /// - /// Defines block number, which should already contain no tasks, - /// because they were processed before. - /// Missed blocks processing prioritized. - pub type MissedBlocksCollection = BTreeSet>; - - pub struct MissedBlocksPrefix(PhantomData<(T,)>); - - impl frame_support::traits::StorageInstance for MissedBlocksPrefix { - fn pallet_prefix() -> &'static str { - <::PalletInfo as PalletInfo>::name::>().expect("No name found for the pallet in the runtime! This usually means that the pallet wasn't added to `construct_runtime!`.") - } - const STORAGE_PREFIX: &'static str = "MissedBlocks"; - } - - // Private storage for missed blocks collection. - pub type MissedBlocks = StorageValue, MissedBlocksCollection>; - - // Public wrap of the missed blocks collection. - common::wrap_storage_value!( - storage: MissedBlocks, - name: MissedBlocksWrap, - value: MissedBlocksCollection - ); -} - -pub struct MigrateToV2(PhantomData); - -impl OnRuntimeUpgrade for MigrateToV2 { - fn on_runtime_upgrade() -> Weight { - let current = Pallet::::current_storage_version(); - let onchain = Pallet::::on_chain_storage_version(); - - log::info!( - "🚚 Running migration with current storage version {:?} / onchain {:?}", - current, - onchain - ); - - let mut weight = T::DbWeight::get().reads(1); // 1 read for on chain storage version. - - if current == 2 && onchain == 1 { - let set = v1::MissedBlocks::::take(); - let bn = set.and_then(|set| set.first().copied()); - pallet::FirstIncompleteTasksBlock::::set(bn); - - current.put::>(); - - log::info!("Successfully migrated storage from v1 to v2"); - - // 1 read for `MissedBlocks` - // 1 write for `FirstIncompleteTasksBlock` - weight += T::DbWeight::get().reads_writes(1, 1) - } else { - log::info!("❌ Migration did not execute. This probably should be removed"); - } - - weight - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - use parity_scale_codec::Encode; - - let set = v1::MissedBlocks::::get(); - assert!(!pallet::FirstIncompleteTasksBlock::::exists()); - Ok(set.encode()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { - use parity_scale_codec::Decode; - - assert!(!v1::MissedBlocks::::exists()); - let first_incomplete_tasks_block = pallet::FirstIncompleteTasksBlock::::get(); - let set: Option> = Decode::decode(&mut &state[..]).unwrap(); - assert_eq!( - first_incomplete_tasks_block, - set.and_then(|set| set.first().copied()) - ); - Ok(()) - } -} - -#[cfg(feature = "try-runtime")] -#[cfg(test)] -mod tests { - use super::*; - use crate::mock::*; - use common::storage::ValueStorage; - use frame_support::traits::StorageVersion; - - #[test] - fn migrate_to_v2() { - new_test_ext().execute_with(|| { - StorageVersion::new(1).put::>(); - - v1::MissedBlocksWrap::::put([1_u32, 2, 3, 6, 7, 8].map(Into::into).into()); - - let state = MigrateToV2::::pre_upgrade().unwrap(); - let weight = MigrateToV2::::on_runtime_upgrade(); - assert_ne!(weight.ref_time(), 0); - MigrateToV2::::post_upgrade(state).unwrap(); - - assert_eq!( - pallet::FirstIncompleteTasksBlock::::get(), - Some(1_u32.into()) - ); - }) - } -} diff --git a/pallets/gear-voucher/src/lib.rs b/pallets/gear-voucher/src/lib.rs index d9858db437e..7d8258ad107 100644 --- a/pallets/gear-voucher/src/lib.rs +++ b/pallets/gear-voucher/src/lib.rs @@ -49,7 +49,6 @@ #[cfg(feature = "runtime-benchmarks")] mod benchmarking; -pub mod migration; pub mod weights; #[cfg(test)] diff --git a/pallets/gear-voucher/src/migration.rs b/pallets/gear-voucher/src/migration.rs deleted file mode 100644 index d0c34413cf9..00000000000 --- a/pallets/gear-voucher/src/migration.rs +++ /dev/null @@ -1,31 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Storage migration module. - -use crate::{Config, Pallet, Weight}; - -/// Wrapper for all migrations of this pallet, based on `StorageVersion`. -pub fn migrate() -> Weight { - use frame_support::traits::StorageVersion; - - let _version = StorageVersion::get::>(); - let weight: Weight = Weight::zero(); - - weight -} diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 7b7f7407c2a..22ce9fa94ff 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -33,7 +33,6 @@ mod runtime_api; mod schedule; pub mod manager; -pub mod migration; pub mod weights; #[cfg(test)] diff --git a/pallets/gear/src/migration.rs b/pallets/gear/src/migration.rs deleted file mode 100644 index a3b247bc978..00000000000 --- a/pallets/gear/src/migration.rs +++ /dev/null @@ -1,29 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{Config, Pallet, Weight}; - -/// Wrapper for all migrations of this pallet, based on `StorageVersion`. -pub fn migrate() -> Weight { - use frame_support::traits::StorageVersion; - - let _version = StorageVersion::get::>(); - let weight: Weight = Weight::zero(); - - weight -} diff --git a/pallets/staking-rewards/src/lib.rs b/pallets/staking-rewards/src/lib.rs index 0a93180a964..a379e014e8b 100644 --- a/pallets/staking-rewards/src/lib.rs +++ b/pallets/staking-rewards/src/lib.rs @@ -41,10 +41,10 @@ #![allow(clippy::items_after_test_module)] pub mod extension; -mod inflation; -pub mod migration; pub mod weights; +mod inflation; + #[cfg(test)] mod mock; diff --git a/pallets/staking-rewards/src/migration.rs b/pallets/staking-rewards/src/migration.rs deleted file mode 100644 index 28933c1380c..00000000000 --- a/pallets/staking-rewards/src/migration.rs +++ /dev/null @@ -1,109 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate::{pallet, Config, Pallet, Weight}; -use frame_support::traits::{Get, GetStorageVersion, OnRuntimeUpgrade}; -use sp_runtime::Perquintill; -use sp_std::marker::PhantomData; -#[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; - -pub struct MigrateToV2(PhantomData); - -impl OnRuntimeUpgrade for MigrateToV2 { - fn on_runtime_upgrade() -> Weight { - let current = Pallet::::current_storage_version(); - let onchain = Pallet::::on_chain_storage_version(); - - log::info!( - "🚚 Running migration with current storage version {:?} / onchain {:?}", - current, - onchain - ); - - let mut weight = T::DbWeight::get().reads(1); // 1 read for on chain storage version. - - if current == 2 && onchain == 1 { - // Adjusted target inflation parameter: 6.00% - let adjusted_inflation: Perquintill = Perquintill::from_percent(6); - pallet::TargetInflation::::put(adjusted_inflation); - - current.put::>(); - - log::info!("Successfully migrated storage from v1 to v2"); - - // 1 write for `TargetInflation` + 1 write for `StorageVersion` - weight += T::DbWeight::get().writes(2) - } else { - log::info!("❌ Migration did not execute. This probably should be removed"); - } - - weight - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - use parity_scale_codec::Encode; - - let inflation = pallet::TargetInflation::::get(); - assert_eq!(inflation, Perquintill::from_rational(578_u64, 10_000_u64)); - Ok(inflation.encode()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { - use parity_scale_codec::Decode; - - let old_inflation: Perquintill = Decode::decode(&mut &state[..]).unwrap(); - let new_inflation = pallet::TargetInflation::::get(); - assert_ne!(old_inflation, new_inflation); - assert_eq!(new_inflation, Perquintill::from_percent(6)); - Ok(()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::mock::*; - use frame_support::traits::StorageVersion; - - #[test] - fn migrate_to_v2() { - ExtBuilder::default() - .initial_authorities(vec![(VAL_1_STASH, VAL_1_CONTROLLER, VAL_1_AUTH_ID)]) - .stash(VALIDATOR_STAKE) - .endowment(ENDOWMENT) - .target_inflation(Perquintill::from_rational(578_u64, 10_000_u64)) - .build() - .execute_with(|| { - StorageVersion::new(1).put::>(); - - let weight = MigrateToV2::::on_runtime_upgrade(); - assert_eq!( - weight, - ::DbWeight::get().reads_writes(1, 2) - ); - - assert_eq!( - pallet::TargetInflation::::get(), - Perquintill::from_percent(6), - ); - }) - } -} diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 8f2a074d3b1..8620bd086fd 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -20,7 +20,6 @@ mod apis; pub mod constants; -pub mod migrations; pub mod weights; use frame_support::{ diff --git a/runtime/common/src/migrations.rs b/runtime/common/src/migrations.rs deleted file mode 100644 index 56d6da5ad7a..00000000000 --- a/runtime/common/src/migrations.rs +++ /dev/null @@ -1,162 +0,0 @@ -use frame_support::{ - pallet_prelude::Weight, - traits::{Currency, OnRuntimeUpgrade, ReservableCurrency}, -}; -use frame_system::AccountInfo; -use gear_common::{storage::LinkedNode, GasPrice, GasProvider, GasTree, Origin}; -use gear_core::ids::ProgramId; -use sp_runtime::traits::{Get, UniqueSaturatedInto, Zero}; -#[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; - -type AccountIdOf = ::AccountId; -type Balances = pallet_balances::Pallet; -type GearGas = pallet_gear_gas::Pallet; -type GearBank = pallet_gear_bank::Pallet; -type GasHandlerOf = as GasProvider>::GasTree; -type GasNodesOf = pallet_gear_gas::GasNodes; -type AccountsOf = frame_system::Account; -type CurrencyOf = ::Currency; -type BalanceOf = as Currency>>::Balance; -type DispatchesOf = pallet_gear_messenger::Dispatches; -type MailboxOf = pallet_gear_messenger::Mailbox; -type WaitlistOf = pallet_gear_messenger::Waitlist; -type DispatchStashOf = pallet_gear_messenger::DispatchStash; - -pub struct MigrateToGearBank(sp_std::marker::PhantomData<(T, P)>) -where - T: frame_system::Config>> - + pallet_balances::Config> - + pallet_gear_gas::Config - + pallet_gear_bank::Config - + pallet_gear_messenger::Config, - P: GasPrice>, - AccountIdOf: Origin; - -impl OnRuntimeUpgrade for MigrateToGearBank -where - T: frame_system::Config>> - + pallet_balances::Config> - + pallet_gear_gas::Config - + pallet_gear_bank::Config - + pallet_gear_messenger::Config, - P: GasPrice>, - AccountIdOf: Origin, -{ - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - Ok(Default::default()) - } - - fn on_runtime_upgrade() -> Weight { - let version = T::Version::get().spec_version; - - log::info!("🚚 Running migration to gear-bank with current spec version {version:?}"); - - if version <= 320 { - let mut ops = 0u64; - - // Depositing gas from gas nodes. - let gas_nodes_iter = GasNodesOf::::iter(); - for (node_id, gas_node) in gas_nodes_iter { - let Ok(external) = GasHandlerOf::::get_external(node_id) else { - log::error!("Failed to get external id of {node_id:?}"); - continue; - }; - - let gas_amount = gas_node.total_value(); - - let gas_price = P::gas_price(gas_amount); - log::debug!("Gas nodes: {node_id:?} = {gas_amount} ({gas_price:?})"); - log::debug!( - "Gas nodes external: {external:?} = {:?}; {:?}", - Balances::::free_balance(&external), - Balances::::reserved_balance(&external) - ); - if !Balances::::unreserve(&external, gas_price).is_zero() { - log::error!( - "Failed to unreserve all requested value: {external:?} ({gas_price:?})" - ) - } - if let Err(err) = GearBank::::deposit_gas::

(&external, gas_amount) { - log::error!("Failed to deposit gas {err:?}: {external:?} ({gas_amount:?})"); - continue; - }; - - // Just random approximate amount of operations, - // that will be meant as write operations. - // - // Two writes into balances (system_pallet), single write - // into gear-bank pallet and several read that will with - // optimizations result into ~4 writes. - ops += 4; - } - - let mut deposit = |source: ProgramId, value: u128| { - let source = AccountIdOf::::from_origin(source.into_origin()); - let value = value.unique_saturated_into(); - if !Balances::::unreserve(&source, value).is_zero() { - log::error!("Failed to unreserve all requested value: {source:?} ({value:?})"); - } - if let Err(err) = GearBank::::deposit_value(&source, value) { - log::error!("Failed to deposit value {err:?}: {source:?} ({value:?})"); - }; - - // Just random approximate amount of operations, - // that will be meant as write operations. - ops += 3; - }; - - // Dispatches value migration. - let dispatches_iter = DispatchesOf::::iter_values(); - for LinkedNode { - value: dispatch, .. - } in dispatches_iter - { - deposit(dispatch.source(), dispatch.value()); - } - - // Mailbox value migration. - let mailbox_iter = MailboxOf::::iter_values(); - for (message, _) in mailbox_iter { - deposit(message.source(), message.value()); - } - - // Waitlist value migration. - let waitlist_iter = WaitlistOf::::iter_values(); - for (dispatch, _) in waitlist_iter { - deposit(dispatch.source(), dispatch.value()); - } - - // DispatchStash value migration. - let dispatch_stash_iter = DispatchStashOf::::iter_values(); - for (dispatch, _) in dispatch_stash_iter { - deposit(dispatch.source(), dispatch.value()); - } - - // Depositing value. - let accounts_iter = AccountsOf::::iter(); - for (account_id, AccountInfo { data, .. }) in accounts_iter { - let reserve = data.reserved; - if !reserve.is_zero() && !Balances::::unreserve(&account_id, reserve).is_zero() { - log::error!( - "Failed to unreserve all requested value: {account_id:?} ({reserve:?})" - ); - } - } - - T::DbWeight::get().writes(ops) - } else { - log::info!( - "❌ Migration to gear-bank did not execute. This probably should be removed" - ); - Zero::zero() - } - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: Vec) -> Result<(), &'static str> { - log::info!("Runtime successfully migrated to gear-bank."); - Ok(()) - } -} diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 5d38f62871a..09487031cb0 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -125,7 +125,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 320, + spec_version: 330, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/gear/src/migrations.rs b/runtime/gear/src/migrations.rs index 19efd2314f0..248916f1fad 100644 --- a/runtime/gear/src/migrations.rs +++ b/runtime/gear/src/migrations.rs @@ -16,6 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#[allow(unused)] use crate::*; -pub type Migrations = (runtime_common::migrations::MigrateToGearBank,); +pub type Migrations = (); diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index f7f240c1303..b10895090f3 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -146,7 +146,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 320, + spec_version: 330, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/vara/src/migrations.rs b/runtime/vara/src/migrations.rs index 6e9415dd776..248916f1fad 100644 --- a/runtime/vara/src/migrations.rs +++ b/runtime/vara/src/migrations.rs @@ -1,10 +1,22 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#[allow(unused)] use crate::*; -pub type Migrations = ( - pallet_gear_gas::migrations::v1::MigrateToV1, - pallet_gear_scheduler::migration::MigrateToV2, - pallet_gear_gas::migrations::v2::MigrateToV2, - pallet_gear_messenger::migrations::MigrateToV2, - pallet_gear_staking_rewards::migration::MigrateToV2, - runtime_common::migrations::MigrateToGearBank, -); +pub type Migrations = (); From 807472a1f98dac94f291b41b84d6f8a4fbd80584 Mon Sep 17 00:00:00 2001 From: mertwole <33563701+mertwole@users.noreply.github.com> Date: Mon, 4 Sep 2023 16:43:45 +0300 Subject: [PATCH 114/165] refactor(gtest): introduce `state_args` macro for `read_state_using_wasm` --- Cargo.lock | 1 + examples/new-meta/tests/read_state.rs | 109 +++++++++++++++++++++-- gtest/Cargo.toml | 1 + gtest/src/lib.rs | 1 + gtest/src/manager.rs | 5 +- gtest/src/program.rs | 121 +++++++++++++++++++++++++- 6 files changed, 225 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1bc26f8c3f7..ca31e2e52ea 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4731,6 +4731,7 @@ dependencies = [ "colored", "demo-custom", "demo-futures-unordered", + "demo-meta-io", "demo-piggy-bank", "demo-ping", "derive_more", diff --git a/examples/new-meta/tests/read_state.rs b/examples/new-meta/tests/read_state.rs index 4e86296214c..d285ac014f8 100644 --- a/examples/new-meta/tests/read_state.rs +++ b/examples/new-meta/tests/read_state.rs @@ -2,7 +2,7 @@ use demo_new_meta::{ MessageInitIn, Person, Wallet, META_EXPORTS_V1, META_EXPORTS_V2, META_WASM_V1, META_WASM_V2, }; use gstd::Encode; -use gtest::{Program, System}; +use gtest::{state_args, state_args_encoded, Program, System}; #[test] fn read_state_bytes_returns_full_state() { @@ -22,11 +22,11 @@ fn read_state_bytes_returns_full_state() { fn read_state_bytes_with_wasm_func_returns_transformed_state() { let system = System::new(); let program = initialize_current_program(&system); - const FIRST_WALLET_FUNC_NAME: &str = "first_wallet"; - assert!(META_EXPORTS_V1.contains(&FIRST_WALLET_FUNC_NAME)); + const FUNC_NAME: &str = "first_wallet"; + assert!(META_EXPORTS_V1.contains(&FUNC_NAME)); let actual_state = program - .read_state_bytes_using_wasm(FIRST_WALLET_FUNC_NAME, META_WASM_V1.to_vec(), None) + .read_state_bytes_using_wasm(FUNC_NAME, META_WASM_V1.to_vec(), state_args_encoded!()) .expect("Unable to read program state"); let expected_state = Wallet::test_sequence().first().encode(); @@ -38,8 +38,8 @@ fn read_state_bytes_with_wasm_func_returns_transformed_state() { fn read_state_bytes_with_parameterized_wasm_func_returns_transformed_state() { let system = System::new(); let program = initialize_current_program(&system); - const WALLET_BY_PERSON_FUNC_NAME: &str = "wallet_by_person"; - assert!(META_EXPORTS_V2.contains(&WALLET_BY_PERSON_FUNC_NAME)); + const FUNC_NAME: &str = "wallet_by_person"; + assert!(META_EXPORTS_V2.contains(&FUNC_NAME)); let other_person = Person { surname: "OtherSurname".into(), name: "OtherName".into(), @@ -47,9 +47,9 @@ fn read_state_bytes_with_parameterized_wasm_func_returns_transformed_state() { let actual_state = program .read_state_bytes_using_wasm( - WALLET_BY_PERSON_FUNC_NAME, + FUNC_NAME, META_WASM_V2.to_vec(), - Some(other_person.encode()), + state_args_encoded!(&other_person), ) .expect("Unable to read program state"); @@ -61,6 +61,32 @@ fn read_state_bytes_with_parameterized_wasm_func_returns_transformed_state() { assert_eq!(expected_state, actual_state); } +#[test] +fn read_state_bytes_with_two_args_wasm_func_returns_transformed_state() { + let system = System::new(); + let program = initialize_current_program(&system); + const FUNC_NAME: &str = "wallet_by_name_and_surname"; + assert!(META_EXPORTS_V2.contains(&FUNC_NAME)); + + let name = "OtherName".to_string(); + let surname = "OtherSurname".to_string(); + + let actual_state = program + .read_state_bytes_using_wasm( + FUNC_NAME, + META_WASM_V2.to_vec(), + state_args_encoded!(name.clone(), surname.clone()), + ) + .expect("Unable to read program state"); + + let expected_state = Wallet::test_sequence() + .into_iter() + .find(|wallet| wallet.person.name == name && wallet.person.surname == surname) + .encode(); + + assert_eq!(expected_state, actual_state); +} + #[test] fn read_state_returns_full_state() { let system = System::new(); @@ -73,6 +99,73 @@ fn read_state_returns_full_state() { assert_eq!(actual_state, expected_state); } +#[test] +fn read_state_with_wasm_func_returns_transformed_state() { + let system = System::new(); + let program = initialize_current_program(&system); + const FUNC_NAME: &str = "first_wallet"; + assert!(META_EXPORTS_V1.contains(&FUNC_NAME)); + + let actual_state = program + .read_state_using_wasm(FUNC_NAME, META_WASM_V1.to_vec(), state_args!()) + .expect("Unable to read program state"); + + let expected_state = Wallet::test_sequence().first().cloned(); + + assert_eq!(expected_state, actual_state); +} + +#[test] +fn read_state_with_parameterized_wasm_func_returns_transformed_state() { + let system = System::new(); + let program = initialize_current_program(&system); + const FUNC_NAME: &str = "wallet_by_person"; + assert!(META_EXPORTS_V2.contains(&FUNC_NAME)); + let other_person = Person { + surname: "OtherSurname".into(), + name: "OtherName".into(), + }; + + let actual_state = program + .read_state_using_wasm( + FUNC_NAME, + META_WASM_V2.to_vec(), + state_args!(other_person.clone()), + ) + .expect("Unable to read program state"); + + let expected_state = Wallet::test_sequence() + .into_iter() + .find(|wallet| wallet.person == other_person); + + assert_eq!(expected_state, actual_state); +} + +#[test] +fn read_state_with_two_args_wasm_func_returns_transformed_state() { + let system = System::new(); + let program = initialize_current_program(&system); + const FUNC_NAME: &str = "wallet_by_name_and_surname"; + assert!(META_EXPORTS_V2.contains(&FUNC_NAME)); + + let name = "OtherName".to_string(); + let surname = "OtherSurname".to_string(); + + let actual_state = program + .read_state_using_wasm( + FUNC_NAME, + META_WASM_V2.to_vec(), + state_args!(name.clone(), surname.clone()), + ) + .expect("Unable to read program state"); + + let expected_state = Wallet::test_sequence() + .into_iter() + .find(|wallet| wallet.person.name == name && wallet.person.surname == surname); + + assert_eq!(expected_state, actual_state); +} + fn initialize_current_program(system: &System) -> Program { const SOME_USER_ID: u64 = 3; let program = Program::current(system); diff --git a/gtest/Cargo.toml b/gtest/Cargo.toml index efc813abc27..55886642194 100644 --- a/gtest/Cargo.toml +++ b/gtest/Cargo.toml @@ -30,3 +30,4 @@ demo-custom.workspace = true demo-piggy-bank.workspace = true demo-ping.workspace = true demo-futures-unordered.workspace = true +demo-meta-io.workspace = true diff --git a/gtest/src/lib.rs b/gtest/src/lib.rs index d1432ef14e2..0fe769f8b12 100644 --- a/gtest/src/lib.rs +++ b/gtest/src/lib.rs @@ -24,6 +24,7 @@ mod program; mod system; pub use crate::log::{CoreLog, Log, RunResult}; +pub use codec; pub use error::{Result, TestError}; pub use program::{calculate_program_id, Gas, Program, WasmProgram}; pub use system::System; diff --git a/gtest/src/manager.rs b/gtest/src/manager.rs index 36e71353afb..ca70cd4b075 100644 --- a/gtest/src/manager.rs +++ b/gtest/src/manager.rs @@ -471,7 +471,7 @@ impl ExtManager { program_id: &ProgramId, fn_name: &str, wasm: Vec, - argument: Option>, + args: Option>, ) -> Result> { let mapping_code = Code::new_raw(wasm, 1, None, true, false).map_err(|_| TestError::Instrumentation)?; @@ -480,8 +480,7 @@ impl ExtManager { .into_parts() .0; - // The `metawasm` macro knows how to decode this as a tuple - let mut mapping_code_payload = argument.unwrap_or_default(); + let mut mapping_code_payload = args.unwrap_or_default(); mapping_code_payload.append(&mut self.read_state_bytes(program_id)?); core_processor::informational::execute_for_reply::, _>( diff --git a/gtest/src/program.rs b/gtest/src/program.rs index a30d5497b7f..cc0c4e5b426 100644 --- a/gtest/src/program.rs +++ b/gtest/src/program.rs @@ -173,6 +173,38 @@ impl From<&str> for ProgramIdWrapper { } } +#[macro_export] +macro_rules! state_args { + () => { + Option::<()>::None + }; + ($single:expr) => { + Some($single) + }; + ($($multiple:expr),*) => { + Some(($($multiple,)*)) + }; +} + +#[macro_export] +macro_rules! state_args_encoded { + () => { + Option::>::None + }; + ($single:expr) => { + { + use $crate::codec::Encode; + Some(($single).encode()) + } + }; + ($($multiple:expr),*) => { + { + use $crate::codec::Encode; + Some((($($multiple,)*)).encode()) + } + }; +} + pub struct Program<'a> { pub(crate) manager: &'a RefCell, pub(crate) id: ProgramId, @@ -421,15 +453,58 @@ impl<'a> Program<'a> { /// Reads the program’s transformed state as a byte vector. The transformed /// state is a result of applying the `fn_name` function from the `wasm` /// binary with the optional `argument`. + /// + /// # Usage + /// You can pass arguments as `Option<(arg1, arg2, ...).encode()>` or by + /// using [`state_args_encoded`] macro. + /// + /// # Examples + /// + /// ``` + /// # use gtest::{state_args_encoded, Program, System, WasmProgram, Result}; + /// # use codec::Encode; + /// # fn doctest() -> Result<()> { + /// # #[derive(Debug)] + /// # struct MockWasm {} + /// # + /// # impl WasmProgram for MockWasm { + /// # fn init(&mut self, _payload: Vec) -> Result>, &'static str> { unimplemented!() } + /// # fn handle(&mut self, _payload: Vec) -> Result>, &'static str> { unimplemented!() } + /// # fn handle_reply(&mut self, _payload: Vec) -> Result<(), &'static str> {unimplemented!() } + /// # fn handle_signal(&mut self, _payload: Vec) -> Result<(), &'static str> { unimplemented!() } + /// # fn state(&mut self) -> Result, &'static str> { unimplemented!() } + /// # } + /// # let system = System::new(); + /// # let program = Program::mock(&system, MockWasm { }); + /// # let ARG_1 = 0u8; + /// # let ARG_2 = 0u8; + /// //Read state bytes with no arguments passed to wasm. + /// # let WASM = vec![]; + /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, Option::>::None)?; + /// # let WASM = vec![]; + /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, state_args_encoded!())?; + /// // Read state bytes with one argument passed to wasm. + /// # let WASM = vec![]; + /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, Some(ARG_1.encode()))?; + /// # let WASM = vec![]; + /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, state_args_encoded!(ARG_1))?; + /// // Read state bytes with multiple arguments passed to wasm. + /// # let WASM = vec![]; + /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, Some((ARG_1, ARG_2).encode()))?; + /// # let WASM = vec![]; + /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, state_args_encoded!(ARG_1, ARG_2))?; + /// # Ok(()) + /// # } + /// ``` pub fn read_state_bytes_using_wasm( &self, fn_name: &str, wasm: Vec, - argument: Option>, + args: Option>, ) -> Result> { self.manager .borrow_mut() - .read_state_bytes_using_wasm(&self.id, fn_name, wasm, argument) + .read_state_bytes_using_wasm(&self.id, fn_name, wasm, args) } /// Reads and decodes the program's state . @@ -441,6 +516,48 @@ impl<'a> Program<'a> { /// Reads and decodes the program’s transformed state. The transformed state /// is a result of applying the `fn_name` function from the `wasm` /// binary with the optional `argument`. + /// + /// # Usage + /// You can pass arguments as `Option<(arg1, arg2, ...)>` or by + /// using [`state_args`] macro. + /// + /// # Examples + /// + /// ``` + /// # use gtest::{state_args, Program, System, WasmProgram, Result}; + /// # fn doctest() -> Result<()> { + /// # #[derive(Debug)] + /// # struct MockWasm {} + /// # + /// # impl WasmProgram for MockWasm { + /// # fn init(&mut self, _payload: Vec) -> Result>, &'static str> { unimplemented!() } + /// # fn handle(&mut self, _payload: Vec) -> Result>, &'static str> { unimplemented!() } + /// # fn handle_reply(&mut self, _payload: Vec) -> Result<(), &'static str> {unimplemented!() } + /// # fn handle_signal(&mut self, _payload: Vec) -> Result<(), &'static str> { unimplemented!() } + /// # fn state(&mut self) -> Result, &'static str> { unimplemented!() } + /// # } + /// # let system = System::new(); + /// # let program = Program::mock(&system, MockWasm { }); + /// # let ARG_1 = 0u8; + /// # let ARG_2 = 0u8; + /// //Read state bytes with no arguments passed to wasm. + /// # let WASM = vec![]; + /// let _ = program.read_state_using_wasm("fn_name", WASM, Option::<()>::None)?; + /// # let WASM = vec![]; + /// let _ = program.read_state_using_wasm("fn_name", WASM, state_args!())?; + /// // Read state bytes with one argument passed to wasm. + /// # let WASM = vec![]; + /// let _ = program.read_state_using_wasm("fn_name", WASM, Some(ARG_1))?; + /// # let WASM = vec![]; + /// let _ = program.read_state_using_wasm("fn_name", WASM, state_args!(ARG_1))?; + /// // Read state bytes with multiple arguments passed to wasm. + /// # let WASM = vec![]; + /// let _ = program.read_state_using_wasm("fn_name", WASM, Some((ARG_1, ARG_2)))?; + /// # let WASM = vec![]; + /// let _ = program.read_state_using_wasm("fn_name", WASM, state_args!(ARG_1, ARG_2))?; + /// # Ok(()) + /// # } + /// ``` pub fn read_state_using_wasm( &self, fn_name: &str, From 4c3bb97ceec4bd8cf36bdd1f15f90d46597a8a6f Mon Sep 17 00:00:00 2001 From: mertwole <33563701+mertwole@users.noreply.github.com> Date: Mon, 4 Sep 2023 17:30:14 +0300 Subject: [PATCH 115/165] feat(wasm-gen): Implement fallible syscalls error processing setup --- utils/wasm-gen/src/config/syscalls.rs | 44 +++++++++++++++---- utils/wasm-gen/src/generator/syscalls.rs | 4 +- .../src/generator/syscalls/invocator.rs | 22 ++++++++-- utils/wasm-gen/src/tests.rs | 8 +++- 4 files changed, 62 insertions(+), 16 deletions(-) diff --git a/utils/wasm-gen/src/config/syscalls.rs b/utils/wasm-gen/src/config/syscalls.rs index 3dbc167e8a6..b9a37a4ed17 100644 --- a/utils/wasm-gen/src/config/syscalls.rs +++ b/utils/wasm-gen/src/config/syscalls.rs @@ -25,11 +25,13 @@ mod param; use gear_utils::NonEmpty; use gear_wasm_instrument::syscalls::SysCallName; use gsys::{Hash, HashWithValue}; -use std::ops::RangeInclusive; +use std::{collections::HashSet, ops::RangeInclusive}; pub use amount::*; pub use param::*; +use crate::InvocableSysCall; + /// Builder for [`SysCallsConfig`]. pub struct SysCallsConfigBuilder(SysCallsConfig); @@ -40,7 +42,7 @@ impl SysCallsConfigBuilder { injection_amounts, params_config: SysCallsParamsConfig::default(), sending_message_destination: MessageDestination::default(), - ignore_fallible_syscall_errors: true, + error_processing_config: ErrorProcessingConfig::None, log_info: None, }) } @@ -84,9 +86,9 @@ impl SysCallsConfigBuilder { self } - /// Enable/disable processing of errors returned from fallible syscalls. - pub fn set_ignore_fallible_syscall_errors(mut self, ignore: bool) -> Self { - self.0.ignore_fallible_syscall_errors = ignore; + /// Setup fallible syscalls error processing options. + pub fn set_error_processing_config(mut self, config: ErrorProcessingConfig) -> Self { + self.0.error_processing_config = config; self } @@ -107,13 +109,37 @@ impl SysCallsConfigBuilder { } } +#[derive(Debug, Clone, Default)] +pub enum ErrorProcessingConfig { + /// Process errors on all the fallible syscalls. + All, + /// Process only errors on provided syscalls. + Whitelist(HashSet), + /// Process errors on all the syscalls excluding provided. + Blacklist(HashSet), + /// Don't process syscall errors at all. + #[default] + None, +} + +impl ErrorProcessingConfig { + pub fn error_should_be_processed(&self, syscall: &InvocableSysCall) -> bool { + match self { + Self::All => true, + Self::Whitelist(wl) => wl.contains(syscall), + Self::Blacklist(bl) => !bl.contains(syscall), + Self::None => false, + } + } +} + /// United config for all entities in sys-calls generator module. #[derive(Debug, Clone, Default)] pub struct SysCallsConfig { injection_amounts: SysCallsInjectionAmounts, params_config: SysCallsParamsConfig, sending_message_destination: MessageDestination, - ignore_fallible_syscall_errors: bool, + error_processing_config: ErrorProcessingConfig, log_info: Option, } @@ -142,9 +168,9 @@ impl SysCallsConfig { &self.params_config } - /// Should we ignore error processing of fallible syscalls? - pub fn ignore_fallible_syscall_errors(&self) -> bool { - self.ignore_fallible_syscall_errors + /// Error processing config for fallible syscalls. + pub fn error_processing_config(&self) -> &ErrorProcessingConfig { + &self.error_processing_config } } diff --git a/utils/wasm-gen/src/generator/syscalls.rs b/utils/wasm-gen/src/generator/syscalls.rs index f285968db21..6fc3ce9f3a8 100644 --- a/utils/wasm-gen/src/generator/syscalls.rs +++ b/utils/wasm-gen/src/generator/syscalls.rs @@ -54,8 +54,8 @@ use gear_wasm_instrument::syscalls::{ParamType, SysCallName, SysCallSignature}; /// which is pretty hard to predict beforehand with a generator. So this call context /// is created from scratch - first `gr_reserve_gas` is called and then it's result /// is used for the further `gr_reservation_send` call. Those are `Precise` sys-calls. -#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] -pub(crate) enum InvocableSysCall { +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum InvocableSysCall { Loose(SysCallName), Precise(SysCallName), } diff --git a/utils/wasm-gen/src/generator/syscalls/invocator.rs b/utils/wasm-gen/src/generator/syscalls/invocator.rs index 0cdf9da6590..479913e10cf 100644 --- a/utils/wasm-gen/src/generator/syscalls/invocator.rs +++ b/utils/wasm-gen/src/generator/syscalls/invocator.rs @@ -208,6 +208,10 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { self.unstructured.len() ); + let insert_error_processing = self + .config + .error_processing_config() + .error_should_be_processed(&invocable); let (fallible, mut signature) = (invocable.is_fallible(), invocable.into_signature()); if self.is_not_send_sys_call(invocable) { @@ -215,7 +219,12 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { " -- Generating build call for non-send sys-call {}", invocable.to_str() ); - return self.build_call(signature, fallible, call_indexes_handle); + return self.build_call( + signature, + fallible, + insert_error_processing, + call_indexes_handle, + ); } log::trace!( @@ -226,8 +235,12 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { // The value for the first param is chosen from config. // It's either the result of `gr_source`, some existing address (set in the data section) or a completely random value. signature.params.remove(0); - let mut call_without_destination_instrs = - self.build_call(signature, fallible, call_indexes_handle)?; + let mut call_without_destination_instrs = self.build_call( + signature, + fallible, + insert_error_processing, + call_indexes_handle, + )?; let res = if self.config.sending_message_destination().is_source() { log::trace!(" -- Message destination is result of `gr_source`"); @@ -306,6 +319,7 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { &mut self, signature: SysCallSignature, fallible: bool, + insert_error_processing: bool, call_indexes_handle: CallIndexesHandle, ) -> Result> { let param_setters = self.build_param_setters(&signature.params)?; @@ -317,7 +331,7 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { instructions.push(Instruction::Call(call_indexes_handle as u32)); - let mut result_processing = if self.config.ignore_fallible_syscall_errors() { + let mut result_processing = if !insert_error_processing { Self::build_result_processing_ignored(signature) } else if fallible { Self::build_result_processing_fallible(signature, ¶m_setters) diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index a52571ec4b2..588bdc7c989 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -247,6 +247,12 @@ fn execute_wasm_with_syscall_injected( let mut injection_amounts = SysCallsInjectionAmounts::all_never(); injection_amounts.set(syscall, INJECTED_SYSCALLS, INJECTED_SYSCALLS); + let error_processing_config = if ignore_fallible_errors { + ErrorProcessingConfig::None + } else { + ErrorProcessingConfig::All + }; + let gear_config = ( GearWasmGeneratorConfigBuilder::new() .with_memory_config(MemoryPagesConfig { @@ -256,7 +262,7 @@ fn execute_wasm_with_syscall_injected( .with_sys_calls_config( SysCallsConfigBuilder::new(injection_amounts) .with_params_config(params_config) - .set_ignore_fallible_syscall_errors(ignore_fallible_errors) + .set_error_processing_config(error_processing_config) .build(), ) .with_entry_points_config(EntryPointsSet::Init) From 60c37cd26469b06c3f3e3d7f12760f2714081d32 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Mon, 4 Sep 2023 19:15:10 +0300 Subject: [PATCH 116/165] docs(runtime-fuzzer): add documentation for `runtime-fuzzer` crate (#3200) --- utils/runtime-fuzzer/README.md | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 utils/runtime-fuzzer/README.md diff --git a/utils/runtime-fuzzer/README.md b/utils/runtime-fuzzer/README.md new file mode 100644 index 00000000000..3b9c326aeb9 --- /dev/null +++ b/utils/runtime-fuzzer/README.md @@ -0,0 +1,81 @@ +# runtime-fuzzer + +This is an internal product that is used to find panics that may occur in our runtime. + +### Measuring code coverage + +Pre-requirements: + +- llvm-tools: `rustup component add llvm-tools-preview` +- [cargo-fuzz](https://github.com/rust-fuzz/cargo-fuzz): `cargo install cargo-fuzz` +- [cargo-binutils](https://github.com/rust-embedded/cargo-binutils): `cargo install cargo-binutils` +- [rustfilt](https://github.com/luser/rustfilt): `cargo install rustfilt` + +Running fuzzer on the local machine: + +```bash +cd utils/runtime-fuzzer + +# Fuzzer expects a minimal input size of 25 MiB. Without providing a corpus of the same or larger +# size fuzzer will stuck for a long time with trying to test the target using 0..100 bytes. +mkdir -p fuzz/corpus/main +dd if=/dev/urandom of=fuzz/corpus/main/check-fuzzer-bytes bs=1 count=27000000 + +# Run fuzzer for at least 20 minutes and then press Ctrl-C to stop fuzzing. +# You can also remove RUST_LOG to avoid printing tons of logs on terminal. +RUST_LOG=debug,syscalls,gear_wasm_gen=trace,runtime_fuzzer=trace,gear_backend_common=trace \ +cargo fuzz run \ + --release \ + --sanitizer=none \ + main \ + fuzz/corpus/main \ + -- \ + -rss_limit_mb=8192 \ + -max_len=35000000 \ + -len_control=0 + +# Get coverage +cargo fuzz coverage \ + --release \ + --sanitizer=none \ + main \ + fuzz/corpus/main \ + -- \ + -rss_limit_mb=8192 \ + -max_len=35000000 \ + -len_control=0 +``` + +### Viewing code coverage + +There are two ways to view coverage: + +- in text mode + + ```bash + # generate `coverage.txt` + HOST_TARGET=$(rustc -Vv | grep "host: " | sed "s/^host: \(.*\)$/\1/") + cargo cov -- show target/$HOST_TARGET/coverage/$HOST_TARGET/release/main \ + --format=text \ + --show-line-counts \ + --Xdemangler=rustfilt \ + --instr-profile=fuzz/coverage/main/coverage.profdata \ + --ignore-filename-regex=/rustc/ \ + --ignore-filename-regex=.cargo/ &> fuzz/coverage/main/coverage.txt + ``` + +- in Visual Studio Code + with [Coverage Gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters): + + ```bash + # generate `lcov.info` file with coverage + HOST_TARGET=$(rustc -Vv | grep "host: " | sed "s/^host: \(.*\)$/\1/") + cargo cov -- export target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/main \ + --format=lcov \ + --instr-profile=fuzz/coverage/main/coverage.profdata \ + --ignore-filename-regex=/rustc/ \ + --ignore-filename-regex=.cargo/ > fuzz/coverage/main/lcov.info + ``` + + Then you need to install the Coverage Gutters extension and use Ctrl-Shift-P to invoke the "Coverage Gutters: Watch" + action. The extension will look for the `lcov.info` file. After a while, the coverage will appear in your editor. From 29ea1fde7cde26b85b80135588a1a2f871c44be0 Mon Sep 17 00:00:00 2001 From: Georgy Shepelev Date: Tue, 5 Sep 2023 14:50:25 +0400 Subject: [PATCH 117/165] chore: Change runner for measurements CI (#3215) --- .github/workflows/test-measurements.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-measurements.yaml b/.github/workflows/test-measurements.yaml index 21fe256ecbd..de079404e8e 100644 --- a/.github/workflows/test-measurements.yaml +++ b/.github/workflows/test-measurements.yaml @@ -14,7 +14,7 @@ env: jobs: build: - runs-on: [ k8s-runner ] + runs-on: [kuberunner] timeout-minutes: 720 steps: - name: "ACTIONS: Checkout" From 992a2d4c207bb27ab95c92a740629b06794c534f Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Tue, 5 Sep 2023 16:29:16 +0200 Subject: [PATCH 118/165] feat(pallet-gear-rpc): read states in batch (#3208) --- pallets/gear/rpc/src/lib.rs | 81 +++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/pallets/gear/rpc/src/lib.rs b/pallets/gear/rpc/src/lib.rs index 0ede52fdf16..b92040b1231 100644 --- a/pallets/gear/rpc/src/lib.rs +++ b/pallets/gear/rpc/src/lib.rs @@ -37,6 +37,8 @@ use sp_core::{Bytes, H256}; use sp_runtime::traits::Block as BlockT; use std::sync::Arc; +const MAX_BATCH_SIZE: usize = 256; + /// Converts a runtime trap into a [`CallError`]. fn runtime_error_into_rpc_error(err: impl std::fmt::Debug) -> JsonRpseeError { CallError::Custom(ErrorObject::owned( @@ -101,6 +103,13 @@ pub trait GearApi { at: Option, ) -> RpcResult; + #[method(name = "gear_readStateBatch")] + fn read_state_batch( + &self, + batch_id_payload: Vec<(H256, Bytes)>, + at: Option, + ) -> RpcResult>; + #[method(name = "gear_readStateUsingWasm")] fn read_state_using_wasm( &self, @@ -112,6 +121,16 @@ pub trait GearApi { at: Option, ) -> RpcResult; + #[method(name = "gear_readStateUsingWasmBatch")] + fn read_state_using_wasm_batch( + &self, + batch_id_payload: Vec<(H256, Bytes)>, + fn_name: Bytes, + wasm: Bytes, + argument: Option, + at: Option, + ) -> RpcResult>; + #[method(name = "gear_readMetahash")] fn read_metahash(&self, program_id: H256, at: Option) -> RpcResult; } @@ -336,6 +355,31 @@ where .map(Bytes) } + fn read_state_batch( + &self, + batch_id_payload: Vec<(H256, Bytes)>, + at: Option<::Hash>, + ) -> RpcResult> { + if batch_id_payload.len() > MAX_BATCH_SIZE { + return Err(CallError::Custom(ErrorObject::owned( + 8000, + "Runtime error", + Some(format!("Batch size must be lower than {MAX_BATCH_SIZE:?}")), + )) + .into()); + } + + let at_hash = at.unwrap_or_else(|| self.client.info().best_hash); + + batch_id_payload + .into_iter() + .map(|(program_id, payload)| { + self.run_with_api_copy(|api| api.read_state(at_hash, program_id, payload.0)) + .map(Bytes) + }) + .collect() + } + fn read_state_using_wasm( &self, program_id: H256, @@ -360,6 +404,43 @@ where }) } + fn read_state_using_wasm_batch( + &self, + batch_id_payload: Vec<(H256, Bytes)>, + fn_name: Bytes, + wasm: Bytes, + argument: Option, + at: Option<::Hash>, + ) -> RpcResult> { + if batch_id_payload.len() > MAX_BATCH_SIZE { + return Err(CallError::Custom(ErrorObject::owned( + 8000, + "Runtime error", + Some(format!("Batch size must be lower than {MAX_BATCH_SIZE:?}")), + )) + .into()); + } + + let at_hash = at.unwrap_or_else(|| self.client.info().best_hash); + + batch_id_payload + .into_iter() + .map(|(program_id, payload)| { + self.run_with_api_copy(|api| { + api.read_state_using_wasm( + at_hash, + program_id, + payload.to_vec(), + fn_name.clone().to_vec(), + wasm.clone().to_vec(), + argument.clone().map(|v| v.to_vec()), + ) + .map(|r| r.map(Bytes)) + }) + }) + .collect() + } + fn read_metahash( &self, program_id: H256, From 5fc71c19704ed5bbf9478e1fe71fc0affd86c1ce Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Wed, 6 Sep 2023 12:41:32 +0400 Subject: [PATCH 119/165] feat(gtest): Support reply deposit in `gtest` (#3212) --- Cargo.lock | 10 ++++++ Cargo.toml | 1 + examples/autoreply/Cargo.toml | 21 +++++++++++ examples/autoreply/build.rs | 21 +++++++++++ examples/autoreply/src/lib.rs | 64 ++++++++++++++++++++++++++++++++++ examples/autoreply/src/wasm.rs | 54 ++++++++++++++++++++++++++++ gtest/src/manager.rs | 18 ++++++---- 7 files changed, 182 insertions(+), 7 deletions(-) create mode 100644 examples/autoreply/Cargo.toml create mode 100644 examples/autoreply/build.rs create mode 100644 examples/autoreply/src/lib.rs create mode 100644 examples/autoreply/src/wasm.rs diff --git a/Cargo.lock b/Cargo.lock index ca31e2e52ea..f2643cc024a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1851,6 +1851,16 @@ dependencies = [ "parity-scale-codec", ] +[[package]] +name = "demo-autoreply" +version = "0.1.0" +dependencies = [ + "gear-wasm-builder", + "gstd", + "gtest", + "parity-scale-codec", +] + [[package]] name = "demo-calc-hash" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 822c24513d3..f933a3c1154 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ members = [ "examples/async-init", "examples/async-signal-entry", "examples/async-tester", + "examples/autoreply", "examples/calc-hash", "examples/custom", "examples/compose", diff --git a/examples/autoreply/Cargo.toml b/examples/autoreply/Cargo.toml new file mode 100644 index 00000000000..4827837f35e --- /dev/null +++ b/examples/autoreply/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "demo-autoreply" +version = "0.1.0" +authors.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +gstd = { workspace = true, features = ["debug"] } +parity-scale-codec.workspace = true + +[dev-dependencies] +gtest.workspace = true + +[build-dependencies] +gear-wasm-builder.workspace = true + +[features] +debug = ["gstd/debug"] +default = ["std"] +std = [] diff --git a/examples/autoreply/build.rs b/examples/autoreply/build.rs new file mode 100644 index 00000000000..1a948b5bf66 --- /dev/null +++ b/examples/autoreply/build.rs @@ -0,0 +1,21 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +fn main() { + gear_wasm_builder::build(); +} diff --git a/examples/autoreply/src/lib.rs b/examples/autoreply/src/lib.rs new file mode 100644 index 00000000000..90a59205f62 --- /dev/null +++ b/examples/autoreply/src/lib.rs @@ -0,0 +1,64 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#![no_std] + +#[cfg(feature = "std")] +mod code { + include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); +} + +#[cfg(feature = "std")] +pub use code::WASM_BINARY_OPT as WASM_BINARY; + +#[cfg(not(feature = "std"))] +mod wasm; + +#[cfg(test)] +mod tests { + use gstd::ActorId; + use gtest::{Program, System}; + + #[test] + fn auto_reply_received() { + let system = System::new(); + system.init_logger(); + + let prog1 = Program::current(&system); + let prog1_id = ActorId::from_slice(prog1.id().as_ref()).unwrap(); + + let from = 42; + + // Init Program-1 + let res = prog1.send(from, ActorId::zero()); + assert!(!res.main_failed()); + + // Init Program-2 with Program-1 as destination + let prog2 = Program::current(&system); + let res = prog2.send(from, prog1_id); + assert!(!res.main_failed()); + + // Send a message from Program-2 to Program-1 + let res = prog2.send_bytes(from, b"Let's go!"); + assert!(!res.main_failed()); + + // Check whether the auto-reply was received + let reply_received: bool = prog2.read_state().expect("Failed to read state"); + assert!(reply_received); + } +} diff --git a/examples/autoreply/src/wasm.rs b/examples/autoreply/src/wasm.rs new file mode 100644 index 00000000000..b015136606a --- /dev/null +++ b/examples/autoreply/src/wasm.rs @@ -0,0 +1,54 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{debug, exec, msg, prelude::*, ActorId}; + +static mut DESTINATION: ActorId = ActorId::zero(); +static mut RECEIVED_AUTO_REPLY: bool = false; + +#[no_mangle] +extern "C" fn init() { + debug!("init()"); + let destination = msg::load().expect("Failed to load destination"); + debug!("Destination: {destination:?}"); + unsafe { DESTINATION = destination }; +} + +#[no_mangle] +extern "C" fn handle() { + debug!("handle()"); + let destination = unsafe { DESTINATION }; + if !destination.is_zero() { + // Send message to receive an auto-reply + let msg_id = msg::send_bytes(destination, b"Hi", 0).expect("Failed to send message"); + debug!("Sent message with ID: {msg_id:?}"); + exec::reply_deposit(msg_id, 1_000_000_000).expect("Failed to deposit reply"); + } +} + +#[no_mangle] +extern "C" fn handle_reply() { + debug!("handle_reply()"); + unsafe { RECEIVED_AUTO_REPLY = true }; +} + +#[no_mangle] +extern "C" fn state() { + debug!("state()"); + msg::reply(unsafe { RECEIVED_AUTO_REPLY }, 0).expect("Failed to load reply"); +} diff --git a/gtest/src/manager.rs b/gtest/src/manager.rs index ca70cd4b075..61ad00e8713 100644 --- a/gtest/src/manager.rs +++ b/gtest/src/manager.rs @@ -216,7 +216,7 @@ pub(crate) struct ExtManager { pub(crate) mailbox: HashMap>, pub(crate) wait_list: BTreeMap<(ProgramId, MessageId), StoredDispatch>, pub(crate) wait_init_list: BTreeMap>, - pub(crate) gas_limits: BTreeMap>, + pub(crate) gas_limits: BTreeMap, pub(crate) delayed_dispatches: HashMap>, // Last run info @@ -369,7 +369,9 @@ impl ExtManager { pub(crate) fn run_dispatch(&mut self, dispatch: Dispatch) -> RunResult { self.prepare_for(&dispatch); - self.gas_limits.insert(dispatch.id(), dispatch.gas_limit()); + self.gas_limits + .entry(dispatch.id()) + .or_insert_with(|| dispatch.gas_limit().unwrap_or(u64::MAX)); if !self.is_user(&dispatch.destination()) { self.dispatches.push_back(dispatch.into_stored()); @@ -791,8 +793,7 @@ impl ExtManager { let gas_limit = self .gas_limits .get(&dispatch.id()) - .expect("Unable to find gas limit for message") - .unwrap_or(u64::MAX); + .expect("Unable to find gas limit for message"); let block_config = BlockConfig { block_info: self.block_info, max_pages: TESTS_MAX_PAGES_NUMBER.into(), @@ -825,7 +826,7 @@ impl ExtManager { let precharged_dispatch = match core_processor::precharge_for_program( &block_config, u64::MAX, - dispatch.into_incoming(gas_limit), + dispatch.into_incoming(*gas_limit), dest, ) { Ok(d) => d, @@ -928,7 +929,9 @@ impl JournalHandler for ExtManager { log::debug!("[{message_id}] new dispatch#{}", dispatch.id()); - self.gas_limits.insert(dispatch.id(), dispatch.gas_limit()); + self.gas_limits + .entry(dispatch.id()) + .or_insert_with(|| dispatch.gas_limit().unwrap_or(u64::MAX)); if !self.is_user(&dispatch.destination()) { self.dispatches.push_back(dispatch.into_stored()); @@ -1150,6 +1153,7 @@ impl JournalHandler for ExtManager { fn pay_program_rent(&mut self, _payer: ProgramId, _program_id: ProgramId, _block_count: u32) {} - fn reply_deposit(&mut self, _message_id: MessageId, _future_reply_id: MessageId, _amount: u64) { + fn reply_deposit(&mut self, _message_id: MessageId, future_reply_id: MessageId, amount: u64) { + self.gas_limits.insert(future_reply_id, amount); } } From 22605739e3ee97e9a300742eaa0cecaa209002cf Mon Sep 17 00:00:00 2001 From: Dmitriy <128726599+Magorsky@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:35:05 +0300 Subject: [PATCH 120/165] chore(scripts): Update `fuzzer.sh` (#3219) --- docker/runtime-fuzzer/scripts/fuzzer.sh | 109 +++++++++++++++++------- 1 file changed, 78 insertions(+), 31 deletions(-) diff --git a/docker/runtime-fuzzer/scripts/fuzzer.sh b/docker/runtime-fuzzer/scripts/fuzzer.sh index b6ecc6f8978..70f12b4fa99 100755 --- a/docker/runtime-fuzzer/scripts/fuzzer.sh +++ b/docker/runtime-fuzzer/scripts/fuzzer.sh @@ -8,20 +8,31 @@ ARTIFACT_DIR="$WORK_DIR/artifacts" ARCHIVE_PATH="/opt/download-archives/" # DOCKER PARAMS CONTAINER_NAME=node-fuzzer +CONTAINER_NAME_GEAR=gear +#IMAGE='node-fuzzer:0.0.0' IMAGE='ghcr.io/gear-tech/gear-node-fuzzer:latest' +DOCKER_EXIT_CODE='' # ALERTING PARAMS GROUP_ID='***' BOT_TOKEN='***' -# Function to check container -function _check_need_arch { +# Function to check container was stopped manually +function _check_stop_manually { _dcode=$(docker inspect ${CONTAINER_NAME} --format='{{.State.ExitCode}}' ) echo "Container exit code: $_dcode" - cmd=$(docker logs -f --tail 100 ${CONTAINER_NAME} | grep 'ERROR: libFuzzer: out-of-memory') if [ "$_dcode" -eq 137 ]; then echo "Container was stopped manually" return 0 - elif [[ $cmd ]]; then + else + echo "Proceed with archiving" + return 1 + fi +} + +# Function to check container was stopped by OOM +function _check_stop_oom { + cmd=$(docker logs -f --tail 100 ${CONTAINER_NAME} | grep 'ERROR: libFuzzer: out-of-memory') + if [ -n $cmd ]; then echo "Archiving doesn't needed due to OOM error" return 0 else @@ -40,27 +51,57 @@ function _check_container_runtime { } # Function to start the container and wait for it to stop -function _start_container { +function start_container_post { + # Start the container in the background + if [ "$(docker ps -aq -f status=exited -f name=${CONTAINER_NAME_GEAR})" ]; then + # cleanup + docker rm ${CONTAINER_NAME_GEAR} + fi + # run container + docker run --rm -itd \ + --entrypoint "/bin/sh" \ + -e TERM=xterm-256color \ + -v "${CORPUS_DIR}:/corpus/main" \ + --workdir /gear/utils/runtime-fuzzer \ + --name ${CONTAINER_NAME_GEAR} ${IMAGE} \ + -c "cargo install cargo-binutils && \ + rustup component add llvm-tools-preview && \ + rustup component add --toolchain nightly llvm-tools-preview && \ + cargo fuzz coverage --release --sanitizer=none main /corpus/main && \ + cargo cov -- show target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/main \ + --format=text \ + --show-line-counts \ + --Xdemangler=rustfilt \ + --ignore-filename-regex=/rustc/ \ + --ignore-filename-regex=.cargo/ \ + --instr-profile=fuzz/coverage/main/coverage.profdata > /corpus/main/gear$1.txt 2>&1" + # Wait for the container to stop + docker wait ${CONTAINER_NAME_GEAR} + mv ${CORPUS_DIR}/gear$1.txt ${ARCHIVE_PATH} + rm -rf $WORK_DIR/corpus/* + dd if=/dev/urandom of=$WORK_DIR/corpus/first-seed bs=1 count=27000000 +} + +# Function to start the container and wait for it to stop +function start_container { # Start the container in the background if [ ! "$(docker ps -a -q -f name=${CONTAINER_NAME})" ]; then if [ "$(docker ps -aq -f status=exited -f name=${CONTAINER_NAME})" ]; then # cleanup docker rm ${CONTAINER_NAME} fi - # run container - docker run -d --pull=always \ - -e TERM=xterm-256color \ - -v "${VOLUME_DIR}:/fuzzing-seeds-dir" \ - -v "${CORPUS_DIR}:/corpus/main" \ - -v "${ARTIFACT_DIR}:/gear/utils/runtime-fuzzer/fuzz/artifactis/main" \ - --name ${CONTAINER_NAME} ${IMAGE} + # run container + docker run -d --pull=always \ + -e TERM=xterm-256color \ + -v "${CORPUS_DIR}:/corpus/main" \ + -v "${ARTIFACT_DIR}:/gear/utils/runtime-fuzzer/fuzz/artifactis/main" \ + --name ${CONTAINER_NAME} ${IMAGE} fi # Wait for the container to stop docker wait node-fuzzer } -# Send message+logfile to telegram -function _alert_tg { +function alert_tg { docker logs -f --tail 100 ${CONTAINER_NAME} >& node-fuzzer.log text_message="Node Fuzzer Alert 🔥 @@ -81,21 +122,20 @@ Please check logs. rm node-fuzzer.log } -function _archive_logs { - ARCHIVE_NAME="node-fuzzer_logs_$(date +%Y-%m-%d_%H-%M-%S).tar.gz" - echo "Container exit code: $_dcode" +function archive_logs { + ARCHIVE_NAME="node-fuzzer_logs_$1.tar.gz" # Get the logs from the container and archive them with the current timestamp in the filename docker logs node-fuzzer >& node-fuzzer.log split -C 1024m --additional-suffix=.log --numeric-suffixes node-fuzzer.log node-fuzzer_part rm node-fuzzer.log - echo "Copy fuzzing-seeds" - cp ${VOLUME_DIR}fuzzing-seeds ./ + #echo "Copy fuzzing-seeds" + #cp ${VOLUME_DIR}fuzzing-seeds ./ echo "Creating tar archive: ${ARCHIVE_NAME}" # Tar logs and seeds - tar -czvf ${ARCHIVE_PATH}/${ARCHIVE_NAME} *.log fuzzing-seeds corpus artifacts + tar -czvf ${ARCHIVE_PATH}/${ARCHIVE_NAME} *.log corpus # Clean temp files echo "Clean tmp files" - rm *.log fuzzing-seeds + rm *.log rm -rf ./atrifacts/* } @@ -104,19 +144,25 @@ function start { while true; do echo "########## $(date) ###########" echo "Start container: ${CONTAINER_NAME}" - _start_container - if ! _check_need_arch; then - echo "Start archiving logs" - _archive_logs - echo "Create alert" - _alert_tg $ARCHIVE_NAME + start_container + DATE=$(date +%Y-%m-%d_%H-%M-%S) + _check_container_runtime + if ! _check_stop_manually; then + echo "start archive" + # Create archive + archive_logs $DATE + if ! _check_stop_oom; then + # Create telegram alert + alert_tg $ARCHIVE_NAME + fi + start_container_post $DATE fi - _check_container_runtime # Clean up the container - docker rm ${CONTAINER_NAME} - docker rmi ${IMAGE} + docker rm ${CONTAINER_NAME} + # Clean up image + docker rmi ${IMAGE} # Clean archives older than 30 days - find ${ARCHIVE_PATH} -name "node-fuzzer_logs*.tar.gz" -type f -mtime +30 -delete + find ${ARCHIVE_PATH} -name "node-fuzzer_logs*.tar.gz" -type f -mtime +2 -delete done } @@ -135,3 +181,4 @@ case "$1" in exit 1 ;; esac + From e36bdb37a4762b97849d7c6207d68b5771ac7761 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Wed, 6 Sep 2023 15:06:43 +0300 Subject: [PATCH 121/165] feat(wasm-gen): implement sys-call patterns (#3177) --- Cargo.lock | 1 + utils/wasm-gen/Cargo.toml | 1 + utils/wasm-gen/src/generator/syscalls.rs | 24 ++ .../src/generator/syscalls/imports.rs | 402 ++++++++++++++++-- 4 files changed, 386 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f2643cc024a..a946403defe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4426,6 +4426,7 @@ dependencies = [ "proptest", "rand 0.8.5", "static_assertions", + "thiserror", "wasm-smith", "wasmparser-nostd 0.100.1", "wasmprinter", diff --git a/utils/wasm-gen/Cargo.toml b/utils/wasm-gen/Cargo.toml index 5d16b4f2efc..9b9c6464ea9 100644 --- a/utils/wasm-gen/Cargo.toml +++ b/utils/wasm-gen/Cargo.toml @@ -16,6 +16,7 @@ gear-utils.workspace = true gear-core.workspace = true wasmparser.workspace = true static_assertions.workspace = true +thiserror.workspace = true [dev-dependencies] rand = { workspace = true, features = ["small_rng"] } diff --git a/utils/wasm-gen/src/generator/syscalls.rs b/utils/wasm-gen/src/generator/syscalls.rs index 6fc3ce9f3a8..5b667c216fe 100644 --- a/utils/wasm-gen/src/generator/syscalls.rs +++ b/utils/wasm-gen/src/generator/syscalls.rs @@ -66,6 +66,9 @@ impl InvocableSysCall { InvocableSysCall::Loose(sys_call) => sys_call.to_str(), InvocableSysCall::Precise(sys_call) => match sys_call { SysCallName::ReservationSend => "precise_gr_reservation_send", + SysCallName::ReservationReply => "precise_gr_reservation_reply", + SysCallName::SendCommit => "precise_gr_send_commit", + SysCallName::SendCommitWGas => "precise_gr_send_commit_wgas", _ => unimplemented!(), }, } @@ -84,6 +87,27 @@ impl InvocableSysCall { ParamType::Duration, // Duration of the reservation ParamType::Ptr(None), // Address of error returned ]), + SysCallName::ReservationReply => SysCallSignature::gr([ + ParamType::Ptr(None), // Address of value + ParamType::Ptr(Some(2)), // Pointer to payload + ParamType::Size, // Size of the payload + ParamType::Gas, // Amount of gas to reserve + ParamType::Duration, // Duration of the reservation + ParamType::Ptr(None), // Address of error returned + ]), + SysCallName::SendCommit => SysCallSignature::gr([ + ParamType::Ptr(None), // Address of recipient and value (HashWithValue struct) + ParamType::Ptr(Some(2)), // Pointer to payload + ParamType::Size, // Size of the payload + ParamType::Delay, // Number of blocks to delay the sending for + ParamType::Ptr(None), // Address of error returned + ]), + SysCallName::SendCommitWGas => SysCallSignature::gr([ + ParamType::Ptr(None), // Address of recipient and value (HashWithValue struct) + ParamType::Delay, // Number of blocks to delay the sending for + ParamType::Gas, // Amount of gas to reserve + ParamType::Ptr(None), // Address of error returned + ]), _ => unimplemented!(), }, } diff --git a/utils/wasm-gen/src/generator/syscalls/imports.rs b/utils/wasm-gen/src/generator/syscalls/imports.rs index 7ba7a55adcc..8389f943f08 100644 --- a/utils/wasm-gen/src/generator/syscalls/imports.rs +++ b/utils/wasm-gen/src/generator/syscalls/imports.rs @@ -26,15 +26,15 @@ use crate::{ wasm::{PageCount as WasmPageCount, WasmModule}, InvocableSysCall, SysCallsConfig, }; -use arbitrary::{Result, Unstructured}; +use arbitrary::{Error as ArbitraryError, Result, Unstructured}; use gear_wasm_instrument::{ parity_wasm::{ builder, - elements::{BlockType, Instruction, Instructions, Local}, + elements::{BlockType, Instruction, Instructions}, }, syscalls::SysCallName, }; -use gsys::Hash; +use gsys::{Handle, Hash, Length}; use std::{collections::BTreeMap, mem}; /// Gear sys-calls imports generator. @@ -57,6 +57,20 @@ pub struct SysCallsImportsGeneratorInstantiator<'a, 'b>( ), ); +/// The set of sys-calls that need to be imported to create precise sys-call. +#[derive(thiserror::Error, Debug)] +#[error("The following sys-calls must be imported: {0:?}")] +pub struct RequiredSysCalls(&'static [SysCallName]); + +/// An error that occurs when generating precise sys-call. +#[derive(thiserror::Error, Debug)] +pub enum PreciseSysCallError { + #[error("{0}")] + RequiredImports(#[from] RequiredSysCalls), + #[error("{0}")] + Arbitrary(#[from] ArbitraryError), +} + impl<'a, 'b> From<( GearWasmGenerator<'a, 'b>, @@ -158,7 +172,7 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { log::trace!("Generating sys-calls imports"); let sys_calls_proof = self.generate_sys_calls_imports()?; - self.generate_send_from_reservation(); + self.generate_precise_sys_calls()?; Ok((self.disable(), sys_calls_proof)) } @@ -181,6 +195,25 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { Ok(SysCallsImportsGenerationProof(())) } + /// Generates precise sys-calls and handles errors if any occurred during generation. + fn generate_precise_sys_calls(&mut self) -> Result<()> { + for result in [ + self.generate_send_from_reservation(), + self.generate_reply_from_reservation(), + self.generate_send_commit(), + self.generate_send_commit_with_gas(), + ] { + if let Err(err) = result { + match err { + PreciseSysCallError::RequiredImports(err) => log::trace!("{err}"), + PreciseSysCallError::Arbitrary(err) => return Err(err), + } + } + } + + Ok(()) + } + /// Generate import of the gear sys-call defined by `sys_call` param. /// /// Returns [`Option`] which wraps the tuple of amount of sys-call further injections @@ -242,32 +275,25 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { } impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { + /// The amount of memory used to create a precise sys-call. + const PRECISE_SYS_CALL_MEMORY_SIZE: u32 = 100; + /// Returns the indexes of invocable sys-calls. fn invocable_sys_calls_indexes( &self, - sys_calls: [SysCallName; N], - ) -> Option<[usize; N]> { + sys_calls: &'static [SysCallName; N], + ) -> Result<[usize; N], RequiredSysCalls> { let mut indexes = [0; N]; - let iter = sys_calls.iter().map(|&sys_call| { - self.sys_calls_imports + + for (index, &sys_call) in indexes.iter_mut().zip(sys_calls.iter()) { + *index = self + .sys_calls_imports .get(&InvocableSysCall::Loose(sys_call)) .map(|&(_, call_indexes_handle)| call_indexes_handle) - }); - - for (index, maybe_index) in indexes.iter_mut().zip(iter) { - match maybe_index { - Some(idx) => *index = idx, - None => { - log::trace!( - "The following sys-calls must be imported: {missing_sys_calls:?}", - missing_sys_calls = sys_calls.map(|sys_call| sys_call.to_str()), - ); - return None; - } - } + .ok_or_else(|| RequiredSysCalls(&sys_calls[..]))?; } - Some(indexes) + Ok(indexes) } /// Generates a function which calls "properly" the given sys-call. @@ -275,7 +301,6 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { &mut self, sys_call: SysCallName, func_instructions: Instructions, - func_locals: Option>, ) { let invocable_sys_call = InvocableSysCall::Precise(sys_call); let signature = invocable_sys_call.into_signature(); @@ -293,7 +318,6 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { .with_signature(func_signature) .body() .with_instructions(func_instructions) - .with_locals(func_locals.unwrap_or_default()) .build() .build(), ); @@ -314,30 +338,35 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { .insert(invocable_sys_call, (1, call_indexes_handle)); } + /// Returns the size of the memory in bytes that can be used to build precise sys-call. + fn memory_size_in_bytes(&self) -> u32 { + let initial_mem_size: WasmPageCount = self + .module + .initial_mem_size() + .expect("generator is instantiated with a mem import generation proof") + .into(); + initial_mem_size.memory_size() + } + + /// Reserves enough memory build precise sys-call. + fn reserve_memory(&self) -> i32 { + self.memory_size_in_bytes() + .saturating_sub(Self::PRECISE_SYS_CALL_MEMORY_SIZE) as i32 + } + /// Generates a function which calls "properly" the `gr_reservation_send`. - fn generate_send_from_reservation(&mut self) { - let sys_call = SysCallName::ReservationSend; + fn generate_send_from_reservation(&mut self) -> Result<(), PreciseSysCallError> { + const SYS_CALL: SysCallName = SysCallName::ReservationSend; log::trace!( "Constructing {name} sys-call...", - name = InvocableSysCall::Precise(sys_call).to_str() + name = InvocableSysCall::Precise(SYS_CALL).to_str() ); - let Some([reserve_gas_idx, reservation_send_idx]) = self - .invocable_sys_calls_indexes([SysCallName::ReserveGas, SysCallName::ReservationSend]) else { - return; - }; - - let memory_size_in_bytes = { - let initial_mem_size: WasmPageCount = self - .module - .initial_mem_size() - .expect("generator is instantiated with a mem import generation proof") - .into(); - initial_mem_size.memory_size() - }; + let [reserve_gas_idx, reservation_send_idx] = + self.invocable_sys_calls_indexes(&[SysCallName::ReserveGas, SYS_CALL])?; // subtract to be sure we are in memory boundaries. - let rid_pid_value_ptr = memory_size_in_bytes.saturating_sub(100) as i32; + let rid_pid_value_ptr = self.reserve_memory(); let pid_value_ptr = rid_pid_value_ptr + mem::size_of::() as i32; let func_instructions = Instructions::new(vec![ @@ -414,7 +443,296 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { Instruction::End, ]); - self.generate_proper_sys_call_invocation(sys_call, func_instructions, None); + self.generate_proper_sys_call_invocation(SYS_CALL, func_instructions); + + Ok(()) + } + + /// Generates a function which calls "properly" the `gr_reservation_reply`. + fn generate_reply_from_reservation(&mut self) -> Result<(), PreciseSysCallError> { + const SYS_CALL: SysCallName = SysCallName::ReservationReply; + log::trace!( + "Constructing {name} sys-call...", + name = InvocableSysCall::Precise(SYS_CALL).to_str() + ); + + let [reserve_gas_idx, reservation_reply_idx] = + self.invocable_sys_calls_indexes(&[SysCallName::ReserveGas, SYS_CALL])?; + + // subtract to be sure we are in memory boundaries. + let rid_value_ptr = self.reserve_memory(); + let value_ptr = rid_value_ptr + mem::size_of::() as i32; + + let func_instructions = Instructions::new(vec![ + // Amount of gas to reserve + Instruction::GetLocal(3), + // Duration of the reservation + Instruction::GetLocal(4), + // Pointer to the ErrorWithHash struct + Instruction::GetLocal(5), + Instruction::Call(reserve_gas_idx as u32), + // Pointer to the ErrorWithHash struct + Instruction::GetLocal(5), + // Load ErrorWithHash.error + Instruction::I32Load(2, 0), + // Check if ErrorWithHash.error == 0 + Instruction::I32Eqz, + // If ErrorWithHash.error == 0 + Instruction::If(BlockType::NoResult), + // Copy the Hash struct (32 bytes) containing the reservation id. + Instruction::I32Const(rid_value_ptr), + Instruction::GetLocal(5), + Instruction::I64Load(3, 4), + Instruction::I64Store(3, 0), + Instruction::I32Const(rid_value_ptr), + Instruction::GetLocal(5), + Instruction::I64Load(3, 12), + Instruction::I64Store(3, 8), + Instruction::I32Const(rid_value_ptr), + Instruction::GetLocal(5), + Instruction::I64Load(3, 20), + Instruction::I64Store(3, 16), + Instruction::I32Const(rid_value_ptr), + Instruction::GetLocal(5), + Instruction::I64Load(3, 28), + Instruction::I64Store(3, 24), + // Copy the value (16 bytes). + Instruction::I32Const(value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 0), + Instruction::I64Store(3, 0), + Instruction::I32Const(value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 8), + Instruction::I64Store(3, 8), + // Pointer to reservation ID and value + Instruction::I32Const(rid_value_ptr), + // Pointer to payload + Instruction::GetLocal(1), + // Size of the payload + Instruction::GetLocal(2), + // Pointer to the result of the reservation reply + Instruction::GetLocal(5), + Instruction::Call(reservation_reply_idx as u32), + Instruction::End, + Instruction::End, + ]); + + self.generate_proper_sys_call_invocation(SYS_CALL, func_instructions); + + Ok(()) + } + + /// Generates a function which calls "properly" the `gr_send_commit`. + fn generate_send_commit(&mut self) -> Result<(), PreciseSysCallError> { + const SYS_CALL: SysCallName = SysCallName::SendCommit; + log::trace!( + "Constructing {name} sys-call...", + name = InvocableSysCall::Precise(SYS_CALL).to_str() + ); + + let [send_init_idx, send_push_idx, send_commit_idx] = + self.invocable_sys_calls_indexes(&[ + SysCallName::SendInit, + SysCallName::SendPush, + SYS_CALL, + ])?; + + // subtract to be sure we are in memory boundaries. + let handle_ptr = self.reserve_memory(); + let pid_value_ptr = handle_ptr + mem::size_of::() as i32; + + let mut elements = vec![ + // Pointer to the ErrorWithHandle struct + Instruction::GetLocal(4), + Instruction::Call(send_init_idx as u32), + // Pointer to the ErrorWithHandle struct + Instruction::GetLocal(4), + // Load ErrorWithHandle.error + Instruction::I32Load(2, 0), + // Check if ErrorWithHandle.error == 0 + Instruction::I32Eqz, + // If ErrorWithHandle.error == 0 + Instruction::If(BlockType::NoResult), + // Copy the Handle + Instruction::I32Const(handle_ptr), + Instruction::GetLocal(4), + Instruction::I32Load(2, 4), + Instruction::I32Store(2, 0), + ]; + + let number_of_pushes = self.unstructured.int_in_range(0..=3)?; + for _ in 0..number_of_pushes { + elements.extend_from_slice(&[ + // Handle of message + Instruction::I32Const(handle_ptr), + Instruction::I32Load(2, 0), + // Pointer to payload + Instruction::GetLocal(1), + // Size of the payload + Instruction::GetLocal(2), + // Pointer to the result of the send push + Instruction::GetLocal(4), + Instruction::Call(send_push_idx as u32), + ]); + } + + elements.extend_from_slice(&[ + // Copy the HashWithValue struct (48 bytes) containing the recipient and value + // TODO: extract into another method + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 0), + Instruction::I64Store(3, 0), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 8), + Instruction::I64Store(3, 8), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 16), + Instruction::I64Store(3, 16), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 24), + Instruction::I64Store(3, 24), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 32), + Instruction::I64Store(3, 32), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 40), + Instruction::I64Store(3, 40), + // Handle of message + Instruction::I32Const(handle_ptr), + Instruction::I32Load(2, 0), + // Pointer to recipient ID and value + Instruction::I32Const(pid_value_ptr), + // Number of blocks to delay the sending for + Instruction::GetLocal(3), + // Pointer to the result of the send commit + Instruction::GetLocal(4), + Instruction::Call(send_commit_idx as u32), + Instruction::End, + Instruction::End, + ]); + + let func_instructions = Instructions::new(elements); + + self.generate_proper_sys_call_invocation(SYS_CALL, func_instructions); + + Ok(()) + } + + /// Generates a function which calls "properly" the `gr_send_commit_wgas`. + fn generate_send_commit_with_gas(&mut self) -> Result<(), PreciseSysCallError> { + const SYS_CALL: SysCallName = SysCallName::SendCommitWGas; + log::trace!( + "Constructing {name} sys-call...", + name = InvocableSysCall::Precise(SYS_CALL).to_str() + ); + + let [size_idx, send_init_idx, send_push_input_idx, send_commit_wgas_idx] = self + .invocable_sys_calls_indexes(&[ + SysCallName::Size, + SysCallName::SendInit, + SysCallName::SendPushInput, + SYS_CALL, + ])?; + + // subtract to be sure we are in memory boundaries. + let handle_ptr = self.reserve_memory(); + let pid_value_ptr = handle_ptr + mem::size_of::() as i32; + let length_ptr = pid_value_ptr + mem::size_of::() as i32; + + let mut elements = vec![ + // Pointer to the ErrorWithHandle struct + Instruction::GetLocal(3), + Instruction::Call(send_init_idx as u32), + // Pointer to the ErrorWithHandle struct + Instruction::GetLocal(3), + // Load ErrorWithHandle.error + Instruction::I32Load(2, 0), + // Check if ErrorWithHandle.error == 0 + Instruction::I32Eqz, + // If ErrorWithHandle.error == 0 + Instruction::If(BlockType::NoResult), + // Copy the Handle + Instruction::I32Const(handle_ptr), + Instruction::GetLocal(3), + Instruction::I32Load(2, 4), + Instruction::I32Store(2, 0), + // Pointer to message length + Instruction::I32Const(length_ptr), + Instruction::Call(size_idx as u32), + ]; + + let number_of_pushes = self.unstructured.int_in_range(0..=3)?; + for _ in 0..number_of_pushes { + elements.extend_from_slice(&[ + // Handle of message + Instruction::I32Const(handle_ptr), + Instruction::I32Load(2, 0), + // Offset of input + Instruction::I32Const(0), + // Length of input + Instruction::I32Const(length_ptr), + Instruction::I32Load(2, 0), + // Pointer to the result of the send push input + Instruction::GetLocal(3), + Instruction::Call(send_push_input_idx as u32), + ]); + } + + elements.extend_from_slice(&[ + // Copy the HashWithValue struct (48 bytes) containing the recipient and value + // TODO: extract into another method + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 0), + Instruction::I64Store(3, 0), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 8), + Instruction::I64Store(3, 8), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 16), + Instruction::I64Store(3, 16), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 24), + Instruction::I64Store(3, 24), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 32), + Instruction::I64Store(3, 32), + Instruction::I32Const(pid_value_ptr), + Instruction::GetLocal(0), + Instruction::I64Load(3, 40), + Instruction::I64Store(3, 40), + // Handle of message + Instruction::I32Const(handle_ptr), + Instruction::I32Load(2, 0), + // Pointer to recipient ID and value + Instruction::I32Const(pid_value_ptr), + // Gas limit for message + Instruction::GetLocal(2), + // Number of blocks to delay the sending for + Instruction::GetLocal(1), + // Pointer to the result of the send commit + Instruction::GetLocal(3), + Instruction::Call(send_commit_wgas_idx as u32), + Instruction::End, + Instruction::End, + ]); + + let func_instructions = Instructions::new(elements); + + self.generate_proper_sys_call_invocation(SYS_CALL, func_instructions); + + Ok(()) } } From fa2dfd893898d972180ae8352ff7c31b78814663 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Wed, 6 Sep 2023 17:32:28 +0200 Subject: [PATCH 122/165] fix(vara): Bump MaxAuthorities to 100_000 (#3220) --- runtime/vara/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index b10895090f3..9a486108f41 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -755,7 +755,7 @@ parameter_types! { pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value(); /// We prioritize im-online heartbeats over election solution submission. pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2; - pub const MaxAuthorities: u32 = 32; + pub const MaxAuthorities: u32 = 100_000; pub const MaxKeys: u32 = 10_000; pub const MaxPeerInHeartbeats: u32 = 10_000; pub const MaxPeerDataEncodingSize: u32 = 1_000; From 99716339e4eb40dbad3644e3f209632ceff14453 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Thu, 7 Sep 2023 12:16:07 +0400 Subject: [PATCH 123/165] test: Introduce `read_big_state` test on benchmark tests (#3113) --- .github/workflows/build.yml | 2 + Cargo.toml | 2 +- examples/read-big-state/Cargo.toml | 3 +- examples/read-big-state/build.rs | 6 +- examples/read-big-state/src/lib.rs | 8 +- examples/sys-calls/src/lib.rs | 7 +- pallets/gear/Cargo.toml | 3 + pallets/gear/src/benchmarking/mod.rs | 5 ++ .../benchmarking/tests/syscalls_integrity.rs | 81 ++++++++++++++++++- 9 files changed, 105 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71e687d38d9..dddbbdfae2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,6 +99,8 @@ jobs: cargo build -p gear-cli --release --features=runtime-benchmarks,runtime-benchmarks-checkers # check that perf benchmarks works. `--steps=20` need to test, that benchmarks works for different input number. ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 + # check that read_big_state benchmarks works + ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="read_big_state" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --extra # check that check/test benchmarks works ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_all" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --extra # check also lazy-pages benchmarks tests for native runtime diff --git a/Cargo.toml b/Cargo.toml index f933a3c1154..d29797818bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -395,7 +395,7 @@ demo-program-generator = { path = "examples/program-generator" } demo-proxy = { path = "examples/proxy", default-features = false } demo-proxy-relay = { path = "examples/proxy-relay" } demo-proxy-reservation-with-gas = { path = "examples/proxy-reservation-with-gas" } -demo-read-big-state = { path = "examples/read-big-state" } +demo-read-big-state = { path = "examples/read-big-state", default-features = false } demo-reservation-manager = { path = "examples/reservation-manager" } demo-reserve-gas = { path = "examples/reserve-gas" } demo-rwlock = { path = "examples/rwlock" } diff --git a/examples/read-big-state/Cargo.toml b/examples/read-big-state/Cargo.toml index 8468f7fcadd..120c31ee6f2 100644 --- a/examples/read-big-state/Cargo.toml +++ b/examples/read-big-state/Cargo.toml @@ -15,5 +15,6 @@ gear-wasm-builder.workspace = true [features] debug = ["gstd/debug"] +wasm-wrapper = [] +std = ["wasm-wrapper", "parity-scale-codec/std"] default = ["std"] -std = [] diff --git a/examples/read-big-state/build.rs b/examples/read-big-state/build.rs index 4c502a3ddee..b911ce127bb 100644 --- a/examples/read-big-state/build.rs +++ b/examples/read-big-state/build.rs @@ -16,6 +16,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use gear_wasm_builder::WasmBuilder; + fn main() { - gear_wasm_builder::build(); + WasmBuilder::new() + .exclude_features(vec!["std", "wasm-wrapper"]) + .build(); } diff --git a/examples/read-big-state/src/lib.rs b/examples/read-big-state/src/lib.rs index c2c99929b26..3f7d147551c 100644 --- a/examples/read-big-state/src/lib.rs +++ b/examples/read-big-state/src/lib.rs @@ -16,19 +16,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; use alloc::{collections::BTreeMap, string::String, vec, vec::Vec}; use parity_scale_codec::{Decode, Encode}; -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] mod code { include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); } -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] pub use code::WASM_BINARY_OPT as WASM_BINARY; #[derive(Encode, Decode, Default, Debug, Clone)] @@ -59,7 +59,7 @@ impl State { } } -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "wasm-wrapper"))] mod wasm { use super::*; use gstd::{msg, prelude::*}; diff --git a/examples/sys-calls/src/lib.rs b/examples/sys-calls/src/lib.rs index 84740b82462..48940fc8bbe 100644 --- a/examples/sys-calls/src/lib.rs +++ b/examples/sys-calls/src/lib.rs @@ -20,6 +20,7 @@ extern crate alloc; +use alloc::{string::String, vec::Vec}; use parity_scale_codec::{Decode, Encode}; #[cfg(feature = "wasm-wrapper")] @@ -27,13 +28,11 @@ mod code { include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); } -type MessageId = [u8; 32]; -type ActorId = [u8; 32]; - #[cfg(feature = "wasm-wrapper")] pub use code::WASM_BINARY_OPT as WASM_BINARY; -use alloc::{string::String, vec::Vec}; +type MessageId = [u8; 32]; +type ActorId = [u8; 32]; // Instead of proper gstd primitives we use their raw versions to make this contract // compilable as a dependency for the build of the `gear` with `runtime-benchmarking` feature. diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index 618be304e11..efcf988b0a5 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -58,6 +58,7 @@ rand = { workspace = true, optional = true } rand_pcg = { workspace = true, optional = true } sp-consensus-slots = { workspace = true, optional = true } test-syscalls = { workspace = true, optional = true } +demo-read-big-state = { workspace = true, optional = true } demo-proxy = { workspace = true, optional = true } [dev-dependencies] @@ -151,6 +152,7 @@ std = [ "gear-lazy-pages-common?/std", "sp-consensus-babe/std", "test-syscalls?/std", + "demo-read-big-state?/std", "demo-proxy?/std", "gear-runtime-interface/std", ] @@ -167,6 +169,7 @@ runtime-benchmarks = [ "rand", "rand_pcg", "test-syscalls/wasm-wrapper", + "demo-read-big-state/wasm-wrapper", "demo-proxy/wasm-wrapper", "gsys", ] diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 1f34ababd94..69ea3269d4b 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -360,6 +360,11 @@ benchmarks! { T: pallet_gear_voucher::Config, } + #[extra] + read_big_state { + syscalls_integrity::read_big_state::(); + } : {} + #[extra] check_all { syscalls_integrity::main_test::(); diff --git a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs index 73792debfef..8c31271c482 100644 --- a/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs +++ b/pallets/gear/src/benchmarking/tests/syscalls_integrity.rs @@ -29,7 +29,8 @@ use super::*; -use crate::{CurrencyOf, Event, RentCostPerBlockOf, WaitlistOf}; +use crate::{BlockGasLimitOf, CurrencyOf, Event, RentCostPerBlockOf, String, WaitlistOf}; +use common::event::DispatchStatus; use frame_support::traits::Randomness; use gear_core::ids::{CodeId, ReservationId}; use gear_core_errors::{ReplyCode, SuccessReplyReason}; @@ -39,6 +40,84 @@ use parity_scale_codec::Decode; use sp_runtime::SaturatedConversion; use test_syscalls::{Kind, WASM_BINARY as SYSCALLS_TEST_WASM_BINARY}; +pub fn read_big_state() +where + T: Config, + T::AccountId: Origin, +{ + use demo_read_big_state::{State, Strings, WASM_BINARY}; + + #[cfg(feature = "std")] + utils::init_logger(); + + let origin = benchmarking::account::("origin", 0, 0); + CurrencyOf::::deposit_creating( + &origin, + 100_000_000_000_000_000_u128.unique_saturated_into(), + ); + + let salt = b"read_big_state salt"; + + Gear::::upload_program( + RawOrigin::Signed(origin.clone()).into(), + WASM_BINARY.to_vec(), + salt.to_vec(), + Default::default(), + BlockGasLimitOf::::get(), + Zero::zero(), + ) + .expect("Failed to upload read_big_state binary"); + + let pid = ProgramId::generate(CodeId::generate(WASM_BINARY), salt); + utils::run_to_next_block::(None); + + let string = String::from("hi").repeat(4095); + let string_size = 8 * 1024; + assert_eq!(string.encoded_size(), string_size); + + let strings = Strings::new(string); + let strings_size = (string_size * Strings::LEN) + 1; + assert_eq!(strings.encoded_size(), strings_size); + + let approx_size = + |size: usize, iteration: usize| -> usize { size - 17 - 144 * (iteration + 1) }; + + // with initial data step is ~2 MiB + let expected_size = + |iteration: usize| -> usize { Strings::LEN * State::LEN * string_size * (iteration + 1) }; + + // go to 6 MiB due to approximate calculations and 8MiB reply restrictions + for i in 0..3 { + let next_user_mid = utils::get_next_message_id::(origin.clone()); + + Gear::::send_message( + RawOrigin::Signed(origin.clone()).into(), + pid, + strings.encode(), + BlockGasLimitOf::::get(), + Zero::zero(), + false, + ) + .expect("Failed to send read_big_state append command"); + + utils::run_to_next_block::(None); + + assert!(SystemPallet::::events().into_iter().any(|e| { + let bytes = e.event.encode(); + let Ok(gear_event): Result, _> = Event::decode(&mut bytes[1..].as_ref()) else { return false }; + let Event::MessagesDispatched { statuses, .. } = gear_event else { return false }; + + log::debug!("{statuses:?}"); + log::debug!("{next_user_mid:?}"); + matches!(statuses.get(&next_user_mid), Some(DispatchStatus::Success)) + }), "No message with expected id had succeeded"); + + let state = + Gear::::read_state_impl(pid, Default::default()).expect("Failed to read state"); + assert_eq!(approx_size(state.len(), i), expected_size(i)); + } +} + pub fn main_test() where T: Config, From 103a8bf837df481b2c20d50cf7709feaa253bda3 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Thu, 7 Sep 2023 18:28:42 +0300 Subject: [PATCH 124/165] fix(runtime-fuzzer): Fix fuzzer coverage script (#3228) --- docker/runtime-fuzzer/Dockerfile | 2 +- docker/runtime-fuzzer/scripts/fuzzer.sh | 3 ++- utils/runtime-fuzzer/README.md | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker/runtime-fuzzer/Dockerfile b/docker/runtime-fuzzer/Dockerfile index 806a37e574b..339055cb3b4 100644 --- a/docker/runtime-fuzzer/Dockerfile +++ b/docker/runtime-fuzzer/Dockerfile @@ -18,7 +18,7 @@ RUN apt update -y && \ rustup target add wasm32-unknown-unknown --toolchain nightly; \ rustup default nightly; \ # Install cargo-fuzz \ - cargo install --git https://github.com/rust-fuzz/cargo-fuzz; \ + cargo install --version 0.11.2 cargo-fuzz; \ # Set rights \ chmod +x ./scripts/gear.sh && \ # Create dir for corpus \ diff --git a/docker/runtime-fuzzer/scripts/fuzzer.sh b/docker/runtime-fuzzer/scripts/fuzzer.sh index 70f12b4fa99..91ad8f99c8c 100755 --- a/docker/runtime-fuzzer/scripts/fuzzer.sh +++ b/docker/runtime-fuzzer/scripts/fuzzer.sh @@ -67,7 +67,8 @@ function start_container_post { -c "cargo install cargo-binutils && \ rustup component add llvm-tools-preview && \ rustup component add --toolchain nightly llvm-tools-preview && \ - cargo fuzz coverage --release --sanitizer=none main /corpus/main && \ + cargo fuzz coverage --release --sanitizer=none main /corpus/main -- \ + -rss_limit_mb=8192 -max_len=35000000 -len_control=0 && \ cargo cov -- show target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/main \ --format=text \ --show-line-counts \ diff --git a/utils/runtime-fuzzer/README.md b/utils/runtime-fuzzer/README.md index 3b9c326aeb9..a7600d80bf9 100644 --- a/utils/runtime-fuzzer/README.md +++ b/utils/runtime-fuzzer/README.md @@ -19,7 +19,7 @@ cd utils/runtime-fuzzer # Fuzzer expects a minimal input size of 25 MiB. Without providing a corpus of the same or larger # size fuzzer will stuck for a long time with trying to test the target using 0..100 bytes. mkdir -p fuzz/corpus/main -dd if=/dev/urandom of=fuzz/corpus/main/check-fuzzer-bytes bs=1 count=27000000 +dd if=/dev/urandom of=fuzz/corpus/main/fuzzer-seed-corpus bs=1 count=27000000 # Run fuzzer for at least 20 minutes and then press Ctrl-C to stop fuzzing. # You can also remove RUST_LOG to avoid printing tons of logs on terminal. From 9c515efad7d62f33187c9f4f4a40f5ec5105d6bc Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Thu, 7 Sep 2023 21:36:25 +0300 Subject: [PATCH 125/165] feat(runtime-fuzzer): Optionally enable fuzzer logs (#3229) --- Makefile | 8 -------- scripts/check-fuzzer.sh | 2 +- scripts/gear.sh | 2 +- scripts/src/test.sh | 13 ++++++++++--- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 7e42d79edf5..0a253551404 100644 --- a/Makefile +++ b/Makefile @@ -256,14 +256,6 @@ doc: -p pallet-gear-program -p pallet-gear-rpc-runtime-api -p pallet-gear-rpc -p pallet-gear-scheduler -p gsdk @ cp -f images/logo.svg target/doc/rust-logo.svg -.PHONY: fuzz -fuzz: - @ ./scripts/gear.sh test fuzz $(target) - -.PHONY: fuzz-vara #TODO 2434 test it works -fuzz-vara: - @ ./scripts/gear.sh test fuzz --features=vara-native,lazy-pages --no-default-features $(target) - .PHONY: kill-gear kill: @ pkill -f 'gear |gear$' -9 diff --git a/scripts/check-fuzzer.sh b/scripts/check-fuzzer.sh index a7a9d4a37e8..fff3839e853 100755 --- a/scripts/check-fuzzer.sh +++ b/scripts/check-fuzzer.sh @@ -8,7 +8,7 @@ main() { dd if=/dev/urandom of=utils/runtime-fuzzer/fuzz/corpus/main/check-fuzzer-bytes bs=1 count=27000000 echo " >> Running fuzzer with failpoint" - RUST_BACKTRACE=1 FAILPOINTS=fail_fuzzer=return ./scripts/gear.sh test fuzz > fuzz_run 2>&1 + RUST_BACKTRACE=1 FAILPOINTS=fail_fuzzer=return ./scripts/gear.sh test fuzz "" wlogs > fuzz_run 2>&1 echo " >> Checking fuzzer output" if cat fuzz_run | grep -qzP '(?s)(?=.*GasTree corrupted)(?=.*NodeAlreadyExists)(?=.*\Qpallet_gear::pallet::Pallet>::consume_and_retrieve\E)' ; then diff --git a/scripts/gear.sh b/scripts/gear.sh index a7e2ebc1d55..e74c01c7145 100755 --- a/scripts/gear.sh +++ b/scripts/gear.sh @@ -299,7 +299,7 @@ case "$COMMAND" in fuzz) header "Running fuzzer for runtime panic checks" - run_fuzzer "$ROOT_DIR" "$1"; ;; + run_fuzzer "$ROOT_DIR" "$1" "$2"; ;; fuzz-repr) header "Running fuzzer reproduction" diff --git a/scripts/src/test.sh b/scripts/src/test.sh index 07272ce15e9..aa51385bfc8 100755 --- a/scripts/src/test.sh +++ b/scripts/src/test.sh @@ -20,7 +20,9 @@ test_usage() { gcli run gcli package tests pallet run pallet-gear tests client run client tests via gclient - fuzz run fuzzer with a fuzz target + fuzz run fuzzer + The scripts accepts a path to corpus dir as a first param, + and a "wlogs" flag to enable logs while fuzzing. fuzz-repr run fuzzer reproduction test syscalls run syscalls integrity test in benchmarking module of pallet-gear docs run doc tests @@ -85,9 +87,14 @@ run_fuzzer() { # Navigate to fuzzer dir cd $ROOT_DIR/utils/runtime-fuzzer + if [ "$3" = "wlogs" ]; then + LOG_TARGETS="debug,syscalls,gear_wasm_gen=trace,runtime_fuzzer=trace,gear_backend_common=trace" + else + LOG_TARGETS="off" + fi + # Run fuzzer - RUST_LOG=debug,syscalls,gear_wasm_gen=trace,runtime_fuzzer=trace,gear_backend_common=trace \ - cargo fuzz run --release --sanitizer=none main $CORPUS_DIR -- -rss_limit_mb=8192 -max_len=35000000 -len_control=0 + RUST_LOG="$LOG_TARGETS" cargo fuzz run --release --sanitizer=none main $CORPUS_DIR -- -rss_limit_mb=8192 -max_len=35000000 -len_control=0 } test_fuzzer_reproduction() { From ec10e18bbf897e08267e45d0e4993e4f86483090 Mon Sep 17 00:00:00 2001 From: Dmitriy <128726599+Magorsky@users.noreply.github.com> Date: Fri, 8 Sep 2023 18:27:39 +0300 Subject: [PATCH 126/165] chore(scripts): add fuzzer.sh changes (#3230) --- docker/runtime-fuzzer/scripts/fuzzer.sh | 36 ++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/docker/runtime-fuzzer/scripts/fuzzer.sh b/docker/runtime-fuzzer/scripts/fuzzer.sh index 91ad8f99c8c..eab3c634910 100755 --- a/docker/runtime-fuzzer/scripts/fuzzer.sh +++ b/docker/runtime-fuzzer/scripts/fuzzer.sh @@ -15,6 +15,8 @@ DOCKER_EXIT_CODE='' # ALERTING PARAMS GROUP_ID='***' BOT_TOKEN='***' +#HTTP +URL='***' # Function to check container was stopped manually function _check_stop_manually { @@ -75,11 +77,19 @@ function start_container_post { --Xdemangler=rustfilt \ --ignore-filename-regex=/rustc/ \ --ignore-filename-regex=.cargo/ \ - --instr-profile=fuzz/coverage/main/coverage.profdata > /corpus/main/gear$1.txt 2>&1" + --instr-profile=fuzz/coverage/main/coverage.profdata > /corpus/main/coverage_$1.txt 2>&1 && \ + cargo cov -- export target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/main \ + --format=lcov \ + --instr-profile=fuzz/coverage/main/coverage.profdata \ + --ignore-filename-regex=/rustc/ \ + --ignore-filename-regex=.cargo/ > /corpus/main/lcov_$1.info" # Wait for the container to stop docker wait ${CONTAINER_NAME_GEAR} - mv ${CORPUS_DIR}/gear$1.txt ${ARCHIVE_PATH} + mv ${CORPUS_DIR}/coverage_$1.txt ${ARCHIVE_PATH} + mv ${CORPUS_DIR}/lcov_$1.txt ${ARCHIVE_PATH} + # Clear folder with corpus rm -rf $WORK_DIR/corpus/* + # Generate new first seed dd if=/dev/urandom of=$WORK_DIR/corpus/first-seed bs=1 count=27000000 } @@ -110,7 +120,7 @@ function alert_tg { Please check logs. Archive link: -Link" +Link" echo "$WORK_DIR" curl -s \ @@ -123,6 +133,19 @@ Please check logs. rm node-fuzzer.log } +function info_alert_tg { + COV_NUM=$(find $ARCHIVE_PATH -name "gear*" -type f -mmin -720 | wc -l) + if [[ $COV_NUM -gt 0 ]]; then + text_message="❕Node Fuzzer Info❕ +Info: For last 12 hours $COV_NUM coverages was created. +Link: Link +Disc Free Space: $(df -h | grep root | awk '{print $4}')" + curl -s \ + --data "text=$text_message" --data "chat_id=$GROUP_ID" \ + 'https://api.telegram.org/bot'$BOT_TOKEN'/sendMessage?parse_mode=HTML' + fi +} + function archive_logs { ARCHIVE_NAME="node-fuzzer_logs_$1.tar.gz" # Get the logs from the container and archive them with the current timestamp in the filename @@ -146,7 +169,7 @@ function start { echo "########## $(date) ###########" echo "Start container: ${CONTAINER_NAME}" start_container - DATE=$(date +%Y-%m-%d_%H-%M-%S) + DATE=$(date +%Y-%m-%d_%H-%M-%S) _check_container_runtime if ! _check_stop_manually; then echo "start archive" @@ -175,9 +198,14 @@ function stop { docker rmi ${IMAGE} } +function info { + info_alert_tg +} + case "$1" in start) start;; stop) stop;; + info) info;; *) echo "usage: $0 start_app|stop_app" >&2 exit 1 ;; From 7fa7f0fc7c726c99de463a26f35c8ae39baf7c83 Mon Sep 17 00:00:00 2001 From: Gregory Sobol Date: Sun, 10 Sep 2023 23:14:26 +0400 Subject: [PATCH 127/165] feat(pallet-gear): enable stack limit instrumentation (#3209) --- Cargo.lock | 1 + core-processor/src/executor.rs | 4 +- core-processor/src/ext.rs | 4 +- core/src/code.rs | 404 +++++++++++--------- core/src/program.rs | 2 +- examples/fungible-token/tests/benchmarks.rs | 22 +- gcli/src/meta/mod.rs | 13 +- gsdk/HOW-TO-UPDATE.md | 2 +- gsdk/src/metadata/generated.rs | 2 +- gtest/src/manager.rs | 12 +- pallets/gear/src/benchmarking/mod.rs | 8 +- pallets/gear/src/benchmarking/syscalls.rs | 56 --- pallets/gear/src/benchmarking/tests/mod.rs | 68 +++- pallets/gear/src/lib.rs | 51 ++- pallets/gear/src/runtime_api.rs | 7 +- pallets/gear/src/schedule.rs | 10 +- pallets/gear/src/tests.rs | 281 +++++++++----- sandbox/host/Cargo.toml | 1 + sandbox/host/src/sandbox/wasmer_backend.rs | 13 +- sandbox/host/src/sandbox/wasmi_backend.rs | 14 +- utils/wasm-builder/src/optimize.rs | 29 +- utils/wasm-gen/src/tests.rs | 4 +- 22 files changed, 595 insertions(+), 413 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a946403defe..c6b1074db12 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4258,6 +4258,7 @@ dependencies = [ "thiserror", "wasmer", "wasmer-cache", + "wasmer-types", "wasmi 0.13.2", ] diff --git a/core-processor/src/executor.rs b/core-processor/src/executor.rs index df24b6924be..c98778ff592 100644 --- a/core-processor/src/executor.rs +++ b/core-processor/src/executor.rs @@ -343,7 +343,7 @@ where let execute = || { let env = E::new( ext, - program.raw_code(), + program.code_bytes(), kind, program.code().exports().clone(), memory_size, @@ -548,7 +548,7 @@ where let f = || { let env = E::new( ext, - program.raw_code(), + program.code_bytes(), function, program.code().exports().clone(), memory_size, diff --git a/core-processor/src/ext.rs b/core-processor/src/ext.rs index 7ae0201f712..aa872cd3d9b 100644 --- a/core-processor/src/ext.rs +++ b/core-processor/src/ext.rs @@ -30,8 +30,6 @@ use gear_backend_common::{ UnrecoverableExecutionError, UnrecoverableExtError as UnrecoverableExtErrorCore, UnrecoverableWaitError, }; -#[cfg(any(feature = "mock", test))] -use gear_core::message::{ContextSettings, IncomingDispatch}; use gear_core::{ costs::{HostFnWeights, RuntimeCosts}, env::{Externalities, PayloadSliceLock, UnlockPayloadBound}, @@ -112,6 +110,8 @@ pub struct ProcessorContext { impl ProcessorContext { /// Create new mock [`ProcessorContext`] for usage in tests. pub fn new_mock() -> ProcessorContext { + use gear_core::message::{ContextSettings, IncomingDispatch}; + ProcessorContext { gas_counter: GasCounter::new(0), gas_allowance_counter: GasAllowanceCounter::new(0), diff --git a/core/src/code.rs b/core/src/code.rs index 1069659c8c7..86bdc3df438 100644 --- a/core/src/code.rs +++ b/core/src/code.rs @@ -197,26 +197,24 @@ pub enum CodeError { /// The provided code contains unnecessary function exports. #[display(fmt = "Unnecessary function exports found")] NonGearExportFnFound, + /// Validation by wasmparser failed. + #[display(fmt = "Wasm validation failed")] + Validation, /// Error occurred during decoding original program code. - /// - /// The provided code was a malformed Wasm bytecode or contained unsupported features - /// (atomics, simd instructions, etc.). - #[display(fmt = "The wasm bytecode is malformed or contains unsupported features")] + #[display(fmt = "The wasm bytecode is failed to be decoded")] Decode, /// Error occurred during injecting gas metering instructions. /// /// This might be due to program contained unsupported/non-deterministic instructions - /// (floats, manual memory grow, etc.). - #[display(fmt = "Failed to inject instructions for gas metrics: \ - program contains unsupported instructions (floats, manual memory grow, etc.)")] + /// (floats, memory grow, etc.). + #[display(fmt = "Failed to inject instructions for gas metrics: may be in case \ + program contains unsupported instructions (floats, memory grow, etc.)")] GasInjection, /// Error occurred during stack height instrumentation. #[display(fmt = "Failed to set stack height limits")] StackLimitInjection, /// Error occurred during encoding instrumented program. - /// - /// The only possible reason for that might be OOM. - #[display(fmt = "Failed to encode instrumented program (probably because OOM)")] + #[display(fmt = "Failed to encode instrumented program")] Encode, /// We restrict start sections in smart contracts. #[display(fmt = "Start section is not allowed for smart contracts")] @@ -242,16 +240,17 @@ pub enum CodeError { } /// Contains instrumented binary code of a program and initial memory size from memory import. -#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] +#[derive(Clone, Debug, PartialEq, Eq)] pub struct Code { /// Code instrumented with the latest schedule. code: Vec, /// The uninstrumented, original version of the code. - raw_code: Vec, + original_code: Vec, /// Exports of the wasm module. exports: BTreeSet, + /// Static pages count from memory import. static_pages: WasmPage, - #[codec(compact)] + /// Instruction weights version. instruction_weights_version: u32, } @@ -287,33 +286,94 @@ fn check_mut_global_exports(module: &Module) -> Result<(), CodeError> { Ok(()) } +fn check_start_section(module: &Module) -> Result<(), CodeError> { + if module.start_section().is_some() { + log::debug!("Found start section in contract code, which is not allowed"); + Err(CodeError::StartSectionExists) + } else { + Ok(()) + } +} + +/// Configuration for `Code::try_new_mock_`. +/// By default all checks enabled. +pub struct TryNewCodeConfig { + /// Instrumentation version + pub version: u32, + /// Stack height limit + pub stack_height: Option, + /// Check exports (wasm contains init or handle exports) + pub check_exports: bool, + /// Check and canonize stack end + pub check_and_canonize_stack_end: bool, + /// Check mutable global exports + pub check_mut_global_exports: bool, + /// Check start section (not allowed for smart contracts) + pub check_start_section: bool, + /// Make wasmparser validation + pub make_validation: bool, +} + +impl Default for TryNewCodeConfig { + fn default() -> Self { + Self { + version: 1, + stack_height: None, + check_exports: true, + check_and_canonize_stack_end: true, + check_mut_global_exports: true, + check_start_section: true, + make_validation: true, + } + } +} + +impl TryNewCodeConfig { + /// New default config without exports checks. + pub fn new_no_exports_check() -> Self { + Self { + check_exports: false, + ..Default::default() + } + } +} + impl Code { /// Create the code by checking and instrumenting `original_code`. - pub fn try_new( - raw_code: Vec, - version: u32, - mut get_gas_rules: GetRulesFn, - stack_height: Option, + fn try_new_internal( + original_code: Vec, + get_gas_rules: Option, + config: TryNewCodeConfig, ) -> Result where R: Rules, GetRulesFn: FnMut(&Module) -> R, { - wasmparser::validate(&raw_code).map_err(|_| CodeError::Decode)?; + if config.make_validation { + wasmparser::validate(&original_code).map_err(|err| { + log::trace!("Wasm validation failed: {err}"); + CodeError::Validation + })?; + } let mut module: Module = - parity_wasm::deserialize_buffer(&raw_code).map_err(|_| CodeError::Decode)?; - - check_and_canonize_gear_stack_end(&mut module)?; - check_mut_global_exports(&module)?; + parity_wasm::deserialize_buffer(&original_code).map_err(|err| { + log::trace!("The wasm bytecode is failed to be decoded: {err}"); + CodeError::Decode + })?; - if module.start_section().is_some() { - log::debug!("Found start section in contract code, which is not allowed"); - return Err(CodeError::StartSectionExists); + if config.check_and_canonize_stack_end { + check_and_canonize_gear_stack_end(&mut module)?; + } + if config.check_mut_global_exports { + check_mut_global_exports(&module)?; + } + if config.check_start_section { + check_start_section(&module)?; } - // get initial memory size from memory import. - let static_pages_raw = module + // get initial memory size from memory import + let static_pages = module .import_section() .ok_or(CodeError::ImportSectionNotFound)? .entries() @@ -322,172 +382,170 @@ impl Code { parity_wasm::elements::External::Memory(mem_ty) => Some(mem_ty.limits().initial()), _ => None, }) - .ok_or(CodeError::MemoryEntryNotFound)?; - let static_pages = - WasmPage::new(static_pages_raw).map_err(|_| CodeError::InvalidStaticPageCount)?; + .map(WasmPage::new) + .ok_or(CodeError::MemoryEntryNotFound)? + .map_err(|_| CodeError::InvalidStaticPageCount)?; if static_pages.raw() > MAX_WASM_PAGE_COUNT as u32 { return Err(CodeError::InvalidStaticPageCount); } - let exports = get_exports(&module, true)?; - - if exports.contains(&DispatchKind::Init) || exports.contains(&DispatchKind::Handle) { - let gas_rules = get_gas_rules(&module); - let instrumented_module = gear_wasm_instrument::inject(module, &gas_rules, "env") - .map_err(|_| CodeError::GasInjection)?; - - let instrumented = if let Some(limit) = stack_height { - let instrumented_module = - wasm_instrument::inject_stack_limiter(instrumented_module, limit) - .map_err(|_| CodeError::StackLimitInjection)?; - parity_wasm::elements::serialize(instrumented_module) - .map_err(|_| CodeError::Encode)? - } else { - parity_wasm::elements::serialize(instrumented_module) - .map_err(|_| CodeError::Encode)? - }; - - Ok(Self { - code: instrumented, - raw_code, - exports, - static_pages, - instruction_weights_version: version, - }) - } else { - Err(CodeError::RequiredExportFnNotFound) - } - } - - /// Create the code without instrumentation or instrumented - /// with `ConstantCostRules`. There is also no check for static memory pages. - pub fn new_raw( - original_code: Vec, - version: u32, - module: Option, - instrument_with_const_rules: bool, - check_entries: bool, - ) -> Result { - wasmparser::validate(&original_code).map_err(|_| CodeError::Decode)?; - - let module = module.unwrap_or( - parity_wasm::deserialize_buffer(&original_code).map_err(|_| CodeError::Decode)?, - ); - - if module.start_section().is_some() { - log::debug!("Found start section in contract code, which is not allowed"); - return Err(CodeError::StartSectionExists); - } - - // get initial memory size from memory import. - let static_pages = WasmPage::new( - module - .import_section() - .ok_or(CodeError::ImportSectionNotFound)? - .entries() - .iter() - .find_map(|entry| match entry.external() { - parity_wasm::elements::External::Memory(mem_ty) => { - Some(mem_ty.limits().initial()) - } - _ => None, - }) - .ok_or(CodeError::MemoryEntryNotFound)?, - ) - .map_err(|_| CodeError::InvalidStaticPageCount)?; - - let exports = get_exports(&module, false)?; - - if check_entries + let exports = get_exports(&module, config.check_exports)?; + if config.check_exports && !(exports.contains(&DispatchKind::Init) || exports.contains(&DispatchKind::Handle)) { return Err(CodeError::RequiredExportFnNotFound); } - let code = if instrument_with_const_rules { - let instrumented_module = - gear_wasm_instrument::inject(module, &ConstantCostRules::default(), "env") - .map_err(|_| CodeError::GasInjection)?; + if let Some(stack_limit) = config.stack_height { + module = wasm_instrument::inject_stack_limiter(module, stack_limit).map_err(|err| { + log::trace!("Failed to inject stack height limits: {err}"); + CodeError::StackLimitInjection + })?; + } - parity_wasm::elements::serialize(instrumented_module).map_err(|_| CodeError::Encode)? - } else { - original_code.clone() - }; + if let Some(mut get_gas_rules) = get_gas_rules { + let gas_rules = get_gas_rules(&module); + module = gear_wasm_instrument::inject(module, &gas_rules, "env") + .map_err(|_| CodeError::GasInjection)?; + } + + let code = parity_wasm::elements::serialize(module).map_err(|err| { + log::trace!("Failed to encode instrumented program: {err}"); + CodeError::Encode + })?; Ok(Self { - raw_code: original_code, code, + original_code, exports, static_pages, - instruction_weights_version: version, + instruction_weights_version: config.version, }) } - /// Create the code with instrumentation, but without checks. - /// There is also no check for static memory pages. - pub fn new_raw_with_rules( + /// Create the code by checking and instrumenting `original_code`. + /// Main logic of instrumentation can be represented by this example: + /// Let's take a code: + /// ```wasm + /// (module + /// (import "env" "memory" (memory 1)) + /// (export "init" (func $init)) + /// (func $f1 + /// <-- f1 code --> + /// ) + /// (func $f2 + /// if (i32.eqz (i32.const 0)) + /// <-- some code --> + /// else + /// <-- some code --> + /// end + /// ) + /// (func $f3 + /// <-- f3 code --> + /// ) + /// (func $init + /// call $f1 + /// call $f2 + /// call $f3 + /// <-- some code --> + /// ) + /// ) + /// ``` + /// + /// After instrumentation code will be like: + /// ```wasm + /// (module + /// (import "env" "memory" (memory 1)) + /// (export "init" (func $init_export)) + /// (func $gas_charge + /// <-- gas charge impl --> ;; see utils/wasm-instrument/src/lib.rs + /// ) + /// (func $f1 + /// i32.const 123 + /// call $gas_charge + /// <-- f1 code --> + /// ) + /// (func $f2 + /// i32.const 123 + /// call $gas_charge + /// if (i32.eqz (i32.const 0)) + /// i32.const 1 + /// call $gas_charge + /// <-- some code --> + /// else + /// i32.const 2 + /// call $gas_charge + /// <-- some code --> + /// end + /// ) + /// (func $init + /// i32.const 123 + /// call $gas_charge + /// ;; stack limit check impl see in wasm_instrument::inject_stack_limiter + /// <-- stack limit check and increase --> + /// call $f1 + /// <-- stack limit decrease --> + /// <-- stack limit check and increase --> + /// call $f2 + /// <-- stack limit decrease --> + /// <-- some code --> + /// ) + /// (func $init_export + /// i32.const 123 + /// call $gas_charge + /// <-- stack limit check and increase --> + /// call $init + /// <-- stack limit decrease --> + /// ) + /// ) + pub fn try_new( original_code: Vec, version: u32, - check_entries: bool, - mut get_gas_rules: GetRulesFn, + get_gas_rules: GetRulesFn, + stack_height: Option, ) -> Result where R: Rules, GetRulesFn: FnMut(&Module) -> R, { - wasmparser::validate(&original_code).map_err(|_| CodeError::Decode)?; - - let module: Module = - parity_wasm::deserialize_buffer(&original_code).map_err(|_| CodeError::Decode)?; - - if module.start_section().is_some() { - log::debug!("Found start section in contract code, which is not allowed"); - return Err(CodeError::StartSectionExists); - } - - // get initial memory size from memory import. - let static_pages_raw = module - .import_section() - .ok_or(CodeError::ImportSectionNotFound)? - .entries() - .iter() - .find_map(|entry| match entry.external() { - parity_wasm::elements::External::Memory(mem_ty) => Some(mem_ty.limits().initial()), - _ => None, - }) - .ok_or(CodeError::MemoryEntryNotFound)?; - - let static_pages = - WasmPage::new(static_pages_raw).map_err(|_| CodeError::InvalidStaticPageCount)?; - - let exports = get_exports(&module, false)?; - - if check_entries - && !(exports.contains(&DispatchKind::Init) || exports.contains(&DispatchKind::Handle)) - { - return Err(CodeError::RequiredExportFnNotFound); - } - - let gas_rules = get_gas_rules(&module); - let instrumented_module = gear_wasm_instrument::inject(module, &gas_rules, "env") - .map_err(|_| CodeError::GasInjection)?; + Self::try_new_internal( + original_code, + Some(get_gas_rules), + TryNewCodeConfig { + version, + stack_height, + ..Default::default() + }, + ) + } - let instrumented = - parity_wasm::elements::serialize(instrumented_module).map_err(|_| CodeError::Encode)?; + /// Create new code for mock goals with const or no instrumentation rules. + pub fn try_new_mock_const_or_no_rules( + original_code: Vec, + const_rules: bool, + config: TryNewCodeConfig, + ) -> Result { + let get_gas_rules = const_rules.then_some(|_module: &Module| ConstantCostRules::default()); + Self::try_new_internal(original_code, get_gas_rules, config) + } - Ok(Self { - raw_code: original_code, - code: instrumented, - exports, - static_pages, - instruction_weights_version: version, - }) + /// Create new code for mock goals with custom instrumentation rules. + pub fn try_new_mock_with_rules( + original_code: Vec, + get_gas_rules: GetRulesFn, + config: TryNewCodeConfig, + ) -> Result + where + R: Rules, + GetRulesFn: FnMut(&Module) -> R, + { + Self::try_new_internal(original_code, Some(get_gas_rules), config) } /// Returns the original code. - pub fn raw_code(&self) -> &[u8] { - &self.raw_code + pub fn original_code(&self) -> &[u8] { + &self.original_code } /// Returns reference to the instrumented binary code. @@ -512,7 +570,7 @@ impl Code { /// Consumes this instance and returns the instrumented and raw binary codes. pub fn into_parts(self) -> (InstrumentedCode, Vec) { - let original_code_len = self.raw_code.len() as u32; + let original_code_len = self.original_code.len() as u32; ( InstrumentedCode { code: self.code, @@ -521,7 +579,7 @@ impl Code { static_pages: self.static_pages, version: self.instruction_weights_version, }, - self.raw_code, + self.original_code, ) } } @@ -536,13 +594,13 @@ pub struct CodeAndId { impl CodeAndId { /// Calculates the id (hash) of the raw binary code and creates new instance. pub fn new(code: Code) -> Self { - let code_id = CodeId::generate(code.raw_code()); + let code_id = CodeId::generate(code.original_code()); Self { code, code_id } } /// Creates the instance from the precalculated hash without checks. pub fn from_parts_unchecked(code: Code, code_id: CodeId) -> Self { - debug_assert_eq!(code_id, CodeId::generate(code.raw_code())); + debug_assert_eq!(code_id, CodeId::generate(code.original_code())); Self { code, code_id } } @@ -661,10 +719,10 @@ mod tests { ) "#; - let raw_code = wat2wasm(WAT); + let original_code = wat2wasm(WAT); assert_eq!( - Code::try_new(raw_code, 1, |_| ConstantCostRules::default(), None), + Code::try_new(original_code, 1, |_| ConstantCostRules::default(), None), Err(CodeError::NonGearExportFnFound) ); } @@ -679,10 +737,10 @@ mod tests { ) "#; - let raw_code = wat2wasm(WAT); + let original_code = wat2wasm(WAT); assert_eq!( - Code::try_new(raw_code, 1, |_| ConstantCostRules::default(), None), + Code::try_new(original_code, 1, |_| ConstantCostRules::default(), None), Err(CodeError::RequiredExportFnNotFound) ); } @@ -697,10 +755,10 @@ mod tests { ) "#; - let raw_code = wat2wasm(WAT); + let original_code = wat2wasm(WAT); let _ = Code::try_new( - raw_code, + original_code, 1, |_| ConstantCostRules::default(), Some(16 * 1024), diff --git a/core/src/program.rs b/core/src/program.rs index 74d90acfb10..3ead4b37d98 100644 --- a/core/src/program.rs +++ b/core/src/program.rs @@ -65,7 +65,7 @@ impl Program { } /// Reference to raw binary code of this program. - pub fn raw_code(&self) -> &[u8] { + pub fn code_bytes(&self) -> &[u8] { self.code.code() } diff --git a/examples/fungible-token/tests/benchmarks.rs b/examples/fungible-token/tests/benchmarks.rs index b52c153f827..589b9e15e39 100644 --- a/examples/fungible-token/tests/benchmarks.rs +++ b/examples/fungible-token/tests/benchmarks.rs @@ -208,15 +208,15 @@ async fn stress_test() -> Result<()> { async fn stress_transfer() -> Result<()> { let mut rng = StdRng::seed_from_u64(42); - let api = GearApi::dev_from_path(GEAR_PATH).await?; + let api = GearApi::dev_from_path(GEAR_PATH).await.unwrap(); // Use this code in comment for custom node run: // let api = GearApi::dev().await?.with("//Alice")?; // Subscribing for events. - let mut listener = api.subscribe().await?; + let mut listener = api.subscribe().await.unwrap(); // Checking that blocks still running. - assert!(listener.blocks_running().await?); + assert!(listener.blocks_running().await.unwrap()); // Uploading program. let init_msg = InitConfig { @@ -230,9 +230,14 @@ async fn stress_transfer() -> Result<()> { let salt: u8 = rng.gen(); let (message_id, program_id, _hash) = api .upload_program_bytes(WASM_BINARY.to_vec(), [salt], init_msg, MAX_GAS_LIMIT, 0) - .await?; + .await + .unwrap(); - assert!(listener.message_processed(message_id).await?.succeed()); + assert!(listener + .message_processed(message_id) + .await + .unwrap() + .succeed()); // Fill program with test users balances let mut actions: Vec = vec![]; @@ -256,12 +261,15 @@ async fn stress_transfer() -> Result<()> { .map(|action| (program_id, action.encode(), MAX_GAS_LIMIT, 0, false)) .collect(); - let message_ids = send_messages_in_parallel(&api, BATCH_CHUNK_SIZE, 1, &messages).await?; + let message_ids = send_messages_in_parallel(&api, BATCH_CHUNK_SIZE, 1, &messages) + .await + .unwrap(); // Wait until messages are not processed if let Some((msg_id, status)) = listener .message_processed_batch(message_ids) - .await? + .await + .unwrap() .into_iter() .find(|(_, status)| !status.succeed()) { diff --git a/gcli/src/meta/mod.rs b/gcli/src/meta/mod.rs index 647d0deaf0e..fe8b3772c83 100644 --- a/gcli/src/meta/mod.rs +++ b/gcli/src/meta/mod.rs @@ -23,7 +23,7 @@ mod tests; use crate::result::{Error, Result}; use core_processor::configs::BlockInfo; -use gear_core::code::{Code, CodeAndId, InstrumentedCode, InstrumentedCodeAndId}; +use gear_core::code::{Code, CodeAndId, InstrumentedCode, InstrumentedCodeAndId, TryNewCodeConfig}; use gmeta::{MetadataRepr, MetawasmData, TypesRepr}; use registry::LocalRegistry as _; use scale_info::{scale::Decode, PortableRegistry}; @@ -125,15 +125,12 @@ impl Meta { /// Decode metawasm from wasm binary. pub fn decode_wasm(wasm: &[u8]) -> Result { - let code = InstrumentedCodeAndId::from(CodeAndId::new(Code::new_raw( + let code = Code::try_new_mock_const_or_no_rules( wasm.to_vec(), - 1, - None, true, - false, - )?)) - .into_parts() - .0; + TryNewCodeConfig::new_no_exports_check(), + )?; + let (code, _) = InstrumentedCodeAndId::from(CodeAndId::new(code)).into_parts(); Ok(Self::Wasm(MetawasmData::decode( &mut Self::execute(code, "metadata")?.as_ref(), diff --git a/gsdk/HOW-TO-UPDATE.md b/gsdk/HOW-TO-UPDATE.md index da9973a6994..ca9d183d80e 100644 --- a/gsdk/HOW-TO-UPDATE.md +++ b/gsdk/HOW-TO-UPDATE.md @@ -13,4 +13,4 @@ You can do it with the following command: Otherwise, you can open the [`build.rs`](build.rs) file to learn how the code generation process works. In that case use command `GSDK_API_GEN=1 cargo build --package gsdk --release` to start it. In case of any errors, follow the -instructions in the error message. +instructions in the error message. diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index a6801edc06c..53010231e06 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -2709,7 +2709,7 @@ pub mod runtime_types { #[doc = "Program with the specified id is not found."] ProgramNotFound, #[codec(index = 14)] - #[doc = "Voucher can't be redemmed"] + #[doc = "Voucher can't be redeemed"] FailureRedeemingVoucher, #[codec(index = 15)] #[doc = "Gear::run() already included in current block."] diff --git a/gtest/src/manager.rs b/gtest/src/manager.rs index 61ad00e8713..23a5d0cb964 100644 --- a/gtest/src/manager.rs +++ b/gtest/src/manager.rs @@ -31,7 +31,7 @@ use core_processor::{ }; use gear_backend_sandbox::SandboxEnvironment; use gear_core::{ - code::{Code, CodeAndId, InstrumentedCode, InstrumentedCodeAndId}, + code::{Code, CodeAndId, InstrumentedCode, InstrumentedCodeAndId, TryNewCodeConfig}, ids::{CodeId, MessageId, ProgramId, ReservationId}, memory::PageBuf, message::{ @@ -263,7 +263,7 @@ impl ExtManager { init_message_id: Option, ) -> Option<(TestActor, Balance)> { if let Program::Genuine { program, .. } = &program { - self.store_new_code(program.raw_code()); + self.store_new_code(program.code_bytes()); } self.actors .insert(program_id, (TestActor::new(init_message_id, program), 0)) @@ -475,8 +475,12 @@ impl ExtManager { wasm: Vec, args: Option>, ) -> Result> { - let mapping_code = - Code::new_raw(wasm, 1, None, true, false).map_err(|_| TestError::Instrumentation)?; + let mapping_code = Code::try_new_mock_const_or_no_rules( + wasm, + true, + TryNewCodeConfig::new_no_exports_check(), + ) + .map_err(|_| TestError::Instrumentation)?; let mapping_code = InstrumentedCodeAndId::from(CodeAndId::new(mapping_code)) .into_parts() diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 69ea3269d4b..4a9a8085aaa 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -368,6 +368,7 @@ benchmarks! { #[extra] check_all { syscalls_integrity::main_test::(); + tests::check_stack_overflow::(); #[cfg(feature = "lazy-pages")] { tests::lazy_pages::lazy_pages_charging::(); @@ -376,6 +377,11 @@ benchmarks! { } } : {} + #[extra] + check_stack_overflow { + tests::check_stack_overflow::(); + }: {} + #[extra] check_lazy_pages_all { #[cfg(feature = "lazy-pages")] @@ -760,7 +766,7 @@ benchmarks! { reinstrument_per_kb { let c in 0 .. T::Schedule::get().limits.code_len / 1_024; let WasmModule { code, hash, .. } = WasmModule::::sized(c * 1_024, Location::Handle); - let code = Code::new_raw(code, 1, None, false, true).unwrap(); + let code = Code::try_new_mock_const_or_no_rules(code, false, Default::default()).unwrap(); let code_and_id = CodeAndId::new(code); let code_id = code_and_id.code_id(); diff --git a/pallets/gear/src/benchmarking/syscalls.rs b/pallets/gear/src/benchmarking/syscalls.rs index 14afa62f339..3443affb04e 100644 --- a/pallets/gear/src/benchmarking/syscalls.rs +++ b/pallets/gear/src/benchmarking/syscalls.rs @@ -220,7 +220,6 @@ where let module = ModuleDefinition { memory: Some(ImportedMemory::new(0)), imported_functions: vec![SysCallName::Alloc, SysCallName::Free], - init_body: None, handle_body: Some(body::from_instructions(instructions)), ..Default::default() }; @@ -1332,61 +1331,6 @@ where Self::prepare_handle(module, 0) } - // pub fn gr_create_program_wgas(r: u32) -> Result, &'static str> { - // let repetitions = r * API_BENCHMARK_BATCH_SIZE; - - // let module = WasmModule::::dummy(); - // let _ = Gear::::upload_code_raw( - // RawOrigin::Signed(benchmarking::account("instantiator", 0, 0)).into(), - // module.code, - // ); - - // let mut cid_value = [0; CID_VALUE_SIZE as usize]; - // cid_value[0..CID_SIZE as usize].copy_from_slice(module.hash.as_ref()); - // cid_value[CID_SIZE as usize..].copy_from_slice(&0u128.to_le_bytes()); - - // let cid_value_offset = COMMON_OFFSET; - // let payload_offset = cid_value_offset + cid_value.len() as u32; - // let payload_len = 10; - // let res_offset = payload_offset + payload_len; - - // // Use previous result bytes as salt. First one uses 0 bytes. - // let salt_offset = res_offset; - // let salt_len = 32; - - // let module = ModuleDefinition { - // memory: Some(ImportedMemory::new(SMALL_MEM_SIZE)), - // imported_functions: vec![SysCallName::CreateProgramWGas], - // data_segments: vec![DataSegment { - // offset: cid_value_offset, - // value: cid_value.to_vec(), - // }], - // handle_body: Some(body::fallible_syscall( - // repetitions, - // res_offset, - // &[ - // // cid value offset - // InstrI32Const(cid_value_offset), - // // salt offset - // InstrI32Const(salt_offset), - // // salt len - // InstrI32Const(salt_len), - // // payload offset - // InstrI32Const(payload_offset), - // // payload len - // InstrI32Const(payload_len), - // // gas limit - // InstrI64Const(100_000_000), - // // delay - // InstrI32Const(10), - // ], - // )), - // ..Default::default() - // }; - - // Self::prepare_handle(module, 0) - // } - pub fn gr_create_program( batches: u32, payload_len_kb: Option, diff --git a/pallets/gear/src/benchmarking/tests/mod.rs b/pallets/gear/src/benchmarking/tests/mod.rs index c45a25e0728..d163bcf2baf 100644 --- a/pallets/gear/src/benchmarking/tests/mod.rs +++ b/pallets/gear/src/benchmarking/tests/mod.rs @@ -23,8 +23,72 @@ use super::*; +#[cfg(feature = "lazy-pages")] +pub mod lazy_pages; pub mod syscalls_integrity; mod utils; -#[cfg(feature = "lazy-pages")] -pub mod lazy_pages; +use crate::{ + alloc::string::ToString, + benchmarking::{ + code::{body, WasmModule}, + utils as common_utils, + }, + HandleKind, +}; +use common::benchmarking; +use gear_backend_common::TrapExplanation; + +use gear_wasm_instrument::parity_wasm::elements::Instruction; + +pub fn check_stack_overflow() +where + T: Config, + T::AccountId: Origin, +{ + let instrs = vec![ + Instruction::I64Const(10), + Instruction::GetGlobal(0), + Instruction::I64Add, + Instruction::SetGlobal(0), + Instruction::Call(0), + ]; + + let module: WasmModule = ModuleDefinition { + memory: Some(ImportedMemory::max::()), + init_body: Some(body::from_instructions(instrs)), + stack_end: Some(0.into()), + num_globals: 1, + ..Default::default() + } + .into(); + + let source = benchmarking::account("instantiator", 0, 0); + let exec = common_utils::prepare_exec::( + source, + HandleKind::Init(module.code), + Default::default(), + Default::default(), + ) + .unwrap(); + + core_processor::process::( + &exec.block_config, + exec.context, + exec.random_data, + exec.memory_pages, + ) + .unwrap() + .into_iter() + .find_map(|note| match note { + JournalNote::MessageDispatched { outcome, .. } => Some(outcome), + _ => None, + }) + .map(|outcome| match outcome { + DispatchOutcome::InitFailure { reason, .. } => { + assert_eq!(reason, TrapExplanation::Unknown.to_string()); + } + _ => panic!("Unexpected dispatch outcome: {:?}", outcome), + }) + .unwrap(); +} diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 22ce9fa94ff..74718bf5bb3 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -265,7 +265,7 @@ pub mod pallet { /// Message Queue processing routing provider. type QueueRunner: QueueRunner>; - /// Type that allows to check calller's eligibility for using voucher for payment. + /// Type that allows to check caller's eligibility for using voucher for payment. type Voucher: PaymentVoucher< Self::AccountId, ProgramId, @@ -475,7 +475,7 @@ pub mod pallet { ResumePeriodLessThanMinimal, /// Program with the specified id is not found. ProgramNotFound, - /// Voucher can't be redemmed + /// Voucher can't be redeemed FailureRedeemingVoucher, /// Gear::run() already included in current block. GearRunAlreadyInBlock, @@ -566,7 +566,8 @@ pub mod pallet { >::put(bn.saturated_into::()); } - /// Submit program for benchmarks which does not check the code. + /// Upload program to the chain without stack limit injection and + /// does not make some checks for code. #[cfg(feature = "runtime-benchmarks")] pub fn upload_program_raw( origin: OriginFor, @@ -576,22 +577,22 @@ pub mod pallet { gas_limit: u64, value: BalanceOf, ) -> DispatchResultWithPostInfo { - let who = ensure_signed(origin)?; - - let schedule = T::Schedule::get(); + use gear_core::code::TryNewCodeConfig; - let module = - gear_wasm_instrument::parity_wasm::deserialize_buffer(&code).map_err(|e| { - log::debug!("Module failed to load: {:?}", e); - Error::::ProgramConstructionFailed - })?; + let who = ensure_signed(origin)?; - let code = Code::new_raw( + let code = Code::try_new_mock_const_or_no_rules( code, - schedule.instruction_weights.version, - Some(module), - true, true, + TryNewCodeConfig { + // actual version to avoid re-instrumentation + version: T::Schedule::get().instruction_weights.version, + // some benchmarks have data in user stack memory + check_and_canonize_stack_end: false, + // without stack end canonization, program has mutable globals. + check_mut_global_exports: false, + ..Default::default() + }, ) .map_err(|e| { log::debug!("Code failed to load: {:?}", e); @@ -673,24 +674,16 @@ pub mod pallet { Ok(().into()) } - /// Submit code for benchmarks which does not check nor instrument the code. + /// Upload code to the chain without gas and stack limit injection. #[cfg(feature = "runtime-benchmarks")] pub fn upload_code_raw(origin: OriginFor, code: Vec) -> DispatchResultWithPostInfo { let who = ensure_signed(origin)?; - let schedule = T::Schedule::get(); - - let code = Code::new_raw( - code, - schedule.instruction_weights.version, - None, - false, - true, - ) - .map_err(|e| { - log::debug!("Code failed to load: {:?}", e); - Error::::ProgramConstructionFailed - })?; + let code = Code::try_new_mock_const_or_no_rules(code, false, Default::default()) + .map_err(|e| { + log::debug!("Code failed to load: {e:?}"); + Error::::ProgramConstructionFailed + })?; let code_id = Self::set_code_with_metadata(CodeAndId::new(code), who.into_origin())?; diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index f59c4e568fb..841be8cd72b 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -20,7 +20,7 @@ use super::*; use crate::queue::QueueStep; use common::ActiveProgram; use core::convert::TryFrom; -use gear_core::pages::WasmPage; +use gear_core::{code::TryNewCodeConfig, pages::WasmPage}; use gear_wasm_instrument::syscalls::SysCallName; // Multiplier 6 was experimentally found as median value for performance, @@ -291,11 +291,10 @@ where return Err("Wasm too big".into()); } - let code = Code::new_raw_with_rules( + let code = Code::try_new_mock_with_rules( wasm, - schedule.instruction_weights.version, - false, |module| schedule.rules(module), + TryNewCodeConfig::new_no_exports_check(), ) .map_err(|e| format!("Failed to construct program: {e:?}"))?; diff --git a/pallets/gear/src/schedule.rs b/pallets/gear/src/schedule.rs index fb1a42cb04f..bd6a4f5d03d 100644 --- a/pallets/gear/src/schedule.rs +++ b/pallets/gear/src/schedule.rs @@ -726,7 +726,15 @@ impl Default for Schedule { impl Default for Limits { fn default() -> Self { Self { - stack_height: None, + // Constant for `stack_height` is chosen to be small enough to avoid stack overflow in + // wasmer and wasmi executors. Currently it's just heuristic value. + // Unfortunately it's very hard to calculate this value precisely, + // because of difference of how stack height is calculated in injection and + // how wasmer and wasmi actually uses stack. + // To avoid potential stack overflow problems we have a panic in sandbox in case, + // execution is ended with stack overflow error. So, process queue execution will be + // stopped and we will be able to investigate the problem and decrease this constant if needed. + stack_height: Some(20_000), globals: 256, locals: 1024, parameters: 128, diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 5c2b93fd50d..0e89b7591d1 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -5871,7 +5871,7 @@ fn test_create_program_works() { ) .expect("Code failed to load"); - let code_id = CodeId::generate(code.raw_code()); + let code_id = CodeId::generate(code.original_code()); assert_ok!(Gear::create_program( RuntimeOrigin::signed(USER_1), code_id, @@ -7780,6 +7780,27 @@ fn gas_spent_vs_balance() { #[test] fn gas_spent_precalculated() { + // After instrumentation will be: + // (export "handle" (func $handle_export)) + // (func $add + // <-- call gas_charge --> + // local.get $0 + // local.get $1 + // i32.add + // local.set $2 + // ) + // (func $handle + // <-- call gas_charge --> + // <-- stack limit check and increase --> + // call $add (i32.const 2) (i32.const 2)) + // <-- stack limit decrease --> + // ) + // (func $handle_export + // <-- call gas_charge --> + // <-- stack limit check and increase --> + // call $handle + // <-- stack limit decrease --> + // ) let wat = r#" (module (import "env" "memory" (memory 1)) @@ -7799,14 +7820,63 @@ fn gas_spent_precalculated() { ) )"#; - let wat_no_counter = r#" + // After instrumentation will be: + // (export "init" (func $init_export)) + // (func $init) + // (func $init_export + // <-- call gas_charge --> + // <-- stack limit check and increase --> + // call $init + // <-- stack limit decrease --> + // ) + let wat_empty_init = r#" (module (import "env" "memory" (memory 1)) (export "init" (func $init)) (func $init) )"#; - let wat_init = r#" + // After instrumentation will be: + // (export "init" (func $init_export)) + // (func $f1) + // (func $init + // <-- call gas_charge --> + // <-- stack limit check and increase --> + // call $f1 + // <-- stack limit decrease --> + // ) + // (func $init_export + // <-- call gas_charge --> + // <-- stack limit check and increase --> + // call $init + // <-- stack limit decrease --> + // ) + let wat_two_stack_limits = r#" + (module + (import "env" "memory" (memory 1)) + (export "init" (func $init)) + (func $f1) + (func $init + (call $f1) + ) + )"#; + + // After instrumentation will be: + // (export "init" (func $init_export)) + // (func $init + // <-- call gas_charge --> + // <-- stack limit check and increase --> + // i32.const 1 + // local.set $1 + // <-- stack limit decrease --> + // ) + // (func $init_export + // <-- call gas_charge --> + // <-- stack limit check and increase --> + // call $init + // <-- stack limit decrease --> + // ) + let wat_two_gas_charge = r#" (module (import "env" "memory" (memory 1)) (export "init" (func $init)) @@ -7819,129 +7889,132 @@ fn gas_spent_precalculated() { init_logger(); new_test_ext().execute_with(|| { - let prog = ProgramCodeKind::Custom(wat); - let prog_id = upload_program_default(USER_1, prog).expect("submit result was asserted"); - - let init_gas_id = upload_program_default(USER_3, ProgramCodeKind::Custom(wat_init)) + let pid = upload_program_default(USER_1, ProgramCodeKind::Custom(wat)) .expect("submit result was asserted"); - let init_no_counter_id = - upload_program_default(USER_3, ProgramCodeKind::Custom(wat_no_counter)) + let empty_init_pid = + upload_program_default(USER_3, ProgramCodeKind::Custom(wat_empty_init)) + .expect("submit result was asserted"); + let init_two_gas_charge_pid = + upload_program_default(USER_3, ProgramCodeKind::Custom(wat_two_gas_charge)) + .expect("submit result was asserted"); + let init_two_stack_limits_pid = + upload_program_default(USER_3, ProgramCodeKind::Custom(wat_two_stack_limits)) .expect("submit result was asserted"); run_to_block(2, None); - let code_id = CodeId::generate(&prog.to_bytes()); - let code = ::CodeStorage::get_code(code_id).unwrap(); - let code = code.code(); - - let init_gas_code_id = CodeId::from_origin(ProgramStorageOf::::get_program(init_gas_id) - .and_then(|program| common::ActiveProgram::try_from(program).ok()) - .expect("program must exist") - .code_hash); - let init_code_len: u64 = ::CodeStorage::get_code(init_gas_code_id).unwrap().code().len() as u64; - - let init_no_gas_code_id = CodeId::from_origin(ProgramStorageOf::::get_program(init_no_counter_id) - .and_then(|program| common::ActiveProgram::try_from(program).ok()) - .expect("program must exist") - .code_hash); - let init_no_gas_code_len: u64 = ::CodeStorage::get_code(init_no_gas_code_id).unwrap().code().len() as u64; - - // binaries have the same memory amount but different lengths - // so take this into account in gas calculations - let length_margin = init_code_len - init_no_gas_code_len; - - let GasInfo { - min_limit: gas_spent_init, - .. - } = Gear::calculate_gas_info( - USER_1.into_origin(), - HandleKind::Init(ProgramCodeKind::Custom(wat_init).to_bytes()), - EMPTY_PAYLOAD.to_vec(), - 0, - true, true, - ) - .unwrap(); + let get_program_code_len = |pid| { + let code_id = CodeId::from_origin( + ProgramStorageOf::::get_program(pid) + .and_then(|program| common::ActiveProgram::try_from(program).ok()) + .expect("program must exist") + .code_hash, + ); + ::CodeStorage::get_code(code_id) + .unwrap() + .code() + .len() as u64 + }; - let GasInfo { - min_limit: gas_spent_no_counter, - .. - } = Gear::calculate_gas_info( - USER_1.into_origin(), - HandleKind::Init(ProgramCodeKind::Custom(wat_no_counter).to_bytes()), - EMPTY_PAYLOAD.to_vec(), - 0, - true, true, - ) - .unwrap(); + let get_gas_charged_for_code = |pid| { + let schedule = ::Schedule::get(); + let per_byte_cost = schedule.db_read_per_byte.ref_time(); + let module_instantiation_per_byte = schedule.module_instantiation_per_byte.ref_time(); + let read_cost = DbWeightOf::::get().reads(1).ref_time(); + let code_len = get_program_code_len(pid); + core_processor::calculate_gas_for_code(read_cost, per_byte_cost, code_len) + + module_instantiation_per_byte * code_len + }; - let schedule = ::Schedule::get(); - let per_byte_cost = schedule.db_read_per_byte.ref_time(); - let const_i64_cost = schedule.instruction_weights.i64const; - let set_local_cost = schedule.instruction_weights.local_set; - let module_instantiation_per_byte = schedule.module_instantiation_per_byte.ref_time(); - - // gas_charge call in handle and "add" func - let gas_cost = gas_spent_init - - gas_spent_no_counter - - const_i64_cost as u64 - - set_local_cost as u64 - - core_processor::calculate_gas_for_code(0, per_byte_cost, length_margin) - - module_instantiation_per_byte * length_margin; + let calc_gas_spent_for_init = |wat| { + Gear::calculate_gas_info( + USER_1.into_origin(), + HandleKind::Init(ProgramCodeKind::Custom(wat).to_bytes()), + EMPTY_PAYLOAD.to_vec(), + 0, + true, + true, + ) + .unwrap() + .min_limit + }; - let GasInfo { - min_limit: gas_spent_1, - .. - } = Gear::calculate_gas_info( - USER_1.into_origin(), - HandleKind::Handle(prog_id), - EMPTY_PAYLOAD.to_vec(), - 0, - true, true, - ) - .unwrap(); + let gas_two_gas_charge = calc_gas_spent_for_init(wat_two_gas_charge); + let gas_two_stack_limits = calc_gas_spent_for_init(wat_two_stack_limits); + let gas_empty_init = calc_gas_spent_for_init(wat_empty_init); - let call_cost = schedule.instruction_weights.call; - let get_local_cost = schedule.instruction_weights.local_get; - let add_cost = schedule.instruction_weights.i32add; - let module_instantiation = module_instantiation_per_byte * code.len() as u64; + macro_rules! cost { + ($name:ident) => { + ::Schedule::get().instruction_weights.$name as u64 + }; + } - let total_cost = { - let cost = call_cost - + const_i64_cost * 2 - + set_local_cost - + get_local_cost * 2 - + add_cost - + gas_cost as u32 * 2; + // `wat_empty_init` has 1 gas_charge call and + // `wat_two_gas_charge` has 2 gas_charge calls, so we can calculate + // gas_charge function call cost as difference between them, + // taking in account difference in other aspects. + let gas_charge_call_cost = (gas_two_gas_charge - gas_empty_init) + // Take in account difference in executed instructions + - cost!(i64const) + - cost!(local_set) + // Take in account difference in gas depended on code len + - (get_gas_charged_for_code(init_two_gas_charge_pid) + - get_gas_charged_for_code(empty_init_pid)); + + // `wat_empty_init` has 1 stack limit check and + // `wat_two_stack_limits` has 2 stack limit checks, so we can calculate + // stack limit check cost as difference between them, + // taking in account difference in other aspects. + let stack_check_limit_cost = (gas_two_stack_limits - gas_empty_init) + // Take in account difference in executed instructions + - cost!(call) + // Take in account additional gas_charge call + - gas_charge_call_cost + // Take in account difference in gas depended on code len + - (get_gas_charged_for_code(init_two_stack_limits_pid) + - get_gas_charged_for_code(empty_init_pid)); + + let gas_spent_expected = { + let execution_cost = cost!(call) * 2 + + cost!(i64const) * 2 + + cost!(local_set) + + cost!(local_get) * 2 + + cost!(i32add) + + gas_charge_call_cost * 3 + + stack_check_limit_cost * 2; let read_cost = DbWeightOf::::get().reads(1).ref_time(); - - u64::from(cost) + execution_cost // cost for loading program + core_processor::calculate_gas_for_program(read_cost, 0) // cost for loading code length + read_cost - // cost for loading code - + core_processor::calculate_gas_for_code(read_cost, per_byte_cost, code.len() as u64) - + module_instantiation + // cost for code loading and instantiation + + get_gas_charged_for_code(pid) // cost for one static page in program + ::Schedule::get().memory_weights.static_page.ref_time() }; - assert_eq!(gas_spent_1, total_cost); + let make_check = |gas_spent_expected| { + let GasInfo { + min_limit: gas_spent_calculated, + .. + } = Gear::calculate_gas_info( + USER_1.into_origin(), + HandleKind::Handle(pid), + EMPTY_PAYLOAD.to_vec(), + 0, + true, + true, + ) + .unwrap(); - let GasInfo { - min_limit: gas_spent_2, - .. - } = Gear::calculate_gas_info( - USER_1.into_origin(), - HandleKind::Handle(prog_id), - EMPTY_PAYLOAD.to_vec(), - 0, - true, true, - ) - .expect("calculate_gas_info failed"); + assert_eq!(gas_spent_calculated, gas_spent_expected); + }; - assert_eq!(gas_spent_1, gas_spent_2); + // Check also, that gas spent is the same if we calculate it twice. + make_check(gas_spent_expected); + make_check(gas_spent_expected); }); } diff --git a/sandbox/host/Cargo.toml b/sandbox/host/Cargo.toml index 854f36e26a0..d34332673a2 100644 --- a/sandbox/host/Cargo.toml +++ b/sandbox/host/Cargo.toml @@ -18,6 +18,7 @@ environmental = "1.1.3" thiserror.workspace = true log = { workspace = true, features = ["std"] } wasmer = { version = "2.2", features = ["singlepass"] } +wasmer-types = "2.2" wasmi = { git = "https://github.com/gear-tech/wasmi", branch = "v0.13.2-sign-ext", features = ["virtual_memory"] } sp-allocator = { workspace = true, features = ["std"] } sp-wasm-interface = { workspace = true, features = ["std"] } diff --git a/sandbox/host/src/sandbox/wasmer_backend.rs b/sandbox/host/src/sandbox/wasmer_backend.rs index 96c33630639..cc793f0095e 100644 --- a/sandbox/host/src/sandbox/wasmer_backend.rs +++ b/sandbox/host/src/sandbox/wasmer_backend.rs @@ -21,6 +21,7 @@ use std::{cell::RefCell, collections::HashMap, rc::Rc}; use wasmer::{Exportable, RuntimeError}; +use wasmer_types::TrapCode; use codec::{Decode, Encode}; use gear_sandbox_env::{HostError, Instantiate, WasmReturnValue, GLOBAL_NAME_GAS}; @@ -116,7 +117,17 @@ pub fn invoke( let wasmer_result = SandboxContextStore::using(sandbox_context, || { function .call(&args) - .map_err(|error| Error::Sandbox(error.to_string())) + .map_err(|error| { + if error.clone().to_trap() == Some(TrapCode::StackOverflow) { + // Panic stops process queue execution in that case. + // This allows to avoid error lead to consensus failures, that must be handled + // in node binaries forever. If this panic occur, then we must increase stack memory size, + // or tune stack limit injection. + // see also https://github.com/wasmerio/wasmer/issues/4181 + unreachable!("Suppose that this can not happen, because we have a stack limit instrumentation in programs"); + } + Error::Sandbox(error.to_string()) + }) })?; match wasmer_result.as_ref() { diff --git a/sandbox/host/src/sandbox/wasmi_backend.rs b/sandbox/host/src/sandbox/wasmi_backend.rs index e430093caac..828991fcb65 100644 --- a/sandbox/host/src/sandbox/wasmi_backend.rs +++ b/sandbox/host/src/sandbox/wasmi_backend.rs @@ -25,7 +25,7 @@ use gear_sandbox_env::HostError; use sp_wasm_interface::{util, Pointer, ReturnValue, Value, WordSize}; use wasmi::{ memory_units::Pages, ImportResolver, MemoryInstance, Module, ModuleInstance, RuntimeArgs, - RuntimeValue, Trap, + RuntimeValue, Trap, TrapCode, }; use crate::{ @@ -351,7 +351,17 @@ pub fn invoke( module .invoke_export(export_name, &args, guest_externals) .map(|result| result.map(Into::into)) - .map_err(|error| error::Error::Sandbox(error.to_string())) + .map_err(|error| { + if matches!(error, wasmi::Error::Trap(Trap::Code(TrapCode::StackOverflow))) { + // Panic stops process queue execution in that case. + // This allows to avoid error lead to consensus failures, that must be handled + // in node binaries forever. If this panic occur, then we must increase stack memory size, + // or tune stack limit injection. + // see also https://github.com/wasmerio/wasmer/issues/4181 + unreachable!("Suppose that this can not happen, because we have a stack limit instrumentation in programs"); + } + error::Error::Sandbox(error.to_string()) + }) }) }) } diff --git a/utils/wasm-builder/src/optimize.rs b/utils/wasm-builder/src/optimize.rs index 0702aa49ea6..263eb95e6d7 100644 --- a/utils/wasm-builder/src/optimize.rs +++ b/utils/wasm-builder/src/optimize.rs @@ -2,7 +2,7 @@ use crate::{builder_error::BuilderError, stack_end}; use anyhow::{Context, Result}; #[cfg(not(feature = "wasm-opt"))] use colored::Colorize; -use gear_core::code::Code; +use gear_core::code::{Code, TryNewCodeConfig}; use gear_wasm_instrument::{rules::CustomConstantCostRules, STACK_END_EXPORT_NAME}; use pwasm_utils::{ parity_wasm, @@ -118,22 +118,27 @@ impl Optimizer { // Post-checking the program code for possible errors // `pallet-gear` crate performs the same check at the node level when the user tries to upload program code - let raw_code = code.clone(); + let original_code = code.clone(); match ty { // validate metawasm code // see `pallet_gear::pallet::Pallet::read_state_using_wasm(...)` - OptType::Meta => { - Code::new_raw_with_rules(raw_code, 1, false, |_| CustomConstantCostRules::default()) - .map(|_| ()) - .map_err(BuilderError::CodeCheckFailed)? - } + OptType::Meta => Code::try_new_mock_const_or_no_rules( + original_code, + false, + TryNewCodeConfig::new_no_exports_check(), + ) + .map(|_| ()) + .map_err(BuilderError::CodeCheckFailed)?, // validate wasm code // see `pallet_gear::pallet::Pallet::upload_program(...)` - OptType::Opt => { - Code::try_new(raw_code, 1, |_| CustomConstantCostRules::default(), None) - .map(|_| ()) - .map_err(BuilderError::CodeCheckFailed)? - } + OptType::Opt => Code::try_new( + original_code, + 1, + |_| CustomConstantCostRules::default(), + None, + ) + .map(|_| ()) + .map_err(BuilderError::CodeCheckFailed)?, } Ok(code) diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index 588bdc7c989..1f45db0b6fd 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -338,10 +338,10 @@ proptest! { ..Default::default() }; - let raw_code = generate_gear_program_code(&mut u, configs_bundle) + let original_code = generate_gear_program_code(&mut u, configs_bundle) .expect("failed generating wasm"); - let code_res = Code::try_new(raw_code, 1, |_| CustomConstantCostRules::default(), None); + let code_res = Code::try_new(original_code, 1, |_| CustomConstantCostRules::default(), None); assert!(code_res.is_ok()); } From 369e669996dd66dc2e2983613008759f967174d0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 11 Sep 2023 09:44:09 +0300 Subject: [PATCH 128/165] deps: combine dependabot's PRs (#3238) --- .../workflows/Build-gear-loader-network.yml | 4 +- .github/workflows/CI.yaml | 6 +- .github/workflows/PR.yml | 2 +- .github/workflows/Update-Vara-Prod.yml | 12 +- .github/workflows/Update-testnet.yml | 8 +- .github/workflows/benchmarks.yml | 2 +- .github/workflows/build-macos.yml | 2 +- .github/workflows/build-node-fuzzer.yaml | 2 +- .github/workflows/build.yml | 4 +- .github/workflows/check.yml | 4 +- .github/workflows/docs.yml | 2 +- .github/workflows/label.yml | 2 +- .github/workflows/release.yml | 4 +- .github/workflows/rollback-testnet.yml | 4 +- .github/workflows/test-measurements.yaml | 2 +- .github/workflows/time-consuming-tests.yml | 2 +- .github/workflows/typos.yml | 2 +- Cargo.lock | 106 +++++++++--------- Cargo.toml | 6 +- gsdk/api-gen/Cargo.toml | 2 +- 20 files changed, 89 insertions(+), 89 deletions(-) diff --git a/.github/workflows/Build-gear-loader-network.yml b/.github/workflows/Build-gear-loader-network.yml index 31fd4324a28..ace98317b67 100644 --- a/.github/workflows/Build-gear-loader-network.yml +++ b/.github/workflows/Build-gear-loader-network.yml @@ -14,7 +14,7 @@ jobs: RUSTUP_HOME: /tmp/rustup_home steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Install: Set cargo path" run: echo "/tmp/cargo/bin" >> $GITHUB_PATH @@ -45,7 +45,7 @@ jobs: needs: build-gear-loader steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download artifact uses: actions/download-artifact@v3 diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 54dcca031c4..9256c5ee13e 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -24,7 +24,7 @@ jobs: # runs-on: [kuberunner] # steps: # - name: "ACTIONS: Checkout" - # uses: actions/checkout@v3 + # uses: actions/checkout@v4 # - name: "Fetch origin" # run: git fetch origin @@ -39,7 +39,7 @@ jobs: sccache_path: ${{ steps.sccache.outputs.sccache_path }} steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "CACHE: Set sccache path" id: sccache @@ -71,7 +71,7 @@ jobs: CARGO_INCREMENTAL: 0 steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Install: Setup MSYS2 environment" uses: msys2/setup-msys2@v2 diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 6849ba7e024..c4379322bff 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -21,7 +21,7 @@ jobs: outputs: cache: ${{ steps.check-commit-message.outputs.cache }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/Update-Vara-Prod.yml b/.github/workflows/Update-Vara-Prod.yml index 4b86a606e81..8c162a7b09f 100644 --- a/.github/workflows/Update-Vara-Prod.yml +++ b/.github/workflows/Update-Vara-Prod.yml @@ -13,7 +13,7 @@ jobs: image_tag: ${{ steps.image-tag.outputs.tag }} steps: - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create image tag id: image-tag @@ -24,7 +24,7 @@ jobs: needs: tag-image steps: - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v2 @@ -54,7 +54,7 @@ jobs: environment: production steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Info run: | @@ -93,7 +93,7 @@ jobs: environment: production steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Info run: | @@ -132,7 +132,7 @@ jobs: environment: production steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Info run: | @@ -171,7 +171,7 @@ jobs: needs: [docker, tag-image, deploy-first-connector, deploy-second-connector, deploy-one-validator] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Info run: | diff --git a/.github/workflows/Update-testnet.yml b/.github/workflows/Update-testnet.yml index a682d2ebf2e..8fdf955af51 100644 --- a/.github/workflows/Update-testnet.yml +++ b/.github/workflows/Update-testnet.yml @@ -13,7 +13,7 @@ jobs: image_tag: ${{ steps.image-tag.outputs.tag }} steps: - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Create image tag id: image-tag @@ -24,7 +24,7 @@ jobs: needs: tag-image steps: - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Echo tag run: echo ${{ needs.tag-image.outputs.image_tag }} @@ -53,7 +53,7 @@ jobs: # needs: [docker, tag-image] # steps: # - name: Checkout -# uses: actions/checkout@v3 +# uses: actions/checkout@v4 @@ -89,7 +89,7 @@ jobs: # needs: [docker, deploy-one-validator,tag-image] # steps: # - name: Checkout -# uses: actions/checkout@v3 +# uses: actions/checkout@v4 diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 73c1ef25c97..cdb98420dac 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -19,7 +19,7 @@ jobs: RUSTUP_HOME: /tmp/rustup_home steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 8ab63dd12da..a4a3a9a2cb9 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -18,7 +18,7 @@ jobs: RUSTUP_HOME: /tmp/rustup_home steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "ACTIONS: Setup caching" uses: actions/cache@v3 diff --git a/.github/workflows/build-node-fuzzer.yaml b/.github/workflows/build-node-fuzzer.yaml index fe817a2fd33..dee6607cade 100644 --- a/.github/workflows/build-node-fuzzer.yaml +++ b/.github/workflows/build-node-fuzzer.yaml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v2 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dddbbdfae2e..190dfc4f524 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,7 +36,7 @@ jobs: SCCACHE_DIR: ${{ inputs.cache }} steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Install: Set cargo path" run: echo "/tmp/cargo/bin" >> $GITHUB_PATH @@ -196,7 +196,7 @@ jobs: CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Install: Set cargo path" run: echo "/tmp/cargo/bin" >> $GITHUB_PATH diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index bfba0acb7af..c69b1afdf27 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -22,7 +22,7 @@ jobs: SCCACHE_DIR: ${{ inputs.cache }} steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Install: Set cargo path" run: echo "/tmp/cargo/bin" >> $GITHUB_PATH @@ -76,7 +76,7 @@ jobs: access_token: ${{ github.token }} - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Install: Set cargo path" run: echo "/tmp/cargo/bin" >> $GITHUB_PATH diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 4ccecb5dad4..d9cbb97a2ce 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,7 +17,7 @@ jobs: RUSTUP_HOME: /tmp/rustup_home if: github.actor != 'dependabot[bot]' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 9dd2ef902dc..c27ae71e5a6 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -14,7 +14,7 @@ jobs: || github.event.label.name == 'A4-insubstantial' || github.event.label.name == 'A2-mergeoncegreen' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} - uses: actions/github-script@v6 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 915fb6961dd..5c62aa29c58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: release_body: ${{ steps.git-cliff.outputs.content }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Update config @@ -50,7 +50,7 @@ jobs: runs-on: [kuberunner] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set cargo path run: echo "/tmp/cargo/bin" >> $GITHUB_PATH diff --git a/.github/workflows/rollback-testnet.yml b/.github/workflows/rollback-testnet.yml index aa12d49fa5c..27a9564bc0a 100644 --- a/.github/workflows/rollback-testnet.yml +++ b/.github/workflows/rollback-testnet.yml @@ -17,7 +17,7 @@ jobs: environment: production steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Info run: | @@ -55,7 +55,7 @@ jobs: environment: production steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Info run: | diff --git a/.github/workflows/test-measurements.yaml b/.github/workflows/test-measurements.yaml index de079404e8e..1368cadb136 100644 --- a/.github/workflows/test-measurements.yaml +++ b/.github/workflows/test-measurements.yaml @@ -18,7 +18,7 @@ jobs: timeout-minutes: 720 steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Install: Set cargo path" run: echo "/tmp/cargo/bin" >> $GITHUB_PATH diff --git a/.github/workflows/time-consuming-tests.yml b/.github/workflows/time-consuming-tests.yml index 584697b69d2..126744ebcfa 100644 --- a/.github/workflows/time-consuming-tests.yml +++ b/.github/workflows/time-consuming-tests.yml @@ -16,7 +16,7 @@ jobs: RUSTUP_HOME: /tmp/rustup_home steps: - name: "ACTIONS: Checkout" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "Install: Set cargo path" run: echo "/tmp/cargo/bin" >> $GITHUB_PATH diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml index 6d601654747..110ba5d8774 100644 --- a/.github/workflows/typos.yml +++ b/.github/workflows/typos.yml @@ -15,6 +15,6 @@ jobs: name: Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: typos-action uses: crate-ci/typos@master diff --git a/Cargo.lock b/Cargo.lock index c6b1074db12..1bd81d15e5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -454,7 +454,7 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -465,7 +465,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -1108,7 +1108,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -1651,7 +1651,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -1678,7 +1678,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -1695,7 +1695,7 @@ checksum = "50c49547d73ba8dcfd4ad7325d64c6d5391ff4224d498fc39a6f3f49825a530d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -1743,7 +1743,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -1765,7 +1765,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -2422,7 +2422,7 @@ checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -2568,7 +2568,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -2825,7 +2825,7 @@ checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -2866,7 +2866,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -2887,7 +2887,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -3570,7 +3570,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -3780,7 +3780,7 @@ version = "0.3.2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -3909,7 +3909,7 @@ name = "gear-common-codegen" version = "0.3.2" dependencies = [ "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -4402,7 +4402,7 @@ dependencies = [ "pwasm-utils", "regex", "thiserror", - "toml 0.7.6", + "toml 0.7.7", "wabt", "wasm-opt", "wasmi 0.14.0", @@ -4628,7 +4628,7 @@ dependencies = [ "proc-macro2", "quote", "scale-info", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -4690,7 +4690,7 @@ dependencies = [ "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "subxt-codegen", "subxt-metadata", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -4699,7 +4699,7 @@ version = "0.3.2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -4727,7 +4727,7 @@ dependencies = [ "gstd", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", "trybuild", ] @@ -6974,7 +6974,7 @@ checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -7574,7 +7574,7 @@ version = "2.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -8339,7 +8339,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -8380,7 +8380,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -9048,7 +9048,7 @@ checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -9076,14 +9076,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.6", - "regex-syntax 0.7.4", + "regex-automata 0.3.7", + "regex-syntax 0.7.5", ] [[package]] @@ -9097,13 +9097,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.7.5", ] [[package]] @@ -9114,9 +9114,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "region" @@ -10950,7 +10950,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -10972,7 +10972,7 @@ checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -12600,7 +12600,7 @@ dependencies = [ "quote", "scale-info", "subxt-metadata", - "syn 2.0.29", + "syn 2.0.31", "thiserror", "tokio", ] @@ -12613,7 +12613,7 @@ dependencies = [ "darling 0.20.3", "proc-macro-error", "subxt-codegen", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -12641,9 +12641,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", @@ -12779,7 +12779,7 @@ checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -12927,7 +12927,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -12989,9 +12989,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "de0a3ab2091e52d7299a39d098e200114a972df0a7724add02a273aa9aada592" dependencies = [ "serde", "serde_spanned", @@ -13010,9 +13010,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ "indexmap 2.0.0", "serde", @@ -13094,7 +13094,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] @@ -13459,9 +13459,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna 0.4.0", @@ -13699,7 +13699,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", "wasm-bindgen-shared", ] @@ -13733,7 +13733,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -15213,7 +15213,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.31", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d29797818bc..cc657902e6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -157,10 +157,10 @@ static_assertions = "1" subxt = { version = "0.29.0", git = "https://github.com/gear-tech/subxt", branch = "v0.29.0" } subxt-metadata = { version = "0.29.0", git = "https://github.com/gear-tech/subxt", branch = "v0.29.0" } subxt-codegen = { version = "0.29.0", git = "https://github.com/gear-tech/subxt", branch = "v0.29.0" } -syn = "2.0.28" +syn = "2.0.31" thiserror = "1.0.44" tokio = { version = "1.27.0" } -url = "2.3.1" +url = "2.4.1" wat = "1.0.71" wabt = "0.10.0" wasmi = { version = "0.14.0", default-features = false } @@ -437,7 +437,7 @@ schnorrkel = "0.9.1" # gcli scopeguard = { version = "1.2.0", default-features = false } # pallets/gear tabled = "0.10.0" # utils/regression-analysis thousands = "0.2.0" # utils/regression-analysis -toml = "0.7.3" # utils/wasm-builder +toml = "0.7.7" # utils/wasm-builder tracing = "0.1.37" # utils/node-loder tracing-appender = "0.2" # utils/node-loder tracing-subscriber = "0.3.16" # utils/node-loder diff --git a/gsdk/api-gen/Cargo.toml b/gsdk/api-gen/Cargo.toml index 9cb41604efe..eab4e618452 100644 --- a/gsdk/api-gen/Cargo.toml +++ b/gsdk/api-gen/Cargo.toml @@ -25,4 +25,4 @@ subxt-codegen.workspace = true # TODO: inherit from workspace # # use "2.0.15" because subxt-codegen-0.29.0 requires it. -syn = { version = "2.0.28", features = ["full", "parsing"] } +syn = { version = "2.0.31", features = ["full", "parsing"] } From 3dc2b35bb05c4d87ffb076b18dd658411009292b Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Mon, 11 Sep 2023 13:23:57 +0400 Subject: [PATCH 129/165] feat(runtime)!: Add customisation for gas price (#3239) --- Cargo.lock | 1 + common/src/gas_provider/internal.rs | 122 ++++---- common/src/gas_provider/mod.rs | 41 ++- common/src/gas_provider/node.rs | 40 ++- .../gas_provider/property_tests/assertions.rs | 2 +- common/src/gas_provider/property_tests/mod.rs | 6 +- .../src/gas_provider/property_tests/utils.rs | 2 +- common/src/lib.rs | 44 ++- gcli/tests/cmd/claim.rs | 2 +- gsdk/src/lib.rs | 2 +- gsdk/src/metadata/generated.rs | 14 +- pallets/airdrop/src/mock.rs | 11 +- pallets/gas/src/lib.rs | 8 +- pallets/gas/src/migrations.rs | 239 ++++++++++++++++ pallets/gas/src/tests.rs | 48 ++-- pallets/gear-bank/src/lib.rs | 29 +- pallets/gear-bank/src/mock.rs | 4 + pallets/gear-bank/src/tests.rs | 265 +++++++++--------- pallets/gear-debug/src/mock.rs | 11 +- pallets/gear-scheduler/src/mock.rs | 11 +- pallets/gear-scheduler/src/tests.rs | 59 ++-- pallets/gear/src/benchmarking/mod.rs | 10 +- pallets/gear/src/internal.rs | 11 +- pallets/gear/src/lib.rs | 18 +- pallets/gear/src/mock.rs | 11 +- pallets/gear/src/runtime_api.rs | 5 +- pallets/gear/src/tests.rs | 170 ++++++----- pallets/payment/src/mock.rs | 9 +- runtime/common/src/lib.rs | 12 +- runtime/gear/src/lib.rs | 8 +- runtime/gear/src/migrations.rs | 2 +- runtime/vara/src/lib.rs | 8 +- runtime/vara/src/migrations.rs | 2 +- utils/runtime-fuzzer/Cargo.toml | 1 + utils/runtime-fuzzer/src/runtime/mod.rs | 6 +- 35 files changed, 765 insertions(+), 469 deletions(-) create mode 100644 pallets/gas/src/migrations.rs diff --git a/Cargo.lock b/Cargo.lock index 1bd81d15e5b..c6ee9ecbb10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9350,6 +9350,7 @@ dependencies = [ "pallet-authorship", "pallet-balances", "pallet-gear", + "pallet-gear-bank", "parity-scale-codec", "proptest", "rand 0.8.5", diff --git a/common/src/gas_provider/internal.rs b/common/src/gas_provider/internal.rs index bd4e57f35d1..14d38c14fc0 100644 --- a/common/src/gas_provider/internal.rs +++ b/common/src/gas_provider/internal.rs @@ -33,15 +33,19 @@ enum CatchValueOutput { } impl CatchValueOutput { - fn into_consume_output( + fn into_consume_output( self, origin: ExternalId, - ) -> Option<(NegativeImbalance, ExternalId)> - where - ExternalId: Clone, - { + multiplier: GasMultiplier, + ) -> Option<( + NegativeImbalance, + GasMultiplier, + ExternalId, + )> { match self { - CatchValueOutput::Caught(value) => Some((NegativeImbalance::new(value), origin)), + CatchValueOutput::Caught(value) => { + Some((NegativeImbalance::new(value), multiplier, origin)) + } _ => None, } } @@ -66,16 +70,17 @@ pub struct TreeImpl, ); -impl +impl TreeImpl where Balance: BalanceTrait, + Funds: Clone, TotalValue: ValueStorage, InternalError: super::Error, Error: From, ExternalId: Clone, NodeId: Copy, - StorageMap: MapStorage>, + StorageMap: MapStorage>, { pub(super) fn get_node(key: impl Into) -> Option { StorageMap::get(&key.into()) @@ -107,25 +112,6 @@ where Ok((ret_node, ret_id)) } - /// Returns id and data for root node (as [`GasNode`]) of the value tree, - /// which contains the `node`. If some node along the upstream path is - /// missing, returns an error (tree is invalidated). - /// - /// As in [`TreeImpl::node_with_value`], root's id is of `Option` type. It - /// is equal to `None` in case `node` is a root node. - pub(super) fn root( - node: StorageMap::Value, - ) -> Result<(StorageMap::Value, Option), Error> { - let mut ret_id = None; - let mut ret_node = node; - while let Some(parent) = ret_node.parent() { - ret_id = Some(parent); - ret_node = Self::get_node(parent).ok_or_else(InternalError::parent_is_lost)?; - } - - Ok((ret_node, ret_id)) - } - pub(super) fn decrease_parents_ref(node: &StorageMap::Value) -> Result<(), Error> { let id = match node.parent() { Some(id) => id, @@ -296,7 +282,7 @@ where let mut node = Self::get_node(key).ok_or_else(InternalError::node_not_found)?; let mut consume_output = None; - let external = Self::get_external(key)?; + let (external, multiplier, _) = Self::get_origin_node(key)?; // Descendant's `catch_value` output is used for the sake of optimization. // We could easily run `catch_value` in the below `while` loop each time @@ -323,8 +309,8 @@ where return Err(InternalError::value_is_blocked().into()); } - consume_output = - consume_output.or_else(|| catch_output.into_consume_output(external.clone())); + consume_output = consume_output + .or_else(|| catch_output.into_consume_output(external.clone(), multiplier.clone())); if node.spec_refs() == 0 { Self::decrease_parents_ref(&node)?; @@ -360,9 +346,9 @@ where constructor: impl FnOnce( NodeId, Balance, - &mut GasNode, + &mut GasNode, NodeId, - ) -> Result, Error>, + ) -> Result, Error>, ) -> Result<(), Error> { let key = key.into(); let new_node_key = new_node_key.into(); @@ -411,7 +397,7 @@ where // Get limit node fn that may work with both: consumed and not, depending on `validate` argument. fn get_limit_node_impl( key: impl Into, - validate: impl FnOnce(&GasNode) -> Result<(), Error>, + validate: impl FnOnce(&GasNode) -> Result<(), Error>, ) -> Result<(Balance, NodeId), Error> { let key = key.into(); @@ -430,20 +416,22 @@ where } } -impl Tree +impl Tree for TreeImpl where Balance: BalanceTrait, + Funds: Clone, TotalValue: ValueStorage, InternalError: super::Error, Error: From, ExternalId: Clone, NodeId: Copy, - StorageMap: MapStorage>, + StorageMap: MapStorage>, { type ExternalOrigin = ExternalId; type NodeId = NodeId; type Balance = Balance; + type Funds = Funds; type PositiveImbalance = PositiveImbalance; type NegativeImbalance = NegativeImbalance; @@ -457,6 +445,7 @@ where fn create( origin: Self::ExternalOrigin, + multiplier: GasMultiplier, key: impl Into, amount: Self::Balance, ) -> Result { @@ -466,7 +455,7 @@ where return Err(InternalError::node_already_exists().into()); } - let node = GasNode::new(origin, amount, false); + let node = GasNode::new(origin, multiplier, amount, false); // Save value node to storage StorageMap::insert(key, node); @@ -486,20 +475,23 @@ where fn get_origin_node( key: impl Into, - ) -> Result<(Self::ExternalOrigin, NodeId), Self::Error> { + ) -> Result, Self::Error> { let key = key.into(); let node = Self::get_node(key).ok_or_else(InternalError::node_not_found)?; - // key known, must return the origin, unless corrupted - let (root, maybe_key) = Self::root(node)?; - - if let GasNode::External { id, .. } - | GasNode::Cut { id, .. } - | GasNode::Reserved { id, .. } = root - { - Ok((id, maybe_key.unwrap_or(key))) + if let Some((external_origin, multiplier)) = node.external_data() { + Ok((external_origin, multiplier, key)) } else { - unreachable!("Guaranteed by ValueNode::root method") + let root_id = node + .root_id() + .unwrap_or_else(|| unreachable!("Guaranteed by GasNode::root_id() fn")); + + let root_node = Self::get_node(root_id).ok_or_else(InternalError::node_not_found)?; + + let (external_origin, multiplier) = root_node + .external_data() + .unwrap_or_else(|| unreachable!("Guaranteed by GasNode::root_id() fn")); + Ok((external_origin, multiplier, root_id)) } } @@ -593,7 +585,7 @@ where node.mark_consumed(); let catch_output = Self::catch_value(&mut node)?; - let external = Self::get_external(key)?; + let (external, multiplier, _) = Self::get_origin_node(key)?; let res = if node.refs() == 0 { Self::decrease_parents_ref(&node)?; @@ -604,7 +596,7 @@ where if !catch_output.is_caught() { return Err(InternalError::value_is_not_caught().into()); } - catch_output.into_consume_output(external) + catch_output.into_consume_output(external, multiplier) } GasNode::UnspecifiedLocal { parent, .. } => { if !catch_output.is_blocked() { @@ -616,12 +608,14 @@ where if catch_output.is_blocked() { return Err(InternalError::value_is_blocked().into()); } - let consume_output = catch_output.into_consume_output(external); + let consume_output = catch_output.into_consume_output(external, multiplier); let consume_ancestors_output = Self::try_remove_consumed_ancestors(parent, catch_output)?; match (&consume_output, consume_ancestors_output) { // value can't be caught in both procedures - (Some(_), Some((neg_imb, _))) if neg_imb.peek().is_zero() => consume_output, + (Some(_), Some((neg_imb, ..))) if neg_imb.peek().is_zero() => { + consume_output + } (None, None) => consume_output, _ => return Err(InternalError::unexpected_consume_output().into()), } @@ -633,11 +627,11 @@ where } StorageMap::insert(key, node); - catch_output.into_consume_output(external) + catch_output.into_consume_output(external, multiplier) }; // Update Total in storage - if let Some((negative_imbalance, _)) = res.as_ref() { + if let Some((negative_imbalance, ..)) = res.as_ref() { TotalValue::mutate(|total| { negative_imbalance.apply_to(total).map_err(|_| { *total = None; @@ -708,6 +702,7 @@ where parent_node.increase_spec_refs(); Ok(GasNode::SpecifiedLocal { + root: parent_node.root_id().unwrap_or(parent_id), value, lock: Zero::zero(), system_reserve: Zero::zero(), @@ -743,6 +738,7 @@ where node.increase_unspec_refs(); let new_node = GasNode::UnspecifiedLocal { + root: node.root_id().unwrap_or(node_id), parent: node_id, lock: Zero::zero(), system_reserve: Zero::zero(), @@ -766,9 +762,10 @@ where new_key, amount, |key, value, _parent_node, _parent_id| { - let id = Self::get_external(key)?; + let (id, multiplier, _) = Self::get_origin_node(key)?; Ok(GasNode::Cut { id, + multiplier, value, lock: Zero::zero(), }) @@ -786,8 +783,8 @@ where new_key, amount, |key, value, _parent_node, _parent_id| { - let id = Self::get_external(key)?; - Ok(GasNode::new(id, value, true)) + let (id, multiplier, _) = Self::get_origin_node(key)?; + Ok(GasNode::new(id, multiplier, value, true)) }, ) } @@ -808,16 +805,17 @@ where } } -impl LockableTree +impl LockableTree for TreeImpl where Balance: BalanceTrait, + Funds: Clone, TotalValue: ValueStorage, InternalError: super::Error, Error: From, ExternalId: Clone, NodeId: Copy, - StorageMap: MapStorage>, + StorageMap: MapStorage>, { fn lock( key: impl Into, @@ -945,16 +943,17 @@ where } } -impl ReservableTree - for TreeImpl +impl + ReservableTree for TreeImpl where Balance: BalanceTrait, + Funds: Clone, TotalValue: ValueStorage, InternalError: super::Error, Error: From, ExternalId: Clone, NodeId: Copy, - StorageMap: MapStorage>, + StorageMap: MapStorage>, { fn reserve( key: impl Into, @@ -966,9 +965,10 @@ where new_key, amount, |key, value, _parent_node, _parent_id| { - let id = Self::get_external(key)?; + let (id, multiplier, _) = Self::get_origin_node(key)?; Ok(GasNode::Reserved { id, + multiplier, value, lock: Zero::zero(), refs: Default::default(), diff --git a/common/src/gas_provider/mod.rs b/common/src/gas_provider/mod.rs index 5e58c2e4e15..cf1bda7541a 100644 --- a/common/src/gas_provider/mod.rs +++ b/common/src/gas_provider/mod.rs @@ -43,10 +43,21 @@ pub use reservable::ReservableTree; /// Simplified type for result of `GasTree::consume` call. pub type ConsumeResultOf = Result< - Option<(::NegativeImbalance, ::ExternalOrigin)>, + Option<( + ::NegativeImbalance, + GasMultiplier<::Funds, ::Balance>, + ::ExternalOrigin, + )>, ::Error, >; +/// Simplified type for `GasTree::get_origin_node` call. +pub type OriginNodeDataOf = ( + ::ExternalOrigin, + GasMultiplier<::Funds, ::Balance>, + ::NodeId, +); + /// Abstraction for a chain of value items each piece of which has an attributed /// owner and can be traced up to some root origin. /// @@ -62,6 +73,9 @@ pub trait Tree { /// Type representing a quantity of value. type Balance: Clone; + /// Type representing a quantity of token balance. + type Funds: Clone; + /// Types to denote a result of some unbalancing operation - that is /// operations that create inequality between the underlying value /// supply and some hypothetical "collateral" asset. @@ -89,31 +103,40 @@ pub trait Tree { /// already identifies some other piece of value an error is returned. fn create( origin: Self::ExternalOrigin, + multiplier: GasMultiplier, key: impl Into, amount: Self::Balance, ) -> Result; - /// The id of node and external origin for a key. + /// The id of node, external origin and funds multiplier for a key. /// /// Error occurs if the tree is invalidated (has "orphan" nodes), and the /// node identified by the `key` belongs to a subtree originating at /// such "orphan" node, or in case of inexistent key. - fn get_origin_node( - key: impl Into, - ) -> Result<(Self::ExternalOrigin, Self::NodeId), Self::Error>; + fn get_origin_node(key: impl Into) + -> Result, Self::Error>; /// The external origin for a key. /// /// See [`get_origin_node`](Self::get_origin_node) for details. fn get_external(key: impl Into) -> Result { - Self::get_origin_node(key).map(|(external, _key)| external) + Self::get_origin_node(key).map(|(external, _multiplier, _key)| external) + } + + /// The funds multiplier for a key. + /// + /// See [`get_origin_node`](Self::get_origin_node) for details. + fn get_funds_multiplier( + key: impl Into, + ) -> Result, Self::Error> { + Self::get_origin_node(key).map(|(_external, multiplier, _key)| multiplier) } /// The id of external node for a key. /// /// See [`get_origin_node`](Self::get_origin_node) for details. fn get_origin_key(key: impl Into) -> Result { - Self::get_origin_node(key).map(|(_external, key)| key) + Self::get_origin_node(key).map(|(_external, _multiplier, key)| key) } /// Get value associated with given id and the key of an ancestor, @@ -235,6 +258,9 @@ pub trait Provider { /// Type representing a quantity of value. type Balance; + /// Type representing a quantity of token balance. + type Funds; + /// Types to denote a result of some unbalancing operation - that is /// operations that create inequality between the underlying value /// supply and some hypothetical "collateral" asset. @@ -249,6 +275,7 @@ pub trait Provider { ExternalOrigin = Self::ExternalOrigin, NodeId = Self::NodeId, Balance = Self::Balance, + Funds = Self::Funds, InternalError = Self::InternalError, Error = Self::Error, > + ReservableTree; diff --git a/common/src/gas_provider/node.rs b/common/src/gas_provider/node.rs index b0a6d26115a..82cc86af53d 100644 --- a/common/src/gas_provider/node.rs +++ b/common/src/gas_provider/node.rs @@ -131,12 +131,13 @@ impl NodeLock { #[derive(Clone, Decode, Debug, Encode, MaxEncodedLen, TypeInfo, PartialEq, Eq)] #[codec(crate = codec)] #[scale_info(crate = scale_info)] -pub enum GasNode { +pub enum GasNode { /// A root node for each gas tree. /// /// Usually created when a new gas-ful logic started (i.e., message sent). External { id: ExternalId, + multiplier: GasMultiplier, value: Balance, lock: NodeLock, system_reserve: Balance, @@ -151,6 +152,7 @@ pub enum GasNode { /// (not node's parent, not node's child). Cut { id: ExternalId, + multiplier: GasMultiplier, value: Balance, lock: NodeLock, }, @@ -160,6 +162,7 @@ pub enum GasNode { /// Such node types are detached from initial tree and may act the a root of new tree. Reserved { id: ExternalId, + multiplier: GasMultiplier, value: Balance, lock: NodeLock, refs: ChildrenRefs, @@ -176,6 +179,7 @@ pub enum GasNode { /// from which that one was created. SpecifiedLocal { parent: Id, + root: Id, value: Balance, lock: NodeLock, system_reserve: Balance, @@ -189,6 +193,7 @@ pub enum GasNode { /// Such nodes don't have children references. UnspecifiedLocal { parent: Id, + root: Id, lock: NodeLock, system_reserve: Balance, }, @@ -207,7 +212,8 @@ impl< ExternalId: Clone, Id: Clone + Copy, Balance: Default + Zero + Clone + Copy + sp_runtime::traits::Saturating, - > GasNode + Funds: Clone, + > GasNode { /// Returns total gas value inside GasNode. pub fn total_value(&self) -> Balance { @@ -218,13 +224,19 @@ impl< } } -impl - GasNode +impl + GasNode { /// Creates a new `GasNode::External` root node for a new tree. - pub fn new(id: ExternalId, value: Balance, deposit: bool) -> Self { + pub fn new( + id: ExternalId, + multiplier: GasMultiplier, + value: Balance, + deposit: bool, + ) -> Self { Self::External { id, + multiplier, value, lock: Zero::zero(), system_reserve: Zero::zero(), @@ -404,6 +416,24 @@ impl Option { + match self { + Self::SpecifiedLocal { root, .. } | Self::UnspecifiedLocal { root, .. } => Some(*root), + Self::External { .. } | Self::Cut { .. } | Self::Reserved { .. } => None, + } + } + + /// Returns external origin and funds multiplier of the node if contains that data inside. + pub fn external_data(&self) -> Option<(ExternalId, GasMultiplier)> { + match self { + Self::External { id, multiplier, .. } + | Self::Cut { id, multiplier, .. } + | Self::Reserved { id, multiplier, .. } => Some((id.clone(), multiplier.clone())), + Self::SpecifiedLocal { .. } | Self::UnspecifiedLocal { .. } => None, + } + } + /// Returns whether the node is of `External` type pub(crate) fn is_external(&self) -> bool { matches!(self, Self::External { .. }) diff --git a/common/src/gas_provider/property_tests/assertions.rs b/common/src/gas_provider/property_tests/assertions.rs index 1469e2dd9cd..02e17022a0d 100644 --- a/common/src/gas_provider/property_tests/assertions.rs +++ b/common/src/gas_provider/property_tests/assertions.rs @@ -175,7 +175,7 @@ pub(super) fn assert_root_children_removed( ) { let root_node = root_node.into(); let is_child = |id: GasNodeId<_, _>| { - let (_, origin_id) = Gas::get_origin_node(id).unwrap(); + let origin_id = Gas::get_origin_key(id).unwrap(); origin_id == root_node }; diff --git a/common/src/gas_provider/property_tests/mod.rs b/common/src/gas_provider/property_tests/mod.rs index 35923ce12aa..9d55ef5f177 100644 --- a/common/src/gas_provider/property_tests/mod.rs +++ b/common/src/gas_provider/property_tests/mod.rs @@ -91,6 +91,7 @@ mod strategies; mod utils; type Balance = u64; +type Funds = u128; std::thread_local! { static TOTAL_ISSUANCE: RefCell> = RefCell::new(None); @@ -140,7 +141,7 @@ impl ValueStorage for TotalIssuanceWrap { } type Key = GasNodeId; -type GasNode = super::GasNode; +type GasNode = super::GasNode; #[derive(Debug, Copy, Hash, Clone, Eq, PartialEq, Ord, PartialOrd)] pub struct ExternalOrigin(MapKey); @@ -310,6 +311,7 @@ impl super::Provider for GasProvider { type ExternalOrigin = ExternalOrigin; type NodeId = GasNodeId; type Balance = Balance; + type Funds = Funds; type InternalError = Error; type Error = Error; @@ -429,7 +431,7 @@ proptest! { let lock_ids = all::().collect::>(); // Only root has a max balance - Gas::create(external, root_node, max_balance).expect("Failed to create gas tree"); + Gas::create(external, GasMultiplier::ValuePerGas(25), root_node, max_balance).expect("Failed to create gas tree"); assert_eq!(Gas::total_supply(), max_balance); // Nodes on which `consume` was called diff --git a/common/src/gas_provider/property_tests/utils.rs b/common/src/gas_provider/property_tests/utils.rs index 966e1bbcf10..a4bf4a4c9d7 100644 --- a/common/src/gas_provider/property_tests/utils.rs +++ b/common/src/gas_provider/property_tests/utils.rs @@ -28,7 +28,7 @@ pub(super) fn consume_node( ) -> Result<(MaybeCaughtValue, RemainingNodes, RemovedNodes), super::Error> { let nodes_before_consume = gas_tree_node_clone(); Gas::consume(consuming).map(|maybe_output| { - let maybe_caught_value = maybe_output.map(|(imb, _)| imb.peek()); + let maybe_caught_value = maybe_output.map(|(imb, ..)| imb.peek()); let remaining_nodes = gas_tree_node_clone(); let mut removed_nodes = BTreeMap::new(); for (id, node) in nodes_before_consume { diff --git a/common/src/lib.rs b/common/src/lib.rs index 2ca0c1104d8..3d4873bb6a2 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -42,6 +42,7 @@ pub mod benchmarking; use core::fmt; use frame_support::{ codec::{self, Decode, Encode}, + pallet_prelude::MaxEncodedLen, scale_info::{self, TypeInfo}, sp_runtime::{ self, @@ -49,7 +50,6 @@ use frame_support::{ traits::{Dispatchable, SignedExtension}, }, traits::Get, - weights::{ConstantMultiplier, Weight, WeightToFee}, }; use gear_core::{ ids::{CodeId, MessageId, ProgramId}, @@ -59,7 +59,7 @@ use gear_core::{ reservation::GasReservationMap, }; use primitive_types::H256; -use sp_arithmetic::traits::{BaseArithmetic, Saturating, Unsigned}; +use sp_arithmetic::traits::{BaseArithmetic, One, Saturating, UniqueSaturatedInto, Unsigned}; use sp_core::crypto::UncheckedFrom; use sp_std::{ collections::{btree_map::BTreeMap, btree_set::BTreeSet}, @@ -143,17 +143,39 @@ impl Origin for CodeId { } } -pub trait GasPrice { - type Balance: BaseArithmetic + From + Copy + Unsigned; +#[derive( + Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Encode, Decode, MaxEncodedLen, TypeInfo, +)] +#[codec(crate = codec)] +#[scale_info(crate = scale_info)] +/// Type representing converter between gas and value in different relations. +pub enum GasMultiplier { + ValuePerGas(Balance), + GasPerValue(Gas), +} - type GasToBalanceMultiplier: Get; +impl Default for GasMultiplier { + fn default() -> Self { + Self::ValuePerGas(One::one()) + } +} - /// A price for the `gas` amount of gas. - /// In general case, this doesn't necessarily has to be constant. - fn gas_price(gas: u64) -> Self::Balance { - ConstantMultiplier::::weight_to_fee( - &Weight::from_parts(gas, 0), - ) +impl GasMultiplier +where + Balance: BaseArithmetic + Copy + Unsigned, + Gas: BaseArithmetic + Copy + Unsigned + UniqueSaturatedInto, +{ + /// Converts given gas amount into its value equivalent. + pub fn gas_to_value(&self, gas: Gas) -> Balance { + let gas: Balance = gas.unique_saturated_into(); + + match self { + Self::ValuePerGas(multiplier) => gas.saturating_mul(*multiplier), + Self::GasPerValue(_multiplier) => { + // Consider option to return `(*cost*, *amount of gas to be bought*)`. + unimplemented!("Currently unsupported that 1 Value > 1 Gas"); + } + } } } diff --git a/gcli/tests/cmd/claim.rs b/gcli/tests/cmd/claim.rs index a6491e59f0b..316eacbd1d0 100644 --- a/gcli/tests/cmd/claim.rs +++ b/gcli/tests/cmd/claim.rs @@ -23,7 +23,7 @@ use crate::common::{ }; use gsdk::Api; -const REWARD_PER_BLOCK: u128 = 3_000_000; // 3_000 gas * 1_000 value per gas +const REWARD_PER_BLOCK: u128 = 75_000; // 3_000 gas * 25 value per gas #[tokio::test] async fn test_command_claim_works() -> Result<()> { diff --git a/gsdk/src/lib.rs b/gsdk/src/lib.rs index 1bbf37d138f..f4705522088 100644 --- a/gsdk/src/lib.rs +++ b/gsdk/src/lib.rs @@ -86,7 +86,7 @@ pub struct GasInfo { pub type GearGasNodeId = GasNodeId; /// Gear gas node. -pub type GearGasNode = GasNode; +pub type GearGasNode = GasNode; /// Gear pages. pub type GearPages = HashMap>; diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index 53010231e06..be17b5ca758 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -525,10 +525,11 @@ pub mod runtime_types { #[derive( Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode, )] - pub enum GasNode<_0, _1, _2> { + pub enum GasNode<_0, _1, _2, _3> { #[codec(index = 0)] External { id: _0, + multiplier: runtime_types::gear_common::GasMultiplier<_3, _2>, value: _2, lock: runtime_types::gear_common::gas_provider::node::NodeLock<_2>, system_reserve: _2, @@ -539,12 +540,14 @@ pub mod runtime_types { #[codec(index = 1)] Cut { id: _0, + multiplier: runtime_types::gear_common::GasMultiplier<_3, _2>, value: _2, lock: runtime_types::gear_common::gas_provider::node::NodeLock<_2>, }, #[codec(index = 2)] Reserved { id: _0, + multiplier: runtime_types::gear_common::GasMultiplier<_3, _2>, value: _2, lock: runtime_types::gear_common::gas_provider::node::NodeLock<_2>, refs: runtime_types::gear_common::gas_provider::node::ChildrenRefs, @@ -553,6 +556,7 @@ pub mod runtime_types { #[codec(index = 3)] SpecifiedLocal { parent: _1, + root: _1, value: _2, lock: runtime_types::gear_common::gas_provider::node::NodeLock<_2>, system_reserve: _2, @@ -562,6 +566,7 @@ pub mod runtime_types { #[codec(index = 4)] UnspecifiedLocal { parent: _1, + root: _1, lock: runtime_types::gear_common::gas_provider::node::NodeLock<_2>, system_reserve: _2, }, @@ -683,6 +688,13 @@ pub mod runtime_types { pub block_number: ::core::primitive::u32, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] + pub enum GasMultiplier<_0, _1> { + #[codec(index = 0)] + ValuePerGas(_0), + #[codec(index = 1)] + GasPerValue(_1), + } + #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] pub enum Program<_0> { #[codec(index = 0)] Active(runtime_types::gear_common::ActiveProgram<_0>), diff --git a/pallets/airdrop/src/mock.rs b/pallets/airdrop/src/mock.rs index edfcd314f3b..6e4f334f9f2 100644 --- a/pallets/airdrop/src/mock.rs +++ b/pallets/airdrop/src/mock.rs @@ -23,7 +23,7 @@ use frame_support::{ }; use frame_support_test::TestRandomness; use frame_system as system; -use sp_core::{ConstBool, ConstU128}; +use sp_core::ConstBool; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, ConvertInto, IdentityLookup}, @@ -142,29 +142,24 @@ impl pallet_gear_program::Config for Test { type CurrentBlockNumber = (); } -pub struct GasConverter; -impl common::GasPrice for GasConverter { - type Balance = Balance; - type GasToBalanceMultiplier = ConstU128<1_000>; -} - parameter_types! { pub RentFreePeriod: BlockNumber = 1_000; pub RentCostPerBlock: Balance = 11; pub ResumeMinimalPeriod: BlockNumber = 100; pub ResumeSessionDuration: BlockNumber = 1_000; pub const BankAddress: AccountId = 15082001; + pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(25); } impl pallet_gear_bank::Config for Test { type Currency = Balances; type BankAddress = BankAddress; + type GasMultiplier = GasMultiplier; } impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type GasPrice = GasConverter; type WeightInfo = (); type Schedule = GearSchedule; type OutgoingLimit = OutgoingLimit; diff --git a/pallets/gas/src/lib.rs b/pallets/gas/src/lib.rs index 79069af5103..24d49b20d33 100644 --- a/pallets/gas/src/lib.rs +++ b/pallets/gas/src/lib.rs @@ -139,11 +139,13 @@ mod mock; #[cfg(test)] mod tests; +pub mod migrations; + type BlockGasLimitOf = ::BlockGasLimit; type AccountIdOf = ::AccountId; /// The current storage version. -const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); +const STORAGE_VERSION: StorageVersion = StorageVersion::new(3); #[frame_support::pallet] pub mod pallet { @@ -278,6 +280,7 @@ pub mod pallet { } pub type Balance = u64; + pub type Funds = u128; // ---- @@ -295,7 +298,7 @@ pub mod pallet { // ---- pub type Key = GasNodeId; - pub type NodeOf = GasNode, Key, Balance>; + pub type NodeOf = GasNode, Key, Balance, Funds>; // Private storage for nodes of the gas tree. #[pallet::storage] @@ -337,6 +340,7 @@ pub mod pallet { type ExternalOrigin = AccountIdOf; type NodeId = GasNodeId; type Balance = Balance; + type Funds = Funds; type InternalError = Error; type Error = DispatchError; diff --git a/pallets/gas/src/migrations.rs b/pallets/gas/src/migrations.rs new file mode 100644 index 00000000000..809c218932e --- /dev/null +++ b/pallets/gas/src/migrations.rs @@ -0,0 +1,239 @@ +use crate::{Config, Error, Key, NodeOf, Pallet, Weight}; +use common::GasMultiplier; +use core::marker::PhantomData; +use frame_support::{ + dispatch::GetStorageVersion, + traits::{Get, OnRuntimeUpgrade}, +}; +#[cfg(feature = "try-runtime")] +use sp_std::vec::Vec; + +const MULTIPLIER: GasMultiplier = GasMultiplier::ValuePerGas(1_000); + +pub struct MigrateToV3(PhantomData); + +impl OnRuntimeUpgrade for MigrateToV3 { + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, &'static str> { + use parity_scale_codec::Encode as _; + + let version = >::on_chain_storage_version(); + + Ok(version.encode()) + } + + fn on_runtime_upgrade() -> Weight { + let onchain = Pallet::::on_chain_storage_version(); + let current = Pallet::::current_storage_version(); + + if current != 3 || onchain != 2 { + log::info!("❌ Migrations of `pallet-gear-gas` to V3 are outdated"); + + return T::DbWeight::get().reads(1); + } + + log::info!("🚚 Running migrations to version {current:?} from version {onchain:?}"); + + let mut writes = 0u64; + + crate::GasNodes::::translate::, _>(|key, value| { + writes += 1; + translate::(key, value) + .map_err(|e| { + log::error!("Error translating {key:?} node: {e:?})"); + e + }) + .ok() + }); + + log::info!("Upgraded {writes:?} gas nodes"); + + current.put::>(); + + T::DbWeight::get().reads_writes(1, writes + 1) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(state: Vec) -> Result<(), &'static str> { + use frame_support::traits::StorageVersion; + use parity_scale_codec::Decode; + + let previous: StorageVersion = + Decode::decode(&mut state.as_ref()).map_err(|_| "Cannot decode version")?; + + let onchain = Pallet::::on_chain_storage_version(); + + assert_ne!(previous, onchain, "Must have upgraded from version 2 to 3"); + + log::info!("Storage `pallet-gear-gas` successfully migrated to V3"); + + Ok(()) + } +} + +fn translate(node_key: Key, node: v2::GasNode) -> Result, Error> { + log::info!("Translating {node_key:?} node"); + + let new_node = match node { + v2::GasNode::::Cut { id, value, lock } => NodeOf::::Cut { + id, + multiplier: MULTIPLIER, + value, + lock, + }, + v2::GasNode::::External { + id, + value, + lock, + system_reserve, + refs, + consumed, + deposit, + } => NodeOf::::External { + id, + multiplier: MULTIPLIER, + value, + lock, + system_reserve, + refs, + consumed, + deposit, + }, + v2::GasNode::::Reserved { + id, + value, + lock, + refs, + consumed, + } => NodeOf::::Reserved { + id, + multiplier: MULTIPLIER, + value, + lock, + refs, + consumed, + }, + v2::GasNode::::SpecifiedLocal { + parent, + value, + lock, + system_reserve, + refs, + consumed, + } => NodeOf::::SpecifiedLocal { + parent, + root: v2::root(node_key, node)?, + value, + lock, + system_reserve, + refs, + consumed, + }, + v2::GasNode::::UnspecifiedLocal { + parent, + lock, + system_reserve, + } => NodeOf::::UnspecifiedLocal { + parent, + root: v2::root(node_key, node)?, + lock, + system_reserve, + }, + }; + + Ok(new_node) +} + +mod v2 { + use crate::{AccountIdOf, Balance, Config, Error, Key, Pallet}; + use common::gas_provider::{ChildrenRefs, GasNodeId, NodeLock}; + use core::marker::PhantomData; + use frame_support::{ + storage::types::StorageMap, + traits::{PalletInfo, StorageInstance}, + Identity, + }; + use gear_core::ids::{MessageId, ReservationId}; + use parity_scale_codec::{Decode, Encode}; + + pub type GasNode = GasNodeImpl, GasNodeId, Balance>; + + pub struct GasNodesPrefix(PhantomData); + + impl StorageInstance for GasNodesPrefix { + const STORAGE_PREFIX: &'static str = "GasNodes"; + + fn pallet_prefix() -> &'static str { + <::PalletInfo as PalletInfo>::name::>() + .expect("No name found for the pallet in the runtime!") + } + } + + pub type GasNodes = StorageMap, Identity, Key, GasNode>; + + #[derive(Encode, Decode, Debug)] + pub enum GasNodeImpl { + External { + id: ExternalId, + value: Balance, + lock: NodeLock, + system_reserve: Balance, + refs: ChildrenRefs, + consumed: bool, + deposit: bool, + }, + + Cut { + id: ExternalId, + value: Balance, + lock: NodeLock, + }, + + Reserved { + id: ExternalId, + value: Balance, + lock: NodeLock, + refs: ChildrenRefs, + consumed: bool, + }, + + SpecifiedLocal { + parent: Id, + value: Balance, + lock: NodeLock, + system_reserve: Balance, + refs: ChildrenRefs, + consumed: bool, + }, + + UnspecifiedLocal { + parent: Id, + lock: NodeLock, + system_reserve: Balance, + }, + } + + impl GasNodeImpl { + pub fn parent(&self) -> Option { + match self { + Self::External { .. } | Self::Cut { .. } | Self::Reserved { .. } => None, + Self::SpecifiedLocal { parent, .. } | Self::UnspecifiedLocal { parent, .. } => { + Some(*parent) + } + } + } + } + + pub fn root(mut node_key: Key, mut node: GasNode) -> Result> { + log::trace!("Looking for root of {node_key:?} ({node:?}"); + + while let Some(parent) = node.parent() { + node_key = parent; + node = GasNodes::::get(node_key).ok_or(Error::::ParentIsLost)?; + } + + log::trace!("Root found: {node_key:?}"); + + Ok(node_key) + } +} diff --git a/pallets/gas/src/tests.rs b/pallets/gas/src/tests.rs index 8e6e3f09927..e9edc9cdbc7 100644 --- a/pallets/gas/src/tests.rs +++ b/pallets/gas/src/tests.rs @@ -20,7 +20,7 @@ use super::*; use crate::mock::*; use common::{ gas_provider::{GasNodeId, Imbalance, NegativeImbalance}, - GasTree as _, LockId, LockableTree as _, Origin, + GasMultiplier, GasTree as _, LockId, LockableTree as _, Origin, }; use frame_support::{assert_noop, assert_ok}; use gear_core::ids::MessageId; @@ -34,17 +34,19 @@ fn random_node_id() -> MessageId { MessageId::from_origin(H256::random()) } +const MULTIPLIER: GasMultiplier = GasMultiplier::ValuePerGas(25); + #[test] fn simple_value_tree() { new_test_ext().execute_with(|| { let new_root = random_node_id(); - let pos = Gas::create(ALICE, new_root, 1000).unwrap(); + let pos = Gas::create(ALICE, MULTIPLIER, new_root, 1000).unwrap(); assert_eq!(pos.peek(), 1000); assert_eq!(Gas::total_supply(), 1000); - let (_neg, owner) = Gas::consume(new_root).unwrap().unwrap(); + let (_neg, _, owner) = Gas::consume(new_root).unwrap().unwrap(); assert_eq!(owner, ALICE); assert!(Gas::total_supply().is_zero()); @@ -60,7 +62,7 @@ fn test_consume_procedure_with_subnodes() { let node_3 = random_node_id(); let node_4 = random_node_id(); - let pos_imb = Gas::create(ALICE, root, 300).unwrap(); + let pos_imb = Gas::create(ALICE, MULTIPLIER, root, 300).unwrap(); assert_eq!(Gas::total_supply(), 300); assert_eq!(pos_imb.peek(), 300); // Chain of nodes, that form more likely a path rather then a tree @@ -141,7 +143,7 @@ fn can_cut_nodes() { (1000, 500, 300, 200, 100); // create nodes - Gas::create(ALICE, root, total_supply).unwrap(); + Gas::create(ALICE, MULTIPLIER, root, total_supply).unwrap(); assert_ok!(Gas::cut(root, cut_a, cut_a_value)); assert_ok!(Gas::split_with_value(root, specified, specified_value)); assert_ok!(Gas::cut(specified, cut_b, cut_b_value)); @@ -174,7 +176,7 @@ fn value_tree_with_all_kinds_of_nodes() { ); // create nodes - Gas::create(ALICE, root, total_supply).unwrap(); + Gas::create(ALICE, MULTIPLIER, root, total_supply).unwrap(); assert_ok!(Gas::cut(root, cut, cut_value)); assert_ok!(Gas::split_with_value(root, specified, specified_value)); assert_ok!(Gas::split(root, unspecified)); @@ -189,11 +191,11 @@ fn value_tree_with_all_kinds_of_nodes() { assert_ok!( Gas::consume(root), - Some((NegativeImbalance::new(specified_value), ALICE)) + Some((NegativeImbalance::new(specified_value), MULTIPLIER, ALICE)) ); assert_ok!( Gas::consume(cut), - Some((NegativeImbalance::new(cut_value), ALICE)) + Some((NegativeImbalance::new(cut_value), MULTIPLIER, ALICE)) ); assert!(Gas::total_supply().is_zero()); @@ -223,7 +225,7 @@ fn splits_fail() { let node_3 = random_node_id(); // Prepare the initial configuration - Gas::create(origin, root, 1000).unwrap(); + Gas::create(origin, MULTIPLIER, root, 1000).unwrap(); assert_ok!(Gas::split_with_value(root, node_1, 800)); assert_ok!(Gas::split_with_value(node_1, node_2, 500)); assert_ok!(Gas::split(node_1, node_3)); @@ -253,7 +255,7 @@ fn value_tree_known_errors() { let cut = random_node_id(); let cut_1 = random_node_id(); - let pos_imb = Gas::create(origin, new_root, 1000).unwrap(); + let pos_imb = Gas::create(origin, MULTIPLIER, new_root, 1000).unwrap(); assert_eq!(Gas::total_supply(), 1000); assert_eq!(pos_imb.peek(), 1000); @@ -262,7 +264,7 @@ fn value_tree_known_errors() { // Attempt to re-create an existing node assert_noop!( - Gas::create(origin, new_root, 1000), + Gas::create(origin, MULTIPLIER, new_root, 1000), Error::::NodeAlreadyExists ); @@ -317,7 +319,7 @@ fn sub_nodes_tree_with_spends() { let split_1 = random_node_id(); let split_2 = random_node_id(); - Gas::create(origin, new_root, 1000).unwrap(); + Gas::create(origin, MULTIPLIER, new_root, 1000).unwrap(); assert_ok!(Gas::split_with_value(new_root, split_1, 500)); assert_ok!(Gas::split_with_value(new_root, split_2, 500)); @@ -337,7 +339,7 @@ fn all_keys_are_cleared() { let origin = ALICE; let sub_keys = (0..5).map(|_| random_node_id()).collect::>(); - Gas::create(origin, root, 2000).unwrap(); + Gas::create(origin, MULTIPLIER, root, 2000).unwrap(); for key in sub_keys.iter() { Gas::split_with_value(root, *key, 100).unwrap(); } @@ -366,7 +368,7 @@ fn split_with_no_value() { let split_2 = random_node_id(); let split_1_2 = random_node_id(); - Gas::create(origin, new_root, 1000).unwrap(); + Gas::create(origin, MULTIPLIER, new_root, 1000).unwrap(); assert_ok!(Gas::split(new_root, split_1)); assert_ok!(Gas::split(new_root, split_2)); @@ -401,7 +403,7 @@ fn long_chain() { let m4 = random_node_id(); let origin = ALICE; - Gas::create(origin, root, 2000).unwrap(); + Gas::create(origin, MULTIPLIER, root, 2000).unwrap(); assert_ok!(Gas::split_with_value(root, m1, 1500)); assert_ok!(Gas::split_with_value(m1, m2, 1000)); @@ -434,7 +436,7 @@ fn long_chain() { // Has a patron parent m3 assert_ok!(Gas::consume(m4), None); - let (neg_imb, payee) = Gas::consume(m3).unwrap().unwrap(); + let (neg_imb, _, payee) = Gas::consume(m3).unwrap().unwrap(); // 2000 initial, 5*50 spent assert_eq!( @@ -457,7 +459,7 @@ fn limit_vs_origin() { let split_1_2 = random_node_id(); let split_1_1_1 = random_node_id(); - Gas::create(origin, root_node, 1100).unwrap(); + Gas::create(origin, MULTIPLIER, root_node, 1100).unwrap(); assert_ok!(Gas::cut(root_node, cut, 300)); assert_ok!(Gas::split(root_node, split_1)); @@ -535,7 +537,7 @@ fn subtree_gas_limit_remains_intact() { let node_5 = random_node_id(); // Prepare the initial configuration - Gas::create(origin, root, 1000).unwrap(); + Gas::create(origin, MULTIPLIER, root, 1000).unwrap(); assert_ok!(Gas::split_with_value(root, node_1, 800)); assert_ok!(Gas::split_with_value(node_1, node_2, 500)); assert_ok!(Gas::split(node_1, node_3)); @@ -589,10 +591,10 @@ fn gas_free_after_consumed() { let origin = BOB; let root_msg_id = random_node_id(); - Gas::create(origin, root_msg_id, 1000).unwrap(); + Gas::create(origin, MULTIPLIER, root_msg_id, 1000).unwrap(); assert_ok!(Gas::spend(root_msg_id, 300)); - let (v, _) = Gas::consume(root_msg_id).unwrap().unwrap(); + let (v, ..) = Gas::consume(root_msg_id).unwrap().unwrap(); assert_eq!(v.peek(), 700); assert_noop!( Gas::get_limit_node(root_msg_id), @@ -610,7 +612,7 @@ fn catch_value_all_blocked() { let spec_2 = random_node_id(); let spec_3 = random_node_id(); - Gas::create(ALICE, root, 10000).unwrap(); + Gas::create(ALICE, MULTIPLIER, root, 10000).unwrap(); assert_eq!(Gas::total_supply(), 10000); assert_ok!(Gas::split(root, random_node_id())); assert_ok!(Gas::split(root, random_node_id())); @@ -646,7 +648,7 @@ fn catch_value_all_catch() { let spec_2 = random_node_id(); let spec_3 = random_node_id(); - Gas::create(ALICE, root, 10000).unwrap(); + Gas::create(ALICE, MULTIPLIER, root, 10000).unwrap(); assert_eq!(Gas::total_supply(), 10000); assert_ok!(Gas::split_with_value(root, spec_1, 100)); assert_ok!(Gas::split_with_value(root, spec_2, 100)); @@ -671,7 +673,7 @@ fn lock_works() { let reserved = random_node_id(); // Creating external and locking some value. - Gas::create(ALICE, external, 10_000).unwrap(); + Gas::create(ALICE, MULTIPLIER, external, 10_000).unwrap(); assert_eq!(Gas::total_supply(), 10_000); // Lock value for book a slot in waitlist diff --git a/pallets/gear-bank/src/lib.rs b/pallets/gear-bank/src/lib.rs index 37e37dbe6e6..eb9e34e178e 100644 --- a/pallets/gear-bank/src/lib.rs +++ b/pallets/gear-bank/src/lib.rs @@ -33,6 +33,8 @@ use frame_support::traits::{Currency, StorageVersion}; pub(crate) type AccountIdOf = ::AccountId; pub(crate) type BalanceOf = as Currency>>::Balance; pub(crate) type CurrencyOf = ::Currency; +pub(crate) type GasMultiplier = common::GasMultiplier, u64>; +pub(crate) type GasMultiplierOf = ::GasMultiplier; /// The current storage version. pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); @@ -40,7 +42,6 @@ pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); #[frame_support::pallet] pub mod pallet { use super::*; - use common::GasPrice; use core::ops::Add; use frame_support::{ ensure, @@ -68,6 +69,10 @@ pub mod pallet { #[pallet::constant] /// Bank account address, that will keep all reserved funds. type BankAddress: Get>; + + #[pallet::constant] + /// Gas price converter. + type GasMultiplier: Get>; } // Funds pallets error. @@ -228,15 +233,12 @@ pub mod pallet { Self::withdraw(&block_author, value) } - pub fn deposit_gas>>( - account_id: &AccountIdOf, - amount: u64, - ) -> Result<(), Error> { + pub fn deposit_gas(account_id: &AccountIdOf, amount: u64) -> Result<(), Error> { if amount.is_zero() { return Ok(()); } - let value = P::gas_price(amount); + let value = GasMultiplierOf::::get().gas_to_value(amount); Self::deposit(account_id, value)?; @@ -252,11 +254,12 @@ pub mod pallet { Ok(()) } - fn withdraw_gas_no_transfer>>( + fn withdraw_gas_no_transfer( account_id: &AccountIdOf, amount: u64, + multiplier: GasMultiplier, ) -> Result, Error> { - let value = P::gas_price(amount); + let value = multiplier.gas_to_value(amount); let gas_balance = Self::account_gas(account_id); @@ -281,15 +284,16 @@ pub mod pallet { Ok(value) } - pub fn withdraw_gas>>( + pub fn withdraw_gas( account_id: &AccountIdOf, amount: u64, + multiplier: GasMultiplier, ) -> Result<(), Error> { if amount.is_zero() { return Ok(()); } - let value = Self::withdraw_gas_no_transfer::

(account_id, amount)?; + let value = Self::withdraw_gas_no_transfer(account_id, amount, multiplier)?; // All the checks and internal values withdrawals performed in // `*_no_transfer` function above. @@ -300,15 +304,16 @@ pub mod pallet { Ok(()) } - pub fn spend_gas>>( + pub fn spend_gas( account_id: &AccountIdOf, amount: u64, + multiplier: GasMultiplier, ) -> Result<(), Error> { if amount.is_zero() { return Ok(()); } - let value = Self::withdraw_gas_no_transfer::

(account_id, amount)?; + let value = Self::withdraw_gas_no_transfer(account_id, amount, multiplier)?; // All the checks and internal values withdrawals performed in // `*_no_transfer` function above. diff --git a/pallets/gear-bank/src/mock.rs b/pallets/gear-bank/src/mock.rs index 733bb770a72..21182ff87e5 100644 --- a/pallets/gear-bank/src/mock.rs +++ b/pallets/gear-bank/src/mock.rs @@ -53,12 +53,15 @@ mod consts { pub const EVE: AccountId = 4; pub const EXISTENTIAL_DEPOSIT: Balance = 100_000; + + pub const VALUE_PER_GAS: Balance = 25; } pub use consts::*; parameter_types! { pub const BankAddress: AccountId = BANK_ADDRESS; + pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(VALUE_PER_GAS); pub const BlockHashCount: u64 = 250; pub const ExistentialDeposit: Balance = EXISTENTIAL_DEPOSIT; } @@ -131,6 +134,7 @@ impl pallet_balances::Config for Test { impl pallet_gear_bank::Config for Test { type Currency = Balances; type BankAddress = BankAddress; + type GasMultiplier = GasMultiplier; } pub fn new_test_ext() -> TestExternalities { diff --git a/pallets/gear-bank/src/tests.rs b/pallets/gear-bank/src/tests.rs index 814981cf8ef..f0f0b019562 100644 --- a/pallets/gear-bank/src/tests.rs +++ b/pallets/gear-bank/src/tests.rs @@ -17,9 +17,8 @@ // along with this program. If not, see . use crate::{mock::*, *}; -use common::GasPrice; use frame_support::{assert_noop, assert_ok}; -use sp_runtime::traits::{ConstU128, Zero}; +use sp_runtime::traits::Zero; use utils::*; #[test] @@ -31,22 +30,22 @@ fn deposit_gas_different_users() { assert_balance(&BOB, BOB_BALANCE); const ALICE_GAS: u64 = 1_234_567; - assert_ok!(GearBank::deposit_gas::(&ALICE, ALICE_GAS)); + assert_ok!(GearBank::deposit_gas(&ALICE, ALICE_GAS)); assert_bank_balance(ALICE_GAS, 0); - assert_alice_dec(GasConverter::gas_price(ALICE_GAS)); + assert_alice_dec(gas_price(ALICE_GAS)); assert_gas_value(&ALICE, ALICE_GAS, 0); const BOB_GAS: u64 = 56_789; - assert_ok!(GearBank::deposit_gas::(&BOB, BOB_GAS)); + assert_ok!(GearBank::deposit_gas(&BOB, BOB_GAS)); assert_bank_balance(ALICE_GAS + BOB_GAS, 0); - assert_alice_dec(GasConverter::gas_price(ALICE_GAS)); + assert_alice_dec(gas_price(ALICE_GAS)); assert_gas_value(&ALICE, ALICE_GAS, 0); - assert_bob_dec(GasConverter::gas_price(BOB_GAS)); + assert_bob_dec(gas_price(BOB_GAS)); assert_gas_value(&BOB, BOB_GAS, 0); }) } @@ -55,19 +54,19 @@ fn deposit_gas_different_users() { fn deposit_gas_single_user() { new_test_ext().execute_with(|| { const GAS_1: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_1)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_1)); assert_bank_balance(GAS_1, 0); - assert_alice_dec(GasConverter::gas_price(GAS_1)); + assert_alice_dec(gas_price(GAS_1)); assert_gas_value(&ALICE, GAS_1, 0); const GAS_2: u64 = 67_890; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_2)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_2)); assert_bank_balance(GAS_1 + GAS_2, 0); - assert_alice_dec(GasConverter::gas_price(GAS_1 + GAS_2)); + assert_alice_dec(gas_price(GAS_1 + GAS_2)); assert_gas_value(&ALICE, GAS_1 + GAS_2, 0); }) } @@ -80,9 +79,9 @@ fn deposit_gas_user_account_deleted() { const BALANCE_DIFF: Balance = ALICE_BALANCE - ALICE_TO_DUST_BALANCE; const GAS_AMOUNT: u64 = (BALANCE_DIFF / VALUE_PER_GAS) as u64; - assert_eq!(GasConverter::gas_price(GAS_AMOUNT), BALANCE_DIFF); + assert_eq!(gas_price(GAS_AMOUNT), BALANCE_DIFF); - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert_bank_balance(GAS_AMOUNT, 0); @@ -96,9 +95,9 @@ fn deposit_gas_zero() { new_test_ext().execute_with(|| { let h = frame_support::storage_root(frame_support::StateVersion::V1); - assert_ok!(GearBank::deposit_gas::(&ALICE, 0)); + assert_ok!(GearBank::deposit_gas(&ALICE, 0)); - assert_ok!(GearBank::deposit_gas::(&Zero::zero(), 0)); + assert_ok!(GearBank::deposit_gas(&Zero::zero(), 0)); // No-op operation assertion. assert_eq!( @@ -114,10 +113,10 @@ fn deposit_gas_insufficient_balance() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = u64::MAX; - assert!(GasConverter::gas_price(GAS_AMOUNT) > Balances::free_balance(ALICE)); + assert!(gas_price(GAS_AMOUNT) > Balances::free_balance(ALICE)); assert_noop!( - GearBank::deposit_gas::(&ALICE, GAS_AMOUNT), + GearBank::deposit_gas(&ALICE, GAS_AMOUNT), Error::::InsufficientBalance ); }) @@ -129,7 +128,7 @@ fn deposit_gas_insufficient_deposit() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 1; - assert!(GasConverter::gas_price(GAS_AMOUNT) < CurrencyOf::::minimum_balance()); + assert!(gas_price(GAS_AMOUNT) < CurrencyOf::::minimum_balance()); assert_ok!(Balances::transfer_all( RuntimeOrigin::signed(BANK_ADDRESS), @@ -138,7 +137,7 @@ fn deposit_gas_insufficient_deposit() { )); assert_noop!( - GearBank::deposit_gas::(&ALICE, GAS_AMOUNT), + GearBank::deposit_gas(&ALICE, GAS_AMOUNT), Error::::InsufficientDeposit ); }) @@ -148,31 +147,31 @@ fn deposit_gas_insufficient_deposit() { fn withdraw_gas_different_users() { new_test_ext().execute_with(|| { const ALICE_GAS: u64 = 1_234_567; - assert_ok!(GearBank::deposit_gas::(&ALICE, ALICE_GAS)); + assert_ok!(GearBank::deposit_gas(&ALICE, ALICE_GAS)); const BOB_GAS: u64 = 56_789; - assert_ok!(GearBank::deposit_gas::(&BOB, BOB_GAS)); + assert_ok!(GearBank::deposit_gas(&BOB, BOB_GAS)); const ALICE_WITHDRAW: u64 = ALICE_GAS - 123_456; - assert_ok!(GearBank::withdraw_gas::(&ALICE, ALICE_WITHDRAW)); + assert_ok!(GearBank::withdraw_gas(&ALICE, ALICE_WITHDRAW, mult())); assert_bank_balance(ALICE_GAS - ALICE_WITHDRAW + BOB_GAS, 0); - assert_alice_dec(GasConverter::gas_price(ALICE_GAS - ALICE_WITHDRAW)); + assert_alice_dec(gas_price(ALICE_GAS - ALICE_WITHDRAW)); assert_gas_value(&ALICE, ALICE_GAS - ALICE_WITHDRAW, 0); - assert_bob_dec(GasConverter::gas_price(BOB_GAS)); + assert_bob_dec(gas_price(BOB_GAS)); assert_gas_value(&BOB, BOB_GAS, 0); const BOB_WITHDRAW: u64 = BOB_GAS - 1_234; - assert_ok!(GearBank::withdraw_gas::(&BOB, BOB_WITHDRAW)); + assert_ok!(GearBank::withdraw_gas(&BOB, BOB_WITHDRAW, mult())); assert_bank_balance(ALICE_GAS - ALICE_WITHDRAW + BOB_GAS - BOB_WITHDRAW, 0); - assert_alice_dec(GasConverter::gas_price(ALICE_GAS - ALICE_WITHDRAW)); + assert_alice_dec(gas_price(ALICE_GAS - ALICE_WITHDRAW)); assert_gas_value(&ALICE, ALICE_GAS - ALICE_WITHDRAW, 0); - assert_bob_dec(GasConverter::gas_price(BOB_GAS - BOB_WITHDRAW)); + assert_bob_dec(gas_price(BOB_GAS - BOB_WITHDRAW)); assert_gas_value(&BOB, BOB_GAS - BOB_WITHDRAW, 0); }) } @@ -181,24 +180,22 @@ fn withdraw_gas_different_users() { fn withdraw_gas_single_user() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); const WITHDRAW_1: u64 = GAS_AMOUNT - 23_456; - assert_ok!(GearBank::withdraw_gas::(&ALICE, WITHDRAW_1)); + assert_ok!(GearBank::withdraw_gas(&ALICE, WITHDRAW_1, mult())); assert_bank_balance(GAS_AMOUNT - WITHDRAW_1, 0); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT - WITHDRAW_1)); + assert_alice_dec(gas_price(GAS_AMOUNT - WITHDRAW_1)); assert_gas_value(&ALICE, GAS_AMOUNT - WITHDRAW_1, 0); const WITHDRAW_2: u64 = GAS_AMOUNT - WITHDRAW_1 - 10_000; - assert_ok!(GearBank::withdraw_gas::(&ALICE, WITHDRAW_2)); + assert_ok!(GearBank::withdraw_gas(&ALICE, WITHDRAW_2, mult())); assert_bank_balance(GAS_AMOUNT - WITHDRAW_1 - WITHDRAW_2, 0); - assert_alice_dec(GasConverter::gas_price( - GAS_AMOUNT - WITHDRAW_1 - WITHDRAW_2, - )); + assert_alice_dec(gas_price(GAS_AMOUNT - WITHDRAW_1 - WITHDRAW_2)); assert_gas_value(&ALICE, GAS_AMOUNT - WITHDRAW_1 - WITHDRAW_2, 0); }) } @@ -207,9 +204,9 @@ fn withdraw_gas_single_user() { fn withdraw_gas_all_balance() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); - assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::withdraw_gas(&ALICE, GAS_AMOUNT, mult())); assert_bank_balance(0, 0); @@ -226,11 +223,11 @@ fn withdraw_gas_all_balance_user_account_deleted() { const BALANCE_DIFF: Balance = ALICE_BALANCE - ALICE_TO_DUST_BALANCE; const GAS_AMOUNT: u64 = (BALANCE_DIFF / VALUE_PER_GAS) as u64; - assert_eq!(GasConverter::gas_price(GAS_AMOUNT), BALANCE_DIFF); + assert_eq!(gas_price(GAS_AMOUNT), BALANCE_DIFF); assert!(BALANCE_DIFF > CurrencyOf::::minimum_balance()); - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); - assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::withdraw_gas(&ALICE, GAS_AMOUNT, mult())); assert_bank_balance(0, 0); @@ -244,11 +241,11 @@ fn withdraw_gas_small_amount() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = ((EXISTENTIAL_DEPOSIT - VALUE_PER_GAS) / VALUE_PER_GAS) as u64; - assert!(GasConverter::gas_price(GAS_AMOUNT) < CurrencyOf::::minimum_balance()); + assert!(gas_price(GAS_AMOUNT) < CurrencyOf::::minimum_balance()); - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); - assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::withdraw_gas(&ALICE, GAS_AMOUNT, mult())); assert_bank_balance(0, 0); @@ -264,9 +261,9 @@ fn withdraw_gas_small_amount_user_account_deleted() { assert!(GAS_VALUE_AMOUNT < CurrencyOf::::minimum_balance()); const GAS_AMOUNT: u64 = (GAS_VALUE_AMOUNT / VALUE_PER_GAS) as u64; - assert_eq!(GasConverter::gas_price(GAS_AMOUNT), GAS_VALUE_AMOUNT); + assert_eq!(gas_price(GAS_AMOUNT), GAS_VALUE_AMOUNT); - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert_ok!(Balances::transfer_all( RuntimeOrigin::signed(ALICE), @@ -274,7 +271,7 @@ fn withdraw_gas_small_amount_user_account_deleted() { false, )); - assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::withdraw_gas(&ALICE, GAS_AMOUNT, mult())); assert_eq!(GearBank::unused_value(), GAS_VALUE_AMOUNT); assert_balance(&BANK_ADDRESS, EXISTENTIAL_DEPOSIT + GAS_VALUE_AMOUNT); @@ -291,9 +288,9 @@ fn withdraw_gas_zero() { new_test_ext().execute_with(|| { let h = frame_support::storage_root(frame_support::StateVersion::V1); - assert_ok!(GearBank::withdraw_gas::(&ALICE, 0)); + assert_ok!(GearBank::withdraw_gas(&ALICE, 0, mult())); - assert_ok!(GearBank::withdraw_gas::(&Zero::zero(), 0)); + assert_ok!(GearBank::withdraw_gas(&Zero::zero(), 0, mult())); // No-op operation assertion. assert_eq!( @@ -310,7 +307,7 @@ fn withdraw_gas_insufficient_bank_balance() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert_ok!(Balances::transfer_all( RuntimeOrigin::signed(BANK_ADDRESS), @@ -319,7 +316,7 @@ fn withdraw_gas_insufficient_bank_balance() { )); assert_noop!( - GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT), + GearBank::withdraw_gas(&ALICE, GAS_AMOUNT, mult()), Error::::InsufficientBankBalance ); }) @@ -330,17 +327,17 @@ fn withdraw_gas_insufficient_gas_balance() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert_noop!( - GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT + 1), + GearBank::withdraw_gas(&ALICE, GAS_AMOUNT + 1, mult()), Error::::InsufficientGasBalance ); - assert_ok!(GearBank::deposit_gas::(&BOB, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&BOB, GAS_AMOUNT)); assert_noop!( - GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT + 1), + GearBank::withdraw_gas(&ALICE, GAS_AMOUNT + 1, mult()), Error::::InsufficientGasBalance ); }) @@ -350,26 +347,26 @@ fn withdraw_gas_insufficient_gas_balance() { fn withdraw_gas_insufficient_inexistent_gas_balance() { new_test_ext().execute_with(|| { assert_noop!( - GearBank::withdraw_gas::(&ALICE, 1), + GearBank::withdraw_gas(&ALICE, 1, mult()), Error::::InsufficientGasBalance ); assert_noop!( - GearBank::withdraw_gas::(&Zero::zero(), 1), + GearBank::withdraw_gas(&Zero::zero(), 1, mult()), Error::::InsufficientGasBalance ); const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&BOB, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&BOB, GAS_AMOUNT)); assert_noop!( - GearBank::withdraw_gas::(&ALICE, 1), + GearBank::withdraw_gas(&ALICE, 1, mult()), Error::::InsufficientGasBalance ); assert_noop!( - GearBank::withdraw_gas::(&Zero::zero(), 1), + GearBank::withdraw_gas(&Zero::zero(), 1, mult()), Error::::InsufficientGasBalance ); }) @@ -379,35 +376,35 @@ fn withdraw_gas_insufficient_inexistent_gas_balance() { fn spend_gas_different_users() { new_test_ext().execute_with(|| { const ALICE_GAS: u64 = 1_234_567; - assert_ok!(GearBank::deposit_gas::(&ALICE, ALICE_GAS)); + assert_ok!(GearBank::deposit_gas(&ALICE, ALICE_GAS)); const BOB_GAS: u64 = 56_789; - assert_ok!(GearBank::deposit_gas::(&BOB, BOB_GAS)); + assert_ok!(GearBank::deposit_gas(&BOB, BOB_GAS)); const ALICE_BURN: u64 = ALICE_GAS - 123_456; - assert_ok!(GearBank::spend_gas::(&ALICE, ALICE_BURN)); + assert_ok!(GearBank::spend_gas(&ALICE, ALICE_BURN, mult())); assert_bank_balance(ALICE_GAS - ALICE_BURN + BOB_GAS, 0); - assert_block_author_inc(GasConverter::gas_price(ALICE_BURN)); + assert_block_author_inc(gas_price(ALICE_BURN)); - assert_alice_dec(GasConverter::gas_price(ALICE_GAS)); + assert_alice_dec(gas_price(ALICE_GAS)); assert_gas_value(&ALICE, ALICE_GAS - ALICE_BURN, 0); - assert_bob_dec(GasConverter::gas_price(BOB_GAS)); + assert_bob_dec(gas_price(BOB_GAS)); assert_gas_value(&BOB, BOB_GAS, 0); const BOB_BURN: u64 = BOB_GAS - 1_234; - assert_ok!(GearBank::spend_gas::(&BOB, BOB_BURN)); + assert_ok!(GearBank::spend_gas(&BOB, BOB_BURN, mult())); assert_bank_balance(ALICE_GAS - ALICE_BURN + BOB_GAS - BOB_BURN, 0); - assert_block_author_inc(GasConverter::gas_price(ALICE_BURN + BOB_BURN)); + assert_block_author_inc(gas_price(ALICE_BURN + BOB_BURN)); - assert_alice_dec(GasConverter::gas_price(ALICE_GAS)); + assert_alice_dec(gas_price(ALICE_GAS)); assert_gas_value(&ALICE, ALICE_GAS - ALICE_BURN, 0); - assert_bob_dec(GasConverter::gas_price(BOB_GAS)); + assert_bob_dec(gas_price(BOB_GAS)); assert_gas_value(&BOB, BOB_GAS - BOB_BURN, 0); }) } @@ -416,26 +413,26 @@ fn spend_gas_different_users() { fn spend_gas_single_user() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); const BURN_1: u64 = GAS_AMOUNT - 23_456; - assert_ok!(GearBank::spend_gas::(&ALICE, BURN_1)); + assert_ok!(GearBank::spend_gas(&ALICE, BURN_1, mult())); assert_bank_balance(GAS_AMOUNT - BURN_1, 0); - assert_block_author_inc(GasConverter::gas_price(BURN_1)); + assert_block_author_inc(gas_price(BURN_1)); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_alice_dec(gas_price(GAS_AMOUNT)); assert_gas_value(&ALICE, GAS_AMOUNT - BURN_1, 0); const BURN_2: u64 = GAS_AMOUNT - BURN_1 - 10_000; - assert_ok!(GearBank::spend_gas::(&ALICE, BURN_2)); + assert_ok!(GearBank::spend_gas(&ALICE, BURN_2, mult())); assert_bank_balance(GAS_AMOUNT - BURN_1 - BURN_2, 0); - assert_block_author_inc(GasConverter::gas_price(BURN_1 + BURN_2)); + assert_block_author_inc(gas_price(BURN_1 + BURN_2)); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_alice_dec(gas_price(GAS_AMOUNT)); assert_gas_value(&ALICE, GAS_AMOUNT - BURN_1 - BURN_2, 0); }) } @@ -444,15 +441,15 @@ fn spend_gas_single_user() { fn spend_gas_all_balance() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); - assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::spend_gas(&ALICE, GAS_AMOUNT, mult())); assert_bank_balance(0, 0); - assert_block_author_inc(GasConverter::gas_price(GAS_AMOUNT)); + assert_block_author_inc(gas_price(GAS_AMOUNT)); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_alice_dec(gas_price(GAS_AMOUNT)); assert_gas_value(&ALICE, 0, 0); }) } @@ -462,9 +459,9 @@ fn spend_gas_all_balance_validator_account_deleted() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert!(GasConverter::gas_price(GAS_AMOUNT) >= CurrencyOf::::minimum_balance()); + assert!(gas_price(GAS_AMOUNT) >= CurrencyOf::::minimum_balance()); - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert_ok!(Balances::transfer_all( RuntimeOrigin::signed(BLOCK_AUTHOR), @@ -472,13 +469,13 @@ fn spend_gas_all_balance_validator_account_deleted() { false, )); - assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::spend_gas(&ALICE, GAS_AMOUNT, mult())); assert_bank_balance(0, 0); - assert_balance(&BLOCK_AUTHOR, GasConverter::gas_price(GAS_AMOUNT)); + assert_balance(&BLOCK_AUTHOR, gas_price(GAS_AMOUNT)); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_alice_dec(gas_price(GAS_AMOUNT)); assert_gas_value(&ALICE, 0, 0); }) } @@ -488,17 +485,17 @@ fn spend_gas_small_amount() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = ((EXISTENTIAL_DEPOSIT - VALUE_PER_GAS) / VALUE_PER_GAS) as u64; - assert!(GasConverter::gas_price(GAS_AMOUNT) < CurrencyOf::::minimum_balance()); + assert!(gas_price(GAS_AMOUNT) < CurrencyOf::::minimum_balance()); - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); - assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::spend_gas(&ALICE, GAS_AMOUNT, mult())); assert_bank_balance(0, 0); - assert_block_author_inc(GasConverter::gas_price(GAS_AMOUNT)); + assert_block_author_inc(gas_price(GAS_AMOUNT)); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_alice_dec(gas_price(GAS_AMOUNT)); assert_gas_value(&ALICE, 0, 0); }) } @@ -510,9 +507,9 @@ fn spend_gas_small_amount_validator_account_deleted() { assert!(GAS_VALUE_AMOUNT < CurrencyOf::::minimum_balance()); const GAS_AMOUNT: u64 = (GAS_VALUE_AMOUNT / VALUE_PER_GAS) as u64; - assert_eq!(GasConverter::gas_price(GAS_AMOUNT), GAS_VALUE_AMOUNT); + assert_eq!(gas_price(GAS_AMOUNT), GAS_VALUE_AMOUNT); - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert_ok!(Balances::transfer_all( RuntimeOrigin::signed(BLOCK_AUTHOR), @@ -520,7 +517,7 @@ fn spend_gas_small_amount_validator_account_deleted() { false, )); - assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::spend_gas(&ALICE, GAS_AMOUNT, mult())); assert_eq!(GearBank::unused_value(), GAS_VALUE_AMOUNT); assert_balance(&BANK_ADDRESS, EXISTENTIAL_DEPOSIT + GAS_VALUE_AMOUNT); @@ -529,7 +526,7 @@ fn spend_gas_small_amount_validator_account_deleted() { assert_balance(&BLOCK_AUTHOR, 0); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_alice_dec(gas_price(GAS_AMOUNT)); assert_gas_value(&ALICE, 0, 0); }) } @@ -539,9 +536,9 @@ fn spend_gas_zero() { new_test_ext().execute_with(|| { let h = frame_support::storage_root(frame_support::StateVersion::V1); - assert_ok!(GearBank::spend_gas::(&ALICE, 0)); + assert_ok!(GearBank::spend_gas(&ALICE, 0, mult())); - assert_ok!(GearBank::spend_gas::(&Zero::zero(), 0)); + assert_ok!(GearBank::spend_gas(&Zero::zero(), 0, mult())); // No-op operation assertion. assert_eq!( @@ -558,7 +555,7 @@ fn spend_gas_insufficient_bank_balance() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert_ok!(Balances::transfer_all( RuntimeOrigin::signed(BANK_ADDRESS), @@ -569,7 +566,7 @@ fn spend_gas_insufficient_bank_balance() { assert_balance(&BANK_ADDRESS, 0); assert_noop!( - GearBank::spend_gas::(&ALICE, GAS_AMOUNT), + GearBank::spend_gas(&ALICE, GAS_AMOUNT, mult()), Error::::InsufficientBankBalance ); }) @@ -580,17 +577,17 @@ fn spend_gas_insufficient_gas_balance() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert_noop!( - GearBank::spend_gas::(&ALICE, GAS_AMOUNT + 1), + GearBank::spend_gas(&ALICE, GAS_AMOUNT + 1, mult()), Error::::InsufficientGasBalance ); - assert_ok!(GearBank::deposit_gas::(&BOB, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&BOB, GAS_AMOUNT)); assert_noop!( - GearBank::spend_gas::(&ALICE, GAS_AMOUNT + 1), + GearBank::spend_gas(&ALICE, GAS_AMOUNT + 1, mult()), Error::::InsufficientGasBalance ); }) @@ -600,25 +597,25 @@ fn spend_gas_insufficient_gas_balance() { fn spend_gas_insufficient_inexistent_gas_balance() { new_test_ext().execute_with(|| { assert_noop!( - GearBank::spend_gas::(&ALICE, 1), + GearBank::spend_gas(&ALICE, 1, mult()), Error::::InsufficientGasBalance ); assert_noop!( - GearBank::spend_gas::(&Zero::zero(), 1), + GearBank::spend_gas(&Zero::zero(), 1, mult()), Error::::InsufficientGasBalance ); const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&BOB, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&BOB, GAS_AMOUNT)); assert_noop!( - GearBank::spend_gas::(&ALICE, 1), + GearBank::spend_gas(&ALICE, 1, mult()), Error::::InsufficientGasBalance ); assert_noop!( - GearBank::spend_gas::(&Zero::zero(), 1), + GearBank::spend_gas(&Zero::zero(), 1, mult()), Error::::InsufficientGasBalance ); }) @@ -1312,16 +1309,16 @@ fn empty_accounts_deleted() { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert!(GearBank::account(ALICE).is_some()); - assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::withdraw_gas(&ALICE, GAS_AMOUNT, mult())); assert!(GearBank::account(ALICE).is_none()); - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert!(GearBank::account(ALICE).is_some()); - assert_ok!(GearBank::spend_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::spend_gas(&ALICE, GAS_AMOUNT, mult())); assert!(GearBank::account(ALICE).is_none()); const VALUE: Balance = 123_456_000; @@ -1351,13 +1348,13 @@ fn empty_zero_accounts_deleted() { new_test_ext().execute_with(|| { assert!(GearBank::account(::zero()).is_none()); - assert_ok!(GearBank::deposit_gas::(&Zero::zero(), 0)); + assert_ok!(GearBank::deposit_gas(&Zero::zero(), 0)); assert!(GearBank::account(::zero()).is_none()); - assert_ok!(GearBank::withdraw_gas::(&Zero::zero(), 0)); + assert_ok!(GearBank::withdraw_gas(&Zero::zero(), 0, mult())); assert!(GearBank::account(::zero()).is_none()); - assert_ok!(GearBank::spend_gas::(&Zero::zero(), 0)); + assert_ok!(GearBank::spend_gas(&Zero::zero(), 0, mult())); assert!(GearBank::account(::zero()).is_none()); assert_ok!(GearBank::deposit_value(&Zero::zero(), 0)); @@ -1378,12 +1375,12 @@ fn empty_zero_accounts_deleted() { fn empty_composite_accounts_deleted() { new_test_ext().execute_with(|| { const GAS_AMOUNT: u64 = 123_456; - assert_ok!(GearBank::deposit_gas::(&ALICE, GAS_AMOUNT)); + assert_ok!(GearBank::deposit_gas(&ALICE, GAS_AMOUNT)); assert_bank_balance(GAS_AMOUNT, 0); assert!(GearBank::account(ALICE).is_some()); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_alice_dec(gas_price(GAS_AMOUNT)); assert_gas_value(&ALICE, GAS_AMOUNT, 0); const VALUE: Balance = 234_567_000; @@ -1392,17 +1389,17 @@ fn empty_composite_accounts_deleted() { assert_bank_balance(GAS_AMOUNT, VALUE); assert!(GearBank::account(ALICE).is_some()); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT) + VALUE); + assert_alice_dec(gas_price(GAS_AMOUNT) + VALUE); assert_gas_value(&ALICE, GAS_AMOUNT, VALUE); const GAS_BURN: u64 = GAS_AMOUNT / 2; - assert_ok!(GearBank::spend_gas::(&ALICE, GAS_BURN)); + assert_ok!(GearBank::spend_gas(&ALICE, GAS_BURN, mult())); assert_bank_balance(GAS_AMOUNT - GAS_BURN, VALUE); assert!(GearBank::account(ALICE).is_some()); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT) + VALUE); + assert_alice_dec(gas_price(GAS_AMOUNT) + VALUE); assert_gas_value(&ALICE, GAS_AMOUNT - GAS_BURN, VALUE); assert_ok!(GearBank::withdraw_value(&ALICE, VALUE)); @@ -1410,15 +1407,19 @@ fn empty_composite_accounts_deleted() { assert_bank_balance(GAS_AMOUNT - GAS_BURN, 0); assert!(GearBank::account(ALICE).is_some()); - assert_alice_dec(GasConverter::gas_price(GAS_AMOUNT)); + assert_alice_dec(gas_price(GAS_AMOUNT)); assert_gas_value(&ALICE, GAS_AMOUNT - GAS_BURN, 0); - assert_ok!(GearBank::withdraw_gas::(&ALICE, GAS_AMOUNT - GAS_BURN)); + assert_ok!(GearBank::withdraw_gas( + &ALICE, + GAS_AMOUNT - GAS_BURN, + mult() + )); assert_bank_balance(0, 0); assert!(GearBank::account(ALICE).is_none()); - assert_alice_dec(GasConverter::gas_price(GAS_BURN)); + assert_alice_dec(gas_price(GAS_BURN)); assert_gas_value(&ALICE, 0, 0); }) } @@ -1426,16 +1427,6 @@ fn empty_composite_accounts_deleted() { mod utils { use super::*; - pub const VALUE_PER_GAS: u128 = 1_000; - - pub struct GasConverter; - impl common::GasPrice for GasConverter { - type Balance = Balance; - type GasToBalanceMultiplier = ConstU128; - } - - pub type GC = GasConverter; - // For some reason `assert_noop!` doesnt work for the pallet fns. impl PartialEq for Error { fn eq(&self, other: &Self) -> bool { @@ -1457,6 +1448,10 @@ mod utils { }) } + pub fn mult() -> GasMultiplier { + GasMultiplierOf::::get() + } + #[track_caller] pub fn assert_balance(account_id: &AccountId, value: Balance) { assert_eq!(Balances::total_balance(account_id), value); @@ -1465,7 +1460,7 @@ mod utils { #[track_caller] pub fn assert_bank_balance(gas: u64, value: Balance) { - let gas_value = GasConverter::gas_price(gas); + let gas_value = gas_price(gas); assert_balance( &BANK_ADDRESS, CurrencyOf::::minimum_balance() + GearBank::unused_value() + gas_value + value, @@ -1476,7 +1471,7 @@ mod utils { pub fn assert_gas_value(account_id: &AccountId, expected_gas: u64, expected_value: Balance) { let BankAccount { gas, value } = GearBank::account(account_id).unwrap_or_default(); - assert_eq!(gas, GasConverter::gas_price(expected_gas)); + assert_eq!(gas, gas_price(expected_gas)); assert_eq!(value, expected_value); } @@ -1509,4 +1504,8 @@ mod utils { pub fn assert_eve_inc(diff: Balance) { assert_balance(&EVE, EXISTENTIAL_DEPOSIT + diff) } + + pub fn gas_price(gas: u64) -> u128 { + ::GasMultiplier::get().gas_to_value(gas) + } } diff --git a/pallets/gear-debug/src/mock.rs b/pallets/gear-debug/src/mock.rs index 573ac4a31d8..4d2571d8ad5 100644 --- a/pallets/gear-debug/src/mock.rs +++ b/pallets/gear-debug/src/mock.rs @@ -27,7 +27,7 @@ use frame_support_test::TestRandomness; use frame_system::{self as system, limits::BlockWeights}; use pallet_gear::GasAllowanceOf; use primitive_types::H256; -use sp_core::{ConstBool, ConstU128}; +use sp_core::ConstBool; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, ConstU64, IdentityLookup}, @@ -125,12 +125,6 @@ impl pallet_timestamp::Config for Test { type WeightInfo = (); } -pub struct GasConverter; -impl common::GasPrice for GasConverter { - type Balance = Balance; - type GasToBalanceMultiplier = ConstU128<1_000>; -} - impl pallet_gear_program::Config for Test { type Scheduler = GearScheduler; type CurrentBlockNumber = (); @@ -142,17 +136,18 @@ parameter_types! { pub ResumeMinimalPeriod: BlockNumber = 100; pub ResumeSessionDuration: BlockNumber = 1_000; pub const BankAddress: AccountId = 15082001; + pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(25); } impl pallet_gear_bank::Config for Test { type Currency = Balances; type BankAddress = BankAddress; + type GasMultiplier = GasMultiplier; } impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type GasPrice = GasConverter; type WeightInfo = (); type OutgoingLimit = OutgoingLimit; type DebugInfo = super::Pallet; diff --git a/pallets/gear-scheduler/src/mock.rs b/pallets/gear-scheduler/src/mock.rs index b28e986a095..8ef9b7da76d 100644 --- a/pallets/gear-scheduler/src/mock.rs +++ b/pallets/gear-scheduler/src/mock.rs @@ -28,7 +28,7 @@ use frame_support::{ use frame_support_test::TestRandomness; use frame_system::{self as system, limits::BlockWeights}; use pallet_gear::GasAllowanceOf; -use sp_core::{ConstBool, ConstU128, H256}; +use sp_core::{ConstBool, H256}; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, @@ -113,12 +113,6 @@ impl system::Config for Test { type MaxConsumers = frame_support::traits::ConstU32<16>; } -pub struct GasConverter; -impl common::GasPrice for GasConverter { - type Balance = Balance; - type GasToBalanceMultiplier = ConstU128<1_000>; -} - impl pallet_gear_program::Config for Test { type Scheduler = GearScheduler; type CurrentBlockNumber = (); @@ -133,17 +127,18 @@ parameter_types! { pub ResumeMinimalPeriod: BlockNumber = 100; pub ResumeSessionDuration: BlockNumber = 1_000; pub const BankAddress: AccountId = 15082001; + pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(25); } impl pallet_gear_bank::Config for Test { type Currency = Balances; type BankAddress = BankAddress; + type GasMultiplier = GasMultiplier; } impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type GasPrice = GasConverter; type WeightInfo = (); type Schedule = GearSchedule; type OutgoingLimit = OutgoingLimit; diff --git a/pallets/gear-scheduler/src/tests.rs b/pallets/gear-scheduler/src/tests.rs index e592d00c163..d2ba06af84f 100644 --- a/pallets/gear-scheduler/src/tests.rs +++ b/pallets/gear-scheduler/src/tests.rs @@ -21,13 +21,12 @@ extern crate alloc; use crate::{mock::*, *}; -use common::{scheduler::*, storage::*, GasPrice as _, GasTree, LockId, LockableTree as _, Origin}; +use common::{scheduler::*, storage::*, GasTree, LockId, LockableTree as _, Origin}; use gear_core::{ids::*, message::*}; use gear_core_errors::ErrorReplyReason; use pallet_gear::{GasAllowanceOf, GasHandlerOf}; use sp_core::H256; -type GasPrice = ::GasPrice; type WaitlistOf = <::Messenger as Messenger>::Waitlist; type TaskPoolOf = <::Scheduler as Scheduler>::TaskPool; @@ -40,8 +39,12 @@ pub(crate) fn init_logger() { const DEFAULT_GAS: u64 = 1_000_000; +fn gas_price(gas: u64) -> u128 { + ::GasMultiplier::get().gas_to_value(gas) +} + fn wl_cost_for(amount_of_blocks: u64) -> u128 { - GasPrice::gas_price( as Scheduler>::CostsPerBlock::waitlist() * amount_of_blocks) + gas_price( as Scheduler>::CostsPerBlock::waitlist() * amount_of_blocks) } fn dispatch_from(src: impl Into) -> StoredDispatch { @@ -70,9 +73,11 @@ fn populate_wl_from( TaskPoolOf::::add(bn, ScheduledTask::RemoveFromWaitlist(pid, mid)) .expect("Failed to insert task"); WaitlistOf::::insert(dispatch, bn).expect("Failed to insert to waitlist"); - GearBank::deposit_gas::<::GasPrice>(&src, DEFAULT_GAS) - .expect("Cannot reserve gas"); - GasHandlerOf::::create(src, mid, DEFAULT_GAS).expect("Failed to create gas handler"); + GearBank::deposit_gas(&src, DEFAULT_GAS).expect("Cannot reserve gas"); + + let multiplier = ::GasMultiplier::get(); + GasHandlerOf::::create(src, multiplier, mid, DEFAULT_GAS) + .expect("Failed to create gas handler"); // Locking funds for holding. GasHandlerOf::::lock( mid, @@ -167,12 +172,9 @@ fn gear_handles_tasks() { assert_eq!(Balances::free_balance(BLOCK_AUTHOR), block_author_balance); assert_eq!( Balances::free_balance(USER_1), - user1_balance - GasPrice::gas_price(DEFAULT_GAS) - ); - assert_eq!( - GearBank::account_total(&USER_1), - GasPrice::gas_price(DEFAULT_GAS) + user1_balance - gas_price(DEFAULT_GAS) ); + assert_eq!(GearBank::account_total(&USER_1), gas_price(DEFAULT_GAS)); // Check if task and message exist before start of block `bn`. run_to_block(bn - 1, Some(u64::MAX)); @@ -190,12 +192,9 @@ fn gear_handles_tasks() { assert_eq!(Balances::free_balance(BLOCK_AUTHOR), block_author_balance); assert_eq!( Balances::free_balance(USER_1), - user1_balance - GasPrice::gas_price(DEFAULT_GAS) - ); - assert_eq!( - GearBank::account_total(&USER_1), - GasPrice::gas_price(DEFAULT_GAS) + user1_balance - gas_price(DEFAULT_GAS) ); + assert_eq!(GearBank::account_total(&USER_1), gas_price(DEFAULT_GAS)); // Check if task and message got processed in block `bn`. run_to_block(bn, Some(u64::MAX)); @@ -262,20 +261,14 @@ fn gear_handles_outdated_tasks() { assert_eq!(Balances::free_balance(BLOCK_AUTHOR), block_author_balance); assert_eq!( Balances::free_balance(USER_1), - user1_balance - GasPrice::gas_price(DEFAULT_GAS) - ); - assert_eq!( - GearBank::account_total(&USER_1), - GasPrice::gas_price(DEFAULT_GAS) + user1_balance - gas_price(DEFAULT_GAS) ); + assert_eq!(GearBank::account_total(&USER_1), gas_price(DEFAULT_GAS)); assert_eq!( Balances::free_balance(USER_2), - user2_balance - GasPrice::gas_price(DEFAULT_GAS) - ); - assert_eq!( - GearBank::account_total(&USER_2), - GasPrice::gas_price(DEFAULT_GAS) + user2_balance - gas_price(DEFAULT_GAS) ); + assert_eq!(GearBank::account_total(&USER_2), gas_price(DEFAULT_GAS)); // Check if tasks and messages exist before start of block `bn`. run_to_block(bn - 1, Some(u64::MAX)); @@ -294,20 +287,14 @@ fn gear_handles_outdated_tasks() { assert_eq!(Balances::free_balance(BLOCK_AUTHOR), block_author_balance); assert_eq!( Balances::free_balance(USER_1), - user1_balance - GasPrice::gas_price(DEFAULT_GAS) - ); - assert_eq!( - GearBank::account_total(&USER_1), - GasPrice::gas_price(DEFAULT_GAS) + user1_balance - gas_price(DEFAULT_GAS) ); + assert_eq!(GearBank::account_total(&USER_1), gas_price(DEFAULT_GAS)); assert_eq!( Balances::free_balance(USER_2), - user2_balance - GasPrice::gas_price(DEFAULT_GAS) - ); - assert_eq!( - GearBank::account_total(&USER_2), - GasPrice::gas_price(DEFAULT_GAS) + user2_balance - gas_price(DEFAULT_GAS) ); + assert_eq!(GearBank::account_total(&USER_2), gas_price(DEFAULT_GAS)); // Check if task and message got processed before start of block `bn`. // But due to the low gas allowance, we may process the only first task. diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 4a9a8085aaa..089b6ba2799 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -464,8 +464,9 @@ benchmarks! { let original_message_id = MessageId::from_origin(benchmarking::account::("message", 0, 100).into_origin()); let gas_limit = 50000; let value = 10000u32.into(); - GasHandlerOf::::create(program_id.clone(), original_message_id, gas_limit).expect("Failed to create gas handler"); - GearBank::::deposit_gas::(&program_id, gas_limit).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); + let multiplier = ::GasMultiplier::get(); + GasHandlerOf::::create(program_id.clone(), multiplier, original_message_id, gas_limit).expect("Failed to create gas handler"); + GearBank::::deposit_gas(&program_id, gas_limit).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); GearBank::::deposit_value(&program_id, value).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); MailboxOf::::insert(gear_core::message::StoredMessage::new( original_message_id, @@ -709,8 +710,9 @@ benchmarks! { let original_message_id = MessageId::from_origin(benchmarking::account::("message", 0, 100).into_origin()); let gas_limit = 50000; let value = (p % 2).into(); - GasHandlerOf::::create(program_id.clone(), original_message_id, gas_limit).expect("Failed to create gas handler"); - GearBank::::deposit_gas::(&program_id, gas_limit).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); + let multiplier = ::GasMultiplier::get(); + GasHandlerOf::::create(program_id.clone(), multiplier, original_message_id, gas_limit).expect("Failed to create gas handler"); + GearBank::::deposit_gas(&program_id, gas_limit).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); GearBank::::deposit_value(&program_id, value).unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); MailboxOf::::insert(gear_core::message::StoredMessage::new( original_message_id, diff --git a/pallets/gear/src/internal.rs b/pallets/gear/src/internal.rs index 3b8a04ee4cc..1f742082195 100644 --- a/pallets/gear/src/internal.rs +++ b/pallets/gear/src/internal.rs @@ -228,11 +228,11 @@ where .unwrap_or_else(|e| unreachable!("GasTree corrupted! {:?}", e)); // Querying external id. Fails in cases of `GasTree` invalidations. - let external = GasHandlerOf::::get_external(id) + let (external, multiplier, _) = GasHandlerOf::::get_origin_node(id) .unwrap_or_else(|e| unreachable!("GasTree corrupted! {:?}", e)); // Transferring reserved funds from external user to block author. - GearBank::::spend_gas::(&external, amount) + GearBank::::spend_gas(&external, amount, multiplier) .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); } @@ -247,7 +247,7 @@ where .unwrap_or_else(|e| unreachable!("GasTree corrupted! {:?}", e)); // Unreserving funds, if imbalance returned. - if let Some((imbalance, external)) = outcome { + if let Some((imbalance, multiplier, external)) = outcome { // Peeking numeric value from negative imbalance. let gas_left = imbalance.peek(); @@ -257,7 +257,7 @@ where "Consumed message {id}. Unreserving {gas_left} (gas) from {external:?}" ); - GearBank::::withdraw_gas::(&external, gas_left) + GearBank::::withdraw_gas(&external, gas_left, multiplier) .unwrap_or_else(|e| unreachable!("Gear bank error: {e:?}")); } } @@ -1044,8 +1044,9 @@ where amount: GasBalanceOf, is_reply: bool, ) { + let multiplier = ::GasMultiplier::get(); if !is_reply || !GasHandlerOf::::exists_and_deposit(key.clone()) { - GasHandlerOf::::create(origin, key, amount) + GasHandlerOf::::create(origin, multiplier, key, amount) .unwrap_or_else(|e| unreachable!("GasTree corrupted! {:?}", e)); } } diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 74718bf5bb3..e236c02de33 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -51,7 +51,7 @@ pub use weights::WeightInfo; use alloc::{format, string::String}; use common::{ self, event::*, gas_provider::GasNodeId, paused_program_storage::SessionId, scheduler::*, - storage::*, BlockLimiter, CodeMetadata, CodeStorage, GasPrice, GasProvider, GasTree, Origin, + storage::*, BlockLimiter, CodeMetadata, CodeStorage, GasProvider, GasTree, Origin, PausedProgramStorage, PaymentVoucher, Program, ProgramState, ProgramStorage, QueueRunner, }; use core::marker::PhantomData; @@ -189,9 +189,6 @@ pub mod pallet { /// The generator used to supply randomness to contracts through `seal_random` type Randomness: Randomness; - /// Gas to Currency converter - type GasPrice: GasPrice>; - /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; @@ -249,6 +246,7 @@ pub mod pallet { ExternalOrigin = Self::AccountId, NodeId = GasNodeId, Balance = u64, + Funds = BalanceOf, Error = DispatchError, >; @@ -622,7 +620,7 @@ pub mod pallet { // First we reserve enough funds on the account to pay for `gas_limit` // and to transfer declared value. - GearBank::::deposit_gas::(&who, gas_limit)?; + GearBank::::deposit_gas(&who, gas_limit)?; GearBank::::deposit_value(&who, value)?; let origin = who.clone().into_origin(); @@ -1207,7 +1205,7 @@ pub mod pallet { // First we reserve enough funds on the account to pay for `gas_limit` // and to transfer declared value. - GearBank::::deposit_gas::(&who, gas_limit)?; + GearBank::::deposit_gas(&who, gas_limit)?; GearBank::::deposit_value(&who, value)?; Ok(packet) @@ -1518,7 +1516,7 @@ pub mod pallet { // If no such voucher exists, the call is invalidated. let voucher_id = VoucherOf::::voucher_id(who.clone(), destination); - GearBank::::deposit_gas::(&voucher_id, gas_limit).map_err(|e| { + GearBank::::deposit_gas(&voucher_id, gas_limit).map_err(|e| { log::debug!( "Failed to redeem voucher for user {who:?} and program {destination:?}: {e:?}" ); @@ -1528,7 +1526,7 @@ pub mod pallet { voucher_id } else { // If voucher is not used, we reserve gas limit on the user's account. - GearBank::::deposit_gas::(&who, gas_limit)?; + GearBank::::deposit_gas(&who, gas_limit)?; who.clone() }; @@ -1642,7 +1640,7 @@ pub mod pallet { // If no such voucher exists, the call is invalidated. let voucher_id = VoucherOf::::voucher_id(origin.clone(), destination); - GearBank::::deposit_gas::(&voucher_id, gas_limit).map_err(|e| { + GearBank::::deposit_gas(&voucher_id, gas_limit).map_err(|e| { log::debug!( "Failed to redeem voucher for user {origin:?} and program {destination:?}: {e:?}" ); @@ -1652,7 +1650,7 @@ pub mod pallet { voucher_id } else { // If voucher is not used, we reserve gas limit on the user's account. - GearBank::::deposit_gas::(&origin, gas_limit)?; + GearBank::::deposit_gas(&origin, gas_limit)?; origin.clone() }; diff --git a/pallets/gear/src/mock.rs b/pallets/gear/src/mock.rs index 416861336c1..e4f29b149e2 100644 --- a/pallets/gear/src/mock.rs +++ b/pallets/gear/src/mock.rs @@ -28,7 +28,7 @@ use frame_support::{ }; use frame_support_test::TestRandomness; use frame_system::{self as system, limits::BlockWeights}; -use sp_core::{ConstU128, H256}; +use sp_core::H256; use sp_runtime::{ generic, traits::{BlakeTwo256, IdentityLookup}, @@ -141,12 +141,6 @@ impl system::Config for Test { type MaxConsumers = frame_support::traits::ConstU32<16>; } -pub struct GasConverter; -impl common::GasPrice for GasConverter { - type Balance = Balance; - type GasToBalanceMultiplier = ConstU128<1_000>; -} - impl pallet_gear_program::Config for Test { type Scheduler = GearScheduler; type CurrentBlockNumber = (); @@ -208,17 +202,18 @@ impl Drop for DynamicScheduleReset { parameter_types! { pub const BankAddress: AccountId = 15082001; + pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(25); } impl pallet_gear_bank::Config for Test { type Currency = Balances; type BankAddress = BankAddress; + type GasMultiplier = GasMultiplier; } impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type GasPrice = GasConverter; type WeightInfo = pallet_gear::weights::SubstrateWeight; type Schedule = DynamicSchedule; type OutgoingLimit = OutgoingLimit; diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index 841be8cd72b..a37fea57381 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -49,8 +49,9 @@ where let account = ::from_origin(source); let balance = CurrencyOf::::free_balance(&account); - let max_balance: BalanceOf = - T::GasPrice::gas_price(initial_gas) + value.unique_saturated_into(); + let max_balance: BalanceOf = ::GasMultiplier::get() + .gas_to_value(initial_gas) + + value.unique_saturated_into(); CurrencyOf::::deposit_creating(&account, max_balance.saturating_sub(balance)); let who = frame_support::dispatch::RawOrigin::Signed(account); diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 0e89b7591d1..ae861d0d365 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -51,8 +51,8 @@ use crate::{ TaskPoolOf, WaitlistOf, }; use common::{ - event::*, scheduler::*, storage::*, ActiveProgram, CodeStorage, GasPrice as _, GasTree, LockId, - LockableTree, Origin as _, PausedProgramStorage, ProgramStorage, ReservableTree, + event::*, scheduler::*, storage::*, ActiveProgram, CodeStorage, GasTree, LockId, LockableTree, + Origin as _, PausedProgramStorage, ProgramStorage, ReservableTree, }; use core_processor::{common::ActorExecutionErrorReplyReason, ActorPrepareMemoryError}; use frame_support::{ @@ -1340,7 +1340,7 @@ fn delayed_send_user_message_payment() { // Run blocks to make message get into dispatch stash. run_to_block(3, None); - let delay_holding_fee = GasPrice::gas_price( + let delay_holding_fee = gas_price( CostsPerBlockOf::::dispatch_stash().saturating_mul( delay .saturating_add(CostsPerBlockOf::::reserve_for()) @@ -1348,7 +1348,7 @@ fn delayed_send_user_message_payment() { ), ); - let reserve_for_fee = GasPrice::gas_price( + let reserve_for_fee = gas_price( CostsPerBlockOf::::dispatch_stash() .saturating_mul(CostsPerBlockOf::::reserve_for().saturated_into()), ); @@ -1441,7 +1441,7 @@ fn delayed_send_user_message_with_reservation() { // Run blocks to make message get into dispatch stash. run_to_block(3, None); - let delay_holding_fee = GasPrice::gas_price( + let delay_holding_fee = gas_price( CostsPerBlockOf::::dispatch_stash().saturating_mul( delay .saturating_add(CostsPerBlockOf::::reserve_for()) @@ -1449,12 +1449,12 @@ fn delayed_send_user_message_with_reservation() { ), ); - let reserve_for_fee = GasPrice::gas_price( + let reserve_for_fee = gas_price( CostsPerBlockOf::::dispatch_stash() .saturating_mul(CostsPerBlockOf::::reserve_for().saturated_into()), ); - let mailbox_gas_threshold = GasPrice::gas_price(::MailboxThreshold::get()); + let mailbox_gas_threshold = gas_price(::MailboxThreshold::get()); // At this point a `Cut` node has been created with `mailbox_threshold` as value and // `delay` + 1 locked for using dispatch stash storage. @@ -1549,7 +1549,7 @@ fn delayed_send_program_message_payment() { // Run blocks to make message get into dispatch stash. run_to_block(3, None); - let delay_holding_fee = GasPrice::gas_price( + let delay_holding_fee = gas_price( CostsPerBlockOf::::dispatch_stash().saturating_mul( delay .saturating_add(CostsPerBlockOf::::reserve_for()) @@ -1557,7 +1557,7 @@ fn delayed_send_program_message_payment() { ), ); - let reserve_for_fee = GasPrice::gas_price( + let reserve_for_fee = gas_price( CostsPerBlockOf::::dispatch_stash() .saturating_mul(CostsPerBlockOf::::reserve_for().saturated_into()), ); @@ -1652,7 +1652,7 @@ fn delayed_send_program_message_with_reservation() { // Run blocks to make message get into dispatch stash. run_to_block(3, None); - let delay_holding_fee = GasPrice::gas_price( + let delay_holding_fee = gas_price( CostsPerBlockOf::::dispatch_stash().saturating_mul( delay .saturating_add(CostsPerBlockOf::::reserve_for()) @@ -1660,7 +1660,7 @@ fn delayed_send_program_message_with_reservation() { ), ); - let reservation_holding_fee = GasPrice::gas_price( + let reservation_holding_fee = gas_price( 80u64 .saturating_add(CostsPerBlockOf::::reserve_for().unique_saturated_into()) .saturating_mul(CostsPerBlockOf::::reservation()), @@ -1676,13 +1676,13 @@ fn delayed_send_program_message_with_reservation() { // Check that correct amount locked for dispatch stash let gas_locked_in_gas_node = - GasPrice::gas_price(Gas::get_lock(delayed_id, LockId::DispatchStash).unwrap()); + gas_price(Gas::get_lock(delayed_id, LockId::DispatchStash).unwrap()); assert_eq!(gas_locked_in_gas_node, delay_holding_fee); // Gas should be reserved while message is being held in storage. assert_eq!( GearBank::::account_total(&USER_1), - GasPrice::gas_price(reservation_amount) + reservation_holding_fee + gas_price(reservation_amount) + reservation_holding_fee ); // Run blocks to release message. @@ -1763,7 +1763,7 @@ fn delayed_send_program_message_with_low_reservation() { // Run blocks to make message get into dispatch stash. run_to_block(3, None); - let delay_holding_fee = GasPrice::gas_price( + let delay_holding_fee = gas_price( CostsPerBlockOf::::dispatch_stash().saturating_mul( delay .saturating_add(CostsPerBlockOf::::reserve_for()) @@ -1771,7 +1771,7 @@ fn delayed_send_program_message_with_low_reservation() { ), ); - let reservation_holding_fee = GasPrice::gas_price( + let reservation_holding_fee = gas_price( 80u64 .saturating_add(CostsPerBlockOf::::reserve_for().unique_saturated_into()) .saturating_mul(CostsPerBlockOf::::reservation()), @@ -1787,13 +1787,13 @@ fn delayed_send_program_message_with_low_reservation() { // Check that correct amount locked for dispatch stash let gas_locked_in_gas_node = - GasPrice::gas_price(Gas::get_lock(delayed_id, LockId::DispatchStash).unwrap()); + gas_price(Gas::get_lock(delayed_id, LockId::DispatchStash).unwrap()); assert_eq!(gas_locked_in_gas_node, delay_holding_fee); // Gas should be reserved while message is being held in storage. assert_eq!( GearBank::::account_total(&USER_1), - GasPrice::gas_price(reservation_amount) + reservation_holding_fee + gas_price(reservation_amount) + reservation_holding_fee ); // Run blocks to release message. @@ -1895,7 +1895,7 @@ fn delayed_program_creation_no_code() { let delayed_block_amount: u64 = 1; - let delay_holding_fee = GasPrice::gas_price( + let delay_holding_fee = gas_price( delayed_block_amount.saturating_mul(CostsPerBlockOf::::dispatch_stash()), ); @@ -1903,7 +1903,7 @@ fn delayed_program_creation_no_code() { Balances::free_balance(USER_1), free_balance + reserved_balance - delay_holding_fee - - GasPrice::gas_price(DbWeightOf::::get().reads(1).ref_time()) + - gas_price(DbWeightOf::::get().reads(1).ref_time()) ); assert!(GearBank::::account_total(&USER_1).is_zero()); }) @@ -1917,14 +1917,10 @@ fn unstoppable_block_execution_works() { new_test_ext().execute_with(|| { let user_balance = Balances::free_balance(USER_1); - let user_gas = Balances::free_balance(USER_1) as u64 / 1_000; // This manipulations are required due to we have only gas to value conversion. - assert_eq!(GasPrice::gas_price(user_gas), user_balance); - let executions_amount = 100; - let gas_for_each_execution = user_gas / executions_amount; - - assert!(gas_for_each_execution < BlockGasLimitOf::::get()); + let executions_amount = 100_u64; + let gas_for_each_execution = BlockGasLimitOf::::get(); let program_id = { let res = upload_program_default(USER_2, ProgramCodeKind::Default); @@ -1974,7 +1970,7 @@ fn unstoppable_block_execution_works() { assert_eq!( Balances::free_balance(USER_1), - GasPrice::gas_price(user_gas - real_gas_to_burn) + user_balance - gas_price(real_gas_to_burn) ); }) } @@ -2302,8 +2298,8 @@ fn mailbox_rent_out_of_rent() { utils::assert_balance( USER_1, - user_1_balance - GasPrice::gas_price(gas_info.min_limit + data.extra_gas), - GasPrice::gas_price(gas_info.min_limit + data.extra_gas), + user_1_balance - gas_price(gas_info.min_limit + data.extra_gas), + gas_price(gas_info.min_limit + data.extra_gas), ); utils::assert_balance(USER_2, user_2_balance, 0u128); utils::assert_balance(sender, prog_balance, 0u128); @@ -2322,8 +2318,8 @@ fn mailbox_rent_out_of_rent() { utils::assert_balance( USER_1, - user_1_balance - GasPrice::gas_price(gas_info.burned + data.gas_limit_to_send), - GasPrice::gas_price(data.gas_limit_to_send), + user_1_balance - gas_price(gas_info.burned + data.gas_limit_to_send), + gas_price(data.gas_limit_to_send), ); utils::assert_balance(USER_2, user_2_balance, 0u128); utils::assert_balance(sender, prog_balance - data.value, data.value); @@ -2336,7 +2332,7 @@ fn mailbox_rent_out_of_rent() { utils::assert_balance( USER_1, - user_1_balance - GasPrice::gas_price(gas_totally_burned), + user_1_balance - gas_price(gas_totally_burned), 0u128, ); utils::assert_balance(USER_2, user_2_balance + data.value, 0u128); @@ -2397,8 +2393,8 @@ fn mailbox_rent_claimed() { utils::assert_balance( USER_1, - user_1_balance - GasPrice::gas_price(gas_info.min_limit + data.extra_gas), - GasPrice::gas_price(gas_info.min_limit + data.extra_gas), + user_1_balance - gas_price(gas_info.min_limit + data.extra_gas), + gas_price(gas_info.min_limit + data.extra_gas), ); utils::assert_balance(USER_2, user_2_balance, 0u128); utils::assert_balance(sender, prog_balance, 0u128); @@ -2410,8 +2406,8 @@ fn mailbox_rent_claimed() { utils::assert_balance( USER_1, - user_1_balance - GasPrice::gas_price(gas_info.burned + data.gas_limit_to_send), - GasPrice::gas_price(data.gas_limit_to_send), + user_1_balance - gas_price(gas_info.burned + data.gas_limit_to_send), + gas_price(data.gas_limit_to_send), ); utils::assert_balance(USER_2, user_2_balance, 0u128); utils::assert_balance(sender, prog_balance - data.value, data.value); @@ -2424,8 +2420,8 @@ fn mailbox_rent_claimed() { utils::assert_balance( USER_1, - user_1_balance - GasPrice::gas_price(gas_info.burned + data.gas_limit_to_send), - GasPrice::gas_price(data.gas_limit_to_send), + user_1_balance - gas_price(gas_info.burned + data.gas_limit_to_send), + gas_price(data.gas_limit_to_send), ); utils::assert_balance(USER_2, user_2_balance, 0u128); utils::assert_balance(sender, prog_balance - data.value, data.value); @@ -2435,7 +2431,7 @@ fn mailbox_rent_claimed() { utils::assert_balance( USER_1, - user_1_balance - GasPrice::gas_price(gas_info.burned + duration * mb_cost), + user_1_balance - gas_price(gas_info.burned + duration * mb_cost), 0u128, ); utils::assert_balance(USER_2, user_2_balance + data.value, 0u128); @@ -2505,9 +2501,8 @@ fn mailbox_sending_instant_transfer() { utils::assert_balance( USER_1, - user_1_balance - - GasPrice::gas_price(gas_info.burned + gas_limit.unwrap_or_default()), - GasPrice::gas_price(gas_info.burned + gas_limit.unwrap_or_default()), + user_1_balance - gas_price(gas_info.burned + gas_limit.unwrap_or_default()), + gas_price(gas_info.burned + gas_limit.unwrap_or_default()), ); utils::assert_balance(USER_2, user_2_balance, 0u128); utils::assert_balance(sender, prog_balance, 0u128); @@ -2515,11 +2510,7 @@ fn mailbox_sending_instant_transfer() { run_to_next_block(None); - utils::assert_balance( - USER_1, - user_1_balance - GasPrice::gas_price(gas_info.burned), - 0u128, - ); + utils::assert_balance(USER_1, user_1_balance - gas_price(gas_info.burned), 0u128); utils::assert_balance(USER_2, user_2_balance + value, 0u128); utils::assert_balance(sender, prog_balance - value, 0u128); assert!(MailboxOf::::is_empty(&USER_2)); @@ -2603,7 +2594,7 @@ fn send_message_works() { // Balances check // Gas spends on sending 2 default messages (submit program and send message to program) - let user1_potential_msgs_spends = GasPrice::gas_price(2 * DEFAULT_GAS_LIMIT); + let user1_potential_msgs_spends = gas_price(2 * DEFAULT_GAS_LIMIT); // User 1 has sent two messages assert_eq!( Balances::free_balance(USER_1), @@ -2890,7 +2881,7 @@ fn spent_gas_to_reward_block_author_works() { // The block author should be paid the amount of Currency equal to // the `gas_charge` incurred while processing the `InitProgram` message - let gas_spent = GasPrice::gas_price( + let gas_spent = gas_price( BlockGasLimitOf::::get() .saturating_sub(GasAllowanceOf::::get()) .saturating_sub(minimal_weight.ref_time()), @@ -2935,7 +2926,7 @@ fn unused_gas_released_back_works() { // Spends for submit program with default gas limit and sending default message with a huge gas limit let user1_potential_msgs_spends = - GasPrice::gas_price(DEFAULT_GAS_LIMIT + huge_send_message_gas_limit); + gas_price(DEFAULT_GAS_LIMIT + huge_send_message_gas_limit); assert_eq!( Balances::free_balance(USER_1), @@ -2948,7 +2939,7 @@ fn unused_gas_released_back_works() { run_to_block(2, None); - let user1_actual_msgs_spends = GasPrice::gas_price( + let user1_actual_msgs_spends = gas_price( BlockGasLimitOf::::get() .saturating_sub(GasAllowanceOf::::get()) .saturating_sub(minimal_weight.ref_time()), @@ -3433,9 +3424,7 @@ fn initial_pages_cheaper_than_allocated_pages() { run_to_next_block(None); assert_last_dequeued(1); - GasPrice::gas_price( - BlockGasLimitOf::::get().saturating_sub(GasAllowanceOf::::get()), - ) + gas_price(BlockGasLimitOf::::get().saturating_sub(GasAllowanceOf::::get())) }; let spent_for_initial_pages = gas_spent(wat_initial); @@ -3706,7 +3695,7 @@ fn mailbox_works() { assert_eq!( GearBank::::account_total(&USER_1), - GasPrice::gas_price(OUTGOING_WITH_VALUE_IN_HANDLE_VALUE_GAS) + gas_price(OUTGOING_WITH_VALUE_IN_HANDLE_VALUE_GAS) ); let (mailbox_message, _bn) = { @@ -4085,7 +4074,7 @@ fn send_reply_value_claiming_works() { assert_eq!( GearBank::::account_total(&USER_2), - GasPrice::gas_price(OUTGOING_WITH_VALUE_IN_HANDLE_VALUE_GAS) + gas_price(OUTGOING_WITH_VALUE_IN_HANDLE_VALUE_GAS) ); // nothing changed @@ -4102,7 +4091,7 @@ fn send_reply_value_claiming_works() { false, )); - let currently_sent = value_to_reply + GasPrice::gas_price(gas_limit_to_reply); + let currently_sent = value_to_reply + gas_price(gas_limit_to_reply); assert_eq!( Balances::free_balance(USER_1), @@ -4157,7 +4146,7 @@ fn claim_value_works() { ) .expect("calculate_gas_info failed"); - let gas_burned = GasPrice::gas_price(gas_burned - may_be_returned); + let gas_burned = gas_price(gas_burned - may_be_returned); run_to_block(bn_of_insertion + holding_duration, None); @@ -4174,7 +4163,7 @@ fn claim_value_works() { let expected_claimer_balance = claimer_balance + value_sent; assert_eq!(Balances::free_balance(USER_1), expected_claimer_balance); - let burned_for_hold = GasPrice::gas_price( + let burned_for_hold = gas_price( GasBalanceOf::::saturated_from(holding_duration) * CostsPerBlockOf::::mailbox(), ); @@ -4182,7 +4171,7 @@ fn claim_value_works() { // In `calculate_gas_info` program start to work with page data in storage, // so need to take in account gas, which spent for data loading. let charged_for_page_load = if cfg!(feature = "lazy-pages") { - GasPrice::gas_price( + gas_price( ::Schedule::get() .memory_weights .load_page_data @@ -5656,12 +5645,10 @@ fn terminated_locking_funds() { ); let gas_spent_in_wl = CostsPerBlockOf::::waitlist(); // Value, which will be returned to init message after wake. - let returned_from_wait_list = - ::GasPrice::gas_price(locked_gas_to_wl - gas_spent_in_wl); + let returned_from_wait_list = gas_price(locked_gas_to_wl - gas_spent_in_wl); // Value, which will be returned to `USER1` after init message processing complete. - let returned_from_system_reservation = - ::GasPrice::gas_price(system_reservation); + let returned_from_system_reservation = gas_price(system_reservation); // Additional gas for loading resources on next wake up. // Must be exactly equal to gas, which we must pre-charge for program execution. @@ -5768,7 +5755,7 @@ fn terminated_locking_funds() { assert!(MailboxOf::::is_empty(&USER_3)); - let extra_gas_to_mb = ::GasPrice::gas_price( + let extra_gas_to_mb = gas_price( CostsPerBlockOf::::mailbox() * GasBalanceOf::::saturated_from(CostsPerBlockOf::::reserve_for()), ); @@ -7465,7 +7452,7 @@ fn no_redundant_gas_value_after_exiting() { // before execution let free_after_send = Balances::free_balance(USER_1); let reserved_after_send = GearBank::::account_total(&USER_1); - assert_eq!(reserved_after_send, GasPrice::gas_price(gas_spent)); + assert_eq!(reserved_after_send, gas_price(gas_spent)); run_to_block(3, None); @@ -7479,7 +7466,7 @@ fn no_redundant_gas_value_after_exiting() { let free_after_execution = Balances::free_balance(USER_1); assert_eq!( free_after_execution, - free_after_send + (reserved_after_send - GasPrice::gas_price(gas_spent)) + free_after_send + (reserved_after_send - gas_price(gas_spent)) ); // reserved balance after execution is zero @@ -7753,7 +7740,7 @@ fn gas_spent_vs_balance() { assert_eq!( (initial_balance - balance_after_init), - GasPrice::gas_price(init_gas_spent) + gas_price(init_gas_spent) ); run_to_block(4, None); @@ -7773,7 +7760,7 @@ fn gas_spent_vs_balance() { assert_eq!( balance_after_init - balance_after_handle, - GasPrice::gas_price(handle_gas_spent) + gas_price(handle_gas_spent) ); }); } @@ -8723,8 +8710,8 @@ fn cascading_messages_with_value_do_not_overcharge() { false, )); - let gas_to_spend = GasPrice::gas_price(gas_to_spend); - let gas_reserved = GasPrice::gas_price(gas_reserved); + let gas_to_spend = gas_price(gas_to_spend); + let gas_reserved = gas_price(gas_reserved); let reserved_balance = gas_reserved + value; assert_balance( @@ -8774,8 +8761,8 @@ fn free_storage_hold_on_scheduler_overwhelm() { utils::assert_balance( USER_1, - user_1_balance - GasPrice::gas_price(gas_info.min_limit + data.extra_gas), - GasPrice::gas_price(gas_info.min_limit + data.extra_gas), + user_1_balance - gas_price(gas_info.min_limit + data.extra_gas), + gas_price(gas_info.min_limit + data.extra_gas), ); utils::assert_balance(USER_2, user_2_balance, 0u128); utils::assert_balance(sender, prog_balance, 0u128); @@ -8793,8 +8780,8 @@ fn free_storage_hold_on_scheduler_overwhelm() { utils::assert_balance( USER_1, - user_1_balance - GasPrice::gas_price(gas_info.burned + data.gas_limit_to_send), - GasPrice::gas_price(data.gas_limit_to_send), + user_1_balance - gas_price(gas_info.burned + data.gas_limit_to_send), + gas_price(data.gas_limit_to_send), ); utils::assert_balance(USER_2, user_2_balance, 0u128); utils::assert_balance(sender, prog_balance - data.value, data.value); @@ -8811,7 +8798,7 @@ fn free_storage_hold_on_scheduler_overwhelm() { // Block which already can't be paid. run_to_next_block(None); - let gas_totally_burned = GasPrice::gas_price(gas_info.burned + data.gas_limit_to_send); + let gas_totally_burned = gas_price(gas_info.burned + data.gas_limit_to_send); utils::assert_balance(USER_1, user_1_balance - gas_totally_burned, 0u128); utils::assert_balance(USER_2, user_2_balance, 0u128); @@ -9973,7 +9960,7 @@ fn missing_functions_are_not_executed() { // no execution is performed at all and hence user was not charged for program execution. assert_eq!( balance_before, - Balances::free_balance(USER_1) + GasPrice::gas_price(program_cost) + Balances::free_balance(USER_1) + gas_price(program_cost) ); // this value is actually a constant in the wat. @@ -10025,7 +10012,7 @@ fn missing_functions_are_not_executed() { assert_eq!( balance_before - reply_value + locked_value, - Balances::free_balance(USER_1) + GasPrice::gas_price(program_cost) + Balances::free_balance(USER_1) + gas_price(program_cost) ); }); } @@ -10994,7 +10981,7 @@ fn system_reservation_unreserve_works() { assert!(GasHandlerOf::::get_system_reserve(mid).is_err()); - let burned = GasPrice::gas_price(burned); + let burned = gas_price(burned); assert_eq!( Balances::free_balance(USER_1), user_initial_balance - burned @@ -11492,9 +11479,9 @@ fn gas_reservation_works() { let map = get_reservation_map(pid).unwrap(); assert_eq!(map.len(), 2); - let gas_reserved = GasPrice::gas_price(spent_gas); - let reservation_amount = GasPrice::gas_price(RESERVATION_AMOUNT); - let reservation_holding = 15 * GasPrice::gas_price(CostsPerBlockOf::::reservation()); + let gas_reserved = gas_price(spent_gas); + let reservation_amount = gas_price(RESERVATION_AMOUNT); + let reservation_holding = 15 * gas_price(CostsPerBlockOf::::reservation()); assert_eq!( Balances::free_balance(USER_1), @@ -13635,12 +13622,12 @@ fn send_gasless_message_works() { RuntimeOrigin::signed(USER_1), USER_2, program_id, - GasPrice::gas_price(DEFAULT_GAS_LIMIT), + gas_price(DEFAULT_GAS_LIMIT), )); // Balances check // USER_1 can spend up to 2 default messages worth of gas (submit program and issue voucher) - let user1_potential_msgs_spends = GasPrice::gas_price(2 * DEFAULT_GAS_LIMIT); + let user1_potential_msgs_spends = gas_price(2 * DEFAULT_GAS_LIMIT); assert_eq!( Balances::free_balance(USER_1), user1_initial_balance - user1_potential_msgs_spends @@ -13654,7 +13641,7 @@ fn send_gasless_message_works() { let voucher_id = GearVoucher::voucher_account_id(&USER_2, &program_id); assert_eq!( Balances::free_balance(voucher_id), - GasPrice::gas_price(DEFAULT_GAS_LIMIT) + gas_price(DEFAULT_GAS_LIMIT) ); // Test 2: USER_2 sends a gasless message to the program (intending to use a voucher). @@ -13690,7 +13677,7 @@ fn send_gasless_message_works() { // Check that the gas leftover has been returned to the voucher assert_eq!( Balances::free_balance(voucher_id), - GasPrice::gas_price(DEFAULT_GAS_LIMIT) - GasPrice::gas_price(actual_gas_burned) + gas_price(DEFAULT_GAS_LIMIT) - gas_price(actual_gas_burned) ); // USER_2 total balance has been reduced by the value in the message @@ -13729,7 +13716,7 @@ fn send_gasless_reply_works() { RuntimeOrigin::signed(USER_2), USER_1, prog_id, - GasPrice::gas_price(DEFAULT_GAS_LIMIT), + gas_price(DEFAULT_GAS_LIMIT), )); let voucher_id = GearVoucher::voucher_account_id(&USER_1, &prog_id); @@ -13738,7 +13725,7 @@ fn send_gasless_reply_works() { // Balance check assert_eq!( Balances::free_balance(voucher_id), - GasPrice::gas_price(DEFAULT_GAS_LIMIT) + gas_price(DEFAULT_GAS_LIMIT) ); // USER_1 sends a gasless reply using a voucher @@ -13774,14 +13761,14 @@ fn send_gasless_reply_works() { // Balances check before processing queue assert_eq!( Balances::free_balance(voucher_id), - GasPrice::gas_price(DEFAULT_GAS_LIMIT.saturating_sub(gas_limit)) + gas_price(DEFAULT_GAS_LIMIT.saturating_sub(gas_limit)) ); run_to_block(4, None); // Ensure that some gas leftover has been returned to the voucher account assert!( Balances::free_balance(voucher_id) - > GasPrice::gas_price(DEFAULT_GAS_LIMIT.saturating_sub(gas_limit)) + > gas_price(DEFAULT_GAS_LIMIT.saturating_sub(gas_limit)) ); }) } @@ -14378,7 +14365,6 @@ mod utils { pub(super) type DispatchCustomResult = Result; pub(super) type AccountId = ::AccountId; - pub(super) type GasPrice = ::GasPrice; type BlockNumber = ::BlockNumber; @@ -15260,4 +15246,8 @@ mod utils { assert_eq!(mail_msg.payload_bytes(), true.encode()); }); } + + pub(super) fn gas_price(gas: u64) -> u128 { + ::GasMultiplier::get().gas_to_value(gas) + } } diff --git a/pallets/payment/src/mock.rs b/pallets/payment/src/mock.rs index 3cc35c361b9..a511c7c92bc 100644 --- a/pallets/payment/src/mock.rs +++ b/pallets/payment/src/mock.rs @@ -164,12 +164,6 @@ impl pallet_transaction_payment::Config for Test { type FeeMultiplierUpdate = pallet_gear_payment::GearFeeMultiplier; } -pub struct GasConverter; -impl common::GasPrice for GasConverter { - type Balance = Balance; - type GasToBalanceMultiplier = ConstU128<1_000>; -} - parameter_types! { pub const BlockGasLimit: u64 = 500_000; pub const OutgoingLimit: u32 = 1024; @@ -179,17 +173,18 @@ parameter_types! { pub ResumeMinimalPeriod: BlockNumber = 100; pub ResumeSessionDuration: BlockNumber = 1_000; pub const BankAddress: AccountId = 15082001; + pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(25); } impl pallet_gear_bank::Config for Test { type Currency = Balances; type BankAddress = BankAddress; + type GasMultiplier = GasMultiplier; } impl pallet_gear::Config for Test { type RuntimeEvent = RuntimeEvent; type Randomness = TestRandomness; - type GasPrice = GasConverter; type WeightInfo = (); type Schedule = GearSchedule; type OutgoingLimit = OutgoingLimit; diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 8620bd086fd..cc4d345231a 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -25,14 +25,14 @@ pub mod weights; use frame_support::{ pallet_prelude::DispatchClass, parameter_types, - traits::{ConstU128, Currency, OnUnbalanced}, + traits::{Currency, OnUnbalanced}, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight}, Weight, }, }; use frame_system::limits::BlockWeights; -use runtime_primitives::{AccountId, Balance, BlockNumber}; +use runtime_primitives::{AccountId, BlockNumber}; use sp_runtime::Perbill; /// We assume that ~3% of the block weight is consumed by `on_initialize` handlers. @@ -73,13 +73,7 @@ parameter_types! { pub const BlockHashCount: BlockNumber = 2400; } -pub const VALUE_PER_GAS: u128 = 1_000; - -pub struct GasConverter; -impl gear_common::GasPrice for GasConverter { - type Balance = Balance; - type GasToBalanceMultiplier = ConstU128; -} +pub const VALUE_PER_GAS: u128 = 25; pub type NegativeImbalance = as Currency< ::AccountId, diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 09487031cb0..2cc7472aab4 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -60,9 +60,8 @@ pub use runtime_common::{ RENT_DISABLED_DELTA_WEEK_FACTOR, RENT_FREE_PERIOD_MONTH_FACTOR, RENT_RESUME_WEEK_FACTOR, RESUME_SESSION_DURATION_HOUR_FACTOR, }, - impl_runtime_apis_plus_common, BlockHashCount, DealWithFees, GasConverter, - AVERAGE_ON_INITIALIZE_RATIO, GAS_LIMIT_MIN_PERCENTAGE_NUM, NORMAL_DISPATCH_RATIO, - VALUE_PER_GAS, + impl_runtime_apis_plus_common, BlockHashCount, DealWithFees, AVERAGE_ON_INITIALIZE_RATIO, + GAS_LIMIT_MIN_PERCENTAGE_NUM, NORMAL_DISPATCH_RATIO, VALUE_PER_GAS, }; pub use runtime_primitives::{AccountId, Signature}; use runtime_primitives::{Balance, BlockNumber, Hash, Index, Moment}; @@ -456,17 +455,18 @@ parameter_types! { parameter_types! { pub Schedule: pallet_gear::Schedule = Default::default(); pub BankAddress: AccountId = BANK_ADDRESS.into(); + pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(VALUE_PER_GAS); } impl pallet_gear_bank::Config for Runtime { type Currency = Balances; type BankAddress = BankAddress; + type GasMultiplier = GasMultiplier; } impl pallet_gear::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Randomness = pallet_babe::RandomnessFromOneEpochAgo; - type GasPrice = GasConverter; type WeightInfo = weights::pallet_gear::SubstrateWeight; type Schedule = Schedule; type OutgoingLimit = OutgoingLimit; diff --git a/runtime/gear/src/migrations.rs b/runtime/gear/src/migrations.rs index 248916f1fad..8749826d911 100644 --- a/runtime/gear/src/migrations.rs +++ b/runtime/gear/src/migrations.rs @@ -19,4 +19,4 @@ #[allow(unused)] use crate::*; -pub type Migrations = (); +pub type Migrations = (pallet_gear_gas::migrations::MigrateToV3,); diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 9a486108f41..305b3f35228 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -70,9 +70,8 @@ pub use runtime_common::{ RENT_DISABLED_DELTA_WEEK_FACTOR, RENT_FREE_PERIOD_MONTH_FACTOR, RENT_RESUME_WEEK_FACTOR, RESUME_SESSION_DURATION_HOUR_FACTOR, }, - impl_runtime_apis_plus_common, BlockHashCount, DealWithFees, GasConverter, - AVERAGE_ON_INITIALIZE_RATIO, GAS_LIMIT_MIN_PERCENTAGE_NUM, NORMAL_DISPATCH_RATIO, - VALUE_PER_GAS, + impl_runtime_apis_plus_common, BlockHashCount, DealWithFees, AVERAGE_ON_INITIALIZE_RATIO, + GAS_LIMIT_MIN_PERCENTAGE_NUM, NORMAL_DISPATCH_RATIO, VALUE_PER_GAS, }; pub use runtime_primitives::{AccountId, Signature}; use runtime_primitives::{Balance, BlockNumber, Hash, Index, Moment}; @@ -952,17 +951,18 @@ parameter_types! { parameter_types! { pub Schedule: pallet_gear::Schedule = Default::default(); pub BankAddress: AccountId = BANK_ADDRESS.into(); + pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(VALUE_PER_GAS); } impl pallet_gear_bank::Config for Runtime { type Currency = Balances; type BankAddress = BankAddress; + type GasMultiplier = GasMultiplier; } impl pallet_gear::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Randomness = pallet_babe::RandomnessFromOneEpochAgo; - type GasPrice = GasConverter; type WeightInfo = weights::pallet_gear::SubstrateWeight; type Schedule = Schedule; type OutgoingLimit = OutgoingLimit; diff --git a/runtime/vara/src/migrations.rs b/runtime/vara/src/migrations.rs index 248916f1fad..8749826d911 100644 --- a/runtime/vara/src/migrations.rs +++ b/runtime/vara/src/migrations.rs @@ -19,4 +19,4 @@ #[allow(unused)] use crate::*; -pub type Migrations = (); +pub type Migrations = (pallet_gear_gas::migrations::MigrateToV3,); diff --git a/utils/runtime-fuzzer/Cargo.toml b/utils/runtime-fuzzer/Cargo.toml index 1c160974b5f..0c145193e63 100644 --- a/utils/runtime-fuzzer/Cargo.toml +++ b/utils/runtime-fuzzer/Cargo.toml @@ -24,6 +24,7 @@ gear-core.workspace = true gear-utils.workspace = true gear-runtime = { workspace = true, features = ["std", "fuzz", "lazy-pages"] } pallet-gear.workspace = true +pallet-gear-bank.workspace = true frame-support.workspace = true frame-system.workspace = true diff --git a/utils/runtime-fuzzer/src/runtime/mod.rs b/utils/runtime-fuzzer/src/runtime/mod.rs index f14e5b7c301..36d212a2f5f 100644 --- a/utils/runtime-fuzzer/src/runtime/mod.rs +++ b/utils/runtime-fuzzer/src/runtime/mod.rs @@ -23,12 +23,11 @@ use frame_support::{ traits::{Currency, GenesisBuild}, }; use frame_system::GenesisConfig as SystemConfig; -use gear_common::GasPrice; use gear_runtime::{ AccountId, Balances, BankAddress, Runtime, RuntimeOrigin, SessionConfig, SessionKeys, }; use pallet_balances::{GenesisConfig as BalancesConfig, Pallet as BalancesPallet}; -use pallet_gear::Config as GearConfig; +use pallet_gear_bank::Config as GearBankConfig; use sp_io::TestExternalities; pub use account::{account, alice}; @@ -95,7 +94,8 @@ pub fn increase_to_max_balance(who: AccountId) -> DispatchResultWithPostInfo { BalancesPallet::::set_balance( RuntimeOrigin::root(), who.into(), - ::GasPrice::gas_price(account::acc_max_balance() as u64), + ::GasMultiplier::get() + .gas_to_value(account::acc_max_balance() as u64), new_reserved, ) } From 0af1c2a8f94ce952a7bb8ea50468735a5f470089 Mon Sep 17 00:00:00 2001 From: mqxf Date: Mon, 11 Sep 2023 14:05:33 +0200 Subject: [PATCH 130/165] refactor(core): Change Debug/Display implementation for Payload (#3227) --- core/src/buffer.rs | 87 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/core/src/buffer.rs b/core/src/buffer.rs index 0d4178d4cf7..e69ece89fb6 100644 --- a/core/src/buffer.rs +++ b/core/src/buffer.rs @@ -37,12 +37,46 @@ use scale_info::{ #[derive(Clone, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Decode, Encode, TypeInfo)] pub struct LimitedVec(Vec, PhantomData); +/// Formatter for [`LimitedVec`] will print to precision of 8 by default, to print the whole data, use `{:+}`. +impl Display for LimitedVec +where + [T]: AsRef<[u8]>, +{ + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + let len = self.0.len(); + let median = (len + 1) / 2; + + let mut e1 = median; + let mut s2 = median; + + if let Some(precision) = f.precision() { + if precision < median { + e1 = precision; + s2 = len - precision; + } + } else if !f.sign_plus() && median > 8 { + e1 = 8; + s2 = len - 8; + } + + let p1 = hex::encode(&self.0[..e1]); + let p2 = hex::encode(&self.0[s2..]); + let sep = e1.ne(&s2).then_some("..").unwrap_or_default(); + + if f.alternate() { + write!(f, "LimitedVec(0x{p1}{sep}{p2})") + } else { + write!(f, "0x{p1}{sep}{p2}") + } + } +} + impl Debug for LimitedVec where [T]: AsRef<[u8]>, { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - write!(f, "0x{}", hex::encode(self.inner())) + core::fmt::Display::fmt(self, f) } } @@ -170,6 +204,8 @@ mod test { const N: usize = 1000; type TestBuffer = LimitedVec; + const M: usize = 64; + type SmallTestBuffer = LimitedVec; #[test] fn test_try_from() { @@ -234,4 +270,53 @@ mod test { assert_eq!(&z.into_vec(), &[0, 2, 3, 42, 1, 2, 3]); assert_eq!(TestBuffer::max_len(), N); } + + #[test] + fn formatting_test() { + use alloc::format; + + let buffer = SmallTestBuffer::try_from(b"abcdefghijklmnopqrstuvwxyz012345".to_vec()) + .expect("String is 64 bytes"); + + // `Debug`/`Display`. + assert_eq!( + format!("{buffer:+?}"), + "0x6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435" + ); + // `Debug`/`Display` with default precision. + assert_eq!( + format!("{buffer:?}"), + "0x6162636465666768..797a303132333435" + ); + // `Debug`/`Display` with precision 0. + assert_eq!(format!("{buffer:.0?}"), "0x.."); + // `Debug`/`Display` with precision 1. + assert_eq!(format!("{buffer:.1?}"), "0x61..35"); + // `Debug`/`Display` with precision 2. + assert_eq!(format!("{buffer:.2?}"), "0x6162..3435"); + // `Debug`/`Display` with precision 4. + assert_eq!(format!("{buffer:.4?}"), "0x61626364..32333435"); + // `Debug`/`Display` with precision 15. + assert_eq!( + format!("{buffer:.15?}"), + "0x6162636465666768696a6b6c6d6e6f..72737475767778797a303132333435" + ); + // `Debug`/`Display` with precision 30. + assert_eq!( + format!("{buffer:.30?}"), + "0x6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435" + ); + // Alternate formatter with default precision. + assert_eq!( + format!("{buffer:#}"), + "LimitedVec(0x6162636465666768..797a303132333435)" + ); + // Alternate formatter with max precision. + assert_eq!( + format!("{buffer:+#}"), + "LimitedVec(0x6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435)" + ); + // Alternate formatter with precision 2. + assert_eq!(format!("{buffer:#.2}"), "LimitedVec(0x6162..3435)"); + } } From 0818456121b791e6148fefa68740827d389ffe84 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Mon, 11 Sep 2023 14:43:31 +0200 Subject: [PATCH 131/165] chore(runtime): Update weights (#3243) --- pallets/gear/src/weights.rs | 3010 ++++++++--------- runtime/gear/src/tests.rs | 12 +- runtime/gear/src/weights/frame_system.rs | 90 +- runtime/gear/src/weights/pallet_balances.rs | 62 +- runtime/gear/src/weights/pallet_gear.rs | 3010 ++++++++--------- .../gear/src/weights/pallet_gear_voucher.rs | 14 +- runtime/gear/src/weights/pallet_timestamp.rs | 30 +- runtime/gear/src/weights/pallet_utility.rs | 70 +- runtime/vara/src/tests.rs | 6 +- runtime/vara/src/weights/frame_system.rs | 86 +- runtime/vara/src/weights/pallet_airdrop.rs | 26 +- runtime/vara/src/weights/pallet_balances.rs | 58 +- runtime/vara/src/weights/pallet_gear.rs | 3006 ++++++++-------- .../vara/src/weights/pallet_gear_voucher.rs | 10 +- runtime/vara/src/weights/pallet_timestamp.rs | 26 +- runtime/vara/src/weights/pallet_utility.rs | 66 +- 16 files changed, 4779 insertions(+), 4803 deletions(-) diff --git a/pallets/gear/src/weights.rs b/pallets/gear/src/weights.rs index 07935956903..c52d1f58fac 100644 --- a/pallets/gear/src/weights.rs +++ b/pallets/gear/src/weights.rs @@ -19,13 +19,13 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/gear benchmark pallet --chain=gear-dev --steps=50 --repeat=20 --pallet=pallet_gear --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_gear.rs --template=.maintain/frame-weight-template.hbs +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_gear --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_gear.rs --template=.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -244,21 +244,21 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 951_000 picoseconds. - Weight::from_parts(1_020_000, 0) - // Standard Error: 722 - .saturating_add(Weight::from_parts(240_031, 0).saturating_mul(c.into())) + // Minimum execution time: 1_023_000 picoseconds. + Weight::from_parts(1_051_000, 0) + // Standard Error: 912 + .saturating_add(Weight::from_parts(213_761, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. fn db_read_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `42 + c * (1024 ±0)` - // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_762_000 picoseconds. - Weight::from_parts(2_859_000, 3506) - // Standard Error: 813 - .saturating_add(Weight::from_parts(665_139, 0).saturating_mul(c.into())) + // Measured: `146 + c * (1024 ±0)` + // Estimated: `3610 + c * (1024 ±0)` + // Minimum execution time: 3_252_000 picoseconds. + Weight::from_parts(3_416_000, 3610) + // Standard Error: 1_261 + .saturating_add(Weight::from_parts(689_572, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -267,35 +267,35 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 50_591_000 picoseconds. - Weight::from_parts(61_353_023, 0) - // Standard Error: 9_186 - .saturating_add(Weight::from_parts(2_404_810, 0).saturating_mul(c.into())) + // Minimum execution time: 59_805_000 picoseconds. + Weight::from_parts(86_729_126, 0) + // Standard Error: 7_023 + .saturating_add(Weight::from_parts(2_475_519, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: - // Measured: `979` - // Estimated: `42236` - // Minimum execution time: 81_660_000 picoseconds. - Weight::from_parts(83_840_000, 42236) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(10_u64)) + // Measured: `1372` + // Estimated: `51905` + // Minimum execution time: 107_694_000 picoseconds. + Weight::from_parts(110_328_000, 51905) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(12_u64)) } fn pay_program_rent() -> Weight { // Proof Size summary in bytes: - // Measured: `886` - // Estimated: `21261` - // Minimum execution time: 54_005_000 picoseconds. - Weight::from_parts(55_095_000, 21261) + // Measured: `992` + // Estimated: `21579` + // Minimum execution time: 55_980_000 picoseconds. + Weight::from_parts(56_766_000, 21579) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } fn resume_session_init() -> Weight { // Proof Size summary in bytes: - // Measured: `534` - // Estimated: `17070` - // Minimum execution time: 28_880_000 picoseconds. - Weight::from_parts(29_583_000, 17070) + // Measured: `638` + // Estimated: `17486` + // Minimum execution time: 29_973_000 picoseconds. + Weight::from_parts(31_008_000, 17486) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -304,22 +304,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_744_000 picoseconds. - Weight::from_parts(4_233_092, 7640) - // Standard Error: 39_690 - .saturating_add(Weight::from_parts(14_033_179, 0).saturating_mul(c.into())) + // Minimum execution time: 8_054_000 picoseconds. + Weight::from_parts(8_342_000, 7640) + // Standard Error: 17_771 + .saturating_add(Weight::from_parts(13_335_661, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1297 + c * (16389 ±0)` - // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 70_301_000 picoseconds. - Weight::from_parts(70_991_000, 40898) - // Standard Error: 177_223 - .saturating_add(Weight::from_parts(54_687_249, 0).saturating_mul(c.into())) + // Measured: `1593 + c * (16389 ±0)` + // Estimated: `43266 + c * (131112 ±0)` + // Minimum execution time: 72_178_000 picoseconds. + Weight::from_parts(73_341_000, 43266) + // Standard Error: 167_723 + .saturating_add(Weight::from_parts(54_442_045, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -328,97 +328,97 @@ impl WeightInfo for SubstrateWeight { /// The range of component `c` is `[0, 250]`. fn upload_code(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `10` - // Estimated: `4990` - // Minimum execution time: 61_715_000 picoseconds. - Weight::from_parts(40_384_385, 4990) - // Standard Error: 57_496 - .saturating_add(Weight::from_parts(53_210_788, 0).saturating_mul(c.into())) + // Measured: `113` + // Estimated: `5402` + // Minimum execution time: 78_662_000 picoseconds. + Weight::from_parts(42_066_175, 5402) + // Standard Error: 52_075 + .saturating_add(Weight::from_parts(60_249_549, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `671` - // Estimated: `38638` - // Minimum execution time: 63_077_000 picoseconds. - Weight::from_parts(96_840_506, 38638) - // Standard Error: 0 - .saturating_add(Weight::from_parts(2_609, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(10_u64)) + // Measured: `1111` + // Estimated: `50600` + // Minimum execution time: 94_321_000 picoseconds. + Weight::from_parts(129_113_540, 50600) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_625, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(12_u64)) } /// The range of component `c` is `[0, 250]`. /// The range of component `s` is `[0, 4194304]`. fn upload_program(c: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235` - // Estimated: `34312` - // Minimum execution time: 11_049_858_000 picoseconds. - Weight::from_parts(11_090_406_000, 34312) - // Standard Error: 517_330 - .saturating_add(Weight::from_parts(25_497_137, 0).saturating_mul(c.into())) - // Standard Error: 30 - .saturating_add(Weight::from_parts(910, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(14_u64)) + // Measured: `521` + // Estimated: `45152` + // Minimum execution time: 11_148_491_000 picoseconds. + Weight::from_parts(21_065_971, 45152) + // Standard Error: 173_883 + .saturating_add(Weight::from_parts(60_839_567, 0).saturating_mul(c.into())) + // Standard Error: 10 + .saturating_add(Weight::from_parts(2_652, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(16_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_message(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `348` - // Estimated: `23853` - // Minimum execution time: 56_305_000 picoseconds. - Weight::from_parts(38_705_997, 23853) + // Measured: `531` + // Estimated: `31266` + // Minimum execution time: 73_302_000 picoseconds. + Weight::from_parts(47_279_667, 31266) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_034, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(9_u64)) - .saturating_add(T::DbWeight::get().writes(8_u64)) + .saturating_add(Weight::from_parts(1_055, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `978` - // Estimated: `42227` - // Minimum execution time: 83_033_000 picoseconds. - Weight::from_parts(69_135_468, 42227) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(10_u64)) + // Measured: `1371` + // Estimated: `54435` + // Minimum execution time: 124_173_000 picoseconds. + Weight::from_parts(96_458_887, 54435) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_078, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(16_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `760` - // Estimated: `74319` - // Minimum execution time: 295_535_000 picoseconds. - Weight::from_parts(306_791_413, 74319) - // Standard Error: 1_111 - .saturating_add(Weight::from_parts(1_568, 0).saturating_mul(q.into())) - .saturating_add(T::DbWeight::get().reads(27_u64)) - .saturating_add(T::DbWeight::get().writes(22_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 365_983_000 picoseconds. + Weight::from_parts(387_416_952, 114612) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(26_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(_q: u32, ) -> Weight { + fn alloc_in_handle(q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `760` - // Estimated: `74319` - // Minimum execution time: 309_253_000 picoseconds. - Weight::from_parts(323_694_389, 74319) - .saturating_add(T::DbWeight::get().reads(27_u64)) - .saturating_add(T::DbWeight::get().writes(22_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 380_430_000 picoseconds. + Weight::from_parts(403_376_118, 114612) + // Standard Error: 2_451 + .saturating_add(Weight::from_parts(1_137, 0).saturating_mul(q.into())) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(26_u64)) } /// The range of component `c` is `[0, 512]`. fn reinstrument_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 44_806_000 picoseconds. - Weight::from_parts(45_498_000, 3899) - // Standard Error: 44_467 - .saturating_add(Weight::from_parts(54_603_581, 0).saturating_mul(c.into())) + // Minimum execution time: 58_080_000 picoseconds. + Weight::from_parts(58_601_000, 3899) + // Standard Error: 36_083 + .saturating_add(Weight::from_parts(58_395_643, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -428,630 +428,628 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_307_000 picoseconds. - Weight::from_parts(84_226_000, 0) - // Standard Error: 4_203_577 - .saturating_add(Weight::from_parts(574_493_471, 0).saturating_mul(r.into())) + // Minimum execution time: 91_412_000 picoseconds. + Weight::from_parts(94_168_000, 0) + // Standard Error: 3_806_298 + .saturating_add(Weight::from_parts(673_774_453, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 309_893_000 picoseconds. - Weight::from_parts(234_558_588, 0) - // Standard Error: 7_966 - .saturating_add(Weight::from_parts(32_022_587, 0).saturating_mul(p.into())) + // Minimum execution time: 452_549_000 picoseconds. + Weight::from_parts(398_963_700, 0) + // Standard Error: 7_042 + .saturating_add(Weight::from_parts(29_406_609, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 142_319_000 picoseconds. - Weight::from_parts(121_865_521, 0) - // Standard Error: 314_080 - .saturating_add(Weight::from_parts(64_422_856, 0).saturating_mul(r.into())) + // Minimum execution time: 207_052_000 picoseconds. + Weight::from_parts(209_606_478, 0) + // Standard Error: 255_281 + .saturating_add(Weight::from_parts(62_959_531, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_527_000 picoseconds. - Weight::from_parts(91_967_528, 0) - // Standard Error: 3_856 - .saturating_add(Weight::from_parts(2_363_669, 0).saturating_mul(r.into())) + // Minimum execution time: 97_729_000 picoseconds. + Weight::from_parts(105_964_750, 0) + // Standard Error: 4_847 + .saturating_add(Weight::from_parts(2_433_966, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 144_133_000 picoseconds. - Weight::from_parts(156_991_945, 0) - // Standard Error: 24_223 - .saturating_add(Weight::from_parts(2_431_525, 0).saturating_mul(r.into())) + // Minimum execution time: 175_010_000 picoseconds. + Weight::from_parts(229_153_209, 0) + // Standard Error: 17_116 + .saturating_add(Weight::from_parts(1_991_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_811_000 picoseconds. - Weight::from_parts(101_122_470, 0) - // Standard Error: 303_533 - .saturating_add(Weight::from_parts(92_415_204, 0).saturating_mul(r.into())) + // Minimum execution time: 94_696_000 picoseconds. + Weight::from_parts(119_674_535, 0) + // Standard Error: 387_178 + .saturating_add(Weight::from_parts(98_102_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_453_000 picoseconds. - Weight::from_parts(79_049_804, 0) - // Standard Error: 305_992 - .saturating_add(Weight::from_parts(79_382_630, 0).saturating_mul(r.into())) + // Minimum execution time: 95_794_000 picoseconds. + Weight::from_parts(89_931_979, 0) + // Standard Error: 371_349 + .saturating_add(Weight::from_parts(86_524_059, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_650_000 picoseconds. - Weight::from_parts(79_085_060, 0) - // Standard Error: 293_080 - .saturating_add(Weight::from_parts(77_346_019, 0).saturating_mul(r.into())) + // Minimum execution time: 97_924_000 picoseconds. + Weight::from_parts(84_041_201, 0) + // Standard Error: 327_841 + .saturating_add(Weight::from_parts(95_483_315, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_545_000 picoseconds. - Weight::from_parts(72_777_984, 0) - // Standard Error: 351_302 - .saturating_add(Weight::from_parts(80_634_984, 0).saturating_mul(r.into())) + // Minimum execution time: 97_122_000 picoseconds. + Weight::from_parts(86_789_268, 0) + // Standard Error: 353_259 + .saturating_add(Weight::from_parts(85_698_317, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_245_000 picoseconds. - Weight::from_parts(76_181_868, 0) - // Standard Error: 354_266 - .saturating_add(Weight::from_parts(79_459_120, 0).saturating_mul(r.into())) + // Minimum execution time: 94_821_000 picoseconds. + Weight::from_parts(92_694_130, 0) + // Standard Error: 340_146 + .saturating_add(Weight::from_parts(84_623_945, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_064_000 picoseconds. - Weight::from_parts(77_882_516, 0) - // Standard Error: 377_997 - .saturating_add(Weight::from_parts(78_533_852, 0).saturating_mul(r.into())) + // Minimum execution time: 93_840_000 picoseconds. + Weight::from_parts(87_888_572, 0) + // Standard Error: 369_465 + .saturating_add(Weight::from_parts(85_638_902, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_522_000 picoseconds. - Weight::from_parts(66_328_137, 0) - // Standard Error: 360_143 - .saturating_add(Weight::from_parts(79_838_604, 0).saturating_mul(r.into())) + // Minimum execution time: 98_597_000 picoseconds. + Weight::from_parts(86_642_386, 0) + // Standard Error: 362_257 + .saturating_add(Weight::from_parts(85_598_887, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_961_000 picoseconds. - Weight::from_parts(72_789_065, 0) - // Standard Error: 366_577 - .saturating_add(Weight::from_parts(79_031_060, 0).saturating_mul(r.into())) + // Minimum execution time: 94_546_000 picoseconds. + Weight::from_parts(91_466_289, 0) + // Standard Error: 344_423 + .saturating_add(Weight::from_parts(84_318_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_686_000 picoseconds. - Weight::from_parts(749_297_529, 0) - // Standard Error: 383_897 - .saturating_add(Weight::from_parts(132_242_102, 0).saturating_mul(r.into())) + // Minimum execution time: 578_036_000 picoseconds. + Weight::from_parts(696_140_951, 0) + // Standard Error: 559_498 + .saturating_add(Weight::from_parts(149_397_501, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 830_957_000 picoseconds. - Weight::from_parts(850_017_000, 0) - // Standard Error: 67_693 - .saturating_add(Weight::from_parts(13_570_326, 0).saturating_mul(n.into())) + // Minimum execution time: 723_788_000 picoseconds. + Weight::from_parts(740_225_000, 0) + // Standard Error: 52_895 + .saturating_add(Weight::from_parts(13_188_120, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_261_000 picoseconds. - Weight::from_parts(70_573_139, 0) - // Standard Error: 351_239 - .saturating_add(Weight::from_parts(80_441_776, 0).saturating_mul(r.into())) + // Minimum execution time: 99_012_000 picoseconds. + Weight::from_parts(88_269_135, 0) + // Standard Error: 296_136 + .saturating_add(Weight::from_parts(92_296_104, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_164_000 picoseconds. - Weight::from_parts(70_866_987, 0) - // Standard Error: 346_107 - .saturating_add(Weight::from_parts(82_471_591, 0).saturating_mul(r.into())) + // Minimum execution time: 93_803_000 picoseconds. + Weight::from_parts(87_097_769, 0) + // Standard Error: 367_325 + .saturating_add(Weight::from_parts(84_987_043, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_192_000 picoseconds. - Weight::from_parts(101_814_078, 0) - // Standard Error: 391_508 - .saturating_add(Weight::from_parts(166_873_282, 0).saturating_mul(n.into())) + // Minimum execution time: 96_663_000 picoseconds. + Weight::from_parts(105_357_427, 0) + // Standard Error: 366_135 + .saturating_add(Weight::from_parts(172_109_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_974_000 picoseconds. - Weight::from_parts(87_244_000, 0) - // Standard Error: 3_619_557 - .saturating_add(Weight::from_parts(749_950_767, 0).saturating_mul(r.into())) + // Minimum execution time: 99_210_000 picoseconds. + Weight::from_parts(102_217_000, 0) + // Standard Error: 4_527_119 + .saturating_add(Weight::from_parts(845_784_967, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_612_000 picoseconds. - Weight::from_parts(147_822_399, 0) - // Standard Error: 421_408 - .saturating_add(Weight::from_parts(250_730_230, 0).saturating_mul(r.into())) + // Minimum execution time: 96_579_000 picoseconds. + Weight::from_parts(162_452_429, 0) + // Standard Error: 416_836 + .saturating_add(Weight::from_parts(257_900_517, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 332_130_000 picoseconds. - Weight::from_parts(337_780_000, 0) - // Standard Error: 52_652 - .saturating_add(Weight::from_parts(20_743_155, 0).saturating_mul(n.into())) + // Minimum execution time: 353_526_000 picoseconds. + Weight::from_parts(358_025_000, 0) + // Standard Error: 61_984 + .saturating_add(Weight::from_parts(21_521_461, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_722_000 picoseconds. - Weight::from_parts(147_881_270, 0) - // Standard Error: 390_429 - .saturating_add(Weight::from_parts(259_701_373, 0).saturating_mul(r.into())) + // Minimum execution time: 94_822_000 picoseconds. + Weight::from_parts(168_431_611, 0) + // Standard Error: 378_696 + .saturating_add(Weight::from_parts(263_135_958, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 337_753_000 picoseconds. - Weight::from_parts(343_454_000, 0) - // Standard Error: 66_604 - .saturating_add(Weight::from_parts(21_189_034, 0).saturating_mul(n.into())) + // Minimum execution time: 351_828_000 picoseconds. + Weight::from_parts(355_382_000, 0) + // Standard Error: 60_589 + .saturating_add(Weight::from_parts(21_325_400, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 708_454_000 picoseconds. - Weight::from_parts(775_673_824, 0) - // Standard Error: 380_634 - .saturating_add(Weight::from_parts(268_253_890, 0).saturating_mul(r.into())) + // Minimum execution time: 569_384_000 picoseconds. + Weight::from_parts(638_474_730, 0) + // Standard Error: 425_903 + .saturating_add(Weight::from_parts(275_691_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_799_000 picoseconds. - Weight::from_parts(782_052_003, 0) - // Standard Error: 385_065 - .saturating_add(Weight::from_parts(265_280_556, 0).saturating_mul(r.into())) + // Minimum execution time: 573_053_000 picoseconds. + Weight::from_parts(640_078_802, 0) + // Standard Error: 475_389 + .saturating_add(Weight::from_parts(284_337_155, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_511_000 picoseconds. - Weight::from_parts(61_459_678, 0) - // Standard Error: 362_497 - .saturating_add(Weight::from_parts(87_903_947, 0).saturating_mul(r.into())) + // Minimum execution time: 98_223_000 picoseconds. + Weight::from_parts(85_732_985, 0) + // Standard Error: 336_308 + .saturating_add(Weight::from_parts(92_936_006, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_676_718_000 picoseconds. - Weight::from_parts(1_838_206_733, 0) - // Standard Error: 440_793 - .saturating_add(Weight::from_parts(156_352_100, 0).saturating_mul(r.into())) + // Minimum execution time: 1_822_621_000 picoseconds. + Weight::from_parts(1_951_955_018, 0) + // Standard Error: 339_415 + .saturating_add(Weight::from_parts(157_557_756, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 284_222_000 picoseconds. - Weight::from_parts(293_316_000, 0) - // Standard Error: 54_796 - .saturating_add(Weight::from_parts(30_939_288, 0).saturating_mul(n.into())) + // Minimum execution time: 314_296_000 picoseconds. + Weight::from_parts(317_522_000, 0) + // Standard Error: 61_360 + .saturating_add(Weight::from_parts(29_499_741, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_682_466_000 picoseconds. - Weight::from_parts(1_829_413_701, 0) - // Standard Error: 510_421 - .saturating_add(Weight::from_parts(216_009_232, 0).saturating_mul(r.into())) + // Minimum execution time: 1_835_106_000 picoseconds. + Weight::from_parts(1_948_516_646, 0) + // Standard Error: 382_008 + .saturating_add(Weight::from_parts(214_812_508, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_681_160_000 picoseconds. - Weight::from_parts(1_819_797_788, 0) - // Standard Error: 453_707 - .saturating_add(Weight::from_parts(215_589_534, 0).saturating_mul(r.into())) + // Minimum execution time: 1_827_496_000 picoseconds. + Weight::from_parts(1_949_190_773, 0) + // Standard Error: 340_175 + .saturating_add(Weight::from_parts(218_001_536, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 242_556_000 picoseconds. - Weight::from_parts(314_306_159, 0) - // Standard Error: 376_142 - .saturating_add(Weight::from_parts(260_614_468, 0).saturating_mul(r.into())) + // Minimum execution time: 264_306_000 picoseconds. + Weight::from_parts(363_536_651, 0) + // Standard Error: 467_914 + .saturating_add(Weight::from_parts(265_564_072, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 495_430_000 picoseconds. - Weight::from_parts(502_714_000, 0) - // Standard Error: 52_049 - .saturating_add(Weight::from_parts(21_259_132, 0).saturating_mul(n.into())) + // Minimum execution time: 523_150_000 picoseconds. + Weight::from_parts(535_842_000, 0) + // Standard Error: 65_412 + .saturating_add(Weight::from_parts(21_698_063, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_809_658_000 picoseconds. - Weight::from_parts(2_002_681_446, 0) - // Standard Error: 414_919 - .saturating_add(Weight::from_parts(227_942_929, 0).saturating_mul(r.into())) + // Minimum execution time: 1_974_743_000 picoseconds. + Weight::from_parts(2_096_494_995, 0) + // Standard Error: 474_778 + .saturating_add(Weight::from_parts(232_524_299, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_821_000 picoseconds. - Weight::from_parts(84_783_126, 0) - // Standard Error: 234_696 - .saturating_add(Weight::from_parts(22_124_873, 0).saturating_mul(r.into())) + // Minimum execution time: 94_139_000 picoseconds. + Weight::from_parts(101_775_569, 0) + // Standard Error: 452_439 + .saturating_add(Weight::from_parts(16_839_430, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_040_000 picoseconds. - Weight::from_parts(92_861_700, 0) - // Standard Error: 1_021 - .saturating_add(Weight::from_parts(419_414, 0).saturating_mul(n.into())) + // Minimum execution time: 112_050_000 picoseconds. + Weight::from_parts(102_205_366, 0) + // Standard Error: 1_008 + .saturating_add(Weight::from_parts(431_304, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_986_000 picoseconds. - Weight::from_parts(85_723_530, 0) - // Standard Error: 278_519 - .saturating_add(Weight::from_parts(19_484_469, 0).saturating_mul(r.into())) + // Minimum execution time: 93_528_000 picoseconds. + Weight::from_parts(99_748_422, 0) + // Standard Error: 396_992 + .saturating_add(Weight::from_parts(20_536_877, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_879_000 picoseconds. - Weight::from_parts(88_056_044, 0) - // Standard Error: 1_087 - .saturating_add(Weight::from_parts(427_201, 0).saturating_mul(n.into())) + // Minimum execution time: 117_832_000 picoseconds. + Weight::from_parts(104_552_847, 0) + // Standard Error: 1_402 + .saturating_add(Weight::from_parts(432_018, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_548_000 picoseconds. - Weight::from_parts(84_139_208, 0) - // Standard Error: 235_150 - .saturating_add(Weight::from_parts(17_533_491, 0).saturating_mul(r.into())) + // Minimum execution time: 93_325_000 picoseconds. + Weight::from_parts(101_074_097, 0) + // Standard Error: 454_790 + .saturating_add(Weight::from_parts(20_838_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_118_000 picoseconds. - Weight::from_parts(88_086_604, 0) - // Standard Error: 244_958 - .saturating_add(Weight::from_parts(17_286_195, 0).saturating_mul(r.into())) + // Minimum execution time: 93_800_000 picoseconds. + Weight::from_parts(102_249_326, 0) + // Standard Error: 463_488 + .saturating_add(Weight::from_parts(15_991_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_393_000 picoseconds. - Weight::from_parts(132_631_342, 0) - // Standard Error: 436_134 - .saturating_add(Weight::from_parts(141_520_417, 0).saturating_mul(r.into())) + // Minimum execution time: 93_153_000 picoseconds. + Weight::from_parts(121_452_989, 0) + // Standard Error: 390_540 + .saturating_add(Weight::from_parts(145_641_178, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_567_000 picoseconds. - Weight::from_parts(99_600_000, 0) - // Standard Error: 2_187 - .saturating_add(Weight::from_parts(639_729, 0).saturating_mul(n.into())) + // Minimum execution time: 115_529_000 picoseconds. + Weight::from_parts(120_413_000, 0) + // Standard Error: 3_105 + .saturating_add(Weight::from_parts(640_863, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 696_739_000 picoseconds. - Weight::from_parts(711_247_336, 0) - // Standard Error: 1_403_605 - .saturating_add(Weight::from_parts(15_869_663, 0).saturating_mul(r.into())) + // Minimum execution time: 566_859_000 picoseconds. + Weight::from_parts(631_111_316, 0) + // Standard Error: 7_012_228 + .saturating_add(Weight::from_parts(21_896_983, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. - fn gr_reply_input_wgas(r: u32, ) -> Weight { + fn gr_reply_input_wgas(_r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 697_432_000 picoseconds. - Weight::from_parts(712_096_565, 0) - // Standard Error: 1_674_352 - .saturating_add(Weight::from_parts(32_103_934, 0).saturating_mul(r.into())) + // Minimum execution time: 565_382_000 picoseconds. + Weight::from_parts(613_048_008, 0) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_685_000 picoseconds. - Weight::from_parts(96_156_389, 0) - // Standard Error: 262_969 - .saturating_add(Weight::from_parts(8_983_510, 0).saturating_mul(r.into())) + // Minimum execution time: 104_401_000 picoseconds. + Weight::from_parts(112_651_320, 0) + // Standard Error: 438_590 + .saturating_add(Weight::from_parts(11_095_379, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_746_000 picoseconds. - Weight::from_parts(89_918_273, 0) - // Standard Error: 1_055 - .saturating_add(Weight::from_parts(427_838, 0).saturating_mul(n.into())) + // Minimum execution time: 115_615_000 picoseconds. + Weight::from_parts(112_987_750, 0) + // Standard Error: 960 + .saturating_add(Weight::from_parts(423_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_634_000 picoseconds. - Weight::from_parts(99_574_926, 0) - // Standard Error: 267_301 - .saturating_add(Weight::from_parts(3_125_673, 0).saturating_mul(r.into())) + // Minimum execution time: 105_056_000 picoseconds. + Weight::from_parts(113_735_922, 0) + // Standard Error: 466_586 + .saturating_add(Weight::from_parts(5_305_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 99_268_000 picoseconds. - Weight::from_parts(93_140_981, 0) - // Standard Error: 1_101 - .saturating_add(Weight::from_parts(419_078, 0).saturating_mul(n.into())) + // Minimum execution time: 113_897_000 picoseconds. + Weight::from_parts(112_616_408, 0) + // Standard Error: 1_722 + .saturating_add(Weight::from_parts(428_420, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_167_000 picoseconds. - Weight::from_parts(80_305_860, 0) - // Standard Error: 357_986 - .saturating_add(Weight::from_parts(80_422_820, 0).saturating_mul(r.into())) + // Minimum execution time: 93_845_000 picoseconds. + Weight::from_parts(97_247_314, 0) + // Standard Error: 366_814 + .saturating_add(Weight::from_parts(85_900_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_137_000 picoseconds. - Weight::from_parts(76_881_656, 0) - // Standard Error: 302_504 - .saturating_add(Weight::from_parts(80_036_963, 0).saturating_mul(r.into())) + // Minimum execution time: 93_761_000 picoseconds. + Weight::from_parts(92_637_129, 0) + // Standard Error: 309_799 + .saturating_add(Weight::from_parts(85_725_727, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_922_000 picoseconds. - Weight::from_parts(767_820_244, 0) - // Standard Error: 418_647 - .saturating_add(Weight::from_parts(97_993_049, 0).saturating_mul(r.into())) + // Minimum execution time: 565_388_000 picoseconds. + Weight::from_parts(606_358_854, 0) + // Standard Error: 430_766 + .saturating_add(Weight::from_parts(108_769_267, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 724_683_000 picoseconds. - Weight::from_parts(732_157_836, 0) - // Standard Error: 618 - .saturating_add(Weight::from_parts(151_809, 0).saturating_mul(n.into())) + // Minimum execution time: 591_660_000 picoseconds. + Weight::from_parts(597_035_528, 0) + // Standard Error: 2_641 + .saturating_add(Weight::from_parts(153_781, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_304_055_000 picoseconds. - Weight::from_parts(2_435_844_780, 0) - // Standard Error: 420_214 - .saturating_add(Weight::from_parts(120_405_108, 0).saturating_mul(r.into())) + // Minimum execution time: 2_317_147_000 picoseconds. + Weight::from_parts(2_514_940_964, 0) + // Standard Error: 546_319 + .saturating_add(Weight::from_parts(128_825_542, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_431_524_000 picoseconds. - Weight::from_parts(2_669_711_936, 0) - // Standard Error: 12_819 - .saturating_add(Weight::from_parts(13_546_418, 0).saturating_mul(n.into())) + // Minimum execution time: 2_560_344_000 picoseconds. + Weight::from_parts(2_512_409_449, 0) + // Standard Error: 15_466 + .saturating_add(Weight::from_parts(12_395_144, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_238_000 picoseconds. - Weight::from_parts(104_905_012, 0) - // Standard Error: 392_000 - .saturating_add(Weight::from_parts(116_570_175, 0).saturating_mul(r.into())) + // Minimum execution time: 97_996_000 picoseconds. + Weight::from_parts(130_630_238, 0) + // Standard Error: 414_418 + .saturating_add(Weight::from_parts(114_735_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 143_132_000 picoseconds. - Weight::from_parts(145_448_000, 0) - // Standard Error: 51_056 - .saturating_add(Weight::from_parts(25_497_066, 0).saturating_mul(n.into())) + // Minimum execution time: 157_513_000 picoseconds. + Weight::from_parts(160_584_000, 0) + // Standard Error: 57_227 + .saturating_add(Weight::from_parts(25_738_939, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_055_000 picoseconds. - Weight::from_parts(75_514_507, 0) - // Standard Error: 342_511 - .saturating_add(Weight::from_parts(78_022_368, 0).saturating_mul(r.into())) + // Minimum execution time: 92_652_000 picoseconds. + Weight::from_parts(88_138_429, 0) + // Standard Error: 330_537 + .saturating_add(Weight::from_parts(83_235_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_725_000 picoseconds. - Weight::from_parts(87_574_873, 0) - // Standard Error: 249_331 - .saturating_add(Weight::from_parts(24_890_126, 0).saturating_mul(r.into())) + // Minimum execution time: 93_824_000 picoseconds. + Weight::from_parts(102_740_497, 0) + // Standard Error: 428_593 + .saturating_add(Weight::from_parts(23_682_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_761_000 picoseconds. - Weight::from_parts(86_511_404, 0) - // Standard Error: 240_746 - .saturating_add(Weight::from_parts(16_767_395, 0).saturating_mul(r.into())) + // Minimum execution time: 92_530_000 picoseconds. + Weight::from_parts(101_410_861, 0) + // Standard Error: 432_236 + .saturating_add(Weight::from_parts(12_196_938, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_794_000 picoseconds. - Weight::from_parts(88_401_167, 0) - // Standard Error: 217_438 - .saturating_add(Weight::from_parts(11_267_632, 0).saturating_mul(r.into())) + // Minimum execution time: 93_402_000 picoseconds. + Weight::from_parts(102_285_877, 0) + // Standard Error: 466_463 + .saturating_add(Weight::from_parts(13_156_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_664_000 picoseconds. - Weight::from_parts(89_193_048, 0) - // Standard Error: 336_699 - .saturating_add(Weight::from_parts(12_350_251, 0).saturating_mul(r.into())) + // Minimum execution time: 95_706_000 picoseconds. + Weight::from_parts(102_513_059, 0) + // Standard Error: 464_787 + .saturating_add(Weight::from_parts(13_986_540, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_815_000 picoseconds. - Weight::from_parts(87_397_869, 0) - // Standard Error: 235_037 - .saturating_add(Weight::from_parts(16_313_030, 0).saturating_mul(r.into())) + // Minimum execution time: 93_057_000 picoseconds. + Weight::from_parts(99_083_869, 0) + // Standard Error: 378_747 + .saturating_add(Weight::from_parts(12_230_330, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_190_000 picoseconds. - Weight::from_parts(186_267_428, 0) - // Standard Error: 346_204 - .saturating_add(Weight::from_parts(158_103_512, 0).saturating_mul(r.into())) + // Minimum execution time: 177_947_000 picoseconds. + Weight::from_parts(226_692_243, 0) + // Standard Error: 265_725 + .saturating_add(Weight::from_parts(156_938_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_748_000 picoseconds. - Weight::from_parts(148_556_306, 0) - // Standard Error: 400_680 - .saturating_add(Weight::from_parts(333_100_790, 0).saturating_mul(r.into())) + // Minimum execution time: 107_346_000 picoseconds. + Weight::from_parts(160_631_540, 0) + // Standard Error: 352_753 + .saturating_add(Weight::from_parts(338_685_448, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1059,22 +1057,22 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 44_452_286_000 picoseconds. - Weight::from_parts(44_568_744_000, 0) - // Standard Error: 268_880 - .saturating_add(Weight::from_parts(7_444_126, 0).saturating_mul(p.into())) - // Standard Error: 268_867 - .saturating_add(Weight::from_parts(179_724_917, 0).saturating_mul(s.into())) + // Minimum execution time: 44_754_074_000 picoseconds. + Weight::from_parts(44_833_050_000, 0) + // Standard Error: 269_308 + .saturating_add(Weight::from_parts(7_629_892, 0).saturating_mul(p.into())) + // Standard Error: 269_294 + .saturating_add(Weight::from_parts(179_148_245, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_042_000 picoseconds. - Weight::from_parts(163_443_462, 0) - // Standard Error: 381_777 - .saturating_add(Weight::from_parts(338_839_702, 0).saturating_mul(r.into())) + // Minimum execution time: 108_278_000 picoseconds. + Weight::from_parts(161_208_126, 0) + // Standard Error: 368_644 + .saturating_add(Weight::from_parts(346_324_329, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1082,32 +1080,32 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_724_116_000 picoseconds. - Weight::from_parts(42_849_968_000, 0) - // Standard Error: 263_445 - .saturating_add(Weight::from_parts(8_197_177, 0).saturating_mul(p.into())) - // Standard Error: 263_432 - .saturating_add(Weight::from_parts(180_050_572, 0).saturating_mul(s.into())) + // Minimum execution time: 44_266_209_000 picoseconds. + Weight::from_parts(44_559_345_000, 0) + // Standard Error: 270_420 + .saturating_add(Weight::from_parts(7_460_172, 0).saturating_mul(p.into())) + // Standard Error: 270_407 + .saturating_add(Weight::from_parts(179_211_260, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_607_000 picoseconds. - Weight::from_parts(100_957_693, 0) - // Standard Error: 29_067 - .saturating_add(Weight::from_parts(1_762_813, 0).saturating_mul(r.into())) + // Minimum execution time: 94_889_000 picoseconds. + Weight::from_parts(115_310_524, 0) + // Standard Error: 34_049 + .saturating_add(Weight::from_parts(1_916_607, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_305_000 picoseconds. - Weight::from_parts(108_825_748, 1131) - // Standard Error: 5_956 - .saturating_add(Weight::from_parts(11_809_647, 0).saturating_mul(p.into())) + // Minimum execution time: 97_825_000 picoseconds. + Weight::from_parts(251_440_245, 1131) + // Standard Error: 70_641 + .saturating_add(Weight::from_parts(15_652_952, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1116,10 +1114,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_531_000 picoseconds. - Weight::from_parts(88_749_000, 1131) - // Standard Error: 27_438 - .saturating_add(Weight::from_parts(35_435_114, 0).saturating_mul(p.into())) + // Minimum execution time: 96_761_000 picoseconds. + Weight::from_parts(100_398_000, 1131) + // Standard Error: 45_532 + .saturating_add(Weight::from_parts(39_790_625, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1128,10 +1126,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_087_078_000 picoseconds. - Weight::from_parts(5_882_681_000, 5069931) - // Standard Error: 87_545 - .saturating_add(Weight::from_parts(37_047_042, 0).saturating_mul(p.into())) + // Minimum execution time: 7_471_807_000 picoseconds. + Weight::from_parts(7_440_591_962, 5069931) + // Standard Error: 168_373 + .saturating_add(Weight::from_parts(40_244_359, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1139,10 +1137,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_432_000 picoseconds. - Weight::from_parts(87_001_000, 1939) - // Standard Error: 47_768 - .saturating_add(Weight::from_parts(47_598_234, 0).saturating_mul(p.into())) + // Minimum execution time: 97_303_000 picoseconds. + Weight::from_parts(98_185_000, 1939) + // Standard Error: 38_471 + .saturating_add(Weight::from_parts(55_016_921, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1151,10 +1149,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 92_594_000 picoseconds. - Weight::from_parts(93_795_036, 1131) - // Standard Error: 53_549 - .saturating_add(Weight::from_parts(35_797_869, 0).saturating_mul(p.into())) + // Minimum execution time: 102_497_000 picoseconds. + Weight::from_parts(104_932_685, 1131) + // Standard Error: 78_974 + .saturating_add(Weight::from_parts(39_257_150, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1163,10 +1161,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 769_397_000 picoseconds. - Weight::from_parts(792_321_925, 1496) - // Standard Error: 237_986 - .saturating_add(Weight::from_parts(48_847_504, 0).saturating_mul(p.into())) + // Minimum execution time: 612_308_000 picoseconds. + Weight::from_parts(642_079_999, 1496) + // Standard Error: 357_245 + .saturating_add(Weight::from_parts(46_518_860, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1175,10 +1173,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_113_735_000 picoseconds. - Weight::from_parts(1_148_020_828, 317931) - // Standard Error: 167_371 - .saturating_add(Weight::from_parts(47_795_831, 0).saturating_mul(p.into())) + // Minimum execution time: 1_068_248_000 picoseconds. + Weight::from_parts(1_080_741_205, 317931) + // Standard Error: 262_216 + .saturating_add(Weight::from_parts(50_047_907, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1186,885 +1184,883 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_154_000 picoseconds. - Weight::from_parts(4_280_364, 0) - // Standard Error: 8_638 - .saturating_add(Weight::from_parts(24_150_721, 0).saturating_mul(r.into())) + // Minimum execution time: 3_099_000 picoseconds. + Weight::from_parts(6_340_084, 0) + // Standard Error: 180_257 + .saturating_add(Weight::from_parts(74_666_091, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_339_689_000 picoseconds. - Weight::from_parts(4_202_598_633, 0) - // Standard Error: 74_721 - .saturating_add(Weight::from_parts(4_468_109, 0).saturating_mul(r.into())) + // Minimum execution time: 4_391_547_000 picoseconds. + Weight::from_parts(4_140_785_425, 0) + // Standard Error: 89_369 + .saturating_add(Weight::from_parts(5_769_622, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_343_068_000 picoseconds. - Weight::from_parts(4_226_706_212, 0) - // Standard Error: 60_538 - .saturating_add(Weight::from_parts(4_325_162, 0).saturating_mul(r.into())) + // Minimum execution time: 4_386_802_000 picoseconds. + Weight::from_parts(4_243_536_456, 0) + // Standard Error: 95_210 + .saturating_add(Weight::from_parts(5_278_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_409_473_000 picoseconds. - Weight::from_parts(11_882_222_938, 0) - // Standard Error: 194_167 - .saturating_add(Weight::from_parts(8_210_890, 0).saturating_mul(r.into())) + // Minimum execution time: 11_072_272_000 picoseconds. + Weight::from_parts(11_558_306_225, 0) + // Standard Error: 165_659 + .saturating_add(Weight::from_parts(9_828_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_212_512_000 picoseconds. - Weight::from_parts(10_628_957_808, 0) - // Standard Error: 170_508 - .saturating_add(Weight::from_parts(11_560_237, 0).saturating_mul(r.into())) + // Minimum execution time: 10_285_071_000 picoseconds. + Weight::from_parts(11_137_621_942, 0) + // Standard Error: 147_513 + .saturating_add(Weight::from_parts(9_014_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_229_000 picoseconds. - Weight::from_parts(2_319_000, 0) - // Standard Error: 9_576 - .saturating_add(Weight::from_parts(3_794_717, 0).saturating_mul(r.into())) + // Minimum execution time: 2_285_000 picoseconds. + Weight::from_parts(2_410_000, 0) + // Standard Error: 7_624 + .saturating_add(Weight::from_parts(3_864_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_265_000 picoseconds. - Weight::from_parts(2_353_000, 0) - // Standard Error: 5_018 - .saturating_add(Weight::from_parts(3_059_511, 0).saturating_mul(r.into())) + // Minimum execution time: 2_342_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 6_413 + .saturating_add(Weight::from_parts(3_120_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(3_531_925, 0) - // Standard Error: 1_167 - .saturating_add(Weight::from_parts(1_569_201, 0).saturating_mul(r.into())) + // Minimum execution time: 2_301_000 picoseconds. + Weight::from_parts(3_591_730, 0) + // Standard Error: 1_106 + .saturating_add(Weight::from_parts(1_565_415, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_359_000, 0) - // Standard Error: 9_672 - .saturating_add(Weight::from_parts(2_884_305, 0).saturating_mul(r.into())) + // Minimum execution time: 2_306_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 7_711 + .saturating_add(Weight::from_parts(2_932_880, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 8_373 - .saturating_add(Weight::from_parts(5_256_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_358_000 picoseconds. + Weight::from_parts(2_144_801, 0) + // Standard Error: 22_082 + .saturating_add(Weight::from_parts(5_266_139, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_012_000 picoseconds. - Weight::from_parts(4_938_253, 0) - // Standard Error: 2_214 - .saturating_add(Weight::from_parts(151_870, 0).saturating_mul(e.into())) + // Minimum execution time: 6_803_000 picoseconds. + Weight::from_parts(5_374_690, 0) + // Standard Error: 1_699 + .saturating_add(Weight::from_parts(171_193, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_309_000 picoseconds. - Weight::from_parts(4_232_448, 0) - // Standard Error: 6_359 - .saturating_add(Weight::from_parts(2_596_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_431_000 picoseconds. + Weight::from_parts(4_875_813, 0) + // Standard Error: 8_258 + .saturating_add(Weight::from_parts(2_629_733, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_596_672 - - 2_404_212, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_629_733 - + 2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(4_432_470, 0) - // Standard Error: 11_941 - .saturating_add(Weight::from_parts(2_404_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(5_140_243, 0) + // Standard Error: 13_164 + .saturating_add(Weight::from_parts(2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_776_000 picoseconds. - Weight::from_parts(12_954_286, 0) - // Standard Error: 30_568 - .saturating_add(Weight::from_parts(10_260_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_669_000 picoseconds. + Weight::from_parts(22_369_265, 0) + // Standard Error: 28_577 + .saturating_add(Weight::from_parts(9_740_558, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_935_000 picoseconds. - Weight::from_parts(1_635_475, 0) - // Standard Error: 7_669 - .saturating_add(Weight::from_parts(1_285_084, 0).saturating_mul(p.into())) + // Minimum execution time: 12_277_000 picoseconds. + Weight::from_parts(3_596_853, 0) + // Standard Error: 5_869 + .saturating_add(Weight::from_parts(1_258_605, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(l: u32, ) -> Weight { + fn instr_call_per_local(_l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_316_000 picoseconds. - Weight::from_parts(5_699_758, 0) - // Standard Error: 13 - .saturating_add(Weight::from_parts(34, 0).saturating_mul(l.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(5_778_137, 0) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_315_000 picoseconds. - Weight::from_parts(2_460_643, 0) - // Standard Error: 2_850 - .saturating_add(Weight::from_parts(235_587, 0).saturating_mul(r.into())) + // Minimum execution time: 4_835_000 picoseconds. + Weight::from_parts(6_065_483, 0) + // Standard Error: 3_006 + .saturating_add(Weight::from_parts(378_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 6_150 - .saturating_add(Weight::from_parts(730_523, 0).saturating_mul(r.into())) + // Minimum execution time: 4_722_000 picoseconds. + Weight::from_parts(3_902_309, 0) + // Standard Error: 5_742 + .saturating_add(Weight::from_parts(1_056_408, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_338_000, 0) - // Standard Error: 5_205 - .saturating_add(Weight::from_parts(679_669, 0).saturating_mul(r.into())) + // Minimum execution time: 4_888_000 picoseconds. + Weight::from_parts(4_512_058, 0) + // Standard Error: 6_410 + .saturating_add(Weight::from_parts(1_001_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_412_000 picoseconds. - Weight::from_parts(2_087_064, 0) - // Standard Error: 9_824 - .saturating_add(Weight::from_parts(743_737, 0).saturating_mul(r.into())) + // Minimum execution time: 6_413_000 picoseconds. + Weight::from_parts(2_704_134, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(804_200, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_388_000 picoseconds. - Weight::from_parts(6_512_000, 0) - // Standard Error: 7_958 - .saturating_add(Weight::from_parts(1_283_588, 0).saturating_mul(r.into())) + // Minimum execution time: 6_516_000 picoseconds. + Weight::from_parts(1_028_752, 0) + // Standard Error: 8_792 + .saturating_add(Weight::from_parts(1_494_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_885_000 picoseconds. - Weight::from_parts(4_075_795, 0) - // Standard Error: 12_241 - .saturating_add(Weight::from_parts(6_965_908, 0).saturating_mul(r.into())) + // Minimum execution time: 5_560_000 picoseconds. + Weight::from_parts(1_126_442, 0) + // Standard Error: 14_476 + .saturating_add(Weight::from_parts(7_240_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 5_936 - .saturating_add(Weight::from_parts(3_299_707, 0).saturating_mul(r.into())) + // Minimum execution time: 2_299_000 picoseconds. + Weight::from_parts(2_449_000, 0) + // Standard Error: 7_416 + .saturating_add(Weight::from_parts(3_344_387, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 6_255 - .saturating_add(Weight::from_parts(2_999_382, 0).saturating_mul(r.into())) + // Minimum execution time: 2_389_000 picoseconds. + Weight::from_parts(2_551_000, 0) + // Standard Error: 5_708 + .saturating_add(Weight::from_parts(3_133_430, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 6_896 - .saturating_add(Weight::from_parts(2_967_047, 0).saturating_mul(r.into())) + // Minimum execution time: 2_428_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 7_262 + .saturating_add(Weight::from_parts(3_192_675, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 4_893 - .saturating_add(Weight::from_parts(2_579_110, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(2_426_000, 0) + // Standard Error: 4_554 + .saturating_add(Weight::from_parts(2_683_293, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_304_000, 0) - // Standard Error: 3_852 - .saturating_add(Weight::from_parts(520_005, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 4_686 + .saturating_add(Weight::from_parts(631_609, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_274_000 picoseconds. - Weight::from_parts(1_794_591, 0) - // Standard Error: 3_416 - .saturating_add(Weight::from_parts(359_819, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(1_221_890, 0) + // Standard Error: 3_960 + .saturating_add(Weight::from_parts(452_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_287_000, 0) - // Standard Error: 10_307 - .saturating_add(Weight::from_parts(1_833_775, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_390_000, 0) + // Standard Error: 11_114 + .saturating_add(Weight::from_parts(1_916_122, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(2_349_000, 0) - // Standard Error: 9_393 - .saturating_add(Weight::from_parts(1_178_942, 0).saturating_mul(r.into())) + // Minimum execution time: 2_436_000 picoseconds. + Weight::from_parts(2_504_000, 0) + // Standard Error: 7_104 + .saturating_add(Weight::from_parts(1_156_958, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_256_508, 0) - // Standard Error: 3_133 - .saturating_add(Weight::from_parts(326_908, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(1_708_596, 0) + // Standard Error: 2_843 + .saturating_add(Weight::from_parts(377_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_298_000 picoseconds. - Weight::from_parts(1_792_383, 0) - // Standard Error: 2_981 - .saturating_add(Weight::from_parts(325_072, 0).saturating_mul(r.into())) + // Minimum execution time: 2_386_000 picoseconds. + Weight::from_parts(1_424_415, 0) + // Standard Error: 3_599 + .saturating_add(Weight::from_parts(395_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(236_190, 0) - // Standard Error: 5_791 - .saturating_add(Weight::from_parts(526_784, 0).saturating_mul(r.into())) + // Minimum execution time: 2_396_000 picoseconds. + Weight::from_parts(2_491_000, 0) + // Standard Error: 3_774 + .saturating_add(Weight::from_parts(516_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(18_346, 0) - // Standard Error: 5_882 - .saturating_add(Weight::from_parts(538_848, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(548_192, 0) + // Standard Error: 4_583 + .saturating_add(Weight::from_parts(556_734, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 4_502 - .saturating_add(Weight::from_parts(463_034, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(447_271, 0) + // Standard Error: 5_300 + .saturating_add(Weight::from_parts(535_915, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(2_193_450, 0) - // Standard Error: 3_655 - .saturating_add(Weight::from_parts(304_226, 0).saturating_mul(r.into())) + // Minimum execution time: 2_340_000 picoseconds. + Weight::from_parts(1_639_695, 0) + // Standard Error: 3_519 + .saturating_add(Weight::from_parts(368_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_803_358, 0) - // Standard Error: 2_256 - .saturating_add(Weight::from_parts(163_489, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_843_474, 0) + // Standard Error: 1_950 + .saturating_add(Weight::from_parts(176_592, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(3_087_274, 0) - // Standard Error: 1_907 - .saturating_add(Weight::from_parts(146_988, 0).saturating_mul(r.into())) + // Minimum execution time: 2_351_000 picoseconds. + Weight::from_parts(2_894_613, 0) + // Standard Error: 2_024 + .saturating_add(Weight::from_parts(188_853, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_335_000, 0) - // Standard Error: 9_220 - .saturating_add(Weight::from_parts(1_682_986, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_418_000, 0) + // Standard Error: 9_504 + .saturating_add(Weight::from_parts(1_936_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 7_751 - .saturating_add(Weight::from_parts(1_073_438, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_364_000, 0) + // Standard Error: 8_346 + .saturating_add(Weight::from_parts(1_222_521, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_297_000, 0) - // Standard Error: 9_887 - .saturating_add(Weight::from_parts(1_746_888, 0).saturating_mul(r.into())) + // Minimum execution time: 2_345_000 picoseconds. + Weight::from_parts(2_452_000, 0) + // Standard Error: 10_232 + .saturating_add(Weight::from_parts(1_883_867, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_305_000, 0) - // Standard Error: 8_241 - .saturating_add(Weight::from_parts(1_123_968, 0).saturating_mul(r.into())) + // Minimum execution time: 2_323_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 7_581 + .saturating_add(Weight::from_parts(1_200_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_325_000 picoseconds. - Weight::from_parts(2_368_000, 0) - // Standard Error: 10_199 - .saturating_add(Weight::from_parts(1_754_281, 0).saturating_mul(r.into())) + // Minimum execution time: 2_410_000 picoseconds. + Weight::from_parts(2_459_000, 0) + // Standard Error: 11_139 + .saturating_add(Weight::from_parts(1_877_766, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 7_885 - .saturating_add(Weight::from_parts(1_054_096, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 8_083 + .saturating_add(Weight::from_parts(1_217_904, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_244_000, 0) - // Standard Error: 11_272 - .saturating_add(Weight::from_parts(1_769_874, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(2_482_000, 0) + // Standard Error: 11_044 + .saturating_add(Weight::from_parts(1_956_302, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 8_360 - .saturating_add(Weight::from_parts(1_115_362, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 7_870 + .saturating_add(Weight::from_parts(1_213_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 9_424 - .saturating_add(Weight::from_parts(1_807_643, 0).saturating_mul(r.into())) + // Minimum execution time: 2_364_000 picoseconds. + Weight::from_parts(2_430_000, 0) + // Standard Error: 10_577 + .saturating_add(Weight::from_parts(1_968_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 7_499 - .saturating_add(Weight::from_parts(1_087_178, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_442_000, 0) + // Standard Error: 7_838 + .saturating_add(Weight::from_parts(1_267_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 11_743 - .saturating_add(Weight::from_parts(1_703_075, 0).saturating_mul(r.into())) + // Minimum execution time: 2_395_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 10_856 + .saturating_add(Weight::from_parts(1_910_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_254_000, 0) - // Standard Error: 8_099 - .saturating_add(Weight::from_parts(1_080_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_343_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 5_786 + .saturating_add(Weight::from_parts(1_128_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_183_000 picoseconds. - Weight::from_parts(2_301_000, 0) - // Standard Error: 10_230 - .saturating_add(Weight::from_parts(1_738_567, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 10_344 + .saturating_add(Weight::from_parts(1_897_480, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_209_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 8_536 - .saturating_add(Weight::from_parts(1_161_928, 0).saturating_mul(r.into())) + // Minimum execution time: 2_355_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 6_963 + .saturating_add(Weight::from_parts(1_125_698, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_208_000 picoseconds. - Weight::from_parts(2_255_000, 0) - // Standard Error: 10_368 - .saturating_add(Weight::from_parts(1_847_441, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_447_000, 0) + // Standard Error: 8_285 + .saturating_add(Weight::from_parts(1_848_149, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 8_213 - .saturating_add(Weight::from_parts(1_112_048, 0).saturating_mul(r.into())) + // Minimum execution time: 2_327_000 picoseconds. + Weight::from_parts(2_394_000, 0) + // Standard Error: 7_282 + .saturating_add(Weight::from_parts(1_176_423, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 12_684 - .saturating_add(Weight::from_parts(1_728_765, 0).saturating_mul(r.into())) + // Minimum execution time: 2_372_000 picoseconds. + Weight::from_parts(2_439_000, 0) + // Standard Error: 9_207 + .saturating_add(Weight::from_parts(1_837_009, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_573_000 picoseconds. - Weight::from_parts(2_655_000, 0) - // Standard Error: 7_404 - .saturating_add(Weight::from_parts(1_080_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_368_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_320 + .saturating_add(Weight::from_parts(1_231_088, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 9_739 - .saturating_add(Weight::from_parts(1_807_913, 0).saturating_mul(r.into())) + // Minimum execution time: 2_373_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 9_499 + .saturating_add(Weight::from_parts(1_922_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 7_265 - .saturating_add(Weight::from_parts(1_087_210, 0).saturating_mul(r.into())) + // Minimum execution time: 2_387_000 picoseconds. + Weight::from_parts(2_455_000, 0) + // Standard Error: 7_681 + .saturating_add(Weight::from_parts(1_198_894, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_311_000, 0) - // Standard Error: 7_444 - .saturating_add(Weight::from_parts(1_191_685, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 7_797 + .saturating_add(Weight::from_parts(1_286_566, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_263_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 5_023 - .saturating_add(Weight::from_parts(585_667, 0).saturating_mul(r.into())) + // Minimum execution time: 2_329_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 4_968 + .saturating_add(Weight::from_parts(645_254, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 10_018 - .saturating_add(Weight::from_parts(1_297_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(2_489_000, 0) + // Standard Error: 7_055 + .saturating_add(Weight::from_parts(1_232_084, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_291_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 4_776 - .saturating_add(Weight::from_parts(612_864, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 4_348 + .saturating_add(Weight::from_parts(633_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_286_000 picoseconds. - Weight::from_parts(2_356_000, 0) - // Standard Error: 11_619 - .saturating_add(Weight::from_parts(1_743_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_336_000 picoseconds. + Weight::from_parts(2_413_000, 0) + // Standard Error: 8_202 + .saturating_add(Weight::from_parts(1_777_425, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_302_000 picoseconds. - Weight::from_parts(2_343_000, 0) - // Standard Error: 8_638 - .saturating_add(Weight::from_parts(1_136_060, 0).saturating_mul(r.into())) + // Minimum execution time: 2_314_000 picoseconds. + Weight::from_parts(2_369_000, 0) + // Standard Error: 6_935 + .saturating_add(Weight::from_parts(1_201_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 7_114 - .saturating_add(Weight::from_parts(2_599_346, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(6_846_840, 0) + // Standard Error: 17_822 + .saturating_add(Weight::from_parts(2_268_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(3_823_403, 0) - // Standard Error: 18_912 - .saturating_add(Weight::from_parts(2_161_963, 0).saturating_mul(r.into())) + // Minimum execution time: 2_394_000 picoseconds. + Weight::from_parts(4_704_336, 0) + // Standard Error: 10_960 + .saturating_add(Weight::from_parts(2_182_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_199_000 picoseconds. - Weight::from_parts(2_817_173, 0) - // Standard Error: 17_341 - .saturating_add(Weight::from_parts(2_740_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_375_000 picoseconds. + Weight::from_parts(1_968_824, 0) + // Standard Error: 15_899 + .saturating_add(Weight::from_parts(2_762_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(88_235, 0) - // Standard Error: 10_326 - .saturating_add(Weight::from_parts(2_481_087, 0).saturating_mul(r.into())) + // Minimum execution time: 2_335_000 picoseconds. + Weight::from_parts(1_450_000, 0) + // Standard Error: 13_496 + .saturating_add(Weight::from_parts(2_401_407, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 14_480 - .saturating_add(Weight::from_parts(9_604_981, 0).saturating_mul(r.into())) + // Minimum execution time: 2_448_000 picoseconds. + Weight::from_parts(2_513_000, 0) + // Standard Error: 19_401 + .saturating_add(Weight::from_parts(9_309_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 21_926 - .saturating_add(Weight::from_parts(7_501_289, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(1_738_370, 0) + // Standard Error: 42_672 + .saturating_add(Weight::from_parts(7_512_557, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_309_000 picoseconds. - Weight::from_parts(10_308_173, 0) - // Standard Error: 30_680 - .saturating_add(Weight::from_parts(2_288_505, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_215_088, 0) + // Standard Error: 15_445 + .saturating_add(Weight::from_parts(2_956_278, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 5_007 - .saturating_add(Weight::from_parts(2_516_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(217_500, 0) + // Standard Error: 7_904 + .saturating_add(Weight::from_parts(2_576_151, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_228_000 picoseconds. - Weight::from_parts(2_300_000, 0) - // Standard Error: 8_948 - .saturating_add(Weight::from_parts(1_264_596, 0).saturating_mul(r.into())) + // Minimum execution time: 2_456_000 picoseconds. + Weight::from_parts(2_503_000, 0) + // Standard Error: 7_920 + .saturating_add(Weight::from_parts(1_321_543, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 5_099 - .saturating_add(Weight::from_parts(612_107, 0).saturating_mul(r.into())) + // Minimum execution time: 2_346_000 picoseconds. + Weight::from_parts(2_479_000, 0) + // Standard Error: 4_711 + .saturating_add(Weight::from_parts(689_892, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(2_326_000, 0) - // Standard Error: 10_004 - .saturating_add(Weight::from_parts(1_278_365, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_029 + .saturating_add(Weight::from_parts(1_256_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 5_578 - .saturating_add(Weight::from_parts(645_196, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_480_000, 0) + // Standard Error: 3_812 + .saturating_add(Weight::from_parts(607_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_338_000 picoseconds. - Weight::from_parts(2_363_000, 0) - // Standard Error: 8_554 - .saturating_add(Weight::from_parts(1_288_676, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 7_362 + .saturating_add(Weight::from_parts(1_248_739, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_332_000, 0) - // Standard Error: 3_999 - .saturating_add(Weight::from_parts(594_484, 0).saturating_mul(r.into())) + // Minimum execution time: 2_419_000 picoseconds. + Weight::from_parts(2_465_000, 0) + // Standard Error: 4_304 + .saturating_add(Weight::from_parts(604_813, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 7_437 - .saturating_add(Weight::from_parts(1_044_306, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 8_043 + .saturating_add(Weight::from_parts(1_073_194, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_308_000, 0) - // Standard Error: 4_658 - .saturating_add(Weight::from_parts(537_262, 0).saturating_mul(r.into())) + // Minimum execution time: 2_427_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 4_969 + .saturating_add(Weight::from_parts(594_802, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 10_254 - .saturating_add(Weight::from_parts(1_154_138, 0).saturating_mul(r.into())) + // Minimum execution time: 2_312_000 picoseconds. + Weight::from_parts(2_399_000, 0) + // Standard Error: 7_093 + .saturating_add(Weight::from_parts(1_110_114, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_234_000 picoseconds. - Weight::from_parts(2_313_000, 0) - // Standard Error: 4_960 - .saturating_add(Weight::from_parts(607_930, 0).saturating_mul(r.into())) + // Minimum execution time: 2_331_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 4_140 + .saturating_add(Weight::from_parts(600_354, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 7_909 - .saturating_add(Weight::from_parts(1_094_660, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_419_000, 0) + // Standard Error: 7_150 + .saturating_add(Weight::from_parts(1_154_649, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(39_069, 0) - // Standard Error: 6_710 - .saturating_add(Weight::from_parts(599_572, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_423_000, 0) + // Standard Error: 5_067 + .saturating_add(Weight::from_parts(594_487, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 8_785 - .saturating_add(Weight::from_parts(1_060_321, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_406_000, 0) + // Standard Error: 5_674 + .saturating_add(Weight::from_parts(1_051_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 4_191 - .saturating_add(Weight::from_parts(528_319, 0).saturating_mul(r.into())) + // Minimum execution time: 2_383_000 picoseconds. + Weight::from_parts(114_723, 0) + // Standard Error: 5_881 + .saturating_add(Weight::from_parts(646_798, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 9_328 - .saturating_add(Weight::from_parts(1_114_164, 0).saturating_mul(r.into())) + // Minimum execution time: 2_292_000 picoseconds. + Weight::from_parts(2_422_000, 0) + // Standard Error: 6_697 + .saturating_add(Weight::from_parts(1_053_580, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_210_000 picoseconds. - Weight::from_parts(390_951, 0) - // Standard Error: 5_316 - .saturating_add(Weight::from_parts(609_568, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(206_699, 0) + // Standard Error: 5_851 + .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } } @@ -2089,21 +2085,21 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 951_000 picoseconds. - Weight::from_parts(1_020_000, 0) - // Standard Error: 722 - .saturating_add(Weight::from_parts(240_031, 0).saturating_mul(c.into())) + // Minimum execution time: 1_023_000 picoseconds. + Weight::from_parts(1_051_000, 0) + // Standard Error: 912 + .saturating_add(Weight::from_parts(213_761, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. fn db_read_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `42 + c * (1024 ±0)` - // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_762_000 picoseconds. - Weight::from_parts(2_859_000, 3506) - // Standard Error: 813 - .saturating_add(Weight::from_parts(665_139, 0).saturating_mul(c.into())) + // Measured: `146 + c * (1024 ±0)` + // Estimated: `3610 + c * (1024 ±0)` + // Minimum execution time: 3_252_000 picoseconds. + Weight::from_parts(3_416_000, 3610) + // Standard Error: 1_261 + .saturating_add(Weight::from_parts(689_572, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2112,35 +2108,35 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 50_591_000 picoseconds. - Weight::from_parts(61_353_023, 0) - // Standard Error: 9_186 - .saturating_add(Weight::from_parts(2_404_810, 0).saturating_mul(c.into())) + // Minimum execution time: 59_805_000 picoseconds. + Weight::from_parts(86_729_126, 0) + // Standard Error: 7_023 + .saturating_add(Weight::from_parts(2_475_519, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: - // Measured: `979` - // Estimated: `42236` - // Minimum execution time: 81_660_000 picoseconds. - Weight::from_parts(83_840_000, 42236) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(10_u64)) + // Measured: `1372` + // Estimated: `51905` + // Minimum execution time: 107_694_000 picoseconds. + Weight::from_parts(110_328_000, 51905) + .saturating_add(RocksDbWeight::get().reads(15_u64)) + .saturating_add(RocksDbWeight::get().writes(12_u64)) } fn pay_program_rent() -> Weight { // Proof Size summary in bytes: - // Measured: `886` - // Estimated: `21261` - // Minimum execution time: 54_005_000 picoseconds. - Weight::from_parts(55_095_000, 21261) + // Measured: `992` + // Estimated: `21579` + // Minimum execution time: 55_980_000 picoseconds. + Weight::from_parts(56_766_000, 21579) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } fn resume_session_init() -> Weight { // Proof Size summary in bytes: - // Measured: `534` - // Estimated: `17070` - // Minimum execution time: 28_880_000 picoseconds. - Weight::from_parts(29_583_000, 17070) + // Measured: `638` + // Estimated: `17486` + // Minimum execution time: 29_973_000 picoseconds. + Weight::from_parts(31_008_000, 17486) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2149,22 +2145,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_744_000 picoseconds. - Weight::from_parts(4_233_092, 7640) - // Standard Error: 39_690 - .saturating_add(Weight::from_parts(14_033_179, 0).saturating_mul(c.into())) + // Minimum execution time: 8_054_000 picoseconds. + Weight::from_parts(8_342_000, 7640) + // Standard Error: 17_771 + .saturating_add(Weight::from_parts(13_335_661, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1297 + c * (16389 ±0)` - // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 70_301_000 picoseconds. - Weight::from_parts(70_991_000, 40898) - // Standard Error: 177_223 - .saturating_add(Weight::from_parts(54_687_249, 0).saturating_mul(c.into())) + // Measured: `1593 + c * (16389 ±0)` + // Estimated: `43266 + c * (131112 ±0)` + // Minimum execution time: 72_178_000 picoseconds. + Weight::from_parts(73_341_000, 43266) + // Standard Error: 167_723 + .saturating_add(Weight::from_parts(54_442_045, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2173,97 +2169,97 @@ impl WeightInfo for () { /// The range of component `c` is `[0, 250]`. fn upload_code(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `10` - // Estimated: `4990` - // Minimum execution time: 61_715_000 picoseconds. - Weight::from_parts(40_384_385, 4990) - // Standard Error: 57_496 - .saturating_add(Weight::from_parts(53_210_788, 0).saturating_mul(c.into())) + // Measured: `113` + // Estimated: `5402` + // Minimum execution time: 78_662_000 picoseconds. + Weight::from_parts(42_066_175, 5402) + // Standard Error: 52_075 + .saturating_add(Weight::from_parts(60_249_549, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `671` - // Estimated: `38638` - // Minimum execution time: 63_077_000 picoseconds. - Weight::from_parts(96_840_506, 38638) - // Standard Error: 0 - .saturating_add(Weight::from_parts(2_609, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(10_u64)) + // Measured: `1111` + // Estimated: `50600` + // Minimum execution time: 94_321_000 picoseconds. + Weight::from_parts(129_113_540, 50600) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_625, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(15_u64)) + .saturating_add(RocksDbWeight::get().writes(12_u64)) } /// The range of component `c` is `[0, 250]`. /// The range of component `s` is `[0, 4194304]`. fn upload_program(c: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235` - // Estimated: `34312` - // Minimum execution time: 11_049_858_000 picoseconds. - Weight::from_parts(11_090_406_000, 34312) - // Standard Error: 517_330 - .saturating_add(Weight::from_parts(25_497_137, 0).saturating_mul(c.into())) - // Standard Error: 30 - .saturating_add(Weight::from_parts(910, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(14_u64)) + // Measured: `521` + // Estimated: `45152` + // Minimum execution time: 11_148_491_000 picoseconds. + Weight::from_parts(21_065_971, 45152) + // Standard Error: 173_883 + .saturating_add(Weight::from_parts(60_839_567, 0).saturating_mul(c.into())) + // Standard Error: 10 + .saturating_add(Weight::from_parts(2_652, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(15_u64)) + .saturating_add(RocksDbWeight::get().writes(16_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_message(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `348` - // Estimated: `23853` - // Minimum execution time: 56_305_000 picoseconds. - Weight::from_parts(38_705_997, 23853) + // Measured: `531` + // Estimated: `31266` + // Minimum execution time: 73_302_000 picoseconds. + Weight::from_parts(47_279_667, 31266) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_034, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(9_u64)) - .saturating_add(RocksDbWeight::get().writes(8_u64)) + .saturating_add(Weight::from_parts(1_055, 0).saturating_mul(p.into())) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(10_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `978` - // Estimated: `42227` - // Minimum execution time: 83_033_000 picoseconds. - Weight::from_parts(69_135_468, 42227) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(10_u64)) + // Measured: `1371` + // Estimated: `54435` + // Minimum execution time: 124_173_000 picoseconds. + Weight::from_parts(96_458_887, 54435) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_078, 0).saturating_mul(p.into())) + .saturating_add(RocksDbWeight::get().reads(16_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `760` - // Estimated: `74319` - // Minimum execution time: 295_535_000 picoseconds. - Weight::from_parts(306_791_413, 74319) - // Standard Error: 1_111 - .saturating_add(Weight::from_parts(1_568, 0).saturating_mul(q.into())) - .saturating_add(RocksDbWeight::get().reads(27_u64)) - .saturating_add(RocksDbWeight::get().writes(22_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 365_983_000 picoseconds. + Weight::from_parts(387_416_952, 114612) + .saturating_add(RocksDbWeight::get().reads(33_u64)) + .saturating_add(RocksDbWeight::get().writes(26_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(_q: u32, ) -> Weight { + fn alloc_in_handle(q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `760` - // Estimated: `74319` - // Minimum execution time: 309_253_000 picoseconds. - Weight::from_parts(323_694_389, 74319) - .saturating_add(RocksDbWeight::get().reads(27_u64)) - .saturating_add(RocksDbWeight::get().writes(22_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 380_430_000 picoseconds. + Weight::from_parts(403_376_118, 114612) + // Standard Error: 2_451 + .saturating_add(Weight::from_parts(1_137, 0).saturating_mul(q.into())) + .saturating_add(RocksDbWeight::get().reads(33_u64)) + .saturating_add(RocksDbWeight::get().writes(26_u64)) } /// The range of component `c` is `[0, 512]`. fn reinstrument_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 44_806_000 picoseconds. - Weight::from_parts(45_498_000, 3899) - // Standard Error: 44_467 - .saturating_add(Weight::from_parts(54_603_581, 0).saturating_mul(c.into())) + // Minimum execution time: 58_080_000 picoseconds. + Weight::from_parts(58_601_000, 3899) + // Standard Error: 36_083 + .saturating_add(Weight::from_parts(58_395_643, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2273,630 +2269,628 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_307_000 picoseconds. - Weight::from_parts(84_226_000, 0) - // Standard Error: 4_203_577 - .saturating_add(Weight::from_parts(574_493_471, 0).saturating_mul(r.into())) + // Minimum execution time: 91_412_000 picoseconds. + Weight::from_parts(94_168_000, 0) + // Standard Error: 3_806_298 + .saturating_add(Weight::from_parts(673_774_453, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 309_893_000 picoseconds. - Weight::from_parts(234_558_588, 0) - // Standard Error: 7_966 - .saturating_add(Weight::from_parts(32_022_587, 0).saturating_mul(p.into())) + // Minimum execution time: 452_549_000 picoseconds. + Weight::from_parts(398_963_700, 0) + // Standard Error: 7_042 + .saturating_add(Weight::from_parts(29_406_609, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 142_319_000 picoseconds. - Weight::from_parts(121_865_521, 0) - // Standard Error: 314_080 - .saturating_add(Weight::from_parts(64_422_856, 0).saturating_mul(r.into())) + // Minimum execution time: 207_052_000 picoseconds. + Weight::from_parts(209_606_478, 0) + // Standard Error: 255_281 + .saturating_add(Weight::from_parts(62_959_531, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_527_000 picoseconds. - Weight::from_parts(91_967_528, 0) - // Standard Error: 3_856 - .saturating_add(Weight::from_parts(2_363_669, 0).saturating_mul(r.into())) + // Minimum execution time: 97_729_000 picoseconds. + Weight::from_parts(105_964_750, 0) + // Standard Error: 4_847 + .saturating_add(Weight::from_parts(2_433_966, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 144_133_000 picoseconds. - Weight::from_parts(156_991_945, 0) - // Standard Error: 24_223 - .saturating_add(Weight::from_parts(2_431_525, 0).saturating_mul(r.into())) + // Minimum execution time: 175_010_000 picoseconds. + Weight::from_parts(229_153_209, 0) + // Standard Error: 17_116 + .saturating_add(Weight::from_parts(1_991_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_811_000 picoseconds. - Weight::from_parts(101_122_470, 0) - // Standard Error: 303_533 - .saturating_add(Weight::from_parts(92_415_204, 0).saturating_mul(r.into())) + // Minimum execution time: 94_696_000 picoseconds. + Weight::from_parts(119_674_535, 0) + // Standard Error: 387_178 + .saturating_add(Weight::from_parts(98_102_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_453_000 picoseconds. - Weight::from_parts(79_049_804, 0) - // Standard Error: 305_992 - .saturating_add(Weight::from_parts(79_382_630, 0).saturating_mul(r.into())) + // Minimum execution time: 95_794_000 picoseconds. + Weight::from_parts(89_931_979, 0) + // Standard Error: 371_349 + .saturating_add(Weight::from_parts(86_524_059, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_650_000 picoseconds. - Weight::from_parts(79_085_060, 0) - // Standard Error: 293_080 - .saturating_add(Weight::from_parts(77_346_019, 0).saturating_mul(r.into())) + // Minimum execution time: 97_924_000 picoseconds. + Weight::from_parts(84_041_201, 0) + // Standard Error: 327_841 + .saturating_add(Weight::from_parts(95_483_315, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_545_000 picoseconds. - Weight::from_parts(72_777_984, 0) - // Standard Error: 351_302 - .saturating_add(Weight::from_parts(80_634_984, 0).saturating_mul(r.into())) + // Minimum execution time: 97_122_000 picoseconds. + Weight::from_parts(86_789_268, 0) + // Standard Error: 353_259 + .saturating_add(Weight::from_parts(85_698_317, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_245_000 picoseconds. - Weight::from_parts(76_181_868, 0) - // Standard Error: 354_266 - .saturating_add(Weight::from_parts(79_459_120, 0).saturating_mul(r.into())) + // Minimum execution time: 94_821_000 picoseconds. + Weight::from_parts(92_694_130, 0) + // Standard Error: 340_146 + .saturating_add(Weight::from_parts(84_623_945, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_064_000 picoseconds. - Weight::from_parts(77_882_516, 0) - // Standard Error: 377_997 - .saturating_add(Weight::from_parts(78_533_852, 0).saturating_mul(r.into())) + // Minimum execution time: 93_840_000 picoseconds. + Weight::from_parts(87_888_572, 0) + // Standard Error: 369_465 + .saturating_add(Weight::from_parts(85_638_902, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_522_000 picoseconds. - Weight::from_parts(66_328_137, 0) - // Standard Error: 360_143 - .saturating_add(Weight::from_parts(79_838_604, 0).saturating_mul(r.into())) + // Minimum execution time: 98_597_000 picoseconds. + Weight::from_parts(86_642_386, 0) + // Standard Error: 362_257 + .saturating_add(Weight::from_parts(85_598_887, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_961_000 picoseconds. - Weight::from_parts(72_789_065, 0) - // Standard Error: 366_577 - .saturating_add(Weight::from_parts(79_031_060, 0).saturating_mul(r.into())) + // Minimum execution time: 94_546_000 picoseconds. + Weight::from_parts(91_466_289, 0) + // Standard Error: 344_423 + .saturating_add(Weight::from_parts(84_318_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_686_000 picoseconds. - Weight::from_parts(749_297_529, 0) - // Standard Error: 383_897 - .saturating_add(Weight::from_parts(132_242_102, 0).saturating_mul(r.into())) + // Minimum execution time: 578_036_000 picoseconds. + Weight::from_parts(696_140_951, 0) + // Standard Error: 559_498 + .saturating_add(Weight::from_parts(149_397_501, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 830_957_000 picoseconds. - Weight::from_parts(850_017_000, 0) - // Standard Error: 67_693 - .saturating_add(Weight::from_parts(13_570_326, 0).saturating_mul(n.into())) + // Minimum execution time: 723_788_000 picoseconds. + Weight::from_parts(740_225_000, 0) + // Standard Error: 52_895 + .saturating_add(Weight::from_parts(13_188_120, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_261_000 picoseconds. - Weight::from_parts(70_573_139, 0) - // Standard Error: 351_239 - .saturating_add(Weight::from_parts(80_441_776, 0).saturating_mul(r.into())) + // Minimum execution time: 99_012_000 picoseconds. + Weight::from_parts(88_269_135, 0) + // Standard Error: 296_136 + .saturating_add(Weight::from_parts(92_296_104, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_164_000 picoseconds. - Weight::from_parts(70_866_987, 0) - // Standard Error: 346_107 - .saturating_add(Weight::from_parts(82_471_591, 0).saturating_mul(r.into())) + // Minimum execution time: 93_803_000 picoseconds. + Weight::from_parts(87_097_769, 0) + // Standard Error: 367_325 + .saturating_add(Weight::from_parts(84_987_043, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_192_000 picoseconds. - Weight::from_parts(101_814_078, 0) - // Standard Error: 391_508 - .saturating_add(Weight::from_parts(166_873_282, 0).saturating_mul(n.into())) + // Minimum execution time: 96_663_000 picoseconds. + Weight::from_parts(105_357_427, 0) + // Standard Error: 366_135 + .saturating_add(Weight::from_parts(172_109_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_974_000 picoseconds. - Weight::from_parts(87_244_000, 0) - // Standard Error: 3_619_557 - .saturating_add(Weight::from_parts(749_950_767, 0).saturating_mul(r.into())) + // Minimum execution time: 99_210_000 picoseconds. + Weight::from_parts(102_217_000, 0) + // Standard Error: 4_527_119 + .saturating_add(Weight::from_parts(845_784_967, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_612_000 picoseconds. - Weight::from_parts(147_822_399, 0) - // Standard Error: 421_408 - .saturating_add(Weight::from_parts(250_730_230, 0).saturating_mul(r.into())) + // Minimum execution time: 96_579_000 picoseconds. + Weight::from_parts(162_452_429, 0) + // Standard Error: 416_836 + .saturating_add(Weight::from_parts(257_900_517, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 332_130_000 picoseconds. - Weight::from_parts(337_780_000, 0) - // Standard Error: 52_652 - .saturating_add(Weight::from_parts(20_743_155, 0).saturating_mul(n.into())) + // Minimum execution time: 353_526_000 picoseconds. + Weight::from_parts(358_025_000, 0) + // Standard Error: 61_984 + .saturating_add(Weight::from_parts(21_521_461, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_722_000 picoseconds. - Weight::from_parts(147_881_270, 0) - // Standard Error: 390_429 - .saturating_add(Weight::from_parts(259_701_373, 0).saturating_mul(r.into())) + // Minimum execution time: 94_822_000 picoseconds. + Weight::from_parts(168_431_611, 0) + // Standard Error: 378_696 + .saturating_add(Weight::from_parts(263_135_958, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 337_753_000 picoseconds. - Weight::from_parts(343_454_000, 0) - // Standard Error: 66_604 - .saturating_add(Weight::from_parts(21_189_034, 0).saturating_mul(n.into())) + // Minimum execution time: 351_828_000 picoseconds. + Weight::from_parts(355_382_000, 0) + // Standard Error: 60_589 + .saturating_add(Weight::from_parts(21_325_400, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 708_454_000 picoseconds. - Weight::from_parts(775_673_824, 0) - // Standard Error: 380_634 - .saturating_add(Weight::from_parts(268_253_890, 0).saturating_mul(r.into())) + // Minimum execution time: 569_384_000 picoseconds. + Weight::from_parts(638_474_730, 0) + // Standard Error: 425_903 + .saturating_add(Weight::from_parts(275_691_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_799_000 picoseconds. - Weight::from_parts(782_052_003, 0) - // Standard Error: 385_065 - .saturating_add(Weight::from_parts(265_280_556, 0).saturating_mul(r.into())) + // Minimum execution time: 573_053_000 picoseconds. + Weight::from_parts(640_078_802, 0) + // Standard Error: 475_389 + .saturating_add(Weight::from_parts(284_337_155, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_511_000 picoseconds. - Weight::from_parts(61_459_678, 0) - // Standard Error: 362_497 - .saturating_add(Weight::from_parts(87_903_947, 0).saturating_mul(r.into())) + // Minimum execution time: 98_223_000 picoseconds. + Weight::from_parts(85_732_985, 0) + // Standard Error: 336_308 + .saturating_add(Weight::from_parts(92_936_006, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_676_718_000 picoseconds. - Weight::from_parts(1_838_206_733, 0) - // Standard Error: 440_793 - .saturating_add(Weight::from_parts(156_352_100, 0).saturating_mul(r.into())) + // Minimum execution time: 1_822_621_000 picoseconds. + Weight::from_parts(1_951_955_018, 0) + // Standard Error: 339_415 + .saturating_add(Weight::from_parts(157_557_756, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 284_222_000 picoseconds. - Weight::from_parts(293_316_000, 0) - // Standard Error: 54_796 - .saturating_add(Weight::from_parts(30_939_288, 0).saturating_mul(n.into())) + // Minimum execution time: 314_296_000 picoseconds. + Weight::from_parts(317_522_000, 0) + // Standard Error: 61_360 + .saturating_add(Weight::from_parts(29_499_741, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_682_466_000 picoseconds. - Weight::from_parts(1_829_413_701, 0) - // Standard Error: 510_421 - .saturating_add(Weight::from_parts(216_009_232, 0).saturating_mul(r.into())) + // Minimum execution time: 1_835_106_000 picoseconds. + Weight::from_parts(1_948_516_646, 0) + // Standard Error: 382_008 + .saturating_add(Weight::from_parts(214_812_508, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_681_160_000 picoseconds. - Weight::from_parts(1_819_797_788, 0) - // Standard Error: 453_707 - .saturating_add(Weight::from_parts(215_589_534, 0).saturating_mul(r.into())) + // Minimum execution time: 1_827_496_000 picoseconds. + Weight::from_parts(1_949_190_773, 0) + // Standard Error: 340_175 + .saturating_add(Weight::from_parts(218_001_536, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 242_556_000 picoseconds. - Weight::from_parts(314_306_159, 0) - // Standard Error: 376_142 - .saturating_add(Weight::from_parts(260_614_468, 0).saturating_mul(r.into())) + // Minimum execution time: 264_306_000 picoseconds. + Weight::from_parts(363_536_651, 0) + // Standard Error: 467_914 + .saturating_add(Weight::from_parts(265_564_072, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 495_430_000 picoseconds. - Weight::from_parts(502_714_000, 0) - // Standard Error: 52_049 - .saturating_add(Weight::from_parts(21_259_132, 0).saturating_mul(n.into())) + // Minimum execution time: 523_150_000 picoseconds. + Weight::from_parts(535_842_000, 0) + // Standard Error: 65_412 + .saturating_add(Weight::from_parts(21_698_063, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_809_658_000 picoseconds. - Weight::from_parts(2_002_681_446, 0) - // Standard Error: 414_919 - .saturating_add(Weight::from_parts(227_942_929, 0).saturating_mul(r.into())) + // Minimum execution time: 1_974_743_000 picoseconds. + Weight::from_parts(2_096_494_995, 0) + // Standard Error: 474_778 + .saturating_add(Weight::from_parts(232_524_299, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_821_000 picoseconds. - Weight::from_parts(84_783_126, 0) - // Standard Error: 234_696 - .saturating_add(Weight::from_parts(22_124_873, 0).saturating_mul(r.into())) + // Minimum execution time: 94_139_000 picoseconds. + Weight::from_parts(101_775_569, 0) + // Standard Error: 452_439 + .saturating_add(Weight::from_parts(16_839_430, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_040_000 picoseconds. - Weight::from_parts(92_861_700, 0) - // Standard Error: 1_021 - .saturating_add(Weight::from_parts(419_414, 0).saturating_mul(n.into())) + // Minimum execution time: 112_050_000 picoseconds. + Weight::from_parts(102_205_366, 0) + // Standard Error: 1_008 + .saturating_add(Weight::from_parts(431_304, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_986_000 picoseconds. - Weight::from_parts(85_723_530, 0) - // Standard Error: 278_519 - .saturating_add(Weight::from_parts(19_484_469, 0).saturating_mul(r.into())) + // Minimum execution time: 93_528_000 picoseconds. + Weight::from_parts(99_748_422, 0) + // Standard Error: 396_992 + .saturating_add(Weight::from_parts(20_536_877, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_879_000 picoseconds. - Weight::from_parts(88_056_044, 0) - // Standard Error: 1_087 - .saturating_add(Weight::from_parts(427_201, 0).saturating_mul(n.into())) + // Minimum execution time: 117_832_000 picoseconds. + Weight::from_parts(104_552_847, 0) + // Standard Error: 1_402 + .saturating_add(Weight::from_parts(432_018, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_548_000 picoseconds. - Weight::from_parts(84_139_208, 0) - // Standard Error: 235_150 - .saturating_add(Weight::from_parts(17_533_491, 0).saturating_mul(r.into())) + // Minimum execution time: 93_325_000 picoseconds. + Weight::from_parts(101_074_097, 0) + // Standard Error: 454_790 + .saturating_add(Weight::from_parts(20_838_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_118_000 picoseconds. - Weight::from_parts(88_086_604, 0) - // Standard Error: 244_958 - .saturating_add(Weight::from_parts(17_286_195, 0).saturating_mul(r.into())) + // Minimum execution time: 93_800_000 picoseconds. + Weight::from_parts(102_249_326, 0) + // Standard Error: 463_488 + .saturating_add(Weight::from_parts(15_991_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_393_000 picoseconds. - Weight::from_parts(132_631_342, 0) - // Standard Error: 436_134 - .saturating_add(Weight::from_parts(141_520_417, 0).saturating_mul(r.into())) + // Minimum execution time: 93_153_000 picoseconds. + Weight::from_parts(121_452_989, 0) + // Standard Error: 390_540 + .saturating_add(Weight::from_parts(145_641_178, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_567_000 picoseconds. - Weight::from_parts(99_600_000, 0) - // Standard Error: 2_187 - .saturating_add(Weight::from_parts(639_729, 0).saturating_mul(n.into())) + // Minimum execution time: 115_529_000 picoseconds. + Weight::from_parts(120_413_000, 0) + // Standard Error: 3_105 + .saturating_add(Weight::from_parts(640_863, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 696_739_000 picoseconds. - Weight::from_parts(711_247_336, 0) - // Standard Error: 1_403_605 - .saturating_add(Weight::from_parts(15_869_663, 0).saturating_mul(r.into())) + // Minimum execution time: 566_859_000 picoseconds. + Weight::from_parts(631_111_316, 0) + // Standard Error: 7_012_228 + .saturating_add(Weight::from_parts(21_896_983, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. - fn gr_reply_input_wgas(r: u32, ) -> Weight { + fn gr_reply_input_wgas(_r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 697_432_000 picoseconds. - Weight::from_parts(712_096_565, 0) - // Standard Error: 1_674_352 - .saturating_add(Weight::from_parts(32_103_934, 0).saturating_mul(r.into())) + // Minimum execution time: 565_382_000 picoseconds. + Weight::from_parts(613_048_008, 0) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_685_000 picoseconds. - Weight::from_parts(96_156_389, 0) - // Standard Error: 262_969 - .saturating_add(Weight::from_parts(8_983_510, 0).saturating_mul(r.into())) + // Minimum execution time: 104_401_000 picoseconds. + Weight::from_parts(112_651_320, 0) + // Standard Error: 438_590 + .saturating_add(Weight::from_parts(11_095_379, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_746_000 picoseconds. - Weight::from_parts(89_918_273, 0) - // Standard Error: 1_055 - .saturating_add(Weight::from_parts(427_838, 0).saturating_mul(n.into())) + // Minimum execution time: 115_615_000 picoseconds. + Weight::from_parts(112_987_750, 0) + // Standard Error: 960 + .saturating_add(Weight::from_parts(423_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_634_000 picoseconds. - Weight::from_parts(99_574_926, 0) - // Standard Error: 267_301 - .saturating_add(Weight::from_parts(3_125_673, 0).saturating_mul(r.into())) + // Minimum execution time: 105_056_000 picoseconds. + Weight::from_parts(113_735_922, 0) + // Standard Error: 466_586 + .saturating_add(Weight::from_parts(5_305_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 99_268_000 picoseconds. - Weight::from_parts(93_140_981, 0) - // Standard Error: 1_101 - .saturating_add(Weight::from_parts(419_078, 0).saturating_mul(n.into())) + // Minimum execution time: 113_897_000 picoseconds. + Weight::from_parts(112_616_408, 0) + // Standard Error: 1_722 + .saturating_add(Weight::from_parts(428_420, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_167_000 picoseconds. - Weight::from_parts(80_305_860, 0) - // Standard Error: 357_986 - .saturating_add(Weight::from_parts(80_422_820, 0).saturating_mul(r.into())) + // Minimum execution time: 93_845_000 picoseconds. + Weight::from_parts(97_247_314, 0) + // Standard Error: 366_814 + .saturating_add(Weight::from_parts(85_900_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_137_000 picoseconds. - Weight::from_parts(76_881_656, 0) - // Standard Error: 302_504 - .saturating_add(Weight::from_parts(80_036_963, 0).saturating_mul(r.into())) + // Minimum execution time: 93_761_000 picoseconds. + Weight::from_parts(92_637_129, 0) + // Standard Error: 309_799 + .saturating_add(Weight::from_parts(85_725_727, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_922_000 picoseconds. - Weight::from_parts(767_820_244, 0) - // Standard Error: 418_647 - .saturating_add(Weight::from_parts(97_993_049, 0).saturating_mul(r.into())) + // Minimum execution time: 565_388_000 picoseconds. + Weight::from_parts(606_358_854, 0) + // Standard Error: 430_766 + .saturating_add(Weight::from_parts(108_769_267, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 724_683_000 picoseconds. - Weight::from_parts(732_157_836, 0) - // Standard Error: 618 - .saturating_add(Weight::from_parts(151_809, 0).saturating_mul(n.into())) + // Minimum execution time: 591_660_000 picoseconds. + Weight::from_parts(597_035_528, 0) + // Standard Error: 2_641 + .saturating_add(Weight::from_parts(153_781, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_304_055_000 picoseconds. - Weight::from_parts(2_435_844_780, 0) - // Standard Error: 420_214 - .saturating_add(Weight::from_parts(120_405_108, 0).saturating_mul(r.into())) + // Minimum execution time: 2_317_147_000 picoseconds. + Weight::from_parts(2_514_940_964, 0) + // Standard Error: 546_319 + .saturating_add(Weight::from_parts(128_825_542, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_431_524_000 picoseconds. - Weight::from_parts(2_669_711_936, 0) - // Standard Error: 12_819 - .saturating_add(Weight::from_parts(13_546_418, 0).saturating_mul(n.into())) + // Minimum execution time: 2_560_344_000 picoseconds. + Weight::from_parts(2_512_409_449, 0) + // Standard Error: 15_466 + .saturating_add(Weight::from_parts(12_395_144, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_238_000 picoseconds. - Weight::from_parts(104_905_012, 0) - // Standard Error: 392_000 - .saturating_add(Weight::from_parts(116_570_175, 0).saturating_mul(r.into())) + // Minimum execution time: 97_996_000 picoseconds. + Weight::from_parts(130_630_238, 0) + // Standard Error: 414_418 + .saturating_add(Weight::from_parts(114_735_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 143_132_000 picoseconds. - Weight::from_parts(145_448_000, 0) - // Standard Error: 51_056 - .saturating_add(Weight::from_parts(25_497_066, 0).saturating_mul(n.into())) + // Minimum execution time: 157_513_000 picoseconds. + Weight::from_parts(160_584_000, 0) + // Standard Error: 57_227 + .saturating_add(Weight::from_parts(25_738_939, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_055_000 picoseconds. - Weight::from_parts(75_514_507, 0) - // Standard Error: 342_511 - .saturating_add(Weight::from_parts(78_022_368, 0).saturating_mul(r.into())) + // Minimum execution time: 92_652_000 picoseconds. + Weight::from_parts(88_138_429, 0) + // Standard Error: 330_537 + .saturating_add(Weight::from_parts(83_235_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_725_000 picoseconds. - Weight::from_parts(87_574_873, 0) - // Standard Error: 249_331 - .saturating_add(Weight::from_parts(24_890_126, 0).saturating_mul(r.into())) + // Minimum execution time: 93_824_000 picoseconds. + Weight::from_parts(102_740_497, 0) + // Standard Error: 428_593 + .saturating_add(Weight::from_parts(23_682_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_761_000 picoseconds. - Weight::from_parts(86_511_404, 0) - // Standard Error: 240_746 - .saturating_add(Weight::from_parts(16_767_395, 0).saturating_mul(r.into())) + // Minimum execution time: 92_530_000 picoseconds. + Weight::from_parts(101_410_861, 0) + // Standard Error: 432_236 + .saturating_add(Weight::from_parts(12_196_938, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_794_000 picoseconds. - Weight::from_parts(88_401_167, 0) - // Standard Error: 217_438 - .saturating_add(Weight::from_parts(11_267_632, 0).saturating_mul(r.into())) + // Minimum execution time: 93_402_000 picoseconds. + Weight::from_parts(102_285_877, 0) + // Standard Error: 466_463 + .saturating_add(Weight::from_parts(13_156_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_664_000 picoseconds. - Weight::from_parts(89_193_048, 0) - // Standard Error: 336_699 - .saturating_add(Weight::from_parts(12_350_251, 0).saturating_mul(r.into())) + // Minimum execution time: 95_706_000 picoseconds. + Weight::from_parts(102_513_059, 0) + // Standard Error: 464_787 + .saturating_add(Weight::from_parts(13_986_540, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_815_000 picoseconds. - Weight::from_parts(87_397_869, 0) - // Standard Error: 235_037 - .saturating_add(Weight::from_parts(16_313_030, 0).saturating_mul(r.into())) + // Minimum execution time: 93_057_000 picoseconds. + Weight::from_parts(99_083_869, 0) + // Standard Error: 378_747 + .saturating_add(Weight::from_parts(12_230_330, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_190_000 picoseconds. - Weight::from_parts(186_267_428, 0) - // Standard Error: 346_204 - .saturating_add(Weight::from_parts(158_103_512, 0).saturating_mul(r.into())) + // Minimum execution time: 177_947_000 picoseconds. + Weight::from_parts(226_692_243, 0) + // Standard Error: 265_725 + .saturating_add(Weight::from_parts(156_938_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_748_000 picoseconds. - Weight::from_parts(148_556_306, 0) - // Standard Error: 400_680 - .saturating_add(Weight::from_parts(333_100_790, 0).saturating_mul(r.into())) + // Minimum execution time: 107_346_000 picoseconds. + Weight::from_parts(160_631_540, 0) + // Standard Error: 352_753 + .saturating_add(Weight::from_parts(338_685_448, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2904,22 +2898,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 44_452_286_000 picoseconds. - Weight::from_parts(44_568_744_000, 0) - // Standard Error: 268_880 - .saturating_add(Weight::from_parts(7_444_126, 0).saturating_mul(p.into())) - // Standard Error: 268_867 - .saturating_add(Weight::from_parts(179_724_917, 0).saturating_mul(s.into())) + // Minimum execution time: 44_754_074_000 picoseconds. + Weight::from_parts(44_833_050_000, 0) + // Standard Error: 269_308 + .saturating_add(Weight::from_parts(7_629_892, 0).saturating_mul(p.into())) + // Standard Error: 269_294 + .saturating_add(Weight::from_parts(179_148_245, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_042_000 picoseconds. - Weight::from_parts(163_443_462, 0) - // Standard Error: 381_777 - .saturating_add(Weight::from_parts(338_839_702, 0).saturating_mul(r.into())) + // Minimum execution time: 108_278_000 picoseconds. + Weight::from_parts(161_208_126, 0) + // Standard Error: 368_644 + .saturating_add(Weight::from_parts(346_324_329, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2927,32 +2921,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_724_116_000 picoseconds. - Weight::from_parts(42_849_968_000, 0) - // Standard Error: 263_445 - .saturating_add(Weight::from_parts(8_197_177, 0).saturating_mul(p.into())) - // Standard Error: 263_432 - .saturating_add(Weight::from_parts(180_050_572, 0).saturating_mul(s.into())) + // Minimum execution time: 44_266_209_000 picoseconds. + Weight::from_parts(44_559_345_000, 0) + // Standard Error: 270_420 + .saturating_add(Weight::from_parts(7_460_172, 0).saturating_mul(p.into())) + // Standard Error: 270_407 + .saturating_add(Weight::from_parts(179_211_260, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_607_000 picoseconds. - Weight::from_parts(100_957_693, 0) - // Standard Error: 29_067 - .saturating_add(Weight::from_parts(1_762_813, 0).saturating_mul(r.into())) + // Minimum execution time: 94_889_000 picoseconds. + Weight::from_parts(115_310_524, 0) + // Standard Error: 34_049 + .saturating_add(Weight::from_parts(1_916_607, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_305_000 picoseconds. - Weight::from_parts(108_825_748, 1131) - // Standard Error: 5_956 - .saturating_add(Weight::from_parts(11_809_647, 0).saturating_mul(p.into())) + // Minimum execution time: 97_825_000 picoseconds. + Weight::from_parts(251_440_245, 1131) + // Standard Error: 70_641 + .saturating_add(Weight::from_parts(15_652_952, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2961,10 +2955,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_531_000 picoseconds. - Weight::from_parts(88_749_000, 1131) - // Standard Error: 27_438 - .saturating_add(Weight::from_parts(35_435_114, 0).saturating_mul(p.into())) + // Minimum execution time: 96_761_000 picoseconds. + Weight::from_parts(100_398_000, 1131) + // Standard Error: 45_532 + .saturating_add(Weight::from_parts(39_790_625, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2973,10 +2967,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_087_078_000 picoseconds. - Weight::from_parts(5_882_681_000, 5069931) - // Standard Error: 87_545 - .saturating_add(Weight::from_parts(37_047_042, 0).saturating_mul(p.into())) + // Minimum execution time: 7_471_807_000 picoseconds. + Weight::from_parts(7_440_591_962, 5069931) + // Standard Error: 168_373 + .saturating_add(Weight::from_parts(40_244_359, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -2984,10 +2978,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_432_000 picoseconds. - Weight::from_parts(87_001_000, 1939) - // Standard Error: 47_768 - .saturating_add(Weight::from_parts(47_598_234, 0).saturating_mul(p.into())) + // Minimum execution time: 97_303_000 picoseconds. + Weight::from_parts(98_185_000, 1939) + // Standard Error: 38_471 + .saturating_add(Weight::from_parts(55_016_921, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -2996,10 +2990,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 92_594_000 picoseconds. - Weight::from_parts(93_795_036, 1131) - // Standard Error: 53_549 - .saturating_add(Weight::from_parts(35_797_869, 0).saturating_mul(p.into())) + // Minimum execution time: 102_497_000 picoseconds. + Weight::from_parts(104_932_685, 1131) + // Standard Error: 78_974 + .saturating_add(Weight::from_parts(39_257_150, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3008,10 +3002,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 769_397_000 picoseconds. - Weight::from_parts(792_321_925, 1496) - // Standard Error: 237_986 - .saturating_add(Weight::from_parts(48_847_504, 0).saturating_mul(p.into())) + // Minimum execution time: 612_308_000 picoseconds. + Weight::from_parts(642_079_999, 1496) + // Standard Error: 357_245 + .saturating_add(Weight::from_parts(46_518_860, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3020,10 +3014,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_113_735_000 picoseconds. - Weight::from_parts(1_148_020_828, 317931) - // Standard Error: 167_371 - .saturating_add(Weight::from_parts(47_795_831, 0).saturating_mul(p.into())) + // Minimum execution time: 1_068_248_000 picoseconds. + Weight::from_parts(1_080_741_205, 317931) + // Standard Error: 262_216 + .saturating_add(Weight::from_parts(50_047_907, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3031,884 +3025,882 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_154_000 picoseconds. - Weight::from_parts(4_280_364, 0) - // Standard Error: 8_638 - .saturating_add(Weight::from_parts(24_150_721, 0).saturating_mul(r.into())) + // Minimum execution time: 3_099_000 picoseconds. + Weight::from_parts(6_340_084, 0) + // Standard Error: 180_257 + .saturating_add(Weight::from_parts(74_666_091, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_339_689_000 picoseconds. - Weight::from_parts(4_202_598_633, 0) - // Standard Error: 74_721 - .saturating_add(Weight::from_parts(4_468_109, 0).saturating_mul(r.into())) + // Minimum execution time: 4_391_547_000 picoseconds. + Weight::from_parts(4_140_785_425, 0) + // Standard Error: 89_369 + .saturating_add(Weight::from_parts(5_769_622, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_343_068_000 picoseconds. - Weight::from_parts(4_226_706_212, 0) - // Standard Error: 60_538 - .saturating_add(Weight::from_parts(4_325_162, 0).saturating_mul(r.into())) + // Minimum execution time: 4_386_802_000 picoseconds. + Weight::from_parts(4_243_536_456, 0) + // Standard Error: 95_210 + .saturating_add(Weight::from_parts(5_278_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_409_473_000 picoseconds. - Weight::from_parts(11_882_222_938, 0) - // Standard Error: 194_167 - .saturating_add(Weight::from_parts(8_210_890, 0).saturating_mul(r.into())) + // Minimum execution time: 11_072_272_000 picoseconds. + Weight::from_parts(11_558_306_225, 0) + // Standard Error: 165_659 + .saturating_add(Weight::from_parts(9_828_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_212_512_000 picoseconds. - Weight::from_parts(10_628_957_808, 0) - // Standard Error: 170_508 - .saturating_add(Weight::from_parts(11_560_237, 0).saturating_mul(r.into())) + // Minimum execution time: 10_285_071_000 picoseconds. + Weight::from_parts(11_137_621_942, 0) + // Standard Error: 147_513 + .saturating_add(Weight::from_parts(9_014_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_229_000 picoseconds. - Weight::from_parts(2_319_000, 0) - // Standard Error: 9_576 - .saturating_add(Weight::from_parts(3_794_717, 0).saturating_mul(r.into())) + // Minimum execution time: 2_285_000 picoseconds. + Weight::from_parts(2_410_000, 0) + // Standard Error: 7_624 + .saturating_add(Weight::from_parts(3_864_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_265_000 picoseconds. - Weight::from_parts(2_353_000, 0) - // Standard Error: 5_018 - .saturating_add(Weight::from_parts(3_059_511, 0).saturating_mul(r.into())) + // Minimum execution time: 2_342_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 6_413 + .saturating_add(Weight::from_parts(3_120_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(3_531_925, 0) - // Standard Error: 1_167 - .saturating_add(Weight::from_parts(1_569_201, 0).saturating_mul(r.into())) + // Minimum execution time: 2_301_000 picoseconds. + Weight::from_parts(3_591_730, 0) + // Standard Error: 1_106 + .saturating_add(Weight::from_parts(1_565_415, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_359_000, 0) - // Standard Error: 9_672 - .saturating_add(Weight::from_parts(2_884_305, 0).saturating_mul(r.into())) + // Minimum execution time: 2_306_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 7_711 + .saturating_add(Weight::from_parts(2_932_880, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 8_373 - .saturating_add(Weight::from_parts(5_256_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_358_000 picoseconds. + Weight::from_parts(2_144_801, 0) + // Standard Error: 22_082 + .saturating_add(Weight::from_parts(5_266_139, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_012_000 picoseconds. - Weight::from_parts(4_938_253, 0) - // Standard Error: 2_214 - .saturating_add(Weight::from_parts(151_870, 0).saturating_mul(e.into())) + // Minimum execution time: 6_803_000 picoseconds. + Weight::from_parts(5_374_690, 0) + // Standard Error: 1_699 + .saturating_add(Weight::from_parts(171_193, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_309_000 picoseconds. - Weight::from_parts(4_232_448, 0) - // Standard Error: 6_359 - .saturating_add(Weight::from_parts(2_596_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_431_000 picoseconds. + Weight::from_parts(4_875_813, 0) + // Standard Error: 8_258 + .saturating_add(Weight::from_parts(2_629_733, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_596_672 - - 2_404_212, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_629_733 - + 2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(4_432_470, 0) - // Standard Error: 11_941 - .saturating_add(Weight::from_parts(2_404_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(5_140_243, 0) + // Standard Error: 13_164 + .saturating_add(Weight::from_parts(2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_776_000 picoseconds. - Weight::from_parts(12_954_286, 0) - // Standard Error: 30_568 - .saturating_add(Weight::from_parts(10_260_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_669_000 picoseconds. + Weight::from_parts(22_369_265, 0) + // Standard Error: 28_577 + .saturating_add(Weight::from_parts(9_740_558, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_935_000 picoseconds. - Weight::from_parts(1_635_475, 0) - // Standard Error: 7_669 - .saturating_add(Weight::from_parts(1_285_084, 0).saturating_mul(p.into())) + // Minimum execution time: 12_277_000 picoseconds. + Weight::from_parts(3_596_853, 0) + // Standard Error: 5_869 + .saturating_add(Weight::from_parts(1_258_605, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(l: u32, ) -> Weight { + fn instr_call_per_local(_l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_316_000 picoseconds. - Weight::from_parts(5_699_758, 0) - // Standard Error: 13 - .saturating_add(Weight::from_parts(34, 0).saturating_mul(l.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(5_778_137, 0) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_315_000 picoseconds. - Weight::from_parts(2_460_643, 0) - // Standard Error: 2_850 - .saturating_add(Weight::from_parts(235_587, 0).saturating_mul(r.into())) + // Minimum execution time: 4_835_000 picoseconds. + Weight::from_parts(6_065_483, 0) + // Standard Error: 3_006 + .saturating_add(Weight::from_parts(378_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 6_150 - .saturating_add(Weight::from_parts(730_523, 0).saturating_mul(r.into())) + // Minimum execution time: 4_722_000 picoseconds. + Weight::from_parts(3_902_309, 0) + // Standard Error: 5_742 + .saturating_add(Weight::from_parts(1_056_408, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_338_000, 0) - // Standard Error: 5_205 - .saturating_add(Weight::from_parts(679_669, 0).saturating_mul(r.into())) + // Minimum execution time: 4_888_000 picoseconds. + Weight::from_parts(4_512_058, 0) + // Standard Error: 6_410 + .saturating_add(Weight::from_parts(1_001_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_412_000 picoseconds. - Weight::from_parts(2_087_064, 0) - // Standard Error: 9_824 - .saturating_add(Weight::from_parts(743_737, 0).saturating_mul(r.into())) + // Minimum execution time: 6_413_000 picoseconds. + Weight::from_parts(2_704_134, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(804_200, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_388_000 picoseconds. - Weight::from_parts(6_512_000, 0) - // Standard Error: 7_958 - .saturating_add(Weight::from_parts(1_283_588, 0).saturating_mul(r.into())) + // Minimum execution time: 6_516_000 picoseconds. + Weight::from_parts(1_028_752, 0) + // Standard Error: 8_792 + .saturating_add(Weight::from_parts(1_494_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_885_000 picoseconds. - Weight::from_parts(4_075_795, 0) - // Standard Error: 12_241 - .saturating_add(Weight::from_parts(6_965_908, 0).saturating_mul(r.into())) + // Minimum execution time: 5_560_000 picoseconds. + Weight::from_parts(1_126_442, 0) + // Standard Error: 14_476 + .saturating_add(Weight::from_parts(7_240_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 5_936 - .saturating_add(Weight::from_parts(3_299_707, 0).saturating_mul(r.into())) + // Minimum execution time: 2_299_000 picoseconds. + Weight::from_parts(2_449_000, 0) + // Standard Error: 7_416 + .saturating_add(Weight::from_parts(3_344_387, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 6_255 - .saturating_add(Weight::from_parts(2_999_382, 0).saturating_mul(r.into())) + // Minimum execution time: 2_389_000 picoseconds. + Weight::from_parts(2_551_000, 0) + // Standard Error: 5_708 + .saturating_add(Weight::from_parts(3_133_430, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 6_896 - .saturating_add(Weight::from_parts(2_967_047, 0).saturating_mul(r.into())) + // Minimum execution time: 2_428_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 7_262 + .saturating_add(Weight::from_parts(3_192_675, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 4_893 - .saturating_add(Weight::from_parts(2_579_110, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(2_426_000, 0) + // Standard Error: 4_554 + .saturating_add(Weight::from_parts(2_683_293, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_304_000, 0) - // Standard Error: 3_852 - .saturating_add(Weight::from_parts(520_005, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 4_686 + .saturating_add(Weight::from_parts(631_609, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_274_000 picoseconds. - Weight::from_parts(1_794_591, 0) - // Standard Error: 3_416 - .saturating_add(Weight::from_parts(359_819, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(1_221_890, 0) + // Standard Error: 3_960 + .saturating_add(Weight::from_parts(452_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_287_000, 0) - // Standard Error: 10_307 - .saturating_add(Weight::from_parts(1_833_775, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_390_000, 0) + // Standard Error: 11_114 + .saturating_add(Weight::from_parts(1_916_122, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(2_349_000, 0) - // Standard Error: 9_393 - .saturating_add(Weight::from_parts(1_178_942, 0).saturating_mul(r.into())) + // Minimum execution time: 2_436_000 picoseconds. + Weight::from_parts(2_504_000, 0) + // Standard Error: 7_104 + .saturating_add(Weight::from_parts(1_156_958, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_256_508, 0) - // Standard Error: 3_133 - .saturating_add(Weight::from_parts(326_908, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(1_708_596, 0) + // Standard Error: 2_843 + .saturating_add(Weight::from_parts(377_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_298_000 picoseconds. - Weight::from_parts(1_792_383, 0) - // Standard Error: 2_981 - .saturating_add(Weight::from_parts(325_072, 0).saturating_mul(r.into())) + // Minimum execution time: 2_386_000 picoseconds. + Weight::from_parts(1_424_415, 0) + // Standard Error: 3_599 + .saturating_add(Weight::from_parts(395_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(236_190, 0) - // Standard Error: 5_791 - .saturating_add(Weight::from_parts(526_784, 0).saturating_mul(r.into())) + // Minimum execution time: 2_396_000 picoseconds. + Weight::from_parts(2_491_000, 0) + // Standard Error: 3_774 + .saturating_add(Weight::from_parts(516_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(18_346, 0) - // Standard Error: 5_882 - .saturating_add(Weight::from_parts(538_848, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(548_192, 0) + // Standard Error: 4_583 + .saturating_add(Weight::from_parts(556_734, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 4_502 - .saturating_add(Weight::from_parts(463_034, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(447_271, 0) + // Standard Error: 5_300 + .saturating_add(Weight::from_parts(535_915, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(2_193_450, 0) - // Standard Error: 3_655 - .saturating_add(Weight::from_parts(304_226, 0).saturating_mul(r.into())) + // Minimum execution time: 2_340_000 picoseconds. + Weight::from_parts(1_639_695, 0) + // Standard Error: 3_519 + .saturating_add(Weight::from_parts(368_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_803_358, 0) - // Standard Error: 2_256 - .saturating_add(Weight::from_parts(163_489, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_843_474, 0) + // Standard Error: 1_950 + .saturating_add(Weight::from_parts(176_592, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(3_087_274, 0) - // Standard Error: 1_907 - .saturating_add(Weight::from_parts(146_988, 0).saturating_mul(r.into())) + // Minimum execution time: 2_351_000 picoseconds. + Weight::from_parts(2_894_613, 0) + // Standard Error: 2_024 + .saturating_add(Weight::from_parts(188_853, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_335_000, 0) - // Standard Error: 9_220 - .saturating_add(Weight::from_parts(1_682_986, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_418_000, 0) + // Standard Error: 9_504 + .saturating_add(Weight::from_parts(1_936_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 7_751 - .saturating_add(Weight::from_parts(1_073_438, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_364_000, 0) + // Standard Error: 8_346 + .saturating_add(Weight::from_parts(1_222_521, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_297_000, 0) - // Standard Error: 9_887 - .saturating_add(Weight::from_parts(1_746_888, 0).saturating_mul(r.into())) + // Minimum execution time: 2_345_000 picoseconds. + Weight::from_parts(2_452_000, 0) + // Standard Error: 10_232 + .saturating_add(Weight::from_parts(1_883_867, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_305_000, 0) - // Standard Error: 8_241 - .saturating_add(Weight::from_parts(1_123_968, 0).saturating_mul(r.into())) + // Minimum execution time: 2_323_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 7_581 + .saturating_add(Weight::from_parts(1_200_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_325_000 picoseconds. - Weight::from_parts(2_368_000, 0) - // Standard Error: 10_199 - .saturating_add(Weight::from_parts(1_754_281, 0).saturating_mul(r.into())) + // Minimum execution time: 2_410_000 picoseconds. + Weight::from_parts(2_459_000, 0) + // Standard Error: 11_139 + .saturating_add(Weight::from_parts(1_877_766, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 7_885 - .saturating_add(Weight::from_parts(1_054_096, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 8_083 + .saturating_add(Weight::from_parts(1_217_904, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_244_000, 0) - // Standard Error: 11_272 - .saturating_add(Weight::from_parts(1_769_874, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(2_482_000, 0) + // Standard Error: 11_044 + .saturating_add(Weight::from_parts(1_956_302, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 8_360 - .saturating_add(Weight::from_parts(1_115_362, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 7_870 + .saturating_add(Weight::from_parts(1_213_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 9_424 - .saturating_add(Weight::from_parts(1_807_643, 0).saturating_mul(r.into())) + // Minimum execution time: 2_364_000 picoseconds. + Weight::from_parts(2_430_000, 0) + // Standard Error: 10_577 + .saturating_add(Weight::from_parts(1_968_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 7_499 - .saturating_add(Weight::from_parts(1_087_178, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_442_000, 0) + // Standard Error: 7_838 + .saturating_add(Weight::from_parts(1_267_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 11_743 - .saturating_add(Weight::from_parts(1_703_075, 0).saturating_mul(r.into())) + // Minimum execution time: 2_395_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 10_856 + .saturating_add(Weight::from_parts(1_910_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_254_000, 0) - // Standard Error: 8_099 - .saturating_add(Weight::from_parts(1_080_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_343_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 5_786 + .saturating_add(Weight::from_parts(1_128_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_183_000 picoseconds. - Weight::from_parts(2_301_000, 0) - // Standard Error: 10_230 - .saturating_add(Weight::from_parts(1_738_567, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 10_344 + .saturating_add(Weight::from_parts(1_897_480, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_209_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 8_536 - .saturating_add(Weight::from_parts(1_161_928, 0).saturating_mul(r.into())) + // Minimum execution time: 2_355_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 6_963 + .saturating_add(Weight::from_parts(1_125_698, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_208_000 picoseconds. - Weight::from_parts(2_255_000, 0) - // Standard Error: 10_368 - .saturating_add(Weight::from_parts(1_847_441, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_447_000, 0) + // Standard Error: 8_285 + .saturating_add(Weight::from_parts(1_848_149, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 8_213 - .saturating_add(Weight::from_parts(1_112_048, 0).saturating_mul(r.into())) + // Minimum execution time: 2_327_000 picoseconds. + Weight::from_parts(2_394_000, 0) + // Standard Error: 7_282 + .saturating_add(Weight::from_parts(1_176_423, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 12_684 - .saturating_add(Weight::from_parts(1_728_765, 0).saturating_mul(r.into())) + // Minimum execution time: 2_372_000 picoseconds. + Weight::from_parts(2_439_000, 0) + // Standard Error: 9_207 + .saturating_add(Weight::from_parts(1_837_009, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_573_000 picoseconds. - Weight::from_parts(2_655_000, 0) - // Standard Error: 7_404 - .saturating_add(Weight::from_parts(1_080_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_368_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_320 + .saturating_add(Weight::from_parts(1_231_088, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 9_739 - .saturating_add(Weight::from_parts(1_807_913, 0).saturating_mul(r.into())) + // Minimum execution time: 2_373_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 9_499 + .saturating_add(Weight::from_parts(1_922_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 7_265 - .saturating_add(Weight::from_parts(1_087_210, 0).saturating_mul(r.into())) + // Minimum execution time: 2_387_000 picoseconds. + Weight::from_parts(2_455_000, 0) + // Standard Error: 7_681 + .saturating_add(Weight::from_parts(1_198_894, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_311_000, 0) - // Standard Error: 7_444 - .saturating_add(Weight::from_parts(1_191_685, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 7_797 + .saturating_add(Weight::from_parts(1_286_566, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_263_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 5_023 - .saturating_add(Weight::from_parts(585_667, 0).saturating_mul(r.into())) + // Minimum execution time: 2_329_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 4_968 + .saturating_add(Weight::from_parts(645_254, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 10_018 - .saturating_add(Weight::from_parts(1_297_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(2_489_000, 0) + // Standard Error: 7_055 + .saturating_add(Weight::from_parts(1_232_084, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_291_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 4_776 - .saturating_add(Weight::from_parts(612_864, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 4_348 + .saturating_add(Weight::from_parts(633_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_286_000 picoseconds. - Weight::from_parts(2_356_000, 0) - // Standard Error: 11_619 - .saturating_add(Weight::from_parts(1_743_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_336_000 picoseconds. + Weight::from_parts(2_413_000, 0) + // Standard Error: 8_202 + .saturating_add(Weight::from_parts(1_777_425, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_302_000 picoseconds. - Weight::from_parts(2_343_000, 0) - // Standard Error: 8_638 - .saturating_add(Weight::from_parts(1_136_060, 0).saturating_mul(r.into())) + // Minimum execution time: 2_314_000 picoseconds. + Weight::from_parts(2_369_000, 0) + // Standard Error: 6_935 + .saturating_add(Weight::from_parts(1_201_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 7_114 - .saturating_add(Weight::from_parts(2_599_346, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(6_846_840, 0) + // Standard Error: 17_822 + .saturating_add(Weight::from_parts(2_268_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(3_823_403, 0) - // Standard Error: 18_912 - .saturating_add(Weight::from_parts(2_161_963, 0).saturating_mul(r.into())) + // Minimum execution time: 2_394_000 picoseconds. + Weight::from_parts(4_704_336, 0) + // Standard Error: 10_960 + .saturating_add(Weight::from_parts(2_182_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_199_000 picoseconds. - Weight::from_parts(2_817_173, 0) - // Standard Error: 17_341 - .saturating_add(Weight::from_parts(2_740_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_375_000 picoseconds. + Weight::from_parts(1_968_824, 0) + // Standard Error: 15_899 + .saturating_add(Weight::from_parts(2_762_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(88_235, 0) - // Standard Error: 10_326 - .saturating_add(Weight::from_parts(2_481_087, 0).saturating_mul(r.into())) + // Minimum execution time: 2_335_000 picoseconds. + Weight::from_parts(1_450_000, 0) + // Standard Error: 13_496 + .saturating_add(Weight::from_parts(2_401_407, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 14_480 - .saturating_add(Weight::from_parts(9_604_981, 0).saturating_mul(r.into())) + // Minimum execution time: 2_448_000 picoseconds. + Weight::from_parts(2_513_000, 0) + // Standard Error: 19_401 + .saturating_add(Weight::from_parts(9_309_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 21_926 - .saturating_add(Weight::from_parts(7_501_289, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(1_738_370, 0) + // Standard Error: 42_672 + .saturating_add(Weight::from_parts(7_512_557, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_309_000 picoseconds. - Weight::from_parts(10_308_173, 0) - // Standard Error: 30_680 - .saturating_add(Weight::from_parts(2_288_505, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_215_088, 0) + // Standard Error: 15_445 + .saturating_add(Weight::from_parts(2_956_278, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 5_007 - .saturating_add(Weight::from_parts(2_516_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(217_500, 0) + // Standard Error: 7_904 + .saturating_add(Weight::from_parts(2_576_151, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_228_000 picoseconds. - Weight::from_parts(2_300_000, 0) - // Standard Error: 8_948 - .saturating_add(Weight::from_parts(1_264_596, 0).saturating_mul(r.into())) + // Minimum execution time: 2_456_000 picoseconds. + Weight::from_parts(2_503_000, 0) + // Standard Error: 7_920 + .saturating_add(Weight::from_parts(1_321_543, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 5_099 - .saturating_add(Weight::from_parts(612_107, 0).saturating_mul(r.into())) + // Minimum execution time: 2_346_000 picoseconds. + Weight::from_parts(2_479_000, 0) + // Standard Error: 4_711 + .saturating_add(Weight::from_parts(689_892, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(2_326_000, 0) - // Standard Error: 10_004 - .saturating_add(Weight::from_parts(1_278_365, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_029 + .saturating_add(Weight::from_parts(1_256_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 5_578 - .saturating_add(Weight::from_parts(645_196, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_480_000, 0) + // Standard Error: 3_812 + .saturating_add(Weight::from_parts(607_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_338_000 picoseconds. - Weight::from_parts(2_363_000, 0) - // Standard Error: 8_554 - .saturating_add(Weight::from_parts(1_288_676, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 7_362 + .saturating_add(Weight::from_parts(1_248_739, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_332_000, 0) - // Standard Error: 3_999 - .saturating_add(Weight::from_parts(594_484, 0).saturating_mul(r.into())) + // Minimum execution time: 2_419_000 picoseconds. + Weight::from_parts(2_465_000, 0) + // Standard Error: 4_304 + .saturating_add(Weight::from_parts(604_813, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 7_437 - .saturating_add(Weight::from_parts(1_044_306, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 8_043 + .saturating_add(Weight::from_parts(1_073_194, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_308_000, 0) - // Standard Error: 4_658 - .saturating_add(Weight::from_parts(537_262, 0).saturating_mul(r.into())) + // Minimum execution time: 2_427_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 4_969 + .saturating_add(Weight::from_parts(594_802, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 10_254 - .saturating_add(Weight::from_parts(1_154_138, 0).saturating_mul(r.into())) + // Minimum execution time: 2_312_000 picoseconds. + Weight::from_parts(2_399_000, 0) + // Standard Error: 7_093 + .saturating_add(Weight::from_parts(1_110_114, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_234_000 picoseconds. - Weight::from_parts(2_313_000, 0) - // Standard Error: 4_960 - .saturating_add(Weight::from_parts(607_930, 0).saturating_mul(r.into())) + // Minimum execution time: 2_331_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 4_140 + .saturating_add(Weight::from_parts(600_354, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 7_909 - .saturating_add(Weight::from_parts(1_094_660, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_419_000, 0) + // Standard Error: 7_150 + .saturating_add(Weight::from_parts(1_154_649, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(39_069, 0) - // Standard Error: 6_710 - .saturating_add(Weight::from_parts(599_572, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_423_000, 0) + // Standard Error: 5_067 + .saturating_add(Weight::from_parts(594_487, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 8_785 - .saturating_add(Weight::from_parts(1_060_321, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_406_000, 0) + // Standard Error: 5_674 + .saturating_add(Weight::from_parts(1_051_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 4_191 - .saturating_add(Weight::from_parts(528_319, 0).saturating_mul(r.into())) + // Minimum execution time: 2_383_000 picoseconds. + Weight::from_parts(114_723, 0) + // Standard Error: 5_881 + .saturating_add(Weight::from_parts(646_798, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 9_328 - .saturating_add(Weight::from_parts(1_114_164, 0).saturating_mul(r.into())) + // Minimum execution time: 2_292_000 picoseconds. + Weight::from_parts(2_422_000, 0) + // Standard Error: 6_697 + .saturating_add(Weight::from_parts(1_053_580, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_210_000 picoseconds. - Weight::from_parts(390_951, 0) - // Standard Error: 5_316 - .saturating_add(Weight::from_parts(609_568, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(206_699, 0) + // Standard Error: 5_851 + .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } } diff --git a/runtime/gear/src/tests.rs b/runtime/gear/src/tests.rs index bf85a733ec9..95afd48443d 100644 --- a/runtime/gear/src/tests.rs +++ b/runtime/gear/src/tests.rs @@ -32,8 +32,8 @@ fn instruction_weights_heuristics_test() { _phantom: core::marker::PhantomData, i64const: 150, - i64load: 7_000, - i32load: 7_000, + i64load: 11_575, + i32load: 8_000, i64store: 29_000, i32store: 20_000, select: 7_100, @@ -138,14 +138,14 @@ fn page_costs_heuristic_test() { let expected_pages_costs = PageCosts { lazy_pages_signal_read: 28_000_000.into(), lazy_pages_signal_write: 33_000_000.into(), - lazy_pages_signal_write_after_read: 8_624_904.into(), + lazy_pages_signal_write_after_read: 9_500_000.into(), lazy_pages_host_func_read: 29_000_000.into(), lazy_pages_host_func_write: 33_000_000.into(), lazy_pages_host_func_write_after_read: 9_245_597.into(), - load_page_data: 8_700_000.into(), + load_page_data: 9_700_000.into(), upload_page_data: 104_000_000.into(), static_page: 100.into(), - mem_grow: 276_000.into(), + mem_grow: 906_170.into(), parachain_load_heuristic: 0.into(), }; @@ -156,7 +156,7 @@ fn page_costs_heuristic_test() { host_func_read: 29_000_000.into(), host_func_write: 137_000_000.into(), host_func_write_after_read: 112_000_000.into(), - load_page_storage_data: 8_700_000.into(), + load_page_storage_data: 9_700_000.into(), }; check_pages_weights( diff --git a/runtime/gear/src/weights/frame_system.rs b/runtime/gear/src/weights/frame_system.rs index 37c8734e2c3..31dd34692d1 100644 --- a/runtime/gear/src/weights/frame_system.rs +++ b/runtime/gear/src/weights/frame_system.rs @@ -19,13 +19,13 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/gear benchmark pallet --chain=gear-dev --steps=50 --repeat=20 --pallet=frame_system --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/frame_system.rs --template=.maintain/frame-weight-template.hbs +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=frame_system --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/frame_system.rs --template=.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -53,18 +53,18 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_547_000 picoseconds. - Weight::from_parts(1_156_168, 0) + // Minimum execution time: 1_562_000 picoseconds. + Weight::from_parts(1_066_991, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(461, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 1310720]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_872_000 picoseconds. - Weight::from_parts(6_100_000, 0) + // Minimum execution time: 5_949_000 picoseconds. + Weight::from_parts(6_153_000, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(1_441, 0).saturating_mul(b.into())) } @@ -72,8 +72,8 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_110_000 picoseconds. - Weight::from_parts(3_331_000, 1485) + // Minimum execution time: 3_113_000 picoseconds. + Weight::from_parts(3_394_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -82,10 +82,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_474_000 picoseconds. - Weight::from_parts(1_571_000, 0) - // Standard Error: 974 - .saturating_add(Weight::from_parts(687_544, 0).saturating_mul(i.into())) + // Minimum execution time: 1_578_000 picoseconds. + Weight::from_parts(1_632_000, 0) + // Standard Error: 994 + .saturating_add(Weight::from_parts(687_989, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -93,21 +93,21 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_521_000 picoseconds. - Weight::from_parts(1_570_000, 0) - // Standard Error: 706 - .saturating_add(Weight::from_parts(527_682, 0).saturating_mul(i.into())) + // Minimum execution time: 1_593_000 picoseconds. + Weight::from_parts(1_667_000, 0) + // Standard Error: 783 + .saturating_add(Weight::from_parts(535_872, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `64 + p * (69 ±0)` - // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 3_122_000 picoseconds. - Weight::from_parts(3_256_000, 66) - // Standard Error: 1_528 - .saturating_add(Weight::from_parts(1_112_001, 0).saturating_mul(p.into())) + // Measured: `82 + p * (69 ±0)` + // Estimated: `89 + p * (70 ±0)` + // Minimum execution time: 3_345_000 picoseconds. + Weight::from_parts(3_470_000, 89) + // Standard Error: 1_511 + .saturating_add(Weight::from_parts(1_126_865, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -121,18 +121,18 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_547_000 picoseconds. - Weight::from_parts(1_156_168, 0) + // Minimum execution time: 1_562_000 picoseconds. + Weight::from_parts(1_066_991, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(461, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 1310720]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_872_000 picoseconds. - Weight::from_parts(6_100_000, 0) + // Minimum execution time: 5_949_000 picoseconds. + Weight::from_parts(6_153_000, 0) // Standard Error: 0 .saturating_add(Weight::from_parts(1_441, 0).saturating_mul(b.into())) } @@ -140,8 +140,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_110_000 picoseconds. - Weight::from_parts(3_331_000, 1485) + // Minimum execution time: 3_113_000 picoseconds. + Weight::from_parts(3_394_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -150,10 +150,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_474_000 picoseconds. - Weight::from_parts(1_571_000, 0) - // Standard Error: 974 - .saturating_add(Weight::from_parts(687_544, 0).saturating_mul(i.into())) + // Minimum execution time: 1_578_000 picoseconds. + Weight::from_parts(1_632_000, 0) + // Standard Error: 994 + .saturating_add(Weight::from_parts(687_989, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -161,21 +161,21 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_521_000 picoseconds. - Weight::from_parts(1_570_000, 0) - // Standard Error: 706 - .saturating_add(Weight::from_parts(527_682, 0).saturating_mul(i.into())) + // Minimum execution time: 1_593_000 picoseconds. + Weight::from_parts(1_667_000, 0) + // Standard Error: 783 + .saturating_add(Weight::from_parts(535_872, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `64 + p * (69 ±0)` - // Estimated: `66 + p * (70 ±0)` - // Minimum execution time: 3_122_000 picoseconds. - Weight::from_parts(3_256_000, 66) - // Standard Error: 1_528 - .saturating_add(Weight::from_parts(1_112_001, 0).saturating_mul(p.into())) + // Measured: `82 + p * (69 ±0)` + // Estimated: `89 + p * (70 ±0)` + // Minimum execution time: 3_345_000 picoseconds. + Weight::from_parts(3_470_000, 89) + // Standard Error: 1_511 + .saturating_add(Weight::from_parts(1_126_865, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/runtime/gear/src/weights/pallet_balances.rs b/runtime/gear/src/weights/pallet_balances.rs index b1991b28d8a..f096d50de43 100644 --- a/runtime/gear/src/weights/pallet_balances.rs +++ b/runtime/gear/src/weights/pallet_balances.rs @@ -19,13 +19,13 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/gear benchmark pallet --chain=gear-dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_balances.rs --template=.maintain/frame-weight-template.hbs +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_balances.rs --template=.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -53,8 +53,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_830_000 picoseconds. - Weight::from_parts(30_268_000, 3593) + // Minimum execution time: 29_789_000 picoseconds. + Weight::from_parts(30_683_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -62,8 +62,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 21_306_000 picoseconds. - Weight::from_parts(21_569_000, 3593) + // Minimum execution time: 21_425_000 picoseconds. + Weight::from_parts(21_900_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -71,8 +71,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_033_000 picoseconds. - Weight::from_parts(12_390_000, 3593) + // Minimum execution time: 12_387_000 picoseconds. + Weight::from_parts(12_754_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +80,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 14_966_000 picoseconds. - Weight::from_parts(15_395_000, 3593) + // Minimum execution time: 15_196_000 picoseconds. + Weight::from_parts(15_778_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -89,8 +89,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 31_303_000 picoseconds. - Weight::from_parts(31_887_000, 6196) + // Minimum execution time: 31_544_000 picoseconds. + Weight::from_parts(32_018_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -98,8 +98,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 28_222_000 picoseconds. - Weight::from_parts(28_785_000, 3593) + // Minimum execution time: 28_027_000 picoseconds. + Weight::from_parts(29_047_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,8 +107,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 11_871_000 picoseconds. - Weight::from_parts(12_362_000, 3593) + // Minimum execution time: 11_796_000 picoseconds. + Weight::from_parts(12_239_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +120,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 29_830_000 picoseconds. - Weight::from_parts(30_268_000, 3593) + // Minimum execution time: 29_789_000 picoseconds. + Weight::from_parts(30_683_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -129,8 +129,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 21_306_000 picoseconds. - Weight::from_parts(21_569_000, 3593) + // Minimum execution time: 21_425_000 picoseconds. + Weight::from_parts(21_900_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_033_000 picoseconds. - Weight::from_parts(12_390_000, 3593) + // Minimum execution time: 12_387_000 picoseconds. + Weight::from_parts(12_754_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -147,8 +147,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 14_966_000 picoseconds. - Weight::from_parts(15_395_000, 3593) + // Minimum execution time: 15_196_000 picoseconds. + Weight::from_parts(15_778_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -156,8 +156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 31_303_000 picoseconds. - Weight::from_parts(31_887_000, 6196) + // Minimum execution time: 31_544_000 picoseconds. + Weight::from_parts(32_018_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -165,8 +165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 28_222_000 picoseconds. - Weight::from_parts(28_785_000, 3593) + // Minimum execution time: 28_027_000 picoseconds. + Weight::from_parts(29_047_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -174,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 11_871_000 picoseconds. - Weight::from_parts(12_362_000, 3593) + // Minimum execution time: 11_796_000 picoseconds. + Weight::from_parts(12_239_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/runtime/gear/src/weights/pallet_gear.rs b/runtime/gear/src/weights/pallet_gear.rs index 57f8c62db66..707b287d5c5 100644 --- a/runtime/gear/src/weights/pallet_gear.rs +++ b/runtime/gear/src/weights/pallet_gear.rs @@ -19,13 +19,13 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/gear benchmark pallet --chain=gear-dev --steps=50 --repeat=20 --pallet=pallet_gear --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_gear.rs --template=.maintain/frame-weight-template.hbs +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_gear --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_gear.rs --template=.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -244,21 +244,21 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 951_000 picoseconds. - Weight::from_parts(1_020_000, 0) - // Standard Error: 722 - .saturating_add(Weight::from_parts(240_031, 0).saturating_mul(c.into())) + // Minimum execution time: 1_023_000 picoseconds. + Weight::from_parts(1_051_000, 0) + // Standard Error: 912 + .saturating_add(Weight::from_parts(213_761, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. fn db_read_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `42 + c * (1024 ±0)` - // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_762_000 picoseconds. - Weight::from_parts(2_859_000, 3506) - // Standard Error: 813 - .saturating_add(Weight::from_parts(665_139, 0).saturating_mul(c.into())) + // Measured: `146 + c * (1024 ±0)` + // Estimated: `3610 + c * (1024 ±0)` + // Minimum execution time: 3_252_000 picoseconds. + Weight::from_parts(3_416_000, 3610) + // Standard Error: 1_261 + .saturating_add(Weight::from_parts(689_572, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -267,35 +267,35 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 50_591_000 picoseconds. - Weight::from_parts(61_353_023, 0) - // Standard Error: 9_186 - .saturating_add(Weight::from_parts(2_404_810, 0).saturating_mul(c.into())) + // Minimum execution time: 59_805_000 picoseconds. + Weight::from_parts(86_729_126, 0) + // Standard Error: 7_023 + .saturating_add(Weight::from_parts(2_475_519, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: - // Measured: `979` - // Estimated: `42236` - // Minimum execution time: 81_660_000 picoseconds. - Weight::from_parts(83_840_000, 42236) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(10_u64)) + // Measured: `1372` + // Estimated: `51905` + // Minimum execution time: 107_694_000 picoseconds. + Weight::from_parts(110_328_000, 51905) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(12_u64)) } fn pay_program_rent() -> Weight { // Proof Size summary in bytes: - // Measured: `886` - // Estimated: `21261` - // Minimum execution time: 54_005_000 picoseconds. - Weight::from_parts(55_095_000, 21261) + // Measured: `992` + // Estimated: `21579` + // Minimum execution time: 55_980_000 picoseconds. + Weight::from_parts(56_766_000, 21579) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } fn resume_session_init() -> Weight { // Proof Size summary in bytes: - // Measured: `534` - // Estimated: `17070` - // Minimum execution time: 28_880_000 picoseconds. - Weight::from_parts(29_583_000, 17070) + // Measured: `638` + // Estimated: `17486` + // Minimum execution time: 29_973_000 picoseconds. + Weight::from_parts(31_008_000, 17486) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -304,22 +304,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_744_000 picoseconds. - Weight::from_parts(4_233_092, 7640) - // Standard Error: 39_690 - .saturating_add(Weight::from_parts(14_033_179, 0).saturating_mul(c.into())) + // Minimum execution time: 8_054_000 picoseconds. + Weight::from_parts(8_342_000, 7640) + // Standard Error: 17_771 + .saturating_add(Weight::from_parts(13_335_661, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1297 + c * (16389 ±0)` - // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 70_301_000 picoseconds. - Weight::from_parts(70_991_000, 40898) - // Standard Error: 177_223 - .saturating_add(Weight::from_parts(54_687_249, 0).saturating_mul(c.into())) + // Measured: `1593 + c * (16389 ±0)` + // Estimated: `43266 + c * (131112 ±0)` + // Minimum execution time: 72_178_000 picoseconds. + Weight::from_parts(73_341_000, 43266) + // Standard Error: 167_723 + .saturating_add(Weight::from_parts(54_442_045, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -328,97 +328,97 @@ impl pallet_gear::WeightInfo for SubstrateWeight { /// The range of component `c` is `[0, 250]`. fn upload_code(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `10` - // Estimated: `4990` - // Minimum execution time: 61_715_000 picoseconds. - Weight::from_parts(40_384_385, 4990) - // Standard Error: 57_496 - .saturating_add(Weight::from_parts(53_210_788, 0).saturating_mul(c.into())) + // Measured: `113` + // Estimated: `5402` + // Minimum execution time: 78_662_000 picoseconds. + Weight::from_parts(42_066_175, 5402) + // Standard Error: 52_075 + .saturating_add(Weight::from_parts(60_249_549, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `671` - // Estimated: `38638` - // Minimum execution time: 63_077_000 picoseconds. - Weight::from_parts(96_840_506, 38638) - // Standard Error: 0 - .saturating_add(Weight::from_parts(2_609, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(10_u64)) + // Measured: `1111` + // Estimated: `50600` + // Minimum execution time: 94_321_000 picoseconds. + Weight::from_parts(129_113_540, 50600) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_625, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(12_u64)) } /// The range of component `c` is `[0, 250]`. /// The range of component `s` is `[0, 4194304]`. fn upload_program(c: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235` - // Estimated: `34312` - // Minimum execution time: 11_049_858_000 picoseconds. - Weight::from_parts(11_090_406_000, 34312) - // Standard Error: 517_330 - .saturating_add(Weight::from_parts(25_497_137, 0).saturating_mul(c.into())) - // Standard Error: 30 - .saturating_add(Weight::from_parts(910, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(14_u64)) + // Measured: `521` + // Estimated: `45152` + // Minimum execution time: 11_148_491_000 picoseconds. + Weight::from_parts(21_065_971, 45152) + // Standard Error: 173_883 + .saturating_add(Weight::from_parts(60_839_567, 0).saturating_mul(c.into())) + // Standard Error: 10 + .saturating_add(Weight::from_parts(2_652, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(16_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_message(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `348` - // Estimated: `23853` - // Minimum execution time: 56_305_000 picoseconds. - Weight::from_parts(38_705_997, 23853) + // Measured: `531` + // Estimated: `31266` + // Minimum execution time: 73_302_000 picoseconds. + Weight::from_parts(47_279_667, 31266) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_034, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(9_u64)) - .saturating_add(T::DbWeight::get().writes(8_u64)) + .saturating_add(Weight::from_parts(1_055, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `978` - // Estimated: `42227` - // Minimum execution time: 83_033_000 picoseconds. - Weight::from_parts(69_135_468, 42227) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(10_u64)) + // Measured: `1371` + // Estimated: `54435` + // Minimum execution time: 124_173_000 picoseconds. + Weight::from_parts(96_458_887, 54435) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_078, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(16_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `760` - // Estimated: `74319` - // Minimum execution time: 295_535_000 picoseconds. - Weight::from_parts(306_791_413, 74319) - // Standard Error: 1_111 - .saturating_add(Weight::from_parts(1_568, 0).saturating_mul(q.into())) - .saturating_add(T::DbWeight::get().reads(27_u64)) - .saturating_add(T::DbWeight::get().writes(22_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 365_983_000 picoseconds. + Weight::from_parts(387_416_952, 114612) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(26_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(_q: u32, ) -> Weight { + fn alloc_in_handle(q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `760` - // Estimated: `74319` - // Minimum execution time: 309_253_000 picoseconds. - Weight::from_parts(323_694_389, 74319) - .saturating_add(T::DbWeight::get().reads(27_u64)) - .saturating_add(T::DbWeight::get().writes(22_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 380_430_000 picoseconds. + Weight::from_parts(403_376_118, 114612) + // Standard Error: 2_451 + .saturating_add(Weight::from_parts(1_137, 0).saturating_mul(q.into())) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(26_u64)) } /// The range of component `c` is `[0, 512]`. fn reinstrument_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 44_806_000 picoseconds. - Weight::from_parts(45_498_000, 3899) - // Standard Error: 44_467 - .saturating_add(Weight::from_parts(54_603_581, 0).saturating_mul(c.into())) + // Minimum execution time: 58_080_000 picoseconds. + Weight::from_parts(58_601_000, 3899) + // Standard Error: 36_083 + .saturating_add(Weight::from_parts(58_395_643, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -428,630 +428,628 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_307_000 picoseconds. - Weight::from_parts(84_226_000, 0) - // Standard Error: 4_203_577 - .saturating_add(Weight::from_parts(574_493_471, 0).saturating_mul(r.into())) + // Minimum execution time: 91_412_000 picoseconds. + Weight::from_parts(94_168_000, 0) + // Standard Error: 3_806_298 + .saturating_add(Weight::from_parts(673_774_453, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 309_893_000 picoseconds. - Weight::from_parts(234_558_588, 0) - // Standard Error: 7_966 - .saturating_add(Weight::from_parts(32_022_587, 0).saturating_mul(p.into())) + // Minimum execution time: 452_549_000 picoseconds. + Weight::from_parts(398_963_700, 0) + // Standard Error: 7_042 + .saturating_add(Weight::from_parts(29_406_609, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 142_319_000 picoseconds. - Weight::from_parts(121_865_521, 0) - // Standard Error: 314_080 - .saturating_add(Weight::from_parts(64_422_856, 0).saturating_mul(r.into())) + // Minimum execution time: 207_052_000 picoseconds. + Weight::from_parts(209_606_478, 0) + // Standard Error: 255_281 + .saturating_add(Weight::from_parts(62_959_531, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_527_000 picoseconds. - Weight::from_parts(91_967_528, 0) - // Standard Error: 3_856 - .saturating_add(Weight::from_parts(2_363_669, 0).saturating_mul(r.into())) + // Minimum execution time: 97_729_000 picoseconds. + Weight::from_parts(105_964_750, 0) + // Standard Error: 4_847 + .saturating_add(Weight::from_parts(2_433_966, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 144_133_000 picoseconds. - Weight::from_parts(156_991_945, 0) - // Standard Error: 24_223 - .saturating_add(Weight::from_parts(2_431_525, 0).saturating_mul(r.into())) + // Minimum execution time: 175_010_000 picoseconds. + Weight::from_parts(229_153_209, 0) + // Standard Error: 17_116 + .saturating_add(Weight::from_parts(1_991_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_811_000 picoseconds. - Weight::from_parts(101_122_470, 0) - // Standard Error: 303_533 - .saturating_add(Weight::from_parts(92_415_204, 0).saturating_mul(r.into())) + // Minimum execution time: 94_696_000 picoseconds. + Weight::from_parts(119_674_535, 0) + // Standard Error: 387_178 + .saturating_add(Weight::from_parts(98_102_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_453_000 picoseconds. - Weight::from_parts(79_049_804, 0) - // Standard Error: 305_992 - .saturating_add(Weight::from_parts(79_382_630, 0).saturating_mul(r.into())) + // Minimum execution time: 95_794_000 picoseconds. + Weight::from_parts(89_931_979, 0) + // Standard Error: 371_349 + .saturating_add(Weight::from_parts(86_524_059, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_650_000 picoseconds. - Weight::from_parts(79_085_060, 0) - // Standard Error: 293_080 - .saturating_add(Weight::from_parts(77_346_019, 0).saturating_mul(r.into())) + // Minimum execution time: 97_924_000 picoseconds. + Weight::from_parts(84_041_201, 0) + // Standard Error: 327_841 + .saturating_add(Weight::from_parts(95_483_315, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_545_000 picoseconds. - Weight::from_parts(72_777_984, 0) - // Standard Error: 351_302 - .saturating_add(Weight::from_parts(80_634_984, 0).saturating_mul(r.into())) + // Minimum execution time: 97_122_000 picoseconds. + Weight::from_parts(86_789_268, 0) + // Standard Error: 353_259 + .saturating_add(Weight::from_parts(85_698_317, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_245_000 picoseconds. - Weight::from_parts(76_181_868, 0) - // Standard Error: 354_266 - .saturating_add(Weight::from_parts(79_459_120, 0).saturating_mul(r.into())) + // Minimum execution time: 94_821_000 picoseconds. + Weight::from_parts(92_694_130, 0) + // Standard Error: 340_146 + .saturating_add(Weight::from_parts(84_623_945, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_064_000 picoseconds. - Weight::from_parts(77_882_516, 0) - // Standard Error: 377_997 - .saturating_add(Weight::from_parts(78_533_852, 0).saturating_mul(r.into())) + // Minimum execution time: 93_840_000 picoseconds. + Weight::from_parts(87_888_572, 0) + // Standard Error: 369_465 + .saturating_add(Weight::from_parts(85_638_902, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_522_000 picoseconds. - Weight::from_parts(66_328_137, 0) - // Standard Error: 360_143 - .saturating_add(Weight::from_parts(79_838_604, 0).saturating_mul(r.into())) + // Minimum execution time: 98_597_000 picoseconds. + Weight::from_parts(86_642_386, 0) + // Standard Error: 362_257 + .saturating_add(Weight::from_parts(85_598_887, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_961_000 picoseconds. - Weight::from_parts(72_789_065, 0) - // Standard Error: 366_577 - .saturating_add(Weight::from_parts(79_031_060, 0).saturating_mul(r.into())) + // Minimum execution time: 94_546_000 picoseconds. + Weight::from_parts(91_466_289, 0) + // Standard Error: 344_423 + .saturating_add(Weight::from_parts(84_318_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_686_000 picoseconds. - Weight::from_parts(749_297_529, 0) - // Standard Error: 383_897 - .saturating_add(Weight::from_parts(132_242_102, 0).saturating_mul(r.into())) + // Minimum execution time: 578_036_000 picoseconds. + Weight::from_parts(696_140_951, 0) + // Standard Error: 559_498 + .saturating_add(Weight::from_parts(149_397_501, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 830_957_000 picoseconds. - Weight::from_parts(850_017_000, 0) - // Standard Error: 67_693 - .saturating_add(Weight::from_parts(13_570_326, 0).saturating_mul(n.into())) + // Minimum execution time: 723_788_000 picoseconds. + Weight::from_parts(740_225_000, 0) + // Standard Error: 52_895 + .saturating_add(Weight::from_parts(13_188_120, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_261_000 picoseconds. - Weight::from_parts(70_573_139, 0) - // Standard Error: 351_239 - .saturating_add(Weight::from_parts(80_441_776, 0).saturating_mul(r.into())) + // Minimum execution time: 99_012_000 picoseconds. + Weight::from_parts(88_269_135, 0) + // Standard Error: 296_136 + .saturating_add(Weight::from_parts(92_296_104, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_164_000 picoseconds. - Weight::from_parts(70_866_987, 0) - // Standard Error: 346_107 - .saturating_add(Weight::from_parts(82_471_591, 0).saturating_mul(r.into())) + // Minimum execution time: 93_803_000 picoseconds. + Weight::from_parts(87_097_769, 0) + // Standard Error: 367_325 + .saturating_add(Weight::from_parts(84_987_043, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_192_000 picoseconds. - Weight::from_parts(101_814_078, 0) - // Standard Error: 391_508 - .saturating_add(Weight::from_parts(166_873_282, 0).saturating_mul(n.into())) + // Minimum execution time: 96_663_000 picoseconds. + Weight::from_parts(105_357_427, 0) + // Standard Error: 366_135 + .saturating_add(Weight::from_parts(172_109_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_974_000 picoseconds. - Weight::from_parts(87_244_000, 0) - // Standard Error: 3_619_557 - .saturating_add(Weight::from_parts(749_950_767, 0).saturating_mul(r.into())) + // Minimum execution time: 99_210_000 picoseconds. + Weight::from_parts(102_217_000, 0) + // Standard Error: 4_527_119 + .saturating_add(Weight::from_parts(845_784_967, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_612_000 picoseconds. - Weight::from_parts(147_822_399, 0) - // Standard Error: 421_408 - .saturating_add(Weight::from_parts(250_730_230, 0).saturating_mul(r.into())) + // Minimum execution time: 96_579_000 picoseconds. + Weight::from_parts(162_452_429, 0) + // Standard Error: 416_836 + .saturating_add(Weight::from_parts(257_900_517, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 332_130_000 picoseconds. - Weight::from_parts(337_780_000, 0) - // Standard Error: 52_652 - .saturating_add(Weight::from_parts(20_743_155, 0).saturating_mul(n.into())) + // Minimum execution time: 353_526_000 picoseconds. + Weight::from_parts(358_025_000, 0) + // Standard Error: 61_984 + .saturating_add(Weight::from_parts(21_521_461, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_722_000 picoseconds. - Weight::from_parts(147_881_270, 0) - // Standard Error: 390_429 - .saturating_add(Weight::from_parts(259_701_373, 0).saturating_mul(r.into())) + // Minimum execution time: 94_822_000 picoseconds. + Weight::from_parts(168_431_611, 0) + // Standard Error: 378_696 + .saturating_add(Weight::from_parts(263_135_958, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 337_753_000 picoseconds. - Weight::from_parts(343_454_000, 0) - // Standard Error: 66_604 - .saturating_add(Weight::from_parts(21_189_034, 0).saturating_mul(n.into())) + // Minimum execution time: 351_828_000 picoseconds. + Weight::from_parts(355_382_000, 0) + // Standard Error: 60_589 + .saturating_add(Weight::from_parts(21_325_400, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 708_454_000 picoseconds. - Weight::from_parts(775_673_824, 0) - // Standard Error: 380_634 - .saturating_add(Weight::from_parts(268_253_890, 0).saturating_mul(r.into())) + // Minimum execution time: 569_384_000 picoseconds. + Weight::from_parts(638_474_730, 0) + // Standard Error: 425_903 + .saturating_add(Weight::from_parts(275_691_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_799_000 picoseconds. - Weight::from_parts(782_052_003, 0) - // Standard Error: 385_065 - .saturating_add(Weight::from_parts(265_280_556, 0).saturating_mul(r.into())) + // Minimum execution time: 573_053_000 picoseconds. + Weight::from_parts(640_078_802, 0) + // Standard Error: 475_389 + .saturating_add(Weight::from_parts(284_337_155, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_511_000 picoseconds. - Weight::from_parts(61_459_678, 0) - // Standard Error: 362_497 - .saturating_add(Weight::from_parts(87_903_947, 0).saturating_mul(r.into())) + // Minimum execution time: 98_223_000 picoseconds. + Weight::from_parts(85_732_985, 0) + // Standard Error: 336_308 + .saturating_add(Weight::from_parts(92_936_006, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_676_718_000 picoseconds. - Weight::from_parts(1_838_206_733, 0) - // Standard Error: 440_793 - .saturating_add(Weight::from_parts(156_352_100, 0).saturating_mul(r.into())) + // Minimum execution time: 1_822_621_000 picoseconds. + Weight::from_parts(1_951_955_018, 0) + // Standard Error: 339_415 + .saturating_add(Weight::from_parts(157_557_756, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 284_222_000 picoseconds. - Weight::from_parts(293_316_000, 0) - // Standard Error: 54_796 - .saturating_add(Weight::from_parts(30_939_288, 0).saturating_mul(n.into())) + // Minimum execution time: 314_296_000 picoseconds. + Weight::from_parts(317_522_000, 0) + // Standard Error: 61_360 + .saturating_add(Weight::from_parts(29_499_741, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_682_466_000 picoseconds. - Weight::from_parts(1_829_413_701, 0) - // Standard Error: 510_421 - .saturating_add(Weight::from_parts(216_009_232, 0).saturating_mul(r.into())) + // Minimum execution time: 1_835_106_000 picoseconds. + Weight::from_parts(1_948_516_646, 0) + // Standard Error: 382_008 + .saturating_add(Weight::from_parts(214_812_508, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_681_160_000 picoseconds. - Weight::from_parts(1_819_797_788, 0) - // Standard Error: 453_707 - .saturating_add(Weight::from_parts(215_589_534, 0).saturating_mul(r.into())) + // Minimum execution time: 1_827_496_000 picoseconds. + Weight::from_parts(1_949_190_773, 0) + // Standard Error: 340_175 + .saturating_add(Weight::from_parts(218_001_536, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 242_556_000 picoseconds. - Weight::from_parts(314_306_159, 0) - // Standard Error: 376_142 - .saturating_add(Weight::from_parts(260_614_468, 0).saturating_mul(r.into())) + // Minimum execution time: 264_306_000 picoseconds. + Weight::from_parts(363_536_651, 0) + // Standard Error: 467_914 + .saturating_add(Weight::from_parts(265_564_072, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 495_430_000 picoseconds. - Weight::from_parts(502_714_000, 0) - // Standard Error: 52_049 - .saturating_add(Weight::from_parts(21_259_132, 0).saturating_mul(n.into())) + // Minimum execution time: 523_150_000 picoseconds. + Weight::from_parts(535_842_000, 0) + // Standard Error: 65_412 + .saturating_add(Weight::from_parts(21_698_063, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_809_658_000 picoseconds. - Weight::from_parts(2_002_681_446, 0) - // Standard Error: 414_919 - .saturating_add(Weight::from_parts(227_942_929, 0).saturating_mul(r.into())) + // Minimum execution time: 1_974_743_000 picoseconds. + Weight::from_parts(2_096_494_995, 0) + // Standard Error: 474_778 + .saturating_add(Weight::from_parts(232_524_299, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_821_000 picoseconds. - Weight::from_parts(84_783_126, 0) - // Standard Error: 234_696 - .saturating_add(Weight::from_parts(22_124_873, 0).saturating_mul(r.into())) + // Minimum execution time: 94_139_000 picoseconds. + Weight::from_parts(101_775_569, 0) + // Standard Error: 452_439 + .saturating_add(Weight::from_parts(16_839_430, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_040_000 picoseconds. - Weight::from_parts(92_861_700, 0) - // Standard Error: 1_021 - .saturating_add(Weight::from_parts(419_414, 0).saturating_mul(n.into())) + // Minimum execution time: 112_050_000 picoseconds. + Weight::from_parts(102_205_366, 0) + // Standard Error: 1_008 + .saturating_add(Weight::from_parts(431_304, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_986_000 picoseconds. - Weight::from_parts(85_723_530, 0) - // Standard Error: 278_519 - .saturating_add(Weight::from_parts(19_484_469, 0).saturating_mul(r.into())) + // Minimum execution time: 93_528_000 picoseconds. + Weight::from_parts(99_748_422, 0) + // Standard Error: 396_992 + .saturating_add(Weight::from_parts(20_536_877, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_879_000 picoseconds. - Weight::from_parts(88_056_044, 0) - // Standard Error: 1_087 - .saturating_add(Weight::from_parts(427_201, 0).saturating_mul(n.into())) + // Minimum execution time: 117_832_000 picoseconds. + Weight::from_parts(104_552_847, 0) + // Standard Error: 1_402 + .saturating_add(Weight::from_parts(432_018, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_548_000 picoseconds. - Weight::from_parts(84_139_208, 0) - // Standard Error: 235_150 - .saturating_add(Weight::from_parts(17_533_491, 0).saturating_mul(r.into())) + // Minimum execution time: 93_325_000 picoseconds. + Weight::from_parts(101_074_097, 0) + // Standard Error: 454_790 + .saturating_add(Weight::from_parts(20_838_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_118_000 picoseconds. - Weight::from_parts(88_086_604, 0) - // Standard Error: 244_958 - .saturating_add(Weight::from_parts(17_286_195, 0).saturating_mul(r.into())) + // Minimum execution time: 93_800_000 picoseconds. + Weight::from_parts(102_249_326, 0) + // Standard Error: 463_488 + .saturating_add(Weight::from_parts(15_991_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_393_000 picoseconds. - Weight::from_parts(132_631_342, 0) - // Standard Error: 436_134 - .saturating_add(Weight::from_parts(141_520_417, 0).saturating_mul(r.into())) + // Minimum execution time: 93_153_000 picoseconds. + Weight::from_parts(121_452_989, 0) + // Standard Error: 390_540 + .saturating_add(Weight::from_parts(145_641_178, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_567_000 picoseconds. - Weight::from_parts(99_600_000, 0) - // Standard Error: 2_187 - .saturating_add(Weight::from_parts(639_729, 0).saturating_mul(n.into())) + // Minimum execution time: 115_529_000 picoseconds. + Weight::from_parts(120_413_000, 0) + // Standard Error: 3_105 + .saturating_add(Weight::from_parts(640_863, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 696_739_000 picoseconds. - Weight::from_parts(711_247_336, 0) - // Standard Error: 1_403_605 - .saturating_add(Weight::from_parts(15_869_663, 0).saturating_mul(r.into())) + // Minimum execution time: 566_859_000 picoseconds. + Weight::from_parts(631_111_316, 0) + // Standard Error: 7_012_228 + .saturating_add(Weight::from_parts(21_896_983, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. - fn gr_reply_input_wgas(r: u32, ) -> Weight { + fn gr_reply_input_wgas(_r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 697_432_000 picoseconds. - Weight::from_parts(712_096_565, 0) - // Standard Error: 1_674_352 - .saturating_add(Weight::from_parts(32_103_934, 0).saturating_mul(r.into())) + // Minimum execution time: 565_382_000 picoseconds. + Weight::from_parts(613_048_008, 0) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_685_000 picoseconds. - Weight::from_parts(96_156_389, 0) - // Standard Error: 262_969 - .saturating_add(Weight::from_parts(8_983_510, 0).saturating_mul(r.into())) + // Minimum execution time: 104_401_000 picoseconds. + Weight::from_parts(112_651_320, 0) + // Standard Error: 438_590 + .saturating_add(Weight::from_parts(11_095_379, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_746_000 picoseconds. - Weight::from_parts(89_918_273, 0) - // Standard Error: 1_055 - .saturating_add(Weight::from_parts(427_838, 0).saturating_mul(n.into())) + // Minimum execution time: 115_615_000 picoseconds. + Weight::from_parts(112_987_750, 0) + // Standard Error: 960 + .saturating_add(Weight::from_parts(423_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_634_000 picoseconds. - Weight::from_parts(99_574_926, 0) - // Standard Error: 267_301 - .saturating_add(Weight::from_parts(3_125_673, 0).saturating_mul(r.into())) + // Minimum execution time: 105_056_000 picoseconds. + Weight::from_parts(113_735_922, 0) + // Standard Error: 466_586 + .saturating_add(Weight::from_parts(5_305_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 99_268_000 picoseconds. - Weight::from_parts(93_140_981, 0) - // Standard Error: 1_101 - .saturating_add(Weight::from_parts(419_078, 0).saturating_mul(n.into())) + // Minimum execution time: 113_897_000 picoseconds. + Weight::from_parts(112_616_408, 0) + // Standard Error: 1_722 + .saturating_add(Weight::from_parts(428_420, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_167_000 picoseconds. - Weight::from_parts(80_305_860, 0) - // Standard Error: 357_986 - .saturating_add(Weight::from_parts(80_422_820, 0).saturating_mul(r.into())) + // Minimum execution time: 93_845_000 picoseconds. + Weight::from_parts(97_247_314, 0) + // Standard Error: 366_814 + .saturating_add(Weight::from_parts(85_900_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_137_000 picoseconds. - Weight::from_parts(76_881_656, 0) - // Standard Error: 302_504 - .saturating_add(Weight::from_parts(80_036_963, 0).saturating_mul(r.into())) + // Minimum execution time: 93_761_000 picoseconds. + Weight::from_parts(92_637_129, 0) + // Standard Error: 309_799 + .saturating_add(Weight::from_parts(85_725_727, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_922_000 picoseconds. - Weight::from_parts(767_820_244, 0) - // Standard Error: 418_647 - .saturating_add(Weight::from_parts(97_993_049, 0).saturating_mul(r.into())) + // Minimum execution time: 565_388_000 picoseconds. + Weight::from_parts(606_358_854, 0) + // Standard Error: 430_766 + .saturating_add(Weight::from_parts(108_769_267, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 724_683_000 picoseconds. - Weight::from_parts(732_157_836, 0) - // Standard Error: 618 - .saturating_add(Weight::from_parts(151_809, 0).saturating_mul(n.into())) + // Minimum execution time: 591_660_000 picoseconds. + Weight::from_parts(597_035_528, 0) + // Standard Error: 2_641 + .saturating_add(Weight::from_parts(153_781, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_304_055_000 picoseconds. - Weight::from_parts(2_435_844_780, 0) - // Standard Error: 420_214 - .saturating_add(Weight::from_parts(120_405_108, 0).saturating_mul(r.into())) + // Minimum execution time: 2_317_147_000 picoseconds. + Weight::from_parts(2_514_940_964, 0) + // Standard Error: 546_319 + .saturating_add(Weight::from_parts(128_825_542, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_431_524_000 picoseconds. - Weight::from_parts(2_669_711_936, 0) - // Standard Error: 12_819 - .saturating_add(Weight::from_parts(13_546_418, 0).saturating_mul(n.into())) + // Minimum execution time: 2_560_344_000 picoseconds. + Weight::from_parts(2_512_409_449, 0) + // Standard Error: 15_466 + .saturating_add(Weight::from_parts(12_395_144, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_238_000 picoseconds. - Weight::from_parts(104_905_012, 0) - // Standard Error: 392_000 - .saturating_add(Weight::from_parts(116_570_175, 0).saturating_mul(r.into())) + // Minimum execution time: 97_996_000 picoseconds. + Weight::from_parts(130_630_238, 0) + // Standard Error: 414_418 + .saturating_add(Weight::from_parts(114_735_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 143_132_000 picoseconds. - Weight::from_parts(145_448_000, 0) - // Standard Error: 51_056 - .saturating_add(Weight::from_parts(25_497_066, 0).saturating_mul(n.into())) + // Minimum execution time: 157_513_000 picoseconds. + Weight::from_parts(160_584_000, 0) + // Standard Error: 57_227 + .saturating_add(Weight::from_parts(25_738_939, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_055_000 picoseconds. - Weight::from_parts(75_514_507, 0) - // Standard Error: 342_511 - .saturating_add(Weight::from_parts(78_022_368, 0).saturating_mul(r.into())) + // Minimum execution time: 92_652_000 picoseconds. + Weight::from_parts(88_138_429, 0) + // Standard Error: 330_537 + .saturating_add(Weight::from_parts(83_235_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_725_000 picoseconds. - Weight::from_parts(87_574_873, 0) - // Standard Error: 249_331 - .saturating_add(Weight::from_parts(24_890_126, 0).saturating_mul(r.into())) + // Minimum execution time: 93_824_000 picoseconds. + Weight::from_parts(102_740_497, 0) + // Standard Error: 428_593 + .saturating_add(Weight::from_parts(23_682_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_761_000 picoseconds. - Weight::from_parts(86_511_404, 0) - // Standard Error: 240_746 - .saturating_add(Weight::from_parts(16_767_395, 0).saturating_mul(r.into())) + // Minimum execution time: 92_530_000 picoseconds. + Weight::from_parts(101_410_861, 0) + // Standard Error: 432_236 + .saturating_add(Weight::from_parts(12_196_938, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_794_000 picoseconds. - Weight::from_parts(88_401_167, 0) - // Standard Error: 217_438 - .saturating_add(Weight::from_parts(11_267_632, 0).saturating_mul(r.into())) + // Minimum execution time: 93_402_000 picoseconds. + Weight::from_parts(102_285_877, 0) + // Standard Error: 466_463 + .saturating_add(Weight::from_parts(13_156_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_664_000 picoseconds. - Weight::from_parts(89_193_048, 0) - // Standard Error: 336_699 - .saturating_add(Weight::from_parts(12_350_251, 0).saturating_mul(r.into())) + // Minimum execution time: 95_706_000 picoseconds. + Weight::from_parts(102_513_059, 0) + // Standard Error: 464_787 + .saturating_add(Weight::from_parts(13_986_540, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_815_000 picoseconds. - Weight::from_parts(87_397_869, 0) - // Standard Error: 235_037 - .saturating_add(Weight::from_parts(16_313_030, 0).saturating_mul(r.into())) + // Minimum execution time: 93_057_000 picoseconds. + Weight::from_parts(99_083_869, 0) + // Standard Error: 378_747 + .saturating_add(Weight::from_parts(12_230_330, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_190_000 picoseconds. - Weight::from_parts(186_267_428, 0) - // Standard Error: 346_204 - .saturating_add(Weight::from_parts(158_103_512, 0).saturating_mul(r.into())) + // Minimum execution time: 177_947_000 picoseconds. + Weight::from_parts(226_692_243, 0) + // Standard Error: 265_725 + .saturating_add(Weight::from_parts(156_938_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_748_000 picoseconds. - Weight::from_parts(148_556_306, 0) - // Standard Error: 400_680 - .saturating_add(Weight::from_parts(333_100_790, 0).saturating_mul(r.into())) + // Minimum execution time: 107_346_000 picoseconds. + Weight::from_parts(160_631_540, 0) + // Standard Error: 352_753 + .saturating_add(Weight::from_parts(338_685_448, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1059,22 +1057,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 44_452_286_000 picoseconds. - Weight::from_parts(44_568_744_000, 0) - // Standard Error: 268_880 - .saturating_add(Weight::from_parts(7_444_126, 0).saturating_mul(p.into())) - // Standard Error: 268_867 - .saturating_add(Weight::from_parts(179_724_917, 0).saturating_mul(s.into())) + // Minimum execution time: 44_754_074_000 picoseconds. + Weight::from_parts(44_833_050_000, 0) + // Standard Error: 269_308 + .saturating_add(Weight::from_parts(7_629_892, 0).saturating_mul(p.into())) + // Standard Error: 269_294 + .saturating_add(Weight::from_parts(179_148_245, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_042_000 picoseconds. - Weight::from_parts(163_443_462, 0) - // Standard Error: 381_777 - .saturating_add(Weight::from_parts(338_839_702, 0).saturating_mul(r.into())) + // Minimum execution time: 108_278_000 picoseconds. + Weight::from_parts(161_208_126, 0) + // Standard Error: 368_644 + .saturating_add(Weight::from_parts(346_324_329, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1082,32 +1080,32 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_724_116_000 picoseconds. - Weight::from_parts(42_849_968_000, 0) - // Standard Error: 263_445 - .saturating_add(Weight::from_parts(8_197_177, 0).saturating_mul(p.into())) - // Standard Error: 263_432 - .saturating_add(Weight::from_parts(180_050_572, 0).saturating_mul(s.into())) + // Minimum execution time: 44_266_209_000 picoseconds. + Weight::from_parts(44_559_345_000, 0) + // Standard Error: 270_420 + .saturating_add(Weight::from_parts(7_460_172, 0).saturating_mul(p.into())) + // Standard Error: 270_407 + .saturating_add(Weight::from_parts(179_211_260, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_607_000 picoseconds. - Weight::from_parts(100_957_693, 0) - // Standard Error: 29_067 - .saturating_add(Weight::from_parts(1_762_813, 0).saturating_mul(r.into())) + // Minimum execution time: 94_889_000 picoseconds. + Weight::from_parts(115_310_524, 0) + // Standard Error: 34_049 + .saturating_add(Weight::from_parts(1_916_607, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_305_000 picoseconds. - Weight::from_parts(108_825_748, 1131) - // Standard Error: 5_956 - .saturating_add(Weight::from_parts(11_809_647, 0).saturating_mul(p.into())) + // Minimum execution time: 97_825_000 picoseconds. + Weight::from_parts(251_440_245, 1131) + // Standard Error: 70_641 + .saturating_add(Weight::from_parts(15_652_952, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1116,10 +1114,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_531_000 picoseconds. - Weight::from_parts(88_749_000, 1131) - // Standard Error: 27_438 - .saturating_add(Weight::from_parts(35_435_114, 0).saturating_mul(p.into())) + // Minimum execution time: 96_761_000 picoseconds. + Weight::from_parts(100_398_000, 1131) + // Standard Error: 45_532 + .saturating_add(Weight::from_parts(39_790_625, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1128,10 +1126,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_087_078_000 picoseconds. - Weight::from_parts(5_882_681_000, 5069931) - // Standard Error: 87_545 - .saturating_add(Weight::from_parts(37_047_042, 0).saturating_mul(p.into())) + // Minimum execution time: 7_471_807_000 picoseconds. + Weight::from_parts(7_440_591_962, 5069931) + // Standard Error: 168_373 + .saturating_add(Weight::from_parts(40_244_359, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1139,10 +1137,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_432_000 picoseconds. - Weight::from_parts(87_001_000, 1939) - // Standard Error: 47_768 - .saturating_add(Weight::from_parts(47_598_234, 0).saturating_mul(p.into())) + // Minimum execution time: 97_303_000 picoseconds. + Weight::from_parts(98_185_000, 1939) + // Standard Error: 38_471 + .saturating_add(Weight::from_parts(55_016_921, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1151,10 +1149,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 92_594_000 picoseconds. - Weight::from_parts(93_795_036, 1131) - // Standard Error: 53_549 - .saturating_add(Weight::from_parts(35_797_869, 0).saturating_mul(p.into())) + // Minimum execution time: 102_497_000 picoseconds. + Weight::from_parts(104_932_685, 1131) + // Standard Error: 78_974 + .saturating_add(Weight::from_parts(39_257_150, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1163,10 +1161,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 769_397_000 picoseconds. - Weight::from_parts(792_321_925, 1496) - // Standard Error: 237_986 - .saturating_add(Weight::from_parts(48_847_504, 0).saturating_mul(p.into())) + // Minimum execution time: 612_308_000 picoseconds. + Weight::from_parts(642_079_999, 1496) + // Standard Error: 357_245 + .saturating_add(Weight::from_parts(46_518_860, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1175,10 +1173,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_113_735_000 picoseconds. - Weight::from_parts(1_148_020_828, 317931) - // Standard Error: 167_371 - .saturating_add(Weight::from_parts(47_795_831, 0).saturating_mul(p.into())) + // Minimum execution time: 1_068_248_000 picoseconds. + Weight::from_parts(1_080_741_205, 317931) + // Standard Error: 262_216 + .saturating_add(Weight::from_parts(50_047_907, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1186,885 +1184,883 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_154_000 picoseconds. - Weight::from_parts(4_280_364, 0) - // Standard Error: 8_638 - .saturating_add(Weight::from_parts(24_150_721, 0).saturating_mul(r.into())) + // Minimum execution time: 3_099_000 picoseconds. + Weight::from_parts(6_340_084, 0) + // Standard Error: 180_257 + .saturating_add(Weight::from_parts(74_666_091, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_339_689_000 picoseconds. - Weight::from_parts(4_202_598_633, 0) - // Standard Error: 74_721 - .saturating_add(Weight::from_parts(4_468_109, 0).saturating_mul(r.into())) + // Minimum execution time: 4_391_547_000 picoseconds. + Weight::from_parts(4_140_785_425, 0) + // Standard Error: 89_369 + .saturating_add(Weight::from_parts(5_769_622, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_343_068_000 picoseconds. - Weight::from_parts(4_226_706_212, 0) - // Standard Error: 60_538 - .saturating_add(Weight::from_parts(4_325_162, 0).saturating_mul(r.into())) + // Minimum execution time: 4_386_802_000 picoseconds. + Weight::from_parts(4_243_536_456, 0) + // Standard Error: 95_210 + .saturating_add(Weight::from_parts(5_278_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_409_473_000 picoseconds. - Weight::from_parts(11_882_222_938, 0) - // Standard Error: 194_167 - .saturating_add(Weight::from_parts(8_210_890, 0).saturating_mul(r.into())) + // Minimum execution time: 11_072_272_000 picoseconds. + Weight::from_parts(11_558_306_225, 0) + // Standard Error: 165_659 + .saturating_add(Weight::from_parts(9_828_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_212_512_000 picoseconds. - Weight::from_parts(10_628_957_808, 0) - // Standard Error: 170_508 - .saturating_add(Weight::from_parts(11_560_237, 0).saturating_mul(r.into())) + // Minimum execution time: 10_285_071_000 picoseconds. + Weight::from_parts(11_137_621_942, 0) + // Standard Error: 147_513 + .saturating_add(Weight::from_parts(9_014_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_229_000 picoseconds. - Weight::from_parts(2_319_000, 0) - // Standard Error: 9_576 - .saturating_add(Weight::from_parts(3_794_717, 0).saturating_mul(r.into())) + // Minimum execution time: 2_285_000 picoseconds. + Weight::from_parts(2_410_000, 0) + // Standard Error: 7_624 + .saturating_add(Weight::from_parts(3_864_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_265_000 picoseconds. - Weight::from_parts(2_353_000, 0) - // Standard Error: 5_018 - .saturating_add(Weight::from_parts(3_059_511, 0).saturating_mul(r.into())) + // Minimum execution time: 2_342_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 6_413 + .saturating_add(Weight::from_parts(3_120_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(3_531_925, 0) - // Standard Error: 1_167 - .saturating_add(Weight::from_parts(1_569_201, 0).saturating_mul(r.into())) + // Minimum execution time: 2_301_000 picoseconds. + Weight::from_parts(3_591_730, 0) + // Standard Error: 1_106 + .saturating_add(Weight::from_parts(1_565_415, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_359_000, 0) - // Standard Error: 9_672 - .saturating_add(Weight::from_parts(2_884_305, 0).saturating_mul(r.into())) + // Minimum execution time: 2_306_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 7_711 + .saturating_add(Weight::from_parts(2_932_880, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 8_373 - .saturating_add(Weight::from_parts(5_256_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_358_000 picoseconds. + Weight::from_parts(2_144_801, 0) + // Standard Error: 22_082 + .saturating_add(Weight::from_parts(5_266_139, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_012_000 picoseconds. - Weight::from_parts(4_938_253, 0) - // Standard Error: 2_214 - .saturating_add(Weight::from_parts(151_870, 0).saturating_mul(e.into())) + // Minimum execution time: 6_803_000 picoseconds. + Weight::from_parts(5_374_690, 0) + // Standard Error: 1_699 + .saturating_add(Weight::from_parts(171_193, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_309_000 picoseconds. - Weight::from_parts(4_232_448, 0) - // Standard Error: 6_359 - .saturating_add(Weight::from_parts(2_596_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_431_000 picoseconds. + Weight::from_parts(4_875_813, 0) + // Standard Error: 8_258 + .saturating_add(Weight::from_parts(2_629_733, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_596_672 - - 2_404_212, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_629_733 - + 2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(4_432_470, 0) - // Standard Error: 11_941 - .saturating_add(Weight::from_parts(2_404_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(5_140_243, 0) + // Standard Error: 13_164 + .saturating_add(Weight::from_parts(2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_776_000 picoseconds. - Weight::from_parts(12_954_286, 0) - // Standard Error: 30_568 - .saturating_add(Weight::from_parts(10_260_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_669_000 picoseconds. + Weight::from_parts(22_369_265, 0) + // Standard Error: 28_577 + .saturating_add(Weight::from_parts(9_740_558, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_935_000 picoseconds. - Weight::from_parts(1_635_475, 0) - // Standard Error: 7_669 - .saturating_add(Weight::from_parts(1_285_084, 0).saturating_mul(p.into())) + // Minimum execution time: 12_277_000 picoseconds. + Weight::from_parts(3_596_853, 0) + // Standard Error: 5_869 + .saturating_add(Weight::from_parts(1_258_605, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(l: u32, ) -> Weight { + fn instr_call_per_local(_l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_316_000 picoseconds. - Weight::from_parts(5_699_758, 0) - // Standard Error: 13 - .saturating_add(Weight::from_parts(34, 0).saturating_mul(l.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(5_778_137, 0) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_315_000 picoseconds. - Weight::from_parts(2_460_643, 0) - // Standard Error: 2_850 - .saturating_add(Weight::from_parts(235_587, 0).saturating_mul(r.into())) + // Minimum execution time: 4_835_000 picoseconds. + Weight::from_parts(6_065_483, 0) + // Standard Error: 3_006 + .saturating_add(Weight::from_parts(378_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 6_150 - .saturating_add(Weight::from_parts(730_523, 0).saturating_mul(r.into())) + // Minimum execution time: 4_722_000 picoseconds. + Weight::from_parts(3_902_309, 0) + // Standard Error: 5_742 + .saturating_add(Weight::from_parts(1_056_408, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_338_000, 0) - // Standard Error: 5_205 - .saturating_add(Weight::from_parts(679_669, 0).saturating_mul(r.into())) + // Minimum execution time: 4_888_000 picoseconds. + Weight::from_parts(4_512_058, 0) + // Standard Error: 6_410 + .saturating_add(Weight::from_parts(1_001_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_412_000 picoseconds. - Weight::from_parts(2_087_064, 0) - // Standard Error: 9_824 - .saturating_add(Weight::from_parts(743_737, 0).saturating_mul(r.into())) + // Minimum execution time: 6_413_000 picoseconds. + Weight::from_parts(2_704_134, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(804_200, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_388_000 picoseconds. - Weight::from_parts(6_512_000, 0) - // Standard Error: 7_958 - .saturating_add(Weight::from_parts(1_283_588, 0).saturating_mul(r.into())) + // Minimum execution time: 6_516_000 picoseconds. + Weight::from_parts(1_028_752, 0) + // Standard Error: 8_792 + .saturating_add(Weight::from_parts(1_494_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_885_000 picoseconds. - Weight::from_parts(4_075_795, 0) - // Standard Error: 12_241 - .saturating_add(Weight::from_parts(6_965_908, 0).saturating_mul(r.into())) + // Minimum execution time: 5_560_000 picoseconds. + Weight::from_parts(1_126_442, 0) + // Standard Error: 14_476 + .saturating_add(Weight::from_parts(7_240_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 5_936 - .saturating_add(Weight::from_parts(3_299_707, 0).saturating_mul(r.into())) + // Minimum execution time: 2_299_000 picoseconds. + Weight::from_parts(2_449_000, 0) + // Standard Error: 7_416 + .saturating_add(Weight::from_parts(3_344_387, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 6_255 - .saturating_add(Weight::from_parts(2_999_382, 0).saturating_mul(r.into())) + // Minimum execution time: 2_389_000 picoseconds. + Weight::from_parts(2_551_000, 0) + // Standard Error: 5_708 + .saturating_add(Weight::from_parts(3_133_430, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 6_896 - .saturating_add(Weight::from_parts(2_967_047, 0).saturating_mul(r.into())) + // Minimum execution time: 2_428_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 7_262 + .saturating_add(Weight::from_parts(3_192_675, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 4_893 - .saturating_add(Weight::from_parts(2_579_110, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(2_426_000, 0) + // Standard Error: 4_554 + .saturating_add(Weight::from_parts(2_683_293, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_304_000, 0) - // Standard Error: 3_852 - .saturating_add(Weight::from_parts(520_005, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 4_686 + .saturating_add(Weight::from_parts(631_609, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_274_000 picoseconds. - Weight::from_parts(1_794_591, 0) - // Standard Error: 3_416 - .saturating_add(Weight::from_parts(359_819, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(1_221_890, 0) + // Standard Error: 3_960 + .saturating_add(Weight::from_parts(452_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_287_000, 0) - // Standard Error: 10_307 - .saturating_add(Weight::from_parts(1_833_775, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_390_000, 0) + // Standard Error: 11_114 + .saturating_add(Weight::from_parts(1_916_122, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(2_349_000, 0) - // Standard Error: 9_393 - .saturating_add(Weight::from_parts(1_178_942, 0).saturating_mul(r.into())) + // Minimum execution time: 2_436_000 picoseconds. + Weight::from_parts(2_504_000, 0) + // Standard Error: 7_104 + .saturating_add(Weight::from_parts(1_156_958, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_256_508, 0) - // Standard Error: 3_133 - .saturating_add(Weight::from_parts(326_908, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(1_708_596, 0) + // Standard Error: 2_843 + .saturating_add(Weight::from_parts(377_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_298_000 picoseconds. - Weight::from_parts(1_792_383, 0) - // Standard Error: 2_981 - .saturating_add(Weight::from_parts(325_072, 0).saturating_mul(r.into())) + // Minimum execution time: 2_386_000 picoseconds. + Weight::from_parts(1_424_415, 0) + // Standard Error: 3_599 + .saturating_add(Weight::from_parts(395_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(236_190, 0) - // Standard Error: 5_791 - .saturating_add(Weight::from_parts(526_784, 0).saturating_mul(r.into())) + // Minimum execution time: 2_396_000 picoseconds. + Weight::from_parts(2_491_000, 0) + // Standard Error: 3_774 + .saturating_add(Weight::from_parts(516_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(18_346, 0) - // Standard Error: 5_882 - .saturating_add(Weight::from_parts(538_848, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(548_192, 0) + // Standard Error: 4_583 + .saturating_add(Weight::from_parts(556_734, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 4_502 - .saturating_add(Weight::from_parts(463_034, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(447_271, 0) + // Standard Error: 5_300 + .saturating_add(Weight::from_parts(535_915, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(2_193_450, 0) - // Standard Error: 3_655 - .saturating_add(Weight::from_parts(304_226, 0).saturating_mul(r.into())) + // Minimum execution time: 2_340_000 picoseconds. + Weight::from_parts(1_639_695, 0) + // Standard Error: 3_519 + .saturating_add(Weight::from_parts(368_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_803_358, 0) - // Standard Error: 2_256 - .saturating_add(Weight::from_parts(163_489, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_843_474, 0) + // Standard Error: 1_950 + .saturating_add(Weight::from_parts(176_592, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(3_087_274, 0) - // Standard Error: 1_907 - .saturating_add(Weight::from_parts(146_988, 0).saturating_mul(r.into())) + // Minimum execution time: 2_351_000 picoseconds. + Weight::from_parts(2_894_613, 0) + // Standard Error: 2_024 + .saturating_add(Weight::from_parts(188_853, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_335_000, 0) - // Standard Error: 9_220 - .saturating_add(Weight::from_parts(1_682_986, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_418_000, 0) + // Standard Error: 9_504 + .saturating_add(Weight::from_parts(1_936_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 7_751 - .saturating_add(Weight::from_parts(1_073_438, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_364_000, 0) + // Standard Error: 8_346 + .saturating_add(Weight::from_parts(1_222_521, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_297_000, 0) - // Standard Error: 9_887 - .saturating_add(Weight::from_parts(1_746_888, 0).saturating_mul(r.into())) + // Minimum execution time: 2_345_000 picoseconds. + Weight::from_parts(2_452_000, 0) + // Standard Error: 10_232 + .saturating_add(Weight::from_parts(1_883_867, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_305_000, 0) - // Standard Error: 8_241 - .saturating_add(Weight::from_parts(1_123_968, 0).saturating_mul(r.into())) + // Minimum execution time: 2_323_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 7_581 + .saturating_add(Weight::from_parts(1_200_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_325_000 picoseconds. - Weight::from_parts(2_368_000, 0) - // Standard Error: 10_199 - .saturating_add(Weight::from_parts(1_754_281, 0).saturating_mul(r.into())) + // Minimum execution time: 2_410_000 picoseconds. + Weight::from_parts(2_459_000, 0) + // Standard Error: 11_139 + .saturating_add(Weight::from_parts(1_877_766, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 7_885 - .saturating_add(Weight::from_parts(1_054_096, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 8_083 + .saturating_add(Weight::from_parts(1_217_904, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_244_000, 0) - // Standard Error: 11_272 - .saturating_add(Weight::from_parts(1_769_874, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(2_482_000, 0) + // Standard Error: 11_044 + .saturating_add(Weight::from_parts(1_956_302, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 8_360 - .saturating_add(Weight::from_parts(1_115_362, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 7_870 + .saturating_add(Weight::from_parts(1_213_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 9_424 - .saturating_add(Weight::from_parts(1_807_643, 0).saturating_mul(r.into())) + // Minimum execution time: 2_364_000 picoseconds. + Weight::from_parts(2_430_000, 0) + // Standard Error: 10_577 + .saturating_add(Weight::from_parts(1_968_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 7_499 - .saturating_add(Weight::from_parts(1_087_178, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_442_000, 0) + // Standard Error: 7_838 + .saturating_add(Weight::from_parts(1_267_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 11_743 - .saturating_add(Weight::from_parts(1_703_075, 0).saturating_mul(r.into())) + // Minimum execution time: 2_395_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 10_856 + .saturating_add(Weight::from_parts(1_910_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_254_000, 0) - // Standard Error: 8_099 - .saturating_add(Weight::from_parts(1_080_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_343_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 5_786 + .saturating_add(Weight::from_parts(1_128_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_183_000 picoseconds. - Weight::from_parts(2_301_000, 0) - // Standard Error: 10_230 - .saturating_add(Weight::from_parts(1_738_567, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 10_344 + .saturating_add(Weight::from_parts(1_897_480, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_209_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 8_536 - .saturating_add(Weight::from_parts(1_161_928, 0).saturating_mul(r.into())) + // Minimum execution time: 2_355_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 6_963 + .saturating_add(Weight::from_parts(1_125_698, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_208_000 picoseconds. - Weight::from_parts(2_255_000, 0) - // Standard Error: 10_368 - .saturating_add(Weight::from_parts(1_847_441, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_447_000, 0) + // Standard Error: 8_285 + .saturating_add(Weight::from_parts(1_848_149, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 8_213 - .saturating_add(Weight::from_parts(1_112_048, 0).saturating_mul(r.into())) + // Minimum execution time: 2_327_000 picoseconds. + Weight::from_parts(2_394_000, 0) + // Standard Error: 7_282 + .saturating_add(Weight::from_parts(1_176_423, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 12_684 - .saturating_add(Weight::from_parts(1_728_765, 0).saturating_mul(r.into())) + // Minimum execution time: 2_372_000 picoseconds. + Weight::from_parts(2_439_000, 0) + // Standard Error: 9_207 + .saturating_add(Weight::from_parts(1_837_009, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_573_000 picoseconds. - Weight::from_parts(2_655_000, 0) - // Standard Error: 7_404 - .saturating_add(Weight::from_parts(1_080_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_368_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_320 + .saturating_add(Weight::from_parts(1_231_088, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 9_739 - .saturating_add(Weight::from_parts(1_807_913, 0).saturating_mul(r.into())) + // Minimum execution time: 2_373_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 9_499 + .saturating_add(Weight::from_parts(1_922_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 7_265 - .saturating_add(Weight::from_parts(1_087_210, 0).saturating_mul(r.into())) + // Minimum execution time: 2_387_000 picoseconds. + Weight::from_parts(2_455_000, 0) + // Standard Error: 7_681 + .saturating_add(Weight::from_parts(1_198_894, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_311_000, 0) - // Standard Error: 7_444 - .saturating_add(Weight::from_parts(1_191_685, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 7_797 + .saturating_add(Weight::from_parts(1_286_566, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_263_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 5_023 - .saturating_add(Weight::from_parts(585_667, 0).saturating_mul(r.into())) + // Minimum execution time: 2_329_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 4_968 + .saturating_add(Weight::from_parts(645_254, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 10_018 - .saturating_add(Weight::from_parts(1_297_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(2_489_000, 0) + // Standard Error: 7_055 + .saturating_add(Weight::from_parts(1_232_084, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_291_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 4_776 - .saturating_add(Weight::from_parts(612_864, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 4_348 + .saturating_add(Weight::from_parts(633_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_286_000 picoseconds. - Weight::from_parts(2_356_000, 0) - // Standard Error: 11_619 - .saturating_add(Weight::from_parts(1_743_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_336_000 picoseconds. + Weight::from_parts(2_413_000, 0) + // Standard Error: 8_202 + .saturating_add(Weight::from_parts(1_777_425, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_302_000 picoseconds. - Weight::from_parts(2_343_000, 0) - // Standard Error: 8_638 - .saturating_add(Weight::from_parts(1_136_060, 0).saturating_mul(r.into())) + // Minimum execution time: 2_314_000 picoseconds. + Weight::from_parts(2_369_000, 0) + // Standard Error: 6_935 + .saturating_add(Weight::from_parts(1_201_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 7_114 - .saturating_add(Weight::from_parts(2_599_346, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(6_846_840, 0) + // Standard Error: 17_822 + .saturating_add(Weight::from_parts(2_268_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(3_823_403, 0) - // Standard Error: 18_912 - .saturating_add(Weight::from_parts(2_161_963, 0).saturating_mul(r.into())) + // Minimum execution time: 2_394_000 picoseconds. + Weight::from_parts(4_704_336, 0) + // Standard Error: 10_960 + .saturating_add(Weight::from_parts(2_182_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_199_000 picoseconds. - Weight::from_parts(2_817_173, 0) - // Standard Error: 17_341 - .saturating_add(Weight::from_parts(2_740_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_375_000 picoseconds. + Weight::from_parts(1_968_824, 0) + // Standard Error: 15_899 + .saturating_add(Weight::from_parts(2_762_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(88_235, 0) - // Standard Error: 10_326 - .saturating_add(Weight::from_parts(2_481_087, 0).saturating_mul(r.into())) + // Minimum execution time: 2_335_000 picoseconds. + Weight::from_parts(1_450_000, 0) + // Standard Error: 13_496 + .saturating_add(Weight::from_parts(2_401_407, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 14_480 - .saturating_add(Weight::from_parts(9_604_981, 0).saturating_mul(r.into())) + // Minimum execution time: 2_448_000 picoseconds. + Weight::from_parts(2_513_000, 0) + // Standard Error: 19_401 + .saturating_add(Weight::from_parts(9_309_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 21_926 - .saturating_add(Weight::from_parts(7_501_289, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(1_738_370, 0) + // Standard Error: 42_672 + .saturating_add(Weight::from_parts(7_512_557, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_309_000 picoseconds. - Weight::from_parts(10_308_173, 0) - // Standard Error: 30_680 - .saturating_add(Weight::from_parts(2_288_505, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_215_088, 0) + // Standard Error: 15_445 + .saturating_add(Weight::from_parts(2_956_278, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 5_007 - .saturating_add(Weight::from_parts(2_516_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(217_500, 0) + // Standard Error: 7_904 + .saturating_add(Weight::from_parts(2_576_151, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_228_000 picoseconds. - Weight::from_parts(2_300_000, 0) - // Standard Error: 8_948 - .saturating_add(Weight::from_parts(1_264_596, 0).saturating_mul(r.into())) + // Minimum execution time: 2_456_000 picoseconds. + Weight::from_parts(2_503_000, 0) + // Standard Error: 7_920 + .saturating_add(Weight::from_parts(1_321_543, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 5_099 - .saturating_add(Weight::from_parts(612_107, 0).saturating_mul(r.into())) + // Minimum execution time: 2_346_000 picoseconds. + Weight::from_parts(2_479_000, 0) + // Standard Error: 4_711 + .saturating_add(Weight::from_parts(689_892, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(2_326_000, 0) - // Standard Error: 10_004 - .saturating_add(Weight::from_parts(1_278_365, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_029 + .saturating_add(Weight::from_parts(1_256_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 5_578 - .saturating_add(Weight::from_parts(645_196, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_480_000, 0) + // Standard Error: 3_812 + .saturating_add(Weight::from_parts(607_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_338_000 picoseconds. - Weight::from_parts(2_363_000, 0) - // Standard Error: 8_554 - .saturating_add(Weight::from_parts(1_288_676, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 7_362 + .saturating_add(Weight::from_parts(1_248_739, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_332_000, 0) - // Standard Error: 3_999 - .saturating_add(Weight::from_parts(594_484, 0).saturating_mul(r.into())) + // Minimum execution time: 2_419_000 picoseconds. + Weight::from_parts(2_465_000, 0) + // Standard Error: 4_304 + .saturating_add(Weight::from_parts(604_813, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 7_437 - .saturating_add(Weight::from_parts(1_044_306, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 8_043 + .saturating_add(Weight::from_parts(1_073_194, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_308_000, 0) - // Standard Error: 4_658 - .saturating_add(Weight::from_parts(537_262, 0).saturating_mul(r.into())) + // Minimum execution time: 2_427_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 4_969 + .saturating_add(Weight::from_parts(594_802, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 10_254 - .saturating_add(Weight::from_parts(1_154_138, 0).saturating_mul(r.into())) + // Minimum execution time: 2_312_000 picoseconds. + Weight::from_parts(2_399_000, 0) + // Standard Error: 7_093 + .saturating_add(Weight::from_parts(1_110_114, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_234_000 picoseconds. - Weight::from_parts(2_313_000, 0) - // Standard Error: 4_960 - .saturating_add(Weight::from_parts(607_930, 0).saturating_mul(r.into())) + // Minimum execution time: 2_331_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 4_140 + .saturating_add(Weight::from_parts(600_354, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 7_909 - .saturating_add(Weight::from_parts(1_094_660, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_419_000, 0) + // Standard Error: 7_150 + .saturating_add(Weight::from_parts(1_154_649, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(39_069, 0) - // Standard Error: 6_710 - .saturating_add(Weight::from_parts(599_572, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_423_000, 0) + // Standard Error: 5_067 + .saturating_add(Weight::from_parts(594_487, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 8_785 - .saturating_add(Weight::from_parts(1_060_321, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_406_000, 0) + // Standard Error: 5_674 + .saturating_add(Weight::from_parts(1_051_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 4_191 - .saturating_add(Weight::from_parts(528_319, 0).saturating_mul(r.into())) + // Minimum execution time: 2_383_000 picoseconds. + Weight::from_parts(114_723, 0) + // Standard Error: 5_881 + .saturating_add(Weight::from_parts(646_798, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 9_328 - .saturating_add(Weight::from_parts(1_114_164, 0).saturating_mul(r.into())) + // Minimum execution time: 2_292_000 picoseconds. + Weight::from_parts(2_422_000, 0) + // Standard Error: 6_697 + .saturating_add(Weight::from_parts(1_053_580, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_210_000 picoseconds. - Weight::from_parts(390_951, 0) - // Standard Error: 5_316 - .saturating_add(Weight::from_parts(609_568, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(206_699, 0) + // Standard Error: 5_851 + .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } } @@ -2089,21 +2085,21 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 951_000 picoseconds. - Weight::from_parts(1_020_000, 0) - // Standard Error: 722 - .saturating_add(Weight::from_parts(240_031, 0).saturating_mul(c.into())) + // Minimum execution time: 1_023_000 picoseconds. + Weight::from_parts(1_051_000, 0) + // Standard Error: 912 + .saturating_add(Weight::from_parts(213_761, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. fn db_read_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `42 + c * (1024 ±0)` - // Estimated: `3506 + c * (1024 ±0)` - // Minimum execution time: 2_762_000 picoseconds. - Weight::from_parts(2_859_000, 3506) - // Standard Error: 813 - .saturating_add(Weight::from_parts(665_139, 0).saturating_mul(c.into())) + // Measured: `146 + c * (1024 ±0)` + // Estimated: `3610 + c * (1024 ±0)` + // Minimum execution time: 3_252_000 picoseconds. + Weight::from_parts(3_416_000, 3610) + // Standard Error: 1_261 + .saturating_add(Weight::from_parts(689_572, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2112,35 +2108,35 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 50_591_000 picoseconds. - Weight::from_parts(61_353_023, 0) - // Standard Error: 9_186 - .saturating_add(Weight::from_parts(2_404_810, 0).saturating_mul(c.into())) + // Minimum execution time: 59_805_000 picoseconds. + Weight::from_parts(86_729_126, 0) + // Standard Error: 7_023 + .saturating_add(Weight::from_parts(2_475_519, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: - // Measured: `979` - // Estimated: `42236` - // Minimum execution time: 81_660_000 picoseconds. - Weight::from_parts(83_840_000, 42236) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(10_u64)) + // Measured: `1372` + // Estimated: `51905` + // Minimum execution time: 107_694_000 picoseconds. + Weight::from_parts(110_328_000, 51905) + .saturating_add(RocksDbWeight::get().reads(15_u64)) + .saturating_add(RocksDbWeight::get().writes(12_u64)) } fn pay_program_rent() -> Weight { // Proof Size summary in bytes: - // Measured: `886` - // Estimated: `21261` - // Minimum execution time: 54_005_000 picoseconds. - Weight::from_parts(55_095_000, 21261) + // Measured: `992` + // Estimated: `21579` + // Minimum execution time: 55_980_000 picoseconds. + Weight::from_parts(56_766_000, 21579) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } fn resume_session_init() -> Weight { // Proof Size summary in bytes: - // Measured: `534` - // Estimated: `17070` - // Minimum execution time: 28_880_000 picoseconds. - Weight::from_parts(29_583_000, 17070) + // Measured: `638` + // Estimated: `17486` + // Minimum execution time: 29_973_000 picoseconds. + Weight::from_parts(31_008_000, 17486) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2149,22 +2145,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_744_000 picoseconds. - Weight::from_parts(4_233_092, 7640) - // Standard Error: 39_690 - .saturating_add(Weight::from_parts(14_033_179, 0).saturating_mul(c.into())) + // Minimum execution time: 8_054_000 picoseconds. + Weight::from_parts(8_342_000, 7640) + // Standard Error: 17_771 + .saturating_add(Weight::from_parts(13_335_661, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1297 + c * (16389 ±0)` - // Estimated: `40898 + c * (131112 ±0)` - // Minimum execution time: 70_301_000 picoseconds. - Weight::from_parts(70_991_000, 40898) - // Standard Error: 177_223 - .saturating_add(Weight::from_parts(54_687_249, 0).saturating_mul(c.into())) + // Measured: `1593 + c * (16389 ±0)` + // Estimated: `43266 + c * (131112 ±0)` + // Minimum execution time: 72_178_000 picoseconds. + Weight::from_parts(73_341_000, 43266) + // Standard Error: 167_723 + .saturating_add(Weight::from_parts(54_442_045, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2173,97 +2169,97 @@ impl WeightInfo for () { /// The range of component `c` is `[0, 250]`. fn upload_code(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `10` - // Estimated: `4990` - // Minimum execution time: 61_715_000 picoseconds. - Weight::from_parts(40_384_385, 4990) - // Standard Error: 57_496 - .saturating_add(Weight::from_parts(53_210_788, 0).saturating_mul(c.into())) + // Measured: `113` + // Estimated: `5402` + // Minimum execution time: 78_662_000 picoseconds. + Weight::from_parts(42_066_175, 5402) + // Standard Error: 52_075 + .saturating_add(Weight::from_parts(60_249_549, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `671` - // Estimated: `38638` - // Minimum execution time: 63_077_000 picoseconds. - Weight::from_parts(96_840_506, 38638) - // Standard Error: 0 - .saturating_add(Weight::from_parts(2_609, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(10_u64)) + // Measured: `1111` + // Estimated: `50600` + // Minimum execution time: 94_321_000 picoseconds. + Weight::from_parts(129_113_540, 50600) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_625, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(15_u64)) + .saturating_add(RocksDbWeight::get().writes(12_u64)) } /// The range of component `c` is `[0, 250]`. /// The range of component `s` is `[0, 4194304]`. fn upload_program(c: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `235` - // Estimated: `34312` - // Minimum execution time: 11_049_858_000 picoseconds. - Weight::from_parts(11_090_406_000, 34312) - // Standard Error: 517_330 - .saturating_add(Weight::from_parts(25_497_137, 0).saturating_mul(c.into())) - // Standard Error: 30 - .saturating_add(Weight::from_parts(910, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(14_u64)) + // Measured: `521` + // Estimated: `45152` + // Minimum execution time: 11_148_491_000 picoseconds. + Weight::from_parts(21_065_971, 45152) + // Standard Error: 173_883 + .saturating_add(Weight::from_parts(60_839_567, 0).saturating_mul(c.into())) + // Standard Error: 10 + .saturating_add(Weight::from_parts(2_652, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(15_u64)) + .saturating_add(RocksDbWeight::get().writes(16_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_message(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `348` - // Estimated: `23853` - // Minimum execution time: 56_305_000 picoseconds. - Weight::from_parts(38_705_997, 23853) + // Measured: `531` + // Estimated: `31266` + // Minimum execution time: 73_302_000 picoseconds. + Weight::from_parts(47_279_667, 31266) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_034, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(9_u64)) - .saturating_add(RocksDbWeight::get().writes(8_u64)) + .saturating_add(Weight::from_parts(1_055, 0).saturating_mul(p.into())) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(10_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `978` - // Estimated: `42227` - // Minimum execution time: 83_033_000 picoseconds. - Weight::from_parts(69_135_468, 42227) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_035, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(10_u64)) + // Measured: `1371` + // Estimated: `54435` + // Minimum execution time: 124_173_000 picoseconds. + Weight::from_parts(96_458_887, 54435) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_078, 0).saturating_mul(p.into())) + .saturating_add(RocksDbWeight::get().reads(16_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `760` - // Estimated: `74319` - // Minimum execution time: 295_535_000 picoseconds. - Weight::from_parts(306_791_413, 74319) - // Standard Error: 1_111 - .saturating_add(Weight::from_parts(1_568, 0).saturating_mul(q.into())) - .saturating_add(RocksDbWeight::get().reads(27_u64)) - .saturating_add(RocksDbWeight::get().writes(22_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 365_983_000 picoseconds. + Weight::from_parts(387_416_952, 114612) + .saturating_add(RocksDbWeight::get().reads(33_u64)) + .saturating_add(RocksDbWeight::get().writes(26_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(_q: u32, ) -> Weight { + fn alloc_in_handle(q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `760` - // Estimated: `74319` - // Minimum execution time: 309_253_000 picoseconds. - Weight::from_parts(323_694_389, 74319) - .saturating_add(RocksDbWeight::get().reads(27_u64)) - .saturating_add(RocksDbWeight::get().writes(22_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 380_430_000 picoseconds. + Weight::from_parts(403_376_118, 114612) + // Standard Error: 2_451 + .saturating_add(Weight::from_parts(1_137, 0).saturating_mul(q.into())) + .saturating_add(RocksDbWeight::get().reads(33_u64)) + .saturating_add(RocksDbWeight::get().writes(26_u64)) } /// The range of component `c` is `[0, 512]`. fn reinstrument_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 44_806_000 picoseconds. - Weight::from_parts(45_498_000, 3899) - // Standard Error: 44_467 - .saturating_add(Weight::from_parts(54_603_581, 0).saturating_mul(c.into())) + // Minimum execution time: 58_080_000 picoseconds. + Weight::from_parts(58_601_000, 3899) + // Standard Error: 36_083 + .saturating_add(Weight::from_parts(58_395_643, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2273,630 +2269,628 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_307_000 picoseconds. - Weight::from_parts(84_226_000, 0) - // Standard Error: 4_203_577 - .saturating_add(Weight::from_parts(574_493_471, 0).saturating_mul(r.into())) + // Minimum execution time: 91_412_000 picoseconds. + Weight::from_parts(94_168_000, 0) + // Standard Error: 3_806_298 + .saturating_add(Weight::from_parts(673_774_453, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 309_893_000 picoseconds. - Weight::from_parts(234_558_588, 0) - // Standard Error: 7_966 - .saturating_add(Weight::from_parts(32_022_587, 0).saturating_mul(p.into())) + // Minimum execution time: 452_549_000 picoseconds. + Weight::from_parts(398_963_700, 0) + // Standard Error: 7_042 + .saturating_add(Weight::from_parts(29_406_609, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 142_319_000 picoseconds. - Weight::from_parts(121_865_521, 0) - // Standard Error: 314_080 - .saturating_add(Weight::from_parts(64_422_856, 0).saturating_mul(r.into())) + // Minimum execution time: 207_052_000 picoseconds. + Weight::from_parts(209_606_478, 0) + // Standard Error: 255_281 + .saturating_add(Weight::from_parts(62_959_531, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_527_000 picoseconds. - Weight::from_parts(91_967_528, 0) - // Standard Error: 3_856 - .saturating_add(Weight::from_parts(2_363_669, 0).saturating_mul(r.into())) + // Minimum execution time: 97_729_000 picoseconds. + Weight::from_parts(105_964_750, 0) + // Standard Error: 4_847 + .saturating_add(Weight::from_parts(2_433_966, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 144_133_000 picoseconds. - Weight::from_parts(156_991_945, 0) - // Standard Error: 24_223 - .saturating_add(Weight::from_parts(2_431_525, 0).saturating_mul(r.into())) + // Minimum execution time: 175_010_000 picoseconds. + Weight::from_parts(229_153_209, 0) + // Standard Error: 17_116 + .saturating_add(Weight::from_parts(1_991_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_811_000 picoseconds. - Weight::from_parts(101_122_470, 0) - // Standard Error: 303_533 - .saturating_add(Weight::from_parts(92_415_204, 0).saturating_mul(r.into())) + // Minimum execution time: 94_696_000 picoseconds. + Weight::from_parts(119_674_535, 0) + // Standard Error: 387_178 + .saturating_add(Weight::from_parts(98_102_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_453_000 picoseconds. - Weight::from_parts(79_049_804, 0) - // Standard Error: 305_992 - .saturating_add(Weight::from_parts(79_382_630, 0).saturating_mul(r.into())) + // Minimum execution time: 95_794_000 picoseconds. + Weight::from_parts(89_931_979, 0) + // Standard Error: 371_349 + .saturating_add(Weight::from_parts(86_524_059, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_650_000 picoseconds. - Weight::from_parts(79_085_060, 0) - // Standard Error: 293_080 - .saturating_add(Weight::from_parts(77_346_019, 0).saturating_mul(r.into())) + // Minimum execution time: 97_924_000 picoseconds. + Weight::from_parts(84_041_201, 0) + // Standard Error: 327_841 + .saturating_add(Weight::from_parts(95_483_315, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_545_000 picoseconds. - Weight::from_parts(72_777_984, 0) - // Standard Error: 351_302 - .saturating_add(Weight::from_parts(80_634_984, 0).saturating_mul(r.into())) + // Minimum execution time: 97_122_000 picoseconds. + Weight::from_parts(86_789_268, 0) + // Standard Error: 353_259 + .saturating_add(Weight::from_parts(85_698_317, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_245_000 picoseconds. - Weight::from_parts(76_181_868, 0) - // Standard Error: 354_266 - .saturating_add(Weight::from_parts(79_459_120, 0).saturating_mul(r.into())) + // Minimum execution time: 94_821_000 picoseconds. + Weight::from_parts(92_694_130, 0) + // Standard Error: 340_146 + .saturating_add(Weight::from_parts(84_623_945, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_064_000 picoseconds. - Weight::from_parts(77_882_516, 0) - // Standard Error: 377_997 - .saturating_add(Weight::from_parts(78_533_852, 0).saturating_mul(r.into())) + // Minimum execution time: 93_840_000 picoseconds. + Weight::from_parts(87_888_572, 0) + // Standard Error: 369_465 + .saturating_add(Weight::from_parts(85_638_902, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_522_000 picoseconds. - Weight::from_parts(66_328_137, 0) - // Standard Error: 360_143 - .saturating_add(Weight::from_parts(79_838_604, 0).saturating_mul(r.into())) + // Minimum execution time: 98_597_000 picoseconds. + Weight::from_parts(86_642_386, 0) + // Standard Error: 362_257 + .saturating_add(Weight::from_parts(85_598_887, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_961_000 picoseconds. - Weight::from_parts(72_789_065, 0) - // Standard Error: 366_577 - .saturating_add(Weight::from_parts(79_031_060, 0).saturating_mul(r.into())) + // Minimum execution time: 94_546_000 picoseconds. + Weight::from_parts(91_466_289, 0) + // Standard Error: 344_423 + .saturating_add(Weight::from_parts(84_318_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 700_686_000 picoseconds. - Weight::from_parts(749_297_529, 0) - // Standard Error: 383_897 - .saturating_add(Weight::from_parts(132_242_102, 0).saturating_mul(r.into())) + // Minimum execution time: 578_036_000 picoseconds. + Weight::from_parts(696_140_951, 0) + // Standard Error: 559_498 + .saturating_add(Weight::from_parts(149_397_501, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 830_957_000 picoseconds. - Weight::from_parts(850_017_000, 0) - // Standard Error: 67_693 - .saturating_add(Weight::from_parts(13_570_326, 0).saturating_mul(n.into())) + // Minimum execution time: 723_788_000 picoseconds. + Weight::from_parts(740_225_000, 0) + // Standard Error: 52_895 + .saturating_add(Weight::from_parts(13_188_120, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_261_000 picoseconds. - Weight::from_parts(70_573_139, 0) - // Standard Error: 351_239 - .saturating_add(Weight::from_parts(80_441_776, 0).saturating_mul(r.into())) + // Minimum execution time: 99_012_000 picoseconds. + Weight::from_parts(88_269_135, 0) + // Standard Error: 296_136 + .saturating_add(Weight::from_parts(92_296_104, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_164_000 picoseconds. - Weight::from_parts(70_866_987, 0) - // Standard Error: 346_107 - .saturating_add(Weight::from_parts(82_471_591, 0).saturating_mul(r.into())) + // Minimum execution time: 93_803_000 picoseconds. + Weight::from_parts(87_097_769, 0) + // Standard Error: 367_325 + .saturating_add(Weight::from_parts(84_987_043, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_192_000 picoseconds. - Weight::from_parts(101_814_078, 0) - // Standard Error: 391_508 - .saturating_add(Weight::from_parts(166_873_282, 0).saturating_mul(n.into())) + // Minimum execution time: 96_663_000 picoseconds. + Weight::from_parts(105_357_427, 0) + // Standard Error: 366_135 + .saturating_add(Weight::from_parts(172_109_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_974_000 picoseconds. - Weight::from_parts(87_244_000, 0) - // Standard Error: 3_619_557 - .saturating_add(Weight::from_parts(749_950_767, 0).saturating_mul(r.into())) + // Minimum execution time: 99_210_000 picoseconds. + Weight::from_parts(102_217_000, 0) + // Standard Error: 4_527_119 + .saturating_add(Weight::from_parts(845_784_967, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_612_000 picoseconds. - Weight::from_parts(147_822_399, 0) - // Standard Error: 421_408 - .saturating_add(Weight::from_parts(250_730_230, 0).saturating_mul(r.into())) + // Minimum execution time: 96_579_000 picoseconds. + Weight::from_parts(162_452_429, 0) + // Standard Error: 416_836 + .saturating_add(Weight::from_parts(257_900_517, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 332_130_000 picoseconds. - Weight::from_parts(337_780_000, 0) - // Standard Error: 52_652 - .saturating_add(Weight::from_parts(20_743_155, 0).saturating_mul(n.into())) + // Minimum execution time: 353_526_000 picoseconds. + Weight::from_parts(358_025_000, 0) + // Standard Error: 61_984 + .saturating_add(Weight::from_parts(21_521_461, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_722_000 picoseconds. - Weight::from_parts(147_881_270, 0) - // Standard Error: 390_429 - .saturating_add(Weight::from_parts(259_701_373, 0).saturating_mul(r.into())) + // Minimum execution time: 94_822_000 picoseconds. + Weight::from_parts(168_431_611, 0) + // Standard Error: 378_696 + .saturating_add(Weight::from_parts(263_135_958, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 337_753_000 picoseconds. - Weight::from_parts(343_454_000, 0) - // Standard Error: 66_604 - .saturating_add(Weight::from_parts(21_189_034, 0).saturating_mul(n.into())) + // Minimum execution time: 351_828_000 picoseconds. + Weight::from_parts(355_382_000, 0) + // Standard Error: 60_589 + .saturating_add(Weight::from_parts(21_325_400, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 708_454_000 picoseconds. - Weight::from_parts(775_673_824, 0) - // Standard Error: 380_634 - .saturating_add(Weight::from_parts(268_253_890, 0).saturating_mul(r.into())) + // Minimum execution time: 569_384_000 picoseconds. + Weight::from_parts(638_474_730, 0) + // Standard Error: 425_903 + .saturating_add(Weight::from_parts(275_691_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 706_799_000 picoseconds. - Weight::from_parts(782_052_003, 0) - // Standard Error: 385_065 - .saturating_add(Weight::from_parts(265_280_556, 0).saturating_mul(r.into())) + // Minimum execution time: 573_053_000 picoseconds. + Weight::from_parts(640_078_802, 0) + // Standard Error: 475_389 + .saturating_add(Weight::from_parts(284_337_155, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_511_000 picoseconds. - Weight::from_parts(61_459_678, 0) - // Standard Error: 362_497 - .saturating_add(Weight::from_parts(87_903_947, 0).saturating_mul(r.into())) + // Minimum execution time: 98_223_000 picoseconds. + Weight::from_parts(85_732_985, 0) + // Standard Error: 336_308 + .saturating_add(Weight::from_parts(92_936_006, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_676_718_000 picoseconds. - Weight::from_parts(1_838_206_733, 0) - // Standard Error: 440_793 - .saturating_add(Weight::from_parts(156_352_100, 0).saturating_mul(r.into())) + // Minimum execution time: 1_822_621_000 picoseconds. + Weight::from_parts(1_951_955_018, 0) + // Standard Error: 339_415 + .saturating_add(Weight::from_parts(157_557_756, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 284_222_000 picoseconds. - Weight::from_parts(293_316_000, 0) - // Standard Error: 54_796 - .saturating_add(Weight::from_parts(30_939_288, 0).saturating_mul(n.into())) + // Minimum execution time: 314_296_000 picoseconds. + Weight::from_parts(317_522_000, 0) + // Standard Error: 61_360 + .saturating_add(Weight::from_parts(29_499_741, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_682_466_000 picoseconds. - Weight::from_parts(1_829_413_701, 0) - // Standard Error: 510_421 - .saturating_add(Weight::from_parts(216_009_232, 0).saturating_mul(r.into())) + // Minimum execution time: 1_835_106_000 picoseconds. + Weight::from_parts(1_948_516_646, 0) + // Standard Error: 382_008 + .saturating_add(Weight::from_parts(214_812_508, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_681_160_000 picoseconds. - Weight::from_parts(1_819_797_788, 0) - // Standard Error: 453_707 - .saturating_add(Weight::from_parts(215_589_534, 0).saturating_mul(r.into())) + // Minimum execution time: 1_827_496_000 picoseconds. + Weight::from_parts(1_949_190_773, 0) + // Standard Error: 340_175 + .saturating_add(Weight::from_parts(218_001_536, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 242_556_000 picoseconds. - Weight::from_parts(314_306_159, 0) - // Standard Error: 376_142 - .saturating_add(Weight::from_parts(260_614_468, 0).saturating_mul(r.into())) + // Minimum execution time: 264_306_000 picoseconds. + Weight::from_parts(363_536_651, 0) + // Standard Error: 467_914 + .saturating_add(Weight::from_parts(265_564_072, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 495_430_000 picoseconds. - Weight::from_parts(502_714_000, 0) - // Standard Error: 52_049 - .saturating_add(Weight::from_parts(21_259_132, 0).saturating_mul(n.into())) + // Minimum execution time: 523_150_000 picoseconds. + Weight::from_parts(535_842_000, 0) + // Standard Error: 65_412 + .saturating_add(Weight::from_parts(21_698_063, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_809_658_000 picoseconds. - Weight::from_parts(2_002_681_446, 0) - // Standard Error: 414_919 - .saturating_add(Weight::from_parts(227_942_929, 0).saturating_mul(r.into())) + // Minimum execution time: 1_974_743_000 picoseconds. + Weight::from_parts(2_096_494_995, 0) + // Standard Error: 474_778 + .saturating_add(Weight::from_parts(232_524_299, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_821_000 picoseconds. - Weight::from_parts(84_783_126, 0) - // Standard Error: 234_696 - .saturating_add(Weight::from_parts(22_124_873, 0).saturating_mul(r.into())) + // Minimum execution time: 94_139_000 picoseconds. + Weight::from_parts(101_775_569, 0) + // Standard Error: 452_439 + .saturating_add(Weight::from_parts(16_839_430, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 100_040_000 picoseconds. - Weight::from_parts(92_861_700, 0) - // Standard Error: 1_021 - .saturating_add(Weight::from_parts(419_414, 0).saturating_mul(n.into())) + // Minimum execution time: 112_050_000 picoseconds. + Weight::from_parts(102_205_366, 0) + // Standard Error: 1_008 + .saturating_add(Weight::from_parts(431_304, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_986_000 picoseconds. - Weight::from_parts(85_723_530, 0) - // Standard Error: 278_519 - .saturating_add(Weight::from_parts(19_484_469, 0).saturating_mul(r.into())) + // Minimum execution time: 93_528_000 picoseconds. + Weight::from_parts(99_748_422, 0) + // Standard Error: 396_992 + .saturating_add(Weight::from_parts(20_536_877, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 104_879_000 picoseconds. - Weight::from_parts(88_056_044, 0) - // Standard Error: 1_087 - .saturating_add(Weight::from_parts(427_201, 0).saturating_mul(n.into())) + // Minimum execution time: 117_832_000 picoseconds. + Weight::from_parts(104_552_847, 0) + // Standard Error: 1_402 + .saturating_add(Weight::from_parts(432_018, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 80_548_000 picoseconds. - Weight::from_parts(84_139_208, 0) - // Standard Error: 235_150 - .saturating_add(Weight::from_parts(17_533_491, 0).saturating_mul(r.into())) + // Minimum execution time: 93_325_000 picoseconds. + Weight::from_parts(101_074_097, 0) + // Standard Error: 454_790 + .saturating_add(Weight::from_parts(20_838_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_118_000 picoseconds. - Weight::from_parts(88_086_604, 0) - // Standard Error: 244_958 - .saturating_add(Weight::from_parts(17_286_195, 0).saturating_mul(r.into())) + // Minimum execution time: 93_800_000 picoseconds. + Weight::from_parts(102_249_326, 0) + // Standard Error: 463_488 + .saturating_add(Weight::from_parts(15_991_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_393_000 picoseconds. - Weight::from_parts(132_631_342, 0) - // Standard Error: 436_134 - .saturating_add(Weight::from_parts(141_520_417, 0).saturating_mul(r.into())) + // Minimum execution time: 93_153_000 picoseconds. + Weight::from_parts(121_452_989, 0) + // Standard Error: 390_540 + .saturating_add(Weight::from_parts(145_641_178, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_567_000 picoseconds. - Weight::from_parts(99_600_000, 0) - // Standard Error: 2_187 - .saturating_add(Weight::from_parts(639_729, 0).saturating_mul(n.into())) + // Minimum execution time: 115_529_000 picoseconds. + Weight::from_parts(120_413_000, 0) + // Standard Error: 3_105 + .saturating_add(Weight::from_parts(640_863, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 696_739_000 picoseconds. - Weight::from_parts(711_247_336, 0) - // Standard Error: 1_403_605 - .saturating_add(Weight::from_parts(15_869_663, 0).saturating_mul(r.into())) + // Minimum execution time: 566_859_000 picoseconds. + Weight::from_parts(631_111_316, 0) + // Standard Error: 7_012_228 + .saturating_add(Weight::from_parts(21_896_983, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. - fn gr_reply_input_wgas(r: u32, ) -> Weight { + fn gr_reply_input_wgas(_r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 697_432_000 picoseconds. - Weight::from_parts(712_096_565, 0) - // Standard Error: 1_674_352 - .saturating_add(Weight::from_parts(32_103_934, 0).saturating_mul(r.into())) + // Minimum execution time: 565_382_000 picoseconds. + Weight::from_parts(613_048_008, 0) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_685_000 picoseconds. - Weight::from_parts(96_156_389, 0) - // Standard Error: 262_969 - .saturating_add(Weight::from_parts(8_983_510, 0).saturating_mul(r.into())) + // Minimum execution time: 104_401_000 picoseconds. + Weight::from_parts(112_651_320, 0) + // Standard Error: 438_590 + .saturating_add(Weight::from_parts(11_095_379, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 105_746_000 picoseconds. - Weight::from_parts(89_918_273, 0) - // Standard Error: 1_055 - .saturating_add(Weight::from_parts(427_838, 0).saturating_mul(n.into())) + // Minimum execution time: 115_615_000 picoseconds. + Weight::from_parts(112_987_750, 0) + // Standard Error: 960 + .saturating_add(Weight::from_parts(423_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 95_634_000 picoseconds. - Weight::from_parts(99_574_926, 0) - // Standard Error: 267_301 - .saturating_add(Weight::from_parts(3_125_673, 0).saturating_mul(r.into())) + // Minimum execution time: 105_056_000 picoseconds. + Weight::from_parts(113_735_922, 0) + // Standard Error: 466_586 + .saturating_add(Weight::from_parts(5_305_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 99_268_000 picoseconds. - Weight::from_parts(93_140_981, 0) - // Standard Error: 1_101 - .saturating_add(Weight::from_parts(419_078, 0).saturating_mul(n.into())) + // Minimum execution time: 113_897_000 picoseconds. + Weight::from_parts(112_616_408, 0) + // Standard Error: 1_722 + .saturating_add(Weight::from_parts(428_420, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_167_000 picoseconds. - Weight::from_parts(80_305_860, 0) - // Standard Error: 357_986 - .saturating_add(Weight::from_parts(80_422_820, 0).saturating_mul(r.into())) + // Minimum execution time: 93_845_000 picoseconds. + Weight::from_parts(97_247_314, 0) + // Standard Error: 366_814 + .saturating_add(Weight::from_parts(85_900_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_137_000 picoseconds. - Weight::from_parts(76_881_656, 0) - // Standard Error: 302_504 - .saturating_add(Weight::from_parts(80_036_963, 0).saturating_mul(r.into())) + // Minimum execution time: 93_761_000 picoseconds. + Weight::from_parts(92_637_129, 0) + // Standard Error: 309_799 + .saturating_add(Weight::from_parts(85_725_727, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 707_922_000 picoseconds. - Weight::from_parts(767_820_244, 0) - // Standard Error: 418_647 - .saturating_add(Weight::from_parts(97_993_049, 0).saturating_mul(r.into())) + // Minimum execution time: 565_388_000 picoseconds. + Weight::from_parts(606_358_854, 0) + // Standard Error: 430_766 + .saturating_add(Weight::from_parts(108_769_267, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 724_683_000 picoseconds. - Weight::from_parts(732_157_836, 0) - // Standard Error: 618 - .saturating_add(Weight::from_parts(151_809, 0).saturating_mul(n.into())) + // Minimum execution time: 591_660_000 picoseconds. + Weight::from_parts(597_035_528, 0) + // Standard Error: 2_641 + .saturating_add(Weight::from_parts(153_781, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_304_055_000 picoseconds. - Weight::from_parts(2_435_844_780, 0) - // Standard Error: 420_214 - .saturating_add(Weight::from_parts(120_405_108, 0).saturating_mul(r.into())) + // Minimum execution time: 2_317_147_000 picoseconds. + Weight::from_parts(2_514_940_964, 0) + // Standard Error: 546_319 + .saturating_add(Weight::from_parts(128_825_542, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_431_524_000 picoseconds. - Weight::from_parts(2_669_711_936, 0) - // Standard Error: 12_819 - .saturating_add(Weight::from_parts(13_546_418, 0).saturating_mul(n.into())) + // Minimum execution time: 2_560_344_000 picoseconds. + Weight::from_parts(2_512_409_449, 0) + // Standard Error: 15_466 + .saturating_add(Weight::from_parts(12_395_144, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_238_000 picoseconds. - Weight::from_parts(104_905_012, 0) - // Standard Error: 392_000 - .saturating_add(Weight::from_parts(116_570_175, 0).saturating_mul(r.into())) + // Minimum execution time: 97_996_000 picoseconds. + Weight::from_parts(130_630_238, 0) + // Standard Error: 414_418 + .saturating_add(Weight::from_parts(114_735_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 143_132_000 picoseconds. - Weight::from_parts(145_448_000, 0) - // Standard Error: 51_056 - .saturating_add(Weight::from_parts(25_497_066, 0).saturating_mul(n.into())) + // Minimum execution time: 157_513_000 picoseconds. + Weight::from_parts(160_584_000, 0) + // Standard Error: 57_227 + .saturating_add(Weight::from_parts(25_738_939, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_055_000 picoseconds. - Weight::from_parts(75_514_507, 0) - // Standard Error: 342_511 - .saturating_add(Weight::from_parts(78_022_368, 0).saturating_mul(r.into())) + // Minimum execution time: 92_652_000 picoseconds. + Weight::from_parts(88_138_429, 0) + // Standard Error: 330_537 + .saturating_add(Weight::from_parts(83_235_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_725_000 picoseconds. - Weight::from_parts(87_574_873, 0) - // Standard Error: 249_331 - .saturating_add(Weight::from_parts(24_890_126, 0).saturating_mul(r.into())) + // Minimum execution time: 93_824_000 picoseconds. + Weight::from_parts(102_740_497, 0) + // Standard Error: 428_593 + .saturating_add(Weight::from_parts(23_682_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_761_000 picoseconds. - Weight::from_parts(86_511_404, 0) - // Standard Error: 240_746 - .saturating_add(Weight::from_parts(16_767_395, 0).saturating_mul(r.into())) + // Minimum execution time: 92_530_000 picoseconds. + Weight::from_parts(101_410_861, 0) + // Standard Error: 432_236 + .saturating_add(Weight::from_parts(12_196_938, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_794_000 picoseconds. - Weight::from_parts(88_401_167, 0) - // Standard Error: 217_438 - .saturating_add(Weight::from_parts(11_267_632, 0).saturating_mul(r.into())) + // Minimum execution time: 93_402_000 picoseconds. + Weight::from_parts(102_285_877, 0) + // Standard Error: 466_463 + .saturating_add(Weight::from_parts(13_156_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_664_000 picoseconds. - Weight::from_parts(89_193_048, 0) - // Standard Error: 336_699 - .saturating_add(Weight::from_parts(12_350_251, 0).saturating_mul(r.into())) + // Minimum execution time: 95_706_000 picoseconds. + Weight::from_parts(102_513_059, 0) + // Standard Error: 464_787 + .saturating_add(Weight::from_parts(13_986_540, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_815_000 picoseconds. - Weight::from_parts(87_397_869, 0) - // Standard Error: 235_037 - .saturating_add(Weight::from_parts(16_313_030, 0).saturating_mul(r.into())) + // Minimum execution time: 93_057_000 picoseconds. + Weight::from_parts(99_083_869, 0) + // Standard Error: 378_747 + .saturating_add(Weight::from_parts(12_230_330, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 139_190_000 picoseconds. - Weight::from_parts(186_267_428, 0) - // Standard Error: 346_204 - .saturating_add(Weight::from_parts(158_103_512, 0).saturating_mul(r.into())) + // Minimum execution time: 177_947_000 picoseconds. + Weight::from_parts(226_692_243, 0) + // Standard Error: 265_725 + .saturating_add(Weight::from_parts(156_938_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_748_000 picoseconds. - Weight::from_parts(148_556_306, 0) - // Standard Error: 400_680 - .saturating_add(Weight::from_parts(333_100_790, 0).saturating_mul(r.into())) + // Minimum execution time: 107_346_000 picoseconds. + Weight::from_parts(160_631_540, 0) + // Standard Error: 352_753 + .saturating_add(Weight::from_parts(338_685_448, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2904,22 +2898,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 44_452_286_000 picoseconds. - Weight::from_parts(44_568_744_000, 0) - // Standard Error: 268_880 - .saturating_add(Weight::from_parts(7_444_126, 0).saturating_mul(p.into())) - // Standard Error: 268_867 - .saturating_add(Weight::from_parts(179_724_917, 0).saturating_mul(s.into())) + // Minimum execution time: 44_754_074_000 picoseconds. + Weight::from_parts(44_833_050_000, 0) + // Standard Error: 269_308 + .saturating_add(Weight::from_parts(7_629_892, 0).saturating_mul(p.into())) + // Standard Error: 269_294 + .saturating_add(Weight::from_parts(179_148_245, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 96_042_000 picoseconds. - Weight::from_parts(163_443_462, 0) - // Standard Error: 381_777 - .saturating_add(Weight::from_parts(338_839_702, 0).saturating_mul(r.into())) + // Minimum execution time: 108_278_000 picoseconds. + Weight::from_parts(161_208_126, 0) + // Standard Error: 368_644 + .saturating_add(Weight::from_parts(346_324_329, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2927,32 +2921,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_724_116_000 picoseconds. - Weight::from_parts(42_849_968_000, 0) - // Standard Error: 263_445 - .saturating_add(Weight::from_parts(8_197_177, 0).saturating_mul(p.into())) - // Standard Error: 263_432 - .saturating_add(Weight::from_parts(180_050_572, 0).saturating_mul(s.into())) + // Minimum execution time: 44_266_209_000 picoseconds. + Weight::from_parts(44_559_345_000, 0) + // Standard Error: 270_420 + .saturating_add(Weight::from_parts(7_460_172, 0).saturating_mul(p.into())) + // Standard Error: 270_407 + .saturating_add(Weight::from_parts(179_211_260, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_607_000 picoseconds. - Weight::from_parts(100_957_693, 0) - // Standard Error: 29_067 - .saturating_add(Weight::from_parts(1_762_813, 0).saturating_mul(r.into())) + // Minimum execution time: 94_889_000 picoseconds. + Weight::from_parts(115_310_524, 0) + // Standard Error: 34_049 + .saturating_add(Weight::from_parts(1_916_607, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_305_000 picoseconds. - Weight::from_parts(108_825_748, 1131) - // Standard Error: 5_956 - .saturating_add(Weight::from_parts(11_809_647, 0).saturating_mul(p.into())) + // Minimum execution time: 97_825_000 picoseconds. + Weight::from_parts(251_440_245, 1131) + // Standard Error: 70_641 + .saturating_add(Weight::from_parts(15_652_952, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2961,10 +2955,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 87_531_000 picoseconds. - Weight::from_parts(88_749_000, 1131) - // Standard Error: 27_438 - .saturating_add(Weight::from_parts(35_435_114, 0).saturating_mul(p.into())) + // Minimum execution time: 96_761_000 picoseconds. + Weight::from_parts(100_398_000, 1131) + // Standard Error: 45_532 + .saturating_add(Weight::from_parts(39_790_625, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2973,10 +2967,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_087_078_000 picoseconds. - Weight::from_parts(5_882_681_000, 5069931) - // Standard Error: 87_545 - .saturating_add(Weight::from_parts(37_047_042, 0).saturating_mul(p.into())) + // Minimum execution time: 7_471_807_000 picoseconds. + Weight::from_parts(7_440_591_962, 5069931) + // Standard Error: 168_373 + .saturating_add(Weight::from_parts(40_244_359, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -2984,10 +2978,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 85_432_000 picoseconds. - Weight::from_parts(87_001_000, 1939) - // Standard Error: 47_768 - .saturating_add(Weight::from_parts(47_598_234, 0).saturating_mul(p.into())) + // Minimum execution time: 97_303_000 picoseconds. + Weight::from_parts(98_185_000, 1939) + // Standard Error: 38_471 + .saturating_add(Weight::from_parts(55_016_921, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -2996,10 +2990,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 92_594_000 picoseconds. - Weight::from_parts(93_795_036, 1131) - // Standard Error: 53_549 - .saturating_add(Weight::from_parts(35_797_869, 0).saturating_mul(p.into())) + // Minimum execution time: 102_497_000 picoseconds. + Weight::from_parts(104_932_685, 1131) + // Standard Error: 78_974 + .saturating_add(Weight::from_parts(39_257_150, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3008,10 +3002,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 769_397_000 picoseconds. - Weight::from_parts(792_321_925, 1496) - // Standard Error: 237_986 - .saturating_add(Weight::from_parts(48_847_504, 0).saturating_mul(p.into())) + // Minimum execution time: 612_308_000 picoseconds. + Weight::from_parts(642_079_999, 1496) + // Standard Error: 357_245 + .saturating_add(Weight::from_parts(46_518_860, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3020,10 +3014,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 1_113_735_000 picoseconds. - Weight::from_parts(1_148_020_828, 317931) - // Standard Error: 167_371 - .saturating_add(Weight::from_parts(47_795_831, 0).saturating_mul(p.into())) + // Minimum execution time: 1_068_248_000 picoseconds. + Weight::from_parts(1_080_741_205, 317931) + // Standard Error: 262_216 + .saturating_add(Weight::from_parts(50_047_907, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3031,884 +3025,882 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_154_000 picoseconds. - Weight::from_parts(4_280_364, 0) - // Standard Error: 8_638 - .saturating_add(Weight::from_parts(24_150_721, 0).saturating_mul(r.into())) + // Minimum execution time: 3_099_000 picoseconds. + Weight::from_parts(6_340_084, 0) + // Standard Error: 180_257 + .saturating_add(Weight::from_parts(74_666_091, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_339_689_000 picoseconds. - Weight::from_parts(4_202_598_633, 0) - // Standard Error: 74_721 - .saturating_add(Weight::from_parts(4_468_109, 0).saturating_mul(r.into())) + // Minimum execution time: 4_391_547_000 picoseconds. + Weight::from_parts(4_140_785_425, 0) + // Standard Error: 89_369 + .saturating_add(Weight::from_parts(5_769_622, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_343_068_000 picoseconds. - Weight::from_parts(4_226_706_212, 0) - // Standard Error: 60_538 - .saturating_add(Weight::from_parts(4_325_162, 0).saturating_mul(r.into())) + // Minimum execution time: 4_386_802_000 picoseconds. + Weight::from_parts(4_243_536_456, 0) + // Standard Error: 95_210 + .saturating_add(Weight::from_parts(5_278_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_409_473_000 picoseconds. - Weight::from_parts(11_882_222_938, 0) - // Standard Error: 194_167 - .saturating_add(Weight::from_parts(8_210_890, 0).saturating_mul(r.into())) + // Minimum execution time: 11_072_272_000 picoseconds. + Weight::from_parts(11_558_306_225, 0) + // Standard Error: 165_659 + .saturating_add(Weight::from_parts(9_828_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_212_512_000 picoseconds. - Weight::from_parts(10_628_957_808, 0) - // Standard Error: 170_508 - .saturating_add(Weight::from_parts(11_560_237, 0).saturating_mul(r.into())) + // Minimum execution time: 10_285_071_000 picoseconds. + Weight::from_parts(11_137_621_942, 0) + // Standard Error: 147_513 + .saturating_add(Weight::from_parts(9_014_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_229_000 picoseconds. - Weight::from_parts(2_319_000, 0) - // Standard Error: 9_576 - .saturating_add(Weight::from_parts(3_794_717, 0).saturating_mul(r.into())) + // Minimum execution time: 2_285_000 picoseconds. + Weight::from_parts(2_410_000, 0) + // Standard Error: 7_624 + .saturating_add(Weight::from_parts(3_864_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_265_000 picoseconds. - Weight::from_parts(2_353_000, 0) - // Standard Error: 5_018 - .saturating_add(Weight::from_parts(3_059_511, 0).saturating_mul(r.into())) + // Minimum execution time: 2_342_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 6_413 + .saturating_add(Weight::from_parts(3_120_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(3_531_925, 0) - // Standard Error: 1_167 - .saturating_add(Weight::from_parts(1_569_201, 0).saturating_mul(r.into())) + // Minimum execution time: 2_301_000 picoseconds. + Weight::from_parts(3_591_730, 0) + // Standard Error: 1_106 + .saturating_add(Weight::from_parts(1_565_415, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(2_359_000, 0) - // Standard Error: 9_672 - .saturating_add(Weight::from_parts(2_884_305, 0).saturating_mul(r.into())) + // Minimum execution time: 2_306_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 7_711 + .saturating_add(Weight::from_parts(2_932_880, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 8_373 - .saturating_add(Weight::from_parts(5_256_648, 0).saturating_mul(r.into())) + // Minimum execution time: 2_358_000 picoseconds. + Weight::from_parts(2_144_801, 0) + // Standard Error: 22_082 + .saturating_add(Weight::from_parts(5_266_139, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_012_000 picoseconds. - Weight::from_parts(4_938_253, 0) - // Standard Error: 2_214 - .saturating_add(Weight::from_parts(151_870, 0).saturating_mul(e.into())) + // Minimum execution time: 6_803_000 picoseconds. + Weight::from_parts(5_374_690, 0) + // Standard Error: 1_699 + .saturating_add(Weight::from_parts(171_193, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_309_000 picoseconds. - Weight::from_parts(4_232_448, 0) - // Standard Error: 6_359 - .saturating_add(Weight::from_parts(2_596_672, 0).saturating_mul(r.into())) + // Minimum execution time: 2_431_000 picoseconds. + Weight::from_parts(4_875_813, 0) + // Standard Error: 8_258 + .saturating_add(Weight::from_parts(2_629_733, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_596_672 - - 2_404_212, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_629_733 - + 2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(4_432_470, 0) - // Standard Error: 11_941 - .saturating_add(Weight::from_parts(2_404_212, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(5_140_243, 0) + // Standard Error: 13_164 + .saturating_add(Weight::from_parts(2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_776_000 picoseconds. - Weight::from_parts(12_954_286, 0) - // Standard Error: 30_568 - .saturating_add(Weight::from_parts(10_260_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_669_000 picoseconds. + Weight::from_parts(22_369_265, 0) + // Standard Error: 28_577 + .saturating_add(Weight::from_parts(9_740_558, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_935_000 picoseconds. - Weight::from_parts(1_635_475, 0) - // Standard Error: 7_669 - .saturating_add(Weight::from_parts(1_285_084, 0).saturating_mul(p.into())) + // Minimum execution time: 12_277_000 picoseconds. + Weight::from_parts(3_596_853, 0) + // Standard Error: 5_869 + .saturating_add(Weight::from_parts(1_258_605, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(l: u32, ) -> Weight { + fn instr_call_per_local(_l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_316_000 picoseconds. - Weight::from_parts(5_699_758, 0) - // Standard Error: 13 - .saturating_add(Weight::from_parts(34, 0).saturating_mul(l.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(5_778_137, 0) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_315_000 picoseconds. - Weight::from_parts(2_460_643, 0) - // Standard Error: 2_850 - .saturating_add(Weight::from_parts(235_587, 0).saturating_mul(r.into())) + // Minimum execution time: 4_835_000 picoseconds. + Weight::from_parts(6_065_483, 0) + // Standard Error: 3_006 + .saturating_add(Weight::from_parts(378_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_202_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 6_150 - .saturating_add(Weight::from_parts(730_523, 0).saturating_mul(r.into())) + // Minimum execution time: 4_722_000 picoseconds. + Weight::from_parts(3_902_309, 0) + // Standard Error: 5_742 + .saturating_add(Weight::from_parts(1_056_408, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_338_000, 0) - // Standard Error: 5_205 - .saturating_add(Weight::from_parts(679_669, 0).saturating_mul(r.into())) + // Minimum execution time: 4_888_000 picoseconds. + Weight::from_parts(4_512_058, 0) + // Standard Error: 6_410 + .saturating_add(Weight::from_parts(1_001_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_412_000 picoseconds. - Weight::from_parts(2_087_064, 0) - // Standard Error: 9_824 - .saturating_add(Weight::from_parts(743_737, 0).saturating_mul(r.into())) + // Minimum execution time: 6_413_000 picoseconds. + Weight::from_parts(2_704_134, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(804_200, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_388_000 picoseconds. - Weight::from_parts(6_512_000, 0) - // Standard Error: 7_958 - .saturating_add(Weight::from_parts(1_283_588, 0).saturating_mul(r.into())) + // Minimum execution time: 6_516_000 picoseconds. + Weight::from_parts(1_028_752, 0) + // Standard Error: 8_792 + .saturating_add(Weight::from_parts(1_494_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_885_000 picoseconds. - Weight::from_parts(4_075_795, 0) - // Standard Error: 12_241 - .saturating_add(Weight::from_parts(6_965_908, 0).saturating_mul(r.into())) + // Minimum execution time: 5_560_000 picoseconds. + Weight::from_parts(1_126_442, 0) + // Standard Error: 14_476 + .saturating_add(Weight::from_parts(7_240_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 5_936 - .saturating_add(Weight::from_parts(3_299_707, 0).saturating_mul(r.into())) + // Minimum execution time: 2_299_000 picoseconds. + Weight::from_parts(2_449_000, 0) + // Standard Error: 7_416 + .saturating_add(Weight::from_parts(3_344_387, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 6_255 - .saturating_add(Weight::from_parts(2_999_382, 0).saturating_mul(r.into())) + // Minimum execution time: 2_389_000 picoseconds. + Weight::from_parts(2_551_000, 0) + // Standard Error: 5_708 + .saturating_add(Weight::from_parts(3_133_430, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 6_896 - .saturating_add(Weight::from_parts(2_967_047, 0).saturating_mul(r.into())) + // Minimum execution time: 2_428_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 7_262 + .saturating_add(Weight::from_parts(3_192_675, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 4_893 - .saturating_add(Weight::from_parts(2_579_110, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(2_426_000, 0) + // Standard Error: 4_554 + .saturating_add(Weight::from_parts(2_683_293, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_304_000, 0) - // Standard Error: 3_852 - .saturating_add(Weight::from_parts(520_005, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 4_686 + .saturating_add(Weight::from_parts(631_609, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_274_000 picoseconds. - Weight::from_parts(1_794_591, 0) - // Standard Error: 3_416 - .saturating_add(Weight::from_parts(359_819, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(1_221_890, 0) + // Standard Error: 3_960 + .saturating_add(Weight::from_parts(452_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_287_000, 0) - // Standard Error: 10_307 - .saturating_add(Weight::from_parts(1_833_775, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_390_000, 0) + // Standard Error: 11_114 + .saturating_add(Weight::from_parts(1_916_122, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_287_000 picoseconds. - Weight::from_parts(2_349_000, 0) - // Standard Error: 9_393 - .saturating_add(Weight::from_parts(1_178_942, 0).saturating_mul(r.into())) + // Minimum execution time: 2_436_000 picoseconds. + Weight::from_parts(2_504_000, 0) + // Standard Error: 7_104 + .saturating_add(Weight::from_parts(1_156_958, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_256_508, 0) - // Standard Error: 3_133 - .saturating_add(Weight::from_parts(326_908, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(1_708_596, 0) + // Standard Error: 2_843 + .saturating_add(Weight::from_parts(377_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_298_000 picoseconds. - Weight::from_parts(1_792_383, 0) - // Standard Error: 2_981 - .saturating_add(Weight::from_parts(325_072, 0).saturating_mul(r.into())) + // Minimum execution time: 2_386_000 picoseconds. + Weight::from_parts(1_424_415, 0) + // Standard Error: 3_599 + .saturating_add(Weight::from_parts(395_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(236_190, 0) - // Standard Error: 5_791 - .saturating_add(Weight::from_parts(526_784, 0).saturating_mul(r.into())) + // Minimum execution time: 2_396_000 picoseconds. + Weight::from_parts(2_491_000, 0) + // Standard Error: 3_774 + .saturating_add(Weight::from_parts(516_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(18_346, 0) - // Standard Error: 5_882 - .saturating_add(Weight::from_parts(538_848, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(548_192, 0) + // Standard Error: 4_583 + .saturating_add(Weight::from_parts(556_734, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 4_502 - .saturating_add(Weight::from_parts(463_034, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(447_271, 0) + // Standard Error: 5_300 + .saturating_add(Weight::from_parts(535_915, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_272_000 picoseconds. - Weight::from_parts(2_193_450, 0) - // Standard Error: 3_655 - .saturating_add(Weight::from_parts(304_226, 0).saturating_mul(r.into())) + // Minimum execution time: 2_340_000 picoseconds. + Weight::from_parts(1_639_695, 0) + // Standard Error: 3_519 + .saturating_add(Weight::from_parts(368_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_803_358, 0) - // Standard Error: 2_256 - .saturating_add(Weight::from_parts(163_489, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_843_474, 0) + // Standard Error: 1_950 + .saturating_add(Weight::from_parts(176_592, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_242_000 picoseconds. - Weight::from_parts(3_087_274, 0) - // Standard Error: 1_907 - .saturating_add(Weight::from_parts(146_988, 0).saturating_mul(r.into())) + // Minimum execution time: 2_351_000 picoseconds. + Weight::from_parts(2_894_613, 0) + // Standard Error: 2_024 + .saturating_add(Weight::from_parts(188_853, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_335_000, 0) - // Standard Error: 9_220 - .saturating_add(Weight::from_parts(1_682_986, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_418_000, 0) + // Standard Error: 9_504 + .saturating_add(Weight::from_parts(1_936_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_244_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 7_751 - .saturating_add(Weight::from_parts(1_073_438, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_364_000, 0) + // Standard Error: 8_346 + .saturating_add(Weight::from_parts(1_222_521, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_297_000, 0) - // Standard Error: 9_887 - .saturating_add(Weight::from_parts(1_746_888, 0).saturating_mul(r.into())) + // Minimum execution time: 2_345_000 picoseconds. + Weight::from_parts(2_452_000, 0) + // Standard Error: 10_232 + .saturating_add(Weight::from_parts(1_883_867, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_225_000 picoseconds. - Weight::from_parts(2_305_000, 0) - // Standard Error: 8_241 - .saturating_add(Weight::from_parts(1_123_968, 0).saturating_mul(r.into())) + // Minimum execution time: 2_323_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 7_581 + .saturating_add(Weight::from_parts(1_200_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_325_000 picoseconds. - Weight::from_parts(2_368_000, 0) - // Standard Error: 10_199 - .saturating_add(Weight::from_parts(1_754_281, 0).saturating_mul(r.into())) + // Minimum execution time: 2_410_000 picoseconds. + Weight::from_parts(2_459_000, 0) + // Standard Error: 11_139 + .saturating_add(Weight::from_parts(1_877_766, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 7_885 - .saturating_add(Weight::from_parts(1_054_096, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 8_083 + .saturating_add(Weight::from_parts(1_217_904, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_212_000 picoseconds. - Weight::from_parts(2_244_000, 0) - // Standard Error: 11_272 - .saturating_add(Weight::from_parts(1_769_874, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(2_482_000, 0) + // Standard Error: 11_044 + .saturating_add(Weight::from_parts(1_956_302, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_248_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 8_360 - .saturating_add(Weight::from_parts(1_115_362, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 7_870 + .saturating_add(Weight::from_parts(1_213_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 9_424 - .saturating_add(Weight::from_parts(1_807_643, 0).saturating_mul(r.into())) + // Minimum execution time: 2_364_000 picoseconds. + Weight::from_parts(2_430_000, 0) + // Standard Error: 10_577 + .saturating_add(Weight::from_parts(1_968_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 7_499 - .saturating_add(Weight::from_parts(1_087_178, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_442_000, 0) + // Standard Error: 7_838 + .saturating_add(Weight::from_parts(1_267_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 11_743 - .saturating_add(Weight::from_parts(1_703_075, 0).saturating_mul(r.into())) + // Minimum execution time: 2_395_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 10_856 + .saturating_add(Weight::from_parts(1_910_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_137_000 picoseconds. - Weight::from_parts(2_254_000, 0) - // Standard Error: 8_099 - .saturating_add(Weight::from_parts(1_080_763, 0).saturating_mul(r.into())) + // Minimum execution time: 2_343_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 5_786 + .saturating_add(Weight::from_parts(1_128_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_183_000 picoseconds. - Weight::from_parts(2_301_000, 0) - // Standard Error: 10_230 - .saturating_add(Weight::from_parts(1_738_567, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 10_344 + .saturating_add(Weight::from_parts(1_897_480, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_209_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 8_536 - .saturating_add(Weight::from_parts(1_161_928, 0).saturating_mul(r.into())) + // Minimum execution time: 2_355_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 6_963 + .saturating_add(Weight::from_parts(1_125_698, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_208_000 picoseconds. - Weight::from_parts(2_255_000, 0) - // Standard Error: 10_368 - .saturating_add(Weight::from_parts(1_847_441, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_447_000, 0) + // Standard Error: 8_285 + .saturating_add(Weight::from_parts(1_848_149, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 8_213 - .saturating_add(Weight::from_parts(1_112_048, 0).saturating_mul(r.into())) + // Minimum execution time: 2_327_000 picoseconds. + Weight::from_parts(2_394_000, 0) + // Standard Error: 7_282 + .saturating_add(Weight::from_parts(1_176_423, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_270_000, 0) - // Standard Error: 12_684 - .saturating_add(Weight::from_parts(1_728_765, 0).saturating_mul(r.into())) + // Minimum execution time: 2_372_000 picoseconds. + Weight::from_parts(2_439_000, 0) + // Standard Error: 9_207 + .saturating_add(Weight::from_parts(1_837_009, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_573_000 picoseconds. - Weight::from_parts(2_655_000, 0) - // Standard Error: 7_404 - .saturating_add(Weight::from_parts(1_080_080, 0).saturating_mul(r.into())) + // Minimum execution time: 2_368_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_320 + .saturating_add(Weight::from_parts(1_231_088, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 9_739 - .saturating_add(Weight::from_parts(1_807_913, 0).saturating_mul(r.into())) + // Minimum execution time: 2_373_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 9_499 + .saturating_add(Weight::from_parts(1_922_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 7_265 - .saturating_add(Weight::from_parts(1_087_210, 0).saturating_mul(r.into())) + // Minimum execution time: 2_387_000 picoseconds. + Weight::from_parts(2_455_000, 0) + // Standard Error: 7_681 + .saturating_add(Weight::from_parts(1_198_894, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_252_000 picoseconds. - Weight::from_parts(2_311_000, 0) - // Standard Error: 7_444 - .saturating_add(Weight::from_parts(1_191_685, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 7_797 + .saturating_add(Weight::from_parts(1_286_566, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_263_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 5_023 - .saturating_add(Weight::from_parts(585_667, 0).saturating_mul(r.into())) + // Minimum execution time: 2_329_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 4_968 + .saturating_add(Weight::from_parts(645_254, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_320_000, 0) - // Standard Error: 10_018 - .saturating_add(Weight::from_parts(1_297_791, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(2_489_000, 0) + // Standard Error: 7_055 + .saturating_add(Weight::from_parts(1_232_084, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_291_000 picoseconds. - Weight::from_parts(2_312_000, 0) - // Standard Error: 4_776 - .saturating_add(Weight::from_parts(612_864, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 4_348 + .saturating_add(Weight::from_parts(633_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_286_000 picoseconds. - Weight::from_parts(2_356_000, 0) - // Standard Error: 11_619 - .saturating_add(Weight::from_parts(1_743_809, 0).saturating_mul(r.into())) + // Minimum execution time: 2_336_000 picoseconds. + Weight::from_parts(2_413_000, 0) + // Standard Error: 8_202 + .saturating_add(Weight::from_parts(1_777_425, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_302_000 picoseconds. - Weight::from_parts(2_343_000, 0) - // Standard Error: 8_638 - .saturating_add(Weight::from_parts(1_136_060, 0).saturating_mul(r.into())) + // Minimum execution time: 2_314_000 picoseconds. + Weight::from_parts(2_369_000, 0) + // Standard Error: 6_935 + .saturating_add(Weight::from_parts(1_201_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 7_114 - .saturating_add(Weight::from_parts(2_599_346, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(6_846_840, 0) + // Standard Error: 17_822 + .saturating_add(Weight::from_parts(2_268_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_200_000 picoseconds. - Weight::from_parts(3_823_403, 0) - // Standard Error: 18_912 - .saturating_add(Weight::from_parts(2_161_963, 0).saturating_mul(r.into())) + // Minimum execution time: 2_394_000 picoseconds. + Weight::from_parts(4_704_336, 0) + // Standard Error: 10_960 + .saturating_add(Weight::from_parts(2_182_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_199_000 picoseconds. - Weight::from_parts(2_817_173, 0) - // Standard Error: 17_341 - .saturating_add(Weight::from_parts(2_740_748, 0).saturating_mul(r.into())) + // Minimum execution time: 2_375_000 picoseconds. + Weight::from_parts(1_968_824, 0) + // Standard Error: 15_899 + .saturating_add(Weight::from_parts(2_762_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_294_000 picoseconds. - Weight::from_parts(88_235, 0) - // Standard Error: 10_326 - .saturating_add(Weight::from_parts(2_481_087, 0).saturating_mul(r.into())) + // Minimum execution time: 2_335_000 picoseconds. + Weight::from_parts(1_450_000, 0) + // Standard Error: 13_496 + .saturating_add(Weight::from_parts(2_401_407, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 14_480 - .saturating_add(Weight::from_parts(9_604_981, 0).saturating_mul(r.into())) + // Minimum execution time: 2_448_000 picoseconds. + Weight::from_parts(2_513_000, 0) + // Standard Error: 19_401 + .saturating_add(Weight::from_parts(9_309_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_260_000, 0) - // Standard Error: 21_926 - .saturating_add(Weight::from_parts(7_501_289, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(1_738_370, 0) + // Standard Error: 42_672 + .saturating_add(Weight::from_parts(7_512_557, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_309_000 picoseconds. - Weight::from_parts(10_308_173, 0) - // Standard Error: 30_680 - .saturating_add(Weight::from_parts(2_288_505, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_215_088, 0) + // Standard Error: 15_445 + .saturating_add(Weight::from_parts(2_956_278, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_290_000, 0) - // Standard Error: 5_007 - .saturating_add(Weight::from_parts(2_516_076, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(217_500, 0) + // Standard Error: 7_904 + .saturating_add(Weight::from_parts(2_576_151, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_228_000 picoseconds. - Weight::from_parts(2_300_000, 0) - // Standard Error: 8_948 - .saturating_add(Weight::from_parts(1_264_596, 0).saturating_mul(r.into())) + // Minimum execution time: 2_456_000 picoseconds. + Weight::from_parts(2_503_000, 0) + // Standard Error: 7_920 + .saturating_add(Weight::from_parts(1_321_543, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_213_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 5_099 - .saturating_add(Weight::from_parts(612_107, 0).saturating_mul(r.into())) + // Minimum execution time: 2_346_000 picoseconds. + Weight::from_parts(2_479_000, 0) + // Standard Error: 4_711 + .saturating_add(Weight::from_parts(689_892, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(2_326_000, 0) - // Standard Error: 10_004 - .saturating_add(Weight::from_parts(1_278_365, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_029 + .saturating_add(Weight::from_parts(1_256_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_258_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 5_578 - .saturating_add(Weight::from_parts(645_196, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_480_000, 0) + // Standard Error: 3_812 + .saturating_add(Weight::from_parts(607_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_338_000 picoseconds. - Weight::from_parts(2_363_000, 0) - // Standard Error: 8_554 - .saturating_add(Weight::from_parts(1_288_676, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 7_362 + .saturating_add(Weight::from_parts(1_248_739, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_332_000, 0) - // Standard Error: 3_999 - .saturating_add(Weight::from_parts(594_484, 0).saturating_mul(r.into())) + // Minimum execution time: 2_419_000 picoseconds. + Weight::from_parts(2_465_000, 0) + // Standard Error: 4_304 + .saturating_add(Weight::from_parts(604_813, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_258_000, 0) - // Standard Error: 7_437 - .saturating_add(Weight::from_parts(1_044_306, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 8_043 + .saturating_add(Weight::from_parts(1_073_194, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_226_000 picoseconds. - Weight::from_parts(2_308_000, 0) - // Standard Error: 4_658 - .saturating_add(Weight::from_parts(537_262, 0).saturating_mul(r.into())) + // Minimum execution time: 2_427_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 4_969 + .saturating_add(Weight::from_parts(594_802, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_296_000, 0) - // Standard Error: 10_254 - .saturating_add(Weight::from_parts(1_154_138, 0).saturating_mul(r.into())) + // Minimum execution time: 2_312_000 picoseconds. + Weight::from_parts(2_399_000, 0) + // Standard Error: 7_093 + .saturating_add(Weight::from_parts(1_110_114, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_234_000 picoseconds. - Weight::from_parts(2_313_000, 0) - // Standard Error: 4_960 - .saturating_add(Weight::from_parts(607_930, 0).saturating_mul(r.into())) + // Minimum execution time: 2_331_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 4_140 + .saturating_add(Weight::from_parts(600_354, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_279_000 picoseconds. - Weight::from_parts(2_342_000, 0) - // Standard Error: 7_909 - .saturating_add(Weight::from_parts(1_094_660, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_419_000, 0) + // Standard Error: 7_150 + .saturating_add(Weight::from_parts(1_154_649, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_232_000 picoseconds. - Weight::from_parts(39_069, 0) - // Standard Error: 6_710 - .saturating_add(Weight::from_parts(599_572, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_423_000, 0) + // Standard Error: 5_067 + .saturating_add(Weight::from_parts(594_487, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 8_785 - .saturating_add(Weight::from_parts(1_060_321, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_406_000, 0) + // Standard Error: 5_674 + .saturating_add(Weight::from_parts(1_051_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_257_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 4_191 - .saturating_add(Weight::from_parts(528_319, 0).saturating_mul(r.into())) + // Minimum execution time: 2_383_000 picoseconds. + Weight::from_parts(114_723, 0) + // Standard Error: 5_881 + .saturating_add(Weight::from_parts(646_798, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_256_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 9_328 - .saturating_add(Weight::from_parts(1_114_164, 0).saturating_mul(r.into())) + // Minimum execution time: 2_292_000 picoseconds. + Weight::from_parts(2_422_000, 0) + // Standard Error: 6_697 + .saturating_add(Weight::from_parts(1_053_580, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_210_000 picoseconds. - Weight::from_parts(390_951, 0) - // Standard Error: 5_316 - .saturating_add(Weight::from_parts(609_568, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(206_699, 0) + // Standard Error: 5_851 + .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } } diff --git a/runtime/gear/src/weights/pallet_gear_voucher.rs b/runtime/gear/src/weights/pallet_gear_voucher.rs index 6430deada98..6d6889d1752 100644 --- a/runtime/gear/src/weights/pallet_gear_voucher.rs +++ b/runtime/gear/src/weights/pallet_gear_voucher.rs @@ -19,13 +19,13 @@ //! Autogenerated weights for pallet_gear_voucher //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/gear benchmark pallet --chain=gear-dev --steps=50 --repeat=20 --pallet=pallet_gear_voucher --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_gear_voucher.rs --template=.maintain/frame-weight-template.hbs +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_gear_voucher --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_gear_voucher.rs --template=.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -47,8 +47,8 @@ impl pallet_gear_voucher::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 26_728_000 picoseconds. - Weight::from_parts(27_248_000, 6196) + // Minimum execution time: 25_876_000 picoseconds. + Weight::from_parts(26_659_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -60,8 +60,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 26_728_000 picoseconds. - Weight::from_parts(27_248_000, 6196) + // Minimum execution time: 25_876_000 picoseconds. + Weight::from_parts(26_659_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/runtime/gear/src/weights/pallet_timestamp.rs b/runtime/gear/src/weights/pallet_timestamp.rs index c826119e49e..5c50f24c824 100644 --- a/runtime/gear/src/weights/pallet_timestamp.rs +++ b/runtime/gear/src/weights/pallet_timestamp.rs @@ -19,13 +19,13 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/gear benchmark pallet --chain=gear-dev --steps=50 --repeat=20 --pallet=pallet_timestamp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_timestamp.rs --template=.maintain/frame-weight-template.hbs +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_timestamp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_timestamp.rs --template=.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -46,19 +46,19 @@ pub struct SubstrateWeight(PhantomData); impl pallet_timestamp::WeightInfo for SubstrateWeight { fn set() -> Weight { // Proof Size summary in bytes: - // Measured: `175` + // Measured: `211` // Estimated: `2986` - // Minimum execution time: 7_698_000 picoseconds. - Weight::from_parts(8_141_000, 2986) + // Minimum execution time: 9_513_000 picoseconds. + Weight::from_parts(10_337_000, 2986) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } fn on_finalize() -> Weight { // Proof Size summary in bytes: - // Measured: `57` + // Measured: `94` // Estimated: `0` - // Minimum execution time: 3_104_000 picoseconds. - Weight::from_parts(3_276_000, 0) + // Minimum execution time: 3_681_000 picoseconds. + Weight::from_parts(3_916_000, 0) } } @@ -66,18 +66,18 @@ impl pallet_timestamp::WeightInfo for SubstrateWeight Weight { // Proof Size summary in bytes: - // Measured: `175` + // Measured: `211` // Estimated: `2986` - // Minimum execution time: 7_698_000 picoseconds. - Weight::from_parts(8_141_000, 2986) + // Minimum execution time: 9_513_000 picoseconds. + Weight::from_parts(10_337_000, 2986) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } fn on_finalize() -> Weight { // Proof Size summary in bytes: - // Measured: `57` + // Measured: `94` // Estimated: `0` - // Minimum execution time: 3_104_000 picoseconds. - Weight::from_parts(3_276_000, 0) + // Minimum execution time: 3_681_000 picoseconds. + Weight::from_parts(3_916_000, 0) } } diff --git a/runtime/gear/src/weights/pallet_utility.rs b/runtime/gear/src/weights/pallet_utility.rs index e53f42e744f..514181ef7a3 100644 --- a/runtime/gear/src/weights/pallet_utility.rs +++ b/runtime/gear/src/weights/pallet_utility.rs @@ -19,13 +19,13 @@ //! Autogenerated weights for pallet_utility //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("gear-dev"), DB CACHE: 1024 +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/gear benchmark pallet --chain=gear-dev --steps=50 --repeat=20 --pallet=pallet_utility --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_utility.rs --template=.maintain/frame-weight-template.hbs +// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_utility --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_utility.rs --template=.maintain/frame-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -52,44 +52,44 @@ impl pallet_utility::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_257_000 picoseconds. - Weight::from_parts(4_780_489, 0) - // Standard Error: 5_942 - .saturating_add(Weight::from_parts(4_050_876, 0).saturating_mul(c.into())) + // Minimum execution time: 5_349_000 picoseconds. + Weight::from_parts(8_798_188, 0) + // Standard Error: 2_360 + .saturating_add(Weight::from_parts(3_859_914, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_444_000 picoseconds. - Weight::from_parts(3_651_000, 0) + // Minimum execution time: 3_760_000 picoseconds. + Weight::from_parts(3_882_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_391_000 picoseconds. - Weight::from_parts(13_396_792, 0) - // Standard Error: 5_623 - .saturating_add(Weight::from_parts(4_206_823, 0).saturating_mul(c.into())) + // Minimum execution time: 5_343_000 picoseconds. + Weight::from_parts(6_613_150, 0) + // Standard Error: 2_902 + .saturating_add(Weight::from_parts(4_045_901, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_836_000 picoseconds. - Weight::from_parts(7_186_000, 0) + // Minimum execution time: 6_983_000 picoseconds. + Weight::from_parts(7_317_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_427_000 picoseconds. - Weight::from_parts(14_488_578, 0) - // Standard Error: 6_374 - .saturating_add(Weight::from_parts(4_015_154, 0).saturating_mul(c.into())) + // Minimum execution time: 5_419_000 picoseconds. + Weight::from_parts(9_009_348, 0) + // Standard Error: 2_400 + .saturating_add(Weight::from_parts(3_868_692, 0).saturating_mul(c.into())) } } @@ -100,43 +100,43 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_257_000 picoseconds. - Weight::from_parts(4_780_489, 0) - // Standard Error: 5_942 - .saturating_add(Weight::from_parts(4_050_876, 0).saturating_mul(c.into())) + // Minimum execution time: 5_349_000 picoseconds. + Weight::from_parts(8_798_188, 0) + // Standard Error: 2_360 + .saturating_add(Weight::from_parts(3_859_914, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_444_000 picoseconds. - Weight::from_parts(3_651_000, 0) + // Minimum execution time: 3_760_000 picoseconds. + Weight::from_parts(3_882_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_391_000 picoseconds. - Weight::from_parts(13_396_792, 0) - // Standard Error: 5_623 - .saturating_add(Weight::from_parts(4_206_823, 0).saturating_mul(c.into())) + // Minimum execution time: 5_343_000 picoseconds. + Weight::from_parts(6_613_150, 0) + // Standard Error: 2_902 + .saturating_add(Weight::from_parts(4_045_901, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_836_000 picoseconds. - Weight::from_parts(7_186_000, 0) + // Minimum execution time: 6_983_000 picoseconds. + Weight::from_parts(7_317_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_427_000 picoseconds. - Weight::from_parts(14_488_578, 0) - // Standard Error: 6_374 - .saturating_add(Weight::from_parts(4_015_154, 0).saturating_mul(c.into())) + // Minimum execution time: 5_419_000 picoseconds. + Weight::from_parts(9_009_348, 0) + // Standard Error: 2_400 + .saturating_add(Weight::from_parts(3_868_692, 0).saturating_mul(c.into())) } } diff --git a/runtime/vara/src/tests.rs b/runtime/vara/src/tests.rs index 2dbfc3d0412..ab677a238d5 100644 --- a/runtime/vara/src/tests.rs +++ b/runtime/vara/src/tests.rs @@ -142,10 +142,10 @@ fn page_costs_heuristic_test() { lazy_pages_host_func_read: 29_000_000.into(), lazy_pages_host_func_write: 33_000_000.into(), lazy_pages_host_func_write_after_read: 10_687_730.into(), - load_page_data: 8_700_000.into(), + load_page_data: 9_700_000.into(), upload_page_data: 104_000_000.into(), static_page: 100.into(), - mem_grow: 306_170.into(), + mem_grow: 906_170.into(), parachain_load_heuristic: 0.into(), }; @@ -156,7 +156,7 @@ fn page_costs_heuristic_test() { host_func_read: 29_000_000.into(), host_func_write: 137_000_000.into(), host_func_write_after_read: 112_000_000.into(), - load_page_storage_data: 8_700_000.into(), + load_page_storage_data: 9_700_000.into(), }; check_pages_weights( diff --git a/runtime/vara/src/weights/frame_system.rs b/runtime/vara/src/weights/frame_system.rs index 4a96c3b0457..31dd34692d1 100644 --- a/runtime/vara/src/weights/frame_system.rs +++ b/runtime/vara/src/weights/frame_system.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for frame_system //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -53,27 +53,27 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_619_000 picoseconds. - Weight::from_parts(1_222_978, 0) + // Minimum execution time: 1_562_000 picoseconds. + Weight::from_parts(1_066_991, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(461, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 1310720]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_210_000 picoseconds. - Weight::from_parts(6_305_000, 0) + // Minimum execution time: 5_949_000 picoseconds. + Weight::from_parts(6_153_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_438, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_441, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_022_000 picoseconds. - Weight::from_parts(3_351_000, 1485) + // Minimum execution time: 3_113_000 picoseconds. + Weight::from_parts(3_394_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -82,10 +82,10 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_529_000 picoseconds. - Weight::from_parts(1_573_000, 0) - // Standard Error: 997 - .saturating_add(Weight::from_parts(684_007, 0).saturating_mul(i.into())) + // Minimum execution time: 1_578_000 picoseconds. + Weight::from_parts(1_632_000, 0) + // Standard Error: 994 + .saturating_add(Weight::from_parts(687_989, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -93,21 +93,21 @@ impl frame_system::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_611_000 picoseconds. - Weight::from_parts(1_646_000, 0) - // Standard Error: 813 - .saturating_add(Weight::from_parts(531_452, 0).saturating_mul(i.into())) + // Minimum execution time: 1_593_000 picoseconds. + Weight::from_parts(1_667_000, 0) + // Standard Error: 783 + .saturating_add(Weight::from_parts(535_872, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `82 + p * (69 ±0)` - // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 3_424_000 picoseconds. - Weight::from_parts(3_487_000, 83) - // Standard Error: 1_821 - .saturating_add(Weight::from_parts(1_126_082, 0).saturating_mul(p.into())) + // Estimated: `89 + p * (70 ±0)` + // Minimum execution time: 3_345_000 picoseconds. + Weight::from_parts(3_470_000, 89) + // Standard Error: 1_511 + .saturating_add(Weight::from_parts(1_126_865, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) @@ -121,27 +121,27 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_619_000 picoseconds. - Weight::from_parts(1_222_978, 0) + // Minimum execution time: 1_562_000 picoseconds. + Weight::from_parts(1_066_991, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(460, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(461, 0).saturating_mul(b.into())) } /// The range of component `b` is `[0, 1310720]`. fn remark_with_event(b: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_210_000 picoseconds. - Weight::from_parts(6_305_000, 0) + // Minimum execution time: 5_949_000 picoseconds. + Weight::from_parts(6_153_000, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(1_438, 0).saturating_mul(b.into())) + .saturating_add(Weight::from_parts(1_441, 0).saturating_mul(b.into())) } fn set_heap_pages() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 3_022_000 picoseconds. - Weight::from_parts(3_351_000, 1485) + // Minimum execution time: 3_113_000 picoseconds. + Weight::from_parts(3_394_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -150,10 +150,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_529_000 picoseconds. - Weight::from_parts(1_573_000, 0) - // Standard Error: 997 - .saturating_add(Weight::from_parts(684_007, 0).saturating_mul(i.into())) + // Minimum execution time: 1_578_000 picoseconds. + Weight::from_parts(1_632_000, 0) + // Standard Error: 994 + .saturating_add(Weight::from_parts(687_989, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `i` is `[0, 1000]`. @@ -161,21 +161,21 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_611_000 picoseconds. - Weight::from_parts(1_646_000, 0) - // Standard Error: 813 - .saturating_add(Weight::from_parts(531_452, 0).saturating_mul(i.into())) + // Minimum execution time: 1_593_000 picoseconds. + Weight::from_parts(1_667_000, 0) + // Standard Error: 783 + .saturating_add(Weight::from_parts(535_872, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(i.into()))) } /// The range of component `p` is `[0, 1000]`. fn kill_prefix(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `82 + p * (69 ±0)` - // Estimated: `83 + p * (70 ±0)` - // Minimum execution time: 3_424_000 picoseconds. - Weight::from_parts(3_487_000, 83) - // Standard Error: 1_821 - .saturating_add(Weight::from_parts(1_126_082, 0).saturating_mul(p.into())) + // Estimated: `89 + p * (70 ±0)` + // Minimum execution time: 3_345_000 picoseconds. + Weight::from_parts(3_470_000, 89) + // Standard Error: 1_511 + .saturating_add(Weight::from_parts(1_126_865, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(p.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into())) diff --git a/runtime/vara/src/weights/pallet_airdrop.rs b/runtime/vara/src/weights/pallet_airdrop.rs index a61092155c8..ffe616fea00 100644 --- a/runtime/vara/src/weights/pallet_airdrop.rs +++ b/runtime/vara/src/weights/pallet_airdrop.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_airdrop //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -49,8 +49,8 @@ impl pallet_airdrop::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 25_544_000 picoseconds. - Weight::from_parts(26_559_640, 6196) + // Minimum execution time: 25_162_000 picoseconds. + Weight::from_parts(26_300_954, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -59,10 +59,10 @@ impl pallet_airdrop::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `550` // Estimated: `15482` - // Minimum execution time: 65_922_000 picoseconds. - Weight::from_parts(67_728_019, 15482) - // Standard Error: 331 - .saturating_add(Weight::from_parts(501, 0).saturating_mul(q.into())) + // Minimum execution time: 65_671_000 picoseconds. + Weight::from_parts(67_524_170, 15482) + // Standard Error: 398 + .saturating_add(Weight::from_parts(280, 0).saturating_mul(q.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -75,8 +75,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 25_544_000 picoseconds. - Weight::from_parts(26_559_640, 6196) + // Minimum execution time: 25_162_000 picoseconds. + Weight::from_parts(26_300_954, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -85,10 +85,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `550` // Estimated: `15482` - // Minimum execution time: 65_922_000 picoseconds. - Weight::from_parts(67_728_019, 15482) - // Standard Error: 331 - .saturating_add(Weight::from_parts(501, 0).saturating_mul(q.into())) + // Minimum execution time: 65_671_000 picoseconds. + Weight::from_parts(67_524_170, 15482) + // Standard Error: 398 + .saturating_add(Weight::from_parts(280, 0).saturating_mul(q.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } diff --git a/runtime/vara/src/weights/pallet_balances.rs b/runtime/vara/src/weights/pallet_balances.rs index 22130616509..f096d50de43 100644 --- a/runtime/vara/src/weights/pallet_balances.rs +++ b/runtime/vara/src/weights/pallet_balances.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_balances //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -53,8 +53,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 30_481_000 picoseconds. - Weight::from_parts(31_107_000, 3593) + // Minimum execution time: 29_789_000 picoseconds. + Weight::from_parts(30_683_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -62,8 +62,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 21_607_000 picoseconds. - Weight::from_parts(22_313_000, 3593) + // Minimum execution time: 21_425_000 picoseconds. + Weight::from_parts(21_900_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -71,8 +71,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_411_000 picoseconds. - Weight::from_parts(12_689_000, 3593) + // Minimum execution time: 12_387_000 picoseconds. + Weight::from_parts(12_754_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -80,8 +80,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 14_986_000 picoseconds. - Weight::from_parts(15_531_000, 3593) + // Minimum execution time: 15_196_000 picoseconds. + Weight::from_parts(15_778_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -89,8 +89,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 31_713_000 picoseconds. - Weight::from_parts(32_359_000, 6196) + // Minimum execution time: 31_544_000 picoseconds. + Weight::from_parts(32_018_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -98,8 +98,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 28_362_000 picoseconds. - Weight::from_parts(29_064_000, 3593) + // Minimum execution time: 28_027_000 picoseconds. + Weight::from_parts(29_047_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -107,8 +107,8 @@ impl pallet_balances::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 11_971_000 picoseconds. - Weight::from_parts(12_309_000, 3593) + // Minimum execution time: 11_796_000 picoseconds. + Weight::from_parts(12_239_000, 3593) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -120,8 +120,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 30_481_000 picoseconds. - Weight::from_parts(31_107_000, 3593) + // Minimum execution time: 29_789_000 picoseconds. + Weight::from_parts(30_683_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -129,8 +129,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 21_607_000 picoseconds. - Weight::from_parts(22_313_000, 3593) + // Minimum execution time: 21_425_000 picoseconds. + Weight::from_parts(21_900_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -138,8 +138,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 12_411_000 picoseconds. - Weight::from_parts(12_689_000, 3593) + // Minimum execution time: 12_387_000 picoseconds. + Weight::from_parts(12_754_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -147,8 +147,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 14_986_000 picoseconds. - Weight::from_parts(15_531_000, 3593) + // Minimum execution time: 15_196_000 picoseconds. + Weight::from_parts(15_778_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -156,8 +156,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `6196` - // Minimum execution time: 31_713_000 picoseconds. - Weight::from_parts(32_359_000, 6196) + // Minimum execution time: 31_544_000 picoseconds. + Weight::from_parts(32_018_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -165,8 +165,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3593` - // Minimum execution time: 28_362_000 picoseconds. - Weight::from_parts(29_064_000, 3593) + // Minimum execution time: 28_027_000 picoseconds. + Weight::from_parts(29_047_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -174,8 +174,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `103` // Estimated: `3593` - // Minimum execution time: 11_971_000 picoseconds. - Weight::from_parts(12_309_000, 3593) + // Minimum execution time: 11_796_000 picoseconds. + Weight::from_parts(12_239_000, 3593) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } diff --git a/runtime/vara/src/weights/pallet_gear.rs b/runtime/vara/src/weights/pallet_gear.rs index 35229a049ee..707b287d5c5 100644 --- a/runtime/vara/src/weights/pallet_gear.rs +++ b/runtime/vara/src/weights/pallet_gear.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -244,21 +244,21 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_012_000 picoseconds. - Weight::from_parts(1_102_000, 0) - // Standard Error: 721 - .saturating_add(Weight::from_parts(207_628, 0).saturating_mul(c.into())) + // Minimum execution time: 1_023_000 picoseconds. + Weight::from_parts(1_051_000, 0) + // Standard Error: 912 + .saturating_add(Weight::from_parts(213_761, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. fn db_read_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `113 + c * (1024 ±0)` - // Estimated: `3577 + c * (1024 ±0)` - // Minimum execution time: 3_309_000 picoseconds. - Weight::from_parts(3_406_000, 3577) - // Standard Error: 759 - .saturating_add(Weight::from_parts(674_106, 0).saturating_mul(c.into())) + // Measured: `146 + c * (1024 ±0)` + // Estimated: `3610 + c * (1024 ±0)` + // Minimum execution time: 3_252_000 picoseconds. + Weight::from_parts(3_416_000, 3610) + // Standard Error: 1_261 + .saturating_add(Weight::from_parts(689_572, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -267,35 +267,35 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_127_000 picoseconds. - Weight::from_parts(74_742_938, 0) - // Standard Error: 5_397 - .saturating_add(Weight::from_parts(2_342_205, 0).saturating_mul(c.into())) + // Minimum execution time: 59_805_000 picoseconds. + Weight::from_parts(86_729_126, 0) + // Standard Error: 7_023 + .saturating_add(Weight::from_parts(2_475_519, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: - // Measured: `1050` - // Estimated: `42875` - // Minimum execution time: 84_245_000 picoseconds. - Weight::from_parts(85_847_000, 42875) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(10_u64)) + // Measured: `1372` + // Estimated: `51905` + // Minimum execution time: 107_694_000 picoseconds. + Weight::from_parts(110_328_000, 51905) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(12_u64)) } fn pay_program_rent() -> Weight { // Proof Size summary in bytes: - // Measured: `958` - // Estimated: `21477` - // Minimum execution time: 55_566_000 picoseconds. - Weight::from_parts(57_030_000, 21477) + // Measured: `992` + // Estimated: `21579` + // Minimum execution time: 55_980_000 picoseconds. + Weight::from_parts(56_766_000, 21579) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } fn resume_session_init() -> Weight { // Proof Size summary in bytes: - // Measured: `605` - // Estimated: `17354` - // Minimum execution time: 29_403_000 picoseconds. - Weight::from_parts(30_422_000, 17354) + // Measured: `638` + // Estimated: `17486` + // Minimum execution time: 29_973_000 picoseconds. + Weight::from_parts(31_008_000, 17486) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } @@ -304,22 +304,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_886_000 picoseconds. - Weight::from_parts(5_577_548, 7640) - // Standard Error: 36_666 - .saturating_add(Weight::from_parts(13_383_280, 0).saturating_mul(c.into())) + // Minimum execution time: 8_054_000 picoseconds. + Weight::from_parts(8_342_000, 7640) + // Standard Error: 17_771 + .saturating_add(Weight::from_parts(13_335_661, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1439 + c * (16389 ±0)` - // Estimated: `42034 + c * (131112 ±0)` - // Minimum execution time: 71_129_000 picoseconds. - Weight::from_parts(71_867_000, 42034) - // Standard Error: 194_431 - .saturating_add(Weight::from_parts(53_622_369, 0).saturating_mul(c.into())) + // Measured: `1593 + c * (16389 ±0)` + // Estimated: `43266 + c * (131112 ±0)` + // Minimum execution time: 72_178_000 picoseconds. + Weight::from_parts(73_341_000, 43266) + // Standard Error: 167_723 + .saturating_add(Weight::from_parts(54_442_045, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(11_u64)) .saturating_add(T::DbWeight::get().writes(9_u64)) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -328,97 +328,97 @@ impl pallet_gear::WeightInfo for SubstrateWeight { /// The range of component `c` is `[0, 250]`. fn upload_code(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `80` - // Estimated: `5270` - // Minimum execution time: 63_441_000 picoseconds. - Weight::from_parts(69_716_978, 5270) - // Standard Error: 32_301 - .saturating_add(Weight::from_parts(51_458_430, 0).saturating_mul(c.into())) + // Measured: `113` + // Estimated: `5402` + // Minimum execution time: 78_662_000 picoseconds. + Weight::from_parts(42_066_175, 5402) + // Standard Error: 52_075 + .saturating_add(Weight::from_parts(60_249_549, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `742` - // Estimated: `39419` - // Minimum execution time: 64_601_000 picoseconds. - Weight::from_parts(94_970_592, 39419) - // Standard Error: 0 - .saturating_add(Weight::from_parts(2_577, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(10_u64)) + // Measured: `1111` + // Estimated: `50600` + // Minimum execution time: 94_321_000 picoseconds. + Weight::from_parts(129_113_540, 50600) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_625, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(12_u64)) } /// The range of component `c` is `[0, 250]`. /// The range of component `s` is `[0, 4194304]`. fn upload_program(c: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `306` - // Estimated: `35235` - // Minimum execution time: 10_884_487_000 picoseconds. - Weight::from_parts(321_953_387, 35235) - // Standard Error: 164_114 - .saturating_add(Weight::from_parts(51_946_894, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_506, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(14_u64)) + // Measured: `521` + // Estimated: `45152` + // Minimum execution time: 11_148_491_000 picoseconds. + Weight::from_parts(21_065_971, 45152) + // Standard Error: 173_883 + .saturating_add(Weight::from_parts(60_839_567, 0).saturating_mul(c.into())) + // Standard Error: 10 + .saturating_add(Weight::from_parts(2_652, 0).saturating_mul(s.into())) + .saturating_add(T::DbWeight::get().reads(15_u64)) + .saturating_add(T::DbWeight::get().writes(16_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_message(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `349` - // Estimated: `23860` - // Minimum execution time: 55_131_000 picoseconds. - Weight::from_parts(30_192_078, 23860) + // Measured: `531` + // Estimated: `31266` + // Minimum execution time: 73_302_000 picoseconds. + Weight::from_parts(47_279_667, 31266) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_039, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(9_u64)) - .saturating_add(T::DbWeight::get().writes(8_u64)) + .saturating_add(Weight::from_parts(1_055, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1049` - // Estimated: `42866` - // Minimum execution time: 85_069_000 picoseconds. - Weight::from_parts(72_149_865, 42866) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_036, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(13_u64)) - .saturating_add(T::DbWeight::get().writes(10_u64)) + // Measured: `1371` + // Estimated: `54435` + // Minimum execution time: 124_173_000 picoseconds. + Weight::from_parts(96_458_887, 54435) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_078, 0).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(16_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1066` - // Estimated: `85981` - // Minimum execution time: 323_286_000 picoseconds. - Weight::from_parts(335_875_612, 85981) - // Standard Error: 1_331 - .saturating_add(Weight::from_parts(1_294, 0).saturating_mul(q.into())) - .saturating_add(T::DbWeight::get().reads(29_u64)) - .saturating_add(T::DbWeight::get().writes(23_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 365_983_000 picoseconds. + Weight::from_parts(387_416_952, 114612) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(26_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(_q: u32, ) -> Weight { + fn alloc_in_handle(q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1066` - // Estimated: `85905` - // Minimum execution time: 333_261_000 picoseconds. - Weight::from_parts(348_059_151, 85905) - .saturating_add(T::DbWeight::get().reads(29_u64)) - .saturating_add(T::DbWeight::get().writes(23_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 380_430_000 picoseconds. + Weight::from_parts(403_376_118, 114612) + // Standard Error: 2_451 + .saturating_add(Weight::from_parts(1_137, 0).saturating_mul(q.into())) + .saturating_add(T::DbWeight::get().reads(33_u64)) + .saturating_add(T::DbWeight::get().writes(26_u64)) } /// The range of component `c` is `[0, 512]`. fn reinstrument_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_732_000 picoseconds. - Weight::from_parts(46_437_000, 3899) - // Standard Error: 40_834 - .saturating_add(Weight::from_parts(51_504_684, 0).saturating_mul(c.into())) + // Minimum execution time: 58_080_000 picoseconds. + Weight::from_parts(58_601_000, 3899) + // Standard Error: 36_083 + .saturating_add(Weight::from_parts(58_395_643, 0).saturating_mul(c.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -428,630 +428,628 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_890_000 picoseconds. - Weight::from_parts(87_488_000, 0) - // Standard Error: 4_218_353 - .saturating_add(Weight::from_parts(584_751_765, 0).saturating_mul(r.into())) + // Minimum execution time: 91_412_000 picoseconds. + Weight::from_parts(94_168_000, 0) + // Standard Error: 3_806_298 + .saturating_add(Weight::from_parts(673_774_453, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 319_127_000 picoseconds. - Weight::from_parts(258_635_809, 0) - // Standard Error: 13_905 - .saturating_add(Weight::from_parts(32_129_635, 0).saturating_mul(p.into())) + // Minimum execution time: 452_549_000 picoseconds. + Weight::from_parts(398_963_700, 0) + // Standard Error: 7_042 + .saturating_add(Weight::from_parts(29_406_609, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 145_346_000 picoseconds. - Weight::from_parts(132_224_327, 0) - // Standard Error: 318_914 - .saturating_add(Weight::from_parts(64_020_177, 0).saturating_mul(r.into())) + // Minimum execution time: 207_052_000 picoseconds. + Weight::from_parts(209_606_478, 0) + // Standard Error: 255_281 + .saturating_add(Weight::from_parts(62_959_531, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_899_000 picoseconds. - Weight::from_parts(93_463_487, 0) - // Standard Error: 3_525 - .saturating_add(Weight::from_parts(2_288_372, 0).saturating_mul(r.into())) + // Minimum execution time: 97_729_000 picoseconds. + Weight::from_parts(105_964_750, 0) + // Standard Error: 4_847 + .saturating_add(Weight::from_parts(2_433_966, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 138_092_000 picoseconds. - Weight::from_parts(169_806_344, 0) - // Standard Error: 26_882 - .saturating_add(Weight::from_parts(2_254_783, 0).saturating_mul(r.into())) + // Minimum execution time: 175_010_000 picoseconds. + Weight::from_parts(229_153_209, 0) + // Standard Error: 17_116 + .saturating_add(Weight::from_parts(1_991_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_599_000 picoseconds. - Weight::from_parts(98_793_759, 0) - // Standard Error: 347_287 - .saturating_add(Weight::from_parts(87_526_184, 0).saturating_mul(r.into())) + // Minimum execution time: 94_696_000 picoseconds. + Weight::from_parts(119_674_535, 0) + // Standard Error: 387_178 + .saturating_add(Weight::from_parts(98_102_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_991_000 picoseconds. - Weight::from_parts(83_685_254, 0) - // Standard Error: 318_877 - .saturating_add(Weight::from_parts(76_389_253, 0).saturating_mul(r.into())) + // Minimum execution time: 95_794_000 picoseconds. + Weight::from_parts(89_931_979, 0) + // Standard Error: 371_349 + .saturating_add(Weight::from_parts(86_524_059, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_968_000 picoseconds. - Weight::from_parts(82_459_314, 0) - // Standard Error: 319_709 - .saturating_add(Weight::from_parts(76_181_704, 0).saturating_mul(r.into())) + // Minimum execution time: 97_924_000 picoseconds. + Weight::from_parts(84_041_201, 0) + // Standard Error: 327_841 + .saturating_add(Weight::from_parts(95_483_315, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_819_000 picoseconds. - Weight::from_parts(72_371_983, 0) - // Standard Error: 300_686 - .saturating_add(Weight::from_parts(76_316_802, 0).saturating_mul(r.into())) + // Minimum execution time: 97_122_000 picoseconds. + Weight::from_parts(86_789_268, 0) + // Standard Error: 353_259 + .saturating_add(Weight::from_parts(85_698_317, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_717_000 picoseconds. - Weight::from_parts(76_355_783, 0) - // Standard Error: 285_260 - .saturating_add(Weight::from_parts(75_781_825, 0).saturating_mul(r.into())) + // Minimum execution time: 94_821_000 picoseconds. + Weight::from_parts(92_694_130, 0) + // Standard Error: 340_146 + .saturating_add(Weight::from_parts(84_623_945, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_121_000 picoseconds. - Weight::from_parts(80_173_266, 0) - // Standard Error: 370_111 - .saturating_add(Weight::from_parts(77_146_163, 0).saturating_mul(r.into())) + // Minimum execution time: 93_840_000 picoseconds. + Weight::from_parts(87_888_572, 0) + // Standard Error: 369_465 + .saturating_add(Weight::from_parts(85_638_902, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_040_000 picoseconds. - Weight::from_parts(77_052_017, 0) - // Standard Error: 323_675 - .saturating_add(Weight::from_parts(75_764_467, 0).saturating_mul(r.into())) + // Minimum execution time: 98_597_000 picoseconds. + Weight::from_parts(86_642_386, 0) + // Standard Error: 362_257 + .saturating_add(Weight::from_parts(85_598_887, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_130_000 picoseconds. - Weight::from_parts(76_139_106, 0) - // Standard Error: 362_545 - .saturating_add(Weight::from_parts(80_573_769, 0).saturating_mul(r.into())) + // Minimum execution time: 94_546_000 picoseconds. + Weight::from_parts(91_466_289, 0) + // Standard Error: 344_423 + .saturating_add(Weight::from_parts(84_318_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 558_591_000 picoseconds. - Weight::from_parts(605_772_233, 0) - // Standard Error: 457_089 - .saturating_add(Weight::from_parts(135_861_811, 0).saturating_mul(r.into())) + // Minimum execution time: 578_036_000 picoseconds. + Weight::from_parts(696_140_951, 0) + // Standard Error: 559_498 + .saturating_add(Weight::from_parts(149_397_501, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 699_603_000 picoseconds. - Weight::from_parts(703_289_000, 0) - // Standard Error: 59_520 - .saturating_add(Weight::from_parts(12_949_265, 0).saturating_mul(n.into())) + // Minimum execution time: 723_788_000 picoseconds. + Weight::from_parts(740_225_000, 0) + // Standard Error: 52_895 + .saturating_add(Weight::from_parts(13_188_120, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_014_000 picoseconds. - Weight::from_parts(77_731_097, 0) - // Standard Error: 304_273 - .saturating_add(Weight::from_parts(75_976_070, 0).saturating_mul(r.into())) + // Minimum execution time: 99_012_000 picoseconds. + Weight::from_parts(88_269_135, 0) + // Standard Error: 296_136 + .saturating_add(Weight::from_parts(92_296_104, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_408_000 picoseconds. - Weight::from_parts(73_174_939, 0) - // Standard Error: 383_139 - .saturating_add(Weight::from_parts(76_484_364, 0).saturating_mul(r.into())) + // Minimum execution time: 93_803_000 picoseconds. + Weight::from_parts(87_097_769, 0) + // Standard Error: 367_325 + .saturating_add(Weight::from_parts(84_987_043, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_197_000 picoseconds. - Weight::from_parts(88_845_708, 0) - // Standard Error: 389_513 - .saturating_add(Weight::from_parts(171_448_634, 0).saturating_mul(n.into())) + // Minimum execution time: 96_663_000 picoseconds. + Weight::from_parts(105_357_427, 0) + // Standard Error: 366_135 + .saturating_add(Weight::from_parts(172_109_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_264_000 picoseconds. - Weight::from_parts(88_018_000, 0) - // Standard Error: 4_124_330 - .saturating_add(Weight::from_parts(805_432_550, 0).saturating_mul(r.into())) + // Minimum execution time: 99_210_000 picoseconds. + Weight::from_parts(102_217_000, 0) + // Standard Error: 4_527_119 + .saturating_add(Weight::from_parts(845_784_967, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_295_000 picoseconds. - Weight::from_parts(140_527_286, 0) - // Standard Error: 405_229 - .saturating_add(Weight::from_parts(251_699_250, 0).saturating_mul(r.into())) + // Minimum execution time: 96_579_000 picoseconds. + Weight::from_parts(162_452_429, 0) + // Standard Error: 416_836 + .saturating_add(Weight::from_parts(257_900_517, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 327_394_000 picoseconds. - Weight::from_parts(330_315_000, 0) - // Standard Error: 62_193 - .saturating_add(Weight::from_parts(21_097_102, 0).saturating_mul(n.into())) + // Minimum execution time: 353_526_000 picoseconds. + Weight::from_parts(358_025_000, 0) + // Standard Error: 61_984 + .saturating_add(Weight::from_parts(21_521_461, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_900_000 picoseconds. - Weight::from_parts(158_459_938, 0) - // Standard Error: 440_264 - .saturating_add(Weight::from_parts(252_444_195, 0).saturating_mul(r.into())) + // Minimum execution time: 94_822_000 picoseconds. + Weight::from_parts(168_431_611, 0) + // Standard Error: 378_696 + .saturating_add(Weight::from_parts(263_135_958, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 337_208_000 picoseconds. - Weight::from_parts(341_169_000, 0) - // Standard Error: 59_076 - .saturating_add(Weight::from_parts(20_945_135, 0).saturating_mul(n.into())) + // Minimum execution time: 351_828_000 picoseconds. + Weight::from_parts(355_382_000, 0) + // Standard Error: 60_589 + .saturating_add(Weight::from_parts(21_325_400, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 556_175_000 picoseconds. - Weight::from_parts(627_050_994, 0) - // Standard Error: 426_100 - .saturating_add(Weight::from_parts(261_080_337, 0).saturating_mul(r.into())) + // Minimum execution time: 569_384_000 picoseconds. + Weight::from_parts(638_474_730, 0) + // Standard Error: 425_903 + .saturating_add(Weight::from_parts(275_691_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 557_564_000 picoseconds. - Weight::from_parts(641_256_689, 0) - // Standard Error: 460_579 - .saturating_add(Weight::from_parts(266_649_825, 0).saturating_mul(r.into())) + // Minimum execution time: 573_053_000 picoseconds. + Weight::from_parts(640_078_802, 0) + // Standard Error: 475_389 + .saturating_add(Weight::from_parts(284_337_155, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_507_000 picoseconds. - Weight::from_parts(67_761_917, 0) - // Standard Error: 379_455 - .saturating_add(Weight::from_parts(86_652_007, 0).saturating_mul(r.into())) + // Minimum execution time: 98_223_000 picoseconds. + Weight::from_parts(85_732_985, 0) + // Standard Error: 336_308 + .saturating_add(Weight::from_parts(92_936_006, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_683_177_000 picoseconds. - Weight::from_parts(1_794_013_374, 0) - // Standard Error: 387_018 - .saturating_add(Weight::from_parts(156_399_549, 0).saturating_mul(r.into())) + // Minimum execution time: 1_822_621_000 picoseconds. + Weight::from_parts(1_951_955_018, 0) + // Standard Error: 339_415 + .saturating_add(Weight::from_parts(157_557_756, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 288_797_000 picoseconds. - Weight::from_parts(293_289_000, 0) - // Standard Error: 63_168 - .saturating_add(Weight::from_parts(29_577_277, 0).saturating_mul(n.into())) + // Minimum execution time: 314_296_000 picoseconds. + Weight::from_parts(317_522_000, 0) + // Standard Error: 61_360 + .saturating_add(Weight::from_parts(29_499_741, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_691_333_000 picoseconds. - Weight::from_parts(1_801_253_735, 0) - // Standard Error: 474_792 - .saturating_add(Weight::from_parts(209_949_939, 0).saturating_mul(r.into())) + // Minimum execution time: 1_835_106_000 picoseconds. + Weight::from_parts(1_948_516_646, 0) + // Standard Error: 382_008 + .saturating_add(Weight::from_parts(214_812_508, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_683_041_000 picoseconds. - Weight::from_parts(1_822_549_872, 0) - // Standard Error: 425_077 - .saturating_add(Weight::from_parts(211_798_367, 0).saturating_mul(r.into())) + // Minimum execution time: 1_827_496_000 picoseconds. + Weight::from_parts(1_949_190_773, 0) + // Standard Error: 340_175 + .saturating_add(Weight::from_parts(218_001_536, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 247_656_000 picoseconds. - Weight::from_parts(317_794_229, 0) - // Standard Error: 388_223 - .saturating_add(Weight::from_parts(266_464_404, 0).saturating_mul(r.into())) + // Minimum execution time: 264_306_000 picoseconds. + Weight::from_parts(363_536_651, 0) + // Standard Error: 467_914 + .saturating_add(Weight::from_parts(265_564_072, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 512_971_000 picoseconds. - Weight::from_parts(524_580_000, 0) - // Standard Error: 57_807 - .saturating_add(Weight::from_parts(21_296_153, 0).saturating_mul(n.into())) + // Minimum execution time: 523_150_000 picoseconds. + Weight::from_parts(535_842_000, 0) + // Standard Error: 65_412 + .saturating_add(Weight::from_parts(21_698_063, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_827_786_000 picoseconds. - Weight::from_parts(1_938_199_639, 0) - // Standard Error: 481_292 - .saturating_add(Weight::from_parts(230_397_609, 0).saturating_mul(r.into())) + // Minimum execution time: 1_974_743_000 picoseconds. + Weight::from_parts(2_096_494_995, 0) + // Standard Error: 474_778 + .saturating_add(Weight::from_parts(232_524_299, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_205_000 picoseconds. - Weight::from_parts(87_841_924, 0) - // Standard Error: 284_081 - .saturating_add(Weight::from_parts(20_304_775, 0).saturating_mul(r.into())) + // Minimum execution time: 94_139_000 picoseconds. + Weight::from_parts(101_775_569, 0) + // Standard Error: 452_439 + .saturating_add(Weight::from_parts(16_839_430, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 103_357_000 picoseconds. - Weight::from_parts(89_286_787, 0) - // Standard Error: 1_068 - .saturating_add(Weight::from_parts(423_323, 0).saturating_mul(n.into())) + // Minimum execution time: 112_050_000 picoseconds. + Weight::from_parts(102_205_366, 0) + // Standard Error: 1_008 + .saturating_add(Weight::from_parts(431_304, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_492_000 picoseconds. - Weight::from_parts(86_217_226, 0) - // Standard Error: 241_578 - .saturating_add(Weight::from_parts(18_632_173, 0).saturating_mul(r.into())) + // Minimum execution time: 93_528_000 picoseconds. + Weight::from_parts(99_748_422, 0) + // Standard Error: 396_992 + .saturating_add(Weight::from_parts(20_536_877, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 101_997_000 picoseconds. - Weight::from_parts(93_566_446, 0) - // Standard Error: 1_152 - .saturating_add(Weight::from_parts(421_774, 0).saturating_mul(n.into())) + // Minimum execution time: 117_832_000 picoseconds. + Weight::from_parts(104_552_847, 0) + // Standard Error: 1_402 + .saturating_add(Weight::from_parts(432_018, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_647_000 picoseconds. - Weight::from_parts(85_634_187, 0) - // Standard Error: 241_527 - .saturating_add(Weight::from_parts(16_147_912, 0).saturating_mul(r.into())) + // Minimum execution time: 93_325_000 picoseconds. + Weight::from_parts(101_074_097, 0) + // Standard Error: 454_790 + .saturating_add(Weight::from_parts(20_838_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_801_000 picoseconds. - Weight::from_parts(89_403_918, 0) - // Standard Error: 269_595 - .saturating_add(Weight::from_parts(13_226_181, 0).saturating_mul(r.into())) + // Minimum execution time: 93_800_000 picoseconds. + Weight::from_parts(102_249_326, 0) + // Standard Error: 463_488 + .saturating_add(Weight::from_parts(15_991_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_685_000 picoseconds. - Weight::from_parts(132_414_219, 0) - // Standard Error: 497_457 - .saturating_add(Weight::from_parts(145_777_097, 0).saturating_mul(r.into())) + // Minimum execution time: 93_153_000 picoseconds. + Weight::from_parts(121_452_989, 0) + // Standard Error: 390_540 + .saturating_add(Weight::from_parts(145_641_178, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_574_000 picoseconds. - Weight::from_parts(100_165_000, 0) - // Standard Error: 2_652 - .saturating_add(Weight::from_parts(625_145, 0).saturating_mul(n.into())) + // Minimum execution time: 115_529_000 picoseconds. + Weight::from_parts(120_413_000, 0) + // Standard Error: 3_105 + .saturating_add(Weight::from_parts(640_863, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 553_039_000 picoseconds. - Weight::from_parts(596_067_157, 0) - // Standard Error: 7_999_654 - .saturating_add(Weight::from_parts(49_166_442, 0).saturating_mul(r.into())) + // Minimum execution time: 566_859_000 picoseconds. + Weight::from_parts(631_111_316, 0) + // Standard Error: 7_012_228 + .saturating_add(Weight::from_parts(21_896_983, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. - fn gr_reply_input_wgas(r: u32, ) -> Weight { + fn gr_reply_input_wgas(_r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 560_077_000 picoseconds. - Weight::from_parts(599_598_873, 0) - // Standard Error: 4_500_003 - .saturating_add(Weight::from_parts(54_967_826, 0).saturating_mul(r.into())) + // Minimum execution time: 565_382_000 picoseconds. + Weight::from_parts(613_048_008, 0) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_238_000 picoseconds. - Weight::from_parts(96_280_512, 0) - // Standard Error: 270_962 - .saturating_add(Weight::from_parts(10_382_887, 0).saturating_mul(r.into())) + // Minimum execution time: 104_401_000 picoseconds. + Weight::from_parts(112_651_320, 0) + // Standard Error: 438_590 + .saturating_add(Weight::from_parts(11_095_379, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_112_000 picoseconds. - Weight::from_parts(88_433_773, 0) - // Standard Error: 839 - .saturating_add(Weight::from_parts(426_982, 0).saturating_mul(n.into())) + // Minimum execution time: 115_615_000 picoseconds. + Weight::from_parts(112_987_750, 0) + // Standard Error: 960 + .saturating_add(Weight::from_parts(423_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 91_989_000 picoseconds. - Weight::from_parts(96_225_993, 0) - // Standard Error: 279_323 - .saturating_add(Weight::from_parts(12_960_106, 0).saturating_mul(r.into())) + // Minimum execution time: 105_056_000 picoseconds. + Weight::from_parts(113_735_922, 0) + // Standard Error: 466_586 + .saturating_add(Weight::from_parts(5_305_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 101_178_000 picoseconds. - Weight::from_parts(90_738_187, 0) - // Standard Error: 1_202 - .saturating_add(Weight::from_parts(427_278, 0).saturating_mul(n.into())) + // Minimum execution time: 113_897_000 picoseconds. + Weight::from_parts(112_616_408, 0) + // Standard Error: 1_722 + .saturating_add(Weight::from_parts(428_420, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_732_000 picoseconds. - Weight::from_parts(75_405_776, 0) - // Standard Error: 330_490 - .saturating_add(Weight::from_parts(78_457_591, 0).saturating_mul(r.into())) + // Minimum execution time: 93_845_000 picoseconds. + Weight::from_parts(97_247_314, 0) + // Standard Error: 366_814 + .saturating_add(Weight::from_parts(85_900_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_077_000 picoseconds. - Weight::from_parts(86_563_786, 0) - // Standard Error: 230_585 - .saturating_add(Weight::from_parts(75_198_113, 0).saturating_mul(r.into())) + // Minimum execution time: 93_761_000 picoseconds. + Weight::from_parts(92_637_129, 0) + // Standard Error: 309_799 + .saturating_add(Weight::from_parts(85_725_727, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 561_889_000 picoseconds. - Weight::from_parts(581_183_882, 0) - // Standard Error: 419_713 - .saturating_add(Weight::from_parts(98_014_698, 0).saturating_mul(r.into())) + // Minimum execution time: 565_388_000 picoseconds. + Weight::from_parts(606_358_854, 0) + // Standard Error: 430_766 + .saturating_add(Weight::from_parts(108_769_267, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 573_200_000 picoseconds. - Weight::from_parts(600_501_979, 0) - // Standard Error: 2_551 - .saturating_add(Weight::from_parts(132_221, 0).saturating_mul(n.into())) + // Minimum execution time: 591_660_000 picoseconds. + Weight::from_parts(597_035_528, 0) + // Standard Error: 2_641 + .saturating_add(Weight::from_parts(153_781, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_491_000 picoseconds. - Weight::from_parts(2_303_909_860, 0) - // Standard Error: 546_745 - .saturating_add(Weight::from_parts(116_603_682, 0).saturating_mul(r.into())) + // Minimum execution time: 2_317_147_000 picoseconds. + Weight::from_parts(2_514_940_964, 0) + // Standard Error: 546_319 + .saturating_add(Weight::from_parts(128_825_542, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_276_723_000 picoseconds. - Weight::from_parts(2_217_739_410, 0) - // Standard Error: 14_370 - .saturating_add(Weight::from_parts(12_459_132, 0).saturating_mul(n.into())) + // Minimum execution time: 2_560_344_000 picoseconds. + Weight::from_parts(2_512_409_449, 0) + // Standard Error: 15_466 + .saturating_add(Weight::from_parts(12_395_144, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_311_000 picoseconds. - Weight::from_parts(110_540_924, 0) - // Standard Error: 396_634 - .saturating_add(Weight::from_parts(112_631_557, 0).saturating_mul(r.into())) + // Minimum execution time: 97_996_000 picoseconds. + Weight::from_parts(130_630_238, 0) + // Standard Error: 414_418 + .saturating_add(Weight::from_parts(114_735_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 147_382_000 picoseconds. - Weight::from_parts(148_605_000, 0) - // Standard Error: 51_888 - .saturating_add(Weight::from_parts(25_568_730, 0).saturating_mul(n.into())) + // Minimum execution time: 157_513_000 picoseconds. + Weight::from_parts(160_584_000, 0) + // Standard Error: 57_227 + .saturating_add(Weight::from_parts(25_738_939, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_124_000 picoseconds. - Weight::from_parts(74_488_011, 0) - // Standard Error: 336_019 - .saturating_add(Weight::from_parts(76_615_014, 0).saturating_mul(r.into())) + // Minimum execution time: 92_652_000 picoseconds. + Weight::from_parts(88_138_429, 0) + // Standard Error: 330_537 + .saturating_add(Weight::from_parts(83_235_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_719_000 picoseconds. - Weight::from_parts(89_610_961, 0) - // Standard Error: 278_492 - .saturating_add(Weight::from_parts(19_580_838, 0).saturating_mul(r.into())) + // Minimum execution time: 93_824_000 picoseconds. + Weight::from_parts(102_740_497, 0) + // Standard Error: 428_593 + .saturating_add(Weight::from_parts(23_682_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_624_000 picoseconds. - Weight::from_parts(87_152_636, 0) - // Standard Error: 283_157 - .saturating_add(Weight::from_parts(13_618_763, 0).saturating_mul(r.into())) + // Minimum execution time: 92_530_000 picoseconds. + Weight::from_parts(101_410_861, 0) + // Standard Error: 432_236 + .saturating_add(Weight::from_parts(12_196_938, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_833_000 picoseconds. - Weight::from_parts(85_635_155, 0) - // Standard Error: 260_060 - .saturating_add(Weight::from_parts(16_305_744, 0).saturating_mul(r.into())) + // Minimum execution time: 93_402_000 picoseconds. + Weight::from_parts(102_285_877, 0) + // Standard Error: 466_463 + .saturating_add(Weight::from_parts(13_156_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_742_000 picoseconds. - Weight::from_parts(87_140_859, 0) - // Standard Error: 385_164 - .saturating_add(Weight::from_parts(11_568_440, 0).saturating_mul(r.into())) + // Minimum execution time: 95_706_000 picoseconds. + Weight::from_parts(102_513_059, 0) + // Standard Error: 464_787 + .saturating_add(Weight::from_parts(13_986_540, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_910_000 picoseconds. - Weight::from_parts(85_444_924, 0) - // Standard Error: 294_573 - .saturating_add(Weight::from_parts(16_073_775, 0).saturating_mul(r.into())) + // Minimum execution time: 93_057_000 picoseconds. + Weight::from_parts(99_083_869, 0) + // Standard Error: 378_747 + .saturating_add(Weight::from_parts(12_230_330, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_851_000 picoseconds. - Weight::from_parts(184_343_853, 0) - // Standard Error: 304_576 - .saturating_add(Weight::from_parts(157_917_607, 0).saturating_mul(r.into())) + // Minimum execution time: 177_947_000 picoseconds. + Weight::from_parts(226_692_243, 0) + // Standard Error: 265_725 + .saturating_add(Weight::from_parts(156_938_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_606_000 picoseconds. - Weight::from_parts(153_936_115, 0) - // Standard Error: 400_073 - .saturating_add(Weight::from_parts(335_598_380, 0).saturating_mul(r.into())) + // Minimum execution time: 107_346_000 picoseconds. + Weight::from_parts(160_631_540, 0) + // Standard Error: 352_753 + .saturating_add(Weight::from_parts(338_685_448, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1059,22 +1057,22 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_747_420_000 picoseconds. - Weight::from_parts(42_968_891_000, 0) - // Standard Error: 252_454 - .saturating_add(Weight::from_parts(7_443_047, 0).saturating_mul(p.into())) - // Standard Error: 252_442 - .saturating_add(Weight::from_parts(177_458_321, 0).saturating_mul(s.into())) + // Minimum execution time: 44_754_074_000 picoseconds. + Weight::from_parts(44_833_050_000, 0) + // Standard Error: 269_308 + .saturating_add(Weight::from_parts(7_629_892, 0).saturating_mul(p.into())) + // Standard Error: 269_294 + .saturating_add(Weight::from_parts(179_148_245, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 94_879_000 picoseconds. - Weight::from_parts(157_991_694, 0) - // Standard Error: 362_276 - .saturating_add(Weight::from_parts(340_199_652, 0).saturating_mul(r.into())) + // Minimum execution time: 108_278_000 picoseconds. + Weight::from_parts(161_208_126, 0) + // Standard Error: 368_644 + .saturating_add(Weight::from_parts(346_324_329, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -1082,32 +1080,32 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_940_234_000 picoseconds. - Weight::from_parts(45_999_634_000, 0) - // Standard Error: 269_136 - .saturating_add(Weight::from_parts(7_028_589, 0).saturating_mul(p.into())) - // Standard Error: 269_123 - .saturating_add(Weight::from_parts(176_610_610, 0).saturating_mul(s.into())) + // Minimum execution time: 44_266_209_000 picoseconds. + Weight::from_parts(44_559_345_000, 0) + // Standard Error: 270_420 + .saturating_add(Weight::from_parts(7_460_172, 0).saturating_mul(p.into())) + // Standard Error: 270_407 + .saturating_add(Weight::from_parts(179_211_260, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_303_000 picoseconds. - Weight::from_parts(100_845_158, 0) - // Standard Error: 28_180 - .saturating_add(Weight::from_parts(1_828_410, 0).saturating_mul(r.into())) + // Minimum execution time: 94_889_000 picoseconds. + Weight::from_parts(115_310_524, 0) + // Standard Error: 34_049 + .saturating_add(Weight::from_parts(1_916_607, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 86_742_000 picoseconds. - Weight::from_parts(110_790_993, 1131) - // Standard Error: 6_233 - .saturating_add(Weight::from_parts(11_802_147, 0).saturating_mul(p.into())) + // Minimum execution time: 97_825_000 picoseconds. + Weight::from_parts(251_440_245, 1131) + // Standard Error: 70_641 + .saturating_add(Weight::from_parts(15_652_952, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1116,10 +1114,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_916_000 picoseconds. - Weight::from_parts(85_870_000, 1131) - // Standard Error: 27_705 - .saturating_add(Weight::from_parts(35_450_394, 0).saturating_mul(p.into())) + // Minimum execution time: 96_761_000 picoseconds. + Weight::from_parts(100_398_000, 1131) + // Standard Error: 45_532 + .saturating_add(Weight::from_parts(39_790_625, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1128,10 +1126,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_097_917_000 picoseconds. - Weight::from_parts(5_604_890_798, 5069931) - // Standard Error: 98_374 - .saturating_add(Weight::from_parts(36_989_630, 0).saturating_mul(p.into())) + // Minimum execution time: 7_471_807_000 picoseconds. + Weight::from_parts(7_440_591_962, 5069931) + // Standard Error: 168_373 + .saturating_add(Weight::from_parts(40_244_359, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -1139,10 +1137,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_707_000 picoseconds. - Weight::from_parts(84_791_000, 1939) - // Standard Error: 37_959 - .saturating_add(Weight::from_parts(47_195_271, 0).saturating_mul(p.into())) + // Minimum execution time: 97_303_000 picoseconds. + Weight::from_parts(98_185_000, 1939) + // Standard Error: 38_471 + .saturating_add(Weight::from_parts(55_016_921, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -1151,10 +1149,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 89_993_000 picoseconds. - Weight::from_parts(89_503_538, 1131) - // Standard Error: 59_714 - .saturating_add(Weight::from_parts(36_297_330, 0).saturating_mul(p.into())) + // Minimum execution time: 102_497_000 picoseconds. + Weight::from_parts(104_932_685, 1131) + // Standard Error: 78_974 + .saturating_add(Weight::from_parts(39_257_150, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -1163,10 +1161,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 592_496_000 picoseconds. - Weight::from_parts(565_533_871, 1496) - // Standard Error: 314_500 - .saturating_add(Weight::from_parts(55_506_484, 0).saturating_mul(p.into())) + // Minimum execution time: 612_308_000 picoseconds. + Weight::from_parts(642_079_999, 1496) + // Standard Error: 357_245 + .saturating_add(Weight::from_parts(46_518_860, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -1175,10 +1173,10 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 993_621_000 picoseconds. - Weight::from_parts(1_012_993_434, 317931) - // Standard Error: 387_880 - .saturating_add(Weight::from_parts(53_105_611, 0).saturating_mul(p.into())) + // Minimum execution time: 1_068_248_000 picoseconds. + Weight::from_parts(1_080_741_205, 317931) + // Standard Error: 262_216 + .saturating_add(Weight::from_parts(50_047_907, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -1186,885 +1184,883 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_367_513, 0) - // Standard Error: 8_775 - .saturating_add(Weight::from_parts(24_100_608, 0).saturating_mul(r.into())) + // Minimum execution time: 3_099_000 picoseconds. + Weight::from_parts(6_340_084, 0) + // Standard Error: 180_257 + .saturating_add(Weight::from_parts(74_666_091, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_344_543_000 picoseconds. - Weight::from_parts(4_032_382_572, 0) - // Standard Error: 99_537 - .saturating_add(Weight::from_parts(5_787_910, 0).saturating_mul(r.into())) + // Minimum execution time: 4_391_547_000 picoseconds. + Weight::from_parts(4_140_785_425, 0) + // Standard Error: 89_369 + .saturating_add(Weight::from_parts(5_769_622, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_766_000 picoseconds. - Weight::from_parts(3_999_679_120, 0) - // Standard Error: 103_253 - .saturating_add(Weight::from_parts(5_927_871, 0).saturating_mul(r.into())) + // Minimum execution time: 4_386_802_000 picoseconds. + Weight::from_parts(4_243_536_456, 0) + // Standard Error: 95_210 + .saturating_add(Weight::from_parts(5_278_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_550_469_000 picoseconds. - Weight::from_parts(11_379_288_782, 0) - // Standard Error: 199_762 - .saturating_add(Weight::from_parts(12_085_908, 0).saturating_mul(r.into())) + // Minimum execution time: 11_072_272_000 picoseconds. + Weight::from_parts(11_558_306_225, 0) + // Standard Error: 165_659 + .saturating_add(Weight::from_parts(9_828_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_371_806_000 picoseconds. - Weight::from_parts(11_315_025_252, 0) - // Standard Error: 196_400 - .saturating_add(Weight::from_parts(9_868_462, 0).saturating_mul(r.into())) + // Minimum execution time: 10_285_071_000 picoseconds. + Weight::from_parts(11_137_621_942, 0) + // Standard Error: 147_513 + .saturating_add(Weight::from_parts(9_014_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_296_000 picoseconds. - Weight::from_parts(2_387_000, 0) - // Standard Error: 8_522 - .saturating_add(Weight::from_parts(3_812_287, 0).saturating_mul(r.into())) + // Minimum execution time: 2_285_000 picoseconds. + Weight::from_parts(2_410_000, 0) + // Standard Error: 7_624 + .saturating_add(Weight::from_parts(3_864_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_293_000, 0) - // Standard Error: 5_596 - .saturating_add(Weight::from_parts(3_015_385, 0).saturating_mul(r.into())) + // Minimum execution time: 2_342_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 6_413 + .saturating_add(Weight::from_parts(3_120_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(3_286_665, 0) - // Standard Error: 1_124 - .saturating_add(Weight::from_parts(1_572_972, 0).saturating_mul(r.into())) + // Minimum execution time: 2_301_000 picoseconds. + Weight::from_parts(3_591_730, 0) + // Standard Error: 1_106 + .saturating_add(Weight::from_parts(1_565_415, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 8_691 - .saturating_add(Weight::from_parts(2_934_320, 0).saturating_mul(r.into())) + // Minimum execution time: 2_306_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 7_711 + .saturating_add(Weight::from_parts(2_932_880, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(1_393_237, 0) - // Standard Error: 11_704 - .saturating_add(Weight::from_parts(5_179_849, 0).saturating_mul(r.into())) + // Minimum execution time: 2_358_000 picoseconds. + Weight::from_parts(2_144_801, 0) + // Standard Error: 22_082 + .saturating_add(Weight::from_parts(5_266_139, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_013_000 picoseconds. - Weight::from_parts(5_664_804, 0) - // Standard Error: 2_473 - .saturating_add(Weight::from_parts(127_877, 0).saturating_mul(e.into())) + // Minimum execution time: 6_803_000 picoseconds. + Weight::from_parts(5_374_690, 0) + // Standard Error: 1_699 + .saturating_add(Weight::from_parts(171_193, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_351_000 picoseconds. - Weight::from_parts(4_248_352, 0) - // Standard Error: 5_303 - .saturating_add(Weight::from_parts(2_564_771, 0).saturating_mul(r.into())) + // Minimum execution time: 2_431_000 picoseconds. + Weight::from_parts(4_875_813, 0) + // Standard Error: 8_258 + .saturating_add(Weight::from_parts(2_629_733, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_564_771 - - 2_417_980, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_629_733 - + 2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_275_000 picoseconds. - Weight::from_parts(4_116_849, 0) - // Standard Error: 12_318 - .saturating_add(Weight::from_parts(2_417_980, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(5_140_243, 0) + // Standard Error: 13_164 + .saturating_add(Weight::from_parts(2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_739_000 picoseconds. - Weight::from_parts(8_247_555, 0) - // Standard Error: 21_570 - .saturating_add(Weight::from_parts(10_290_172, 0).saturating_mul(r.into())) + // Minimum execution time: 2_669_000 picoseconds. + Weight::from_parts(22_369_265, 0) + // Standard Error: 28_577 + .saturating_add(Weight::from_parts(9_740_558, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_969_000 picoseconds. - Weight::from_parts(462_240, 0) - // Standard Error: 7_690 - .saturating_add(Weight::from_parts(1_320_559, 0).saturating_mul(p.into())) + // Minimum execution time: 12_277_000 picoseconds. + Weight::from_parts(3_596_853, 0) + // Standard Error: 5_869 + .saturating_add(Weight::from_parts(1_258_605, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(l: u32, ) -> Weight { + fn instr_call_per_local(_l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_385_000 picoseconds. - Weight::from_parts(5_731_863, 0) - // Standard Error: 14 - .saturating_add(Weight::from_parts(7, 0).saturating_mul(l.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(5_778_137, 0) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(1_509_226, 0) - // Standard Error: 3_855 - .saturating_add(Weight::from_parts(289_461, 0).saturating_mul(r.into())) + // Minimum execution time: 4_835_000 picoseconds. + Weight::from_parts(6_065_483, 0) + // Standard Error: 3_006 + .saturating_add(Weight::from_parts(378_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_290_000 picoseconds. - Weight::from_parts(2_403_000, 0) - // Standard Error: 6_135 - .saturating_add(Weight::from_parts(808_043, 0).saturating_mul(r.into())) + // Minimum execution time: 4_722_000 picoseconds. + Weight::from_parts(3_902_309, 0) + // Standard Error: 5_742 + .saturating_add(Weight::from_parts(1_056_408, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_206_000 picoseconds. - Weight::from_parts(2_259_000, 0) - // Standard Error: 6_737 - .saturating_add(Weight::from_parts(815_196, 0).saturating_mul(r.into())) + // Minimum execution time: 4_888_000 picoseconds. + Weight::from_parts(4_512_058, 0) + // Standard Error: 6_410 + .saturating_add(Weight::from_parts(1_001_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_514_000 picoseconds. - Weight::from_parts(2_989_795, 0) - // Standard Error: 8_020 - .saturating_add(Weight::from_parts(785_708, 0).saturating_mul(r.into())) + // Minimum execution time: 6_413_000 picoseconds. + Weight::from_parts(2_704_134, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(804_200, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_390_000 picoseconds. - Weight::from_parts(6_462_000, 0) - // Standard Error: 8_592 - .saturating_add(Weight::from_parts(1_340_863, 0).saturating_mul(r.into())) + // Minimum execution time: 6_516_000 picoseconds. + Weight::from_parts(1_028_752, 0) + // Standard Error: 8_792 + .saturating_add(Weight::from_parts(1_494_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_894_000 picoseconds. - Weight::from_parts(1_962_792, 0) - // Standard Error: 10_808 - .saturating_add(Weight::from_parts(6_909_000, 0).saturating_mul(r.into())) + // Minimum execution time: 5_560_000 picoseconds. + Weight::from_parts(1_126_442, 0) + // Standard Error: 14_476 + .saturating_add(Weight::from_parts(7_240_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 9_270 - .saturating_add(Weight::from_parts(3_370_154, 0).saturating_mul(r.into())) + // Minimum execution time: 2_299_000 picoseconds. + Weight::from_parts(2_449_000, 0) + // Standard Error: 7_416 + .saturating_add(Weight::from_parts(3_344_387, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_328_000, 0) - // Standard Error: 6_565 - .saturating_add(Weight::from_parts(3_096_942, 0).saturating_mul(r.into())) + // Minimum execution time: 2_389_000 picoseconds. + Weight::from_parts(2_551_000, 0) + // Standard Error: 5_708 + .saturating_add(Weight::from_parts(3_133_430, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_301_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 5_842 - .saturating_add(Weight::from_parts(3_131_625, 0).saturating_mul(r.into())) + // Minimum execution time: 2_428_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 7_262 + .saturating_add(Weight::from_parts(3_192_675, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_290_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 5_456 - .saturating_add(Weight::from_parts(2_643_149, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(2_426_000, 0) + // Standard Error: 4_554 + .saturating_add(Weight::from_parts(2_683_293, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_207_000 picoseconds. - Weight::from_parts(2_259_000, 0) - // Standard Error: 4_151 - .saturating_add(Weight::from_parts(559_292, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 4_686 + .saturating_add(Weight::from_parts(631_609, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(1_656_873, 0) - // Standard Error: 3_537 - .saturating_add(Weight::from_parts(394_264, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(1_221_890, 0) + // Standard Error: 3_960 + .saturating_add(Weight::from_parts(452_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_300_000, 0) - // Standard Error: 13_227 - .saturating_add(Weight::from_parts(1_891_285, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_390_000, 0) + // Standard Error: 11_114 + .saturating_add(Weight::from_parts(1_916_122, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_297_000, 0) - // Standard Error: 9_416 - .saturating_add(Weight::from_parts(1_195_412, 0).saturating_mul(r.into())) + // Minimum execution time: 2_436_000 picoseconds. + Weight::from_parts(2_504_000, 0) + // Standard Error: 7_104 + .saturating_add(Weight::from_parts(1_156_958, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(1_244_456, 0) - // Standard Error: 3_993 - .saturating_add(Weight::from_parts(393_631, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(1_708_596, 0) + // Standard Error: 2_843 + .saturating_add(Weight::from_parts(377_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(1_710_108, 0) - // Standard Error: 3_705 - .saturating_add(Weight::from_parts(357_471, 0).saturating_mul(r.into())) + // Minimum execution time: 2_386_000 picoseconds. + Weight::from_parts(1_424_415, 0) + // Standard Error: 3_599 + .saturating_add(Weight::from_parts(395_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_300_000 picoseconds. - Weight::from_parts(2_350_000, 0) - // Standard Error: 4_034 - .saturating_add(Weight::from_parts(496_786, 0).saturating_mul(r.into())) + // Minimum execution time: 2_396_000 picoseconds. + Weight::from_parts(2_491_000, 0) + // Standard Error: 3_774 + .saturating_add(Weight::from_parts(516_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_251_000 picoseconds. - Weight::from_parts(143_742, 0) - // Standard Error: 5_409 - .saturating_add(Weight::from_parts(551_665, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(548_192, 0) + // Standard Error: 4_583 + .saturating_add(Weight::from_parts(556_734, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(210_302, 0) - // Standard Error: 5_693 - .saturating_add(Weight::from_parts(526_432, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(447_271, 0) + // Standard Error: 5_300 + .saturating_add(Weight::from_parts(535_915, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(1_582_329, 0) - // Standard Error: 3_448 - .saturating_add(Weight::from_parts(348_194, 0).saturating_mul(r.into())) + // Minimum execution time: 2_340_000 picoseconds. + Weight::from_parts(1_639_695, 0) + // Standard Error: 3_519 + .saturating_add(Weight::from_parts(368_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_350_000 picoseconds. - Weight::from_parts(2_836_265, 0) - // Standard Error: 1_916 - .saturating_add(Weight::from_parts(158_153, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_843_474, 0) + // Standard Error: 1_950 + .saturating_add(Weight::from_parts(176_592, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_997_599, 0) - // Standard Error: 1_870 - .saturating_add(Weight::from_parts(155_117, 0).saturating_mul(r.into())) + // Minimum execution time: 2_351_000 picoseconds. + Weight::from_parts(2_894_613, 0) + // Standard Error: 2_024 + .saturating_add(Weight::from_parts(188_853, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 11_719 - .saturating_add(Weight::from_parts(1_911_693, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_418_000, 0) + // Standard Error: 9_504 + .saturating_add(Weight::from_parts(1_936_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 7_734 - .saturating_add(Weight::from_parts(1_135_022, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_364_000, 0) + // Standard Error: 8_346 + .saturating_add(Weight::from_parts(1_222_521, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_254_000, 0) - // Standard Error: 13_208 - .saturating_add(Weight::from_parts(1_839_828, 0).saturating_mul(r.into())) + // Minimum execution time: 2_345_000 picoseconds. + Weight::from_parts(2_452_000, 0) + // Standard Error: 10_232 + .saturating_add(Weight::from_parts(1_883_867, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 7_621 - .saturating_add(Weight::from_parts(1_164_880, 0).saturating_mul(r.into())) + // Minimum execution time: 2_323_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 7_581 + .saturating_add(Weight::from_parts(1_200_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_238_000 picoseconds. - Weight::from_parts(2_291_000, 0) - // Standard Error: 10_468 - .saturating_add(Weight::from_parts(1_846_638, 0).saturating_mul(r.into())) + // Minimum execution time: 2_410_000 picoseconds. + Weight::from_parts(2_459_000, 0) + // Standard Error: 11_139 + .saturating_add(Weight::from_parts(1_877_766, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_240_000 picoseconds. - Weight::from_parts(2_308_000, 0) - // Standard Error: 7_502 - .saturating_add(Weight::from_parts(1_112_456, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 8_083 + .saturating_add(Weight::from_parts(1_217_904, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 12_282 - .saturating_add(Weight::from_parts(1_806_513, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(2_482_000, 0) + // Standard Error: 11_044 + .saturating_add(Weight::from_parts(1_956_302, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 8_080 - .saturating_add(Weight::from_parts(1_114_020, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 7_870 + .saturating_add(Weight::from_parts(1_213_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_270_000 picoseconds. - Weight::from_parts(2_319_000, 0) - // Standard Error: 11_947 - .saturating_add(Weight::from_parts(1_858_303, 0).saturating_mul(r.into())) + // Minimum execution time: 2_364_000 picoseconds. + Weight::from_parts(2_430_000, 0) + // Standard Error: 10_577 + .saturating_add(Weight::from_parts(1_968_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_204_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 9_452 - .saturating_add(Weight::from_parts(1_236_546, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_442_000, 0) + // Standard Error: 7_838 + .saturating_add(Weight::from_parts(1_267_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 9_388 - .saturating_add(Weight::from_parts(1_920_612, 0).saturating_mul(r.into())) + // Minimum execution time: 2_395_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 10_856 + .saturating_add(Weight::from_parts(1_910_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 7_906 - .saturating_add(Weight::from_parts(1_147_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_343_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 5_786 + .saturating_add(Weight::from_parts(1_128_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_233_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 14_090 - .saturating_add(Weight::from_parts(1_923_509, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 10_344 + .saturating_add(Weight::from_parts(1_897_480, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 9_629 - .saturating_add(Weight::from_parts(1_197_507, 0).saturating_mul(r.into())) + // Minimum execution time: 2_355_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 6_963 + .saturating_add(Weight::from_parts(1_125_698, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 10_951 - .saturating_add(Weight::from_parts(1_915_569, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_447_000, 0) + // Standard Error: 8_285 + .saturating_add(Weight::from_parts(1_848_149, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 8_283 - .saturating_add(Weight::from_parts(1_212_268, 0).saturating_mul(r.into())) + // Minimum execution time: 2_327_000 picoseconds. + Weight::from_parts(2_394_000, 0) + // Standard Error: 7_282 + .saturating_add(Weight::from_parts(1_176_423, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 11_398 - .saturating_add(Weight::from_parts(1_932_092, 0).saturating_mul(r.into())) + // Minimum execution time: 2_372_000 picoseconds. + Weight::from_parts(2_439_000, 0) + // Standard Error: 9_207 + .saturating_add(Weight::from_parts(1_837_009, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(2_324_000, 0) - // Standard Error: 8_582 - .saturating_add(Weight::from_parts(1_170_243, 0).saturating_mul(r.into())) + // Minimum execution time: 2_368_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_320 + .saturating_add(Weight::from_parts(1_231_088, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 13_115 - .saturating_add(Weight::from_parts(1_902_257, 0).saturating_mul(r.into())) + // Minimum execution time: 2_373_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 9_499 + .saturating_add(Weight::from_parts(1_922_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_277_000 picoseconds. - Weight::from_parts(2_358_000, 0) - // Standard Error: 9_006 - .saturating_add(Weight::from_parts(1_220_902, 0).saturating_mul(r.into())) + // Minimum execution time: 2_387_000 picoseconds. + Weight::from_parts(2_455_000, 0) + // Standard Error: 7_681 + .saturating_add(Weight::from_parts(1_198_894, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 8_357 - .saturating_add(Weight::from_parts(1_302_969, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 7_797 + .saturating_add(Weight::from_parts(1_286_566, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_275_000, 0) - // Standard Error: 5_837 - .saturating_add(Weight::from_parts(637_533, 0).saturating_mul(r.into())) + // Minimum execution time: 2_329_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 4_968 + .saturating_add(Weight::from_parts(645_254, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_182_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_474 - .saturating_add(Weight::from_parts(1_274_444, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(2_489_000, 0) + // Standard Error: 7_055 + .saturating_add(Weight::from_parts(1_232_084, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_314_000, 0) - // Standard Error: 4_787 - .saturating_add(Weight::from_parts(598_295, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 4_348 + .saturating_add(Weight::from_parts(633_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 13_111 - .saturating_add(Weight::from_parts(1_764_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_336_000 picoseconds. + Weight::from_parts(2_413_000, 0) + // Standard Error: 8_202 + .saturating_add(Weight::from_parts(1_777_425, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 8_531 - .saturating_add(Weight::from_parts(1_233_195, 0).saturating_mul(r.into())) + // Minimum execution time: 2_314_000 picoseconds. + Weight::from_parts(2_369_000, 0) + // Standard Error: 6_935 + .saturating_add(Weight::from_parts(1_201_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_215_000 picoseconds. - Weight::from_parts(2_308_000, 0) - // Standard Error: 8_554 - .saturating_add(Weight::from_parts(2_787_034, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(6_846_840, 0) + // Standard Error: 17_822 + .saturating_add(Weight::from_parts(2_268_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_285_000 picoseconds. - Weight::from_parts(2_336_000, 0) - // Standard Error: 8_016 - .saturating_add(Weight::from_parts(2_444_420, 0).saturating_mul(r.into())) + // Minimum execution time: 2_394_000 picoseconds. + Weight::from_parts(4_704_336, 0) + // Standard Error: 10_960 + .saturating_add(Weight::from_parts(2_182_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_266_000, 0) - // Standard Error: 9_336 - .saturating_add(Weight::from_parts(3_001_762, 0).saturating_mul(r.into())) + // Minimum execution time: 2_375_000 picoseconds. + Weight::from_parts(1_968_824, 0) + // Standard Error: 15_899 + .saturating_add(Weight::from_parts(2_762_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 8_838 - .saturating_add(Weight::from_parts(2_479_926, 0).saturating_mul(r.into())) + // Minimum execution time: 2_335_000 picoseconds. + Weight::from_parts(1_450_000, 0) + // Standard Error: 13_496 + .saturating_add(Weight::from_parts(2_401_407, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(2_251_000, 0) - // Standard Error: 15_694 - .saturating_add(Weight::from_parts(9_400_757, 0).saturating_mul(r.into())) + // Minimum execution time: 2_448_000 picoseconds. + Weight::from_parts(2_513_000, 0) + // Standard Error: 19_401 + .saturating_add(Weight::from_parts(9_309_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_262_000, 0) - // Standard Error: 24_148 - .saturating_add(Weight::from_parts(7_553_495, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(1_738_370, 0) + // Standard Error: 42_672 + .saturating_add(Weight::from_parts(7_512_557, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_305_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 8_791 - .saturating_add(Weight::from_parts(2_956_458, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_215_088, 0) + // Standard Error: 15_445 + .saturating_add(Weight::from_parts(2_956_278, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_280_000 picoseconds. - Weight::from_parts(2_297_000, 0) - // Standard Error: 7_657 - .saturating_add(Weight::from_parts(2_477_698, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(217_500, 0) + // Standard Error: 7_904 + .saturating_add(Weight::from_parts(2_576_151, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_206_000 picoseconds. - Weight::from_parts(2_261_000, 0) - // Standard Error: 8_702 - .saturating_add(Weight::from_parts(1_265_825, 0).saturating_mul(r.into())) + // Minimum execution time: 2_456_000 picoseconds. + Weight::from_parts(2_503_000, 0) + // Standard Error: 7_920 + .saturating_add(Weight::from_parts(1_321_543, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_243_000, 0) - // Standard Error: 5_815 - .saturating_add(Weight::from_parts(639_043, 0).saturating_mul(r.into())) + // Minimum execution time: 2_346_000 picoseconds. + Weight::from_parts(2_479_000, 0) + // Standard Error: 4_711 + .saturating_add(Weight::from_parts(689_892, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 8_918 - .saturating_add(Weight::from_parts(1_302_162, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_029 + .saturating_add(Weight::from_parts(1_256_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(2_329_000, 0) - // Standard Error: 4_483 - .saturating_add(Weight::from_parts(628_991, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_480_000, 0) + // Standard Error: 3_812 + .saturating_add(Weight::from_parts(607_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_264_000, 0) - // Standard Error: 9_628 - .saturating_add(Weight::from_parts(1_310_707, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 7_362 + .saturating_add(Weight::from_parts(1_248_739, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_261_000, 0) - // Standard Error: 4_478 - .saturating_add(Weight::from_parts(645_751, 0).saturating_mul(r.into())) + // Minimum execution time: 2_419_000 picoseconds. + Weight::from_parts(2_465_000, 0) + // Standard Error: 4_304 + .saturating_add(Weight::from_parts(604_813, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_327_000, 0) - // Standard Error: 8_607 - .saturating_add(Weight::from_parts(1_149_332, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 8_043 + .saturating_add(Weight::from_parts(1_073_194, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_263_000, 0) - // Standard Error: 4_008 - .saturating_add(Weight::from_parts(590_180, 0).saturating_mul(r.into())) + // Minimum execution time: 2_427_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 4_969 + .saturating_add(Weight::from_parts(594_802, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_285_000, 0) - // Standard Error: 8_280 - .saturating_add(Weight::from_parts(1_079_846, 0).saturating_mul(r.into())) + // Minimum execution time: 2_312_000 picoseconds. + Weight::from_parts(2_399_000, 0) + // Standard Error: 7_093 + .saturating_add(Weight::from_parts(1_110_114, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_310_000 picoseconds. - Weight::from_parts(2_385_000, 0) - // Standard Error: 3_875 - .saturating_add(Weight::from_parts(547_245, 0).saturating_mul(r.into())) + // Minimum execution time: 2_331_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 4_140 + .saturating_add(Weight::from_parts(600_354, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_315_000, 0) - // Standard Error: 9_477 - .saturating_add(Weight::from_parts(1_110_046, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_419_000, 0) + // Standard Error: 7_150 + .saturating_add(Weight::from_parts(1_154_649, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_305_000, 0) - // Standard Error: 4_474 - .saturating_add(Weight::from_parts(564_322, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_423_000, 0) + // Standard Error: 5_067 + .saturating_add(Weight::from_parts(594_487, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_271_000 picoseconds. - Weight::from_parts(2_318_000, 0) - // Standard Error: 8_819 - .saturating_add(Weight::from_parts(1_132_561, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_406_000, 0) + // Standard Error: 5_674 + .saturating_add(Weight::from_parts(1_051_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_240_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 4_113 - .saturating_add(Weight::from_parts(601_692, 0).saturating_mul(r.into())) + // Minimum execution time: 2_383_000 picoseconds. + Weight::from_parts(114_723, 0) + // Standard Error: 5_881 + .saturating_add(Weight::from_parts(646_798, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_294 - .saturating_add(Weight::from_parts(1_106_781, 0).saturating_mul(r.into())) + // Minimum execution time: 2_292_000 picoseconds. + Weight::from_parts(2_422_000, 0) + // Standard Error: 6_697 + .saturating_add(Weight::from_parts(1_053_580, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 4_653 - .saturating_add(Weight::from_parts(587_731, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(206_699, 0) + // Standard Error: 5_851 + .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } } @@ -2089,21 +2085,21 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_012_000 picoseconds. - Weight::from_parts(1_102_000, 0) - // Standard Error: 721 - .saturating_add(Weight::from_parts(207_628, 0).saturating_mul(c.into())) + // Minimum execution time: 1_023_000 picoseconds. + Weight::from_parts(1_051_000, 0) + // Standard Error: 912 + .saturating_add(Weight::from_parts(213_761, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// The range of component `c` is `[0, 512]`. fn db_read_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `113 + c * (1024 ±0)` - // Estimated: `3577 + c * (1024 ±0)` - // Minimum execution time: 3_309_000 picoseconds. - Weight::from_parts(3_406_000, 3577) - // Standard Error: 759 - .saturating_add(Weight::from_parts(674_106, 0).saturating_mul(c.into())) + // Measured: `146 + c * (1024 ±0)` + // Estimated: `3610 + c * (1024 ±0)` + // Minimum execution time: 3_252_000 picoseconds. + Weight::from_parts(3_416_000, 3610) + // Standard Error: 1_261 + .saturating_add(Weight::from_parts(689_572, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1024).saturating_mul(c.into())) } @@ -2112,35 +2108,35 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 52_127_000 picoseconds. - Weight::from_parts(74_742_938, 0) - // Standard Error: 5_397 - .saturating_add(Weight::from_parts(2_342_205, 0).saturating_mul(c.into())) + // Minimum execution time: 59_805_000 picoseconds. + Weight::from_parts(86_729_126, 0) + // Standard Error: 7_023 + .saturating_add(Weight::from_parts(2_475_519, 0).saturating_mul(c.into())) } fn claim_value() -> Weight { // Proof Size summary in bytes: - // Measured: `1050` - // Estimated: `42875` - // Minimum execution time: 84_245_000 picoseconds. - Weight::from_parts(85_847_000, 42875) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(10_u64)) + // Measured: `1372` + // Estimated: `51905` + // Minimum execution time: 107_694_000 picoseconds. + Weight::from_parts(110_328_000, 51905) + .saturating_add(RocksDbWeight::get().reads(15_u64)) + .saturating_add(RocksDbWeight::get().writes(12_u64)) } fn pay_program_rent() -> Weight { // Proof Size summary in bytes: - // Measured: `958` - // Estimated: `21477` - // Minimum execution time: 55_566_000 picoseconds. - Weight::from_parts(57_030_000, 21477) + // Measured: `992` + // Estimated: `21579` + // Minimum execution time: 55_980_000 picoseconds. + Weight::from_parts(56_766_000, 21579) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } fn resume_session_init() -> Weight { // Proof Size summary in bytes: - // Measured: `605` - // Estimated: `17354` - // Minimum execution time: 29_403_000 picoseconds. - Weight::from_parts(30_422_000, 17354) + // Measured: `638` + // Estimated: `17486` + // Minimum execution time: 29_973_000 picoseconds. + Weight::from_parts(31_008_000, 17486) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } @@ -2149,22 +2145,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `355` // Estimated: `7640` - // Minimum execution time: 7_886_000 picoseconds. - Weight::from_parts(5_577_548, 7640) - // Standard Error: 36_666 - .saturating_add(Weight::from_parts(13_383_280, 0).saturating_mul(c.into())) + // Minimum execution time: 8_054_000 picoseconds. + Weight::from_parts(8_342_000, 7640) + // Standard Error: 17_771 + .saturating_add(Weight::from_parts(13_335_661, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// The range of component `c` is `[0, 2044]`. fn resume_session_commit(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1439 + c * (16389 ±0)` - // Estimated: `42034 + c * (131112 ±0)` - // Minimum execution time: 71_129_000 picoseconds. - Weight::from_parts(71_867_000, 42034) - // Standard Error: 194_431 - .saturating_add(Weight::from_parts(53_622_369, 0).saturating_mul(c.into())) + // Measured: `1593 + c * (16389 ±0)` + // Estimated: `43266 + c * (131112 ±0)` + // Minimum execution time: 72_178_000 picoseconds. + Weight::from_parts(73_341_000, 43266) + // Standard Error: 167_723 + .saturating_add(Weight::from_parts(54_442_045, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(11_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) @@ -2173,97 +2169,97 @@ impl WeightInfo for () { /// The range of component `c` is `[0, 250]`. fn upload_code(c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `80` - // Estimated: `5270` - // Minimum execution time: 63_441_000 picoseconds. - Weight::from_parts(69_716_978, 5270) - // Standard Error: 32_301 - .saturating_add(Weight::from_parts(51_458_430, 0).saturating_mul(c.into())) + // Measured: `113` + // Estimated: `5402` + // Minimum execution time: 78_662_000 picoseconds. + Weight::from_parts(42_066_175, 5402) + // Standard Error: 52_075 + .saturating_add(Weight::from_parts(60_249_549, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// The range of component `s` is `[0, 4194304]`. fn create_program(s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `742` - // Estimated: `39419` - // Minimum execution time: 64_601_000 picoseconds. - Weight::from_parts(94_970_592, 39419) - // Standard Error: 0 - .saturating_add(Weight::from_parts(2_577, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(10_u64)) + // Measured: `1111` + // Estimated: `50600` + // Minimum execution time: 94_321_000 picoseconds. + Weight::from_parts(129_113_540, 50600) + // Standard Error: 1 + .saturating_add(Weight::from_parts(2_625, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(15_u64)) + .saturating_add(RocksDbWeight::get().writes(12_u64)) } /// The range of component `c` is `[0, 250]`. /// The range of component `s` is `[0, 4194304]`. fn upload_program(c: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `306` - // Estimated: `35235` - // Minimum execution time: 10_884_487_000 picoseconds. - Weight::from_parts(321_953_387, 35235) - // Standard Error: 164_114 - .saturating_add(Weight::from_parts(51_946_894, 0).saturating_mul(c.into())) - // Standard Error: 9 - .saturating_add(Weight::from_parts(2_506, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(14_u64)) + // Measured: `521` + // Estimated: `45152` + // Minimum execution time: 11_148_491_000 picoseconds. + Weight::from_parts(21_065_971, 45152) + // Standard Error: 173_883 + .saturating_add(Weight::from_parts(60_839_567, 0).saturating_mul(c.into())) + // Standard Error: 10 + .saturating_add(Weight::from_parts(2_652, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(15_u64)) + .saturating_add(RocksDbWeight::get().writes(16_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_message(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `349` - // Estimated: `23860` - // Minimum execution time: 55_131_000 picoseconds. - Weight::from_parts(30_192_078, 23860) + // Measured: `531` + // Estimated: `31266` + // Minimum execution time: 73_302_000 picoseconds. + Weight::from_parts(47_279_667, 31266) // Standard Error: 1 - .saturating_add(Weight::from_parts(1_039, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(9_u64)) - .saturating_add(RocksDbWeight::get().writes(8_u64)) + .saturating_add(Weight::from_parts(1_055, 0).saturating_mul(p.into())) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(10_u64)) } /// The range of component `p` is `[0, 2097152]`. fn send_reply(p: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1049` - // Estimated: `42866` - // Minimum execution time: 85_069_000 picoseconds. - Weight::from_parts(72_149_865, 42866) - // Standard Error: 1 - .saturating_add(Weight::from_parts(1_036, 0).saturating_mul(p.into())) - .saturating_add(RocksDbWeight::get().reads(13_u64)) - .saturating_add(RocksDbWeight::get().writes(10_u64)) + // Measured: `1371` + // Estimated: `54435` + // Minimum execution time: 124_173_000 picoseconds. + Weight::from_parts(96_458_887, 54435) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_078, 0).saturating_mul(p.into())) + .saturating_add(RocksDbWeight::get().reads(16_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) } /// The range of component `q` is `[1, 512]`. - fn initial_allocation(q: u32, ) -> Weight { + fn initial_allocation(_q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1066` - // Estimated: `85981` - // Minimum execution time: 323_286_000 picoseconds. - Weight::from_parts(335_875_612, 85981) - // Standard Error: 1_331 - .saturating_add(Weight::from_parts(1_294, 0).saturating_mul(q.into())) - .saturating_add(RocksDbWeight::get().reads(29_u64)) - .saturating_add(RocksDbWeight::get().writes(23_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 365_983_000 picoseconds. + Weight::from_parts(387_416_952, 114612) + .saturating_add(RocksDbWeight::get().reads(33_u64)) + .saturating_add(RocksDbWeight::get().writes(26_u64)) } /// The range of component `q` is `[0, 512]`. - fn alloc_in_handle(_q: u32, ) -> Weight { + fn alloc_in_handle(q: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1066` - // Estimated: `85905` - // Minimum execution time: 333_261_000 picoseconds. - Weight::from_parts(348_059_151, 85905) - .saturating_add(RocksDbWeight::get().reads(29_u64)) - .saturating_add(RocksDbWeight::get().writes(23_u64)) + // Measured: `1893` + // Estimated: `114612` + // Minimum execution time: 380_430_000 picoseconds. + Weight::from_parts(403_376_118, 114612) + // Standard Error: 2_451 + .saturating_add(Weight::from_parts(1_137, 0).saturating_mul(q.into())) + .saturating_add(RocksDbWeight::get().reads(33_u64)) + .saturating_add(RocksDbWeight::get().writes(26_u64)) } /// The range of component `c` is `[0, 512]`. fn reinstrument_per_kb(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `211 + c * (1075 ±0)` // Estimated: `3899 + c * (2150 ±0)` - // Minimum execution time: 45_732_000 picoseconds. - Weight::from_parts(46_437_000, 3899) - // Standard Error: 40_834 - .saturating_add(Weight::from_parts(51_504_684, 0).saturating_mul(c.into())) + // Minimum execution time: 58_080_000 picoseconds. + Weight::from_parts(58_601_000, 3899) + // Standard Error: 36_083 + .saturating_add(Weight::from_parts(58_395_643, 0).saturating_mul(c.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) .saturating_add(Weight::from_parts(0, 2150).saturating_mul(c.into())) @@ -2273,630 +2269,628 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_890_000 picoseconds. - Weight::from_parts(87_488_000, 0) - // Standard Error: 4_218_353 - .saturating_add(Weight::from_parts(584_751_765, 0).saturating_mul(r.into())) + // Minimum execution time: 91_412_000 picoseconds. + Weight::from_parts(94_168_000, 0) + // Standard Error: 3_806_298 + .saturating_add(Weight::from_parts(673_774_453, 0).saturating_mul(r.into())) } /// The range of component `p` is `[1, 512]`. fn alloc_per_page(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 319_127_000 picoseconds. - Weight::from_parts(258_635_809, 0) - // Standard Error: 13_905 - .saturating_add(Weight::from_parts(32_129_635, 0).saturating_mul(p.into())) + // Minimum execution time: 452_549_000 picoseconds. + Weight::from_parts(398_963_700, 0) + // Standard Error: 7_042 + .saturating_add(Weight::from_parts(29_406_609, 0).saturating_mul(p.into())) } /// The range of component `r` is `[0, 20]`. fn free(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 145_346_000 picoseconds. - Weight::from_parts(132_224_327, 0) - // Standard Error: 318_914 - .saturating_add(Weight::from_parts(64_020_177, 0).saturating_mul(r.into())) + // Minimum execution time: 207_052_000 picoseconds. + Weight::from_parts(209_606_478, 0) + // Standard Error: 255_281 + .saturating_add(Weight::from_parts(62_959_531, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_899_000 picoseconds. - Weight::from_parts(93_463_487, 0) - // Standard Error: 3_525 - .saturating_add(Weight::from_parts(2_288_372, 0).saturating_mul(r.into())) + // Minimum execution time: 97_729_000 picoseconds. + Weight::from_parts(105_964_750, 0) + // Standard Error: 4_847 + .saturating_add(Weight::from_parts(2_433_966, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 256]`. fn gr_unreserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 138_092_000 picoseconds. - Weight::from_parts(169_806_344, 0) - // Standard Error: 26_882 - .saturating_add(Weight::from_parts(2_254_783, 0).saturating_mul(r.into())) + // Minimum execution time: 175_010_000 picoseconds. + Weight::from_parts(229_153_209, 0) + // Standard Error: 17_116 + .saturating_add(Weight::from_parts(1_991_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_system_reserve_gas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_599_000 picoseconds. - Weight::from_parts(98_793_759, 0) - // Standard Error: 347_287 - .saturating_add(Weight::from_parts(87_526_184, 0).saturating_mul(r.into())) + // Minimum execution time: 94_696_000 picoseconds. + Weight::from_parts(119_674_535, 0) + // Standard Error: 387_178 + .saturating_add(Weight::from_parts(98_102_856, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_message_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_991_000 picoseconds. - Weight::from_parts(83_685_254, 0) - // Standard Error: 318_877 - .saturating_add(Weight::from_parts(76_389_253, 0).saturating_mul(r.into())) + // Minimum execution time: 95_794_000 picoseconds. + Weight::from_parts(89_931_979, 0) + // Standard Error: 371_349 + .saturating_add(Weight::from_parts(86_524_059, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_program_id(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_968_000 picoseconds. - Weight::from_parts(82_459_314, 0) - // Standard Error: 319_709 - .saturating_add(Weight::from_parts(76_181_704, 0).saturating_mul(r.into())) + // Minimum execution time: 97_924_000 picoseconds. + Weight::from_parts(84_041_201, 0) + // Standard Error: 327_841 + .saturating_add(Weight::from_parts(95_483_315, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_source(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_819_000 picoseconds. - Weight::from_parts(72_371_983, 0) - // Standard Error: 300_686 - .saturating_add(Weight::from_parts(76_316_802, 0).saturating_mul(r.into())) + // Minimum execution time: 97_122_000 picoseconds. + Weight::from_parts(86_789_268, 0) + // Standard Error: 353_259 + .saturating_add(Weight::from_parts(85_698_317, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_717_000 picoseconds. - Weight::from_parts(76_355_783, 0) - // Standard Error: 285_260 - .saturating_add(Weight::from_parts(75_781_825, 0).saturating_mul(r.into())) + // Minimum execution time: 94_821_000 picoseconds. + Weight::from_parts(92_694_130, 0) + // Standard Error: 340_146 + .saturating_add(Weight::from_parts(84_623_945, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_value_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_121_000 picoseconds. - Weight::from_parts(80_173_266, 0) - // Standard Error: 370_111 - .saturating_add(Weight::from_parts(77_146_163, 0).saturating_mul(r.into())) + // Minimum execution time: 93_840_000 picoseconds. + Weight::from_parts(87_888_572, 0) + // Standard Error: 369_465 + .saturating_add(Weight::from_parts(85_638_902, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_gas_available(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_040_000 picoseconds. - Weight::from_parts(77_052_017, 0) - // Standard Error: 323_675 - .saturating_add(Weight::from_parts(75_764_467, 0).saturating_mul(r.into())) + // Minimum execution time: 98_597_000 picoseconds. + Weight::from_parts(86_642_386, 0) + // Standard Error: 362_257 + .saturating_add(Weight::from_parts(85_598_887, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_size(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_130_000 picoseconds. - Weight::from_parts(76_139_106, 0) - // Standard Error: 362_545 - .saturating_add(Weight::from_parts(80_573_769, 0).saturating_mul(r.into())) + // Minimum execution time: 94_546_000 picoseconds. + Weight::from_parts(91_466_289, 0) + // Standard Error: 344_423 + .saturating_add(Weight::from_parts(84_318_848, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_read(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 558_591_000 picoseconds. - Weight::from_parts(605_772_233, 0) - // Standard Error: 457_089 - .saturating_add(Weight::from_parts(135_861_811, 0).saturating_mul(r.into())) + // Minimum execution time: 578_036_000 picoseconds. + Weight::from_parts(696_140_951, 0) + // Standard Error: 559_498 + .saturating_add(Weight::from_parts(149_397_501, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_read_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 699_603_000 picoseconds. - Weight::from_parts(703_289_000, 0) - // Standard Error: 59_520 - .saturating_add(Weight::from_parts(12_949_265, 0).saturating_mul(n.into())) + // Minimum execution time: 723_788_000 picoseconds. + Weight::from_parts(740_225_000, 0) + // Standard Error: 52_895 + .saturating_add(Weight::from_parts(13_188_120, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_height(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_014_000 picoseconds. - Weight::from_parts(77_731_097, 0) - // Standard Error: 304_273 - .saturating_add(Weight::from_parts(75_976_070, 0).saturating_mul(r.into())) + // Minimum execution time: 99_012_000 picoseconds. + Weight::from_parts(88_269_135, 0) + // Standard Error: 296_136 + .saturating_add(Weight::from_parts(92_296_104, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_block_timestamp(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_408_000 picoseconds. - Weight::from_parts(73_174_939, 0) - // Standard Error: 383_139 - .saturating_add(Weight::from_parts(76_484_364, 0).saturating_mul(r.into())) + // Minimum execution time: 93_803_000 picoseconds. + Weight::from_parts(87_097_769, 0) + // Standard Error: 367_325 + .saturating_add(Weight::from_parts(84_987_043, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 20]`. fn gr_random(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 85_197_000 picoseconds. - Weight::from_parts(88_845_708, 0) - // Standard Error: 389_513 - .saturating_add(Weight::from_parts(171_448_634, 0).saturating_mul(n.into())) + // Minimum execution time: 96_663_000 picoseconds. + Weight::from_parts(105_357_427, 0) + // Standard Error: 366_135 + .saturating_add(Weight::from_parts(172_109_201, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_deposit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_264_000 picoseconds. - Weight::from_parts(88_018_000, 0) - // Standard Error: 4_124_330 - .saturating_add(Weight::from_parts(805_432_550, 0).saturating_mul(r.into())) + // Minimum execution time: 99_210_000 picoseconds. + Weight::from_parts(102_217_000, 0) + // Standard Error: 4_527_119 + .saturating_add(Weight::from_parts(845_784_967, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_295_000 picoseconds. - Weight::from_parts(140_527_286, 0) - // Standard Error: 405_229 - .saturating_add(Weight::from_parts(251_699_250, 0).saturating_mul(r.into())) + // Minimum execution time: 96_579_000 picoseconds. + Weight::from_parts(162_452_429, 0) + // Standard Error: 416_836 + .saturating_add(Weight::from_parts(257_900_517, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 327_394_000 picoseconds. - Weight::from_parts(330_315_000, 0) - // Standard Error: 62_193 - .saturating_add(Weight::from_parts(21_097_102, 0).saturating_mul(n.into())) + // Minimum execution time: 353_526_000 picoseconds. + Weight::from_parts(358_025_000, 0) + // Standard Error: 61_984 + .saturating_add(Weight::from_parts(21_521_461, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_900_000 picoseconds. - Weight::from_parts(158_459_938, 0) - // Standard Error: 440_264 - .saturating_add(Weight::from_parts(252_444_195, 0).saturating_mul(r.into())) + // Minimum execution time: 94_822_000 picoseconds. + Weight::from_parts(168_431_611, 0) + // Standard Error: 378_696 + .saturating_add(Weight::from_parts(263_135_958, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 337_208_000 picoseconds. - Weight::from_parts(341_169_000, 0) - // Standard Error: 59_076 - .saturating_add(Weight::from_parts(20_945_135, 0).saturating_mul(n.into())) + // Minimum execution time: 351_828_000 picoseconds. + Weight::from_parts(355_382_000, 0) + // Standard Error: 60_589 + .saturating_add(Weight::from_parts(21_325_400, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 556_175_000 picoseconds. - Weight::from_parts(627_050_994, 0) - // Standard Error: 426_100 - .saturating_add(Weight::from_parts(261_080_337, 0).saturating_mul(r.into())) + // Minimum execution time: 569_384_000 picoseconds. + Weight::from_parts(638_474_730, 0) + // Standard Error: 425_903 + .saturating_add(Weight::from_parts(275_691_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_input_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 557_564_000 picoseconds. - Weight::from_parts(641_256_689, 0) - // Standard Error: 460_579 - .saturating_add(Weight::from_parts(266_649_825, 0).saturating_mul(r.into())) + // Minimum execution time: 573_053_000 picoseconds. + Weight::from_parts(640_078_802, 0) + // Standard Error: 475_389 + .saturating_add(Weight::from_parts(284_337_155, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_init(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_507_000 picoseconds. - Weight::from_parts(67_761_917, 0) - // Standard Error: 379_455 - .saturating_add(Weight::from_parts(86_652_007, 0).saturating_mul(r.into())) + // Minimum execution time: 98_223_000 picoseconds. + Weight::from_parts(85_732_985, 0) + // Standard Error: 336_308 + .saturating_add(Weight::from_parts(92_936_006, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_683_177_000 picoseconds. - Weight::from_parts(1_794_013_374, 0) - // Standard Error: 387_018 - .saturating_add(Weight::from_parts(156_399_549, 0).saturating_mul(r.into())) + // Minimum execution time: 1_822_621_000 picoseconds. + Weight::from_parts(1_951_955_018, 0) + // Standard Error: 339_415 + .saturating_add(Weight::from_parts(157_557_756, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 288_797_000 picoseconds. - Weight::from_parts(293_289_000, 0) - // Standard Error: 63_168 - .saturating_add(Weight::from_parts(29_577_277, 0).saturating_mul(n.into())) + // Minimum execution time: 314_296_000 picoseconds. + Weight::from_parts(317_522_000, 0) + // Standard Error: 61_360 + .saturating_add(Weight::from_parts(29_499_741, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_691_333_000 picoseconds. - Weight::from_parts(1_801_253_735, 0) - // Standard Error: 474_792 - .saturating_add(Weight::from_parts(209_949_939, 0).saturating_mul(r.into())) + // Minimum execution time: 1_835_106_000 picoseconds. + Weight::from_parts(1_948_516_646, 0) + // Standard Error: 382_008 + .saturating_add(Weight::from_parts(214_812_508, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_683_041_000 picoseconds. - Weight::from_parts(1_822_549_872, 0) - // Standard Error: 425_077 - .saturating_add(Weight::from_parts(211_798_367, 0).saturating_mul(r.into())) + // Minimum execution time: 1_827_496_000 picoseconds. + Weight::from_parts(1_949_190_773, 0) + // Standard Error: 340_175 + .saturating_add(Weight::from_parts(218_001_536, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 247_656_000 picoseconds. - Weight::from_parts(317_794_229, 0) - // Standard Error: 388_223 - .saturating_add(Weight::from_parts(266_464_404, 0).saturating_mul(r.into())) + // Minimum execution time: 264_306_000 picoseconds. + Weight::from_parts(363_536_651, 0) + // Standard Error: 467_914 + .saturating_add(Weight::from_parts(265_564_072, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_send_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 512_971_000 picoseconds. - Weight::from_parts(524_580_000, 0) - // Standard Error: 57_807 - .saturating_add(Weight::from_parts(21_296_153, 0).saturating_mul(n.into())) + // Minimum execution time: 523_150_000 picoseconds. + Weight::from_parts(535_842_000, 0) + // Standard Error: 65_412 + .saturating_add(Weight::from_parts(21_698_063, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reservation_send_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_827_786_000 picoseconds. - Weight::from_parts(1_938_199_639, 0) - // Standard Error: 481_292 - .saturating_add(Weight::from_parts(230_397_609, 0).saturating_mul(r.into())) + // Minimum execution time: 1_974_743_000 picoseconds. + Weight::from_parts(2_096_494_995, 0) + // Standard Error: 474_778 + .saturating_add(Weight::from_parts(232_524_299, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_205_000 picoseconds. - Weight::from_parts(87_841_924, 0) - // Standard Error: 284_081 - .saturating_add(Weight::from_parts(20_304_775, 0).saturating_mul(r.into())) + // Minimum execution time: 94_139_000 picoseconds. + Weight::from_parts(101_775_569, 0) + // Standard Error: 452_439 + .saturating_add(Weight::from_parts(16_839_430, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 103_357_000 picoseconds. - Weight::from_parts(89_286_787, 0) - // Standard Error: 1_068 - .saturating_add(Weight::from_parts(423_323, 0).saturating_mul(n.into())) + // Minimum execution time: 112_050_000 picoseconds. + Weight::from_parts(102_205_366, 0) + // Standard Error: 1_008 + .saturating_add(Weight::from_parts(431_304, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_492_000 picoseconds. - Weight::from_parts(86_217_226, 0) - // Standard Error: 241_578 - .saturating_add(Weight::from_parts(18_632_173, 0).saturating_mul(r.into())) + // Minimum execution time: 93_528_000 picoseconds. + Weight::from_parts(99_748_422, 0) + // Standard Error: 396_992 + .saturating_add(Weight::from_parts(20_536_877, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_wgas_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 101_997_000 picoseconds. - Weight::from_parts(93_566_446, 0) - // Standard Error: 1_152 - .saturating_add(Weight::from_parts(421_774, 0).saturating_mul(n.into())) + // Minimum execution time: 117_832_000 picoseconds. + Weight::from_parts(104_552_847, 0) + // Standard Error: 1_402 + .saturating_add(Weight::from_parts(432_018, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_647_000 picoseconds. - Weight::from_parts(85_634_187, 0) - // Standard Error: 241_527 - .saturating_add(Weight::from_parts(16_147_912, 0).saturating_mul(r.into())) + // Minimum execution time: 93_325_000 picoseconds. + Weight::from_parts(101_074_097, 0) + // Standard Error: 454_790 + .saturating_add(Weight::from_parts(20_838_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_commit_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 82_801_000 picoseconds. - Weight::from_parts(89_403_918, 0) - // Standard Error: 269_595 - .saturating_add(Weight::from_parts(13_226_181, 0).saturating_mul(r.into())) + // Minimum execution time: 93_800_000 picoseconds. + Weight::from_parts(102_249_326, 0) + // Standard Error: 463_488 + .saturating_add(Weight::from_parts(15_991_473, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_685_000 picoseconds. - Weight::from_parts(132_414_219, 0) - // Standard Error: 497_457 - .saturating_add(Weight::from_parts(145_777_097, 0).saturating_mul(r.into())) + // Minimum execution time: 93_153_000 picoseconds. + Weight::from_parts(121_452_989, 0) + // Standard Error: 390_540 + .saturating_add(Weight::from_parts(145_641_178, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 8192]`. fn gr_reply_push_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_574_000 picoseconds. - Weight::from_parts(100_165_000, 0) - // Standard Error: 2_652 - .saturating_add(Weight::from_parts(625_145, 0).saturating_mul(n.into())) + // Minimum execution time: 115_529_000 picoseconds. + Weight::from_parts(120_413_000, 0) + // Standard Error: 3_105 + .saturating_add(Weight::from_parts(640_863, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reply_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 553_039_000 picoseconds. - Weight::from_parts(596_067_157, 0) - // Standard Error: 7_999_654 - .saturating_add(Weight::from_parts(49_166_442, 0).saturating_mul(r.into())) + // Minimum execution time: 566_859_000 picoseconds. + Weight::from_parts(631_111_316, 0) + // Standard Error: 7_012_228 + .saturating_add(Weight::from_parts(21_896_983, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. - fn gr_reply_input_wgas(r: u32, ) -> Weight { + fn gr_reply_input_wgas(_r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 560_077_000 picoseconds. - Weight::from_parts(599_598_873, 0) - // Standard Error: 4_500_003 - .saturating_add(Weight::from_parts(54_967_826, 0).saturating_mul(r.into())) + // Minimum execution time: 565_382_000 picoseconds. + Weight::from_parts(613_048_008, 0) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 92_238_000 picoseconds. - Weight::from_parts(96_280_512, 0) - // Standard Error: 270_962 - .saturating_add(Weight::from_parts(10_382_887, 0).saturating_mul(r.into())) + // Minimum execution time: 104_401_000 picoseconds. + Weight::from_parts(112_651_320, 0) + // Standard Error: 438_590 + .saturating_add(Weight::from_parts(11_095_379, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 102_112_000 picoseconds. - Weight::from_parts(88_433_773, 0) - // Standard Error: 839 - .saturating_add(Weight::from_parts(426_982, 0).saturating_mul(n.into())) + // Minimum execution time: 115_615_000 picoseconds. + Weight::from_parts(112_987_750, 0) + // Standard Error: 960 + .saturating_add(Weight::from_parts(423_774, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 1]`. fn gr_reservation_reply_commit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 91_989_000 picoseconds. - Weight::from_parts(96_225_993, 0) - // Standard Error: 279_323 - .saturating_add(Weight::from_parts(12_960_106, 0).saturating_mul(r.into())) + // Minimum execution time: 105_056_000 picoseconds. + Weight::from_parts(113_735_922, 0) + // Standard Error: 466_586 + .saturating_add(Weight::from_parts(5_305_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reservation_reply_commit_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 101_178_000 picoseconds. - Weight::from_parts(90_738_187, 0) - // Standard Error: 1_202 - .saturating_add(Weight::from_parts(427_278, 0).saturating_mul(n.into())) + // Minimum execution time: 113_897_000 picoseconds. + Weight::from_parts(112_616_408, 0) + // Standard Error: 1_722 + .saturating_add(Weight::from_parts(428_420, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_732_000 picoseconds. - Weight::from_parts(75_405_776, 0) - // Standard Error: 330_490 - .saturating_add(Weight::from_parts(78_457_591, 0).saturating_mul(r.into())) + // Minimum execution time: 93_845_000 picoseconds. + Weight::from_parts(97_247_314, 0) + // Standard Error: 366_814 + .saturating_add(Weight::from_parts(85_900_587, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_signal_from(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_077_000 picoseconds. - Weight::from_parts(86_563_786, 0) - // Standard Error: 230_585 - .saturating_add(Weight::from_parts(75_198_113, 0).saturating_mul(r.into())) + // Minimum execution time: 93_761_000 picoseconds. + Weight::from_parts(92_637_129, 0) + // Standard Error: 309_799 + .saturating_add(Weight::from_parts(85_725_727, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 561_889_000 picoseconds. - Weight::from_parts(581_183_882, 0) - // Standard Error: 419_713 - .saturating_add(Weight::from_parts(98_014_698, 0).saturating_mul(r.into())) + // Minimum execution time: 565_388_000 picoseconds. + Weight::from_parts(606_358_854, 0) + // Standard Error: 430_766 + .saturating_add(Weight::from_parts(108_769_267, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_reply_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 573_200_000 picoseconds. - Weight::from_parts(600_501_979, 0) - // Standard Error: 2_551 - .saturating_add(Weight::from_parts(132_221, 0).saturating_mul(n.into())) + // Minimum execution time: 591_660_000 picoseconds. + Weight::from_parts(597_035_528, 0) + // Standard Error: 2_641 + .saturating_add(Weight::from_parts(153_781, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_send_push_input(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_491_000 picoseconds. - Weight::from_parts(2_303_909_860, 0) - // Standard Error: 546_745 - .saturating_add(Weight::from_parts(116_603_682, 0).saturating_mul(r.into())) + // Minimum execution time: 2_317_147_000 picoseconds. + Weight::from_parts(2_514_940_964, 0) + // Standard Error: 546_319 + .saturating_add(Weight::from_parts(128_825_542, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_send_push_input_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_276_723_000 picoseconds. - Weight::from_parts(2_217_739_410, 0) - // Standard Error: 14_370 - .saturating_add(Weight::from_parts(12_459_132, 0).saturating_mul(n.into())) + // Minimum execution time: 2_560_344_000 picoseconds. + Weight::from_parts(2_512_409_449, 0) + // Standard Error: 15_466 + .saturating_add(Weight::from_parts(12_395_144, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_debug(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_311_000 picoseconds. - Weight::from_parts(110_540_924, 0) - // Standard Error: 396_634 - .saturating_add(Weight::from_parts(112_631_557, 0).saturating_mul(r.into())) + // Minimum execution time: 97_996_000 picoseconds. + Weight::from_parts(130_630_238, 0) + // Standard Error: 414_418 + .saturating_add(Weight::from_parts(114_735_577, 0).saturating_mul(r.into())) } /// The range of component `n` is `[0, 2048]`. fn gr_debug_per_kb(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 147_382_000 picoseconds. - Weight::from_parts(148_605_000, 0) - // Standard Error: 51_888 - .saturating_add(Weight::from_parts(25_568_730, 0).saturating_mul(n.into())) + // Minimum execution time: 157_513_000 picoseconds. + Weight::from_parts(160_584_000, 0) + // Standard Error: 57_227 + .saturating_add(Weight::from_parts(25_738_939, 0).saturating_mul(n.into())) } /// The range of component `r` is `[0, 20]`. fn gr_reply_code(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 84_124_000 picoseconds. - Weight::from_parts(74_488_011, 0) - // Standard Error: 336_019 - .saturating_add(Weight::from_parts(76_615_014, 0).saturating_mul(r.into())) + // Minimum execution time: 92_652_000 picoseconds. + Weight::from_parts(88_138_429, 0) + // Standard Error: 330_537 + .saturating_add(Weight::from_parts(83_235_234, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_exit(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 83_719_000 picoseconds. - Weight::from_parts(89_610_961, 0) - // Standard Error: 278_492 - .saturating_add(Weight::from_parts(19_580_838, 0).saturating_mul(r.into())) + // Minimum execution time: 93_824_000 picoseconds. + Weight::from_parts(102_740_497, 0) + // Standard Error: 428_593 + .saturating_add(Weight::from_parts(23_682_102, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_leave(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_624_000 picoseconds. - Weight::from_parts(87_152_636, 0) - // Standard Error: 283_157 - .saturating_add(Weight::from_parts(13_618_763, 0).saturating_mul(r.into())) + // Minimum execution time: 92_530_000 picoseconds. + Weight::from_parts(101_410_861, 0) + // Standard Error: 432_236 + .saturating_add(Weight::from_parts(12_196_938, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_833_000 picoseconds. - Weight::from_parts(85_635_155, 0) - // Standard Error: 260_060 - .saturating_add(Weight::from_parts(16_305_744, 0).saturating_mul(r.into())) + // Minimum execution time: 93_402_000 picoseconds. + Weight::from_parts(102_285_877, 0) + // Standard Error: 466_463 + .saturating_add(Weight::from_parts(13_156_522, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_for(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_742_000 picoseconds. - Weight::from_parts(87_140_859, 0) - // Standard Error: 385_164 - .saturating_add(Weight::from_parts(11_568_440, 0).saturating_mul(r.into())) + // Minimum execution time: 95_706_000 picoseconds. + Weight::from_parts(102_513_059, 0) + // Standard Error: 464_787 + .saturating_add(Weight::from_parts(13_986_540, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 1]`. fn gr_wait_up_to(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 81_910_000 picoseconds. - Weight::from_parts(85_444_924, 0) - // Standard Error: 294_573 - .saturating_add(Weight::from_parts(16_073_775, 0).saturating_mul(r.into())) + // Minimum execution time: 93_057_000 picoseconds. + Weight::from_parts(99_083_869, 0) + // Standard Error: 378_747 + .saturating_add(Weight::from_parts(12_230_330, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_wake(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 137_851_000 picoseconds. - Weight::from_parts(184_343_853, 0) - // Standard Error: 304_576 - .saturating_add(Weight::from_parts(157_917_607, 0).saturating_mul(r.into())) + // Minimum execution time: 177_947_000 picoseconds. + Weight::from_parts(226_692_243, 0) + // Standard Error: 265_725 + .saturating_add(Weight::from_parts(156_938_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 97_606_000 picoseconds. - Weight::from_parts(153_936_115, 0) - // Standard Error: 400_073 - .saturating_add(Weight::from_parts(335_598_380, 0).saturating_mul(r.into())) + // Minimum execution time: 107_346_000 picoseconds. + Weight::from_parts(160_631_540, 0) + // Standard Error: 352_753 + .saturating_add(Weight::from_parts(338_685_448, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2904,22 +2898,22 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_747_420_000 picoseconds. - Weight::from_parts(42_968_891_000, 0) - // Standard Error: 252_454 - .saturating_add(Weight::from_parts(7_443_047, 0).saturating_mul(p.into())) - // Standard Error: 252_442 - .saturating_add(Weight::from_parts(177_458_321, 0).saturating_mul(s.into())) + // Minimum execution time: 44_754_074_000 picoseconds. + Weight::from_parts(44_833_050_000, 0) + // Standard Error: 269_308 + .saturating_add(Weight::from_parts(7_629_892, 0).saturating_mul(p.into())) + // Standard Error: 269_294 + .saturating_add(Weight::from_parts(179_148_245, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_create_program_wgas(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 94_879_000 picoseconds. - Weight::from_parts(157_991_694, 0) - // Standard Error: 362_276 - .saturating_add(Weight::from_parts(340_199_652, 0).saturating_mul(r.into())) + // Minimum execution time: 108_278_000 picoseconds. + Weight::from_parts(161_208_126, 0) + // Standard Error: 368_644 + .saturating_add(Weight::from_parts(346_324_329, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 2048]`. /// The range of component `s` is `[1, 2048]`. @@ -2927,32 +2921,32 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_940_234_000 picoseconds. - Weight::from_parts(45_999_634_000, 0) - // Standard Error: 269_136 - .saturating_add(Weight::from_parts(7_028_589, 0).saturating_mul(p.into())) - // Standard Error: 269_123 - .saturating_add(Weight::from_parts(176_610_610, 0).saturating_mul(s.into())) + // Minimum execution time: 44_266_209_000 picoseconds. + Weight::from_parts(44_559_345_000, 0) + // Standard Error: 270_420 + .saturating_add(Weight::from_parts(7_460_172, 0).saturating_mul(p.into())) + // Standard Error: 270_407 + .saturating_add(Weight::from_parts(179_211_260, 0).saturating_mul(s.into())) } /// The range of component `r` is `[0, 20]`. fn gr_pay_program_rent(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 86_303_000 picoseconds. - Weight::from_parts(100_845_158, 0) - // Standard Error: 28_180 - .saturating_add(Weight::from_parts(1_828_410, 0).saturating_mul(r.into())) + // Minimum execution time: 94_889_000 picoseconds. + Weight::from_parts(115_310_524, 0) + // Standard Error: 34_049 + .saturating_add(Weight::from_parts(1_916_607, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 512]`. fn lazy_pages_signal_read(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 86_742_000 picoseconds. - Weight::from_parts(110_790_993, 1131) - // Standard Error: 6_233 - .saturating_add(Weight::from_parts(11_802_147, 0).saturating_mul(p.into())) + // Minimum execution time: 97_825_000 picoseconds. + Weight::from_parts(251_440_245, 1131) + // Standard Error: 70_641 + .saturating_add(Weight::from_parts(15_652_952, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2961,10 +2955,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 83_916_000 picoseconds. - Weight::from_parts(85_870_000, 1131) - // Standard Error: 27_705 - .saturating_add(Weight::from_parts(35_450_394, 0).saturating_mul(p.into())) + // Minimum execution time: 96_761_000 picoseconds. + Weight::from_parts(100_398_000, 1131) + // Standard Error: 45_532 + .saturating_add(Weight::from_parts(39_790_625, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -2973,10 +2967,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `5069931` - // Minimum execution time: 6_097_917_000 picoseconds. - Weight::from_parts(5_604_890_798, 5069931) - // Standard Error: 98_374 - .saturating_add(Weight::from_parts(36_989_630, 0).saturating_mul(p.into())) + // Minimum execution time: 7_471_807_000 picoseconds. + Weight::from_parts(7_440_591_962, 5069931) + // Standard Error: 168_373 + .saturating_add(Weight::from_parts(40_244_359, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(2048_u64)) } /// The range of component `p` is `[0, 512]`. @@ -2984,10 +2978,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `1813 + p * (65580 ±0)` // Estimated: `1939 + p * (75482 ±0)` - // Minimum execution time: 82_707_000 picoseconds. - Weight::from_parts(84_791_000, 1939) - // Standard Error: 37_959 - .saturating_add(Weight::from_parts(47_195_271, 0).saturating_mul(p.into())) + // Minimum execution time: 97_303_000 picoseconds. + Weight::from_parts(98_185_000, 1939) + // Standard Error: 38_471 + .saturating_add(Weight::from_parts(55_016_921, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 75482).saturating_mul(p.into())) } @@ -2996,10 +2990,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1131 + p * (9900 ±0)` - // Minimum execution time: 89_993_000 picoseconds. - Weight::from_parts(89_503_538, 1131) - // Standard Error: 59_714 - .saturating_add(Weight::from_parts(36_297_330, 0).saturating_mul(p.into())) + // Minimum execution time: 102_497_000 picoseconds. + Weight::from_parts(104_932_685, 1131) + // Standard Error: 78_974 + .saturating_add(Weight::from_parts(39_257_150, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9900).saturating_mul(p.into())) } @@ -3008,10 +3002,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `1496 + p * (9883 ±2)` - // Minimum execution time: 592_496_000 picoseconds. - Weight::from_parts(565_533_871, 1496) - // Standard Error: 314_500 - .saturating_add(Weight::from_parts(55_506_484, 0).saturating_mul(p.into())) + // Minimum execution time: 612_308_000 picoseconds. + Weight::from_parts(642_079_999, 1496) + // Standard Error: 357_245 + .saturating_add(Weight::from_parts(46_518_860, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads((4_u64).saturating_mul(p.into()))) .saturating_add(Weight::from_parts(0, 9883).saturating_mul(p.into())) } @@ -3020,10 +3014,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `141` // Estimated: `317931` - // Minimum execution time: 993_621_000 picoseconds. - Weight::from_parts(1_012_993_434, 317931) - // Standard Error: 387_880 - .saturating_add(Weight::from_parts(53_105_611, 0).saturating_mul(p.into())) + // Minimum execution time: 1_068_248_000 picoseconds. + Weight::from_parts(1_080_741_205, 317931) + // Standard Error: 262_216 + .saturating_add(Weight::from_parts(50_047_907, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(128_u64)) } /// The range of component `r` is `[0, 20]`. @@ -3031,884 +3025,882 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_180_000 picoseconds. - Weight::from_parts(2_367_513, 0) - // Standard Error: 8_775 - .saturating_add(Weight::from_parts(24_100_608, 0).saturating_mul(r.into())) + // Minimum execution time: 3_099_000 picoseconds. + Weight::from_parts(6_340_084, 0) + // Standard Error: 180_257 + .saturating_add(Weight::from_parts(74_666_091, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_344_543_000 picoseconds. - Weight::from_parts(4_032_382_572, 0) - // Standard Error: 99_537 - .saturating_add(Weight::from_parts(5_787_910, 0).saturating_mul(r.into())) + // Minimum execution time: 4_391_547_000 picoseconds. + Weight::from_parts(4_140_785_425, 0) + // Standard Error: 89_369 + .saturating_add(Weight::from_parts(5_769_622, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32load(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_337_766_000 picoseconds. - Weight::from_parts(3_999_679_120, 0) - // Standard Error: 103_253 - .saturating_add(Weight::from_parts(5_927_871, 0).saturating_mul(r.into())) + // Minimum execution time: 4_386_802_000 picoseconds. + Weight::from_parts(4_243_536_456, 0) + // Standard Error: 95_210 + .saturating_add(Weight::from_parts(5_278_131, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i64store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_550_469_000 picoseconds. - Weight::from_parts(11_379_288_782, 0) - // Standard Error: 199_762 - .saturating_add(Weight::from_parts(12_085_908, 0).saturating_mul(r.into())) + // Minimum execution time: 11_072_272_000 picoseconds. + Weight::from_parts(11_558_306_225, 0) + // Standard Error: 165_659 + .saturating_add(Weight::from_parts(9_828_260, 0).saturating_mul(r.into())) } /// The range of component `r` is `[50, 500]`. fn instr_i32store(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 10_371_806_000 picoseconds. - Weight::from_parts(11_315_025_252, 0) - // Standard Error: 196_400 - .saturating_add(Weight::from_parts(9_868_462, 0).saturating_mul(r.into())) + // Minimum execution time: 10_285_071_000 picoseconds. + Weight::from_parts(11_137_621_942, 0) + // Standard Error: 147_513 + .saturating_add(Weight::from_parts(9_014_757, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_select(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_296_000 picoseconds. - Weight::from_parts(2_387_000, 0) - // Standard Error: 8_522 - .saturating_add(Weight::from_parts(3_812_287, 0).saturating_mul(r.into())) + // Minimum execution time: 2_285_000 picoseconds. + Weight::from_parts(2_410_000, 0) + // Standard Error: 7_624 + .saturating_add(Weight::from_parts(3_864_490, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_293_000, 0) - // Standard Error: 5_596 - .saturating_add(Weight::from_parts(3_015_385, 0).saturating_mul(r.into())) + // Minimum execution time: 2_342_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 6_413 + .saturating_add(Weight::from_parts(3_120_732, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(3_286_665, 0) - // Standard Error: 1_124 - .saturating_add(Weight::from_parts(1_572_972, 0).saturating_mul(r.into())) + // Minimum execution time: 2_301_000 picoseconds. + Weight::from_parts(3_591_730, 0) + // Standard Error: 1_106 + .saturating_add(Weight::from_parts(1_565_415, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_if(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_223_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 8_691 - .saturating_add(Weight::from_parts(2_934_320, 0).saturating_mul(r.into())) + // Minimum execution time: 2_306_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 7_711 + .saturating_add(Weight::from_parts(2_932_880, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_br_table(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(1_393_237, 0) - // Standard Error: 11_704 - .saturating_add(Weight::from_parts(5_179_849, 0).saturating_mul(r.into())) + // Minimum execution time: 2_358_000 picoseconds. + Weight::from_parts(2_144_801, 0) + // Standard Error: 22_082 + .saturating_add(Weight::from_parts(5_266_139, 0).saturating_mul(r.into())) } /// The range of component `e` is `[1, 256]`. fn instr_br_table_per_entry(e: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_013_000 picoseconds. - Weight::from_parts(5_664_804, 0) - // Standard Error: 2_473 - .saturating_add(Weight::from_parts(127_877, 0).saturating_mul(e.into())) + // Minimum execution time: 6_803_000 picoseconds. + Weight::from_parts(5_374_690, 0) + // Standard Error: 1_699 + .saturating_add(Weight::from_parts(171_193, 0).saturating_mul(e.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_const(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_351_000 picoseconds. - Weight::from_parts(4_248_352, 0) - // Standard Error: 5_303 - .saturating_add(Weight::from_parts(2_564_771, 0).saturating_mul(r.into())) + // Minimum execution time: 2_431_000 picoseconds. + Weight::from_parts(4_875_813, 0) + // Standard Error: 8_258 + .saturating_add(Weight::from_parts(2_629_733, 0).saturating_mul(r.into())) } fn instr_i64const(r: u32, ) -> Weight { Weight::from_parts(0, 0) - .saturating_add(Weight::from_parts(2_564_771 - - 2_417_980, 0).saturating_mul(r.into())) + .saturating_add(Weight::from_parts(2_629_733 - + 2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_275_000 picoseconds. - Weight::from_parts(4_116_849, 0) - // Standard Error: 12_318 - .saturating_add(Weight::from_parts(2_417_980, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(5_140_243, 0) + // Standard Error: 13_164 + .saturating_add(Weight::from_parts(2_421_700, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_call_indirect(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_739_000 picoseconds. - Weight::from_parts(8_247_555, 0) - // Standard Error: 21_570 - .saturating_add(Weight::from_parts(10_290_172, 0).saturating_mul(r.into())) + // Minimum execution time: 2_669_000 picoseconds. + Weight::from_parts(22_369_265, 0) + // Standard Error: 28_577 + .saturating_add(Weight::from_parts(9_740_558, 0).saturating_mul(r.into())) } /// The range of component `p` is `[0, 128]`. fn instr_call_indirect_per_param(p: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 11_969_000 picoseconds. - Weight::from_parts(462_240, 0) - // Standard Error: 7_690 - .saturating_add(Weight::from_parts(1_320_559, 0).saturating_mul(p.into())) + // Minimum execution time: 12_277_000 picoseconds. + Weight::from_parts(3_596_853, 0) + // Standard Error: 5_869 + .saturating_add(Weight::from_parts(1_258_605, 0).saturating_mul(p.into())) } /// The range of component `l` is `[0, 1024]`. - fn instr_call_per_local(l: u32, ) -> Weight { + fn instr_call_per_local(_l: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_385_000 picoseconds. - Weight::from_parts(5_731_863, 0) - // Standard Error: 14 - .saturating_add(Weight::from_parts(7, 0).saturating_mul(l.into())) + // Minimum execution time: 5_391_000 picoseconds. + Weight::from_parts(5_778_137, 0) } /// The range of component `r` is `[0, 50]`. fn instr_local_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(1_509_226, 0) - // Standard Error: 3_855 - .saturating_add(Weight::from_parts(289_461, 0).saturating_mul(r.into())) + // Minimum execution time: 4_835_000 picoseconds. + Weight::from_parts(6_065_483, 0) + // Standard Error: 3_006 + .saturating_add(Weight::from_parts(378_512, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_290_000 picoseconds. - Weight::from_parts(2_403_000, 0) - // Standard Error: 6_135 - .saturating_add(Weight::from_parts(808_043, 0).saturating_mul(r.into())) + // Minimum execution time: 4_722_000 picoseconds. + Weight::from_parts(3_902_309, 0) + // Standard Error: 5_742 + .saturating_add(Weight::from_parts(1_056_408, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_local_tee(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_206_000 picoseconds. - Weight::from_parts(2_259_000, 0) - // Standard Error: 6_737 - .saturating_add(Weight::from_parts(815_196, 0).saturating_mul(r.into())) + // Minimum execution time: 4_888_000 picoseconds. + Weight::from_parts(4_512_058, 0) + // Standard Error: 6_410 + .saturating_add(Weight::from_parts(1_001_510, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_get(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_514_000 picoseconds. - Weight::from_parts(2_989_795, 0) - // Standard Error: 8_020 - .saturating_add(Weight::from_parts(785_708, 0).saturating_mul(r.into())) + // Minimum execution time: 6_413_000 picoseconds. + Weight::from_parts(2_704_134, 0) + // Standard Error: 7_244 + .saturating_add(Weight::from_parts(804_200, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_global_set(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_390_000 picoseconds. - Weight::from_parts(6_462_000, 0) - // Standard Error: 8_592 - .saturating_add(Weight::from_parts(1_340_863, 0).saturating_mul(r.into())) + // Minimum execution time: 6_516_000 picoseconds. + Weight::from_parts(1_028_752, 0) + // Standard Error: 8_792 + .saturating_add(Weight::from_parts(1_494_630, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_memory_current(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 4_894_000 picoseconds. - Weight::from_parts(1_962_792, 0) - // Standard Error: 10_808 - .saturating_add(Weight::from_parts(6_909_000, 0).saturating_mul(r.into())) + // Minimum execution time: 5_560_000 picoseconds. + Weight::from_parts(1_126_442, 0) + // Standard Error: 14_476 + .saturating_add(Weight::from_parts(7_240_597, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(2_309_000, 0) - // Standard Error: 9_270 - .saturating_add(Weight::from_parts(3_370_154, 0).saturating_mul(r.into())) + // Minimum execution time: 2_299_000 picoseconds. + Weight::from_parts(2_449_000, 0) + // Standard Error: 7_416 + .saturating_add(Weight::from_parts(3_344_387, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32clz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_214_000 picoseconds. - Weight::from_parts(2_328_000, 0) - // Standard Error: 6_565 - .saturating_add(Weight::from_parts(3_096_942, 0).saturating_mul(r.into())) + // Minimum execution time: 2_389_000 picoseconds. + Weight::from_parts(2_551_000, 0) + // Standard Error: 5_708 + .saturating_add(Weight::from_parts(3_133_430, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_301_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 5_842 - .saturating_add(Weight::from_parts(3_131_625, 0).saturating_mul(r.into())) + // Minimum execution time: 2_428_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 7_262 + .saturating_add(Weight::from_parts(3_192_675, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ctz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_290_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 5_456 - .saturating_add(Weight::from_parts(2_643_149, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(2_426_000, 0) + // Standard Error: 4_554 + .saturating_add(Weight::from_parts(2_683_293, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_207_000 picoseconds. - Weight::from_parts(2_259_000, 0) - // Standard Error: 4_151 - .saturating_add(Weight::from_parts(559_292, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_385_000, 0) + // Standard Error: 4_686 + .saturating_add(Weight::from_parts(631_609, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32popcnt(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_282_000 picoseconds. - Weight::from_parts(1_656_873, 0) - // Standard Error: 3_537 - .saturating_add(Weight::from_parts(394_264, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(1_221_890, 0) + // Standard Error: 3_960 + .saturating_add(Weight::from_parts(452_047, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_300_000, 0) - // Standard Error: 13_227 - .saturating_add(Weight::from_parts(1_891_285, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_390_000, 0) + // Standard Error: 11_114 + .saturating_add(Weight::from_parts(1_916_122, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eqz(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_297_000, 0) - // Standard Error: 9_416 - .saturating_add(Weight::from_parts(1_195_412, 0).saturating_mul(r.into())) + // Minimum execution time: 2_436_000 picoseconds. + Weight::from_parts(2_504_000, 0) + // Standard Error: 7_104 + .saturating_add(Weight::from_parts(1_156_958, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_254_000 picoseconds. - Weight::from_parts(1_244_456, 0) - // Standard Error: 3_993 - .saturating_add(Weight::from_parts(393_631, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(1_708_596, 0) + // Standard Error: 2_843 + .saturating_add(Weight::from_parts(377_083, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(1_710_108, 0) - // Standard Error: 3_705 - .saturating_add(Weight::from_parts(357_471, 0).saturating_mul(r.into())) + // Minimum execution time: 2_386_000 picoseconds. + Weight::from_parts(1_424_415, 0) + // Standard Error: 3_599 + .saturating_add(Weight::from_parts(395_934, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend8s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_300_000 picoseconds. - Weight::from_parts(2_350_000, 0) - // Standard Error: 4_034 - .saturating_add(Weight::from_parts(496_786, 0).saturating_mul(r.into())) + // Minimum execution time: 2_396_000 picoseconds. + Weight::from_parts(2_491_000, 0) + // Standard Error: 3_774 + .saturating_add(Weight::from_parts(516_281, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend16s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_251_000 picoseconds. - Weight::from_parts(143_742, 0) - // Standard Error: 5_409 - .saturating_add(Weight::from_parts(551_665, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(548_192, 0) + // Standard Error: 4_583 + .saturating_add(Weight::from_parts(556_734, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extend32s(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(210_302, 0) - // Standard Error: 5_693 - .saturating_add(Weight::from_parts(526_432, 0).saturating_mul(r.into())) + // Minimum execution time: 2_333_000 picoseconds. + Weight::from_parts(447_271, 0) + // Standard Error: 5_300 + .saturating_add(Weight::from_parts(535_915, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendsi32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_246_000 picoseconds. - Weight::from_parts(1_582_329, 0) - // Standard Error: 3_448 - .saturating_add(Weight::from_parts(348_194, 0).saturating_mul(r.into())) + // Minimum execution time: 2_340_000 picoseconds. + Weight::from_parts(1_639_695, 0) + // Standard Error: 3_519 + .saturating_add(Weight::from_parts(368_523, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64extendui32(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_350_000 picoseconds. - Weight::from_parts(2_836_265, 0) - // Standard Error: 1_916 - .saturating_add(Weight::from_parts(158_153, 0).saturating_mul(r.into())) + // Minimum execution time: 2_305_000 picoseconds. + Weight::from_parts(2_843_474, 0) + // Standard Error: 1_950 + .saturating_add(Weight::from_parts(176_592, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32wrapi64(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_997_599, 0) - // Standard Error: 1_870 - .saturating_add(Weight::from_parts(155_117, 0).saturating_mul(r.into())) + // Minimum execution time: 2_351_000 picoseconds. + Weight::from_parts(2_894_613, 0) + // Standard Error: 2_024 + .saturating_add(Weight::from_parts(188_853, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 11_719 - .saturating_add(Weight::from_parts(1_911_693, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_418_000, 0) + // Standard Error: 9_504 + .saturating_add(Weight::from_parts(1_936_605, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32eq(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_259_000 picoseconds. - Weight::from_parts(2_323_000, 0) - // Standard Error: 7_734 - .saturating_add(Weight::from_parts(1_135_022, 0).saturating_mul(r.into())) + // Minimum execution time: 2_291_000 picoseconds. + Weight::from_parts(2_364_000, 0) + // Standard Error: 8_346 + .saturating_add(Weight::from_parts(1_222_521, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_189_000 picoseconds. - Weight::from_parts(2_254_000, 0) - // Standard Error: 13_208 - .saturating_add(Weight::from_parts(1_839_828, 0).saturating_mul(r.into())) + // Minimum execution time: 2_345_000 picoseconds. + Weight::from_parts(2_452_000, 0) + // Standard Error: 10_232 + .saturating_add(Weight::from_parts(1_883_867, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ne(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_306_000, 0) - // Standard Error: 7_621 - .saturating_add(Weight::from_parts(1_164_880, 0).saturating_mul(r.into())) + // Minimum execution time: 2_323_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 7_581 + .saturating_add(Weight::from_parts(1_200_178, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_238_000 picoseconds. - Weight::from_parts(2_291_000, 0) - // Standard Error: 10_468 - .saturating_add(Weight::from_parts(1_846_638, 0).saturating_mul(r.into())) + // Minimum execution time: 2_410_000 picoseconds. + Weight::from_parts(2_459_000, 0) + // Standard Error: 11_139 + .saturating_add(Weight::from_parts(1_877_766, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32lts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_240_000 picoseconds. - Weight::from_parts(2_308_000, 0) - // Standard Error: 7_502 - .saturating_add(Weight::from_parts(1_112_456, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(2_387_000, 0) + // Standard Error: 8_083 + .saturating_add(Weight::from_parts(1_217_904, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_192_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 12_282 - .saturating_add(Weight::from_parts(1_806_513, 0).saturating_mul(r.into())) + // Minimum execution time: 2_403_000 picoseconds. + Weight::from_parts(2_482_000, 0) + // Standard Error: 11_044 + .saturating_add(Weight::from_parts(1_956_302, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ltu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_250_000 picoseconds. - Weight::from_parts(2_310_000, 0) - // Standard Error: 8_080 - .saturating_add(Weight::from_parts(1_114_020, 0).saturating_mul(r.into())) + // Minimum execution time: 2_353_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 7_870 + .saturating_add(Weight::from_parts(1_213_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_270_000 picoseconds. - Weight::from_parts(2_319_000, 0) - // Standard Error: 11_947 - .saturating_add(Weight::from_parts(1_858_303, 0).saturating_mul(r.into())) + // Minimum execution time: 2_364_000 picoseconds. + Weight::from_parts(2_430_000, 0) + // Standard Error: 10_577 + .saturating_add(Weight::from_parts(1_968_043, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gts(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_204_000 picoseconds. - Weight::from_parts(2_322_000, 0) - // Standard Error: 9_452 - .saturating_add(Weight::from_parts(1_236_546, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_442_000, 0) + // Standard Error: 7_838 + .saturating_add(Weight::from_parts(1_267_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(2_289_000, 0) - // Standard Error: 9_388 - .saturating_add(Weight::from_parts(1_920_612, 0).saturating_mul(r.into())) + // Minimum execution time: 2_395_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 10_856 + .saturating_add(Weight::from_parts(1_910_357, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32gtu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_267_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 7_906 - .saturating_add(Weight::from_parts(1_147_958, 0).saturating_mul(r.into())) + // Minimum execution time: 2_343_000 picoseconds. + Weight::from_parts(2_409_000, 0) + // Standard Error: 5_786 + .saturating_add(Weight::from_parts(1_128_653, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_233_000 picoseconds. - Weight::from_parts(2_278_000, 0) - // Standard Error: 14_090 - .saturating_add(Weight::from_parts(1_923_509, 0).saturating_mul(r.into())) + // Minimum execution time: 2_318_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 10_344 + .saturating_add(Weight::from_parts(1_897_480, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32les(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_271_000, 0) - // Standard Error: 9_629 - .saturating_add(Weight::from_parts(1_197_507, 0).saturating_mul(r.into())) + // Minimum execution time: 2_355_000 picoseconds. + Weight::from_parts(2_460_000, 0) + // Standard Error: 6_963 + .saturating_add(Weight::from_parts(1_125_698, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_341_000, 0) - // Standard Error: 10_951 - .saturating_add(Weight::from_parts(1_915_569, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_447_000, 0) + // Standard Error: 8_285 + .saturating_add(Weight::from_parts(1_848_149, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32leu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_218_000 picoseconds. - Weight::from_parts(2_276_000, 0) - // Standard Error: 8_283 - .saturating_add(Weight::from_parts(1_212_268, 0).saturating_mul(r.into())) + // Minimum execution time: 2_327_000 picoseconds. + Weight::from_parts(2_394_000, 0) + // Standard Error: 7_282 + .saturating_add(Weight::from_parts(1_176_423, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_221_000 picoseconds. - Weight::from_parts(2_283_000, 0) - // Standard Error: 11_398 - .saturating_add(Weight::from_parts(1_932_092, 0).saturating_mul(r.into())) + // Minimum execution time: 2_372_000 picoseconds. + Weight::from_parts(2_439_000, 0) + // Standard Error: 9_207 + .saturating_add(Weight::from_parts(1_837_009, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32ges(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(2_324_000, 0) - // Standard Error: 8_582 - .saturating_add(Weight::from_parts(1_170_243, 0).saturating_mul(r.into())) + // Minimum execution time: 2_368_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_320 + .saturating_add(Weight::from_parts(1_231_088, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_216_000 picoseconds. - Weight::from_parts(2_294_000, 0) - // Standard Error: 13_115 - .saturating_add(Weight::from_parts(1_902_257, 0).saturating_mul(r.into())) + // Minimum execution time: 2_373_000 picoseconds. + Weight::from_parts(2_461_000, 0) + // Standard Error: 9_499 + .saturating_add(Weight::from_parts(1_922_588, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32geu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_277_000 picoseconds. - Weight::from_parts(2_358_000, 0) - // Standard Error: 9_006 - .saturating_add(Weight::from_parts(1_220_902, 0).saturating_mul(r.into())) + // Minimum execution time: 2_387_000 picoseconds. + Weight::from_parts(2_455_000, 0) + // Standard Error: 7_681 + .saturating_add(Weight::from_parts(1_198_894, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_255_000 picoseconds. - Weight::from_parts(2_316_000, 0) - // Standard Error: 8_357 - .saturating_add(Weight::from_parts(1_302_969, 0).saturating_mul(r.into())) + // Minimum execution time: 2_308_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 7_797 + .saturating_add(Weight::from_parts(1_286_566, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32add(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_227_000 picoseconds. - Weight::from_parts(2_275_000, 0) - // Standard Error: 5_837 - .saturating_add(Weight::from_parts(637_533, 0).saturating_mul(r.into())) + // Minimum execution time: 2_329_000 picoseconds. + Weight::from_parts(2_389_000, 0) + // Standard Error: 4_968 + .saturating_add(Weight::from_parts(645_254, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_182_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_474 - .saturating_add(Weight::from_parts(1_274_444, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(2_489_000, 0) + // Standard Error: 7_055 + .saturating_add(Weight::from_parts(1_232_084, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32sub(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_268_000 picoseconds. - Weight::from_parts(2_314_000, 0) - // Standard Error: 4_787 - .saturating_add(Weight::from_parts(598_295, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_420_000, 0) + // Standard Error: 4_348 + .saturating_add(Weight::from_parts(633_810, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_184_000 picoseconds. - Weight::from_parts(2_286_000, 0) - // Standard Error: 13_111 - .saturating_add(Weight::from_parts(1_764_139, 0).saturating_mul(r.into())) + // Minimum execution time: 2_336_000 picoseconds. + Weight::from_parts(2_413_000, 0) + // Standard Error: 8_202 + .saturating_add(Weight::from_parts(1_777_425, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32mul(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_247_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 8_531 - .saturating_add(Weight::from_parts(1_233_195, 0).saturating_mul(r.into())) + // Minimum execution time: 2_314_000 picoseconds. + Weight::from_parts(2_369_000, 0) + // Standard Error: 6_935 + .saturating_add(Weight::from_parts(1_201_570, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_215_000 picoseconds. - Weight::from_parts(2_308_000, 0) - // Standard Error: 8_554 - .saturating_add(Weight::from_parts(2_787_034, 0).saturating_mul(r.into())) + // Minimum execution time: 2_276_000 picoseconds. + Weight::from_parts(6_846_840, 0) + // Standard Error: 17_822 + .saturating_add(Weight::from_parts(2_268_370, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_285_000 picoseconds. - Weight::from_parts(2_336_000, 0) - // Standard Error: 8_016 - .saturating_add(Weight::from_parts(2_444_420, 0).saturating_mul(r.into())) + // Minimum execution time: 2_394_000 picoseconds. + Weight::from_parts(4_704_336, 0) + // Standard Error: 10_960 + .saturating_add(Weight::from_parts(2_182_711, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_266_000, 0) - // Standard Error: 9_336 - .saturating_add(Weight::from_parts(3_001_762, 0).saturating_mul(r.into())) + // Minimum execution time: 2_375_000 picoseconds. + Weight::from_parts(1_968_824, 0) + // Standard Error: 15_899 + .saturating_add(Weight::from_parts(2_762_269, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32divu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_230_000 picoseconds. - Weight::from_parts(2_279_000, 0) - // Standard Error: 8_838 - .saturating_add(Weight::from_parts(2_479_926, 0).saturating_mul(r.into())) + // Minimum execution time: 2_335_000 picoseconds. + Weight::from_parts(1_450_000, 0) + // Standard Error: 13_496 + .saturating_add(Weight::from_parts(2_401_407, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_222_000 picoseconds. - Weight::from_parts(2_251_000, 0) - // Standard Error: 15_694 - .saturating_add(Weight::from_parts(9_400_757, 0).saturating_mul(r.into())) + // Minimum execution time: 2_448_000 picoseconds. + Weight::from_parts(2_513_000, 0) + // Standard Error: 19_401 + .saturating_add(Weight::from_parts(9_309_211, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rems(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_177_000 picoseconds. - Weight::from_parts(2_262_000, 0) - // Standard Error: 24_148 - .saturating_add(Weight::from_parts(7_553_495, 0).saturating_mul(r.into())) + // Minimum execution time: 2_273_000 picoseconds. + Weight::from_parts(1_738_370, 0) + // Standard Error: 42_672 + .saturating_add(Weight::from_parts(7_512_557, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_305_000 picoseconds. - Weight::from_parts(2_344_000, 0) - // Standard Error: 8_791 - .saturating_add(Weight::from_parts(2_956_458, 0).saturating_mul(r.into())) + // Minimum execution time: 2_371_000 picoseconds. + Weight::from_parts(2_215_088, 0) + // Standard Error: 15_445 + .saturating_add(Weight::from_parts(2_956_278, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32remu(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_280_000 picoseconds. - Weight::from_parts(2_297_000, 0) - // Standard Error: 7_657 - .saturating_add(Weight::from_parts(2_477_698, 0).saturating_mul(r.into())) + // Minimum execution time: 2_409_000 picoseconds. + Weight::from_parts(217_500, 0) + // Standard Error: 7_904 + .saturating_add(Weight::from_parts(2_576_151, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_206_000 picoseconds. - Weight::from_parts(2_261_000, 0) - // Standard Error: 8_702 - .saturating_add(Weight::from_parts(1_265_825, 0).saturating_mul(r.into())) + // Minimum execution time: 2_456_000 picoseconds. + Weight::from_parts(2_503_000, 0) + // Standard Error: 7_920 + .saturating_add(Weight::from_parts(1_321_543, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32and(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_198_000 picoseconds. - Weight::from_parts(2_243_000, 0) - // Standard Error: 5_815 - .saturating_add(Weight::from_parts(639_043, 0).saturating_mul(r.into())) + // Minimum execution time: 2_346_000 picoseconds. + Weight::from_parts(2_479_000, 0) + // Standard Error: 4_711 + .saturating_add(Weight::from_parts(689_892, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_243_000 picoseconds. - Weight::from_parts(2_299_000, 0) - // Standard Error: 8_918 - .saturating_add(Weight::from_parts(1_302_162, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_427_000, 0) + // Standard Error: 8_029 + .saturating_add(Weight::from_parts(1_256_838, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32or(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(2_329_000, 0) - // Standard Error: 4_483 - .saturating_add(Weight::from_parts(628_991, 0).saturating_mul(r.into())) + // Minimum execution time: 2_334_000 picoseconds. + Weight::from_parts(2_480_000, 0) + // Standard Error: 3_812 + .saturating_add(Weight::from_parts(607_420, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_211_000 picoseconds. - Weight::from_parts(2_264_000, 0) - // Standard Error: 9_628 - .saturating_add(Weight::from_parts(1_310_707, 0).saturating_mul(r.into())) + // Minimum execution time: 2_328_000 picoseconds. + Weight::from_parts(2_392_000, 0) + // Standard Error: 7_362 + .saturating_add(Weight::from_parts(1_248_739, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32xor(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_197_000 picoseconds. - Weight::from_parts(2_261_000, 0) - // Standard Error: 4_478 - .saturating_add(Weight::from_parts(645_751, 0).saturating_mul(r.into())) + // Minimum execution time: 2_419_000 picoseconds. + Weight::from_parts(2_465_000, 0) + // Standard Error: 4_304 + .saturating_add(Weight::from_parts(604_813, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_327_000, 0) - // Standard Error: 8_607 - .saturating_add(Weight::from_parts(1_149_332, 0).saturating_mul(r.into())) + // Minimum execution time: 2_298_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 8_043 + .saturating_add(Weight::from_parts(1_073_194, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_245_000 picoseconds. - Weight::from_parts(2_263_000, 0) - // Standard Error: 4_008 - .saturating_add(Weight::from_parts(590_180, 0).saturating_mul(r.into())) + // Minimum execution time: 2_427_000 picoseconds. + Weight::from_parts(2_511_000, 0) + // Standard Error: 4_969 + .saturating_add(Weight::from_parts(594_802, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_158_000 picoseconds. - Weight::from_parts(2_285_000, 0) - // Standard Error: 8_280 - .saturating_add(Weight::from_parts(1_079_846, 0).saturating_mul(r.into())) + // Minimum execution time: 2_312_000 picoseconds. + Weight::from_parts(2_399_000, 0) + // Standard Error: 7_093 + .saturating_add(Weight::from_parts(1_110_114, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shrs(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_310_000 picoseconds. - Weight::from_parts(2_385_000, 0) - // Standard Error: 3_875 - .saturating_add(Weight::from_parts(547_245, 0).saturating_mul(r.into())) + // Minimum execution time: 2_331_000 picoseconds. + Weight::from_parts(2_433_000, 0) + // Standard Error: 4_140 + .saturating_add(Weight::from_parts(600_354, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_231_000 picoseconds. - Weight::from_parts(2_315_000, 0) - // Standard Error: 9_477 - .saturating_add(Weight::from_parts(1_110_046, 0).saturating_mul(r.into())) + // Minimum execution time: 2_300_000 picoseconds. + Weight::from_parts(2_419_000, 0) + // Standard Error: 7_150 + .saturating_add(Weight::from_parts(1_154_649, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32shru(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_174_000 picoseconds. - Weight::from_parts(2_305_000, 0) - // Standard Error: 4_474 - .saturating_add(Weight::from_parts(564_322, 0).saturating_mul(r.into())) + // Minimum execution time: 2_356_000 picoseconds. + Weight::from_parts(2_423_000, 0) + // Standard Error: 5_067 + .saturating_add(Weight::from_parts(594_487, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_271_000 picoseconds. - Weight::from_parts(2_318_000, 0) - // Standard Error: 8_819 - .saturating_add(Weight::from_parts(1_132_561, 0).saturating_mul(r.into())) + // Minimum execution time: 2_339_000 picoseconds. + Weight::from_parts(2_406_000, 0) + // Standard Error: 5_674 + .saturating_add(Weight::from_parts(1_051_819, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotl(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_240_000 picoseconds. - Weight::from_parts(2_292_000, 0) - // Standard Error: 4_113 - .saturating_add(Weight::from_parts(601_692, 0).saturating_mul(r.into())) + // Minimum execution time: 2_383_000 picoseconds. + Weight::from_parts(114_723, 0) + // Standard Error: 5_881 + .saturating_add(Weight::from_parts(646_798, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i64rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_236_000 picoseconds. - Weight::from_parts(2_253_000, 0) - // Standard Error: 7_294 - .saturating_add(Weight::from_parts(1_106_781, 0).saturating_mul(r.into())) + // Minimum execution time: 2_292_000 picoseconds. + Weight::from_parts(2_422_000, 0) + // Standard Error: 6_697 + .saturating_add(Weight::from_parts(1_053_580, 0).saturating_mul(r.into())) } /// The range of component `r` is `[0, 50]`. fn instr_i32rotr(r: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_193_000 picoseconds. - Weight::from_parts(2_268_000, 0) - // Standard Error: 4_653 - .saturating_add(Weight::from_parts(587_731, 0).saturating_mul(r.into())) + // Minimum execution time: 2_325_000 picoseconds. + Weight::from_parts(206_699, 0) + // Standard Error: 5_851 + .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } } diff --git a/runtime/vara/src/weights/pallet_gear_voucher.rs b/runtime/vara/src/weights/pallet_gear_voucher.rs index a6028a41c75..6d6889d1752 100644 --- a/runtime/vara/src/weights/pallet_gear_voucher.rs +++ b/runtime/vara/src/weights/pallet_gear_voucher.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_gear_voucher //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -47,8 +47,8 @@ impl pallet_gear_voucher::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 26_236_000 picoseconds. - Weight::from_parts(26_891_000, 6196) + // Minimum execution time: 25_876_000 picoseconds. + Weight::from_parts(26_659_000, 6196) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -60,8 +60,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `101` // Estimated: `6196` - // Minimum execution time: 26_236_000 picoseconds. - Weight::from_parts(26_891_000, 6196) + // Minimum execution time: 25_876_000 picoseconds. + Weight::from_parts(26_659_000, 6196) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/runtime/vara/src/weights/pallet_timestamp.rs b/runtime/vara/src/weights/pallet_timestamp.rs index aa0808323f6..5c50f24c824 100644 --- a/runtime/vara/src/weights/pallet_timestamp.rs +++ b/runtime/vara/src/weights/pallet_timestamp.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_timestamp //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -46,19 +46,19 @@ pub struct SubstrateWeight(PhantomData); impl pallet_timestamp::WeightInfo for SubstrateWeight { fn set() -> Weight { // Proof Size summary in bytes: - // Measured: `175` + // Measured: `211` // Estimated: `2986` - // Minimum execution time: 7_993_000 picoseconds. - Weight::from_parts(8_357_000, 2986) + // Minimum execution time: 9_513_000 picoseconds. + Weight::from_parts(10_337_000, 2986) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } fn on_finalize() -> Weight { // Proof Size summary in bytes: - // Measured: `57` + // Measured: `94` // Estimated: `0` - // Minimum execution time: 3_169_000 picoseconds. - Weight::from_parts(3_266_000, 0) + // Minimum execution time: 3_681_000 picoseconds. + Weight::from_parts(3_916_000, 0) } } @@ -66,18 +66,18 @@ impl pallet_timestamp::WeightInfo for SubstrateWeight Weight { // Proof Size summary in bytes: - // Measured: `175` + // Measured: `211` // Estimated: `2986` - // Minimum execution time: 7_993_000 picoseconds. - Weight::from_parts(8_357_000, 2986) + // Minimum execution time: 9_513_000 picoseconds. + Weight::from_parts(10_337_000, 2986) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } fn on_finalize() -> Weight { // Proof Size summary in bytes: - // Measured: `57` + // Measured: `94` // Estimated: `0` - // Minimum execution time: 3_169_000 picoseconds. - Weight::from_parts(3_266_000, 0) + // Minimum execution time: 3_681_000 picoseconds. + Weight::from_parts(3_916_000, 0) } } diff --git a/runtime/vara/src/weights/pallet_utility.rs b/runtime/vara/src/weights/pallet_utility.rs index 3d4b1380694..514181ef7a3 100644 --- a/runtime/vara/src/weights/pallet_utility.rs +++ b/runtime/vara/src/weights/pallet_utility.rs @@ -19,7 +19,7 @@ //! Autogenerated weights for pallet_utility //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-08-20, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 @@ -52,44 +52,44 @@ impl pallet_utility::WeightInfo for SubstrateWeight // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_430_000 picoseconds. - Weight::from_parts(6_278_690, 0) - // Standard Error: 4_027 - .saturating_add(Weight::from_parts(4_089_487, 0).saturating_mul(c.into())) + // Minimum execution time: 5_349_000 picoseconds. + Weight::from_parts(8_798_188, 0) + // Standard Error: 2_360 + .saturating_add(Weight::from_parts(3_859_914, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_676_000 picoseconds. - Weight::from_parts(3_933_000, 0) + // Minimum execution time: 3_760_000 picoseconds. + Weight::from_parts(3_882_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_177_000 picoseconds. - Weight::from_parts(11_177_183, 0) - // Standard Error: 4_061 - .saturating_add(Weight::from_parts(4_284_675, 0).saturating_mul(c.into())) + // Minimum execution time: 5_343_000 picoseconds. + Weight::from_parts(6_613_150, 0) + // Standard Error: 2_902 + .saturating_add(Weight::from_parts(4_045_901, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_036_000 picoseconds. - Weight::from_parts(7_341_000, 0) + // Minimum execution time: 6_983_000 picoseconds. + Weight::from_parts(7_317_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_427_000 picoseconds. - Weight::from_parts(5_742_970, 0) - // Standard Error: 3_854 - .saturating_add(Weight::from_parts(4_084_209, 0).saturating_mul(c.into())) + // Minimum execution time: 5_419_000 picoseconds. + Weight::from_parts(9_009_348, 0) + // Standard Error: 2_400 + .saturating_add(Weight::from_parts(3_868_692, 0).saturating_mul(c.into())) } } @@ -100,43 +100,43 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_430_000 picoseconds. - Weight::from_parts(6_278_690, 0) - // Standard Error: 4_027 - .saturating_add(Weight::from_parts(4_089_487, 0).saturating_mul(c.into())) + // Minimum execution time: 5_349_000 picoseconds. + Weight::from_parts(8_798_188, 0) + // Standard Error: 2_360 + .saturating_add(Weight::from_parts(3_859_914, 0).saturating_mul(c.into())) } fn as_derivative() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_676_000 picoseconds. - Weight::from_parts(3_933_000, 0) + // Minimum execution time: 3_760_000 picoseconds. + Weight::from_parts(3_882_000, 0) } /// The range of component `c` is `[0, 1000]`. fn batch_all(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_177_000 picoseconds. - Weight::from_parts(11_177_183, 0) - // Standard Error: 4_061 - .saturating_add(Weight::from_parts(4_284_675, 0).saturating_mul(c.into())) + // Minimum execution time: 5_343_000 picoseconds. + Weight::from_parts(6_613_150, 0) + // Standard Error: 2_902 + .saturating_add(Weight::from_parts(4_045_901, 0).saturating_mul(c.into())) } fn dispatch_as() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_036_000 picoseconds. - Weight::from_parts(7_341_000, 0) + // Minimum execution time: 6_983_000 picoseconds. + Weight::from_parts(7_317_000, 0) } /// The range of component `c` is `[0, 1000]`. fn force_batch(c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 5_427_000 picoseconds. - Weight::from_parts(5_742_970, 0) - // Standard Error: 3_854 - .saturating_add(Weight::from_parts(4_084_209, 0).saturating_mul(c.into())) + // Minimum execution time: 5_419_000 picoseconds. + Weight::from_parts(9_009_348, 0) + // Standard Error: 2_400 + .saturating_add(Weight::from_parts(3_868_692, 0).saturating_mul(c.into())) } } From 928276fe27685e299290ee5caf86ba0868fc37b6 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Mon, 11 Sep 2023 17:00:35 +0400 Subject: [PATCH 132/165] chore(release): Versioning (#3244) --- pallets/gear-bank/src/lib.rs | 2 +- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pallets/gear-bank/src/lib.rs b/pallets/gear-bank/src/lib.rs index eb9e34e178e..44b5f1e3845 100644 --- a/pallets/gear-bank/src/lib.rs +++ b/pallets/gear-bank/src/lib.rs @@ -37,7 +37,7 @@ pub(crate) type GasMultiplier = common::GasMultiplier, u64>; pub(crate) type GasMultiplierOf = ::GasMultiplier; /// The current storage version. -pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); +pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); #[frame_support::pallet] pub mod pallet { diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 2cc7472aab4..d083d09d03e 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 330, + spec_version: 340, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 305b3f35228..f99857dd56d 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -145,7 +145,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 330, + spec_version: 340, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 9f02b29f56a52841d1f966f2aadf342127e1f05e Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Mon, 11 Sep 2023 17:09:42 +0400 Subject: [PATCH 133/165] chores(v0.3.3): Revert actual bump and set proper lib versions (#3246) --- Cargo.lock | 42 ++++++++++++++++++------------------ Cargo.toml | 2 +- pallets/gear-bank/src/lib.rs | 2 +- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c6ee9ecbb10..d02d3bb927e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3631,14 +3631,14 @@ dependencies = [ [[package]] name = "galloc" -version = "0.3.2" +version = "0.3.3" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "base64 0.21.3", @@ -3677,7 +3677,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "async-trait", @@ -3721,7 +3721,7 @@ dependencies = [ [[package]] name = "gcore" -version = "0.3.2" +version = "0.3.3" dependencies = [ "galloc", "gear-core-errors", @@ -3776,7 +3776,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.3.2" +version = "0.3.3" dependencies = [ "proc-macro2", "quote", @@ -3785,7 +3785,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.3.2" +version = "0.3.3" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3844,7 +3844,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "0.3.2" +version = "0.3.3" dependencies = [ "clap 4.4.2", "frame-benchmarking", @@ -3878,7 +3878,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.3.2" +version = "0.3.3" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3906,7 +3906,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.3.2" +version = "0.3.3" dependencies = [ "quote", "syn 2.0.31", @@ -3914,7 +3914,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.3.2" +version = "0.3.3" dependencies = [ "blake2-rfc", "byteorder", @@ -3936,7 +3936,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.3.2" +version = "0.3.3" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3945,7 +3945,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.3.2" +version = "0.3.3" dependencies = [ "actor-system-error", "derive_more", @@ -4003,7 +4003,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "arbitrary", @@ -4343,7 +4343,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "0.3.2" +version = "0.3.3" dependencies = [ "cc", ] @@ -4436,7 +4436,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.3.2" +version = "0.3.3" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4606,7 +4606,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "0.3.2" +version = "0.3.3" dependencies = [ "blake2-rfc", "derive_more", @@ -4620,7 +4620,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.3.2" +version = "0.3.3" dependencies = [ "gmeta", "gstd", @@ -4644,7 +4644,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.3.2" +version = "0.3.3" dependencies = [ "anyhow", "base64 0.21.3", @@ -4695,7 +4695,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.3.2" +version = "0.3.3" dependencies = [ "proc-macro2", "quote", @@ -4704,7 +4704,7 @@ dependencies = [ [[package]] name = "gstd" -version = "0.3.2" +version = "0.3.3" dependencies = [ "bs58", "futures", @@ -4733,7 +4733,7 @@ dependencies = [ [[package]] name = "gsys" -version = "0.3.2" +version = "0.3.3" [[package]] name = "gtest" diff --git a/Cargo.toml b/Cargo.toml index cc657902e6f..bf10962750d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.3.2" +version = "0.3.3" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" diff --git a/pallets/gear-bank/src/lib.rs b/pallets/gear-bank/src/lib.rs index 44b5f1e3845..eb9e34e178e 100644 --- a/pallets/gear-bank/src/lib.rs +++ b/pallets/gear-bank/src/lib.rs @@ -37,7 +37,7 @@ pub(crate) type GasMultiplier = common::GasMultiplier, u64>; pub(crate) type GasMultiplierOf = ::GasMultiplier; /// The current storage version. -pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); +pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); #[frame_support::pallet] pub mod pallet { diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index d083d09d03e..2cc7472aab4 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 340, + spec_version: 330, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index f99857dd56d..305b3f35228 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -145,7 +145,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 340, + spec_version: 330, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 998b976672586a4b04ddf3edcbb5be422164d565 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Mon, 11 Sep 2023 17:25:43 +0400 Subject: [PATCH 134/165] chore(v0.3.3): Versioning (#3247) --- Cargo.lock | 42 ++++++++++++++++++------------------ Cargo.toml | 2 +- pallets/gear-bank/src/lib.rs | 2 +- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d02d3bb927e..2500a3e11f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3631,14 +3631,14 @@ dependencies = [ [[package]] name = "galloc" -version = "0.3.3" +version = "0.3.4" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "0.3.3" +version = "0.3.4" dependencies = [ "anyhow", "base64 0.21.3", @@ -3677,7 +3677,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.3.3" +version = "0.3.4" dependencies = [ "anyhow", "async-trait", @@ -3721,7 +3721,7 @@ dependencies = [ [[package]] name = "gcore" -version = "0.3.3" +version = "0.3.4" dependencies = [ "galloc", "gear-core-errors", @@ -3776,7 +3776,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.3.3" +version = "0.3.4" dependencies = [ "proc-macro2", "quote", @@ -3785,7 +3785,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.3.3" +version = "0.3.4" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3844,7 +3844,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "0.3.3" +version = "0.3.4" dependencies = [ "clap 4.4.2", "frame-benchmarking", @@ -3878,7 +3878,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.3.3" +version = "0.3.4" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3906,7 +3906,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.3.3" +version = "0.3.4" dependencies = [ "quote", "syn 2.0.31", @@ -3914,7 +3914,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.3.3" +version = "0.3.4" dependencies = [ "blake2-rfc", "byteorder", @@ -3936,7 +3936,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.3.3" +version = "0.3.4" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3945,7 +3945,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.3.3" +version = "0.3.4" dependencies = [ "actor-system-error", "derive_more", @@ -4003,7 +4003,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "0.3.3" +version = "0.3.4" dependencies = [ "anyhow", "arbitrary", @@ -4343,7 +4343,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "0.3.3" +version = "0.3.4" dependencies = [ "cc", ] @@ -4436,7 +4436,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.3.3" +version = "0.3.4" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4606,7 +4606,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "0.3.3" +version = "0.3.4" dependencies = [ "blake2-rfc", "derive_more", @@ -4620,7 +4620,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.3.3" +version = "0.3.4" dependencies = [ "gmeta", "gstd", @@ -4644,7 +4644,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.3.3" +version = "0.3.4" dependencies = [ "anyhow", "base64 0.21.3", @@ -4695,7 +4695,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.3.3" +version = "0.3.4" dependencies = [ "proc-macro2", "quote", @@ -4704,7 +4704,7 @@ dependencies = [ [[package]] name = "gstd" -version = "0.3.3" +version = "0.3.4" dependencies = [ "bs58", "futures", @@ -4733,7 +4733,7 @@ dependencies = [ [[package]] name = "gsys" -version = "0.3.3" +version = "0.3.4" [[package]] name = "gtest" diff --git a/Cargo.toml b/Cargo.toml index bf10962750d..6dbd8172a62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.3.3" +version = "0.3.4" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" diff --git a/pallets/gear-bank/src/lib.rs b/pallets/gear-bank/src/lib.rs index eb9e34e178e..44b5f1e3845 100644 --- a/pallets/gear-bank/src/lib.rs +++ b/pallets/gear-bank/src/lib.rs @@ -37,7 +37,7 @@ pub(crate) type GasMultiplier = common::GasMultiplier, u64>; pub(crate) type GasMultiplierOf = ::GasMultiplier; /// The current storage version. -pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); +pub(crate) const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); #[frame_support::pallet] pub mod pallet { diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 2cc7472aab4..d083d09d03e 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 330, + spec_version: 340, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 305b3f35228..f99857dd56d 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -145,7 +145,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 330, + spec_version: 340, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From d8d59287bf874d41e9116d9cc6a4e21e40819e58 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Mon, 11 Sep 2023 18:41:16 +0400 Subject: [PATCH 135/165] fix(0.3.3): Force reinstrumentation (#3248) --- Cargo.lock | 42 ++++++++++++++++++------------------ Cargo.toml | 2 +- pallets/gear/src/schedule.rs | 2 +- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2500a3e11f1..d02d3bb927e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3631,14 +3631,14 @@ dependencies = [ [[package]] name = "galloc" -version = "0.3.4" +version = "0.3.3" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "0.3.4" +version = "0.3.3" dependencies = [ "anyhow", "base64 0.21.3", @@ -3677,7 +3677,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.3.4" +version = "0.3.3" dependencies = [ "anyhow", "async-trait", @@ -3721,7 +3721,7 @@ dependencies = [ [[package]] name = "gcore" -version = "0.3.4" +version = "0.3.3" dependencies = [ "galloc", "gear-core-errors", @@ -3776,7 +3776,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.3.4" +version = "0.3.3" dependencies = [ "proc-macro2", "quote", @@ -3785,7 +3785,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.3.4" +version = "0.3.3" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3844,7 +3844,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "0.3.4" +version = "0.3.3" dependencies = [ "clap 4.4.2", "frame-benchmarking", @@ -3878,7 +3878,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.3.4" +version = "0.3.3" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3906,7 +3906,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.3.4" +version = "0.3.3" dependencies = [ "quote", "syn 2.0.31", @@ -3914,7 +3914,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.3.4" +version = "0.3.3" dependencies = [ "blake2-rfc", "byteorder", @@ -3936,7 +3936,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.3.4" +version = "0.3.3" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3945,7 +3945,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.3.4" +version = "0.3.3" dependencies = [ "actor-system-error", "derive_more", @@ -4003,7 +4003,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "0.3.4" +version = "0.3.3" dependencies = [ "anyhow", "arbitrary", @@ -4343,7 +4343,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "0.3.4" +version = "0.3.3" dependencies = [ "cc", ] @@ -4436,7 +4436,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.3.4" +version = "0.3.3" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4606,7 +4606,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "0.3.4" +version = "0.3.3" dependencies = [ "blake2-rfc", "derive_more", @@ -4620,7 +4620,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.3.4" +version = "0.3.3" dependencies = [ "gmeta", "gstd", @@ -4644,7 +4644,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.3.4" +version = "0.3.3" dependencies = [ "anyhow", "base64 0.21.3", @@ -4695,7 +4695,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.3.4" +version = "0.3.3" dependencies = [ "proc-macro2", "quote", @@ -4704,7 +4704,7 @@ dependencies = [ [[package]] name = "gstd" -version = "0.3.4" +version = "0.3.3" dependencies = [ "bs58", "futures", @@ -4733,7 +4733,7 @@ dependencies = [ [[package]] name = "gsys" -version = "0.3.4" +version = "0.3.3" [[package]] name = "gtest" diff --git a/Cargo.toml b/Cargo.toml index 6dbd8172a62..bf10962750d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.3.4" +version = "0.3.3" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" diff --git a/pallets/gear/src/schedule.rs b/pallets/gear/src/schedule.rs index bd6a4f5d03d..30c68805afe 100644 --- a/pallets/gear/src/schedule.rs +++ b/pallets/gear/src/schedule.rs @@ -753,7 +753,7 @@ impl Default for Limits { impl Default for InstructionWeights { fn default() -> Self { Self { - version: 9, + version: 10, i64const: cost_instr!(instr_i64const, 1), i64load: cost_instr!(instr_i64load, 0), i32load: cost_instr!(instr_i32load, 0), diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index d083d09d03e..2cc7472aab4 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 340, + spec_version: 330, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index f99857dd56d..305b3f35228 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -145,7 +145,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 340, + spec_version: 330, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From e0b6b800606b53c686f78a5ce209f70613a7099b Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Tue, 12 Sep 2023 16:31:32 +0400 Subject: [PATCH 136/165] chore!(runtime): Release 0.3.4 (#3251) --- Cargo.lock | 42 +++---- Cargo.toml | 2 +- gsdk/src/metadata/generated.rs | 5 - node/cli/src/benchmarking.rs | 2 - node/testing/src/keyring.rs | 5 +- pallets/gas/src/migrations.rs | 10 +- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/extensions/mod.rs | 109 ----------------- runtime/vara/src/integration_tests.rs | 168 +------------------------- runtime/vara/src/lib.rs | 7 +- 10 files changed, 35 insertions(+), 317 deletions(-) delete mode 100644 runtime/vara/src/extensions/mod.rs diff --git a/Cargo.lock b/Cargo.lock index d02d3bb927e..2500a3e11f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3631,14 +3631,14 @@ dependencies = [ [[package]] name = "galloc" -version = "0.3.3" +version = "0.3.4" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "0.3.3" +version = "0.3.4" dependencies = [ "anyhow", "base64 0.21.3", @@ -3677,7 +3677,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.3.3" +version = "0.3.4" dependencies = [ "anyhow", "async-trait", @@ -3721,7 +3721,7 @@ dependencies = [ [[package]] name = "gcore" -version = "0.3.3" +version = "0.3.4" dependencies = [ "galloc", "gear-core-errors", @@ -3776,7 +3776,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.3.3" +version = "0.3.4" dependencies = [ "proc-macro2", "quote", @@ -3785,7 +3785,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.3.3" +version = "0.3.4" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3844,7 +3844,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "0.3.3" +version = "0.3.4" dependencies = [ "clap 4.4.2", "frame-benchmarking", @@ -3878,7 +3878,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.3.3" +version = "0.3.4" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3906,7 +3906,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.3.3" +version = "0.3.4" dependencies = [ "quote", "syn 2.0.31", @@ -3914,7 +3914,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.3.3" +version = "0.3.4" dependencies = [ "blake2-rfc", "byteorder", @@ -3936,7 +3936,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.3.3" +version = "0.3.4" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3945,7 +3945,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.3.3" +version = "0.3.4" dependencies = [ "actor-system-error", "derive_more", @@ -4003,7 +4003,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "0.3.3" +version = "0.3.4" dependencies = [ "anyhow", "arbitrary", @@ -4343,7 +4343,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "0.3.3" +version = "0.3.4" dependencies = [ "cc", ] @@ -4436,7 +4436,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.3.3" +version = "0.3.4" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4606,7 +4606,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "0.3.3" +version = "0.3.4" dependencies = [ "blake2-rfc", "derive_more", @@ -4620,7 +4620,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.3.3" +version = "0.3.4" dependencies = [ "gmeta", "gstd", @@ -4644,7 +4644,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.3.3" +version = "0.3.4" dependencies = [ "anyhow", "base64 0.21.3", @@ -4695,7 +4695,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.3.3" +version = "0.3.4" dependencies = [ "proc-macro2", "quote", @@ -4704,7 +4704,7 @@ dependencies = [ [[package]] name = "gstd" -version = "0.3.3" +version = "0.3.4" dependencies = [ "bs58", "futures", @@ -4733,7 +4733,7 @@ dependencies = [ [[package]] name = "gsys" -version = "0.3.3" +version = "0.3.4" [[package]] name = "gtest" diff --git a/Cargo.toml b/Cargo.toml index bf10962750d..6dbd8172a62 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.3.3" +version = "0.3.4" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index be17b5ca758..cfc17329d53 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -8798,11 +8798,6 @@ pub mod runtime_types { } pub mod vara_runtime { use super::runtime_types; - pub mod extensions { - use super::runtime_types; - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - pub struct DisableValueTransfers; - } pub mod governance { use super::runtime_types; pub mod origins { diff --git a/node/cli/src/benchmarking.rs b/node/cli/src/benchmarking.rs index 08673be672f..85da0e72834 100644 --- a/node/cli/src/benchmarking.rs +++ b/node/cli/src/benchmarking.rs @@ -108,7 +108,6 @@ macro_rules! with_signed_payload { $( $setup )* let $extra: runtime::SignedExtra = ( - runtime::DisableValueTransfers, pallet_gear_staking_rewards::StakingBlackList::::new(), frame_system::CheckNonZeroSender::::new(), frame_system::CheckSpecVersion::::new(), @@ -126,7 +125,6 @@ macro_rules! with_signed_payload { $call.clone(), $extra.clone(), ( - (), (), (), runtime::VERSION.spec_version, diff --git a/node/testing/src/keyring.rs b/node/testing/src/keyring.rs index 668945d8aaa..f0a74f264e9 100644 --- a/node/testing/src/keyring.rs +++ b/node/testing/src/keyring.rs @@ -28,8 +28,8 @@ use sp_keyring::{AccountKeyring, Ed25519Keyring, Sr25519Keyring}; use sp_runtime::generic::Era; #[cfg(feature = "vara-native")] use vara_runtime::{ - CustomChargeTransactionPayment, DisableValueTransfers, RuntimeCall, SessionKeys, SignedExtra, - StakingBlackList, UncheckedExtrinsic, + CustomChargeTransactionPayment, RuntimeCall, SessionKeys, SignedExtra, StakingBlackList, + UncheckedExtrinsic, }; pub type CheckedExtrinsic = @@ -94,7 +94,6 @@ pub fn to_session_keys( #[cfg(feature = "vara-native")] pub fn signed_extra(nonce: Index) -> SignedExtra { ( - DisableValueTransfers {}, StakingBlackList::new(), frame_system::CheckNonZeroSender::new(), frame_system::CheckSpecVersion::new(), diff --git a/pallets/gas/src/migrations.rs b/pallets/gas/src/migrations.rs index 809c218932e..8ade4e216c1 100644 --- a/pallets/gas/src/migrations.rs +++ b/pallets/gas/src/migrations.rs @@ -61,11 +61,15 @@ impl OnRuntimeUpgrade for MigrateToV3 { let previous: StorageVersion = Decode::decode(&mut state.as_ref()).map_err(|_| "Cannot decode version")?; - let onchain = Pallet::::on_chain_storage_version(); + if previous == 2 { + let onchain = Pallet::::on_chain_storage_version(); - assert_ne!(previous, onchain, "Must have upgraded from version 2 to 3"); + assert_ne!(previous, onchain, "Must have upgraded from version 2 to 3"); - log::info!("Storage `pallet-gear-gas` successfully migrated to V3"); + log::info!("Storage `pallet-gear-gas` successfully migrated to V3"); + } else { + log::info!("Storage `pallet-gear-gas` was already migrated to V3"); + } Ok(()) } diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 2cc7472aab4..d083d09d03e 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 330, + spec_version: 340, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/extensions/mod.rs b/runtime/vara/src/extensions/mod.rs deleted file mode 100644 index 27a3136e639..00000000000 --- a/runtime/vara/src/extensions/mod.rs +++ /dev/null @@ -1,109 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! A list of the different weight modules for our runtime. - -use crate::{AccountId, RuntimeCall}; -use frame_support::{ - codec::{Decode, Encode}, - traits::Contains, -}; -use scale_info::TypeInfo; -use sp_runtime::{ - traits::{DispatchInfoOf, SignedExtension, Zero}, - transaction_validity::{InvalidTransaction, TransactionValidity, TransactionValidityError}, -}; - -/// Disallow balances transfer -/// -/// RELEASE: This is only relevant for the initial PoA run-in period and will be removed -/// from the release runtime. - -struct ValueTransferCallFilter; -impl Contains for ValueTransferCallFilter { - fn contains(call: &RuntimeCall) -> bool { - match call { - RuntimeCall::Balances(_) => true, - RuntimeCall::Gear(pallet_gear::Call::create_program { value, .. }) - | RuntimeCall::Gear(pallet_gear::Call::upload_program { value, .. }) - | RuntimeCall::Gear(pallet_gear::Call::send_message { value, .. }) - | RuntimeCall::Gear(pallet_gear::Call::send_reply { value, .. }) => !value.is_zero(), - RuntimeCall::Utility(utility_call) => { - match utility_call { - pallet_utility::Call::batch { calls } - | pallet_utility::Call::batch_all { calls } - | pallet_utility::Call::force_batch { calls } => { - for c in calls { - if Self::contains(c) { - return true; - } - } - } - pallet_utility::Call::as_derivative { call, .. } - | pallet_utility::Call::dispatch_as { call, .. } - | pallet_utility::Call::with_weight { call, .. } => { - return Self::contains(call); - } - _ => (), - } - false - } - RuntimeCall::Proxy(pallet_proxy::Call::proxy { call, .. }) - | RuntimeCall::Proxy(pallet_proxy::Call::proxy_announced { call, .. }) => { - Self::contains(call) - } - _ => false, - } - } -} - -#[derive(Default, Encode, Debug, Decode, Clone, Eq, PartialEq, TypeInfo)] -pub struct DisableValueTransfers; - -impl SignedExtension for DisableValueTransfers { - const IDENTIFIER: &'static str = "DisableValueTransfers"; - type AccountId = AccountId; - type Call = RuntimeCall; - type AdditionalSigned = (); - type Pre = (); - fn additional_signed(&self) -> Result { - Ok(()) - } - fn validate( - &self, - _: &Self::AccountId, - call: &Self::Call, - _: &DispatchInfoOf, - _: usize, - ) -> TransactionValidity { - if ValueTransferCallFilter::contains(call) { - Err(TransactionValidityError::Invalid(InvalidTransaction::Call)) - } else { - Ok(Default::default()) - } - } - fn pre_dispatch( - self, - _: &Self::AccountId, - _: &Self::Call, - _: &DispatchInfoOf, - _: usize, - ) -> Result { - Ok(()) - } -} diff --git a/runtime/vara/src/integration_tests.rs b/runtime/vara/src/integration_tests.rs index 9b1aadbc07c..fbc17eef11f 100644 --- a/runtime/vara/src/integration_tests.rs +++ b/runtime/vara/src/integration_tests.rs @@ -27,8 +27,8 @@ use sp_consensus_babe::{ Slot, BABE_ENGINE_ID, }; use sp_core::{ed25519, sr25519, Pair}; -use sp_keyring::{AccountKeyring, Sr25519Keyring}; -use sp_runtime::{traits::SignedExtension, Digest, DigestItem, MultiAddress}; +use sp_keyring::AccountKeyring; +use sp_runtime::{Digest, DigestItem}; const ENDOWMENT: u128 = 100 * UNITS; const STASH: u128 = 10 * UNITS; @@ -244,170 +244,6 @@ pub(crate) fn get_last_program_id() -> [u8; 32] { } } -#[test] -fn signed_extension_works() { - use sp_runtime::transaction_validity::{InvalidTransaction, TransactionSource}; - - init_logger(); - - let alice = AccountKeyring::Alice; - let bob = AccountKeyring::Bob; - let charlie = AccountKeyring::Charlie; - ExtBuilder::default() - .initial_authorities(vec![ - ( - alice.into(), - alice.into(), - alice.public(), - ed25519::Pair::from_string("//Alice", None) - .unwrap() - .public(), - alice.public(), - alice.public(), - ), - ( - bob.into(), - bob.into(), - bob.public(), - ed25519::Pair::from_string("//Bob", None).unwrap().public(), - bob.public(), - bob.public(), - ), - ]) - .stash(STASH) - .endowment(ENDOWMENT) - .endowed_accounts(vec![charlie.into()]) - .vested_accounts(vec![(charlie.into(), 100, 500, 10 * UNITS)]) - .build() - .execute_with(|| { - let construct_extrinsic = - |function: RuntimeCall, caller: Sr25519Keyring| -> UncheckedExtrinsic { - let extra: SignedExtra = ( - DisableValueTransfers {}, - StakingBlackList::::new(), - frame_system::CheckNonZeroSender::::new(), - frame_system::CheckSpecVersion::::new(), - frame_system::CheckTxVersion::::new(), - frame_system::CheckGenesis::::new(), - frame_system::CheckEra::::from(generic::Era::mortal(256, 0)), - frame_system::CheckNonce::::from(0), - frame_system::CheckWeight::::new(), - CustomChargeTransactionPayment::::from(0), - ); - UncheckedExtrinsic::new_signed( - function.clone(), - MultiAddress::Id(caller.public().into()), - Signature::Sr25519( - SignedPayload::from_raw( - function, - extra.clone(), - extra.additional_signed().unwrap(), - ) - .using_encoded(|e| caller.sign(e)), - ), - extra, - ) - }; - - // Balance transfer should be blocked by the signed extension - let invalid_call = construct_extrinsic( - RuntimeCall::Balances(pallet_balances::Call::transfer { - dest: MultiAddress::Id(bob.into()), - value: 10 * UNITS, - }), - alice, - ); - - // Wrapping `bond` call in a batch is also illegal - let invalid_batch = construct_extrinsic( - RuntimeCall::Utility(pallet_utility::Call::batch { - calls: vec![RuntimeCall::Balances(pallet_balances::Call::transfer { - dest: MultiAddress::Id(bob.into()), - value: 10 * UNITS, - })], - }), - alice, - ); - - let invalid_batch_all = construct_extrinsic( - RuntimeCall::Utility(pallet_utility::Call::batch_all { - calls: vec![RuntimeCall::Balances(pallet_balances::Call::transfer { - dest: MultiAddress::Id(bob.into()), - value: 10 * UNITS, - })], - }), - alice, - ); - - // Nested batches and/or other `Utility` calls shouldn't work, as well - let nested_batches = construct_extrinsic( - RuntimeCall::Utility(pallet_utility::Call::batch { - calls: vec![RuntimeCall::Utility(pallet_utility::Call::batch_all { - calls: vec![RuntimeCall::Utility(pallet_utility::Call::as_derivative { - index: 0, - call: Box::new(RuntimeCall::Balances( - pallet_balances::Call::transfer { - dest: MultiAddress::Id(bob.into()), - value: 10 * UNITS, - }, - )), - })], - })], - }), - alice, - ); - - let valid_call = - construct_extrinsic(RuntimeCall::Vesting(pallet_vesting::Call::vest {}), charlie); - - assert_eq!( - Executive::validate_transaction( - TransactionSource::External, - invalid_call, - Default::default(), - ) - .unwrap_err(), - InvalidTransaction::Call.into() - ); - - assert_eq!( - Executive::validate_transaction( - TransactionSource::External, - invalid_batch, - Default::default(), - ) - .unwrap_err(), - InvalidTransaction::Call.into() - ); - - assert_eq!( - Executive::validate_transaction( - TransactionSource::External, - invalid_batch_all, - Default::default(), - ) - .unwrap_err(), - InvalidTransaction::Call.into() - ); - - assert_eq!( - Executive::validate_transaction( - TransactionSource::External, - nested_batches, - Default::default(), - ) - .unwrap_err(), - InvalidTransaction::Call.into() - ); - - assert_ok!(Executive::validate_transaction( - TransactionSource::External, - valid_call, - Default::default(), - )); - }); -} - #[test] fn tokens_locking_works() { init_logger(); diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 305b3f35228..fdaba1e9065 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -122,9 +122,6 @@ mod bag_thresholds; pub mod governance; use governance::{pallet_custom_origins, GeneralAdmin, Treasurer, TreasurySpender}; -mod extensions; -pub use extensions::DisableValueTransfers; - mod migrations; // By this we inject compile time version including commit hash @@ -145,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 330, + spec_version: 340, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, @@ -1248,8 +1245,6 @@ pub type Header = generic::Header; pub type Block = generic::Block; /// The SignedExtension to the basic transaction logic. pub type SignedExtra = ( - // RELEASE: remove before final release - DisableValueTransfers, // Keep as long as it's needed StakingBlackList, frame_system::CheckNonZeroSender, From 166afacc2bde04d9d3f79a32b0b94bf913d7974b Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Tue, 12 Sep 2023 18:50:18 +0400 Subject: [PATCH 137/165] test(runtime): Technical release 0.3.5 (#3255) --- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index d083d09d03e..0c202c87f96 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 340, + spec_version: 350, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index fdaba1e9065..ef160ec8e5e 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 340, + spec_version: 350, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 4e263f0d0717f512224f1c456a3f6805d95ad573 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Tue, 12 Sep 2023 20:53:09 +0400 Subject: [PATCH 138/165] test(runtime): Technical release 0.3.6 (#3257) --- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 0c202c87f96..16168baefca 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 350, + spec_version: 360, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index ef160ec8e5e..f175c6d9125 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 350, + spec_version: 360, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 44d16ffd2275cfe2052ca23e77ebaf172841230f Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 16:49:28 +0400 Subject: [PATCH 139/165] chore(v1.0.0): Versions (#3263) --- Cargo.lock | 76 ++++++++++++------------- Cargo.toml | 16 +++--- lazy-pages/Cargo.toml | 8 +-- node/authorship/Cargo.toml | 7 +-- node/cli/Cargo.toml | 3 + node/service/Cargo.toml | 7 +-- node/testing/Cargo.toml | 7 +-- pallets/gas/Cargo.toml | 12 ++-- pallets/gear-bank/Cargo.toml | 4 +- pallets/gear-debug/Cargo.toml | 11 ++-- pallets/gear-messenger/Cargo.toml | 12 ++-- pallets/gear-program/Cargo.toml | 12 ++-- pallets/gear-scheduler/Cargo.toml | 12 ++-- pallets/gear-voucher/Cargo.toml | 12 ++-- pallets/gear/Cargo.toml | 14 ++--- pallets/gear/proc-macro/Cargo.toml | 12 ++-- pallets/gear/rpc/Cargo.toml | 6 +- pallets/gear/rpc/runtime-api/Cargo.toml | 10 ++-- pallets/payment/Cargo.toml | 11 ++-- pallets/staking-rewards/Cargo.toml | 12 ++-- runtime-interface/Cargo.toml | 8 +-- runtime/common/Cargo.toml | 6 +- runtime/gear/Cargo.toml | 8 +-- runtime/gear/src/lib.rs | 2 +- runtime/primitives/Cargo.toml | 8 +-- runtime/vara/Cargo.toml | 8 +-- runtime/vara/src/lib.rs | 2 +- 27 files changed, 153 insertions(+), 153 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2500a3e11f1..32ac68ad265 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3631,14 +3631,14 @@ dependencies = [ [[package]] name = "galloc" -version = "0.3.4" +version = "1.0.0" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "0.3.4" +version = "1.0.0" dependencies = [ "anyhow", "base64 0.21.3", @@ -3677,7 +3677,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.3.4" +version = "1.0.0" dependencies = [ "anyhow", "async-trait", @@ -3721,7 +3721,7 @@ dependencies = [ [[package]] name = "gcore" -version = "0.3.4" +version = "1.0.0" dependencies = [ "galloc", "gear-core-errors", @@ -3734,7 +3734,7 @@ dependencies = [ [[package]] name = "gear-authorship" -version = "0.1.0" +version = "1.0.0" dependencies = [ "demo-mul-by-const", "env_logger", @@ -3776,7 +3776,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.3.4" +version = "1.0.0" dependencies = [ "proc-macro2", "quote", @@ -3785,7 +3785,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.3.4" +version = "1.0.0" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3844,7 +3844,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "0.3.4" +version = "1.0.0" dependencies = [ "clap 4.4.2", "frame-benchmarking", @@ -3878,7 +3878,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.3.4" +version = "1.0.0" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3906,7 +3906,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.3.4" +version = "1.0.0" dependencies = [ "quote", "syn 2.0.31", @@ -3914,7 +3914,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.3.4" +version = "1.0.0" dependencies = [ "blake2-rfc", "byteorder", @@ -3936,7 +3936,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.3.4" +version = "1.0.0" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3945,7 +3945,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.3.4" +version = "1.0.0" dependencies = [ "actor-system-error", "derive_more", @@ -3963,7 +3963,7 @@ dependencies = [ [[package]] name = "gear-lazy-pages" -version = "0.1.0" +version = "1.0.0" dependencies = [ "cfg-if", "derive_more", @@ -4003,7 +4003,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "0.3.4" +version = "1.0.0" dependencies = [ "anyhow", "arbitrary", @@ -4035,7 +4035,7 @@ dependencies = [ [[package]] name = "gear-node-testing" -version = "0.1.0" +version = "1.0.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -4103,7 +4103,7 @@ dependencies = [ [[package]] name = "gear-runtime" -version = "0.1.0" +version = "1.0.0" dependencies = [ "const-str", "frame-benchmarking", @@ -4163,7 +4163,7 @@ dependencies = [ [[package]] name = "gear-runtime-common" -version = "0.1.0" +version = "1.0.0" dependencies = [ "frame-benchmarking", "frame-support", @@ -4189,7 +4189,7 @@ dependencies = [ [[package]] name = "gear-runtime-interface" -version = "0.1.0" +version = "1.0.0" dependencies = [ "byteorder", "derive_more", @@ -4211,7 +4211,7 @@ dependencies = [ [[package]] name = "gear-runtime-primitives" -version = "0.1.0" +version = "1.0.0" dependencies = [ "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", @@ -4264,7 +4264,7 @@ dependencies = [ [[package]] name = "gear-service" -version = "0.1.0" +version = "1.0.0" dependencies = [ "frame-benchmarking", "frame-benchmarking-cli", @@ -4343,7 +4343,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "0.3.4" +version = "1.0.0" dependencies = [ "cc", ] @@ -4436,7 +4436,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.3.4" +version = "1.0.0" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4606,7 +4606,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "0.3.4" +version = "1.0.0" dependencies = [ "blake2-rfc", "derive_more", @@ -4620,7 +4620,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.3.4" +version = "1.0.0" dependencies = [ "gmeta", "gstd", @@ -4644,7 +4644,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.3.4" +version = "1.0.0" dependencies = [ "anyhow", "base64 0.21.3", @@ -4695,7 +4695,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.3.4" +version = "1.0.0" dependencies = [ "proc-macro2", "quote", @@ -4704,7 +4704,7 @@ dependencies = [ [[package]] name = "gstd" -version = "0.3.4" +version = "1.0.0" dependencies = [ "bs58", "futures", @@ -4733,7 +4733,7 @@ dependencies = [ [[package]] name = "gsys" -version = "0.3.4" +version = "1.0.0" [[package]] name = "gtest" @@ -7330,7 +7330,7 @@ dependencies = [ [[package]] name = "pallet-gear" -version = "2.0.0" +version = "1.0.0" dependencies = [ "blake2-rfc", "demo-async", @@ -7446,7 +7446,7 @@ dependencies = [ [[package]] name = "pallet-gear-debug" -version = "2.0.0" +version = "1.0.0" dependencies = [ "demo-vec", "env_logger", @@ -7483,7 +7483,7 @@ dependencies = [ [[package]] name = "pallet-gear-gas" -version = "2.0.0" +version = "1.0.0" dependencies = [ "env_logger", "frame-benchmarking", @@ -7536,7 +7536,7 @@ dependencies = [ [[package]] name = "pallet-gear-payment" -version = "0.1.0" +version = "1.0.0" dependencies = [ "env_logger", "frame-benchmarking", @@ -7570,7 +7570,7 @@ dependencies = [ [[package]] name = "pallet-gear-proc-macro" -version = "2.0.0" +version = "1.0.0" dependencies = [ "proc-macro2", "quote", @@ -7579,7 +7579,7 @@ dependencies = [ [[package]] name = "pallet-gear-program" -version = "2.0.0" +version = "1.0.0" dependencies = [ "frame-support", "frame-system", @@ -7604,7 +7604,7 @@ dependencies = [ [[package]] name = "pallet-gear-rpc" -version = "2.0.0" +version = "1.0.0" dependencies = [ "gear-common", "gear-core", @@ -7620,7 +7620,7 @@ dependencies = [ [[package]] name = "pallet-gear-rpc-runtime-api" -version = "2.0.0" +version = "1.0.0" dependencies = [ "pallet-gear", "sp-api", @@ -13492,7 +13492,7 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vara-runtime" -version = "0.1.0" +version = "1.0.0" dependencies = [ "const-str", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 6dbd8172a62..f3d587003ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [workspace.package] -version = "0.3.4" +version = "1.0.0" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" -homepage = "https://www.gear-tech.io" +homepage = "https://gear-tech.io" repository = "https://github.com/gear-tech/gear" [workspace] @@ -226,16 +226,16 @@ pallet-gear = { path = "pallets/gear", default-features = false } pallet-gear-debug = { path = "pallets/gear-debug", default-features = false } pallet-gear-gas = { path = "pallets/gas", default-features = false } pallet-gear-messenger = { path = "pallets/gear-messenger", default-features = false } -pallet-gear-payment = { version = "0.1.0", path = "pallets/payment", default-features = false } +pallet-gear-payment = { path = "pallets/payment", default-features = false } pallet-gear-program = { path = "pallets/gear-program", default-features = false } pallet-gear-rpc = { path = "pallets/gear/rpc" } -pallet-gear-rpc-runtime-api = { version = "2.0.0", path = "pallets/gear/rpc/runtime-api", default-features = false } +pallet-gear-rpc-runtime-api = { path = "pallets/gear/rpc/runtime-api", default-features = false } pallet-gear-scheduler = { path = "pallets/gear-scheduler", default-features = false } -pallet-gear-staking-rewards = { version = "1.0.0", path = "pallets/staking-rewards", default-features = false } -pallet-gear-voucher = { version = "1.0.0", path = "pallets/gear-voucher", default-features = false } -pallet-gear-bank = { version = "1.0.0", path = "pallets/gear-bank", default-features = false } +pallet-gear-staking-rewards = { path = "pallets/staking-rewards", default-features = false } +pallet-gear-voucher = { path = "pallets/gear-voucher", default-features = false } +pallet-gear-bank = { path = "pallets/gear-bank", default-features = false } runtime-common = { package = "gear-runtime-common", path = "runtime/common", default-features = false } -runtime-primitives = { package = "gear-runtime-primitives", path = "runtime/primitives", version = "0.1.0", default-features = false } +runtime-primitives = { package = "gear-runtime-primitives", path = "runtime/primitives", default-features = false } service = { package = "gear-service", path = "node/service", default-features = false } testing = { package = "gear-node-testing", path = "node/testing" } vara-runtime = { path = "runtime/vara" } diff --git a/lazy-pages/Cargo.toml b/lazy-pages/Cargo.toml index a088e0b9a48..56510ab1ed5 100644 --- a/lazy-pages/Cargo.toml +++ b/lazy-pages/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gear-lazy-pages" -version = "0.1.0" -authors.workspace = true description = "Gear lazy-pages support" +version.workspace = true +authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [dependencies] log = { workspace = true, features = ["std"] } diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index a445c9d5f08..9c9633d0ce9 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "gear-authorship" -version = "0.1.0" +version.workspace = true authors.workspace = true -description = "Gear Node" edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index 21fe8615206..022e3f13c0c 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -3,6 +3,9 @@ name = "gear-cli" version.workspace = true authors.workspace = true edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index a51975375cb..8a7149183bc 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "gear-service" -version = "0.1.0" +version.workspace = true authors.workspace = true -description = "Gear Node" edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/node/testing/Cargo.toml b/node/testing/Cargo.toml index c3d823d90e9..807793fdf89 100644 --- a/node/testing/Cargo.toml +++ b/node/testing/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "gear-node-testing" -version = "0.1.0" +version.workspace = true authors.workspace = true -description = "Gear Node" edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/pallets/gas/Cargo.toml b/pallets/gas/Cargo.toml index 765924dc01c..2d78fad78e2 100644 --- a/pallets/gas/Cargo.toml +++ b/pallets/gas/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-gas" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear gas pallet" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-bank/Cargo.toml b/pallets/gear-bank/Cargo.toml index 0872ba22114..7075b18ace2 100644 --- a/pallets/gear-bank/Cargo.toml +++ b/pallets/gear-bank/Cargo.toml @@ -1,9 +1,11 @@ [package] name = "pallet-gear-bank" -version = "1.0.0" +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] parity-scale-codec = { workspace = true, features = ["derive"] } diff --git a/pallets/gear-debug/Cargo.toml b/pallets/gear-debug/Cargo.toml index b50cc788401..f4d0e4c3294 100644 --- a/pallets/gear-debug/Cargo.toml +++ b/pallets/gear-debug/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "pallet-gear-debug" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' +version.workspace = true +authors.workspace = true +edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" -description = "Gear main pallet" +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-messenger/Cargo.toml b/pallets/gear-messenger/Cargo.toml index ba69981ea20..8037b76a09f 100644 --- a/pallets/gear-messenger/Cargo.toml +++ b/pallets/gear-messenger/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-messenger" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear pallet to work with messages" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-program/Cargo.toml b/pallets/gear-program/Cargo.toml index e66e32b9fa3..0dd3e2653b9 100644 --- a/pallets/gear-program/Cargo.toml +++ b/pallets/gear-program/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-program" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear pallet to work with programs" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-scheduler/Cargo.toml b/pallets/gear-scheduler/Cargo.toml index 58b1be5353f..b8d9a29ccb6 100644 --- a/pallets/gear-scheduler/Cargo.toml +++ b/pallets/gear-scheduler/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-scheduler" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear pallet to work with delayed tasks" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear-voucher/Cargo.toml b/pallets/gear-voucher/Cargo.toml index 7243aba712f..95a87591564 100644 --- a/pallets/gear-voucher/Cargo.toml +++ b/pallets/gear-voucher/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-voucher" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear pallet implementing payment-voucher like functionality" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index efcf988b0a5..8dc26661bee 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear main pallet" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] @@ -32,7 +32,7 @@ gear-core.workspace = true gear-core-errors.workspace = true gear-backend-common.workspace = true gear-backend-sandbox.workspace = true -pallet-gear-proc-macro = { version = "2.0.0", path = "proc-macro" } +pallet-gear-proc-macro = { path = "proc-macro" } gsys = { workspace = true, optional = true } pallet-gear-voucher.workspace = true pallet-gear-bank.workspace = true diff --git a/pallets/gear/proc-macro/Cargo.toml b/pallets/gear/proc-macro/Cargo.toml index b325315e902..8100f907371 100644 --- a/pallets/gear/proc-macro/Cargo.toml +++ b/pallets/gear/proc-macro/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-proc-macro" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Procedural macros used in pallet_gear" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/pallets/gear/rpc/Cargo.toml b/pallets/gear/rpc/Cargo.toml index 47e51e985f9..366c3bb3a48 100644 --- a/pallets/gear/rpc/Cargo.toml +++ b/pallets/gear/rpc/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "pallet-gear-rpc" -version = "2.0.0" +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [dependencies] jsonrpsee = { workspace = true, features = ["server", "macros"] } diff --git a/pallets/gear/rpc/runtime-api/Cargo.toml b/pallets/gear/rpc/runtime-api/Cargo.toml index b4f28c1c773..252dc9e5d8e 100644 --- a/pallets/gear/rpc/runtime-api/Cargo.toml +++ b/pallets/gear/rpc/runtime-api/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "pallet-gear-rpc-runtime-api" -version = "2.0.0" -authors = ['Gear Technologies'] -edition = '2021' +version.workspace = true +authors.workspace = true +edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [dependencies] sp-api.workspace = true diff --git a/pallets/payment/Cargo.toml b/pallets/payment/Cargo.toml index bb6f5903037..93c809367f0 100644 --- a/pallets/payment/Cargo.toml +++ b/pallets/payment/Cargo.toml @@ -1,12 +1,11 @@ [package] name = "pallet-gear-payment" -version = "0.1.0" -authors = ['Gear Technologies'] -edition = '2021' +version.workspace = true +authors.workspace = true +edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" -description = "Gear main pallet" +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/pallets/staking-rewards/Cargo.toml b/pallets/staking-rewards/Cargo.toml index db9f816b402..567659a9853 100644 --- a/pallets/staking-rewards/Cargo.toml +++ b/pallets/staking-rewards/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "pallet-gear-staking-rewards" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" description = "Gear tokenomics implementation" +version.workspace = true +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true readme = "README.md" [package.metadata.docs.rs] diff --git a/runtime-interface/Cargo.toml b/runtime-interface/Cargo.toml index 15b023165b2..f2dd78dbb68 100644 --- a/runtime-interface/Cargo.toml +++ b/runtime-interface/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gear-runtime-interface" -version = "0.1.0" -authors.workspace = true description = "Gear Runtime Interface" +version.workspace = true +authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [dependencies] gear-core.workspace = true diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index ab712a38152..b673f851b3d 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -1,11 +1,11 @@ [package] name = "gear-runtime-common" -version = "0.1.0" +version.workspace = true authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/gear/Cargo.toml b/runtime/gear/Cargo.toml index 00cf7a60141..005773f2bed 100644 --- a/runtime/gear/Cargo.toml +++ b/runtime/gear/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gear-runtime" -version = "0.1.0" +version.workspace = true authors.workspace = true edition.workspace = true -build = "build.rs" license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true +build = "build.rs" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 16168baefca..e7ed11281e6 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 360, + spec_version: 1000, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/primitives/Cargo.toml b/runtime/primitives/Cargo.toml index 420c73e1de6..a4589cb002f 100644 --- a/runtime/primitives/Cargo.toml +++ b/runtime/primitives/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "gear-runtime-primitives" -version = "0.1.0" -authors.workspace = true description = "Gear Runtime primitives" +version.workspace = true +authors.workspace = true edition.workspace = true license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index 99fa7782b58..fa91b85ef26 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "vara-runtime" -version = "0.1.0" +version.workspace = true authors.workspace = true edition.workspace = true -build = "build.rs" license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" +homepage.workspace = true +repository.workspace = true +build = "build.rs" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index f175c6d9125..cf6de126ae5 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 360, + spec_version: 1000, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From b9641da7d532727296ef0819b8053d8eceff0555 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 19:20:49 +0400 Subject: [PATCH 140/165] chore(v1.0.0): Clean up and constants fix (#3265) --- node/service/src/chain_spec/vara.rs | 6 +- node/testing/src/genesis.rs | 44 ++-- pallets/gas/src/lib.rs | 2 - pallets/gas/src/migrations.rs | 243 ---------------------- pallets/staking-rewards/src/mock.rs | 7 +- runtime/gear/src/constants.rs | 2 + runtime/gear/src/migrations.rs | 2 +- runtime/vara/src/constants.rs | 16 +- runtime/vara/src/governance/fellowship.rs | 22 +- runtime/vara/src/governance/mod.rs | 2 +- runtime/vara/src/governance/tracks.rs | 26 +-- runtime/vara/src/lib.rs | 34 +-- runtime/vara/src/migrations.rs | 2 +- 13 files changed, 86 insertions(+), 322 deletions(-) delete mode 100644 pallets/gas/src/migrations.rs diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index b6522ae114a..3122e7326d8 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -28,7 +28,7 @@ use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; use sp_runtime::{Perbill, Perquintill}; use vara_runtime::{ - constants::currency::{DOLLARS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, + constants::currency::{ECONOMIC_UNITS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, ImOnlineConfig, NominationPoolsConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, StakingRewardsConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY, @@ -617,8 +617,8 @@ fn testnet_genesis( transaction_payment: Default::default(), treasury: Default::default(), nomination_pools: NominationPoolsConfig { - min_create_bond: 10 * DOLLARS, - min_join_bond: DOLLARS, + min_create_bond: 10 * ECONOMIC_UNITS, + min_join_bond: ECONOMIC_UNITS, ..Default::default() }, vesting: VestingConfig { vesting: vec![] }, diff --git a/node/testing/src/genesis.rs b/node/testing/src/genesis.rs index f5a63aa4629..019e3f93948 100644 --- a/node/testing/src/genesis.rs +++ b/node/testing/src/genesis.rs @@ -49,18 +49,18 @@ pub fn genesis_config(code: Option<&[u8]>) -> GenesisConfig { #[cfg(feature = "vara-native")] pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> GenesisConfig { let mut endowed = vec![ - (alice(), 111 * DOLLARS), - (bob(), 100 * DOLLARS), - (charlie(), 100_000_000 * DOLLARS), - (dave(), 111 * DOLLARS), - (eve(), 101 * DOLLARS), - (ferdie(), 100 * DOLLARS), + (alice(), 111 * ECONOMIC_UNITS), + (bob(), 100 * ECONOMIC_UNITS), + (charlie(), 100_000_000 * ECONOMIC_UNITS), + (dave(), 111 * ECONOMIC_UNITS), + (eve(), 101 * ECONOMIC_UNITS), + (ferdie(), 100 * ECONOMIC_UNITS), ]; endowed.extend( extra_endowed .into_iter() - .map(|endowed| (endowed, 100 * DOLLARS)), + .map(|endowed| (endowed, 100 * ECONOMIC_UNITS)), ); GenesisConfig { @@ -98,9 +98,19 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> Gen }, staking: StakingConfig { stakers: vec![ - (dave(), alice(), 111 * DOLLARS, StakerStatus::Validator), - (eve(), bob(), 100 * DOLLARS, StakerStatus::Validator), - (ferdie(), charlie(), 100 * DOLLARS, StakerStatus::Validator), + ( + dave(), + alice(), + 111 * ECONOMIC_UNITS, + StakerStatus::Validator, + ), + (eve(), bob(), 100 * ECONOMIC_UNITS, StakerStatus::Validator), + ( + ferdie(), + charlie(), + 100 * ECONOMIC_UNITS, + StakerStatus::Validator, + ), ], validator_count: 3, minimum_validator_count: 3, @@ -128,18 +138,18 @@ pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> Gen #[cfg(all(not(feature = "vara-native"), feature = "gear-native"))] pub fn config_endowed(code: Option<&[u8]>, extra_endowed: Vec) -> GenesisConfig { let mut endowed = vec![ - (alice(), 111 * DOLLARS), - (bob(), 100 * DOLLARS), - (charlie(), 100_000_000 * DOLLARS), - (dave(), 111 * DOLLARS), - (eve(), 101 * DOLLARS), - (ferdie(), 100 * DOLLARS), + (alice(), 111 * ECONOMIC_UNITS), + (bob(), 100 * ECONOMIC_UNITS), + (charlie(), 100_000_000 * ECONOMIC_UNITS), + (dave(), 111 * ECONOMIC_UNITS), + (eve(), 101 * ECONOMIC_UNITS), + (ferdie(), 100 * ECONOMIC_UNITS), ]; endowed.extend( extra_endowed .into_iter() - .map(|endowed| (endowed, 100 * DOLLARS)), + .map(|endowed| (endowed, 100 * ECONOMIC_UNITS)), ); GenesisConfig { diff --git a/pallets/gas/src/lib.rs b/pallets/gas/src/lib.rs index 24d49b20d33..db681e5ca60 100644 --- a/pallets/gas/src/lib.rs +++ b/pallets/gas/src/lib.rs @@ -139,8 +139,6 @@ mod mock; #[cfg(test)] mod tests; -pub mod migrations; - type BlockGasLimitOf = ::BlockGasLimit; type AccountIdOf = ::AccountId; diff --git a/pallets/gas/src/migrations.rs b/pallets/gas/src/migrations.rs deleted file mode 100644 index 8ade4e216c1..00000000000 --- a/pallets/gas/src/migrations.rs +++ /dev/null @@ -1,243 +0,0 @@ -use crate::{Config, Error, Key, NodeOf, Pallet, Weight}; -use common::GasMultiplier; -use core::marker::PhantomData; -use frame_support::{ - dispatch::GetStorageVersion, - traits::{Get, OnRuntimeUpgrade}, -}; -#[cfg(feature = "try-runtime")] -use sp_std::vec::Vec; - -const MULTIPLIER: GasMultiplier = GasMultiplier::ValuePerGas(1_000); - -pub struct MigrateToV3(PhantomData); - -impl OnRuntimeUpgrade for MigrateToV3 { - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - use parity_scale_codec::Encode as _; - - let version = >::on_chain_storage_version(); - - Ok(version.encode()) - } - - fn on_runtime_upgrade() -> Weight { - let onchain = Pallet::::on_chain_storage_version(); - let current = Pallet::::current_storage_version(); - - if current != 3 || onchain != 2 { - log::info!("❌ Migrations of `pallet-gear-gas` to V3 are outdated"); - - return T::DbWeight::get().reads(1); - } - - log::info!("🚚 Running migrations to version {current:?} from version {onchain:?}"); - - let mut writes = 0u64; - - crate::GasNodes::::translate::, _>(|key, value| { - writes += 1; - translate::(key, value) - .map_err(|e| { - log::error!("Error translating {key:?} node: {e:?})"); - e - }) - .ok() - }); - - log::info!("Upgraded {writes:?} gas nodes"); - - current.put::>(); - - T::DbWeight::get().reads_writes(1, writes + 1) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(state: Vec) -> Result<(), &'static str> { - use frame_support::traits::StorageVersion; - use parity_scale_codec::Decode; - - let previous: StorageVersion = - Decode::decode(&mut state.as_ref()).map_err(|_| "Cannot decode version")?; - - if previous == 2 { - let onchain = Pallet::::on_chain_storage_version(); - - assert_ne!(previous, onchain, "Must have upgraded from version 2 to 3"); - - log::info!("Storage `pallet-gear-gas` successfully migrated to V3"); - } else { - log::info!("Storage `pallet-gear-gas` was already migrated to V3"); - } - - Ok(()) - } -} - -fn translate(node_key: Key, node: v2::GasNode) -> Result, Error> { - log::info!("Translating {node_key:?} node"); - - let new_node = match node { - v2::GasNode::::Cut { id, value, lock } => NodeOf::::Cut { - id, - multiplier: MULTIPLIER, - value, - lock, - }, - v2::GasNode::::External { - id, - value, - lock, - system_reserve, - refs, - consumed, - deposit, - } => NodeOf::::External { - id, - multiplier: MULTIPLIER, - value, - lock, - system_reserve, - refs, - consumed, - deposit, - }, - v2::GasNode::::Reserved { - id, - value, - lock, - refs, - consumed, - } => NodeOf::::Reserved { - id, - multiplier: MULTIPLIER, - value, - lock, - refs, - consumed, - }, - v2::GasNode::::SpecifiedLocal { - parent, - value, - lock, - system_reserve, - refs, - consumed, - } => NodeOf::::SpecifiedLocal { - parent, - root: v2::root(node_key, node)?, - value, - lock, - system_reserve, - refs, - consumed, - }, - v2::GasNode::::UnspecifiedLocal { - parent, - lock, - system_reserve, - } => NodeOf::::UnspecifiedLocal { - parent, - root: v2::root(node_key, node)?, - lock, - system_reserve, - }, - }; - - Ok(new_node) -} - -mod v2 { - use crate::{AccountIdOf, Balance, Config, Error, Key, Pallet}; - use common::gas_provider::{ChildrenRefs, GasNodeId, NodeLock}; - use core::marker::PhantomData; - use frame_support::{ - storage::types::StorageMap, - traits::{PalletInfo, StorageInstance}, - Identity, - }; - use gear_core::ids::{MessageId, ReservationId}; - use parity_scale_codec::{Decode, Encode}; - - pub type GasNode = GasNodeImpl, GasNodeId, Balance>; - - pub struct GasNodesPrefix(PhantomData); - - impl StorageInstance for GasNodesPrefix { - const STORAGE_PREFIX: &'static str = "GasNodes"; - - fn pallet_prefix() -> &'static str { - <::PalletInfo as PalletInfo>::name::>() - .expect("No name found for the pallet in the runtime!") - } - } - - pub type GasNodes = StorageMap, Identity, Key, GasNode>; - - #[derive(Encode, Decode, Debug)] - pub enum GasNodeImpl { - External { - id: ExternalId, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - deposit: bool, - }, - - Cut { - id: ExternalId, - value: Balance, - lock: NodeLock, - }, - - Reserved { - id: ExternalId, - value: Balance, - lock: NodeLock, - refs: ChildrenRefs, - consumed: bool, - }, - - SpecifiedLocal { - parent: Id, - value: Balance, - lock: NodeLock, - system_reserve: Balance, - refs: ChildrenRefs, - consumed: bool, - }, - - UnspecifiedLocal { - parent: Id, - lock: NodeLock, - system_reserve: Balance, - }, - } - - impl GasNodeImpl { - pub fn parent(&self) -> Option { - match self { - Self::External { .. } | Self::Cut { .. } | Self::Reserved { .. } => None, - Self::SpecifiedLocal { parent, .. } | Self::UnspecifiedLocal { parent, .. } => { - Some(*parent) - } - } - } - } - - pub fn root(mut node_key: Key, mut node: GasNode) -> Result> { - log::trace!("Looking for root of {node_key:?} ({node:?}"); - - while let Some(parent) = node.parent() { - node_key = parent; - node = GasNodes::::get(node_key).ok_or(Error::::ParentIsLost)?; - } - - log::trace!("Root found: {node_key:?}"); - - Ok(node_key) - } -} diff --git a/pallets/staking-rewards/src/mock.rs b/pallets/staking-rewards/src/mock.rs index d491261680b..e5037ced27b 100644 --- a/pallets/staking-rewards/src/mock.rs +++ b/pallets/staking-rewards/src/mock.rs @@ -67,14 +67,11 @@ pub(crate) const NOM_1_CONTROLLER: AccountId = 41; pub(crate) const ROOT: AccountId = 101; pub(crate) const INITIAL_TOTAL_TOKEN_SUPPLY: u128 = 1_000_000 * UNITS; -pub(crate) const EXISTENTIAL_DEPOSIT: u128 = 10 * MILLICENTS; // 10 +pub(crate) const EXISTENTIAL_DEPOSIT: u128 = 10 * UNITS / 100_000; // 10 pub(crate) const VALIDATOR_STAKE: u128 = 100 * UNITS; // 10 pub(crate) const ENDOWMENT: u128 = 100 * UNITS; pub(crate) const UNITS: u128 = 100_000; // 10^(-5) precision -pub(crate) const DOLLARS: u128 = UNITS; // 1 to 1 -pub(crate) const CENTS: u128 = DOLLARS / 100; // 1_000 -pub(crate) const MILLICENTS: u128 = CENTS / 1_000; // 1 pub(crate) const MILLISECONDS_PER_YEAR: u64 = 1_000 * 3_600 * 24 * 36_525 / 100; pub(crate) const MILLISECS_PER_BLOCK: u64 = 2_400; pub(crate) const SESSION_DURATION: u64 = 1000; @@ -394,7 +391,7 @@ impl pallet_bags_list::Config for Test { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: u128 = DOLLARS; + pub const ProposalBondMinimum: u128 = UNITS; pub const SpendPeriod: u32 = 100; pub const Burn: Permill = Permill::from_percent(50); pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); diff --git a/runtime/gear/src/constants.rs b/runtime/gear/src/constants.rs index 35c4873d511..0b4e927003b 100644 --- a/runtime/gear/src/constants.rs +++ b/runtime/gear/src/constants.rs @@ -20,6 +20,8 @@ pub mod currency { use runtime_primitives::Balance; + pub const UNITS: Balance = 1_000_000_000_000; // 10^(-12) precision + /// The existential deposit. pub const EXISTENTIAL_DEPOSIT: Balance = 500; diff --git a/runtime/gear/src/migrations.rs b/runtime/gear/src/migrations.rs index 8749826d911..248916f1fad 100644 --- a/runtime/gear/src/migrations.rs +++ b/runtime/gear/src/migrations.rs @@ -19,4 +19,4 @@ #[allow(unused)] use crate::*; -pub type Migrations = (pallet_gear_gas::migrations::MigrateToV3,); +pub type Migrations = (); diff --git a/runtime/vara/src/constants.rs b/runtime/vara/src/constants.rs index 75f273a42ee..b80d724a3ec 100644 --- a/runtime/vara/src/constants.rs +++ b/runtime/vara/src/constants.rs @@ -20,22 +20,22 @@ pub mod currency { use runtime_primitives::Balance; + pub const UNITS: Balance = 1_000_000_000_000; // 10^(-12) precision + + /// Base economic unit, 50 Vara. + pub const ECONOMIC_UNITS: Balance = UNITS * 50; + pub const ECONOMIC_CENTIUNITS: Balance = ECONOMIC_UNITS / 100; + /// The existential deposit. - pub const EXISTENTIAL_DEPOSIT: Balance = 10_000_000_000_000; // 10 Vara + pub const EXISTENTIAL_DEPOSIT: Balance = 10 * UNITS; // 10 Vara /// The program rent cost per block. pub const RENT_COST_PER_BLOCK: Balance = 125_000_000; - // TODO: review quantities based on economic model (issue #1277) - pub const UNITS: Balance = 1_000_000_000_000; // 10^(-12) precision - pub const DOLLARS: Balance = UNITS * 20; // 1 token is worth ~$0.05 - pub const CENTS: Balance = DOLLARS / 100; // 200_000_000_000 - pub const MILLICENTS: Balance = CENTS / 1_000; // 200_000_000 - /// Helper function to calculate various deposits for using pallets' storage pub const fn deposit(items: u32, bytes: u32) -> Balance { // TODO: review numbers (#2650) - items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS + items as Balance * 15 * ECONOMIC_CENTIUNITS + (bytes as Balance) * 6 * ECONOMIC_CENTIUNITS } } diff --git a/runtime/vara/src/governance/fellowship.rs b/runtime/vara/src/governance/fellowship.rs index e0e9a39c2c4..6adad66c76d 100644 --- a/runtime/vara/src/governance/fellowship.rs +++ b/runtime/vara/src/governance/fellowship.rs @@ -30,7 +30,7 @@ use sp_runtime::{ }; use super::*; -use crate::{DAYS, DOLLARS}; +use crate::{DAYS, ECONOMIC_UNITS}; parameter_types! { pub const AlarmInterval: BlockNumber = 1; @@ -49,7 +49,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "candidates", max_deciding: 10, - decision_deposit: 100 * DOLLARS, + decision_deposit: 100 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -71,7 +71,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "members", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -93,7 +93,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "proficients", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -115,7 +115,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "fellows", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -137,7 +137,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior fellows", max_deciding: 10, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -159,7 +159,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -181,7 +181,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior experts", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -203,7 +203,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -225,7 +225,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "senior masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, @@ -247,7 +247,7 @@ impl pallet_referenda::TracksInfo for TracksInfo { pallet_referenda::TrackInfo { name: "grand masters", max_deciding: 10, - decision_deposit: 1 * DOLLARS, + decision_deposit: 1 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 7 * DAYS, confirm_period: 30 * MINUTES, diff --git a/runtime/vara/src/governance/mod.rs b/runtime/vara/src/governance/mod.rs index cd3189fc2f4..6e435b4df51 100644 --- a/runtime/vara/src/governance/mod.rs +++ b/runtime/vara/src/governance/mod.rs @@ -53,7 +53,7 @@ impl pallet_conviction_voting::Config for Runtime { parameter_types! { pub const AlarmInterval: BlockNumber = 1; - pub const SubmissionDeposit: Balance = 10 * DOLLARS; + pub const SubmissionDeposit: Balance = 10 * ECONOMIC_UNITS; pub const UndecidingTimeout: BlockNumber = 14 * DAYS; } diff --git a/runtime/vara/src/governance/tracks.rs b/runtime/vara/src/governance/tracks.rs index b20bbf0b3ce..48170c7e827 100644 --- a/runtime/vara/src/governance/tracks.rs +++ b/runtime/vara/src/governance/tracks.rs @@ -67,7 +67,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "root", max_deciding: 1, - decision_deposit: 100_000 * DOLLARS, + decision_deposit: 100_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 24 * HOURS, @@ -81,7 +81,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "whitelisted_caller", max_deciding: 100, - decision_deposit: 10_000 * DOLLARS, + decision_deposit: 10_000 * ECONOMIC_UNITS, prepare_period: 30 * MINUTES, decision_period: 14 * DAYS, confirm_period: 10 * MINUTES, @@ -95,7 +95,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "staking_admin", max_deciding: 10, - decision_deposit: 5_000 * DOLLARS, + decision_deposit: 5_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -109,7 +109,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "treasurer", max_deciding: 10, - decision_deposit: 1_000 * DOLLARS, + decision_deposit: 1_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -123,7 +123,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "fellowship_admin", max_deciding: 10, - decision_deposit: 5_000 * DOLLARS, + decision_deposit: 5_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -137,7 +137,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "general_admin", max_deciding: 10, - decision_deposit: 5_000 * DOLLARS, + decision_deposit: 5_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -151,7 +151,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "referendum_canceller", max_deciding: 1_000, - decision_deposit: 10_000 * DOLLARS, + decision_deposit: 10_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 7 * DAYS, confirm_period: 3 * HOURS, @@ -165,7 +165,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "referendum_killer", max_deciding: 1_000, - decision_deposit: 50_000 * DOLLARS, + decision_deposit: 50_000 * ECONOMIC_UNITS, prepare_period: 2 * HOURS, decision_period: 14 * DAYS, confirm_period: 3 * HOURS, @@ -179,7 +179,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "small_tipper", max_deciding: 200, - decision_deposit: DOLLARS, + decision_deposit: ECONOMIC_UNITS, prepare_period: MINUTES, decision_period: 7 * DAYS, confirm_period: 10 * MINUTES, @@ -193,7 +193,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "big_tipper", max_deciding: 100, - decision_deposit: 10 * DOLLARS, + decision_deposit: 10 * ECONOMIC_UNITS, prepare_period: 10 * MINUTES, decision_period: 7 * DAYS, confirm_period: HOURS, @@ -207,7 +207,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "small_spender", max_deciding: 50, - decision_deposit: 100 * DOLLARS, + decision_deposit: 100 * ECONOMIC_UNITS, prepare_period: 4 * HOURS, decision_period: 14 * DAYS, confirm_period: 12 * HOURS, @@ -221,7 +221,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "medium_spender", max_deciding: 50, - decision_deposit: 200 * DOLLARS, + decision_deposit: 200 * ECONOMIC_UNITS, prepare_period: 4 * HOURS, decision_period: 14 * DAYS, confirm_period: 24 * HOURS, @@ -235,7 +235,7 @@ const TRACKS_DATA: [(u16, pallet_referenda::TrackInfo); 13 pallet_referenda::TrackInfo { name: "big_spender", max_deciding: 50, - decision_deposit: 400 * DOLLARS, + decision_deposit: 400 * ECONOMIC_UNITS, prepare_period: 4 * HOURS, decision_period: 14 * DAYS, confirm_period: 48 * HOURS, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index cf6de126ae5..c6332876d1b 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -313,8 +313,8 @@ impl pallet_scheduler::Config for Runtime { parameter_types! { pub const PreimageMaxSize: u32 = 4096 * 1024; - pub const PreimageBaseDeposit: Balance = DOLLARS; - pub const PreimageByteDeposit: Balance = CENTS; + pub const PreimageBaseDeposit: Balance = ECONOMIC_UNITS; + pub const PreimageByteDeposit: Balance = ECONOMIC_CENTIUNITS; } impl pallet_preimage::Config for Runtime { @@ -451,9 +451,9 @@ parameter_types! { pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; // signed config - pub const SignedRewardBase: Balance = DOLLARS; - pub const SignedDepositBase: Balance = DOLLARS; - pub const SignedDepositByte: Balance = CENTS; + pub const SignedRewardBase: Balance = ECONOMIC_UNITS; + pub const SignedDepositBase: Balance = ECONOMIC_UNITS; + pub const SignedDepositByte: Balance = ECONOMIC_CENTIUNITS; pub BetterUnsignedThreshold: Perbill = Perbill::from_rational(1u32, 10_000); @@ -679,13 +679,13 @@ impl pallet_offences::Config for Runtime { parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); - pub const ProposalBondMinimum: Balance = DOLLARS; + pub const ProposalBondMinimum: Balance = ECONOMIC_UNITS; pub const SpendPeriod: BlockNumber = DAYS; pub const Burn: Permill = Permill::from_percent(50); pub const TipCountdown: BlockNumber = DAYS; pub const TipFindersFee: Percent = Percent::from_percent(20); - pub const TipReportDepositBase: Balance = DOLLARS; - pub const DataDepositPerByte: Balance = CENTS; + pub const TipReportDepositBase: Balance = ECONOMIC_UNITS; + pub const DataDepositPerByte: Balance = ECONOMIC_CENTIUNITS; pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry"); pub const MaximumReasonLength: u32 = 300; pub const MaxApprovals: u32 = 100; @@ -712,11 +712,11 @@ impl pallet_treasury::Config for Runtime { parameter_types! { pub const BountyCuratorDeposit: Permill = Permill::from_percent(50); - pub const BountyValueMinimum: Balance = 5 * DOLLARS; - pub const BountyDepositBase: Balance = DOLLARS; + pub const BountyValueMinimum: Balance = 5 * ECONOMIC_UNITS; + pub const BountyDepositBase: Balance = ECONOMIC_UNITS; pub const CuratorDepositMultiplier: Permill = Permill::from_percent(50); - pub const CuratorDepositMin: Balance = DOLLARS; - pub const CuratorDepositMax: Balance = 100 * DOLLARS; + pub const CuratorDepositMin: Balance = ECONOMIC_UNITS; + pub const CuratorDepositMax: Balance = 100 * ECONOMIC_UNITS; pub const BountyDepositPayoutDelay: BlockNumber = DAYS; pub const BountyUpdatePeriod: BlockNumber = 14 * DAYS; } @@ -737,7 +737,7 @@ impl pallet_bounties::Config for Runtime { } parameter_types! { - pub const ChildBountyValueMinimum: Balance = DOLLARS; + pub const ChildBountyValueMinimum: Balance = ECONOMIC_UNITS; } impl pallet_child_bounties::Config for Runtime { @@ -775,9 +775,9 @@ impl pallet_authority_discovery::Config for Runtime { } parameter_types! { - pub const BasicDeposit: Balance = 10 * DOLLARS; // 258 bytes on-chain - pub const FieldDeposit: Balance = 250 * CENTS; // 66 bytes on-chain - pub const SubAccountDeposit: Balance = 2 * DOLLARS; // 53 bytes on-chain + pub const BasicDeposit: Balance = 10 * ECONOMIC_UNITS; // 258 bytes on-chain + pub const FieldDeposit: Balance = 250 * ECONOMIC_CENTIUNITS; // 66 bytes on-chain + pub const SubAccountDeposit: Balance = 2 * ECONOMIC_UNITS; // 53 bytes on-chain pub const MaxSubAccounts: u32 = 100; pub const MaxAdditionalFields: u32 = 100; pub const MaxRegistrars: u32 = 20; @@ -1094,7 +1094,7 @@ where } parameter_types! { - pub const MinVestedTransfer: Balance = 100 * CENTS; + pub const MinVestedTransfer: Balance = 100 * ECONOMIC_CENTIUNITS; pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); } diff --git a/runtime/vara/src/migrations.rs b/runtime/vara/src/migrations.rs index 8749826d911..248916f1fad 100644 --- a/runtime/vara/src/migrations.rs +++ b/runtime/vara/src/migrations.rs @@ -19,4 +19,4 @@ #[allow(unused)] use crate::*; -pub type Migrations = (pallet_gear_gas::migrations::MigrateToV3,); +pub type Migrations = (); From 9e2576bd81fd257b329252acace14834f8bdf23e Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 19:21:03 +0400 Subject: [PATCH 141/165] chore(v1.0.0): Remove `pallet-airdrop` (#3276) --- Cargo.lock | 32 --- Cargo.toml | 1 - gsdk/src/metadata/errors.rs | 1 - gsdk/src/metadata/generated.rs | 97 -------- pallets/airdrop/Cargo.toml | 70 ------ pallets/airdrop/README.md | 7 - pallets/airdrop/src/benchmarking.rs | 70 ------ pallets/airdrop/src/lib.rs | 214 ------------------ pallets/airdrop/src/mock.rs | 247 --------------------- pallets/airdrop/src/tests.rs | 173 --------------- pallets/airdrop/src/weights.rs | 95 -------- runtime/vara/Cargo.toml | 4 - runtime/vara/src/lib.rs | 13 +- runtime/vara/src/weights/mod.rs | 1 - runtime/vara/src/weights/pallet_airdrop.rs | 95 -------- 15 files changed, 2 insertions(+), 1118 deletions(-) delete mode 100644 pallets/airdrop/Cargo.toml delete mode 100644 pallets/airdrop/README.md delete mode 100644 pallets/airdrop/src/benchmarking.rs delete mode 100644 pallets/airdrop/src/lib.rs delete mode 100644 pallets/airdrop/src/mock.rs delete mode 100644 pallets/airdrop/src/tests.rs delete mode 100644 pallets/airdrop/src/weights.rs delete mode 100644 runtime/vara/src/weights/pallet_airdrop.rs diff --git a/Cargo.lock b/Cargo.lock index 32ac68ad265..f51d1120230 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7118,37 +7118,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "pallet-airdrop" -version = "1.0.0" -dependencies = [ - "env_logger", - "frame-benchmarking", - "frame-support", - "frame-support-test", - "frame-system", - "gear-common", - "log", - "pallet-authorship", - "pallet-balances", - "pallet-gear", - "pallet-gear-bank", - "pallet-gear-gas", - "pallet-gear-messenger", - "pallet-gear-program", - "pallet-gear-scheduler", - "pallet-sudo", - "pallet-timestamp", - "pallet-vesting", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", - "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", - "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", - "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", -] - [[package]] name = "pallet-authority-discovery" version = "4.0.0-dev" @@ -13511,7 +13480,6 @@ dependencies = [ "gear-runtime-primitives", "hex-literal", "log", - "pallet-airdrop", "pallet-authority-discovery", "pallet-authorship", "pallet-babe", diff --git a/Cargo.toml b/Cargo.toml index f3d587003ee..108d5011b92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -221,7 +221,6 @@ gear-wasm-gen = { path = "utils/wasm-gen" } gear-wasm-instrument = { path = "utils/wasm-instrument", default-features = false } junit-common = { path = "utils/junit-common" } actor-system-error = { path = "utils/actor-system-error" } -pallet-airdrop = { path = "pallets/airdrop", default-features = false } pallet-gear = { path = "pallets/gear", default-features = false } pallet-gear-debug = { path = "pallets/gear-debug", default-features = false } pallet-gear-gas = { path = "pallets/gas", default-features = false } diff --git a/gsdk/src/metadata/errors.rs b/gsdk/src/metadata/errors.rs index fef6f00d76e..bfbd006d5a9 100644 --- a/gsdk/src/metadata/errors.rs +++ b/gsdk/src/metadata/errors.rs @@ -94,7 +94,6 @@ macro_rules! export_module_error { // pallets that don't have `Error` type. // // - pallet_transaction_payment -// - pallet_airdrop // // pallets that share the same `errors::RankedCollective` // diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index cfc17329d53..77010704434 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -1000,73 +1000,6 @@ pub mod runtime_types { } } } - pub mod pallet_airdrop { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "Contains one variant per dispatchable that can be called by an extrinsic."] - pub enum Call { - #[codec(index = 0)] - #[doc = "Transfer tokens from pre-funded `source` to `dest` account."] - #[doc = ""] - #[doc = "The origin must be the root."] - #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `source`: the pre-funded account (i.e. root),"] - #[doc = "- `dest`: the beneficiary account,"] - #[doc = "- `amount`: the amount of tokens to be minted."] - #[doc = ""] - #[doc = "Emits the following events:"] - #[doc = "- `TokensDeposited{ dest, amount }`"] - transfer { - source: ::subxt::utils::AccountId32, - dest: ::subxt::utils::AccountId32, - amount: ::core::primitive::u128, - }, - #[codec(index = 1)] - #[doc = "Remove vesting for `source` account and transfer tokens to `dest` account."] - #[doc = ""] - #[doc = "The origin must be the root."] - #[doc = ""] - #[doc = "Parameters:"] - #[doc = "- `source`: the account with vesting running,"] - #[doc = "- `dest`: the beneficiary account,"] - #[doc = "- `schedule_index`: the index of `VestingInfo` for source account."] - #[doc = "- `amount`: the amount to be unlocked and transferred from `VestingInfo`."] - #[doc = ""] - #[doc = "Emits the following events:"] - #[doc = "- `VestingScheduleRemoved{ who, schedule_index }`"] - transfer_vested { - source: ::subxt::utils::AccountId32, - dest: ::subxt::utils::AccountId32, - schedule_index: ::core::primitive::u32, - amount: ::core::option::Option<::core::primitive::u128>, - }, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "Error for the airdrop pallet."] - pub enum Error { - #[codec(index = 0)] - #[doc = "Amount to being transferred is bigger than vested."] - AmountBigger, - } - #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] - #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] - pub enum Event { - #[codec(index = 0)] - TokensDeposited { - account: ::subxt::utils::AccountId32, - amount: ::core::primitive::u128, - }, - #[codec(index = 1)] - VestingScheduleRemoved { - who: ::subxt::utils::AccountId32, - schedule_index: ::core::primitive::u32, - }, - } - } - } pub mod pallet_babe { use super::runtime_types; pub mod pallet { @@ -9113,8 +9046,6 @@ pub mod runtime_types { GearVoucher(runtime_types::pallet_gear_voucher::pallet::Call), #[codec(index = 99)] Sudo(runtime_types::pallet_sudo::pallet::Call), - #[codec(index = 198)] - Airdrop(runtime_types::pallet_airdrop::pallet::Call), #[codec(index = 199)] GearDebug(runtime_types::pallet_gear_debug::pallet::Call), } @@ -9182,8 +9113,6 @@ pub mod runtime_types { GearVoucher(runtime_types::pallet_gear_voucher::pallet::Event), #[codec(index = 99)] Sudo(runtime_types::pallet_sudo::pallet::Event), - #[codec(index = 198)] - Airdrop(runtime_types::pallet_airdrop::pallet::Event), #[codec(index = 199)] GearDebug(runtime_types::pallet_gear_debug::pallet::Event), } @@ -9204,20 +9133,6 @@ pub mod calls { #[doc = r" returns call name."] fn call_name(&self) -> &'static str; } - #[doc = "Calls of pallet `Airdrop`."] - pub enum AirdropCall { - Transfer, - TransferVested, - } - impl CallInfo for AirdropCall { - const PALLET: &'static str = "Airdrop"; - fn call_name(&self) -> &'static str { - match self { - Self::Transfer => "transfer", - Self::TransferVested => "transfer_vested", - } - } - } #[doc = "Calls of pallet `Babe`."] pub enum BabeCall { ReportEquivocation, @@ -11061,15 +10976,6 @@ pub mod impls { )?, )); } - if pallet_name == "Airdrop" { - return Ok(Event::Airdrop( - crate::metadata::airdrop::Event::decode_with_metadata( - &mut &*pallet_bytes, - pallet_ty, - metadata, - )?, - )); - } if pallet_name == "GearDebug" { return Ok(Event::GearDebug( crate::metadata::gear_debug::Event::decode_with_metadata( @@ -11179,9 +11085,6 @@ pub mod exports { pub mod sudo { pub use super::runtime_types::pallet_sudo::pallet::Event; } - pub mod airdrop { - pub use super::runtime_types::pallet_airdrop::pallet::Event; - } pub mod gear_debug { pub use super::runtime_types::pallet_gear_debug::pallet::Event; } diff --git a/pallets/airdrop/Cargo.toml b/pallets/airdrop/Cargo.toml deleted file mode 100644 index 35f74034b41..00000000000 --- a/pallets/airdrop/Cargo.toml +++ /dev/null @@ -1,70 +0,0 @@ -[package] -name = "pallet-airdrop" -version = "1.0.0" -authors = ['Gear Technologies'] -edition = '2021' -license.workspace = true -homepage = "https://gear-tech.io" -repository = "https://github.com/gear-tech/gear" -description = "Airdrop pallet" -readme = "README.md" - -[package.metadata.docs.rs] -targets = ["x86_64-unknown-linux-gnu"] - -[dependencies] -parity-scale-codec = { workspace = true, features = ["derive", "max-encoded-len"] } -scale-info = { workspace = true, features = ["derive"] } -log.workspace = true - -# Internal deps -common.workspace = true -pallet-gear.workspace = true -pallet-gear-bank.workspace = true - -# Substrate deps -frame-support.workspace = true -frame-system.workspace = true -frame-benchmarking = { workspace = true, optional = true } -sp-runtime.workspace = true -sp-std.workspace = true -pallet-balances.workspace = true -pallet-vesting.workspace = true - -[dev-dependencies] -serde.workspace = true -env_logger.workspace = true -sp-core = { workspace = true, features = ["std"] } -sp-io = { workspace = true, features = ["std"] } -pallet-authorship = { workspace = true, features = ["std"] } -pallet-sudo = { workspace = true, features = ["std"] } -pallet-timestamp = { workspace = true, features = ["std"] } -pallet-gear-program = { workspace = true, features = ["std"] } -pallet-gear-messenger = { workspace = true, features = ["std"] } -pallet-gear-scheduler = { workspace = true, features = ["std"] } -pallet-gear-gas = { workspace = true, features = ["std"] } -frame-support-test = { workspace = true, features = ["std"] } - -[features] -default = ["std"] -std = [ - "common/std", - "parity-scale-codec/std", - "log/std", - "frame-benchmarking?/std", - "frame-support/std", - "frame-system/std", - "scale-info/std", - "sp-std/std", - "pallet-balances/std", - "pallet-vesting/std", - "pallet-gear/std", - "pallet-gear-bank/std", -] -runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "common/runtime-benchmarks", -] -try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/airdrop/README.md b/pallets/airdrop/README.md deleted file mode 100644 index 3f75afc1b5b..00000000000 --- a/pallets/airdrop/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Airdrop pallet used on testnet to dispense funds to users - -A crate which provides a mechanism to transfer tokens from pre-funded account to users while generic balance transfers are disabled. - -### Dispatchable Functions - -License: Unlicense diff --git a/pallets/airdrop/src/benchmarking.rs b/pallets/airdrop/src/benchmarking.rs deleted file mode 100644 index 68064fca290..00000000000 --- a/pallets/airdrop/src/benchmarking.rs +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#[allow(unused)] -use crate::Pallet as Airdrop; -use crate::*; -use common::{benchmarking, Origin}; -use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; -use frame_support::traits::Currency; -use frame_system::RawOrigin; -use pallet_vesting::VestingInfo; -use sp_runtime::traits::{StaticLookup, UniqueSaturatedInto}; - -benchmarks! { - where_clause { where - T::AccountId: Origin, - } - - transfer { - let q in 1 .. 256; - - let source: T::AccountId = benchmarking::account("source", 0, 0); - ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); - let recipient: T::AccountId = benchmarking::account("recipient", 0, 0); - // Keeping in mind the existential deposit - let amount = 10_000_000_000_000_u128.saturating_add(10_u128.saturating_mul(q.into())); - - }: _(RawOrigin::Root, source, recipient.clone(), amount.unique_saturated_into()) - verify { - assert_eq!(pallet_balances::Pallet::::total_balance(&recipient), amount.unique_saturated_into()); - } - - transfer_vested { - let q in 1 .. 256; - - let source: T::AccountId = benchmarking::account("source", 0, 0); - let source_lookup = T::Lookup::unlookup(source.clone()); - ::Currency::deposit_creating(&source, (1u128 << 60).unique_saturated_into()); - let recipient: T::AccountId = benchmarking::account("recipient", 0, 0); - let amount = ::MinVestedTransfer::get().saturating_mul(q.into()); - - // create vesting schedule amount * 2 - let vested_amount = amount.saturating_mul(2u128.unique_saturated_into()); - let vesting_schedule = VestingInfo::new(vested_amount.unique_saturated_into(), 10u128.unique_saturated_into(), 1000u32.into()); - pallet_vesting::Pallet::::vested_transfer(RawOrigin::Signed(source.clone()).into(), source_lookup, vesting_schedule)?; - - }: _(RawOrigin::Root, source.clone(), recipient.clone(), 0, Some(amount)) - verify { - // check that the total vested amount is halved between the source and the recipient - assert_eq!(pallet_vesting::Pallet::::vesting_balance(&source), Some(amount)); - assert_eq!(::Currency::free_balance(&recipient), amount); - } -} - -impl_benchmark_test_suite!(Airdrop, crate::mock::new_test_ext(), crate::mock::Test,); diff --git a/pallets/airdrop/src/lib.rs b/pallets/airdrop/src/lib.rs deleted file mode 100644 index 7609271c50e..00000000000 --- a/pallets/airdrop/src/lib.rs +++ /dev/null @@ -1,214 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#![cfg_attr(not(feature = "std"), no_std)] - -use frame_support::{ - pallet_prelude::*, - traits::{Currency, ExistenceRequirement, VestingSchedule}, -}; -pub use pallet::*; -use sp_runtime::traits::{Convert, Saturating}; -pub use weights::WeightInfo; - -pub mod weights; - -#[cfg(feature = "runtime-benchmarks")] -mod benchmarking; - -#[cfg(test)] -mod mock; - -#[cfg(test)] -mod tests; - -pub(crate) type BalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; - -pub(crate) type VestingBalanceOf = <::Currency as Currency< - ::AccountId, ->>::Balance; - -#[frame_support::pallet] -pub mod pallet { - use super::*; - - use frame_system::pallet_prelude::*; - - #[pallet::config] - pub trait Config: - frame_system::Config - + pallet_gear::Config - + pallet_balances::Config - + pallet_vesting::Config - { - /// Because this pallet emits events, it depends on the runtime's definition of an event. - type RuntimeEvent: From> + IsType<::RuntimeEvent>; - - /// Weight information for extrinsics in this pallet. - type WeightInfo: WeightInfo; - - /// To modify/remove vesting schedule - type VestingSchedule: VestingSchedule< - Self::AccountId, - Currency = ::Currency, - Moment = Self::BlockNumber, - >; - } - - #[pallet::pallet] - pub struct Pallet(_); - - #[pallet::event] - #[pallet::generate_deposit(pub(super) fn deposit_event)] - pub enum Event { - TokensDeposited { - account: T::AccountId, - amount: BalanceOf, - }, - VestingScheduleRemoved { - who: T::AccountId, - schedule_index: u32, - }, - } - - /// Error for the airdrop pallet. - #[pallet::error] - pub enum Error { - /// Amount to being transferred is bigger than vested. - AmountBigger, - } - - #[pallet::call] - impl Pallet { - /// Transfer tokens from pre-funded `source` to `dest` account. - /// - /// The origin must be the root. - /// - /// Parameters: - /// - `source`: the pre-funded account (i.e. root), - /// - `dest`: the beneficiary account, - /// - `amount`: the amount of tokens to be minted. - /// - /// Emits the following events: - /// - `TokensDeposited{ dest, amount }` - #[pallet::call_index(0)] - #[pallet::weight(::WeightInfo::transfer(1))] - pub fn transfer( - origin: OriginFor, - source: T::AccountId, - dest: T::AccountId, - amount: BalanceOf, - ) -> DispatchResultWithPostInfo { - ensure_root(origin)?; - - <::Currency as Currency<_>>::transfer( - &source, - &dest, - amount, - ExistenceRequirement::KeepAlive, - )?; - Self::deposit_event(Event::TokensDeposited { - account: dest, - amount, - }); - - // This extrinsic is not chargeable - Ok(Pays::No.into()) - } - - /// Remove vesting for `source` account and transfer tokens to `dest` account. - /// - /// The origin must be the root. - /// - /// Parameters: - /// - `source`: the account with vesting running, - /// - `dest`: the beneficiary account, - /// - `schedule_index`: the index of `VestingInfo` for source account. - /// - `amount`: the amount to be unlocked and transferred from `VestingInfo`. - /// - /// Emits the following events: - /// - `VestingScheduleRemoved{ who, schedule_index }` - #[pallet::call_index(1)] - #[pallet::weight(::WeightInfo::transfer_vested(1))] - pub fn transfer_vested( - origin: OriginFor, - source: T::AccountId, - dest: T::AccountId, - schedule_index: u32, - amount: Option>, - ) -> DispatchResultWithPostInfo { - ensure_root(origin)?; - - let schedules = pallet_vesting::Pallet::::vesting(&source) - .ok_or(pallet_vesting::Error::::NotVesting)?; - - let schedule = schedules - .get(schedule_index as usize) - .ok_or(pallet_vesting::Error::::ScheduleIndexOutOfBounds)?; - - T::VestingSchedule::remove_vesting_schedule(&source, schedule_index)?; - - Self::deposit_event(Event::VestingScheduleRemoved { - who: source.clone(), - schedule_index, - }); - - let amount = if let Some(amount) = amount { - ensure!(amount <= schedule.locked(), Error::::AmountBigger); - let end_amount = schedule.locked().saturating_sub(amount); - let end_block = schedule.ending_block_as_balance::(); - let start_block = T::BlockNumberToBalance::convert(schedule.starting_block()); - let per_block = end_amount / end_block.saturating_sub(start_block); - - T::VestingSchedule::can_add_vesting_schedule( - &source, - end_amount, - per_block, - schedule.starting_block(), - )?; - let res = T::VestingSchedule::add_vesting_schedule( - &source, - end_amount, - per_block, - schedule.starting_block(), - ); - - debug_assert!( - res.is_ok(), - "Failed to add a schedule when we had to succeed." - ); - - amount - } else { - schedule.locked() - }; - - <::Currency as Currency<_>>::transfer( - &source, - &dest, - amount, - ExistenceRequirement::AllowDeath, - )?; - - // This extrinsic is not chargeable - Ok(Pays::No.into()) - } - } -} diff --git a/pallets/airdrop/src/mock.rs b/pallets/airdrop/src/mock.rs deleted file mode 100644 index 6e4f334f9f2..00000000000 --- a/pallets/airdrop/src/mock.rs +++ /dev/null @@ -1,247 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use crate as pallet_airdrop; -use frame_support::{ - construct_runtime, parameter_types, - traits::{ConstU64, GenesisBuild, WithdrawReasons}, -}; -use frame_support_test::TestRandomness; -use frame_system as system; -use sp_core::ConstBool; -use sp_runtime::{ - testing::Header, - traits::{BlakeTwo256, ConvertInto, IdentityLookup}, -}; -use sp_std::convert::{TryFrom, TryInto}; - -type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic; -type Block = frame_system::mocking::MockBlock; -type AccountId = u64; -type BlockNumber = u64; -type Balance = u128; - -pub const ALICE: AccountId = 1; -pub const BOB: AccountId = 2; -pub const ROOT: AccountId = 255; - -// Configure a mock runtime to test the pallet. -construct_runtime!( - pub enum Test where - Block = Block, - NodeBlock = Block, - UncheckedExtrinsic = UncheckedExtrinsic, - { - System: system, - Balances: pallet_balances, - Sudo: pallet_sudo, - Authorship: pallet_authorship, - Timestamp: pallet_timestamp, - GearProgram: pallet_gear_program, - GearMessenger: pallet_gear_messenger, - GearScheduler: pallet_gear_scheduler, - GearGas: pallet_gear_gas, - GearBank: pallet_gear_bank, - Gear: pallet_gear, - Airdrop: pallet_airdrop, - Vesting: pallet_vesting, - } -); - -parameter_types! { - pub const BlockHashCount: u64 = 250; - pub const SS58Prefix: u8 = 42; - pub const ExistentialDeposit: Balance = 1; - pub const OutgoingLimit: u32 = 1024; - pub GearSchedule: pallet_gear::Schedule = >::default(); -} - -impl system::Config for Test { - type BaseCallFilter = frame_support::traits::Everything; - type BlockWeights = (); - type BlockLength = (); - type DbWeight = (); - type RuntimeOrigin = RuntimeOrigin; - type RuntimeCall = RuntimeCall; - type Index = u64; - type BlockNumber = BlockNumber; - type Hash = sp_core::H256; - type Hashing = BlakeTwo256; - type AccountId = AccountId; - type Lookup = IdentityLookup; - type Header = Header; - type RuntimeEvent = RuntimeEvent; - type BlockHashCount = BlockHashCount; - type Version = (); - type PalletInfo = PalletInfo; - type AccountData = pallet_balances::AccountData; - type OnNewAccount = (); - type OnKilledAccount = (); - type SystemWeightInfo = (); - type SS58Prefix = SS58Prefix; - type OnSetCode = (); - type MaxConsumers = frame_support::traits::ConstU32<16>; -} - -impl pallet_balances::Config for Test { - type MaxLocks = (); - type MaxReserves = (); - type ReserveIdentifier = [u8; 8]; - type Balance = Balance; - type DustRemoval = (); - type RuntimeEvent = RuntimeEvent; - type ExistentialDeposit = ExistentialDeposit; - type AccountStore = System; - type WeightInfo = (); -} - -impl pallet_sudo::Config for Test { - type RuntimeEvent = RuntimeEvent; - type RuntimeCall = RuntimeCall; -} - -impl pallet_timestamp::Config for Test { - type Moment = u64; - type OnTimestampSet = (); - type MinimumPeriod = ConstU64<500>; - type WeightInfo = (); -} - -impl pallet_authorship::Config for Test { - type FindAuthor = (); - - type EventHandler = (); -} - -impl pallet_gear_gas::Config for Test { - type BlockGasLimit = ConstU64<100_000_000>; -} - -impl pallet_gear_messenger::Config for Test { - type BlockLimiter = GearGas; - type CurrentBlockNumber = Gear; -} - -impl pallet_gear_program::Config for Test { - type Scheduler = GearScheduler; - type CurrentBlockNumber = (); -} - -parameter_types! { - pub RentFreePeriod: BlockNumber = 1_000; - pub RentCostPerBlock: Balance = 11; - pub ResumeMinimalPeriod: BlockNumber = 100; - pub ResumeSessionDuration: BlockNumber = 1_000; - pub const BankAddress: AccountId = 15082001; - pub const GasMultiplier: common::GasMultiplier = common::GasMultiplier::ValuePerGas(25); -} - -impl pallet_gear_bank::Config for Test { - type Currency = Balances; - type BankAddress = BankAddress; - type GasMultiplier = GasMultiplier; -} - -impl pallet_gear::Config for Test { - type RuntimeEvent = RuntimeEvent; - type Randomness = TestRandomness; - type WeightInfo = (); - type Schedule = GearSchedule; - type OutgoingLimit = OutgoingLimit; - type DebugInfo = (); - type ProgramStorage = GearProgram; - type CodeStorage = GearProgram; - type MailboxThreshold = ConstU64<3000>; - type ReservationsLimit = ConstU64<256>; - type Messenger = GearMessenger; - type GasProvider = GearGas; - type BlockLimiter = GearGas; - type Scheduler = GearScheduler; - type QueueRunner = Gear; - type Voucher = (); - type ProgramRentFreePeriod = RentFreePeriod; - type ProgramResumeMinimalRentPeriod = ResumeMinimalPeriod; - type ProgramRentCostPerBlock = RentCostPerBlock; - type ProgramResumeSessionDuration = ResumeSessionDuration; - type ProgramRentEnabled = ConstBool; - type ProgramRentDisabledDelta = RentFreePeriod; -} - -impl pallet_gear_scheduler::Config for Test { - type BlockLimiter = GearGas; - type ReserveThreshold = ConstU64<1>; - type WaitlistCost = ConstU64<100>; - type MailboxCost = ConstU64<100>; - type ReservationCost = ConstU64<100>; - type DispatchHoldCost = ConstU64<100>; -} - -parameter_types! { - pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = - WithdrawReasons::except(WithdrawReasons::TRANSFER | WithdrawReasons::RESERVE); -} - -impl pallet_vesting::Config for Test { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type BlockNumberToBalance = ConvertInto; - type MinVestedTransfer = (); - type WeightInfo = (); - type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons; - const MAX_VESTING_SCHEDULES: u32 = 28; -} - -pub type VestingError = pallet_vesting::Error; - -impl pallet_airdrop::Config for Test { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = (); - type VestingSchedule = Vesting; -} - -pub type AirdropCall = pallet_airdrop::Call; -pub type AirdropError = pallet_airdrop::Error; - -// Build genesis storage according to the mock runtime. -pub fn new_test_ext() -> sp_io::TestExternalities { - let mut t = system::GenesisConfig::default() - .build_storage::() - .unwrap(); - - pallet_balances::GenesisConfig:: { - balances: vec![ - (ROOT, 100_000_000_u128), - (BOB, 100_000_000_u128), - (BankAddress::get(), ExistentialDeposit::get()), - ], - } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_sudo::GenesisConfig:: { key: Some(ROOT) } - .assimilate_storage(&mut t) - .unwrap(); - - pallet_vesting::GenesisConfig:: { - vesting: vec![(BOB, 100, 1000, 0)], - } - .assimilate_storage(&mut t) - .unwrap(); - - t.into() -} diff --git a/pallets/airdrop/src/tests.rs b/pallets/airdrop/src/tests.rs deleted file mode 100644 index 420b8c05930..00000000000 --- a/pallets/airdrop/src/tests.rs +++ /dev/null @@ -1,173 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2021-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use super::*; -use crate::mock::{ - new_test_ext, Airdrop, AirdropCall, AirdropError, Balances, BankAddress, ExistentialDeposit, - RuntimeCall, RuntimeOrigin, Sudo, Test, Vesting, VestingError, ALICE, BOB, ROOT, -}; -use frame_support::{assert_err, assert_noop, assert_ok}; -use frame_system::Config; -use pallet_vesting::VestingInfo; - -#[test] -fn test_setup_works() { - new_test_ext().execute_with(|| { - assert_eq!(Sudo::key(), Some(ROOT)); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - }); -} - -#[test] -fn sudo_call_works() { - new_test_ext().execute_with(|| { - let call = Box::new(RuntimeCall::Airdrop(AirdropCall::transfer { - source: ROOT, - dest: ALICE, - amount: 10_000_000, - })); - assert_ok!(Sudo::sudo(RuntimeOrigin::signed(ROOT), call)); - assert_eq!(Balances::total_balance(&ALICE), 10_000_000); - assert_eq!(Balances::total_balance(&ROOT), 90_000_000); - assert_eq!( - Balances::total_balance(&BankAddress::get()), - ExistentialDeposit::get() - ); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - - assert_eq!(Balances::locks(BOB).len(), 1); - let call = Box::new(RuntimeCall::Airdrop(AirdropCall::transfer_vested { - source: BOB, - dest: ALICE, - schedule_index: 0, - amount: None, - })); - assert_ok!(Sudo::sudo(RuntimeOrigin::signed(ROOT), call)); - assert_eq!(Balances::total_balance(&BOB), 0); - assert_eq!(Balances::locks(BOB), vec![]); - assert_eq!(Balances::total_balance(&ALICE), 110_000_000); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - }); -} -#[test] -fn vesting_transfer_works() { - new_test_ext().execute_with(|| { - assert_eq!(Balances::locks(BOB).len(), 1); - assert_eq!( - Vesting::vesting(BOB).unwrap().first().unwrap(), - &VestingInfo::, ::BlockNumber>::new( - 100_000_000, - 100_000, - 100, - ) - ); - assert_eq!(Balances::total_balance(&ALICE), 0); - assert_eq!(Balances::total_balance(&BOB), 100_000_000); - assert_eq!(Balances::total_balance(&ROOT), 100_000_000); - assert_eq!( - Balances::total_balance(&BankAddress::get()), - ExistentialDeposit::get() - ); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - - // Vesting must exist on the source account - assert_err!( - Airdrop::transfer_vested(RuntimeOrigin::root(), ALICE, BOB, 1, Some(200_000_000)), - VestingError::NotVesting - ); - - // Schedule must exist on the source account - assert_err!( - Airdrop::transfer_vested(RuntimeOrigin::root(), BOB, ALICE, 1, Some(200_000_000)), - VestingError::ScheduleIndexOutOfBounds - ); - - // Amount can't be bigger than locked funds - assert_err!( - Airdrop::transfer_vested(RuntimeOrigin::root(), BOB, ALICE, 0, Some(200_000_000)), - AirdropError::AmountBigger - ); - - // Transfer part of vested funds to ALICE - assert_ok!(Airdrop::transfer_vested( - RuntimeOrigin::root(), - BOB, - ALICE, - 0, - Some(10_000_000) - )); - - // Check that BOB have the same vesting schedule reduced by unlocked funds - assert_eq!( - Vesting::vesting(BOB).unwrap().first().unwrap(), - &VestingInfo::, ::BlockNumber>::new( - 90_000_000, 90_000, 100, - ) - ); - assert_eq!(Balances::total_balance(&BOB), 90_000_000); - assert_eq!(Balances::free_balance(ALICE), 10_000_000); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - - // Transfer all of vested funds to ALICE - assert_ok!(Airdrop::transfer_vested( - RuntimeOrigin::root(), - BOB, - ALICE, - 0, - None - )); - - // Check that BOB have no vesting and ALICE have all the unlocked funds. - assert_eq!(Vesting::vesting(BOB), None); - assert_eq!(Balances::total_balance(&BOB), 0); - assert_eq!(Balances::free_balance(ALICE), 100_000_000); - assert_eq!( - Balances::total_issuance(), - 200_000_000 + ExistentialDeposit::get() - ); - }); -} - -#[test] -fn signed_extrinsic_fails() { - new_test_ext().execute_with(|| { - assert_noop!( - Airdrop::transfer(RuntimeOrigin::signed(ROOT), ROOT, ALICE, 10_000_000_u128), - DispatchError::BadOrigin, - ); - assert_noop!( - Airdrop::transfer_vested(RuntimeOrigin::signed(ROOT), BOB, ALICE, 0, None), - DispatchError::BadOrigin, - ); - }); -} diff --git a/pallets/airdrop/src/weights.rs b/pallets/airdrop/src/weights.rs deleted file mode 100644 index ddaa539a3d9..00000000000 --- a/pallets/airdrop/src/weights.rs +++ /dev/null @@ -1,95 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Autogenerated weights for pallet_airdrop -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-07-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_airdrop --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=pallet_airdrop.rs --template=.maintain/frame-weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for pallet_airdrop. -pub trait WeightInfo { - fn transfer(q: u32, ) -> Weight; - fn transfer_vested(q: u32, ) -> Weight; -} - -/// Weights for pallet_airdrop using the Gear node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl WeightInfo for SubstrateWeight { - /// The range of component `q` is `[1, 256]`. - fn transfer(_q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6196` - // Minimum execution time: 25_027_000 picoseconds. - Weight::from_parts(25_985_030, 6196) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `550` - // Estimated: `15482` - // Minimum execution time: 65_271_000 picoseconds. - Weight::from_parts(67_109_074, 15482) - // Standard Error: 328 - .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - /// The range of component `q` is `[1, 256]`. - fn transfer(_q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6196` - // Minimum execution time: 25_027_000 picoseconds. - Weight::from_parts(25_985_030, 6196) - .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `550` - // Estimated: `15482` - // Minimum execution time: 65_271_000 picoseconds. - Weight::from_parts(67_109_074, 15482) - // Standard Error: 328 - .saturating_add(Weight::from_parts(336, 0).saturating_mul(q.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } -} diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index fa91b85ef26..dcfed171e56 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -98,7 +98,6 @@ pallet-gear-staking-rewards.workspace = true pallet-gear-voucher.workspace = true pallet-gear-rpc-runtime-api.workspace = true runtime-primitives.workspace = true -pallet-airdrop.workspace = true [dev-dependencies] sp-io.workspace = true @@ -185,7 +184,6 @@ std = [ "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", - "pallet-airdrop/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", @@ -200,7 +198,6 @@ runtime-benchmarks = [ "pallet-gear/runtime-benchmarks", "pallet-gear-voucher/runtime-benchmarks", "sp-runtime/runtime-benchmarks", - "pallet-airdrop/runtime-benchmarks", "pallet-bags-list/runtime-benchmarks", "pallet-staking/runtime-benchmarks", "pallet-conviction-voting/runtime-benchmarks", @@ -255,7 +252,6 @@ try-runtime = [ "pallet-utility/try-runtime", "pallet-vesting/try-runtime", "pallet-whitelist/try-runtime", - "pallet-airdrop/try-runtime", "pallet-bags-list/try-runtime", "runtime-common/try-runtime", ] diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index c6332876d1b..6317db2cc24 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -1015,12 +1015,6 @@ impl pallet_gear_messenger::Config for Runtime { type CurrentBlockNumber = Gear; } -impl pallet_airdrop::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type WeightInfo = weights::pallet_airdrop::SubstrateWeight; - type VestingSchedule = Vesting; -} - pub struct ExtraFeeFilter; impl Contains for ExtraFeeFilter { fn contains(call: &RuntimeCall) -> bool { @@ -1167,8 +1161,7 @@ construct_runtime!( // TODO: Remove in stage 3 Sudo: pallet_sudo = 99, - // TODO: remove from production version - Airdrop: pallet_airdrop = 198, + // NOTE (!): `pallet_airdrop` used to be idx(198). // Only available with "debug-mode" feature on GearDebug: pallet_gear_debug = 199, @@ -1232,8 +1225,7 @@ construct_runtime!( // TODO: Remove in stage 3 Sudo: pallet_sudo = 99, - // TODO: remove from production version - Airdrop: pallet_airdrop = 198, + // NOTE (!): `pallet_airdrop` used to be idx(198). } ); @@ -1295,7 +1287,6 @@ mod benches { [pallet_timestamp, Timestamp] [pallet_utility, Utility] // Gear pallets - [pallet_airdrop, Airdrop] [pallet_gear, Gear] [pallet_gear_voucher, GearVoucher] ); diff --git a/runtime/vara/src/weights/mod.rs b/runtime/vara/src/weights/mod.rs index 170d6f59e22..b4eebedfe52 100644 --- a/runtime/vara/src/weights/mod.rs +++ b/runtime/vara/src/weights/mod.rs @@ -19,7 +19,6 @@ //! A list of the different weight modules for our runtime. pub mod frame_system; -pub mod pallet_airdrop; pub mod pallet_balances; pub mod pallet_gear; pub mod pallet_gear_voucher; diff --git a/runtime/vara/src/weights/pallet_airdrop.rs b/runtime/vara/src/weights/pallet_airdrop.rs deleted file mode 100644 index ffe616fea00..00000000000 --- a/runtime/vara/src/weights/pallet_airdrop.rs +++ /dev/null @@ -1,95 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Autogenerated weights for pallet_airdrop -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-11, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("vara-dev"), DB CACHE: 1024 - -// Executed Command: -// ./target/production/gear benchmark pallet --chain=vara-dev --steps=50 --repeat=20 --pallet=pallet_airdrop --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./scripts/benchmarking/weights-output/pallet_airdrop.rs --template=.maintain/frame-weight-template.hbs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for pallet_airdrop. -pub trait WeightInfo { - fn transfer(q: u32, ) -> Weight; - fn transfer_vested(q: u32, ) -> Weight; -} - -/// Weights for pallet_airdrop using the Gear node and recommended hardware. -pub struct SubstrateWeight(PhantomData); -impl pallet_airdrop::WeightInfo for SubstrateWeight { - /// The range of component `q` is `[1, 256]`. - fn transfer(_q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6196` - // Minimum execution time: 25_162_000 picoseconds. - Weight::from_parts(26_300_954, 6196) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `550` - // Estimated: `15482` - // Minimum execution time: 65_671_000 picoseconds. - Weight::from_parts(67_524_170, 15482) - // Standard Error: 398 - .saturating_add(Weight::from_parts(280, 0).saturating_mul(q.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } -} - -// For backwards compatibility and tests -impl WeightInfo for () { - /// The range of component `q` is `[1, 256]`. - fn transfer(_q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `103` - // Estimated: `6196` - // Minimum execution time: 25_162_000 picoseconds. - Weight::from_parts(26_300_954, 6196) - .saturating_add(RocksDbWeight::get().reads(2_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) - } - /// The range of component `q` is `[1, 256]`. - fn transfer_vested(q: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `550` - // Estimated: `15482` - // Minimum execution time: 65_671_000 picoseconds. - Weight::from_parts(67_524_170, 15482) - // Standard Error: 398 - .saturating_add(Weight::from_parts(280, 0).saturating_mul(q.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) - .saturating_add(RocksDbWeight::get().writes(4_u64)) - } -} From 80fb8478fffe5316f64fc0e491e76b358adda40c Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 19:39:02 +0400 Subject: [PATCH 142/165] chore(v1.0.0): Development features gate (#3277) --- .github/workflows/release.yml | 53 ++++++++++++++++++++--------- gsdk/build.rs | 6 +--- node/authorship/Cargo.toml | 2 +- node/cli/Cargo.toml | 8 ++--- node/cli/src/command.rs | 39 ++++++++++++++------- node/service/Cargo.toml | 6 ++-- node/service/src/chain_spec/gear.rs | 1 + node/service/src/chain_spec/vara.rs | 1 + node/testing/Cargo.toml | 4 +-- pallets/gear-debug/Cargo.toml | 2 +- pallets/gear-debug/src/tests/mod.rs | 8 ++--- pallets/gear-program/Cargo.toml | 2 +- pallets/gear-program/src/lib.rs | 4 +-- runtime/gear/Cargo.toml | 2 +- runtime/gear/src/lib.rs | 14 ++++---- runtime/vara/Cargo.toml | 2 +- runtime/vara/src/lib.rs | 14 ++++---- scripts/update-gsdk-metadata.sh | 2 +- 18 files changed, 101 insertions(+), 69 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c62aa29c58..07d09151710 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,46 +49,67 @@ jobs: needs: prepare runs-on: [kuberunner] steps: - - name: Checkout + - name: "Actions: Checkout" uses: actions/checkout@v4 - - name: Set cargo path - run: echo "/tmp/cargo/bin" >> $GITHUB_PATH + - name: "Environment: Cargo path" + run: > + echo "/tmp/cargo/bin" >> $GITHUB_PATH - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 - - name: Install build deps + - name: "Install: Build dependencies" run: | sudo apt update -y sudo apt install -y git clang curl libssl-dev llvm libudev-dev cmake protobuf-compiler wget bzip2 - - name: Build wasm-proc + - name: "Environment: Export versions" + run: | + export GEAR_SPEC="$(cat runtime/gear/src/lib.rs | grep "spec_version: " | awk -F " " '{print substr($2, 1, length($2)-1)}')" + export VARA_SPEC="$(cat runtime/vara/src/lib.rs | grep "spec_version: " | awk -F " " '{print substr($2, 1, length($2)-1)}')" + + - name: "Artifact: Make `artifact` directory" + run: > + mkdir -p artifact + + - name: "Build: `wasm-proc`" run: | cargo build -p wasm-proc --release cp -vf target/release/wasm-proc ./ - - name: Build binaries + - name: "Build: Production `gear-cli`" run: > cargo build -p gear-cli --profile production - - name: Test runtimes + - name: "Test: Production runtimes" run: | ./wasm-proc --check-runtime-imports target/production/wbuild/gear-runtime/gear_runtime.wasm ./wasm-proc --check-runtime-imports target/production/wbuild/vara-runtime/vara_runtime.wasm - - name: Prepare artifacts + - name: "Artifact: Production binaries" run: | - mkdir -p artifact - cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm artifact/ - cp target/production/wbuild/gear-runtime/gear_runtime.compact.wasm artifact/ - cp target/production/wbuild/gear-runtime/gear_runtime.wasm artifact/ - cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm artifact/ - cp target/production/wbuild/vara-runtime/vara_runtime.compact.wasm artifact/ - cp target/production/wbuild/vara-runtime/vara_runtime.wasm artifact/ - cp target/production/gear artifact/ + cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm "artifact/gear_v$GEAR_SPEC.wasm" + cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm "artifact/vara_v$VARA_SPEC.wasm" + cp target/production/gear artifact/gear strip artifact/gear || true + - name: "Build: Development `gear-cli`" + run: > + cargo build -p gear-cli --profile production -F dev + + - name: "Test: Development runtimes" + run: | + ./wasm-proc --check-runtime-imports target/production/wbuild/gear-runtime/gear_runtime.wasm + ./wasm-proc --check-runtime-imports target/production/wbuild/vara-runtime/vara_runtime.wasm + + - name: "Artifact: Development binaries" + run: | + cp target/production/wbuild/gear-runtime/gear_runtime.compact.compressed.wasm "artifact/dev_gear_v$GEAR_SPEC.wasm" + cp target/production/wbuild/vara-runtime/vara_runtime.compact.compressed.wasm "artifact/dev_vara_v$VARA_SPEC.wasm" + cp target/production/gear artifact/dev-gear + strip artifact/dev-gear || true + - name: Publish uses: softprops/action-gh-release@v1 with: diff --git a/gsdk/build.rs b/gsdk/build.rs index 992126a4a46..a7e74efbc13 100644 --- a/gsdk/build.rs +++ b/gsdk/build.rs @@ -40,11 +40,7 @@ fn generate_api() -> Vec { // NOTE: use vara here since vara includes all pallets gear have, // and the API we are building here is for both vara and gear. let [vara_runtime, api_gen] = [ - ( - VARA_RUNTIME_RELATIVE_PATH, - VARA_RUNTIME_PKG, - vec!["debug-mode"], - ), + (VARA_RUNTIME_RELATIVE_PATH, VARA_RUNTIME_PKG, vec!["dev"]), (GSDK_API_GEN_RELATIVE_PATH, GSDK_API_GEN_PKG, vec![]), ] .map(|(relative_path, pkg, features)| get_path(root, &profile, relative_path, pkg, features)); diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index 9c9633d0ce9..041944ca157 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -55,6 +55,6 @@ pallet-balances = { workspace = true, features = ["std"] } pallet-gear = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } testing = {workspace = true, features = ["vara-native"] } -vara-runtime = { workspace = true, features = ["std"] } +vara-runtime = { workspace = true, features = ["std", "dev"] } demo-mul-by-const.workspace = true env_logger.workspace = true diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index 022e3f13c0c..02fe1c8c9d2 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -86,10 +86,10 @@ runtime-benchmarks = [ runtime-benchmarks-checkers = [ "service/runtime-benchmarks-checkers", ] -debug-mode = [ - "service/debug-mode", - "gear-runtime?/debug-mode", - "vara-runtime?/debug-mode", +dev = [ + "service/dev", + "gear-runtime?/dev", + "vara-runtime?/dev", ] try-runtime = [ "service/try-runtime", diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index 42cf04ca104..d88945fd663 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -52,20 +52,32 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> Result, String> { Ok(match id { - #[cfg(feature = "gear-native")] + #[cfg(all(feature = "gear-native", feature = "dev"))] "dev" | "gear-dev" => Box::new(chain_spec::gear::development_config()?), - #[cfg(feature = "vara-native")] + #[cfg(all(feature = "vara-native", feature = "dev"))] "vara-dev" => Box::new(chain_spec::vara::development_config()?), #[cfg(feature = "gear-native")] - "local" | "gear-local" => Box::new(chain_spec::gear::local_testnet_config()?), + "local" | "gear-local" => { + #[cfg(feature = "dev")] + log::warn!("Running `gear-local` in `dev` mode"); + Box::new(chain_spec::gear::local_testnet_config()?) + } #[cfg(feature = "vara-native")] "vara" => Box::new(chain_spec::RawChainSpec::from_json_bytes( &include_bytes!("../../res/vara.json")[..], )?), #[cfg(feature = "vara-native")] - "vara-local" => Box::new(chain_spec::vara::local_testnet_config()?), + "vara-local" => { + #[cfg(feature = "dev")] + log::warn!("Running `vara-local` in `dev` mode"); + Box::new(chain_spec::vara::local_testnet_config()?) + } #[cfg(feature = "gear-native")] - "staging" | "gear-staging" => Box::new(chain_spec::gear::staging_testnet_config()?), + "staging" | "gear-staging" => { + #[cfg(feature = "dev")] + log::warn!("Running `gear-staging` in `dev` mode"); + Box::new(chain_spec::gear::staging_testnet_config()?) + } "test" | "" => Box::new(chain_spec::RawChainSpec::from_json_bytes( &include_bytes!("../../res/staging.json")[..], )?), @@ -75,24 +87,25 @@ impl SubstrateCli for Cli { let chain_spec = Box::new(chain_spec::RawChainSpec::from_json_file(path.clone())?) as Box; + if chain_spec.is_dev() { + #[cfg(not(feature = "dev"))] + return Err("Development runtimes are not available. Please compile the node with `-F dev` to enable it.".into()); + } + // When `force_*` is provide or the file name starts with the name of a known chain, // we use the chain spec for the specific chain. if self.run.force_vara || chain_spec.is_vara() { #[cfg(feature = "vara-native")] - { - Box::new(chain_spec::vara::ChainSpec::from_json_file(path)?) - } + return Ok(Box::new(chain_spec::vara::ChainSpec::from_json_file(path)?)); #[cfg(not(feature = "vara-native"))] - return Err("Vara runtime is not available. Please compile the node with `--features vara-native` to enable it.".into()); + return Err("Vara runtime is not available. Please compile the node with `-F vara-native` to enable it.".into()); } else { #[cfg(feature = "gear-native")] - { - Box::new(chain_spec::gear::ChainSpec::from_json_file(path)?) - } + return Ok(Box::new(chain_spec::gear::ChainSpec::from_json_file(path)?)); #[cfg(not(feature = "gear-native"))] - return Err("Gear runtime is not available. Please compile the node with default features to enable it.".into()); + return Err("Gear runtime is not available. Please compile the node with `-F gear-native` to enable it.".into()); } } }) diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 8a7149183bc..79ff6da306f 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -123,9 +123,9 @@ runtime-benchmarks-checkers = [ "gear-runtime?/runtime-benchmarks-checkers", "vara-runtime?/runtime-benchmarks-checkers", ] -debug-mode = [ - "gear-runtime?/debug-mode", - "vara-runtime?/debug-mode", +dev = [ + "gear-runtime?/dev", + "vara-runtime?/dev", ] try-runtime = [ "gear-runtime?/try-runtime", diff --git a/node/service/src/chain_spec/gear.rs b/node/service/src/chain_spec/gear.rs index 89c4fd29c96..d180fde5185 100644 --- a/node/service/src/chain_spec/gear.rs +++ b/node/service/src/chain_spec/gear.rs @@ -41,6 +41,7 @@ pub fn authority_keys_from_seed(s: &str) -> (AccountId, BabeId, GrandpaId) { ) } +#[cfg(feature = "dev")] pub fn development_config() -> Result { let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index 3122e7326d8..95bb0eb244f 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -91,6 +91,7 @@ pub fn authority_keys_from_seed( ) } +#[cfg(feature = "dev")] pub fn development_config() -> Result { let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?; diff --git a/node/testing/Cargo.toml b/node/testing/Cargo.toml index 807793fdf89..8607639dc26 100644 --- a/node/testing/Cargo.toml +++ b/node/testing/Cargo.toml @@ -72,5 +72,5 @@ std = [ "gear-runtime?/std", "vara-runtime?/std", ] -gear-native = ["gear-runtime"] -vara-native = ["vara-runtime"] +gear-native = ["gear-runtime/dev"] +vara-native = ["vara-runtime/dev"] diff --git a/pallets/gear-debug/Cargo.toml b/pallets/gear-debug/Cargo.toml index f4d0e4c3294..af5b894aecf 100644 --- a/pallets/gear-debug/Cargo.toml +++ b/pallets/gear-debug/Cargo.toml @@ -45,7 +45,7 @@ pallet-gear-bank = { workspace = true, features = ["std"] } pallet-gear-gas = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } pallet-gear-scheduler = { workspace = true, features = ["std"] } -pallet-gear-program = { workspace = true, features = ["debug-mode", "std"] } +pallet-gear-program = { workspace = true, features = ["dev", "std"] } gear-wasm-instrument.workspace = true demo-vec.workspace = true test-syscalls.workspace = true diff --git a/pallets/gear-debug/src/tests/mod.rs b/pallets/gear-debug/src/tests/mod.rs index 66d5b8b57ef..2008ae84895 100644 --- a/pallets/gear-debug/src/tests/mod.rs +++ b/pallets/gear-debug/src/tests/mod.rs @@ -159,7 +159,7 @@ fn debug_mode_works() { ) .expect("Failed to submit program"); - // Enable debug-mode + // Enable debug mode. DebugMode::::put(true); run_to_block(2, None); @@ -528,7 +528,7 @@ fn check_not_allocated_pages() { 0_u128, )); - // Enable debug-mode + // Enable debug mode. DebugMode::::put(true); run_to_block(2, None); @@ -756,7 +756,7 @@ fn check_changed_pages_in_storage() { 0_u128, )); - // Enable debug-mode + // Enable debug mode. DebugMode::::put(true); run_to_block(2, None); @@ -886,7 +886,7 @@ fn check_gear_stack_end() { 0_u128, )); - // Enable debug-mode + // Enable debug mode. DebugMode::::put(true); run_to_block(2, None); diff --git a/pallets/gear-program/Cargo.toml b/pallets/gear-program/Cargo.toml index 0dd3e2653b9..72b9afd28e1 100644 --- a/pallets/gear-program/Cargo.toml +++ b/pallets/gear-program/Cargo.toml @@ -55,4 +55,4 @@ std = [ "primitive-types/std", ] try-runtime = ["frame-support/try-runtime"] -debug-mode = [] +dev = [] diff --git a/pallets/gear-program/src/lib.rs b/pallets/gear-program/src/lib.rs index 8d6e8c0cea3..281366bac31 100644 --- a/pallets/gear-program/src/lib.rs +++ b/pallets/gear-program/src/lib.rs @@ -145,7 +145,7 @@ pub mod pallet { storage::*, CodeMetadata, Program, }; - #[cfg(feature = "debug-mode")] + #[cfg(feature = "dev")] use frame_support::storage::PrefixIterator; use frame_support::{ dispatch::EncodeLike, pallet_prelude::*, traits::StorageVersion, StoragePrefixedMap, @@ -388,7 +388,7 @@ pub mod pallet { type SessionMemoryPages = SessionMemoryPagesWrap; } - #[cfg(feature = "debug-mode")] + #[cfg(feature = "dev")] impl IterableMap<(ProgramId, Program>)> for pallet::Pallet { type DrainIter = PrefixIterator<(ProgramId, Program>)>; type Iter = PrefixIterator<(ProgramId, Program>)>; diff --git a/runtime/gear/Cargo.toml b/runtime/gear/Cargo.toml index 005773f2bed..fdd6f2deb3a 100644 --- a/runtime/gear/Cargo.toml +++ b/runtime/gear/Cargo.toml @@ -176,7 +176,7 @@ try-runtime = [ "validator-set/try-runtime", "runtime-common/try-runtime", ] -debug-mode = ["pallet-gear-debug", "pallet-gear-program/debug-mode"] +dev = ["pallet-gear-debug", "pallet-gear-program/dev"] lazy-pages = [ "pallet-gear/lazy-pages", "pallet-gear-payment/lazy-pages", diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index e7ed11281e6..6094556ebd9 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -89,7 +89,7 @@ pub use pallet_timestamp::Call as TimestampCall; pub use sp_runtime::BuildStorage; pub use pallet_gear; -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] pub use pallet_gear_debug; pub use pallet_gear_gas; pub use pallet_gear_payment; @@ -495,7 +495,7 @@ impl pallet_gear::Config for Runtime { type ProgramRentDisabledDelta = ConstU32<{ WEEKS * RENT_DISABLED_DELTA_WEEK_FACTOR }>; } -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] impl pallet_gear_debug::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_gear_debug::weights::GearSupportWeight; @@ -600,7 +600,7 @@ where // // While updating the indexes, please update the indexes in `gsdk/src/metadata/mod.rs` // as well, example: https://github.com/gear-tech/gear/pull/2370/commits/a82cb5ba365cf47aef2c42a285a1793a86e711c1 -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] construct_runtime!( pub enum Runtime where Block = Block, @@ -631,12 +631,12 @@ construct_runtime!( GearVoucher: pallet_gear_voucher = 106, GearBank: pallet_gear_bank = 107, - // Only available with "debug-mode" feature on + // Only available with "dev" feature on GearDebug: pallet_gear_debug = 199, } ); -#[cfg(not(feature = "debug-mode"))] +#[cfg(not(feature = "dev"))] construct_runtime!( pub enum Runtime where Block = Block, @@ -704,9 +704,9 @@ pub type Executive = frame_executive::Executive< #[cfg(test)] mod tests; -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] type DebugInfo = GearDebug; -#[cfg(not(feature = "debug-mode"))] +#[cfg(not(feature = "dev"))] type DebugInfo = (); #[cfg(feature = "runtime-benchmarks")] diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index dcfed171e56..74551fefa6d 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -255,7 +255,7 @@ try-runtime = [ "pallet-bags-list/try-runtime", "runtime-common/try-runtime", ] -debug-mode = ["pallet-gear-debug", "pallet-gear-program/debug-mode"] +dev = ["pallet-gear-debug", "pallet-gear-program/dev"] lazy-pages = [ "pallet-gear/lazy-pages", "pallet-gear-payment/lazy-pages", diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 6317db2cc24..7b9f86b4447 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -104,7 +104,7 @@ pub use pallet_sudo::Call as SudoCall; pub use sp_runtime::BuildStorage; pub use pallet_gear; -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] pub use pallet_gear_debug; pub use pallet_gear_gas; pub use pallet_gear_payment; @@ -988,7 +988,7 @@ impl pallet_gear::Config for Runtime { type ProgramRentDisabledDelta = ConstU32<{ WEEKS * RENT_DISABLED_DELTA_WEEK_FACTOR }>; } -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] impl pallet_gear_debug::Config for Runtime { type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_gear_debug::weights::GearSupportWeight; @@ -1104,7 +1104,7 @@ impl pallet_vesting::Config for Runtime { } // Create the runtime by composing the FRAME pallets that were previously configured. -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] construct_runtime!( pub enum Runtime where Block = Block, @@ -1163,12 +1163,12 @@ construct_runtime!( // NOTE (!): `pallet_airdrop` used to be idx(198). - // Only available with "debug-mode" feature on + // Only available with "dev" feature on GearDebug: pallet_gear_debug = 199, } ); -#[cfg(not(feature = "debug-mode"))] +#[cfg(not(feature = "dev"))] construct_runtime!( pub enum Runtime where Block = Block, @@ -1269,9 +1269,9 @@ mod tests; #[cfg(test)] mod integration_tests; -#[cfg(feature = "debug-mode")] +#[cfg(feature = "dev")] type DebugInfo = GearDebug; -#[cfg(not(feature = "debug-mode"))] +#[cfg(not(feature = "dev"))] type DebugInfo = (); #[cfg(feature = "runtime-benchmarks")] diff --git a/scripts/update-gsdk-metadata.sh b/scripts/update-gsdk-metadata.sh index 8ae3903eae0..b28692c0b81 100755 --- a/scripts/update-gsdk-metadata.sh +++ b/scripts/update-gsdk-metadata.sh @@ -5,7 +5,7 @@ set -ex -cargo build --package vara-runtime --features debug-mode --release +cargo build --package vara-runtime --features dev --release cargo build --package gsdk-api-gen --release touch gsdk/build.rs GSDK_API_GEN=1 cargo build --package gsdk --release From 30af61477b9c6c16c49b5f601d6e6aac41d13f58 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 22:15:27 +0400 Subject: [PATCH 143/165] fix(node): Throw error on `--dev` in case of non-dev build (#3280) --- Makefile | 4 ++-- node/cli/src/command.rs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0a253551404..347a011742a 100644 --- a/Makefile +++ b/Makefile @@ -46,11 +46,11 @@ examples-proc: wasm-proc-release .PHONY: node node: - @ ./scripts/gear.sh build node + @ ./scripts/gear.sh build node -F dev .PHONY: node-release node-release: - @ ./scripts/gear.sh build node --release + @ ./scripts/gear.sh build node -F dev --release .PHONY: vara vara: diff --git a/node/cli/src/command.rs b/node/cli/src/command.rs index d88945fd663..4daf4785562 100644 --- a/node/cli/src/command.rs +++ b/node/cli/src/command.rs @@ -52,6 +52,8 @@ impl SubstrateCli for Cli { fn load_spec(&self, id: &str) -> Result, String> { Ok(match id { + #[cfg(not(feature = "dev"))] + "dev" | "gear-dev" | "vara-dev" => return Err("Development runtimes are not available. Please compile the node with `-F dev` to enable it.".into()), #[cfg(all(feature = "gear-native", feature = "dev"))] "dev" | "gear-dev" => Box::new(chain_spec::gear::development_config()?), #[cfg(all(feature = "vara-native", feature = "dev"))] From 9eea531dae180c7150a8e0566f67b56967a73d35 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Fri, 15 Sep 2023 22:15:39 +0400 Subject: [PATCH 144/165] chore(v1.0.0): Remove `pallet-sudo` from production Vara (#3279) --- .github/workflows/build.yml | 8 +++--- .github/workflows/test-measurements.yaml | 2 +- Cargo.lock | 2 ++ node/authorship/Cargo.toml | 1 + node/service/src/chain_spec/vara.rs | 8 +++++- node/testing/Cargo.toml | 5 ++-- runtime/vara/Cargo.toml | 12 +++++--- runtime/vara/src/lib.rs | 32 ++++++++++++++-------- scripts/benchmarking/run_all_benchmarks.sh | 2 +- 9 files changed, 47 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 190dfc4f524..7dc8cfc4c84 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,7 +66,7 @@ jobs: run: ./scripts/gear.sh init cargo - name: "Build: Gear" - run: ./scripts/gear.sh build gear --locked --release + run: ./scripts/gear.sh build gear -F gear-cli/dev --locked --release - name: "Build fuzzer" run: ./scripts/gear.sh build fuzz --locked --release @@ -96,7 +96,7 @@ jobs: - name: "Test: Runtime benchmarks and benchmark tests work" run: | - cargo build -p gear-cli --release --features=runtime-benchmarks,runtime-benchmarks-checkers + cargo build -p gear-cli --release --features=dev,runtime-benchmarks,runtime-benchmarks-checkers # check that perf benchmarks works. `--steps=20` need to test, that benchmarks works for different input number. ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 # check that read_big_state benchmarks works @@ -111,11 +111,11 @@ jobs: - name: "Test: `try-runtime` feature tests" run: | - cargo test -p "pallet-*" --features try-runtime --release --locked + cargo test -p "pallet-*" --features try-runtime,dev --release --locked - name: "Test: Try runtime migrations" run: | - cargo build -p gear-cli --features try-runtime --release --locked + cargo build -p gear-cli --features try-runtime,dev --release --locked ./target/release/gear try-runtime --runtime ./target/release/wbuild/gear-runtime/gear_runtime.wasm on-runtime-upgrade --checks live --uri wss://rpc-private-testnet.gear-tech.io:443 env: RUST_LOG: info diff --git a/.github/workflows/test-measurements.yaml b/.github/workflows/test-measurements.yaml index 1368cadb136..b9c3a16a657 100644 --- a/.github/workflows/test-measurements.yaml +++ b/.github/workflows/test-measurements.yaml @@ -42,7 +42,7 @@ jobs: tar -xf /cache/check_cargo_registry_${{ github.ref_name }}.tar -C / - name: "Build: Gear" - run: ./scripts/gear.sh build gear --release --locked --features=runtime-benchmarks,lazy-pages + run: ./scripts/gear.sh build gear --release --locked --features=dev,runtime-benchmarks,lazy-pages - name: "Collect: Gear workspace tests" run: | diff --git a/Cargo.lock b/Cargo.lock index f51d1120230..108999619f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3745,6 +3745,7 @@ dependencies = [ "gear-common", "gear-node-testing", "gear-runtime-primitives", + "gear-service", "log", "pallet-balances", "pallet-gear", @@ -4046,6 +4047,7 @@ dependencies = [ "gear-runtime", "gear-runtime-interface", "gear-runtime-primitives", + "gear-service", "log", "pallet-gear-rpc-runtime-api", "parity-scale-codec", diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index 041944ca157..7b474e043a6 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -58,3 +58,4 @@ testing = {workspace = true, features = ["vara-native"] } vara-runtime = { workspace = true, features = ["std", "dev"] } demo-mul-by-const.workspace = true env_logger.workspace = true +service = { workspace = true, features = ["dev", "vara-native"] } diff --git a/node/service/src/chain_spec/vara.rs b/node/service/src/chain_spec/vara.rs index 95bb0eb244f..3245ae1aef5 100644 --- a/node/service/src/chain_spec/vara.rs +++ b/node/service/src/chain_spec/vara.rs @@ -27,11 +27,13 @@ use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_grandpa::AuthorityId as GrandpaId; use sp_core::{crypto::UncheckedInto, sr25519}; use sp_runtime::{Perbill, Perquintill}; +#[cfg(feature = "dev")] +use vara_runtime::SudoConfig; use vara_runtime::{ constants::currency::{ECONOMIC_UNITS, EXISTENTIAL_DEPOSIT, UNITS as TOKEN}, AuthorityDiscoveryConfig, BabeConfig, BalancesConfig, GenesisConfig, GrandpaConfig, ImOnlineConfig, NominationPoolsConfig, SessionConfig, SessionKeys, StakerStatus, StakingConfig, - StakingRewardsConfig, SudoConfig, SystemConfig, VestingConfig, WASM_BINARY, + StakingRewardsConfig, SystemConfig, VestingConfig, WASM_BINARY, }; /// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type. @@ -558,6 +560,9 @@ fn testnet_genesis( bank_account: AccountId, _enable_println: bool, ) -> GenesisConfig { + #[cfg(not(feature = "dev"))] + let _ = root_key; + const ENDOWMENT: u128 = 1_000_000 * TOKEN; const STASH: u128 = 100 * TOKEN; const MIN_NOMINATOR_BOND: u128 = 50 * TOKEN; @@ -609,6 +614,7 @@ fn testnet_genesis( min_nominator_bond: MIN_NOMINATOR_BOND, ..Default::default() }, + #[cfg(feature = "dev")] sudo: SudoConfig { // Assign network admin rights. key: Some(root_key), diff --git a/node/testing/Cargo.toml b/node/testing/Cargo.toml index 8607639dc26..6706a388f32 100644 --- a/node/testing/Cargo.toml +++ b/node/testing/Cargo.toml @@ -25,6 +25,7 @@ pallet-gear-rpc-runtime-api.workspace = true gear-runtime = { workspace = true, optional = true } vara-runtime = { workspace = true, optional = true } gear-runtime-interface.workspace = true +service = { workspace = true, features = ["dev"] } # Substrate Client sc-block-builder.workspace = true @@ -72,5 +73,5 @@ std = [ "gear-runtime?/std", "vara-runtime?/std", ] -gear-native = ["gear-runtime/dev"] -vara-native = ["vara-runtime/dev"] +gear-native = ["gear-runtime/dev", "service/gear-native"] +vara-native = ["vara-runtime/dev", "service/vara-native"] diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index 74551fefa6d..f179c2bd346 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -49,7 +49,7 @@ pallet-referenda.workspace = true pallet-scheduler.workspace = true pallet-session = { workspace = true, features = [ "historical" ] } pallet-staking.workspace = true -pallet-sudo.workspace = true +pallet-sudo = { workspace = true, optional = true } pallet-timestamp.workspace = true pallet-transaction-payment.workspace = true pallet-treasury.workspace = true @@ -157,7 +157,7 @@ std = [ "pallet-session/std", "pallet-scheduler/std", "pallet-staking/std", - "pallet-sudo/std", + "pallet-sudo?/std", "pallet-timestamp/std", "pallet-transaction-payment/std", "pallet-transaction-payment-rpc-runtime-api/std", @@ -245,7 +245,7 @@ try-runtime = [ "pallet-scheduler/try-runtime", "pallet-session/try-runtime", "pallet-staking/try-runtime", - "pallet-sudo/try-runtime", + "pallet-sudo?/try-runtime", "pallet-timestamp/try-runtime", "pallet-transaction-payment/try-runtime", "pallet-treasury/try-runtime", @@ -255,7 +255,11 @@ try-runtime = [ "pallet-bags-list/try-runtime", "runtime-common/try-runtime", ] -dev = ["pallet-gear-debug", "pallet-gear-program/dev"] +dev = [ + "pallet-gear-debug", + "pallet-gear-program/dev", + "pallet-sudo", +] lazy-pages = [ "pallet-gear/lazy-pages", "pallet-gear-payment/lazy-pages", diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 7b9f86b4447..fee12da3048 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -98,7 +98,7 @@ pub use frame_system::Call as SystemCall; pub use pallet_balances::Call as BalancesCall; #[cfg(any(feature = "std", test))] pub use pallet_staking::StakerStatus; -#[cfg(any(feature = "std", test))] +#[cfg(all(feature = "dev", any(feature = "std", test)))] pub use pallet_sudo::Call as SudoCall; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; @@ -798,6 +798,7 @@ impl pallet_identity::Config for Runtime { type WeightInfo = pallet_identity::weights::SubstrateWeight; } +#[cfg(feature = "dev")] impl pallet_sudo::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; @@ -869,13 +870,23 @@ impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => !matches!( - c, - RuntimeCall::Balances(..) - | RuntimeCall::Sudo(..) - | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) - | RuntimeCall::Vesting(pallet_vesting::Call::force_vested_transfer { .. }) - ), + ProxyType::NonTransfer => { + #[cfg(feature = "dev")] + return !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Sudo(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Vesting(pallet_vesting::Call::force_vested_transfer { .. }) + ); + #[cfg(not(feature = "dev"))] + return !matches!( + c, + RuntimeCall::Balances(..) + | RuntimeCall::Vesting(pallet_vesting::Call::vested_transfer { .. }) + | RuntimeCall::Vesting(pallet_vesting::Call::force_vested_transfer { .. }) + ); + } ProxyType::Governance => matches!( c, RuntimeCall::Treasury(..) @@ -1158,7 +1169,6 @@ construct_runtime!( GearVoucher: pallet_gear_voucher = 107, GearBank: pallet_gear_bank = 108, - // TODO: Remove in stage 3 Sudo: pallet_sudo = 99, // NOTE (!): `pallet_airdrop` used to be idx(198). @@ -1222,9 +1232,7 @@ construct_runtime!( GearVoucher: pallet_gear_voucher = 107, GearBank: pallet_gear_bank = 108, - // TODO: Remove in stage 3 - Sudo: pallet_sudo = 99, - + // NOTE (!): `pallet_sudo` used to be idx(99). // NOTE (!): `pallet_airdrop` used to be idx(198). } ); diff --git a/scripts/benchmarking/run_all_benchmarks.sh b/scripts/benchmarking/run_all_benchmarks.sh index 87c957ca3f4..caa838da4f2 100755 --- a/scripts/benchmarking/run_all_benchmarks.sh +++ b/scripts/benchmarking/run_all_benchmarks.sh @@ -58,7 +58,7 @@ done if [ "$skip_build" != true ] then echo "[+] Compiling Gear benchmarks..." - cargo build --profile=production --locked --features=runtime-benchmarks + cargo build --profile=production --locked --features=dev,runtime-benchmarks fi # The executable to use. From 604d713569fb817982da88706e5d00c23c67bb86 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Sat, 16 Sep 2023 11:33:27 +0800 Subject: [PATCH 145/165] chore(scripts): sync doc test command with the help message (#3223) --- .github/workflows/check.yml | 2 +- Makefile | 2 +- scripts/gear.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c69b1afdf27..5d0588a862e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -43,7 +43,7 @@ jobs: run: ./scripts/gear.sh clippy examples --all-targets --locked - name: "Test: Doc tests" - run: ./scripts/gear.sh test doc + run: ./scripts/gear.sh test docs - name: "Test: Changes in gsdk generated code" run: | diff --git a/Makefile b/Makefile index 347a011742a..23d3f966ed4 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,7 @@ test-release: test-gear-release .PHONY: test-doc test-doc: - @ ./scripts/gear.sh test doc + @ ./scripts/gear.sh test docs .PHONY: test-gear test-gear: #\ diff --git a/scripts/gear.sh b/scripts/gear.sh index e74c01c7145..05161f5c741 100755 --- a/scripts/gear.sh +++ b/scripts/gear.sh @@ -309,7 +309,7 @@ case "$COMMAND" in header "Running syscalls integrity test of pallet-gear 'benchmarking' module on WASMI executor" syscalls_integrity_test "$@"; ;; - doc) + docs) header "Testing examples in docs" doc_test "$ROOT_DIR/Cargo.toml" "$@"; ;; From 50a4ec10b145d793ba112d29092e64287f8400c4 Mon Sep 17 00:00:00 2001 From: Georgy Shepelev Date: Sun, 17 Sep 2023 20:30:16 +0400 Subject: [PATCH 146/165] refactor(node): Benchmark tasks and reduce GasAllowance accordingly (#2797) --- Cargo.lock | 2 + Cargo.toml | 8 +- common/src/lib.rs | 15 +- common/src/scheduler/task.rs | 28 +- examples/constructor/Cargo.toml | 4 +- examples/constructor/build.rs | 6 +- examples/constructor/src/arg.rs | 2 +- examples/constructor/src/call.rs | 2 +- examples/constructor/src/lib.rs | 10 +- .../src/scheme/demo_proxy_with_gas.rs | 2 +- examples/delayed-sender/Cargo.toml | 3 +- examples/delayed-sender/build.rs | 6 +- examples/delayed-sender/src/code.rs | 18 + examples/delayed-sender/src/lib.rs | 7 +- examples/init-wait/Cargo.toml | 9 +- examples/init-wait/build.rs | 6 +- examples/init-wait/src/code.rs | 18 + examples/init-wait/src/lib.rs | 24 +- examples/reserve-gas/Cargo.toml | 3 +- examples/reserve-gas/build.rs | 6 +- examples/reserve-gas/src/lib.rs | 6 +- examples/wait_wake/build.rs | 6 +- examples/waiter/Cargo.toml | 8 +- examples/waiter/build.rs | 6 +- examples/waiter/src/code.rs | 28 +- examples/waiter/src/lib.rs | 30 +- gclient/Cargo.toml | 4 +- gsdk/Cargo.toml | 2 +- gsdk/tests/rpc.rs | 2 +- pallets/gear-scheduler/src/tests.rs | 15 +- pallets/gear/Cargo.toml | 15 + pallets/gear/src/benchmarking/mod.rs | 122 +++++- pallets/gear/src/benchmarking/tasks.rs | 371 ++++++++++++++++++ pallets/gear/src/lib.rs | 58 ++- pallets/gear/src/manager/task.rs | 164 ++++++-- pallets/gear/src/mock.rs | 2 +- pallets/gear/src/tests.rs | 37 +- pallets/gear/src/weights.rs | 231 +++++++++++ runtime/gear/src/weights/pallet_gear.rs | 231 +++++++++++ runtime/vara/src/weights/pallet_gear.rs | 231 +++++++++++ 40 files changed, 1595 insertions(+), 153 deletions(-) create mode 100644 pallets/gear/src/benchmarking/tasks.rs diff --git a/Cargo.lock b/Cargo.lock index 108999619f0..76d3ff7a82e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1903,6 +1903,7 @@ dependencies = [ name = "demo-constructor" version = "0.1.0" dependencies = [ + "gcore", "gear-wasm-builder", "gstd", "hex", @@ -2314,6 +2315,7 @@ version = "0.1.0" dependencies = [ "demo-waiter", "futures", + "gcore", "gear-core", "gear-wasm-builder", "gstd", diff --git a/Cargo.toml b/Cargo.toml index 108d5011b92..1b581dac2b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -371,7 +371,7 @@ demo-calc-hash-in-one-block = { path = "examples/calc-hash/in-one-block" } demo-calc-hash-over-blocks = { path = "examples/calc-hash/over-blocks" } demo-custom = { path = "examples/custom" } demo-compose = { path = "examples/compose" } -demo-constructor = { path = "examples/constructor" } +demo-constructor = { path = "examples/constructor", default-features = false } demo-delayed-sender = { path = "examples/delayed-sender" } demo-distributor = { path = "examples/distributor" } demo-futures-unordered = { path = "examples/futures-unordered", features = ["debug"] } @@ -379,7 +379,7 @@ demo-gas-burned = { path = "examples/gas-burned" } demo-fungible-token = { path = "examples/fungible-token" } demo-incomplete-async-payloads = { path = "examples/incomplete-async-payloads" } demo-init-fail-sender = { path = "examples/init-fail-sender" } -demo-init-wait = { path = "examples/init-wait" } +demo-init-wait = { path = "examples/init-wait", default-features = false } demo-init-wait-reply-exit = { path = "examples/init-wait-reply-exit" } demo-messager = { path = "examples/messager" } demo-meta-io = { path = "examples/new-meta/io" } @@ -396,7 +396,7 @@ demo-proxy-relay = { path = "examples/proxy-relay" } demo-proxy-reservation-with-gas = { path = "examples/proxy-reservation-with-gas" } demo-read-big-state = { path = "examples/read-big-state", default-features = false } demo-reservation-manager = { path = "examples/reservation-manager" } -demo-reserve-gas = { path = "examples/reserve-gas" } +demo-reserve-gas = { path = "examples/reserve-gas", default-features = false } demo-rwlock = { path = "examples/rwlock" } demo-send-from-reservation = { path = "examples/send-from-reservation" } demo-signal-entry = { path = "examples/signal-entry" } @@ -404,7 +404,7 @@ demo-state-rollback = { path = "examples/state-rollback" } demo-sync-duplicate = { path = "examples/sync-duplicate" } demo-vec = { path = "examples/vec" } demo-wait = { path = "examples/wait" } -demo-waiter = { path = "examples/waiter" } +demo-waiter = { path = "examples/waiter", default-features = false } demo-wait-timeout = { path = "examples/wait-timeout" } demo-wait-wake = { path = "examples/wait_wake" } demo-waiting-proxy = { path = "examples/waiting-proxy" } diff --git a/common/src/lib.rs b/common/src/lib.rs index 3d4873bb6a2..64f47fd4aa4 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -73,6 +73,9 @@ pub use gas_provider::{ LockId, LockableTree, Provider as GasProvider, ReservableTree, Tree as GasTree, }; +/// Type alias for gas entity. +pub type Gas = u64; + pub trait Origin: Sized { fn into_origin(self) -> H256; fn from_origin(val: H256) -> Self; @@ -228,18 +231,6 @@ impl Program { }) ) } - - pub fn is_uninitialized(&self) -> Option { - if let Program::Active(ActiveProgram { - state: ProgramState::Uninitialized { message_id }, - .. - }) = self - { - Some(*message_id) - } else { - None - } - } } #[derive(Clone, Debug, derive_more::Display)] diff --git a/common/src/scheduler/task.rs b/common/src/scheduler/task.rs index ebeb0ff7e78..cbfd0575943 100644 --- a/common/src/scheduler/task.rs +++ b/common/src/scheduler/task.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::paused_program_storage::SessionId; +use crate::{paused_program_storage::SessionId, Gas}; use frame_support::{ codec::{self, Decode, Encode, MaxEncodedLen}, scale_info::{self, TypeInfo}, @@ -85,7 +85,7 @@ pub enum ScheduledTask { } impl ScheduledTask { - pub fn process_with(self, handler: &mut impl TaskHandler) { + pub fn process_with(self, handler: &mut impl TaskHandler) -> Gas { use ScheduledTask::*; match self { @@ -117,32 +117,36 @@ pub trait TaskHandler { // Rent charging section. // ----- /// Pause program action. - fn pause_program(&mut self, program_id: ProgramId); + fn pause_program(&mut self, program_id: ProgramId) -> Gas; /// Remove code action. - fn remove_code(&mut self, code_id: CodeId); + fn remove_code(&mut self, code_id: CodeId) -> Gas; /// Remove from mailbox action. - fn remove_from_mailbox(&mut self, user_id: AccountId, message_id: MessageId); + fn remove_from_mailbox(&mut self, user_id: AccountId, message_id: MessageId) -> Gas; /// Remove from waitlist action. - fn remove_from_waitlist(&mut self, program_id: ProgramId, message_id: MessageId); + fn remove_from_waitlist(&mut self, program_id: ProgramId, message_id: MessageId) -> Gas; /// Remove paused program action. - fn remove_paused_program(&mut self, program_id: ProgramId); + fn remove_paused_program(&mut self, program_id: ProgramId) -> Gas; // Time chained section. // ----- /// Wake message action. - fn wake_message(&mut self, program_id: ProgramId, message_id: MessageId); + fn wake_message(&mut self, program_id: ProgramId, message_id: MessageId) -> Gas; // Send delayed message to program action. - fn send_dispatch(&mut self, stashed_message_id: MessageId); + fn send_dispatch(&mut self, stashed_message_id: MessageId) -> Gas; // Send delayed message to user action. - fn send_user_message(&mut self, stashed_message_id: MessageId, to_mailbox: bool); + fn send_user_message(&mut self, stashed_message_id: MessageId, to_mailbox: bool) -> Gas; /// Remove gas reservation action. - fn remove_gas_reservation(&mut self, program_id: ProgramId, reservation_id: ReservationId); + fn remove_gas_reservation( + &mut self, + program_id: ProgramId, + reservation_id: ReservationId, + ) -> Gas; /// Remove data created by resume program session. - fn remove_resume_session(&mut self, session_id: SessionId); + fn remove_resume_session(&mut self, session_id: SessionId) -> Gas; } #[test] diff --git a/examples/constructor/Cargo.toml b/examples/constructor/Cargo.toml index 10782f0558e..383ed6e29f7 100644 --- a/examples/constructor/Cargo.toml +++ b/examples/constructor/Cargo.toml @@ -7,6 +7,7 @@ license.workspace = true workspace = "../../" [dependencies] +gcore.workspace = true gstd.workspace = true parity-scale-codec = { workspace = true, features = ["derive"] } hex.workspace = true @@ -16,5 +17,6 @@ gear-wasm-builder.workspace = true [features] debug = ["gstd/debug"] -std = [] +wasm-wrapper = [] +std = ["wasm-wrapper"] default = ["std"] diff --git a/examples/constructor/build.rs b/examples/constructor/build.rs index 4c502a3ddee..b911ce127bb 100644 --- a/examples/constructor/build.rs +++ b/examples/constructor/build.rs @@ -16,6 +16,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use gear_wasm_builder::WasmBuilder; + fn main() { - gear_wasm_builder::build(); + WasmBuilder::new() + .exclude_features(vec!["std", "wasm-wrapper"]) + .build(); } diff --git a/examples/constructor/src/arg.rs b/examples/constructor/src/arg.rs index 2d78edf7576..b749bbc03b7 100644 --- a/examples/constructor/src/arg.rs +++ b/examples/constructor/src/arg.rs @@ -90,7 +90,7 @@ impl From<&'static str> for Arg { } } -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "wasm-wrapper"))] mod wasm { use super::*; diff --git a/examples/constructor/src/call.rs b/examples/constructor/src/call.rs index 0287abd0db5..06c0fde0edb 100644 --- a/examples/constructor/src/call.rs +++ b/examples/constructor/src/call.rs @@ -44,7 +44,7 @@ pub enum Call { Loop, } -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "wasm-wrapper"))] mod wasm { use super::*; use crate::DATA; diff --git a/examples/constructor/src/lib.rs b/examples/constructor/src/lib.rs index d112fb3d26b..0ebc224368d 100644 --- a/examples/constructor/src/lib.rs +++ b/examples/constructor/src/lib.rs @@ -16,22 +16,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] extern crate alloc; -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "wasm-wrapper"))] mod wasm; -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "wasm-wrapper"))] pub(crate) use wasm::DATA; -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] mod code { include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); } -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] pub use code::WASM_BINARY_OPT as WASM_BINARY; mod arg; diff --git a/examples/constructor/src/scheme/demo_proxy_with_gas.rs b/examples/constructor/src/scheme/demo_proxy_with_gas.rs index 35c33e3b6c1..70b7e2a1ba5 100644 --- a/examples/constructor/src/scheme/demo_proxy_with_gas.rs +++ b/examples/constructor/src/scheme/demo_proxy_with_gas.rs @@ -1,5 +1,5 @@ use crate::{Arg, Call, Calls, Scheme}; -use gstd::errors::{ReplyCode, SuccessReplyReason}; +use gcore::errors::{ReplyCode, SuccessReplyReason}; use parity_scale_codec::Encode; pub const PROXIED_MESSAGE: &[u8] = b"proxied message"; diff --git a/examples/delayed-sender/Cargo.toml b/examples/delayed-sender/Cargo.toml index e23c5e2f310..7c386c1b22a 100644 --- a/examples/delayed-sender/Cargo.toml +++ b/examples/delayed-sender/Cargo.toml @@ -14,5 +14,6 @@ gear-wasm-builder.workspace = true [features] debug = ["gstd/debug"] -std = [ ] +wasm-wrapper = [] +std = ["wasm-wrapper"] default = ["std"] diff --git a/examples/delayed-sender/build.rs b/examples/delayed-sender/build.rs index 4c502a3ddee..b911ce127bb 100644 --- a/examples/delayed-sender/build.rs +++ b/examples/delayed-sender/build.rs @@ -16,6 +16,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use gear_wasm_builder::WasmBuilder; + fn main() { - gear_wasm_builder::build(); + WasmBuilder::new() + .exclude_features(vec!["std", "wasm-wrapper"]) + .build(); } diff --git a/examples/delayed-sender/src/code.rs b/examples/delayed-sender/src/code.rs index 3107b539988..c1c1c2d61f8 100644 --- a/examples/delayed-sender/src/code.rs +++ b/examples/delayed-sender/src/code.rs @@ -1,3 +1,21 @@ +// This file is part of Gear. + +// Copyright (C) Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + use gstd::{msg, MessageId, exec}; static mut MID: Option = None; diff --git a/examples/delayed-sender/src/lib.rs b/examples/delayed-sender/src/lib.rs index 9348dfb7a52..1175ebd0d91 100644 --- a/examples/delayed-sender/src/lib.rs +++ b/examples/delayed-sender/src/lib.rs @@ -15,17 +15,18 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . + #![no_std] -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] mod code { include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); } -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] pub use code::WASM_BINARY_OPT as WASM_BINARY; -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "wasm-wrapper"))] mod wasm { include! {"./code.rs"} } diff --git a/examples/init-wait/Cargo.toml b/examples/init-wait/Cargo.toml index 8b0d9b0b238..5a7c643798f 100644 --- a/examples/init-wait/Cargo.toml +++ b/examples/init-wait/Cargo.toml @@ -2,8 +2,8 @@ name = "demo-init-wait" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" +edition.workspace = true +license.workspace = true workspace = "../../" [dependencies] @@ -12,9 +12,8 @@ gstd.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] -std = [] +wasm-wrapper = [] +std = ["wasm-wrapper"] default = ["std"] diff --git a/examples/init-wait/build.rs b/examples/init-wait/build.rs index 4c502a3ddee..b911ce127bb 100644 --- a/examples/init-wait/build.rs +++ b/examples/init-wait/build.rs @@ -16,6 +16,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use gear_wasm_builder::WasmBuilder; + fn main() { - gear_wasm_builder::build(); + WasmBuilder::new() + .exclude_features(vec!["std", "wasm-wrapper"]) + .build(); } diff --git a/examples/init-wait/src/code.rs b/examples/init-wait/src/code.rs index 432a5fe94f1..c6ef0bc9edc 100644 --- a/examples/init-wait/src/code.rs +++ b/examples/init-wait/src/code.rs @@ -1,3 +1,21 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + use gstd::{exec, msg, collections::BTreeMap, MessageId}; #[derive(PartialEq, Debug)] diff --git a/examples/init-wait/src/lib.rs b/examples/init-wait/src/lib.rs index e5e4ef17484..a4fc7ea8b42 100644 --- a/examples/init-wait/src/lib.rs +++ b/examples/init-wait/src/lib.rs @@ -1,14 +1,32 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #![cfg_attr(not(feature = "std"), no_std)] -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] mod code { include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); } -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] pub use code::WASM_BINARY_OPT as WASM_BINARY; -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "wasm-wrapper"))] mod wasm { include! {"./code.rs"} } diff --git a/examples/reserve-gas/Cargo.toml b/examples/reserve-gas/Cargo.toml index aef27afb79c..132b43911fa 100644 --- a/examples/reserve-gas/Cargo.toml +++ b/examples/reserve-gas/Cargo.toml @@ -18,5 +18,6 @@ gtest.workspace = true [features] debug = ["gstd/debug"] -std = [] +wasm-wrapper = [] +std = ["wasm-wrapper", "parity-scale-codec/std"] default = ["std"] diff --git a/examples/reserve-gas/build.rs b/examples/reserve-gas/build.rs index 4c502a3ddee..b911ce127bb 100644 --- a/examples/reserve-gas/build.rs +++ b/examples/reserve-gas/build.rs @@ -16,6 +16,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use gear_wasm_builder::WasmBuilder; + fn main() { - gear_wasm_builder::build(); + WasmBuilder::new() + .exclude_features(vec!["std", "wasm-wrapper"]) + .build(); } diff --git a/examples/reserve-gas/src/lib.rs b/examples/reserve-gas/src/lib.rs index da47e95a438..7644c983bb7 100644 --- a/examples/reserve-gas/src/lib.rs +++ b/examples/reserve-gas/src/lib.rs @@ -23,12 +23,12 @@ extern crate alloc; use alloc::vec::Vec; use parity_scale_codec::{Decode, Encode}; -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] mod code { include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); } -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] pub use code::WASM_BINARY_OPT as WASM_BINARY; pub const RESERVATION_AMOUNT: u64 = 50_000_000; @@ -62,7 +62,7 @@ pub enum ReplyAction { pub type GasAmount = u64; pub type BlockCount = u32; -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "wasm-wrapper"))] mod wasm { use super::*; use gstd::{ diff --git a/examples/wait_wake/build.rs b/examples/wait_wake/build.rs index 4c502a3ddee..b911ce127bb 100644 --- a/examples/wait_wake/build.rs +++ b/examples/wait_wake/build.rs @@ -16,6 +16,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use gear_wasm_builder::WasmBuilder; + fn main() { - gear_wasm_builder::build(); + WasmBuilder::new() + .exclude_features(vec!["std", "wasm-wrapper"]) + .build(); } diff --git a/examples/waiter/Cargo.toml b/examples/waiter/Cargo.toml index a72ef94b3a5..3090fc3f7a0 100644 --- a/examples/waiter/Cargo.toml +++ b/examples/waiter/Cargo.toml @@ -2,14 +2,15 @@ name = "demo-waiter" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" +edition.workspace = true +license.workspace = true workspace = "../../" [dependencies] parity-scale-codec = { workspace = true, features = ["derive"] } futures.workspace = true gstd.workspace = true +gcore.workspace = true [build-dependencies] gear-wasm-builder.workspace = true @@ -23,5 +24,6 @@ demo-waiter = { path = ".", features = ["debug"] } [features] debug = ["gstd/debug"] -std = ["parity-scale-codec/std"] +wasm-wrapper = [] +std = ["parity-scale-codec/std", "wasm-wrapper"] default = ["std"] diff --git a/examples/waiter/build.rs b/examples/waiter/build.rs index 4c502a3ddee..b911ce127bb 100644 --- a/examples/waiter/build.rs +++ b/examples/waiter/build.rs @@ -16,6 +16,10 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +use gear_wasm_builder::WasmBuilder; + fn main() { - gear_wasm_builder::build(); + WasmBuilder::new() + .exclude_features(vec!["std", "wasm-wrapper"]) + .build(); } diff --git a/examples/waiter/src/code.rs b/examples/waiter/src/code.rs index 9bc91cb726d..7a68dd08957 100644 --- a/examples/waiter/src/code.rs +++ b/examples/waiter/src/code.rs @@ -1,3 +1,21 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + use crate::{ Command, LockContinuation, LockStaticAccessSubcommand, MxLockContinuation, RwLockContinuation, RwLockType, SleepForWaitType, WaitSubcommand, @@ -22,33 +40,33 @@ async fn main() { match cmd { Command::Wait(subcommand) => process_wait_subcommand(subcommand), Command::SendFor(to, duration) => { - msg::send_bytes_for_reply(to, [], 0, 0) + msg::send_bytes_for_reply(to.into(), [], 0, 0) .expect("send message failed") .exactly(Some(duration)) .expect("Invalid wait duration.") .await; } Command::SendUpTo(to, duration) => { - msg::send_bytes_for_reply(to, [], 0, 0) + msg::send_bytes_for_reply(to.into(), [], 0, 0) .expect("send message failed") .up_to(Some(duration)) .expect("Invalid wait duration.") .await; } Command::SendUpToWait(to, duration) => { - msg::send_bytes_for_reply(to, [], 0, 0) + msg::send_bytes_for_reply(to.into(), [], 0, 0) .expect("send message failed") .up_to(Some(duration)) .expect("Invalid wait duration.") .await; // after waking, wait again. - msg::send_bytes_for_reply(to, [], 0, 0) + msg::send_bytes_for_reply(to.into(), [], 0, 0) .expect("send message failed") .await; } Command::SendAndWaitFor(duration, to) => { - msg::send(to, b"ping", 0); + msg::send(to.into(), b"ping", 0); exec::wait_for(duration); } Command::ReplyAndWait(subcommand) => { diff --git a/examples/waiter/src/lib.rs b/examples/waiter/src/lib.rs index 1e744113065..b7d4619f789 100644 --- a/examples/waiter/src/lib.rs +++ b/examples/waiter/src/lib.rs @@ -15,29 +15,37 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#![no_std] -use gstd::{ActorId, Vec}; +#![cfg_attr(not(feature = "std"), no_std)] + +extern crate alloc; + +use alloc::vec::Vec; +use gcore::BlockCount; use parity_scale_codec::{Decode, Encode}; -#[cfg(feature = "std")] +type ActorId = [u8; 32]; + +#[cfg(feature = "wasm-wrapper")] mod code { include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); } -#[cfg(feature = "std")] +#[cfg(feature = "wasm-wrapper")] pub use code::WASM_BINARY_OPT as WASM_BINARY; -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "wasm-wrapper"))] mod wasm { include! {"./code.rs"} } +#[cfg(feature = "std")] pub fn system_reserve() -> u64 { gstd::Config::system_reserve() } // Re-exports for testing +#[cfg(feature = "std")] pub fn default_wait_up_to_duration() -> u32 { gstd::Config::wait_up_to() } @@ -94,14 +102,14 @@ pub enum RwLockContinuation { #[derive(Debug, Encode, Decode)] pub enum Command { Wait(WaitSubcommand), - SendFor(ActorId, gstd::BlockCount), - SendUpTo(ActorId, gstd::BlockCount), - SendUpToWait(ActorId, gstd::BlockCount), - SendAndWaitFor(gstd::BlockCount, ActorId), + SendFor(ActorId, BlockCount), + SendUpTo(ActorId, BlockCount), + SendUpToWait(ActorId, BlockCount), + SendAndWaitFor(BlockCount, ActorId), ReplyAndWait(WaitSubcommand), - SleepFor(Vec, SleepForWaitType), + SleepFor(Vec, SleepForWaitType), WakeUp([u8; 32]), - MxLock(gstd::BlockCount, MxLockContinuation), + MxLock(BlockCount, MxLockContinuation), MxLockStaticAccess(LockStaticAccessSubcommand), RwLock(RwLockType, RwLockContinuation), RwLockStaticAccess(RwLockType, LockStaticAccessSubcommand), diff --git a/gclient/Cargo.toml b/gclient/Cargo.toml index 3ee7de0f6ec..26f9d8b973a 100644 --- a/gclient/Cargo.toml +++ b/gclient/Cargo.toml @@ -38,7 +38,7 @@ demo-async-tester.workspace = true demo-calc-hash.workspace = true demo-calc-hash-in-one-block.workspace = true demo-custom.workspace = true -demo-constructor.workspace = true +demo-constructor = { workspace = true, features = ["std"] } demo-distributor.workspace = true demo-meta-io.workspace = true demo-new-meta.workspace = true @@ -47,7 +47,7 @@ demo-node.workspace = true demo-program-factory.workspace = true demo-proxy = { workspace = true, features = ["std"] } demo-proxy-relay.workspace = true -demo-reserve-gas.workspace = true +demo-reserve-gas = { workspace = true, features = ["std"] } gmeta = { workspace = true } gstd = { workspace = true, features = ["debug"] } demo-wat.workspace = true diff --git a/gsdk/Cargo.toml b/gsdk/Cargo.toml index d823fcd42d9..3985dbc5494 100644 --- a/gsdk/Cargo.toml +++ b/gsdk/Cargo.toml @@ -42,7 +42,7 @@ gsdk = { path = ".", features = ["testing"] } tokio = { workspace = true, features = [ "full" ] } demo-messager.workspace = true demo-new-meta.workspace = true -demo-waiter.workspace = true +demo-waiter = { workspace = true, features = ["std"] } [features] testing = [ "rand" ] diff --git a/gsdk/tests/rpc.rs b/gsdk/tests/rpc.rs index c458cee94e8..376af7741de 100644 --- a/gsdk/tests/rpc.rs +++ b/gsdk/tests/rpc.rs @@ -151,7 +151,7 @@ async fn test_calculate_reply_gas() -> Result<()> { let salt = vec![]; let pid = ProgramId::generate(CodeId::generate(demo_waiter::WASM_BINARY), &salt); - let payload = demo_waiter::Command::SendUpTo(alice.into(), 10); + let payload = demo_waiter::Command::SendUpTo(alice, 10); // 1. upload program. let signer = Api::new(Some(&node_uri(&node))) diff --git a/pallets/gear-scheduler/src/tests.rs b/pallets/gear-scheduler/src/tests.rs index d2ba06af84f..58a0285d026 100644 --- a/pallets/gear-scheduler/src/tests.rs +++ b/pallets/gear-scheduler/src/tests.rs @@ -89,6 +89,7 @@ fn populate_wl_from( (mid, pid) } +#[track_caller] fn task_and_wl_message_exist( mid: impl Into, pid: impl Into, @@ -100,9 +101,7 @@ fn task_and_wl_message_exist( let ts = TaskPoolOf::::contains(&bn, &ScheduledTask::RemoveFromWaitlist(pid, mid)); let wl = WaitlistOf::::contains(&pid, &mid); - if ts != wl { - panic!("Logic invalidated"); - } + assert_eq!(ts, wl, "Logic invalidated"); ts } @@ -196,12 +195,14 @@ fn gear_handles_tasks() { ); assert_eq!(GearBank::account_total(&USER_1), gas_price(DEFAULT_GAS)); + let task = ScheduledTask::RemoveFromWaitlist(Default::default(), Default::default()); + let task_gas = pallet_gear::manager::get_maximum_task_gas::(&task); // Check if task and message got processed in block `bn`. run_to_block(bn, Some(u64::MAX)); // Read of the first block of incomplete tasks and write for removal of task. assert_eq!( GasAllowanceOf::::get(), - u64::MAX - db_r_w(1, 1).ref_time() + u64::MAX - db_r_w(1, 1).ref_time() - task_gas ); // Storages checking. @@ -298,7 +299,9 @@ fn gear_handles_outdated_tasks() { // Check if task and message got processed before start of block `bn`. // But due to the low gas allowance, we may process the only first task. - run_to_block(bn, Some(db_r_w(1, 2).ref_time() + 1)); + let task = ScheduledTask::RemoveFromWaitlist(Default::default(), Default::default()); + let task_gas = pallet_gear::manager::get_maximum_task_gas::(&task); + run_to_block(bn, Some(db_r_w(2, 2).ref_time() + task_gas + 1)); // Read of the first block of incomplete tasks, write to it afterwards + single task processing. assert_eq!(GasAllowanceOf::::get(), 1); @@ -329,7 +332,7 @@ fn gear_handles_outdated_tasks() { // Delete of the first block of incomplete tasks + single task processing. assert_eq!( GasAllowanceOf::::get(), - u64::MAX - db_r_w(0, 2).ref_time() + u64::MAX - db_r_w(0, 2).ref_time() - task_gas ); let cost2 = wl_cost_for(bn + 1 - initial_block); diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index 8dc26661bee..ac6f96b0a64 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -60,6 +60,11 @@ sp-consensus-slots = { workspace = true, optional = true } test-syscalls = { workspace = true, optional = true } demo-read-big-state = { workspace = true, optional = true } demo-proxy = { workspace = true, optional = true } +demo-reserve-gas = { workspace = true, optional = true } +demo-delayed-sender = { workspace = true, optional = true } +demo-constructor = { workspace = true, optional = true } +demo-waiter = { workspace = true, optional = true } +demo-init-wait = { workspace = true, optional = true } [dev-dependencies] wabt.workspace = true @@ -154,6 +159,11 @@ std = [ "test-syscalls?/std", "demo-read-big-state?/std", "demo-proxy?/std", + "demo-reserve-gas?/std", + "demo-delayed-sender?/std", + "demo-constructor?/std", + "demo-waiter?/std", + "demo-init-wait?/std", "gear-runtime-interface/std", ] runtime-benchmarks = [ @@ -172,6 +182,11 @@ runtime-benchmarks = [ "demo-read-big-state/wasm-wrapper", "demo-proxy/wasm-wrapper", "gsys", + "demo-reserve-gas/wasm-wrapper", + "demo-delayed-sender/wasm-wrapper", + "demo-constructor/wasm-wrapper", + "demo-waiter/wasm-wrapper", + "demo-init-wait/wasm-wrapper", ] runtime-benchmarks-checkers = [] try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 089b6ba2799..354379bfe16 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -39,6 +39,7 @@ mod code; mod sandbox; mod syscalls; +mod tasks; mod utils; use syscalls::Benches; @@ -59,7 +60,7 @@ use crate::{ schedule::{API_BENCHMARK_BATCH_SIZE, INSTR_BENCHMARK_BATCH_SIZE}, BalanceOf, BenchmarkStorage, Call, Config, CurrencyOf, Event, ExecutionEnvironment, Ext as Externalities, GasHandlerOf, GearBank, MailboxOf, Pallet as Gear, Pallet, - ProgramStorageOf, QueueOf, RentFreePeriodOf, ResumeMinimalPeriodOf, Schedule, + ProgramStorageOf, QueueOf, RentFreePeriodOf, ResumeMinimalPeriodOf, Schedule, TaskPoolOf, }; use ::alloc::{ collections::{BTreeMap, BTreeSet}, @@ -68,6 +69,7 @@ use ::alloc::{ use common::{ self, benchmarking, paused_program_storage::SessionId, + scheduler::{ScheduledTask, TaskHandler}, storage::{Counter, *}, ActiveProgram, CodeMetadata, CodeStorage, GasTree, Origin, PausedProgramStorage, ProgramStorage, ReservableTree, @@ -241,6 +243,31 @@ where .unwrap_or_else(|e| unreachable!("core-processor logic invalidated: {}", e)) } +fn get_last_session_id() -> Option { + find_latest_event::(|event| match event { + Event::ProgramResumeSessionStarted { session_id, .. } => Some(session_id), + _ => None, + }) +} + +pub fn find_latest_event(mapping_filter: F) -> Option +where + T: Config, + F: Fn(Event) -> Option, +{ + SystemPallet::::events() + .into_iter() + .rev() + .filter_map(|event_record| { + let event = <::RuntimeEvent as From<_>>::from(event_record.event); + let event: Result, _> = event.try_into(); + + event.ok() + }) + .find_map(mapping_filter) +} + +#[track_caller] fn resume_session_prepare( c: u32, program_id: ProgramId, @@ -261,14 +288,6 @@ where ) .expect("failed to start resume session"); - let event_record = SystemPallet::::events().pop().unwrap(); - let event = <::RuntimeEvent as From<_>>::from(event_record.event); - let event: Result, _> = event.try_into(); - let session_id = match event { - Ok(Event::ProgramResumeSessionStarted { session_id, .. }) => session_id, - _ => unreachable!(), - }; - let memory_pages = { let mut pages = Vec::with_capacity(c as usize); for i in 0..c { @@ -278,7 +297,7 @@ where pages }; - (session_id, memory_pages) + (get_last_session_id::().unwrap(), memory_pages) } /// An instantiated and deployed program. @@ -2741,6 +2760,89 @@ benchmarks! { sbox.invoke(); } + tasks_remove_resume_session { + let session_id = tasks::remove_resume_session::(); + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.remove_resume_session(session_id); + } + + tasks_remove_gas_reservation { + let (program_id, reservation_id) = tasks::remove_gas_reservation::(); + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.remove_gas_reservation(program_id, reservation_id); + } + + tasks_send_user_message_to_mailbox { + let message_id = tasks::send_user_message::(); + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.send_user_message(message_id, true); + } + + tasks_send_user_message { + let message_id = tasks::send_user_message::(); + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.send_user_message(message_id, false); + } + + tasks_send_dispatch { + let message_id = tasks::send_dispatch::(); + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.send_dispatch(message_id); + } + + tasks_wake_message { + let (program_id, message_id) = tasks::wake_message::(); + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.wake_message(program_id, message_id); + } + + tasks_wake_message_no_wake { + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.wake_message(Default::default(), Default::default()); + } + + tasks_remove_from_waitlist { + let (program_id, message_id) = tasks::remove_from_waitlist::(); + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.remove_from_waitlist(program_id, message_id); + } + + tasks_remove_from_mailbox { + let (user, message_id) = tasks::remove_from_mailbox::(); + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.remove_from_mailbox(T::AccountId::from_origin(user.into_origin()), message_id); + } + + tasks_pause_program { + let c in 0 .. (MAX_PAGES - 1) * (WASM_PAGE_SIZE / GEAR_PAGE_SIZE) as u32; + + let code = benchmarking::generate_wasm2(0.into()).unwrap(); + let program_id = tasks::pause_program_prepare::(c, code); + + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.pause_program(program_id); + } + + tasks_pause_program_uninited { + let c in 0 .. (MAX_PAGES - 1) * (WASM_PAGE_SIZE / GEAR_PAGE_SIZE) as u32; + + let program_id = tasks::pause_program_prepare::(c, demo_init_wait::WASM_BINARY.to_vec()); + + let mut ext_manager = ExtManager::::default(); + }: { + ext_manager.pause_program(program_id); + } + // This is no benchmark. It merely exist to have an easy way to pretty print the currently // configured `Schedule` during benchmark development. // It can be outputted using the following command: diff --git a/pallets/gear/src/benchmarking/tasks.rs b/pallets/gear/src/benchmarking/tasks.rs new file mode 100644 index 00000000000..6447b509f01 --- /dev/null +++ b/pallets/gear/src/benchmarking/tasks.rs @@ -0,0 +1,371 @@ +// This file is part of Gear. + +// Copyright (C) Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +use super::*; +use gear_core::ids::ReservationId; + +#[track_caller] +fn send_user_message_prepare(delay: u32) +where + T: Config, + T::AccountId: Origin, +{ + use demo_delayed_sender::WASM_BINARY; + + let caller = benchmarking::account("caller", 0, 0); + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + + init_block::(None); + + let salt = vec![]; + Gear::::upload_program( + RawOrigin::Signed(caller).into(), + WASM_BINARY.to_vec(), + salt, + delay.encode(), + 100_000_000_000, + 0u32.into(), + ) + .expect("submit program failed"); + + Gear::::process_queue(Default::default()); +} + +#[track_caller] +pub(super) fn pause_program_prepare(c: u32, code: Vec) -> ProgramId +where + T: Config, + T::AccountId: Origin, +{ + let caller = benchmarking::account("caller", 0, 0); + CurrencyOf::::deposit_creating(&caller, 400_000_000_000_000u128.unique_saturated_into()); + + init_block::(None); + + let salt = vec![]; + let program_id = ProgramId::generate(CodeId::generate(&code), &salt); + Gear::::upload_program( + RawOrigin::Signed(caller).into(), + code, + salt, + b"init_payload".to_vec(), + 10_000_000_000, + 0u32.into(), + ) + .expect("submit program failed"); + + Gear::::process_queue(Default::default()); + + let memory_page = { + let mut page = PageBuf::new_zeroed(); + page[0] = 1; + + page + }; + + for i in 0..c { + ProgramStorageOf::::set_program_page_data( + program_id, + GearPage::from(i as u16), + memory_page.clone(), + ); + } + + ProgramStorageOf::::update_active_program(program_id, |program| { + program.pages_with_data = BTreeSet::from_iter((0..c).map(|i| GearPage::from(i as u16))); + + let wasm_pages = (c as usize * GEAR_PAGE_SIZE) / WASM_PAGE_SIZE; + program.allocations = + BTreeSet::from_iter((0..wasm_pages).map(|i| WasmPage::from(i as u16))); + }) + .expect("program should exist"); + + program_id +} + +#[track_caller] +pub(super) fn remove_resume_session() -> SessionId +where + T: Config, + T::AccountId: Origin, +{ + let caller = benchmarking::account("caller", 0, 0); + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + let code = benchmarking::generate_wasm2(16.into()).unwrap(); + let salt = vec![]; + let program_id = ProgramId::generate(CodeId::generate(&code), &salt); + Gear::::upload_program( + RawOrigin::Signed(caller.clone()).into(), + code, + salt, + b"init_payload".to_vec(), + 10_000_000_000, + 0u32.into(), + ) + .expect("submit program failed"); + + init_block::(None); + + ProgramStorageOf::::pause_program(program_id, 100u32.into()).unwrap(); + + Gear::::resume_session_init( + RawOrigin::Signed(caller).into(), + program_id, + Default::default(), + CodeId::default(), + ) + .expect("failed to start resume session"); + + get_last_session_id::().unwrap() +} + +#[track_caller] +pub(super) fn remove_gas_reservation() -> (ProgramId, ReservationId) +where + T: Config, + T::AccountId: Origin, +{ + use demo_reserve_gas::{InitAction, WASM_BINARY}; + + let caller = benchmarking::account("caller", 0, 0); + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + + init_block::(None); + + let salt = vec![]; + let program_id = ProgramId::generate(CodeId::generate(WASM_BINARY), &salt); + Gear::::upload_program( + RawOrigin::Signed(caller).into(), + WASM_BINARY.to_vec(), + salt, + InitAction::Normal(vec![(50_000, 100)]).encode(), + 10_000_000_000, + 0u32.into(), + ) + .expect("submit program failed"); + + Gear::::process_queue(Default::default()); + + let program: ActiveProgram<_> = ProgramStorageOf::::get_program(program_id) + .expect("program should exist") + .try_into() + .expect("program should be active"); + + ( + program_id, + program + .gas_reservation_map + .first_key_value() + .map(|(k, _v)| *k) + .unwrap(), + ) +} + +#[track_caller] +pub(super) fn send_user_message() -> MessageId +where + T: Config, + T::AccountId: Origin, +{ + let delay = 1u32; + send_user_message_prepare::(delay); + + let task = TaskPoolOf::::iter_prefix_keys(Gear::::block_number() + delay.into()) + .next() + .expect("task should be scheduled"); + let (message_id, to_mailbox) = match task { + ScheduledTask::SendUserMessage { + message_id, + to_mailbox, + } => (message_id, to_mailbox), + _ => unreachable!("task should be SendUserMessage"), + }; + assert!(to_mailbox); + + message_id +} + +#[track_caller] +pub(super) fn send_dispatch() -> MessageId +where + T: Config, + T::AccountId: Origin, +{ + use demo_constructor::{Call, Calls, Scheme, WASM_BINARY}; + + let caller = benchmarking::account("caller", 0, 0); + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + + init_block::(None); + + let salt = vec![]; + let program_id = ProgramId::generate(CodeId::generate(WASM_BINARY), &salt); + Gear::::upload_program( + RawOrigin::Signed(caller.clone()).into(), + WASM_BINARY.to_vec(), + salt, + Scheme::empty().encode(), + 10_000_000_000, + 0u32.into(), + ) + .expect("submit program failed"); + + let delay = 1u32; + let calls = Calls::builder().add_call(Call::Send( + <[u8; 32]>::from(program_id.into_origin()).into(), + [].into(), + Some(0u64.into()), + 0u128.into(), + delay.into(), + )); + Gear::::send_message( + RawOrigin::Signed(caller).into(), + program_id, + calls.encode(), + 10_000_000_000, + 0u32.into(), + false, + ) + .expect("failed to send message"); + + Gear::::process_queue(Default::default()); + + let task = TaskPoolOf::::iter_prefix_keys(Gear::::block_number() + delay.into()) + .next() + .unwrap(); + + match task { + ScheduledTask::SendDispatch(message_id) => message_id, + _ => unreachable!(), + } +} + +#[track_caller] +pub(super) fn wake_message() -> (ProgramId, MessageId) +where + T: Config, + T::AccountId: Origin, +{ + use demo_waiter::{Command, WaitSubcommand, WASM_BINARY}; + + let caller = benchmarking::account("caller", 0, 0); + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + + init_block::(None); + + let salt = vec![]; + let program_id = ProgramId::generate(CodeId::generate(WASM_BINARY), &salt); + Gear::::upload_program( + RawOrigin::Signed(caller.clone()).into(), + WASM_BINARY.to_vec(), + salt, + vec![], + 10_000_000_000, + 0u32.into(), + ) + .expect("submit program failed"); + + let delay = 10u32; + Gear::::send_message( + RawOrigin::Signed(caller).into(), + program_id, + Command::Wait(WaitSubcommand::WaitFor(delay)).encode(), + 10_000_000_000, + 0u32.into(), + false, + ) + .expect("failed to send message"); + + Gear::::process_queue(Default::default()); + + let task = TaskPoolOf::::iter_prefix_keys(Gear::::block_number() + delay.into()) + .next() + .unwrap(); + let (_program_id, message_id) = match task { + ScheduledTask::WakeMessage(program_id, message_id) => (program_id, message_id), + _ => unreachable!(), + }; + + (program_id, message_id) +} + +#[track_caller] +pub(super) fn remove_from_waitlist() -> (ProgramId, MessageId) +where + T: Config, + T::AccountId: Origin, +{ + use demo_waiter::{Command, WaitSubcommand, WASM_BINARY}; + + let caller = benchmarking::account("caller", 0, 0); + CurrencyOf::::deposit_creating(&caller, 200_000_000_000_000u128.unique_saturated_into()); + + init_block::(None); + + let salt = vec![]; + let program_id = ProgramId::generate(CodeId::generate(WASM_BINARY), &salt); + Gear::::upload_program( + RawOrigin::Signed(caller.clone()).into(), + WASM_BINARY.to_vec(), + salt, + vec![], + 10_000_000_000, + 0u32.into(), + ) + .expect("submit program failed"); + + Gear::::send_message( + RawOrigin::Signed(caller).into(), + program_id, + Command::Wait(WaitSubcommand::Wait).encode(), + 10_000_000_000, + 0u32.into(), + false, + ) + .expect("failed to send message"); + + Gear::::process_queue(Default::default()); + + let expiration = find_latest_event::(|event| match event { + Event::MessageWaited { expiration, .. } => Some(expiration), + _ => None, + }) + .expect("message should be waited"); + + let task = TaskPoolOf::::iter_prefix_keys(expiration) + .next() + .unwrap(); + let (_program_id, message_id) = match task { + ScheduledTask::RemoveFromWaitlist(program_id, message_id) => (program_id, message_id), + _ => unreachable!(), + }; + + (program_id, message_id) +} + +#[track_caller] +pub(super) fn remove_from_mailbox() -> (ProgramId, MessageId) +where + T: Config, + T::AccountId: Origin, +{ + send_user_message_prepare::(0u32); + + find_latest_event::(|event| match event { + Event::UserMessageSent { message, .. } => Some((message.destination(), message.id())), + _ => None, + }) + .expect("message should be sent") +} diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index e236c02de33..0db25c86d60 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -934,7 +934,6 @@ pub mod pallet { ..=current_bn.saturated_into()) .map(|block| block.saturated_into::>()); for bn in missing_blocks { - // Tasks drain iterator. let tasks = TaskPoolOf::::drain_prefix_keys(bn); // Checking gas allowance. @@ -948,30 +947,63 @@ pub mod pallet { } // Iterating over tasks, scheduled on `bn`. + let mut last_task = None; for task in tasks { - log::debug!("Processing task: {:?}", task); - // Decreasing gas allowance due to DB deletion. GasAllowanceOf::::decrease(DbWeightOf::::get().writes(1).ref_time()); - // Processing task. - // - // NOTE: Gas allowance decrease should be implemented - // inside `TaskHandler` trait and/or inside other - // generic types, which interact with storage. - task.process_with(ext_manager); + // gas required to process task. + let max_task_gas = manager::get_maximum_task_gas::(&task); + log::debug!("Processing task: {task:?}, max gas = {max_task_gas}"); // Checking gas allowance. // - // Making sure we have gas to remove next task - // or update the first block of incomplete tasks. - if GasAllowanceOf::::get() <= DbWeightOf::::get().writes(2).ref_time() { + // Making sure we have gas to process the current task + // and update the first block of incomplete tasks. + if GasAllowanceOf::::get().saturating_sub(max_task_gas) + <= DbWeightOf::::get().writes(1).ref_time() + { + // Since the task is not processed write DB cost should be refunded. + // In the same time gas allowance should be charged for read DB cost. + GasAllowanceOf::::put( + GasAllowanceOf::::get() + .saturating_add(DbWeightOf::::get().writes(1).ref_time()) + .saturating_sub(DbWeightOf::::get().reads(1).ref_time()), + ); + + last_task = Some(task); + log::debug!("Not enough gas to process task at: {bn:?}"); + + break; + } + + // Processing task and update allowance of gas. + let task_gas = task.process_with(ext_manager); + GasAllowanceOf::::decrease(task_gas); + + // Check that there is enough gas allowance to query next task and update the first block of incomplete tasks. + if GasAllowanceOf::::get() + <= DbWeightOf::::get().reads_writes(1, 1).ref_time() + { stopped_at = Some(bn); - log::debug!("Stopping processing tasks at: {stopped_at:?}"); + log::debug!("Stopping processing tasks at (read next): {stopped_at:?}"); break; } } + if let Some(task) = last_task { + stopped_at = Some(bn); + + // since there is the overlay mechanism we don't need to subtract write cost + // from gas allowance on task insertion. + GasAllowanceOf::::put( + GasAllowanceOf::::get() + .saturating_add(DbWeightOf::::get().writes(1).ref_time()), + ); + TaskPoolOf::::add(bn, task) + .unwrap_or_else(|e| unreachable!("Scheduling logic invalidated! {:?}", e)); + } + // Stopping iteration over blocks if no resources left. if stopped_at.is_some() { break; diff --git a/pallets/gear/src/manager/task.rs b/pallets/gear/src/manager/task.rs index 41a399265f2..54f6eb85f2b 100644 --- a/pallets/gear/src/manager/task.rs +++ b/pallets/gear/src/manager/task.rs @@ -17,8 +17,8 @@ // along with this program. If not, see . use crate::{ - manager::ExtManager, Config, DispatchStashOf, Event, Pallet, ProgramStorageOf, QueueOf, - TaskPoolOf, WaitlistOf, + manager::ExtManager, weights::WeightInfo, Config, DbWeightOf, DispatchStashOf, Event, Pallet, + ProgramStorageOf, QueueOf, TaskPoolOf, WaitlistOf, }; use alloc::string::ToString; use common::{ @@ -29,21 +29,71 @@ use common::{ paused_program_storage::SessionId, scheduler::*, storage::*, - Origin, PausedProgramStorage, Program, ProgramStorage, + ActiveProgram, Gas, Origin, PausedProgramStorage, Program, ProgramState, ProgramStorage, }; +use core::cmp; use gear_core::{ + code::MAX_WASM_PAGE_COUNT, ids::{CodeId, MessageId, ProgramId, ReservationId}, message::{DispatchKind, ReplyMessage}, + pages::{GEAR_PAGE_SIZE, WASM_PAGE_SIZE}, }; use gear_core_errors::{ErrorReplyReason, SignalCode}; use sp_core::Get; use sp_runtime::Saturating; +pub fn get_maximum_task_gas(task: &ScheduledTask) -> Gas { + use ScheduledTask::*; + + match task { + PauseProgram(_) => { + // TODO: #3079 + if ::ProgramRentEnabled::get() { + let count = + u32::from(MAX_WASM_PAGE_COUNT * (WASM_PAGE_SIZE / GEAR_PAGE_SIZE) as u16 / 2); + cmp::max( + ::WeightInfo::tasks_pause_program(count).ref_time(), + ::WeightInfo::tasks_pause_program_uninited(count).ref_time(), + ) + } else { + DbWeightOf::::get().writes(2).ref_time() + } + } + RemoveCode(_) => todo!("#646"), + RemoveFromMailbox(_, _) => { + ::WeightInfo::tasks_remove_from_mailbox().ref_time() + } + RemoveFromWaitlist(_, _) => { + ::WeightInfo::tasks_remove_from_waitlist().ref_time() + } + RemovePausedProgram(_) => todo!("#646"), + WakeMessage(_, _) => cmp::max( + ::WeightInfo::tasks_wake_message().ref_time(), + ::WeightInfo::tasks_wake_message_no_wake().ref_time(), + ), + SendDispatch(_) => ::WeightInfo::tasks_send_dispatch().ref_time(), + SendUserMessage { .. } => cmp::max( + ::WeightInfo::tasks_send_user_message_to_mailbox().ref_time(), + ::WeightInfo::tasks_send_user_message().ref_time(), + ), + RemoveGasReservation(_, _) => { + ::WeightInfo::tasks_remove_gas_reservation().ref_time() + } + RemoveResumeSession(_) => { + ::WeightInfo::tasks_remove_resume_session().ref_time() + } + } +} + impl TaskHandler for ExtManager where T::AccountId: Origin, { - fn pause_program(&mut self, program_id: ProgramId) { + fn pause_program(&mut self, program_id: ProgramId) -> Gas { + // + // TODO: #3079 + // + if !::ProgramRentEnabled::get() { log::debug!("Program rent logic is disabled."); @@ -63,13 +113,17 @@ where TaskPoolOf::::add(expiration_block, task) .unwrap_or_else(|e| unreachable!("Scheduling logic invalidated! {:?}", e)); - return; + return DbWeightOf::::get().writes(1).ref_time(); } - let program = ProgramStorageOf::::get_program(program_id) - .unwrap_or_else(|| unreachable!("Program to pause not found.")); + let program: ActiveProgram<_> = ProgramStorageOf::::get_program(program_id) + .unwrap_or_else(|| unreachable!("Program to pause not found.")) + .try_into() + .unwrap_or_else(|e| unreachable!("Pause program task logic corrupted: {e:?}")); - let Some(init_message_id) = program.is_uninitialized() else { + let pages_with_data = program.pages_with_data.len() as u32; + + let ProgramState::Uninitialized{ message_id: init_message_id } = program.state else { // pause initialized program let gas_reservation_map = ProgramStorageOf::::pause_program(program_id, Pallet::::block_number()) @@ -90,7 +144,10 @@ where change: ProgramChangeKind::Paused, }); - return; + let gas = ::WeightInfo::tasks_pause_program(pages_with_data).ref_time(); + log::trace!("Task gas: tasks_pause_program = {gas}"); + + return gas; }; // terminate uninitialized program @@ -141,13 +198,19 @@ where id: program_id, change: ProgramChangeKind::Terminated, }); + + let gas = + ::WeightInfo::tasks_pause_program_uninited(pages_with_data).ref_time(); + log::trace!("Task gas: tasks_pause_program_uninited = {gas}"); + + gas } - fn remove_code(&mut self, _code_id: CodeId) { - todo!("#646"); + fn remove_code(&mut self, _code_id: CodeId) -> Gas { + todo!("#646") } - fn remove_from_mailbox(&mut self, user_id: T::AccountId, message_id: MessageId) { + fn remove_from_mailbox(&mut self, user_id: T::AccountId, message_id: MessageId) -> Gas { // Read reason. let reason = UserMessageReadSystemReason::OutOfRent.into_reason(); @@ -169,9 +232,14 @@ where // Queueing dispatch. QueueOf::::queue(dispatch) .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)); + + let gas = ::WeightInfo::tasks_remove_from_mailbox().ref_time(); + log::trace!("Task gas: tasks_remove_from_mailbox = {gas}"); + + gas } - fn remove_from_waitlist(&mut self, program_id: ProgramId, message_id: MessageId) { + fn remove_from_waitlist(&mut self, program_id: ProgramId, message_id: MessageId) -> Gas { // Wake reason. let reason = MessageWokenSystemReason::OutOfRent.into_reason(); @@ -240,24 +308,42 @@ where let origin = waitlisted.source(); Self::process_failed_init(program_id, origin, true); } + + let gas = ::WeightInfo::tasks_remove_from_waitlist().ref_time(); + log::trace!("Task gas: tasks_remove_from_waitlist = {gas}"); + + gas } - fn remove_paused_program(&mut self, _program_id: ProgramId) { - todo!("#646"); + fn remove_paused_program(&mut self, _program_id: ProgramId) -> Gas { + todo!("#646") } - fn wake_message(&mut self, program_id: ProgramId, message_id: MessageId) { - if let Some(dispatch) = Pallet::::wake_dispatch( + fn wake_message(&mut self, program_id: ProgramId, message_id: MessageId) -> Gas { + match Pallet::::wake_dispatch( program_id, message_id, MessageWokenRuntimeReason::WakeCalled.into_reason(), ) { - QueueOf::::queue(dispatch) - .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)); + Some(dispatch) => { + QueueOf::::queue(dispatch) + .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)); + + let gas = ::WeightInfo::tasks_wake_message().ref_time(); + log::trace!("Task gas: tasks_wake_message = {gas}"); + + gas + } + None => { + let gas = ::WeightInfo::tasks_wake_message_no_wake().ref_time(); + log::trace!("Task gas: tasks_wake_message_no_wake = {gas}"); + + gas + } } } - fn send_dispatch(&mut self, stashed_message_id: MessageId) { + fn send_dispatch(&mut self, stashed_message_id: MessageId) -> Gas { // No validation required. If program doesn't exist, then NotExecuted appears. let (dispatch, hold_interval) = DispatchStashOf::::take(stashed_message_id) @@ -268,9 +354,14 @@ where QueueOf::::queue(dispatch) .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)); + + let gas = ::WeightInfo::tasks_send_dispatch().ref_time(); + log::trace!("Task gas: tasks_send_dispatch = {gas}"); + + gas } - fn send_user_message(&mut self, stashed_message_id: MessageId, to_mailbox: bool) { + fn send_user_message(&mut self, stashed_message_id: MessageId, to_mailbox: bool) -> Gas { // TODO: validate here destination and send error reply, if required. // Atm despite the fact that program may exist, message goes into mailbox / event. let (message, hold_interval) = DispatchStashOf::::take(stashed_message_id) @@ -285,15 +376,40 @@ where .try_into() .unwrap_or_else(|_| unreachable!("Signal message sent to user")); Pallet::::send_user_message_after_delay(message, to_mailbox); + + if to_mailbox { + let gas = ::WeightInfo::tasks_send_user_message_to_mailbox().ref_time(); + log::trace!("Task gas: tasks_send_user_message_to_mailbox = {gas}"); + + gas + } else { + let gas = ::WeightInfo::tasks_send_user_message().ref_time(); + log::trace!("Task gas: tasks_send_user_message = {gas}"); + + gas + } } - fn remove_gas_reservation(&mut self, program_id: ProgramId, reservation_id: ReservationId) { + fn remove_gas_reservation( + &mut self, + program_id: ProgramId, + reservation_id: ReservationId, + ) -> Gas { let _slot = Self::remove_gas_reservation_impl(program_id, reservation_id); + + let gas = ::WeightInfo::tasks_remove_gas_reservation().ref_time(); + log::trace!("Task gas: tasks_remove_gas_reservation = {gas}"); + + gas } - fn remove_resume_session(&mut self, session_id: SessionId) { - log::debug!("Execute task to remove resume session with session_id = {session_id}"); + fn remove_resume_session(&mut self, session_id: SessionId) -> Gas { ProgramStorageOf::::remove_resume_session(session_id) .unwrap_or_else(|e| unreachable!("ProgramStorage corrupted! {:?}", e)); + + let gas = ::WeightInfo::tasks_remove_resume_session().ref_time(); + log::trace!("Task gas: tasks_remove_resume_session = {gas}"); + + gas } } diff --git a/pallets/gear/src/mock.rs b/pallets/gear/src/mock.rs index e4f29b149e2..6ddddaa70ca 100644 --- a/pallets/gear/src/mock.rs +++ b/pallets/gear/src/mock.rs @@ -302,7 +302,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { pallet_balances::GenesisConfig:: { balances: vec![ (USER_1, 5_000_000_000_000_000_u128), - (USER_2, 200_000_000_000_000_u128), + (USER_2, 350_000_000_000_000_u128), (USER_3, 500_000_000_000_000_u128), (LOW_BALANCE_USER, 1_000_000_u128), (BLOCK_AUTHOR, 500_000_u128), diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index ae861d0d365..019d2ac293b 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -5118,7 +5118,7 @@ fn test_requeue_after_wait_for_timeout() { run_to_next_block(None); let duration = 10; - let payload = Command::SendAndWaitFor(duration, USER_1.into()).encode(); + let payload = Command::SendAndWaitFor(duration, USER_1.into_origin().into()).encode(); assert_ok!(Gear::send_message( RuntimeOrigin::signed(USER_1), program_id, @@ -5189,7 +5189,7 @@ fn test_sending_waits() { // // Send message and then wait_for. let duration = 5; - let payload = Command::SendFor(USER_1.into(), duration).encode(); + let payload = Command::SendFor(USER_1.into_origin().into(), duration).encode(); assert_ok!(Gear::send_message( RuntimeOrigin::signed(USER_1), @@ -5209,7 +5209,7 @@ fn test_sending_waits() { // // Send message and then wait_up_to. let duration = 10; - let payload = Command::SendUpTo(USER_1.into(), duration).encode(); + let payload = Command::SendUpTo(USER_1.into_origin().into(), duration).encode(); assert_ok!(Gear::send_message( RuntimeOrigin::signed(USER_1), program_id, @@ -5228,7 +5228,7 @@ fn test_sending_waits() { // // Send message and then wait no_more, wake, wait no_more again. let duration = 10; - let payload = Command::SendUpToWait(USER_2.into(), duration).encode(); + let payload = Command::SendUpToWait(USER_2.into_origin().into(), duration).encode(); assert_ok!(Gear::send_message( RuntimeOrigin::signed(USER_1), program_id, @@ -8809,6 +8809,8 @@ fn free_storage_hold_on_scheduler_overwhelm() { #[test] fn execution_over_blocks() { + const MAX_BLOCK: u64 = 10_000_000_000; + init_logger(); let assert_last_message = |src: [u8; 32], count: u128| { @@ -8849,7 +8851,7 @@ fn execution_over_blocks() { )); let in_one_block = get_last_program_id(); - run_to_next_block(None); + run_to_next_block(Some(MAX_BLOCK)); // estimate start cost let pkg = Package::new(times, src); @@ -8870,7 +8872,7 @@ fn execution_over_blocks() { use demo_calc_hash_in_one_block::{Package, WASM_BINARY}; // We suppose that gas limit is less than gas allowance - let block_gas_limit = BlockGasLimitOf::::get() - 10000; + let block_gas_limit = MAX_BLOCK - 10_000; // Deploy demo-calc-hash-in-one-block. assert_ok!(Gear::upload_program( @@ -8887,30 +8889,31 @@ fn execution_over_blocks() { let src = [0; 32]; + let expected = 64; assert_ok!(Gear::send_message( RuntimeOrigin::signed(USER_1), in_one_block, - Package::new(128, src).encode(), + Package::new(expected, src).encode(), block_gas_limit, 0, false, )); - run_to_next_block(None); + run_to_next_block(Some(MAX_BLOCK)); - assert_last_message([0; 32], 128); + assert_last_message([0; 32], expected); assert_ok!(Gear::send_message( RuntimeOrigin::signed(USER_1), in_one_block, - Package::new(17_384, src).encode(), + Package::new(1_024, src).encode(), block_gas_limit, 0, false, )); let message_id = get_last_message_id(); - run_to_next_block(None); + run_to_next_block(Some(MAX_BLOCK)); assert_failed( message_id, @@ -8921,7 +8924,7 @@ fn execution_over_blocks() { new_test_ext().execute_with(|| { use demo_calc_hash::sha2_512_256; use demo_calc_hash_over_blocks::{Method, WASM_BINARY}; - let block_gas_limit = BlockGasLimitOf::::get(); + let block_gas_limit = MAX_BLOCK; let (_, calc_threshold) = estimate_gas_per_calc(); @@ -8931,26 +8934,26 @@ fn execution_over_blocks() { WASM_BINARY.to_vec(), DEFAULT_SALT.to_vec(), calc_threshold.encode(), - 10_000_000_000, + 9_000_000_000, 0, )); let over_blocks = get_last_program_id(); assert!(ProgramStorageOf::::program_exists(over_blocks)); - let (src, id, expected) = ([0; 32], sha2_512_256(b"42"), 16_384); + let (src, id, expected) = ([0; 32], sha2_512_256(b"42"), 512); // trigger calculation assert_ok!(Gear::send_message( RuntimeOrigin::signed(USER_1), over_blocks, Method::Start { src, id, expected }.encode(), - 10_000_000_000, + 9_000_000_000, 0, false, )); - run_to_next_block(None); + run_to_next_block(Some(MAX_BLOCK)); let mut count = 0; loop { @@ -8970,7 +8973,7 @@ fn execution_over_blocks() { )); count += 1; - run_to_next_block(None); + run_to_next_block(Some(MAX_BLOCK)); } assert!(count > 1); diff --git a/pallets/gear/src/weights.rs b/pallets/gear/src/weights.rs index c52d1f58fac..3ad8efedec0 100644 --- a/pallets/gear/src/weights.rs +++ b/pallets/gear/src/weights.rs @@ -215,6 +215,17 @@ pub trait WeightInfo { fn instr_i32rotl(r: u32, ) -> Weight; fn instr_i64rotr(r: u32, ) -> Weight; fn instr_i32rotr(r: u32, ) -> Weight; + fn tasks_remove_resume_session() -> Weight; + fn tasks_remove_gas_reservation() -> Weight; + fn tasks_send_user_message_to_mailbox() -> Weight; + fn tasks_send_user_message() -> Weight; + fn tasks_send_dispatch() -> Weight; + fn tasks_wake_message() -> Weight; + fn tasks_wake_message_no_wake() -> Weight; + fn tasks_remove_from_waitlist() -> Weight; + fn tasks_remove_from_mailbox() -> Weight; + fn tasks_pause_program(c: u32, ) -> Weight; + fn tasks_pause_program_uninited(c: u32, ) -> Weight; fn allocation_cost() -> Weight; fn grow_cost() -> Weight; fn initial_cost() -> Weight; @@ -2062,6 +2073,116 @@ impl WeightInfo for SubstrateWeight { // Standard Error: 5_851 .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } + fn tasks_remove_resume_session() -> Weight { + // Proof Size summary in bytes: + // Measured: `352` + // Estimated: `4169` + // Minimum execution time: 5_698_000 picoseconds. + Weight::from_parts(5_953_000, 4169) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + fn tasks_remove_gas_reservation() -> Weight { + // Proof Size summary in bytes: + // Measured: `1003` + // Estimated: `23637` + // Minimum execution time: 61_615_000 picoseconds. + Weight::from_parts(64_309_000, 23637) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + fn tasks_send_user_message_to_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `784` + // Estimated: `21534` + // Minimum execution time: 43_449_000 picoseconds. + Weight::from_parts(44_990_000, 21534) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + fn tasks_send_user_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `906` + // Estimated: `33891` + // Minimum execution time: 75_764_000 picoseconds. + Weight::from_parts(77_875_000, 33891) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) + } + fn tasks_send_dispatch() -> Weight { + // Proof Size summary in bytes: + // Measured: `591` + // Estimated: `19885` + // Minimum execution time: 31_362_000 picoseconds. + Weight::from_parts(32_425_000, 19885) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + fn tasks_wake_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `872` + // Estimated: `25908` + // Minimum execution time: 45_023_000 picoseconds. + Weight::from_parts(46_479_000, 25908) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + fn tasks_wake_message_no_wake() -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `3545` + // Minimum execution time: 3_365_000 picoseconds. + Weight::from_parts(3_639_000, 3545) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } + fn tasks_remove_from_waitlist() -> Weight { + // Proof Size summary in bytes: + // Measured: `1522` + // Estimated: `57192` + // Minimum execution time: 114_023_000 picoseconds. + Weight::from_parts(117_157_000, 57192) + .saturating_add(T::DbWeight::get().reads(16_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) + } + fn tasks_remove_from_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `1228` + // Estimated: `46026` + // Minimum execution time: 90_320_000 picoseconds. + Weight::from_parts(93_096_000, 46026) + .saturating_add(T::DbWeight::get().reads(14_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2200 + c * (16400 ±0)` + // Estimated: `19363 + c * (84480 ±0)` + // Minimum execution time: 28_326_000 picoseconds. + Weight::from_parts(28_612_000, 19363) + // Standard Error: 73_191 + .saturating_add(Weight::from_parts(39_403_570, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 84480).saturating_mul(c.into())) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program_uninited(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `3025 + c * (42 ±0)` + // Estimated: `59431 + c * (2947 ±0)` + // Minimum execution time: 86_517_000 picoseconds. + Weight::from_parts(78_047_954, 59431) + // Standard Error: 2_660 + .saturating_add(Weight::from_parts(1_060_607, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes(9_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2947).saturating_mul(c.into())) + } } // For backwards compatibility and tests @@ -3903,4 +4024,114 @@ impl WeightInfo for () { // Standard Error: 5_851 .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } + fn tasks_remove_resume_session() -> Weight { + // Proof Size summary in bytes: + // Measured: `352` + // Estimated: `4169` + // Minimum execution time: 5_698_000 picoseconds. + Weight::from_parts(5_953_000, 4169) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + fn tasks_remove_gas_reservation() -> Weight { + // Proof Size summary in bytes: + // Measured: `1003` + // Estimated: `23637` + // Minimum execution time: 61_615_000 picoseconds. + Weight::from_parts(64_309_000, 23637) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + fn tasks_send_user_message_to_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `784` + // Estimated: `21534` + // Minimum execution time: 43_449_000 picoseconds. + Weight::from_parts(44_990_000, 21534) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + } + fn tasks_send_user_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `906` + // Estimated: `33891` + // Minimum execution time: 75_764_000 picoseconds. + Weight::from_parts(77_875_000, 33891) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(10_u64)) + } + fn tasks_send_dispatch() -> Weight { + // Proof Size summary in bytes: + // Measured: `591` + // Estimated: `19885` + // Minimum execution time: 31_362_000 picoseconds. + Weight::from_parts(32_425_000, 19885) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + fn tasks_wake_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `872` + // Estimated: `25908` + // Minimum execution time: 45_023_000 picoseconds. + Weight::from_parts(46_479_000, 25908) + .saturating_add(RocksDbWeight::get().reads(8_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + fn tasks_wake_message_no_wake() -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `3545` + // Minimum execution time: 3_365_000 picoseconds. + Weight::from_parts(3_639_000, 3545) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + } + fn tasks_remove_from_waitlist() -> Weight { + // Proof Size summary in bytes: + // Measured: `1522` + // Estimated: `57192` + // Minimum execution time: 114_023_000 picoseconds. + Weight::from_parts(117_157_000, 57192) + .saturating_add(RocksDbWeight::get().reads(16_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) + } + fn tasks_remove_from_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `1228` + // Estimated: `46026` + // Minimum execution time: 90_320_000 picoseconds. + Weight::from_parts(93_096_000, 46026) + .saturating_add(RocksDbWeight::get().reads(14_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2200 + c * (16400 ±0)` + // Estimated: `19363 + c * (84480 ±0)` + // Minimum execution time: 28_326_000 picoseconds. + Weight::from_parts(28_612_000, 19363) + // Standard Error: 73_191 + .saturating_add(Weight::from_parts(39_403_570, 0).saturating_mul(c.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 84480).saturating_mul(c.into())) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program_uninited(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `3025 + c * (42 ±0)` + // Estimated: `59431 + c * (2947 ±0)` + // Minimum execution time: 86_517_000 picoseconds. + Weight::from_parts(78_047_954, 59431) + // Standard Error: 2_660 + .saturating_add(Weight::from_parts(1_060_607, 0).saturating_mul(c.into())) + .saturating_add(RocksDbWeight::get().reads(13_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(RocksDbWeight::get().writes(9_u64)) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2947).saturating_mul(c.into())) + } } diff --git a/runtime/gear/src/weights/pallet_gear.rs b/runtime/gear/src/weights/pallet_gear.rs index 707b287d5c5..8b14d71ab58 100644 --- a/runtime/gear/src/weights/pallet_gear.rs +++ b/runtime/gear/src/weights/pallet_gear.rs @@ -215,6 +215,17 @@ pub trait WeightInfo { fn instr_i32rotl(r: u32, ) -> Weight; fn instr_i64rotr(r: u32, ) -> Weight; fn instr_i32rotr(r: u32, ) -> Weight; + fn tasks_remove_resume_session() -> Weight; + fn tasks_remove_gas_reservation() -> Weight; + fn tasks_send_user_message_to_mailbox() -> Weight; + fn tasks_send_user_message() -> Weight; + fn tasks_send_dispatch() -> Weight; + fn tasks_wake_message() -> Weight; + fn tasks_wake_message_no_wake() -> Weight; + fn tasks_remove_from_waitlist() -> Weight; + fn tasks_remove_from_mailbox() -> Weight; + fn tasks_pause_program(c: u32, ) -> Weight; + fn tasks_pause_program_uninited(c: u32, ) -> Weight; fn allocation_cost() -> Weight; fn grow_cost() -> Weight; fn initial_cost() -> Weight; @@ -2062,6 +2073,116 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Standard Error: 5_851 .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } + fn tasks_remove_resume_session() -> Weight { + // Proof Size summary in bytes: + // Measured: `352` + // Estimated: `4169` + // Minimum execution time: 5_698_000 picoseconds. + Weight::from_parts(5_953_000, 4169) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + fn tasks_remove_gas_reservation() -> Weight { + // Proof Size summary in bytes: + // Measured: `1003` + // Estimated: `23637` + // Minimum execution time: 61_615_000 picoseconds. + Weight::from_parts(64_309_000, 23637) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + fn tasks_send_user_message_to_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `784` + // Estimated: `21534` + // Minimum execution time: 43_449_000 picoseconds. + Weight::from_parts(44_990_000, 21534) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + fn tasks_send_user_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `906` + // Estimated: `33891` + // Minimum execution time: 75_764_000 picoseconds. + Weight::from_parts(77_875_000, 33891) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) + } + fn tasks_send_dispatch() -> Weight { + // Proof Size summary in bytes: + // Measured: `591` + // Estimated: `19885` + // Minimum execution time: 31_362_000 picoseconds. + Weight::from_parts(32_425_000, 19885) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + fn tasks_wake_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `872` + // Estimated: `25908` + // Minimum execution time: 45_023_000 picoseconds. + Weight::from_parts(46_479_000, 25908) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + fn tasks_wake_message_no_wake() -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `3545` + // Minimum execution time: 3_365_000 picoseconds. + Weight::from_parts(3_639_000, 3545) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } + fn tasks_remove_from_waitlist() -> Weight { + // Proof Size summary in bytes: + // Measured: `1522` + // Estimated: `57192` + // Minimum execution time: 114_023_000 picoseconds. + Weight::from_parts(117_157_000, 57192) + .saturating_add(T::DbWeight::get().reads(16_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) + } + fn tasks_remove_from_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `1228` + // Estimated: `46026` + // Minimum execution time: 90_320_000 picoseconds. + Weight::from_parts(93_096_000, 46026) + .saturating_add(T::DbWeight::get().reads(14_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2200 + c * (16400 ±0)` + // Estimated: `19363 + c * (84480 ±0)` + // Minimum execution time: 28_326_000 picoseconds. + Weight::from_parts(28_612_000, 19363) + // Standard Error: 73_191 + .saturating_add(Weight::from_parts(39_403_570, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 84480).saturating_mul(c.into())) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program_uninited(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `3025 + c * (42 ±0)` + // Estimated: `59431 + c * (2947 ±0)` + // Minimum execution time: 86_517_000 picoseconds. + Weight::from_parts(78_047_954, 59431) + // Standard Error: 2_660 + .saturating_add(Weight::from_parts(1_060_607, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes(9_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2947).saturating_mul(c.into())) + } } // For backwards compatibility and tests @@ -3903,4 +4024,114 @@ impl WeightInfo for () { // Standard Error: 5_851 .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } + fn tasks_remove_resume_session() -> Weight { + // Proof Size summary in bytes: + // Measured: `352` + // Estimated: `4169` + // Minimum execution time: 5_698_000 picoseconds. + Weight::from_parts(5_953_000, 4169) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + fn tasks_remove_gas_reservation() -> Weight { + // Proof Size summary in bytes: + // Measured: `1003` + // Estimated: `23637` + // Minimum execution time: 61_615_000 picoseconds. + Weight::from_parts(64_309_000, 23637) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + fn tasks_send_user_message_to_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `784` + // Estimated: `21534` + // Minimum execution time: 43_449_000 picoseconds. + Weight::from_parts(44_990_000, 21534) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + } + fn tasks_send_user_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `906` + // Estimated: `33891` + // Minimum execution time: 75_764_000 picoseconds. + Weight::from_parts(77_875_000, 33891) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(10_u64)) + } + fn tasks_send_dispatch() -> Weight { + // Proof Size summary in bytes: + // Measured: `591` + // Estimated: `19885` + // Minimum execution time: 31_362_000 picoseconds. + Weight::from_parts(32_425_000, 19885) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + fn tasks_wake_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `872` + // Estimated: `25908` + // Minimum execution time: 45_023_000 picoseconds. + Weight::from_parts(46_479_000, 25908) + .saturating_add(RocksDbWeight::get().reads(8_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + fn tasks_wake_message_no_wake() -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `3545` + // Minimum execution time: 3_365_000 picoseconds. + Weight::from_parts(3_639_000, 3545) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + } + fn tasks_remove_from_waitlist() -> Weight { + // Proof Size summary in bytes: + // Measured: `1522` + // Estimated: `57192` + // Minimum execution time: 114_023_000 picoseconds. + Weight::from_parts(117_157_000, 57192) + .saturating_add(RocksDbWeight::get().reads(16_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) + } + fn tasks_remove_from_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `1228` + // Estimated: `46026` + // Minimum execution time: 90_320_000 picoseconds. + Weight::from_parts(93_096_000, 46026) + .saturating_add(RocksDbWeight::get().reads(14_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2200 + c * (16400 ±0)` + // Estimated: `19363 + c * (84480 ±0)` + // Minimum execution time: 28_326_000 picoseconds. + Weight::from_parts(28_612_000, 19363) + // Standard Error: 73_191 + .saturating_add(Weight::from_parts(39_403_570, 0).saturating_mul(c.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 84480).saturating_mul(c.into())) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program_uninited(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `3025 + c * (42 ±0)` + // Estimated: `59431 + c * (2947 ±0)` + // Minimum execution time: 86_517_000 picoseconds. + Weight::from_parts(78_047_954, 59431) + // Standard Error: 2_660 + .saturating_add(Weight::from_parts(1_060_607, 0).saturating_mul(c.into())) + .saturating_add(RocksDbWeight::get().reads(13_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(RocksDbWeight::get().writes(9_u64)) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2947).saturating_mul(c.into())) + } } diff --git a/runtime/vara/src/weights/pallet_gear.rs b/runtime/vara/src/weights/pallet_gear.rs index 707b287d5c5..c5702325ce6 100644 --- a/runtime/vara/src/weights/pallet_gear.rs +++ b/runtime/vara/src/weights/pallet_gear.rs @@ -215,6 +215,17 @@ pub trait WeightInfo { fn instr_i32rotl(r: u32, ) -> Weight; fn instr_i64rotr(r: u32, ) -> Weight; fn instr_i32rotr(r: u32, ) -> Weight; + fn tasks_remove_resume_session() -> Weight; + fn tasks_remove_gas_reservation() -> Weight; + fn tasks_send_user_message_to_mailbox() -> Weight; + fn tasks_send_user_message() -> Weight; + fn tasks_send_dispatch() -> Weight; + fn tasks_wake_message() -> Weight; + fn tasks_wake_message_no_wake() -> Weight; + fn tasks_remove_from_waitlist() -> Weight; + fn tasks_remove_from_mailbox() -> Weight; + fn tasks_pause_program(c: u32, ) -> Weight; + fn tasks_pause_program_uninited(c: u32, ) -> Weight; fn allocation_cost() -> Weight; fn grow_cost() -> Weight; fn initial_cost() -> Weight; @@ -2062,6 +2073,116 @@ impl pallet_gear::WeightInfo for SubstrateWeight { // Standard Error: 5_851 .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } + fn tasks_remove_resume_session() -> Weight { + // Proof Size summary in bytes: + // Measured: `352` + // Estimated: `4169` + // Minimum execution time: 6_081_000 picoseconds. + Weight::from_parts(6_314_000, 4169) + .saturating_add(T::DbWeight::get().reads(1_u64)) + .saturating_add(T::DbWeight::get().writes(2_u64)) + } + fn tasks_remove_gas_reservation() -> Weight { + // Proof Size summary in bytes: + // Measured: `1107` + // Estimated: `24053` + // Minimum execution time: 61_245_000 picoseconds. + Weight::from_parts(64_310_000, 24053) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + fn tasks_send_user_message_to_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `888` + // Estimated: `22158` + // Minimum execution time: 47_184_000 picoseconds. + Weight::from_parts(48_335_000, 22158) + .saturating_add(T::DbWeight::get().reads(6_u64)) + .saturating_add(T::DbWeight::get().writes(5_u64)) + } + fn tasks_send_user_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `1010` + // Estimated: `34619` + // Minimum execution time: 75_767_000 picoseconds. + Weight::from_parts(77_229_000, 34619) + .saturating_add(T::DbWeight::get().reads(11_u64)) + .saturating_add(T::DbWeight::get().writes(10_u64)) + } + fn tasks_send_dispatch() -> Weight { + // Proof Size summary in bytes: + // Measured: `695` + // Estimated: `20509` + // Minimum execution time: 31_513_000 picoseconds. + Weight::from_parts(33_232_000, 20509) + .saturating_add(T::DbWeight::get().reads(7_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + fn tasks_wake_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `976` + // Estimated: `26636` + // Minimum execution time: 48_739_000 picoseconds. + Weight::from_parts(49_963_000, 26636) + .saturating_add(T::DbWeight::get().reads(8_u64)) + .saturating_add(T::DbWeight::get().writes(6_u64)) + } + fn tasks_wake_message_no_wake() -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `3545` + // Minimum execution time: 3_513_000 picoseconds. + Weight::from_parts(3_670_000, 3545) + .saturating_add(T::DbWeight::get().reads(1_u64)) + } + fn tasks_remove_from_waitlist() -> Weight { + // Proof Size summary in bytes: + // Measured: `1626` + // Estimated: `58232` + // Minimum execution time: 109_582_000 picoseconds. + Weight::from_parts(112_343_000, 58232) + .saturating_add(T::DbWeight::get().reads(16_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) + } + fn tasks_remove_from_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `1332` + // Estimated: `46962` + // Minimum execution time: 90_789_000 picoseconds. + Weight::from_parts(93_329_000, 46962) + .saturating_add(T::DbWeight::get().reads(14_u64)) + .saturating_add(T::DbWeight::get().writes(13_u64)) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2303 + c * (16400 ±0)` + // Estimated: `19878 + c * (84480 ±0)` + // Minimum execution time: 31_262_000 picoseconds. + Weight::from_parts(31_610_000, 19878) + // Standard Error: 69_131 + .saturating_add(Weight::from_parts(39_928_419, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(4_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes(2_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 84480).saturating_mul(c.into())) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program_uninited(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `3129 + c * (42 ±0)` + // Estimated: `60575 + c * (2947 ±0)` + // Minimum execution time: 91_223_000 picoseconds. + Weight::from_parts(98_002_861, 60575) + // Standard Error: 2_086 + .saturating_add(Weight::from_parts(1_092_801, 0).saturating_mul(c.into())) + .saturating_add(T::DbWeight::get().reads(13_u64)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(T::DbWeight::get().writes(9_u64)) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2947).saturating_mul(c.into())) + } } // For backwards compatibility and tests @@ -3903,4 +4024,114 @@ impl WeightInfo for () { // Standard Error: 5_851 .saturating_add(Weight::from_parts(639_333, 0).saturating_mul(r.into())) } + fn tasks_remove_resume_session() -> Weight { + // Proof Size summary in bytes: + // Measured: `352` + // Estimated: `4169` + // Minimum execution time: 6_081_000 picoseconds. + Weight::from_parts(6_314_000, 4169) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + } + fn tasks_remove_gas_reservation() -> Weight { + // Proof Size summary in bytes: + // Measured: `1107` + // Estimated: `24053` + // Minimum execution time: 61_245_000 picoseconds. + Weight::from_parts(64_310_000, 24053) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + fn tasks_send_user_message_to_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `888` + // Estimated: `22158` + // Minimum execution time: 47_184_000 picoseconds. + Weight::from_parts(48_335_000, 22158) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(5_u64)) + } + fn tasks_send_user_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `1010` + // Estimated: `34619` + // Minimum execution time: 75_767_000 picoseconds. + Weight::from_parts(77_229_000, 34619) + .saturating_add(RocksDbWeight::get().reads(11_u64)) + .saturating_add(RocksDbWeight::get().writes(10_u64)) + } + fn tasks_send_dispatch() -> Weight { + // Proof Size summary in bytes: + // Measured: `695` + // Estimated: `20509` + // Minimum execution time: 31_513_000 picoseconds. + Weight::from_parts(33_232_000, 20509) + .saturating_add(RocksDbWeight::get().reads(7_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + fn tasks_wake_message() -> Weight { + // Proof Size summary in bytes: + // Measured: `976` + // Estimated: `26636` + // Minimum execution time: 48_739_000 picoseconds. + Weight::from_parts(49_963_000, 26636) + .saturating_add(RocksDbWeight::get().reads(8_u64)) + .saturating_add(RocksDbWeight::get().writes(6_u64)) + } + fn tasks_wake_message_no_wake() -> Weight { + // Proof Size summary in bytes: + // Measured: `80` + // Estimated: `3545` + // Minimum execution time: 3_513_000 picoseconds. + Weight::from_parts(3_670_000, 3545) + .saturating_add(RocksDbWeight::get().reads(1_u64)) + } + fn tasks_remove_from_waitlist() -> Weight { + // Proof Size summary in bytes: + // Measured: `1626` + // Estimated: `58232` + // Minimum execution time: 109_582_000 picoseconds. + Weight::from_parts(112_343_000, 58232) + .saturating_add(RocksDbWeight::get().reads(16_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) + } + fn tasks_remove_from_mailbox() -> Weight { + // Proof Size summary in bytes: + // Measured: `1332` + // Estimated: `46962` + // Minimum execution time: 90_789_000 picoseconds. + Weight::from_parts(93_329_000, 46962) + .saturating_add(RocksDbWeight::get().reads(14_u64)) + .saturating_add(RocksDbWeight::get().writes(13_u64)) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `2303 + c * (16400 ±0)` + // Estimated: `19878 + c * (84480 ±0)` + // Minimum execution time: 31_262_000 picoseconds. + Weight::from_parts(31_610_000, 19878) + // Standard Error: 69_131 + .saturating_add(Weight::from_parts(39_928_419, 0).saturating_mul(c.into())) + .saturating_add(RocksDbWeight::get().reads(4_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(RocksDbWeight::get().writes(2_u64)) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 84480).saturating_mul(c.into())) + } + /// The range of component `c` is `[0, 2044]`. + fn tasks_pause_program_uninited(c: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `3129 + c * (42 ±0)` + // Estimated: `60575 + c * (2947 ±0)` + // Minimum execution time: 91_223_000 picoseconds. + Weight::from_parts(98_002_861, 60575) + // Standard Error: 2_086 + .saturating_add(Weight::from_parts(1_092_801, 0).saturating_mul(c.into())) + .saturating_add(RocksDbWeight::get().reads(13_u64)) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(c.into()))) + .saturating_add(RocksDbWeight::get().writes(9_u64)) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(c.into()))) + .saturating_add(Weight::from_parts(0, 2947).saturating_mul(c.into())) + } } From 766c8bc3ade9f330e14b68e1381d52985139c0ec Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Mon, 18 Sep 2023 15:04:52 +0300 Subject: [PATCH 147/165] feat(runtime-fuzzer): Aggregational PR for different fuzzer features and adjustments (#3268) --- docker/runtime-fuzzer/Dockerfile | 2 +- utils/node-loader/src/utils.rs | 28 +++- utils/runtime-fuzzer/Cargo.toml | 4 + utils/runtime-fuzzer/README.md | 2 +- utils/runtime-fuzzer/bin/run_corpus.rs | 58 ++++++++ utils/runtime-fuzzer/src/arbitrary_call.rs | 31 +++- utils/wasm-gen/src/config.rs | 20 +++ utils/wasm-gen/src/config/generator.rs | 6 +- utils/wasm-gen/src/config/syscalls.rs | 50 +++---- utils/wasm-gen/src/config/syscalls/amount.rs | 34 +++-- utils/wasm-gen/src/config/syscalls/param.rs | 12 +- utils/wasm-gen/src/generator/syscalls.rs | 38 +++++ .../src/generator/syscalls/additional_data.rs | 4 +- .../src/generator/syscalls/imports.rs | 132 ++++++++---------- .../src/generator/syscalls/invocator.rs | 114 ++++++++------- utils/wasm-gen/src/tests.rs | 30 ++-- 16 files changed, 381 insertions(+), 184 deletions(-) create mode 100644 utils/runtime-fuzzer/bin/run_corpus.rs diff --git a/docker/runtime-fuzzer/Dockerfile b/docker/runtime-fuzzer/Dockerfile index 339055cb3b4..9cf7f8550f4 100644 --- a/docker/runtime-fuzzer/Dockerfile +++ b/docker/runtime-fuzzer/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.10 +FROM ubuntu:22.04 MAINTAINER GEAR diff --git a/utils/node-loader/src/utils.rs b/utils/node-loader/src/utils.rs index 9beff5e7cda..d63d12ea75a 100644 --- a/utils/node-loader/src/utils.rs +++ b/utils/node-loader/src/utils.rs @@ -6,7 +6,10 @@ use gear_call_gen::Seed; use gear_core::ids::{MessageId, ProgramId}; use gear_core_errors::ReplyCode; use gear_utils::NonEmpty; -use gear_wasm_gen::{EntryPointsSet, StandardGearWasmConfigsBundle}; +use gear_wasm_gen::{ + EntryPointsSet, InvocableSysCall, ParamType, StandardGearWasmConfigsBundle, SysCallName, + SysCallsInjectionAmounts, SysCallsParamsConfig, +}; use gsdk::metadata::runtime_types::{ gear_common::event::DispatchStatus as GenDispatchStatus, gear_core::{ @@ -209,10 +212,33 @@ pub fn get_wasm_gen_config( seed: Seed, existing_programs: impl Iterator, ) -> StandardGearWasmConfigsBundle { + let initial_pages = 2; + let mut injection_amounts = SysCallsInjectionAmounts::all_once(); + injection_amounts.set_multiple( + [ + (SysCallName::Leave, 0..=0), + (SysCallName::Panic, 0..=0), + (SysCallName::OomPanic, 0..=0), + (SysCallName::Send, 20..=30), + (SysCallName::Exit, 0..=1), + (SysCallName::Alloc, 5..=10), + (SysCallName::Free, 5..=10), + ] + .map(|(sys_call, range)| (InvocableSysCall::Loose(sys_call), range)) + .into_iter(), + ); + + let mut params_config = SysCallsParamsConfig::default(); + params_config.add_rule(ParamType::Alloc, (1..=10).into()); + params_config.add_rule(ParamType::Free, (initial_pages..=initial_pages + 25).into()); + StandardGearWasmConfigsBundle { log_info: Some(format!("Gear program seed = '{seed}'")), existing_addresses: NonEmpty::collect(existing_programs), entry_points_set: EntryPointsSet::InitHandleHandleReply, + injection_amounts, + params_config, + initial_pages: initial_pages as u32, ..Default::default() } } diff --git a/utils/runtime-fuzzer/Cargo.toml b/utils/runtime-fuzzer/Cargo.toml index 0c145193e63..410ab54b0f9 100644 --- a/utils/runtime-fuzzer/Cargo.toml +++ b/utils/runtime-fuzzer/Cargo.toml @@ -4,6 +4,10 @@ version = "0.1.0" authors.workspace = true edition.workspace = true +[[bin]] +name = "run_corpus" +path = "bin/run_corpus.rs" + [dependencies] anyhow.workspace = true arbitrary.workspace = true diff --git a/utils/runtime-fuzzer/README.md b/utils/runtime-fuzzer/README.md index a7600d80bf9..8c141ea4f23 100644 --- a/utils/runtime-fuzzer/README.md +++ b/utils/runtime-fuzzer/README.md @@ -70,7 +70,7 @@ There are two ways to view coverage: ```bash # generate `lcov.info` file with coverage HOST_TARGET=$(rustc -Vv | grep "host: " | sed "s/^host: \(.*\)$/\1/") - cargo cov -- export target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/main \ + cargo cov -- export target/$HOST_TARGET/coverage/$HOST_TARGET/release/main \ --format=lcov \ --instr-profile=fuzz/coverage/main/coverage.profdata \ --ignore-filename-regex=/rustc/ \ diff --git a/utils/runtime-fuzzer/bin/run_corpus.rs b/utils/runtime-fuzzer/bin/run_corpus.rs new file mode 100644 index 00000000000..fd4e2aaa66b --- /dev/null +++ b/utils/runtime-fuzzer/bin/run_corpus.rs @@ -0,0 +1,58 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Runs provided from the cli corpus +//! +//! Alternatively, `cargo fuzz run` can be used to reproduce some corpus, +//! but it won't give logs of [`GearCalls`] generation, which sheds some +//! light on how `gear-wasm-gen` worked. +//! +//! Also that script can be used to run any bytes input, not only fuzzer's +//! corpus. +//! +//! Just simply run `cargo run --release -- -p `. + +use anyhow::Result; +use arbitrary::{Arbitrary, Unstructured}; +use clap::Parser; +use runtime_fuzzer::{self, GearCalls}; +use std::{fs, path::PathBuf}; + +/// A simple tool to run corpus. +#[derive(Debug, Parser)] +#[command(author, version, about, long_about = None)] +struct Params { + /// Path to the file, which contains corpus. + #[arg(short, long)] + path: PathBuf, +} + +fn main() -> Result<()> { + let params = Params::parse(); + + let corpus_bytes = fs::read(params.path)?; + + gear_utils::init_default_logger(); + + let mut unstructured = Unstructured::new(&corpus_bytes); + let gear_calls = GearCalls::arbitrary(&mut unstructured)?; + + runtime_fuzzer::run(gear_calls); + + Ok(()) +} diff --git a/utils/runtime-fuzzer/src/arbitrary_call.rs b/utils/runtime-fuzzer/src/arbitrary_call.rs index e8eb10c5c70..5f4d9f5836f 100644 --- a/utils/runtime-fuzzer/src/arbitrary_call.rs +++ b/utils/runtime-fuzzer/src/arbitrary_call.rs @@ -23,7 +23,8 @@ use arbitrary::{Arbitrary, Result, Unstructured}; use gear_core::ids::{CodeId, ProgramId}; use gear_utils::NonEmpty; use gear_wasm_gen::{ - EntryPointsSet, StandardGearWasmConfigsBundle, SysCallName, SysCallsInjectionAmounts, + EntryPointsSet, InvocableSysCall, ParamType, StandardGearWasmConfigsBundle, SysCallName, + SysCallsInjectionAmounts, SysCallsParamsConfig, }; use sha1::*; use std::{ @@ -190,12 +191,28 @@ fn config( programs: [ProgramId; GearCalls::INIT_MSGS], log_info: Option, ) -> StandardGearWasmConfigsBundle { + let initial_pages = 2; let mut injection_amounts = SysCallsInjectionAmounts::all_once(); - injection_amounts.set(SysCallName::Leave, 0, 0); - injection_amounts.set(SysCallName::Panic, 0, 0); - injection_amounts.set(SysCallName::OomPanic, 0, 0); - injection_amounts.set(SysCallName::Send, 20, 30); - injection_amounts.set(SysCallName::Exit, 0, 1); + injection_amounts.set_multiple( + [ + (SysCallName::Leave, 0..=0), + (SysCallName::Panic, 0..=0), + (SysCallName::OomPanic, 0..=0), + (SysCallName::Send, 20..=30), + (SysCallName::Exit, 0..=1), + (SysCallName::Alloc, 20..=30), + (SysCallName::Free, 20..=30), + ] + .map(|(sys_call, range)| (InvocableSysCall::Loose(sys_call), range)) + .into_iter(), + ); + + let mut params_config = SysCallsParamsConfig::default(); + params_config.add_rule(ParamType::Alloc, (10..=20).into()); + params_config.add_rule( + ParamType::Free, + (initial_pages..=initial_pages + 250).into(), + ); let existing_addresses = NonEmpty::collect( programs @@ -214,6 +231,8 @@ fn config( injection_amounts, existing_addresses, log_info, + params_config, + initial_pages: initial_pages as u32, ..Default::default() } } diff --git a/utils/wasm-gen/src/config.rs b/utils/wasm-gen/src/config.rs index e07b62de0e7..5993ab0283e 100644 --- a/utils/wasm-gen/src/config.rs +++ b/utils/wasm-gen/src/config.rs @@ -147,6 +147,12 @@ pub struct StandardGearWasmConfigsBundle { pub injection_amounts: SysCallsInjectionAmounts, /// Config of gear wasm call entry-points (exports). pub entry_points_set: EntryPointsSet, + /// Initial wasm memory pages. + pub initial_pages: u32, + /// Optional stack end pages. + pub stack_end_page: Option, + /// Sys-calls params config + pub params_config: SysCallsParamsConfig, } impl Default for StandardGearWasmConfigsBundle { @@ -158,6 +164,9 @@ impl Default for StandardGearWasmConfigsBundle { call_indirect_enabled: true, injection_amounts: SysCallsInjectionAmounts::all_once(), entry_points_set: Default::default(), + initial_pages: DEFAULT_INITIAL_SIZE, + stack_end_page: None, + params_config: SysCallsParamsConfig::default(), } } } @@ -171,6 +180,9 @@ impl> ConfigsBundle for StandardGearWasmConfigsBundle { call_indirect_enabled, injection_amounts, entry_points_set, + initial_pages, + stack_end_page, + params_config, } = self; let selectable_params = SelectableParams { @@ -188,10 +200,18 @@ impl> ConfigsBundle for StandardGearWasmConfigsBundle { } else { sys_calls_config_builder = sys_calls_config_builder.with_source_msg_dest(); } + sys_calls_config_builder = sys_calls_config_builder.with_params_config(params_config); + + let memory_pages_config = MemoryPagesConfig { + initial_size: initial_pages, + stack_end_page, + upper_limit: None, + }; let gear_wasm_generator_config = GearWasmGeneratorConfigBuilder::new() .with_recursions_removed(remove_recursion) .with_sys_calls_config(sys_calls_config_builder.build()) .with_entry_points_config(entry_points_set) + .with_memory_config(memory_pages_config) .build(); (gear_wasm_generator_config, selectable_params) diff --git a/utils/wasm-gen/src/config/generator.rs b/utils/wasm-gen/src/config/generator.rs index 5ee9341d8bd..7d831396143 100644 --- a/utils/wasm-gen/src/config/generator.rs +++ b/utils/wasm-gen/src/config/generator.rs @@ -20,6 +20,8 @@ use crate::SysCallsConfig; +pub(crate) const DEFAULT_INITIAL_SIZE: u32 = 16; + /// Builder for [`GearWasmGeneratorConfig`]. pub struct GearWasmGeneratorConfigBuilder(GearWasmGeneratorConfig); @@ -95,9 +97,9 @@ pub struct MemoryPagesConfig { impl Default for MemoryPagesConfig { fn default() -> Self { Self { - initial_size: Self::MAX_VALUE / 2 + 5, + initial_size: DEFAULT_INITIAL_SIZE, upper_limit: None, - stack_end_page: Some(Self::MAX_VALUE / 2), + stack_end_page: None, } } } diff --git a/utils/wasm-gen/src/config/syscalls.rs b/utils/wasm-gen/src/config/syscalls.rs index b9a37a4ed17..baa69462473 100644 --- a/utils/wasm-gen/src/config/syscalls.rs +++ b/utils/wasm-gen/src/config/syscalls.rs @@ -41,7 +41,7 @@ impl SysCallsConfigBuilder { Self(SysCallsConfig { injection_amounts, params_config: SysCallsParamsConfig::default(), - sending_message_destination: MessageDestination::default(), + sys_call_destination: SysCallDestination::default(), error_processing_config: ErrorProcessingConfig::None, log_info: None, }) @@ -54,23 +54,23 @@ impl SysCallsConfigBuilder { self } - /// Set whether `gr_send*` sys-calls must use `gr_source` result for message destination. + /// Set whether `gr_send*` and `gr_exit` sys-calls must use `gr_source` result for sys-call destination. pub fn with_source_msg_dest(mut self) -> Self { - self.0.sending_message_destination = MessageDestination::Source; - self.enable_sys_call(SysCallName::Source); + self.0.sys_call_destination = SysCallDestination::Source; + self.enable_sys_call(InvocableSysCall::Loose(SysCallName::Source)); self } - /// Set whether `gr_send*` sys-calls must use some address from `addresses` collection - /// as a message destination. + /// Set whether `gr_send*` and `gr_exit` sys-calls must use some address from `addresses` collection + /// as a sys-call destination. pub fn with_data_offset_msg_dest>(mut self, addresses: NonEmpty) -> Self { let addresses = NonEmpty::collect(addresses.into_iter().map(|pid| HashWithValue { hash: pid.into(), value: 0, })) .expect("collected from non empty"); - self.0.sending_message_destination = MessageDestination::ExistingAddresses(addresses); + self.0.sys_call_destination = SysCallDestination::ExistingAddresses(addresses); self } @@ -81,7 +81,7 @@ impl SysCallsConfigBuilder { /// Choosing gear export to log data is done from best `init` to worse `handle`. pub fn with_log_info(mut self, log: String) -> Self { self.0.log_info = Some(log); - self.enable_sys_call(SysCallName::Debug); + self.enable_sys_call(InvocableSysCall::Loose(SysCallName::Debug)); self } @@ -93,7 +93,7 @@ impl SysCallsConfigBuilder { self } - fn enable_sys_call(&mut self, name: SysCallName) { + fn enable_sys_call(&mut self, name: InvocableSysCall) { let range = self.0.injection_amounts.get(name); let range_start = *range.start(); @@ -138,22 +138,22 @@ impl ErrorProcessingConfig { pub struct SysCallsConfig { injection_amounts: SysCallsInjectionAmounts, params_config: SysCallsParamsConfig, - sending_message_destination: MessageDestination, + sys_call_destination: SysCallDestination, error_processing_config: ErrorProcessingConfig, log_info: Option, } impl SysCallsConfig { /// Get possible number of times (range) the sys-call can be injected in the wasm. - pub fn injection_amounts(&self, name: SysCallName) -> RangeInclusive { + pub fn injection_amounts(&self, name: InvocableSysCall) -> RangeInclusive { self.injection_amounts.get(name) } - /// Get defined message destination for `gr_send*` sys-calls. + /// Get defined sys-call destination for `gr_send*` and `gr_exit` sys-calls. /// - /// For more info, read [`MessageDestination`]. - pub fn sending_message_destination(&self) -> &MessageDestination { - &self.sending_message_destination + /// For more info, read [`SysCallDestination`]. + pub fn sys_call_destination(&self) -> &SysCallDestination { + &self.sys_call_destination } /// Get defined log info. @@ -174,33 +174,33 @@ impl SysCallsConfig { } } -/// Message destination choice. +/// Sys-call destination choice. /// -/// `gr_send*` sys-calls generated from this crate can send messages +/// `gr_send*` and `gr_exit` sys-calls generated from this crate can be sent /// to different destination in accordance to the config. /// It's either to the message source, to some existing known address, /// or to some random, most probably non-existing, address. #[derive(Debug, Clone, Default)] -pub enum MessageDestination { +pub enum SysCallDestination { Source, ExistingAddresses(NonEmpty), #[default] Random, } -impl MessageDestination { - /// Check whether message destination is a result of `gr_source`. +impl SysCallDestination { + /// Check whether sys-call destination is a result of `gr_source`. pub fn is_source(&self) -> bool { - matches!(&self, MessageDestination::Source) + matches!(&self, SysCallDestination::Source) } - /// Check whether message destination is defined randomly. + /// Check whether sys-call destination is defined randomly. pub fn is_random(&self) -> bool { - matches!(&self, MessageDestination::Random) + matches!(&self, SysCallDestination::Random) } - /// Check whether message destination is defined from a collection of existing addresses. + /// Check whether sys-call destination is defined from a collection of existing addresses. pub fn is_existing_addresses(&self) -> bool { - matches!(&self, MessageDestination::ExistingAddresses(_)) + matches!(&self, SysCallDestination::ExistingAddresses(_)) } } diff --git a/utils/wasm-gen/src/config/syscalls/amount.rs b/utils/wasm-gen/src/config/syscalls/amount.rs index 10653a8ab74..58350dea518 100644 --- a/utils/wasm-gen/src/config/syscalls/amount.rs +++ b/utils/wasm-gen/src/config/syscalls/amount.rs @@ -20,36 +20,44 @@ //! //! Types here are used to create [`crate::SysCallsConfig`]. +use crate::InvocableSysCall; + use gear_wasm_instrument::syscalls::SysCallName; use std::{collections::HashMap, ops::RangeInclusive}; /// Possible injection amount ranges for each sys-call. #[derive(Debug, Clone)] -pub struct SysCallsInjectionAmounts(HashMap>); +pub struct SysCallsInjectionAmounts(HashMap>); impl SysCallsInjectionAmounts { /// Instantiate a sys-calls amounts ranges map, where each gear sys-call is injected into wasm-module only once. pub fn all_once() -> Self { - Self( - SysCallName::instrumentable() - .into_iter() - .map(|name| (name, (1..=1))) - .collect(), - ) + Self::new_with_range(1..=1) } /// Instantiate a sys-calls amounts ranges map, where no gear sys-call is ever injected into wasm-module. pub fn all_never() -> Self { + Self::new_with_range(0..=0) + } + + /// Instantiate a sys-calls amounts ranges map with given range. + fn new_with_range(range: RangeInclusive) -> Self { + let sys_calls = SysCallName::instrumentable(); Self( - SysCallName::instrumentable() - .into_iter() - .map(|name| (name, (0..=0))) + sys_calls + .iter() + .cloned() + .map(|name| (InvocableSysCall::Loose(name), range.clone())) + .chain(sys_calls.iter().cloned().filter_map(|name| { + InvocableSysCall::has_precise_variant(name) + .then_some((InvocableSysCall::Precise(name), range.clone())) + })) .collect(), ) } /// Get amount possible sys-call amount range. - pub fn get(&self, name: SysCallName) -> RangeInclusive { + pub fn get(&self, name: InvocableSysCall) -> RangeInclusive { self.0 .get(&name) .cloned() @@ -57,14 +65,14 @@ impl SysCallsInjectionAmounts { } /// Sets possible amount range for the the sys-call. - pub fn set(&mut self, name: SysCallName, min: u32, max: u32) { + pub fn set(&mut self, name: InvocableSysCall, min: u32, max: u32) { self.0.insert(name, min..=max); } /// Same as [`SysCallsAmountRanges::set`], but sets amount ranges for multiple sys-calls. pub fn set_multiple( &mut self, - sys_calls_freqs: impl Iterator)>, + sys_calls_freqs: impl Iterator)>, ) { self.0.extend(sys_calls_freqs) } diff --git a/utils/wasm-gen/src/config/syscalls/param.rs b/utils/wasm-gen/src/config/syscalls/param.rs index 81b94c3e90b..705bdd580ed 100644 --- a/utils/wasm-gen/src/config/syscalls/param.rs +++ b/utils/wasm-gen/src/config/syscalls/param.rs @@ -20,10 +20,12 @@ //! //! Types here are used to create [`crate::SysCallsConfig`]. +use crate::DEFAULT_INITIAL_SIZE; use arbitrary::{Result, Unstructured}; -use gear_wasm_instrument::syscalls::ParamType; use std::{collections::HashMap, ops::RangeInclusive}; +pub use gear_wasm_instrument::syscalls::ParamType; + /// Sys-calls params config. /// /// This is basically a map, which creates a relationship between each kind of @@ -42,6 +44,10 @@ use std::{collections::HashMap, ops::RangeInclusive}; pub struct SysCallsParamsConfig(HashMap); impl SysCallsParamsConfig { + pub fn empty() -> Self { + Self(HashMap::new()) + } + /// New [`SysCallsParamsConfig`] with all rules set to produce one constant value. pub fn all_constant_value(value: i64) -> Self { let allowed_values: SysCallParamAllowedValues = (value..=value).into(); @@ -77,6 +83,8 @@ impl SysCallsParamsConfig { impl Default for SysCallsParamsConfig { fn default() -> Self { + let free_start = DEFAULT_INITIAL_SIZE as i64; + let free_end = free_start + 5; Self( [ (ParamType::Size, (0..=0x10000).into()), @@ -87,7 +95,7 @@ impl Default for SysCallsParamsConfig { (ParamType::Duration, (1..=8).into()), (ParamType::Delay, (0..=4).into()), (ParamType::Handler, (0..=100).into()), - (ParamType::Free, (0..=512).into()), + (ParamType::Free, (free_start..=free_end).into()), ] .into_iter() .collect(), diff --git a/utils/wasm-gen/src/generator/syscalls.rs b/utils/wasm-gen/src/generator/syscalls.rs index 5b667c216fe..20997838ed6 100644 --- a/utils/wasm-gen/src/generator/syscalls.rs +++ b/utils/wasm-gen/src/generator/syscalls.rs @@ -113,6 +113,44 @@ impl InvocableSysCall { } } + /// Checks whether given sys-call has the precise variant. + pub(crate) fn has_precise_variant(sys_call: SysCallName) -> bool { + Self::required_imports_for_sys_call(sys_call).is_some() + } + + /// Returns the required imports to build precise sys-call. + fn required_imports_for_sys_call(sys_call: SysCallName) -> Option<&'static [SysCallName]> { + // NOTE: the last sys-call must be pattern itself + Some(match sys_call { + SysCallName::ReservationSend => { + &[SysCallName::ReserveGas, SysCallName::ReservationSend] + } + SysCallName::ReservationReply => { + &[SysCallName::ReserveGas, SysCallName::ReservationReply] + } + SysCallName::SendCommit => &[ + SysCallName::SendInit, + SysCallName::SendPush, + SysCallName::SendCommit, + ], + SysCallName::SendCommitWGas => &[ + SysCallName::Size, + SysCallName::SendInit, + SysCallName::SendPushInput, + SysCallName::SendCommitWGas, + ], + _ => return None, + }) + } + + /// Returns the required imports to build precise sys-call, but of a fixed size. + fn required_imports(sys_call: SysCallName) -> &'static [SysCallName; N] { + Self::required_imports_for_sys_call(sys_call) + .expect("failed to find required imports for sys-call") + .try_into() + .expect("failed to convert slice") + } + // If syscall changes from fallible into infallible or vice versa in future, // we'll see it by analyzing code coverage stats produced by fuzzer. pub(crate) fn is_fallible(&self) -> bool { diff --git a/utils/wasm-gen/src/generator/syscalls/additional_data.rs b/utils/wasm-gen/src/generator/syscalls/additional_data.rs index 4a2cdbb3751..ed31137c446 100644 --- a/utils/wasm-gen/src/generator/syscalls/additional_data.rs +++ b/utils/wasm-gen/src/generator/syscalls/additional_data.rs @@ -23,7 +23,7 @@ use crate::{ CallIndexes, CallIndexesHandle, DisabledSysCallsImportsGenerator, ModuleWithCallIndexes, SysCallsImportsGenerationProof, }, - utils, EntryPointName, InvocableSysCall, MessageDestination, SysCallsConfig, WasmModule, + utils, EntryPointName, InvocableSysCall, SysCallDestination, SysCallsConfig, WasmModule, }; use arbitrary::Unstructured; use gear_core::ids::ProgramId; @@ -140,7 +140,7 @@ impl<'a, 'b> AdditionalDataInjector<'a, 'b> { )); } - let MessageDestination::ExistingAddresses(existing_addresses) = self.config.sending_message_destination() else { + let SysCallDestination::ExistingAddresses(existing_addresses) = self.config.sys_call_destination() else { return None; }; diff --git a/utils/wasm-gen/src/generator/syscalls/imports.rs b/utils/wasm-gen/src/generator/syscalls/imports.rs index 8389f943f08..91887407814 100644 --- a/utils/wasm-gen/src/generator/syscalls/imports.rs +++ b/utils/wasm-gen/src/generator/syscalls/imports.rs @@ -57,16 +57,9 @@ pub struct SysCallsImportsGeneratorInstantiator<'a, 'b>( ), ); -/// The set of sys-calls that need to be imported to create precise sys-call. -#[derive(thiserror::Error, Debug)] -#[error("The following sys-calls must be imported: {0:?}")] -pub struct RequiredSysCalls(&'static [SysCallName]); - /// An error that occurs when generating precise sys-call. #[derive(thiserror::Error, Debug)] pub enum PreciseSysCallError { - #[error("{0}")] - RequiredImports(#[from] RequiredSysCalls), #[error("{0}")] Arbitrary(#[from] ArbitraryError), } @@ -197,16 +190,32 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { /// Generates precise sys-calls and handles errors if any occurred during generation. fn generate_precise_sys_calls(&mut self) -> Result<()> { - for result in [ - self.generate_send_from_reservation(), - self.generate_reply_from_reservation(), - self.generate_send_commit(), - self.generate_send_commit_with_gas(), - ] { - if let Err(err) = result { - match err { - PreciseSysCallError::RequiredImports(err) => log::trace!("{err}"), - PreciseSysCallError::Arbitrary(err) => return Err(err), + use SysCallName::*; + + #[allow(clippy::type_complexity)] + let sys_calls: [( + SysCallName, + fn(&mut Self, SysCallName) -> Result<(), PreciseSysCallError>, + ); 4] = [ + (ReservationSend, Self::generate_send_from_reservation), + (ReservationReply, Self::generate_reply_from_reservation), + (SendCommit, Self::generate_send_commit), + (SendCommitWGas, Self::generate_send_commit_with_gas), + ]; + + for (sys_call, generate_method) in sys_calls { + let sys_call_amount_range = self + .config + .injection_amounts(InvocableSysCall::Precise(sys_call)); + let sys_call_amount = self.unstructured.int_in_range(sys_call_amount_range)?; + for _ in 0..sys_call_amount { + log::trace!( + "Constructing {name} sys-call...", + name = InvocableSysCall::Precise(sys_call).to_str() + ); + + if let Err(PreciseSysCallError::Arbitrary(err)) = generate_method(self, sys_call) { + return Err(err); } } } @@ -223,7 +232,9 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { &mut self, sys_call: SysCallName, ) -> Result> { - let sys_call_amount_range = self.config.injection_amounts(sys_call); + let sys_call_amount_range = self + .config + .injection_amounts(InvocableSysCall::Loose(sys_call)); let sys_call_amount = self.unstructured.int_in_range(sys_call_amount_range)?; Ok((sys_call_amount != 0).then(|| { let call_indexes_handle = self.insert_sys_call_import(sys_call); @@ -280,9 +291,9 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { /// Returns the indexes of invocable sys-calls. fn invocable_sys_calls_indexes( - &self, + &mut self, sys_calls: &'static [SysCallName; N], - ) -> Result<[usize; N], RequiredSysCalls> { + ) -> [usize; N] { let mut indexes = [0; N]; for (index, &sys_call) in indexes.iter_mut().zip(sys_calls.iter()) { @@ -290,10 +301,16 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { .sys_calls_imports .get(&InvocableSysCall::Loose(sys_call)) .map(|&(_, call_indexes_handle)| call_indexes_handle) - .ok_or_else(|| RequiredSysCalls(&sys_calls[..]))?; + .unwrap_or_else(|| { + // insert required import when we can't find it + let call_indexes_handle = self.insert_sys_call_import(sys_call); + self.sys_calls_imports + .insert(InvocableSysCall::Loose(sys_call), (0, call_indexes_handle)); + call_indexes_handle + }) } - Ok(indexes) + indexes } /// Generates a function which calls "properly" the given sys-call. @@ -327,13 +344,12 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { log::trace!( "Built proper call to {precise_sys_call_name}", - precise_sys_call_name = InvocableSysCall::Precise(sys_call).to_str() + precise_sys_call_name = invocable_sys_call.to_str() ); let call_indexes_handle = self.call_indexes.len(); self.call_indexes.add_func(func_idx.signature as usize); - // TODO: make separate config for precise sys-calls (#3122) self.sys_calls_imports .insert(invocable_sys_call, (1, call_indexes_handle)); } @@ -355,15 +371,12 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { } /// Generates a function which calls "properly" the `gr_reservation_send`. - fn generate_send_from_reservation(&mut self) -> Result<(), PreciseSysCallError> { - const SYS_CALL: SysCallName = SysCallName::ReservationSend; - log::trace!( - "Constructing {name} sys-call...", - name = InvocableSysCall::Precise(SYS_CALL).to_str() - ); - + fn generate_send_from_reservation( + &mut self, + sys_call: SysCallName, + ) -> Result<(), PreciseSysCallError> { let [reserve_gas_idx, reservation_send_idx] = - self.invocable_sys_calls_indexes(&[SysCallName::ReserveGas, SYS_CALL])?; + self.invocable_sys_calls_indexes(InvocableSysCall::required_imports(sys_call)); // subtract to be sure we are in memory boundaries. let rid_pid_value_ptr = self.reserve_memory(); @@ -443,21 +456,18 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { Instruction::End, ]); - self.generate_proper_sys_call_invocation(SYS_CALL, func_instructions); + self.generate_proper_sys_call_invocation(sys_call, func_instructions); Ok(()) } /// Generates a function which calls "properly" the `gr_reservation_reply`. - fn generate_reply_from_reservation(&mut self) -> Result<(), PreciseSysCallError> { - const SYS_CALL: SysCallName = SysCallName::ReservationReply; - log::trace!( - "Constructing {name} sys-call...", - name = InvocableSysCall::Precise(SYS_CALL).to_str() - ); - + fn generate_reply_from_reservation( + &mut self, + sys_call: SysCallName, + ) -> Result<(), PreciseSysCallError> { let [reserve_gas_idx, reservation_reply_idx] = - self.invocable_sys_calls_indexes(&[SysCallName::ReserveGas, SYS_CALL])?; + self.invocable_sys_calls_indexes(InvocableSysCall::required_imports(sys_call)); // subtract to be sure we are in memory boundaries. let rid_value_ptr = self.reserve_memory(); @@ -518,25 +528,15 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { Instruction::End, ]); - self.generate_proper_sys_call_invocation(SYS_CALL, func_instructions); + self.generate_proper_sys_call_invocation(sys_call, func_instructions); Ok(()) } /// Generates a function which calls "properly" the `gr_send_commit`. - fn generate_send_commit(&mut self) -> Result<(), PreciseSysCallError> { - const SYS_CALL: SysCallName = SysCallName::SendCommit; - log::trace!( - "Constructing {name} sys-call...", - name = InvocableSysCall::Precise(SYS_CALL).to_str() - ); - + fn generate_send_commit(&mut self, sys_call: SysCallName) -> Result<(), PreciseSysCallError> { let [send_init_idx, send_push_idx, send_commit_idx] = - self.invocable_sys_calls_indexes(&[ - SysCallName::SendInit, - SysCallName::SendPush, - SYS_CALL, - ])?; + self.invocable_sys_calls_indexes(InvocableSysCall::required_imports(sys_call)); // subtract to be sure we are in memory boundaries. let handle_ptr = self.reserve_memory(); @@ -620,26 +620,18 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { let func_instructions = Instructions::new(elements); - self.generate_proper_sys_call_invocation(SYS_CALL, func_instructions); + self.generate_proper_sys_call_invocation(sys_call, func_instructions); Ok(()) } /// Generates a function which calls "properly" the `gr_send_commit_wgas`. - fn generate_send_commit_with_gas(&mut self) -> Result<(), PreciseSysCallError> { - const SYS_CALL: SysCallName = SysCallName::SendCommitWGas; - log::trace!( - "Constructing {name} sys-call...", - name = InvocableSysCall::Precise(SYS_CALL).to_str() - ); - - let [size_idx, send_init_idx, send_push_input_idx, send_commit_wgas_idx] = self - .invocable_sys_calls_indexes(&[ - SysCallName::Size, - SysCallName::SendInit, - SysCallName::SendPushInput, - SYS_CALL, - ])?; + fn generate_send_commit_with_gas( + &mut self, + sys_call: SysCallName, + ) -> Result<(), PreciseSysCallError> { + let [size_idx, send_init_idx, send_push_input_idx, send_commit_wgas_idx] = + self.invocable_sys_calls_indexes(InvocableSysCall::required_imports(sys_call)); // subtract to be sure we are in memory boundaries. let handle_ptr = self.reserve_memory(); @@ -730,7 +722,7 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { let func_instructions = Instructions::new(elements); - self.generate_proper_sys_call_invocation(SYS_CALL, func_instructions); + self.generate_proper_sys_call_invocation(sys_call, func_instructions); Ok(()) } diff --git a/utils/wasm-gen/src/generator/syscalls/invocator.rs b/utils/wasm-gen/src/generator/syscalls/invocator.rs index 479913e10cf..df5d3fca451 100644 --- a/utils/wasm-gen/src/generator/syscalls/invocator.rs +++ b/utils/wasm-gen/src/generator/syscalls/invocator.rs @@ -35,7 +35,9 @@ use std::{collections::BTreeMap, iter}; #[derive(Debug)] pub(crate) enum ProcessedSysCallParams { - Alloc, + Alloc { + allowed_values: Option, + }, Value { value_type: ValueType, allowed_values: Option, @@ -56,7 +58,9 @@ pub(crate) fn process_sys_call_params( continue; } let processed_param = match param { - ParamType::Alloc => ProcessedSysCallParams::Alloc, + ParamType::Alloc => ProcessedSysCallParams::Alloc { + allowed_values: params_config.get_rule(¶m), + }, ParamType::Ptr(maybe_idx) => maybe_idx .map(|_| { // skipping next as we don't need the following `Size` param, @@ -87,7 +91,7 @@ pub(crate) fn process_sys_call_params( /// data injection outcome ([`AddressesInjectionOutcome`]). The latter was introduced /// to give additional guarantees for config and generators consistency. Otherwise, /// if there wasn't any addresses injection outcome, which signals that there was a try to -/// inject addresses, sys-calls invocator could falsely set `gr_send*` call's destination param +/// inject addresses, sys-calls invocator could falsely set `gr_send*` and `gr_exit` call's destination param /// to random value. For example, existing addresses could have been defined in the config, but /// additional data injector was disabled, before injecting addresses from the config. As a result, /// invocator would set un-intended by config values as messages destination. To avoid such @@ -170,8 +174,11 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { ); for (invocable, (amount, call_indexes_handle)) in self.sys_call_imports.clone() { - let instructions = - self.build_sys_call_invoke_instructions(invocable, call_indexes_handle)?; + let instructions = self.build_sys_call_invoke_instructions( + invocable, + invocable.into_signature(), + call_indexes_handle, + )?; log::trace!( "Inserting the {} sys_call {} times", @@ -200,6 +207,7 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { fn build_sys_call_invoke_instructions( &mut self, invocable: InvocableSysCall, + signature: SysCallSignature, call_indexes_handle: CallIndexesHandle, ) -> Result> { log::trace!( @@ -208,42 +216,37 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { self.unstructured.len() ); - let insert_error_processing = self - .config - .error_processing_config() - .error_should_be_processed(&invocable); - let (fallible, mut signature) = (invocable.is_fallible(), invocable.into_signature()); - - if self.is_not_send_sys_call(invocable) { + if self.is_sys_call_with_destination(invocable) { log::trace!( - " -- Generating build call for non-send sys-call {}", + " -- Generating build call for {} sys-call with destination", invocable.to_str() ); - return self.build_call( - signature, - fallible, - insert_error_processing, - call_indexes_handle, + + self.build_call_with_destination(invocable, signature, call_indexes_handle) + } else { + log::trace!( + " -- Generating build call for common sys-call {}", + invocable.to_str() ); - } - log::trace!( - " -- Generating build call for send sys-call {}", - invocable.to_str() - ); + self.build_call(invocable, signature, call_indexes_handle) + } + } + fn build_call_with_destination( + &mut self, + invocable: InvocableSysCall, + mut signature: SysCallSignature, + call_indexes_handle: CallIndexesHandle, + ) -> Result> { // The value for the first param is chosen from config. // It's either the result of `gr_source`, some existing address (set in the data section) or a completely random value. signature.params.remove(0); - let mut call_without_destination_instrs = self.build_call( - signature, - fallible, - insert_error_processing, - call_indexes_handle, - )?; + let mut call_without_destination_instrs = + self.build_call(invocable, signature, call_indexes_handle)?; - let res = if self.config.sending_message_destination().is_source() { - log::trace!(" -- Message destination is result of `gr_source`"); + let res = if self.config.sys_call_destination().is_source() { + log::trace!(" -- Sys-call destination is result of `gr_source`"); let gr_source_call_indexes_handle = self .sys_call_imports @@ -278,17 +281,14 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { let address_offset = match self.offsets.as_mut() { Some(offsets) => { - assert!(self - .config - .sending_message_destination() - .is_existing_addresses()); - log::trace!(" -- Message destination is an existing program address"); + assert!(self.config.sys_call_destination().is_existing_addresses()); + log::trace!(" -- Sys-call destination is an existing program address"); offsets.next_offset() } None => { - assert!(self.config.sending_message_destination().is_random()); - log::trace!(" -- Message destination is a random address"); + assert!(self.config.sys_call_destination().is_random()); + log::trace!(" -- Sys-call destination is a random address"); self.unstructured.arbitrary()? } @@ -303,23 +303,32 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { Ok(res) } - fn is_not_send_sys_call(&self, sys_call: InvocableSysCall) -> bool { + fn is_sys_call_with_destination(&self, sys_call: InvocableSysCall) -> bool { + self.is_send_sys_call(sys_call) || self.is_exit_sys_call(sys_call) + } + + fn is_send_sys_call(&self, sys_call: InvocableSysCall) -> bool { use InvocableSysCall::*; - ![ + [ Loose(SysCallName::Send), Loose(SysCallName::SendWGas), Loose(SysCallName::SendInput), Loose(SysCallName::SendInputWGas), Precise(SysCallName::ReservationSend), + Precise(SysCallName::SendCommit), + Precise(SysCallName::SendCommitWGas), ] .contains(&sys_call) } + fn is_exit_sys_call(&self, sys_call: InvocableSysCall) -> bool { + matches!(sys_call, InvocableSysCall::Loose(SysCallName::Exit)) + } + fn build_call( &mut self, + invocable: InvocableSysCall, signature: SysCallSignature, - fallible: bool, - insert_error_processing: bool, call_indexes_handle: CallIndexesHandle, ) -> Result> { let param_setters = self.build_param_setters(&signature.params)?; @@ -331,9 +340,14 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { instructions.push(Instruction::Call(call_indexes_handle as u32)); + let insert_error_processing = self + .config + .error_processing_config() + .error_should_be_processed(&invocable); + let mut result_processing = if !insert_error_processing { Self::build_result_processing_ignored(signature) - } else if fallible { + } else if invocable.is_fallible() { Self::build_result_processing_fallible(signature, ¶m_setters) } else { Self::build_result_processing_infallible(signature) @@ -360,15 +374,17 @@ impl<'a, 'b> SysCallsInvocator<'a, 'b> { let mut setters = Vec::with_capacity(params.len()); for processed_param in process_sys_call_params(params, self.config.params_config()) { match processed_param { - ProcessedSysCallParams::Alloc => { - let pages_to_alloc = self - .unstructured - .int_in_range(0..=mem_size_pages.saturating_sub(1))?; - let setter = ParamSetter::new_i32(pages_to_alloc as i32); + ProcessedSysCallParams::Alloc { allowed_values } => { + let pages_to_alloc = if let Some(allowed_values) = allowed_values { + allowed_values.get_i32(self.unstructured)? + } else { + let mem_size_pages = (mem_size_pages / 3).max(1); + self.unstructured.int_in_range(0..=mem_size_pages)? as i32 + }; log::trace!(" ---- Allocate memory - {pages_to_alloc}"); - setters.push(setter); + setters.push(ParamSetter::new_i32(pages_to_alloc)); } ProcessedSysCallParams::Value { value_type, diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index 1f45db0b6fd..57019510d32 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -18,17 +18,25 @@ use super::*; use arbitrary::Unstructured; -use gear_backend_common::{TerminationReason, TrapExplanation}; +use gear_backend_common::{BackendReport, Environment, TerminationReason, TrapExplanation}; +use gear_backend_sandbox::SandboxEnvironment; use gear_core::{ code::Code, memory::Memory, - message::{IncomingMessage, ReplyPacket}, + message::{ + ContextSettings, DispatchKind, IncomingDispatch, IncomingMessage, MessageContext, + ReplyPacket, + }, pages::WASM_PAGE_SIZE, }; +use gear_core_processor::{ProcessorContext, ProcessorExternalities}; use gear_utils::NonEmpty; -use gear_wasm_instrument::parity_wasm::{ - self, - elements::{Instruction, Module}, +use gear_wasm_instrument::{ + parity_wasm::{ + self, + elements::{Instruction, Module}, + }, + rules::CustomConstantCostRules, }; use proptest::prelude::*; use rand::{rngs::SmallRng, RngCore, SeedableRng}; @@ -231,12 +239,6 @@ fn execute_wasm_with_syscall_injected( params_config: SysCallsParamsConfig, initial_memory_write: Option, ) -> TerminationReason { - use gear_backend_common::{BackendReport, Environment}; - use gear_backend_sandbox::SandboxEnvironment; - use gear_core::message::{ContextSettings, DispatchKind, IncomingDispatch, MessageContext}; - use gear_core_processor::{ProcessorContext, ProcessorExternalities}; - use gear_wasm_instrument::rules::CustomConstantCostRules; - const INITIAL_PAGES: u16 = 1; const INJECTED_SYSCALLS: u32 = 8; @@ -245,7 +247,11 @@ fn execute_wasm_with_syscall_injected( let mut unstructured = Unstructured::new(&buf); let mut injection_amounts = SysCallsInjectionAmounts::all_never(); - injection_amounts.set(syscall, INJECTED_SYSCALLS, INJECTED_SYSCALLS); + injection_amounts.set( + InvocableSysCall::Loose(syscall), + INJECTED_SYSCALLS, + INJECTED_SYSCALLS, + ); let error_processing_config = if ignore_fallible_errors { ErrorProcessingConfig::None From 7ccc91c4281b9db64eebb9caa66367f97f7f3266 Mon Sep 17 00:00:00 2001 From: ekovalev Date: Mon, 18 Sep 2023 16:19:19 +0200 Subject: [PATCH 148/165] feat(rpc): Add RPC call to query inflation and ROI (#3290) --- Cargo.lock | 24 +++++ Cargo.toml | 2 + node/service/Cargo.toml | 2 + node/service/src/client.rs | 4 +- node/service/src/rpc/mod.rs | 6 +- pallets/staking-rewards/rpc/Cargo.toml | 19 ++++ .../rpc/runtime-api/Cargo.toml | 19 ++++ .../rpc/runtime-api/src/lib.rs | 28 ++++++ pallets/staking-rewards/rpc/src/lib.rs | 96 +++++++++++++++++++ pallets/staking-rewards/src/lib.rs | 40 ++++++++ runtime/gear/Cargo.toml | 4 + runtime/gear/src/lib.rs | 6 ++ runtime/vara/Cargo.toml | 2 + runtime/vara/src/lib.rs | 6 ++ 14 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 pallets/staking-rewards/rpc/Cargo.toml create mode 100644 pallets/staking-rewards/rpc/runtime-api/Cargo.toml create mode 100644 pallets/staking-rewards/rpc/runtime-api/src/lib.rs create mode 100644 pallets/staking-rewards/rpc/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 76d3ff7a82e..00d28e6f667 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4136,6 +4136,8 @@ dependencies = [ "pallet-gear-program", "pallet-gear-rpc-runtime-api", "pallet-gear-scheduler", + "pallet-gear-staking-rewards", + "pallet-gear-staking-rewards-rpc-runtime-api", "pallet-gear-voucher", "pallet-grandpa", "pallet-multisig", @@ -4288,6 +4290,8 @@ dependencies = [ "log", "pallet-gear-rpc", "pallet-gear-rpc-runtime-api", + "pallet-gear-staking-rewards-rpc", + "pallet-gear-staking-rewards-rpc-runtime-api", "pallet-im-online", "pallet-staking", "pallet-transaction-payment", @@ -7666,6 +7670,25 @@ dependencies = [ "sp-std 5.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", ] +[[package]] +name = "pallet-gear-staking-rewards-rpc" +version = "1.0.0" +dependencies = [ + "jsonrpsee", + "pallet-gear-staking-rewards-rpc-runtime-api", + "sp-api", + "sp-blockchain", + "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", +] + +[[package]] +name = "pallet-gear-staking-rewards-rpc-runtime-api" +version = "1.0.0" +dependencies = [ + "pallet-gear-staking-rewards", + "sp-api", +] + [[package]] name = "pallet-gear-voucher" version = "1.0.0" @@ -13503,6 +13526,7 @@ dependencies = [ "pallet-gear-rpc-runtime-api", "pallet-gear-scheduler", "pallet-gear-staking-rewards", + "pallet-gear-staking-rewards-rpc-runtime-api", "pallet-gear-voucher", "pallet-grandpa", "pallet-identity", diff --git a/Cargo.toml b/Cargo.toml index 1b581dac2b3..eecdbf0432f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -231,6 +231,8 @@ pallet-gear-rpc = { path = "pallets/gear/rpc" } pallet-gear-rpc-runtime-api = { path = "pallets/gear/rpc/runtime-api", default-features = false } pallet-gear-scheduler = { path = "pallets/gear-scheduler", default-features = false } pallet-gear-staking-rewards = { path = "pallets/staking-rewards", default-features = false } +pallet-gear-staking-rewards-rpc = { path = "pallets/staking-rewards/rpc" } +pallet-gear-staking-rewards-rpc-runtime-api = { path = "pallets/staking-rewards/rpc/runtime-api", default-features = false } pallet-gear-voucher = { path = "pallets/gear-voucher", default-features = false } pallet-gear-bank = { path = "pallets/gear-bank", default-features = false } runtime-common = { package = "gear-runtime-common", path = "runtime/common", default-features = false } diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 79ff6da306f..707bd61836a 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -22,6 +22,8 @@ serde = { workspace = true, features = ["derive"] } # Gear pallet-gear-rpc.workspace = true pallet-gear-rpc-runtime-api = { workspace = true, features = ["std"] } +pallet-gear-staking-rewards-rpc.workspace = true +pallet-gear-staking-rewards-rpc-runtime-api = { workspace = true, features = ["std"] } runtime-primitives = { workspace = true, features = ["std"] } gear-runtime-interface = { workspace = true, features = ["std"] } authorship.workspace = true diff --git a/node/service/src/client.rs b/node/service/src/client.rs index 284686c4cb3..b118fe36453 100644 --- a/node/service/src/client.rs +++ b/node/service/src/client.rs @@ -119,6 +119,7 @@ pub trait RuntimeApiCollection: + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys + pallet_gear_rpc_runtime_api::GearApi + + pallet_gear_staking_rewards_rpc_runtime_api::GearStakingRewardsApi where >::StateBackend: sp_api::StateBackend, { @@ -136,7 +137,8 @@ where + sp_api::Metadata + sp_offchain::OffchainWorkerApi + sp_session::SessionKeys - + pallet_gear_rpc_runtime_api::GearApi, + + pallet_gear_rpc_runtime_api::GearApi + + pallet_gear_staking_rewards_rpc_runtime_api::GearStakingRewardsApi, >::StateBackend: sp_api::StateBackend, { } diff --git a/node/service/src/rpc/mod.rs b/node/service/src/rpc/mod.rs index 527495e6f18..8c1242bb07b 100644 --- a/node/service/src/rpc/mod.rs +++ b/node/service/src/rpc/mod.rs @@ -101,6 +101,7 @@ where + 'static, C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: pallet_gear_rpc::GearRuntimeApi, + C::Api: pallet_gear_staking_rewards_rpc::GearStakingRewardsRuntimeApi, C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi, C::Api: BabeApi, C::Api: BlockBuilder, @@ -110,6 +111,7 @@ where B::State: sc_client_api::backend::StateBackend>, { use pallet_gear_rpc::{Gear, GearApiServer}; + use pallet_gear_staking_rewards_rpc::{GearStakingRewards, GearStakingRewardsApiServer}; use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer}; use runtime_info::{RuntimeInfoApi, RuntimeInfoServer}; use sc_consensus_babe_rpc::{Babe, BabeApiServer}; @@ -192,7 +194,9 @@ where io.merge(Gear::new(client.clone()).into_rpc())?; - io.merge(RuntimeInfoApi::::new(client).into_rpc())?; + io.merge(RuntimeInfoApi::::new(client.clone()).into_rpc())?; + + io.merge(GearStakingRewards::new(client).into_rpc())?; Ok(io) } diff --git a/pallets/staking-rewards/rpc/Cargo.toml b/pallets/staking-rewards/rpc/Cargo.toml new file mode 100644 index 00000000000..9d1240ed403 --- /dev/null +++ b/pallets/staking-rewards/rpc/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "pallet-gear-staking-rewards-rpc" +version = "1.0.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage = "https://gear-tech.io" +repository = "https://github.com/gear-tech/gear" + +[dependencies] +jsonrpsee = { workspace = true, features = ["server", "macros"] } + +# Substrate packages +sp-api.workspace = true +sp-blockchain.workspace = true +sp-runtime.workspace = true + +# Local packages +pallet-gear-staking-rewards-rpc-runtime-api.workspace = true diff --git a/pallets/staking-rewards/rpc/runtime-api/Cargo.toml b/pallets/staking-rewards/rpc/runtime-api/Cargo.toml new file mode 100644 index 00000000000..5c9d8cb65e9 --- /dev/null +++ b/pallets/staking-rewards/rpc/runtime-api/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "pallet-gear-staking-rewards-rpc-runtime-api" +version = "1.0.0" +authors.workspace = true +edition.workspace = true +license.workspace = true +homepage = "https://gear-tech.io" +repository = "https://github.com/gear-tech/gear" + +[dependencies] +sp-api.workspace = true +pallet-gear-staking-rewards.workspace = true + +[features] +default = ["std"] +std = [ + "sp-api/std", + "pallet-gear-staking-rewards/std", +] diff --git a/pallets/staking-rewards/rpc/runtime-api/src/lib.rs b/pallets/staking-rewards/rpc/runtime-api/src/lib.rs new file mode 100644 index 00000000000..04aebbf65da --- /dev/null +++ b/pallets/staking-rewards/rpc/runtime-api/src/lib.rs @@ -0,0 +1,28 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#![cfg_attr(not(feature = "std"), no_std)] + +pub use pallet_gear_staking_rewards::InflationInfo; + +sp_api::decl_runtime_apis! { + pub trait GearStakingRewardsApi { + /// Calculate token economics related data. + fn inflation_info() -> InflationInfo; + } +} diff --git a/pallets/staking-rewards/rpc/src/lib.rs b/pallets/staking-rewards/rpc/src/lib.rs new file mode 100644 index 00000000000..45267e0bfd9 --- /dev/null +++ b/pallets/staking-rewards/rpc/src/lib.rs @@ -0,0 +1,96 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! RPC interface for the gear module. + +use jsonrpsee::{ + core::{Error as JsonRpseeError, RpcResult}, + proc_macros::rpc, + types::error::{CallError, ErrorObject}, +}; +pub use pallet_gear_staking_rewards_rpc_runtime_api::GearStakingRewardsApi as GearStakingRewardsRuntimeApi; +use pallet_gear_staking_rewards_rpc_runtime_api::InflationInfo; +use sp_api::ProvideRuntimeApi; +use sp_blockchain::HeaderBackend; +use sp_runtime::traits::Block as BlockT; +use std::sync::Arc; + +#[rpc(server)] +pub trait GearStakingRewardsApi { + #[method(name = "stakingRewards_inflationInfo")] + fn query_inflation_info(&self, at: Option) -> RpcResult; +} + +/// Provides RPC methods to query token economics related data. +pub struct GearStakingRewards { + /// Shared reference to the client. + client: Arc, + _marker: std::marker::PhantomData

, +} + +impl GearStakingRewards { + /// Creates a new instance of the GearStakingRewards Rpc helper. + pub fn new(client: Arc) -> Self { + Self { + client, + _marker: Default::default(), + } + } +} + +/// Error type of this RPC api. +pub enum Error { + /// The transaction was not decodable. + DecodeError, + /// The call to runtime failed. + RuntimeError, +} + +impl From for i32 { + fn from(e: Error) -> i32 { + match e { + Error::RuntimeError => 1, + Error::DecodeError => 2, + } + } +} + +impl GearStakingRewardsApiServer<::Hash, InflationInfo> + for GearStakingRewards +where + Block: BlockT, + C: 'static + ProvideRuntimeApi + HeaderBackend, + C::Api: GearStakingRewardsRuntimeApi, +{ + fn query_inflation_info(&self, at: Option) -> RpcResult { + let api = self.client.runtime_api(); + let at_hash = at.unwrap_or_else(|| self.client.info().best_hash); + + fn map_err(err: impl std::fmt::Debug, desc: &'static str) -> JsonRpseeError { + CallError::Custom(ErrorObject::owned( + Error::RuntimeError.into(), + desc, + Some(format!("{err:?}")), + )) + .into() + } + + api.inflation_info(at_hash) + .map_err(|e| map_err(e, "Unable to query inflation info")) + } +} diff --git a/pallets/staking-rewards/src/lib.rs b/pallets/staking-rewards/src/lib.rs index a379e014e8b..039a0ee60df 100644 --- a/pallets/staking-rewards/src/lib.rs +++ b/pallets/staking-rewards/src/lib.rs @@ -59,6 +59,8 @@ use frame_support::{ PalletId, }; use pallet_staking::EraPayout; +use parity_scale_codec::{Decode, Encode}; +pub use scale_info::TypeInfo; use sp_runtime::{ traits::{AccountIdConversion, Saturating, StaticLookup}, PerThing, Perquintill, @@ -79,6 +81,16 @@ pub type NegativeImbalanceOf = <::Currency as Cu >>::NegativeImbalance; type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; +/// Token economics related details. +#[derive(Clone, Decode, Encode, Eq, PartialEq, TypeInfo)] +#[cfg_attr(feature = "std", derive(Debug, serde::Deserialize, serde::Serialize))] +pub struct InflationInfo { + /// Inflation + pub inflation: Perquintill, + /// ROI + pub roi: Perquintill, +} + #[frame_support::pallet] pub mod pallet { use super::*; @@ -333,11 +345,39 @@ pub mod pallet { .saturating_sub(T::Currency::minimum_balance()) } + /// Return the current total stakeable tokens amount. + /// + /// This value is not calculated but rather updated manually in line with tokenomics model. pub fn total_stakeable_tokens() -> BalanceOf { // Should never be 0 but in theory could (Self::non_stakeable_share().left_from_one() * T::Currency::total_issuance()) .saturating_sub(Self::pool()) } + + /// Calculate actual infaltion and ROI parameters. + pub fn inflation_info() -> InflationInfo { + let total_staked = pallet_staking::Pallet::::eras_total_stake( + pallet_staking::Pallet::::current_era().unwrap_or(0), + ); + let total_issuance = T::Currency::total_issuance(); + + let (payout, _) = inflation::compute_total_payout( + total_staked, + Self::total_stakeable_tokens(), + total_issuance, + Self::ideal_staking_ratio(), + T::MinInflation::get(), + Self::target_inflation(), + T::Falloff::get(), + T::MaxROI::get(), + Perquintill::one(), + ); + + let inflation = Perquintill::from_rational(payout, total_issuance); + let roi = Perquintill::from_rational(payout, total_staked); + + InflationInfo { inflation, roi } + } } } diff --git a/runtime/gear/Cargo.toml b/runtime/gear/Cargo.toml index fdd6f2deb3a..c68acce6ee8 100644 --- a/runtime/gear/Cargo.toml +++ b/runtime/gear/Cargo.toml @@ -70,6 +70,8 @@ pallet-gear-payment.workspace = true pallet-gear-voucher.workspace = true pallet-gear-rpc-runtime-api.workspace = true runtime-primitives.workspace = true +pallet-gear-staking-rewards.workspace = true +pallet-gear-staking-rewards-rpc-runtime-api.workspace = true [build-dependencies] substrate-build-script-utils.workspace = true @@ -126,6 +128,8 @@ std = [ "sp-transaction-pool/std", "sp-version/std", "substrate-wasm-builder", + "pallet-gear-staking-rewards-rpc-runtime-api/std", + "pallet-gear-staking-rewards/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 6094556ebd9..da93e6fce77 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -806,4 +806,10 @@ impl_runtime_apis_plus_common! { Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() } } + + impl pallet_gear_staking_rewards_rpc_runtime_api::GearStakingRewardsApi for Runtime { + fn inflation_info() -> pallet_gear_staking_rewards::InflationInfo { + unimplemented!(); + } + } } diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index f179c2bd346..40e450428e2 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -97,6 +97,7 @@ pallet-gear-payment.workspace = true pallet-gear-staking-rewards.workspace = true pallet-gear-voucher.workspace = true pallet-gear-rpc-runtime-api.workspace = true +pallet-gear-staking-rewards-rpc-runtime-api.workspace = true runtime-primitives.workspace = true [dev-dependencies] @@ -143,6 +144,7 @@ std = [ "pallet-gear-program/std", "pallet-gear-staking-rewards/std", "pallet-gear-rpc-runtime-api/std", + "pallet-gear-staking-rewards-rpc-runtime-api/std", "pallet-grandpa/std", "pallet-identity/std", "pallet-im-online/std", diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index fee12da3048..f0446824539 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -1382,4 +1382,10 @@ impl_runtime_apis_plus_common! { Executive::try_execute_block(block, state_root_check, signature_check, select).unwrap() } } + + impl pallet_gear_staking_rewards_rpc_runtime_api::GearStakingRewardsApi for Runtime { + fn inflation_info() -> pallet_gear_staking_rewards::InflationInfo { + StakingRewards::inflation_info() + } + } } From 65a7177a83556af48a0b50baeed16d4171f859de Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Mon, 18 Sep 2023 21:09:13 +0400 Subject: [PATCH 149/165] fix(builds): Pass `dev` feature (#3298) --- .github/workflows/build.yml | 2 +- Makefile | 4 ++-- scripts/calc-gas-spent.sh | 2 +- scripts/ci_build.sh | 4 ++-- scripts/read-state.sh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7dc8cfc4c84..7c913d062b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -158,7 +158,7 @@ jobs: - name: "Build: Production binaries" if: github.event_name == 'push' - run: cargo build -p gear-cli -F cli --profile production + run: cargo build -p gear-cli -F dev,cli --profile production - name: Prepare artifacts if: github.event_name == 'push' diff --git a/Makefile b/Makefile index 23d3f966ed4..223516d7f46 100644 --- a/Makefile +++ b/Makefile @@ -175,11 +175,11 @@ purge-chain-release: .PHONY: purge-dev-chain purge-dev-chain: - @ ./scripts/gear.sh run purge-dev-chain + @ ./scripts/gear.sh run purge-dev-chain -F dev .PHONY: purge-dev-chain-release purge-dev-chain-release: - @ ./scripts/gear.sh run purge-dev-chain --release + @ ./scripts/gear.sh run purge-dev-chain --release -F dev # Test section .PHONY: test # \ diff --git a/scripts/calc-gas-spent.sh b/scripts/calc-gas-spent.sh index 7f2a67a5adb..342cc89791f 100755 --- a/scripts/calc-gas-spent.sh +++ b/scripts/calc-gas-spent.sh @@ -2,7 +2,7 @@ # # Prerequisites: # -# RUST_LOG=gwasm=debug,pallet_gear=debug cargo run -p gear-cli --release -- --dev --tmp -l0 +# RUST_LOG=gwasm=debug,pallet_gear=debug cargo run -p gear-cli --release -F dev -- --dev --tmp -l0 # # Then upload the PING program and copy it's ID. # URL: https://github.com/gear-tech/apps/releases/download/build/demo_ping.opt.wasm diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh index 2ddaff402ab..628a9490a6e 100755 --- a/scripts/ci_build.sh +++ b/scripts/ci_build.sh @@ -42,7 +42,7 @@ echo "Test: gsdk tests" ./scripts/gear.sh test gsdk --release echo "Test: Runtime benchmarks and benchmark tests work" - cargo build -p gear-cli --release --features=runtime-benchmarks,runtime-benchmarks-checkers + cargo build -p gear-cli --release --features=dev,runtime-benchmarks,runtime-benchmarks-checkers ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --steps=20 --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_all" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --extra ./target/release/gear benchmark pallet --chain=dev --pallet=pallet_gear --extrinsic="check_lazy_pages_all" --execution=native --heap-pages=4096 --extra @@ -54,5 +54,5 @@ echo "Test: `try-runtime` feature tests" cargo test -p "pallet-*" --features try-runtime --release --locked echo "Test: Try runtime migrations" - cargo build -p gear-cli --features try-runtime --release --locked + cargo build -p gear-cli --features dev,try-runtime --release --locked ./target/release/gear try-runtime --runtime ./target/release/wbuild/gear-runtime/gear_runtime.wasm on-runtime-upgrade --checks live --uri wss://rpc-private-testnet.gear-tech.io:443 diff --git a/scripts/read-state.sh b/scripts/read-state.sh index f94795e116a..af24d82d4ef 100755 --- a/scripts/read-state.sh +++ b/scripts/read-state.sh @@ -2,7 +2,7 @@ # # Prerequisites: # -# RUST_LOG=gwasm=debug,pallet_gear=debug cargo run -p gear-cli --release -- --dev --tmp -l0 +# RUST_LOG=gwasm=debug,pallet_gear=debug cargo run -p gear-cli --release -F dev -- --dev --tmp -l0 # # Usage: # From 012c1eb8bbfd7f2f30b8129bd153305d374fb0ad Mon Sep 17 00:00:00 2001 From: Arsenii Lyashenko Date: Mon, 18 Sep 2023 21:16:34 +0300 Subject: [PATCH 150/165] chore!: Stabilize `lazy-pages` feature (#3123) --- .github/workflows/CI.yaml | 1 - .github/workflows/build-macos.yml | 5 +- .github/workflows/build.yml | 6 +- .github/workflows/test-measurements.yaml | 4 +- Cargo.lock | 8 +- Makefile | 8 +- core-processor/Cargo.toml | 6 +- core-processor/src/common.rs | 2 - core-processor/src/executor.rs | 283 +------------- core-processor/src/ext.rs | 364 ++++++----------- core-processor/src/processing.rs | 6 +- core/Cargo.toml | 1 + core/src/memory.rs | 118 ++++++ docker/Vara-Dockerfile | 2 +- examples/new-meta/tests/read_state.rs | 6 +- gcli/Cargo.toml | 4 +- gcli/src/meta/mod.rs | 35 +- gtest/Cargo.toml | 5 +- gtest/src/manager.rs | 68 ++-- gtest/src/program.rs | 10 +- gtest/src/system.rs | 5 + node/cli/Cargo.toml | 7 +- node/service/Cargo.toml | 4 - pallets/gear-debug/Cargo.toml | 1 - pallets/gear-debug/src/tests/mod.rs | 12 +- pallets/gear-scheduler/Cargo.toml | 2 +- pallets/gear/Cargo.toml | 6 +- pallets/gear/src/benchmarking/mod.rs | 24 +- .../gear/src/benchmarking/tests/lazy_pages.rs | 5 - pallets/gear/src/benchmarking/tests/mod.rs | 2 - pallets/gear/src/benchmarking/utils.rs | 13 +- pallets/gear/src/ext.rs | 367 ------------------ pallets/gear/src/lib.rs | 57 +-- pallets/gear/src/manager/journal.rs | 2 + pallets/gear/src/queue.rs | 18 +- pallets/gear/src/runtime_api.rs | 48 +-- pallets/gear/src/tests.rs | 18 +- pallets/payment/Cargo.toml | 1 - runtime/common/Cargo.toml | 1 + runtime/gear/Cargo.toml | 5 - runtime/vara/Cargo.toml | 5 - scripts/ci_build.sh | 7 +- utils/runtime-fuzzer/Cargo.toml | 2 +- utils/wasm-gen/Cargo.toml | 3 +- utils/wasm-gen/src/tests.rs | 21 +- 45 files changed, 428 insertions(+), 1150 deletions(-) delete mode 100644 pallets/gear/src/ext.rs diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 9256c5ee13e..01a50f5f55a 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -139,7 +139,6 @@ jobs: -p "pallet-*" -p gear-lazy-pages -p gear-runtime-interface - --features=lazy-pages --release upload: diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index a4a3a9a2cb9..1337b6fc61c 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -43,9 +43,7 @@ jobs: run: curl -LsSf https://get.nexte.st/latest/mac | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin - name: "Build: Node" - run: >- - cargo build - -p gear-cli --features=lazy-pages + run: cargo build -p gear-cli - name: "Test: Lazy pages" run: >- @@ -53,4 +51,3 @@ jobs: -p "pallet-*" -p gear-lazy-pages -p gear-runtime-interface - --features=lazy-pages diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c913d062b7..fc674d05f4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,11 +77,8 @@ jobs: - name: "Check: Vara runtime imports" run: ./target/release/wasm-proc --check-runtime-imports target/release/wbuild/vara-runtime/vara_runtime.compact.wasm - - name: "Test: Gear pallet tests with lazy pages" - run: ./scripts/gear.sh test pallet --features lazy-pages --release --locked - - name: "Test: Gear workspace" - run: ./scripts/gear.sh test gear --exclude gclient --exclude gcli --exclude gsdk --features pallet-gear-debug/lazy-pages --release --locked + run: ./scripts/gear.sh test gear --exclude gclient --exclude gcli --exclude gsdk --release --locked - name: "Test: gsdk tests" run: ./scripts/gear.sh test gsdk --release @@ -252,7 +249,6 @@ jobs: -p "pallet-*" -p gear-lazy-pages -p gear-runtime-interface - --features=lazy-pages --release env: CARGO_BUILD_TARGET: x86_64-pc-windows-msvc diff --git a/.github/workflows/test-measurements.yaml b/.github/workflows/test-measurements.yaml index b9c3a16a657..fca0c365b9e 100644 --- a/.github/workflows/test-measurements.yaml +++ b/.github/workflows/test-measurements.yaml @@ -42,13 +42,13 @@ jobs: tar -xf /cache/check_cargo_registry_${{ github.ref_name }}.tar -C / - name: "Build: Gear" - run: ./scripts/gear.sh build gear --release --locked --features=dev,runtime-benchmarks,lazy-pages + run: ./scripts/gear.sh build gear --release --locked --features=dev,runtime-benchmarks - name: "Collect: Gear workspace tests" run: | mkdir -p ./target/analysis/tests/ mkdir -p ./target/analysis/output/ - for i in `seq 1 $COUNT`; do echo $i; ./scripts/gear.sh test gear --exclude gclient --exclude gcli --features pallet-gear-debug/lazy-pages --release -j1 > ./target/analysis/output/$i 2>&1 ; mv ./target/nextest/ci/junit.xml ./target/analysis/tests/$i; done + for i in `seq 1 $COUNT`; do echo $i; ./scripts/gear.sh test gear --exclude gclient --exclude gcli --release -j1 > ./target/analysis/output/$i 2>&1 ; mv ./target/nextest/ci/junit.xml ./target/analysis/tests/$i; done ./target/release/regression-analysis collect-data --data-folder-path ./target/analysis/tests/ --output-path ./target/pallet-tests.json - name: "Generate report: Gear workspace tests" diff --git a/Cargo.lock b/Cargo.lock index 00d28e6f667..3041ea8580e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3656,6 +3656,7 @@ dependencies = [ "gear-core", "gear-core-errors", "gear-core-processor", + "gear-lazy-pages-common", "gmeta", "gsdk", "hex", @@ -3671,6 +3672,7 @@ dependencies = [ "schnorrkel", "serde", "serde_json", + "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "thiserror", "tokio", "which", @@ -3931,6 +3933,7 @@ dependencies = [ "log", "parity-scale-codec", "paste", + "proptest", "scale-info", "static_assertions", "wabt", @@ -3957,9 +3960,9 @@ dependencies = [ "gear-backend-common", "gear-core", "gear-core-errors", + "gear-lazy-pages-common", "gear-wasm-instrument", "log", - "proptest", "scale-info", "static_assertions", ] @@ -4427,6 +4430,7 @@ dependencies = [ "gear-backend-sandbox", "gear-core", "gear-core-processor", + "gear-lazy-pages-common", "gear-utils", "gear-wasm-instrument", "gsys", @@ -4761,6 +4765,7 @@ dependencies = [ "gear-core", "gear-core-errors", "gear-core-processor", + "gear-lazy-pages-common", "gear-utils", "gear-wasm-builder", "gear-wasm-instrument", @@ -4769,6 +4774,7 @@ dependencies = [ "parity-scale-codec", "path-clean", "rand 0.8.5", + "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", ] [[package]] diff --git a/Makefile b/Makefile index 223516d7f46..0e6ee45d5ed 100644 --- a/Makefile +++ b/Makefile @@ -54,11 +54,11 @@ node-release: .PHONY: vara vara: - @ ./scripts/gear.sh build node --no-default-features --features=vara-native,lazy-pages + @ ./scripts/gear.sh build node --no-default-features --features=vara-native .PHONY: vara-release vara-release: - @ ./scripts/gear.sh build node --release --no-default-features --features=vara-native,lazy-pages + @ ./scripts/gear.sh build node --release --no-default-features --features=vara-native .PHONY: gear-replay gear-replay: @@ -197,13 +197,13 @@ test-doc: test-gear: #\ We use lazy-pages feature for pallet-gear-debug due to cargo building issue \ and fact that pallet-gear default is lazy-pages. - @ ./scripts/gear.sh test gear --exclude gclient --exclude gcli --exclude gsdk --features pallet-gear-debug/lazy-pages + @ ./scripts/gear.sh test gear --exclude gclient --exclude gcli --exclude gsdk .PHONY: test-gear-release test-gear-release: # \ We use lazy-pages feature for pallet-gear-debug due to cargo building issue \ and fact that pallet-gear default is lazy-pages. - @ ./scripts/gear.sh test gear --release --exclude gclient --exclude gcli --exclude gsdk --features pallet-gear-debug/lazy-pages + @ ./scripts/gear.sh test gear --release --exclude gclient --exclude gcli --exclude gsdk .PHONY: test-gsdk test-gsdk: node-release diff --git a/core-processor/Cargo.toml b/core-processor/Cargo.toml index 7230e40a335..cc07d9088ee 100644 --- a/core-processor/Cargo.toml +++ b/core-processor/Cargo.toml @@ -15,6 +15,7 @@ gear-core.workspace = true gear-core-errors = { workspace = true, features = ["codec"] } gear-backend-common.workspace = true gear-wasm-instrument.workspace = true +gear-lazy-pages-common.workspace = true scale-info = { workspace = true, features = ["derive"] } log.workspace = true @@ -23,10 +24,11 @@ static_assertions.workspace = true actor-system-error.workspace = true [dev-dependencies] -proptest.workspace = true env_logger.workspace = true enum-iterator.workspace = true [features] +default = ["std"] +std = ["gear-lazy-pages-common/std"] strict = [] -mock = [] \ No newline at end of file +mock = [] diff --git a/core-processor/src/common.rs b/core-processor/src/common.rs index 65d7df3f45f..16d0f842f07 100644 --- a/core-processor/src/common.rs +++ b/core-processor/src/common.rs @@ -545,8 +545,6 @@ pub struct WasmExecutionContext { pub gas_reserver: GasReserver, /// Program to be executed. pub program: Program, - /// Memory pages with initial data. - pub pages_initial_data: BTreeMap, /// Size of the memory block. pub memory_size: WasmPage, } diff --git a/core-processor/src/executor.rs b/core-processor/src/executor.rs index c98778ff592..c1fa182a76e 100644 --- a/core-processor/src/executor.rs +++ b/core-processor/src/executor.rs @@ -26,7 +26,7 @@ use crate::{ }; use actor_system_error::actor_system_error; use alloc::{ - collections::{BTreeMap, BTreeSet}, + collections::BTreeSet, format, string::{String, ToString}, vec::Vec, @@ -41,12 +41,12 @@ use gear_core::{ env::Externalities, gas::{CountersOwner, GasAllowanceCounter, GasCounter, ValueCounter}, ids::ProgramId, - memory::{AllocationsContext, Memory, MemoryError, PageBuf}, + memory::{AllocationsContext, Memory}, message::{ ContextSettings, DispatchKind, IncomingDispatch, IncomingMessage, MessageContext, WasmEntryPoint, }, - pages::{GearPage, PageU32Size, WasmPage}, + pages::{PageU32Size, WasmPage}, program::Program, reservation::GasReserver, }; @@ -67,9 +67,6 @@ pub enum ActorPrepareMemoryError { /// Stack end page, which value is specified in WASM code, cannot be bigger than static memory size. #[display(fmt = "Stack end page {_0:?} is bigger then WASM static memory size {_1:?}")] StackEndPageBiggerWasmMemSize(WasmPage, WasmPage), - /// It's not allowed to set initial data for stack memory pages, if they are specified in WASM code. - #[display(fmt = "Set initial data for stack pages is restricted")] - StackPagesHaveInitialData, /// Stack is not aligned to WASM page size #[display(fmt = "Stack end addr {_0:#x} must be aligned to WASM page size")] StackIsNotAligned(u32), @@ -80,24 +77,10 @@ pub enum SystemPrepareMemoryError { /// Mem size less then static pages num #[display(fmt = "Mem size less then static pages num")] InsufficientMemorySize, - /// Page with data is not allocated for program - #[display(fmt = "{_0:?} is not allocated for program")] - PageIsNotAllocated(GearPage), - /// Cannot read initial memory data from wasm memory. - #[display(fmt = "Cannot read data for {_0:?}: {_1}")] - InitialMemoryReadFailed(GearPage, MemoryError), - /// Cannot write initial data to wasm memory. - #[display(fmt = "Cannot write initial data for {_0:?}: {_1}")] - InitialDataWriteFailed(GearPage, MemoryError), - /// Initial pages data must be empty in lazy pages mode - #[display(fmt = "Initial pages data must be empty when execute with lazy pages")] - InitialPagesContainsDataInLazyPagesMode, } /// Make checks that everything with memory goes well. -fn check_memory<'a>( - allocations: &BTreeSet, - pages_with_data: impl Iterator, +fn check_memory( static_pages: WasmPage, memory_size: WasmPage, ) -> Result<(), SystemPrepareMemoryError> { @@ -110,31 +93,13 @@ fn check_memory<'a>( return Err(SystemPrepareMemoryError::InsufficientMemorySize); } - // Checks that all pages with data are in allocations set. - for page in pages_with_data { - let wasm_page = page.to_page(); - if wasm_page >= static_pages && !allocations.contains(&wasm_page) { - return Err(SystemPrepareMemoryError::PageIsNotAllocated(*page)); - } - } - Ok(()) } -fn lazy_pages_check_initial_data( - initial_pages_data: &BTreeMap, -) -> Result<(), SystemPrepareMemoryError> { - initial_pages_data - .is_empty() - .then_some(()) - .ok_or(SystemPrepareMemoryError::InitialPagesContainsDataInLazyPagesMode) -} - /// Writes initial pages data to memory and prepare memory for execution. fn prepare_memory( mem: &mut EnvMem, program_id: ProgramId, - pages_data: &mut BTreeMap, static_pages: WasmPage, stack_end: Option, globals_config: GlobalsAccessConfig, @@ -158,94 +123,17 @@ fn prepare_memory( None }; - // Set initial data for pages - for (page, data) in pages_data.iter_mut() { - mem.write(page.offset(), data) - .map_err(|err| SystemPrepareMemoryError::InitialDataWriteFailed(*page, err))?; - } - - if ProcessorExt::LAZY_PAGES_ENABLED { - lazy_pages_check_initial_data(pages_data)?; - - ProcessorExt::lazy_pages_init_for_program( - mem, - program_id, - stack_end, - globals_config, - lazy_pages_weights, - ); - } else { - // If we executes without lazy pages, then we have to save all initial data for static pages, - // in order to be able to identify pages, which has been changed during execution. - // Skip stack page if they are specified. - let begin = stack_end.unwrap_or_default(); - - if pages_data.keys().any(|&p| p < begin.to_page()) { - return Err(ActorPrepareMemoryError::StackPagesHaveInitialData.into()); - } + ProcessorExt::lazy_pages_init_for_program( + mem, + program_id, + stack_end, + globals_config, + lazy_pages_weights, + ); - let non_stack_pages = begin.iter_end(static_pages).unwrap_or_else(|err| { - unreachable!( - "We have already checked that `stack_end` is <= `static_pages`, but get: {}", - err - ) - }); - for page in non_stack_pages.flat_map(|p| p.to_pages_iter()) { - if pages_data.contains_key(&page) { - // This page already has initial data - continue; - } - let mut data = PageBuf::new_zeroed(); - mem.read(page.offset(), &mut data) - .map_err(|err| SystemPrepareMemoryError::InitialMemoryReadFailed(page, err))?; - pages_data.insert(page, data); - } - } Ok(()) } -/// Returns pages and their new data, which must be updated or uploaded to storage. -fn get_pages_to_be_updated( - old_pages_data: BTreeMap, - new_pages_data: BTreeMap, - static_pages: WasmPage, -) -> BTreeMap { - if ProcessorExt::LAZY_PAGES_ENABLED { - // In lazy pages mode we update some page data in storage, - // when it has been write accessed, so no need to compare old and new page data. - new_pages_data.keys().for_each(|page| { - log::trace!("{:?} has been write accessed, update it in storage", page) - }); - return new_pages_data; - } - - let mut page_update = BTreeMap::new(); - let mut old_pages_data = old_pages_data; - let static_gear_pages = static_pages.to_page(); - for (page, new_data) in new_pages_data { - let initial_data = if let Some(initial_data) = old_pages_data.remove(&page) { - initial_data - } else { - // If it's static page without initial data, - // then it's stack page and we skip this page update. - if page < static_gear_pages { - continue; - } - - // If page has no data in `pages_initial_data` then data is zeros. - // Because it's default data for wasm pages which is not static, - // and for all static pages we save data in `pages_initial_data` in E::new. - PageBuf::new_zeroed() - }; - - if new_data != initial_data { - page_update.insert(page, new_data); - log::trace!("{page:?} has been changed - will be updated in storage"); - } - } - page_update -} - /// Execute wasm with dispatch and return dispatch result. pub fn execute_wasm( balance: u128, @@ -264,7 +152,6 @@ where gas_allowance_counter, gas_reserver, program, - mut pages_initial_data, memory_size, } = context; @@ -277,13 +164,7 @@ where let static_pages = program.static_pages(); let allocations = program.allocations(); - check_memory( - allocations, - pages_initial_data.keys(), - static_pages, - memory_size, - ) - .map_err(SystemExecutionError::PrepareMemory)?; + check_memory(static_pages, memory_size).map_err(SystemExecutionError::PrepareMemory)?; // Creating allocations context. let allocations_context = @@ -353,7 +234,6 @@ where prepare_memory::( memory, program_id, - &mut pages_initial_data, static_pages, stack_end, globals_config, @@ -377,12 +257,10 @@ where }; // released pages initial data will be added to `pages_initial_data` after execution. - if E::Ext::LAZY_PAGES_ENABLED { - E::Ext::lazy_pages_post_execution_actions(&mut memory); + E::Ext::lazy_pages_post_execution_actions(&mut memory); - if !E::Ext::lazy_pages_status().is_normal() { - termination = ext.current_counter_type().into() - } + if !E::Ext::lazy_pages_status().is_normal() { + termination = ext.current_counter_type().into() } (termination, memory, ext) @@ -416,11 +294,6 @@ where .into_ext_info(&memory) .map_err(SystemExecutionError::IntoExtInfo)?; - if E::Ext::LAZY_PAGES_ENABLED { - lazy_pages_check_initial_data(&pages_initial_data) - .map_err(SystemExecutionError::PrepareMemory)?; - } - // Parsing outcome. let kind = match termination { ActorTerminationReason::Exit(value_dest) => DispatchResultKind::Exit(value_dest), @@ -437,8 +310,9 @@ where ActorTerminationReason::GasAllowanceExceeded => DispatchResultKind::GasAllowanceExceed, }; - let page_update = - get_pages_to_be_updated::(pages_initial_data, info.pages_data, static_pages); + // With lazy-pages we update some page data in storage, + // when it has been write accessed, so no need to compare old and new page data. + let page_update = info.pages_data; // Getting new programs that are scheduled to be initialized (respected messages are in `generated_dispatches` collection) let program_candidates = info.program_candidates_data; @@ -467,7 +341,6 @@ where pub fn execute_for_reply( function: EP, instrumented_code: InstrumentedCode, - pages_initial_data: Option>, allocations: Option>, program_id: Option, payload: Vec, @@ -481,8 +354,6 @@ where EP: WasmEntryPoint, { let program = Program::new(program_id.unwrap_or_default(), instrumented_code); - let mut pages_initial_data: BTreeMap = - pages_initial_data.unwrap_or_default(); let static_pages = program.static_pages(); let allocations = allocations.unwrap_or_else(|| program.allocations().clone()); @@ -558,7 +429,6 @@ where prepare_memory::( memory, program.id(), - &mut pages_initial_data, static_pages, stack_end, globals_config, @@ -623,18 +493,13 @@ where #[cfg(test)] mod tests { use super::*; - use alloc::vec::Vec; use gear_backend_common::lazy_pages::Status; - use gear_core::{ - memory::PageBufInner, - pages::{PageNumber, WasmPage}, - }; + use gear_core::pages::WasmPage; struct TestExt; struct LazyTestExt; impl ProcessorExternalities for TestExt { - const LAZY_PAGES_ENABLED: bool = false; fn new(_context: ProcessorContext) -> Self { Self } @@ -655,8 +520,6 @@ mod tests { } impl ProcessorExternalities for LazyTestExt { - const LAZY_PAGES_ENABLED: bool = true; - fn new(_context: ProcessorContext) -> Self { Self } @@ -676,118 +539,14 @@ mod tests { } } - fn prepare_pages_and_allocs() -> (Vec, BTreeSet) { - let data = [0u16, 1, 2, 8, 18, 25, 27, 28, 93, 146, 240, 518]; - let pages = data.map(Into::into); - (pages.to_vec(), pages.map(|p| p.to_page()).into()) - } - - fn prepare_pages() -> BTreeMap { - let mut pages = BTreeMap::new(); - for i in 0..=255 { - let buffer = PageBufInner::filled_with(i); - pages.insert((i as u16).into(), PageBuf::from_inner(buffer)); - } - pages - } - #[test] fn check_memory_insufficient() { - let res = check_memory(&[].into(), [].iter(), 8.into(), 4.into()); + let res = check_memory(8.into(), 4.into()); assert_eq!(res, Err(SystemPrepareMemoryError::InsufficientMemorySize)); } - #[test] - fn check_memory_not_allocated() { - let (pages, mut allocs) = prepare_pages_and_allocs(); - let last = *allocs.iter().last().unwrap(); - allocs.remove(&last); - let res = check_memory(&allocs, pages.iter(), 2.into(), 4.into()); - assert_eq!( - res, - Err(SystemPrepareMemoryError::PageIsNotAllocated( - *pages.last().unwrap() - )) - ); - } - #[test] fn check_memory_ok() { - let (pages, allocs) = prepare_pages_and_allocs(); - check_memory(&allocs, pages.iter(), 4.into(), 8.into()).unwrap(); - } - - #[test] - fn lazy_pages_to_update() { - let new_pages = prepare_pages(); - let res = - get_pages_to_be_updated::(Default::default(), new_pages.clone(), 0.into()); - // All touched pages are to be updated in lazy mode - assert_eq!(res, new_pages); - } - - #[test] - fn no_pages_to_update() { - let old_pages = prepare_pages(); - let mut new_pages = old_pages.clone(); - let static_pages = 4; - let res = - get_pages_to_be_updated::(old_pages, new_pages.clone(), static_pages.into()); - assert_eq!(res, Default::default()); - - // Change static pages - for i in 0..static_pages { - let buffer = PageBufInner::filled_with(42); - new_pages.insert(i.into(), PageBuf::from_inner(buffer)); - } - // Do not include non-static pages - let new_pages = new_pages - .into_iter() - .take(WasmPage::from(static_pages).to_page::().raw() as _) - .collect(); - let res = - get_pages_to_be_updated::(Default::default(), new_pages, static_pages.into()); - assert_eq!(res, Default::default()); - } - - #[test] - fn pages_to_update() { - let old_pages = prepare_pages(); - let mut new_pages = old_pages.clone(); - - let page_with_zero_data = WasmPage::from(30).to_page(); - let changes: BTreeMap = [ - ( - WasmPage::from(1).to_page(), - PageBuf::from_inner(PageBufInner::filled_with(42u8)), - ), - ( - WasmPage::from(5).to_page(), - PageBuf::from_inner(PageBufInner::filled_with(84u8)), - ), - (page_with_zero_data, PageBuf::new_zeroed()), - ] - .into_iter() - .collect(); - new_pages.extend(changes.clone().into_iter()); - - // Change pages - let static_pages = 4.into(); - let res = get_pages_to_be_updated::(old_pages, new_pages.clone(), static_pages); - assert_eq!(res, changes); - - // There was no any old page - let res = - get_pages_to_be_updated::(Default::default(), new_pages.clone(), static_pages); - - // The result is all pages except the static ones - for page in static_pages.to_page::().iter_from_zero() { - new_pages.remove(&page); - } - - // Remove page with zero data, because it must not be updated. - new_pages.remove(&page_with_zero_data); - - assert_eq!(res, new_pages); + check_memory(4.into(), 8.into()).unwrap(); } } diff --git a/core-processor/src/ext.rs b/core-processor/src/ext.rs index aa872cd3d9b..7d8098dd92e 100644 --- a/core-processor/src/ext.rs +++ b/core-processor/src/ext.rs @@ -39,20 +39,20 @@ use gear_core::{ }, ids::{CodeId, MessageId, ProgramId, ReservationId}, memory::{ - AllocError, AllocationsContext, GrowHandler, Memory, MemoryError, MemoryInterval, - NoopGrowHandler, PageBuf, + AllocError, AllocationsContext, GrowHandler, Memory, MemoryError, MemoryInterval, PageBuf, }, message::{ ContextOutcomeDrain, GasLimit, HandlePacket, InitPacket, MessageContext, Packet, ReplyPacket, }, - pages::{GearPage, PageU32Size, WasmPage}, + pages::{PageU32Size, WasmPage}, reservation::GasReserver, }; use gear_core_errors::{ ExecutionError as FallibleExecutionError, ExtError as FallibleExtErrorCore, MessageError, ProgramRentError, ReplyCode, ReservationError, SignalCode, }; +use gear_lazy_pages_common as lazy_pages; use gear_wasm_instrument::syscalls::SysCallName; /// Processor context. @@ -155,9 +155,6 @@ impl ProcessorContext { /// Trait to which ext must have to work in processor wasm executor. /// Currently used only for lazy-pages support. pub trait ProcessorExternalities { - /// Whether this extension works with lazy pages. - const LAZY_PAGES_ENABLED: bool; - /// Create new fn new(context: ProcessorContext) -> Self; @@ -286,6 +283,39 @@ impl BackendAllocSyscallError for AllocExtError { } } +struct LazyGrowHandler { + old_mem_addr: Option, + old_mem_size: WasmPage, +} + +impl GrowHandler for LazyGrowHandler { + fn before_grow_action(mem: &mut impl Memory) -> Self { + // New pages allocation may change wasm memory buffer location. + // So we remove protections from lazy-pages + // and then in `after_grow_action` we set protection back for new wasm memory buffer. + let old_mem_addr = mem.get_buffer_host_addr(); + lazy_pages::remove_lazy_pages_prot(mem); + Self { + old_mem_addr, + old_mem_size: mem.size(), + } + } + + fn after_grow_action(self, mem: &mut impl Memory) { + // Add new allocations to lazy pages. + // Protect all lazy pages including new allocations. + let new_mem_addr = mem.get_buffer_host_addr().unwrap_or_else(|| { + unreachable!("Memory size cannot be zero after grow is applied for memory") + }); + lazy_pages::update_lazy_pages_and_protect_again( + mem, + self.old_mem_addr, + self.old_mem_size, + new_mem_addr, + ); + } +} + /// Structure providing externalities for running host functions. pub struct Ext { /// Processor context. @@ -300,8 +330,6 @@ pub struct Ext { /// Empty implementation for non-substrate (and non-lazy-pages) using impl ProcessorExternalities for Ext { - const LAZY_PAGES_ENABLED: bool = false; - fn new(context: ProcessorContext) -> Self { let current_counter = if context.gas_counter.left() <= context.gas_allowance_counter.left() { @@ -318,36 +346,87 @@ impl ProcessorExternalities for Ext { } fn lazy_pages_init_for_program( - _mem: &mut impl Memory, - _prog_id: ProgramId, - _stack_end: Option, - _globals_config: GlobalsAccessConfig, - _lazy_pages_weights: LazyPagesWeights, + mem: &mut impl Memory, + prog_id: ProgramId, + stack_end: Option, + globals_config: GlobalsAccessConfig, + lazy_pages_weights: LazyPagesWeights, ) { - unreachable!("Must not be called: lazy-pages is unsupported by this ext") + lazy_pages::init_for_program(mem, prog_id, stack_end, globals_config, lazy_pages_weights); } - fn lazy_pages_post_execution_actions(_mem: &mut impl Memory) { - unreachable!("Must not be called: lazy-pages is unsupported by this ext") + fn lazy_pages_post_execution_actions(mem: &mut impl Memory) { + lazy_pages::remove_lazy_pages_prot(mem); } fn lazy_pages_status() -> Status { - unreachable!("Must not be called: lazy-pages is unsupported by this ext") + lazy_pages::get_status() } } impl BackendExternalities for Ext { fn into_ext_info(self, memory: &impl Memory) -> Result { - let pages_for_data = - |static_pages: WasmPage, allocations: &BTreeSet| -> Vec { - static_pages - .iter_from_zero() - .chain(allocations.iter().copied()) - .flat_map(|p| p.to_pages_iter()) - .collect() - }; + let ProcessorContext { + allocations_context, + message_context, + gas_counter, + gas_reserver, + system_reservation, + program_candidates_data, + program_rents, + .. + } = self.context; + + let (static_pages, initial_allocations, allocations) = allocations_context.into_parts(); + + // Accessed pages are all pages, that had been released and are in allocations set or static. + let mut accessed_pages = lazy_pages::get_write_accessed_pages(); + accessed_pages.retain(|p| { + let wasm_page = p.to_page(); + wasm_page < static_pages || allocations.contains(&wasm_page) + }); + log::trace!("accessed pages numbers = {:?}", accessed_pages); + + let mut pages_data = BTreeMap::new(); + for page in accessed_pages { + let mut buf = PageBuf::new_zeroed(); + memory.read(page.offset(), &mut buf)?; + pages_data.insert(page, buf); + } + + let (outcome, mut context_store) = message_context.drain(); + let ContextOutcomeDrain { + outgoing_dispatches: generated_dispatches, + awakening, + reply_deposits, + } = outcome.drain(); + + let system_reservation_context = SystemReservationContext { + current_reservation: system_reservation, + previous_reservation: context_store.system_reservation(), + }; - self.into_ext_info_inner(memory, pages_for_data) + context_store.set_reservation_nonce(&gas_reserver); + if let Some(reservation) = system_reservation { + context_store.add_system_reservation(reservation); + } + + let info = ExtInfo { + gas_amount: gas_counter.to_amount(), + gas_reserver, + system_reservation_context, + allocations: (allocations != initial_allocations) + .then_some(allocations) + .unwrap_or_default(), + pages_data, + generated_dispatches, + awakening, + reply_deposits, + context_store, + program_candidates_data, + program_rents, + }; + Ok(info) } fn gas_amount(&self) -> GasAmount { @@ -355,11 +434,11 @@ impl BackendExternalities for Ext { } fn pre_process_memory_accesses( - _reads: &[MemoryInterval], - _writes: &[MemoryInterval], - _gas_counter: &mut u64, + reads: &[MemoryInterval], + writes: &[MemoryInterval], + gas_counter: &mut u64, ) -> Result<(), ProcessAccessError> { - Ok(()) + lazy_pages::pre_process_memory_accesses(reads, writes, gas_counter) } } @@ -591,7 +670,18 @@ impl Externalities for Ext { pages_num: u32, mem: &mut impl Memory, ) -> Result { - self.alloc_inner::(pages_num, mem) + let pages = WasmPage::new(pages_num).map_err(|_| AllocError::ProgramAllocOutOfBounds)?; + + self.context + .allocations_context + .alloc::(pages, mem, |pages| { + Ext::charge_gas_if_enough( + &mut self.context.gas_counter, + &mut self.context.gas_allowance_counter, + self.context.page_costs.mem_grow.calc(pages), + ) + }) + .map_err(Into::into) } fn free(&mut self, page: WasmPage) -> Result<(), Self::AllocError> { @@ -1031,89 +1121,6 @@ impl Externalities for Ext { } } -impl Ext { - /// Inner alloc realization. - pub fn alloc_inner( - &mut self, - pages_num: u32, - mem: &mut impl Memory, - ) -> Result { - let pages = WasmPage::new(pages_num).map_err(|_| AllocError::ProgramAllocOutOfBounds)?; - - self.context - .allocations_context - .alloc::(pages, mem, |pages| { - Ext::charge_gas_if_enough( - &mut self.context.gas_counter, - &mut self.context.gas_allowance_counter, - self.context.page_costs.mem_grow.calc(pages), - ) - }) - .map_err(Into::into) - } - - /// Into ext info inner impl. - /// `pages_for_data` returns vector of pages which data will be stored in info. - pub fn into_ext_info_inner( - self, - memory: &impl Memory, - pages_for_data: impl FnOnce(WasmPage, &BTreeSet) -> Vec, - ) -> Result { - let ProcessorContext { - allocations_context, - message_context, - gas_counter, - gas_reserver, - system_reservation, - program_candidates_data, - program_rents, - .. - } = self.context; - - let (static_pages, initial_allocations, allocations) = allocations_context.into_parts(); - let mut pages_data = BTreeMap::new(); - for page in pages_for_data(static_pages, &allocations) { - let mut buf = PageBuf::new_zeroed(); - memory.read(page.offset(), &mut buf)?; - pages_data.insert(page, buf); - } - - let (outcome, mut context_store) = message_context.drain(); - let ContextOutcomeDrain { - outgoing_dispatches: generated_dispatches, - awakening, - reply_deposits, - } = outcome.drain(); - - let system_reservation_context = SystemReservationContext { - current_reservation: system_reservation, - previous_reservation: context_store.system_reservation(), - }; - - context_store.set_reservation_nonce(&gas_reserver); - if let Some(reservation) = system_reservation { - context_store.add_system_reservation(reservation); - } - - let info = ExtInfo { - gas_amount: gas_counter.to_amount(), - gas_reserver, - system_reservation_context, - allocations: (allocations != initial_allocations) - .then_some(allocations) - .unwrap_or_default(), - pages_data, - generated_dispatches, - awakening, - reply_deposits, - context_store, - program_candidates_data, - program_rents, - }; - Ok(info) - } -} - #[cfg(test)] mod tests { use super::*; @@ -1636,133 +1643,4 @@ mod tests { assert_eq!(dispatch.message().payload_bytes(), &[3, 4, 5]); } - - mod property_tests { - use super::*; - use gear_core::{ - memory::HostPointer, - pages::{PageError, PageNumber}, - }; - use proptest::{ - arbitrary::any, - collection::size_range, - prop_oneof, proptest, - strategy::{Just, Strategy}, - test_runner::Config as ProptestConfig, - }; - - struct TestMemory(WasmPage); - - impl Memory for TestMemory { - type GrowError = PageError; - - fn grow(&mut self, pages: WasmPage) -> Result<(), Self::GrowError> { - self.0 = self.0.add(pages)?; - Ok(()) - } - - fn size(&self) -> WasmPage { - self.0 - } - - fn write(&mut self, _offset: u32, _buffer: &[u8]) -> Result<(), MemoryError> { - unimplemented!() - } - - fn read(&self, _offset: u32, _buffer: &mut [u8]) -> Result<(), MemoryError> { - unimplemented!() - } - - unsafe fn get_buffer_host_addr_unsafe(&mut self) -> HostPointer { - unimplemented!() - } - } - - #[derive(Debug, Clone)] - enum Action { - Alloc { pages: WasmPage }, - Free { page: WasmPage }, - } - - fn actions() -> impl Strategy> { - let action = wasm_page_number().prop_flat_map(|page| { - prop_oneof![ - Just(Action::Alloc { pages: page }), - Just(Action::Free { page }) - ] - }); - proptest::collection::vec(action, 0..1024) - } - - fn allocations() -> impl Strategy> { - proptest::collection::btree_set(wasm_page_number(), size_range(0..1024)) - } - - fn wasm_page_number() -> impl Strategy { - any::().prop_map(WasmPage::from) - } - - fn proptest_config() -> ProptestConfig { - ProptestConfig { - cases: 1024, - ..Default::default() - } - } - - #[track_caller] - fn assert_alloc_error(err: ::AllocError) { - match err { - AllocExtError::Alloc( - AllocError::IncorrectAllocationData(_) | AllocError::ProgramAllocOutOfBounds, - ) => {} - err => Err(err).unwrap(), - } - } - - #[track_caller] - fn assert_free_error(err: ::AllocError) { - match err { - AllocExtError::Alloc(AllocError::InvalidFree(_)) => {} - err => Err(err).unwrap(), - } - } - - proptest! { - #![proptest_config(proptest_config())] - #[test] - fn alloc( - static_pages in wasm_page_number(), - allocations in allocations(), - max_pages in wasm_page_number(), - mem_size in wasm_page_number(), - actions in actions(), - ) { - let _ = env_logger::try_init(); - - let ctx = AllocationsContext::new(allocations, static_pages, max_pages); - let ctx = ProcessorContextBuilder::new() - .with_gas(GasCounter::new(u64::MAX)) - .with_allowance(GasAllowanceCounter::new(u64::MAX)) - .with_allocation_context(ctx) - .build(); - let mut ext = Ext::new(ctx); - let mut mem = TestMemory(mem_size); - - for action in actions { - match action { - Action::Alloc { pages } => { - if let Err(err) = ext.alloc(pages.raw(), &mut mem) { - assert_alloc_error(err); - } - } - Action::Free { page } => { - if let Err(err) = ext.free(page) { - assert_free_error(err); - } - }, - } - } - } - } - } } diff --git a/core-processor/src/processing.rs b/core-processor/src/processing.rs index 69c36f22cb4..094dc7117be 100644 --- a/core-processor/src/processing.rs +++ b/core-processor/src/processing.rs @@ -27,16 +27,14 @@ use crate::{ ext::ProcessorExternalities, precharge::SuccessfulDispatchResultKind, }; -use alloc::{collections::BTreeMap, string::ToString, vec::Vec}; +use alloc::{string::ToString, vec::Vec}; use gear_backend_common::{ BackendExternalities, BackendSyscallError, Environment, SystemReservationContext, }; use gear_core::{ env::Externalities, ids::{MessageId, ProgramId}, - memory::PageBuf, message::{ContextSettings, DispatchKind, IncomingDispatch, ReplyMessage, StoredDispatch}, - pages::GearPage, reservation::GasReservationState, }; use gear_core_errors::{ErrorReplyReason, SignalCode}; @@ -46,7 +44,6 @@ pub fn process( block_config: &BlockConfig, execution_context: ProcessExecutionContext, random_data: (Vec, u32), - memory_pages: BTreeMap, ) -> Result, SystemExecutionError> where E: Environment, @@ -97,7 +94,6 @@ where gas_allowance_counter: execution_context.gas_allowance_counter, gas_reserver: execution_context.gas_reserver, program: execution_context.program, - pages_initial_data: memory_pages, memory_size: execution_context.memory_size, }; diff --git a/core/Cargo.toml b/core/Cargo.toml index 2b5cb2e556e..666e400433f 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -29,6 +29,7 @@ byteorder.workspace = true [dev-dependencies] wabt.workspace = true env_logger.workspace = true +proptest.workspace = true [features] strict = [] diff --git a/core/src/memory.rs b/core/src/memory.rs index 3d676e09fee..6b429b78dd7 100644 --- a/core/src/memory.rs +++ b/core/src/memory.rs @@ -497,4 +497,122 @@ mod tests { test(1238, 3498); test(0, 64444); } + + mod property_tests { + use super::*; + use crate::{memory::HostPointer, pages::PageError}; + use proptest::{ + arbitrary::any, + collection::size_range, + prop_oneof, proptest, + strategy::{Just, Strategy}, + test_runner::Config as ProptestConfig, + }; + + struct TestMemory(WasmPage); + + impl Memory for TestMemory { + type GrowError = PageError; + + fn grow(&mut self, pages: WasmPage) -> Result<(), Self::GrowError> { + self.0 = self.0.add(pages)?; + Ok(()) + } + + fn size(&self) -> WasmPage { + self.0 + } + + fn write(&mut self, _offset: u32, _buffer: &[u8]) -> Result<(), MemoryError> { + unimplemented!() + } + + fn read(&self, _offset: u32, _buffer: &mut [u8]) -> Result<(), MemoryError> { + unimplemented!() + } + + unsafe fn get_buffer_host_addr_unsafe(&mut self) -> HostPointer { + unimplemented!() + } + } + + #[derive(Debug, Clone)] + enum Action { + Alloc { pages: WasmPage }, + Free { page: WasmPage }, + } + + fn actions() -> impl Strategy> { + let action = wasm_page_number().prop_flat_map(|page| { + prop_oneof![ + Just(Action::Alloc { pages: page }), + Just(Action::Free { page }) + ] + }); + proptest::collection::vec(action, 0..1024) + } + + fn allocations() -> impl Strategy> { + proptest::collection::btree_set(wasm_page_number(), size_range(0..1024)) + } + + fn wasm_page_number() -> impl Strategy { + any::().prop_map(WasmPage::from) + } + + fn proptest_config() -> ProptestConfig { + ProptestConfig { + cases: 1024, + ..Default::default() + } + } + + #[track_caller] + fn assert_alloc_error(err: AllocError) { + match err { + AllocError::IncorrectAllocationData(_) | AllocError::ProgramAllocOutOfBounds => {} + err => Err(err).unwrap(), + } + } + + #[track_caller] + fn assert_free_error(err: AllocError) { + match err { + AllocError::InvalidFree(_) => {} + err => Err(err).unwrap(), + } + } + + proptest! { + #![proptest_config(proptest_config())] + #[test] + fn alloc( + static_pages in wasm_page_number(), + allocations in allocations(), + max_pages in wasm_page_number(), + mem_size in wasm_page_number(), + actions in actions(), + ) { + let _ = env_logger::try_init(); + + let mut ctx = AllocationsContext::new(allocations, static_pages, max_pages); + let mut mem = TestMemory(mem_size); + + for action in actions { + match action { + Action::Alloc { pages } => { + if let Err(err) = ctx.alloc::(pages, &mut mem, |_| Ok(())) { + assert_alloc_error(err); + } + } + Action::Free { page } => { + if let Err(err) = ctx.free(page) { + assert_free_error(err); + } + } + } + } + } + } + } } diff --git a/docker/Vara-Dockerfile b/docker/Vara-Dockerfile index 0744a6a0cb2..4abe70f29fc 100644 --- a/docker/Vara-Dockerfile +++ b/docker/Vara-Dockerfile @@ -33,7 +33,7 @@ RUN rustc --version RUN rustup update nightly && rustup target add wasm32-unknown-unknown --toolchain nightly # Build -RUN cargo build -p gear-cli --no-default-features --features=vara-native,lazy-pages --profile $PROFILE +RUN cargo build -p gear-cli --no-default-features --features=vara-native --profile $PROFILE # ===== SECOND STAGE ====== diff --git a/examples/new-meta/tests/read_state.rs b/examples/new-meta/tests/read_state.rs index d285ac014f8..7ee30cc09bb 100644 --- a/examples/new-meta/tests/read_state.rs +++ b/examples/new-meta/tests/read_state.rs @@ -106,7 +106,7 @@ fn read_state_with_wasm_func_returns_transformed_state() { const FUNC_NAME: &str = "first_wallet"; assert!(META_EXPORTS_V1.contains(&FUNC_NAME)); - let actual_state = program + let actual_state: Option = program .read_state_using_wasm(FUNC_NAME, META_WASM_V1.to_vec(), state_args!()) .expect("Unable to read program state"); @@ -126,7 +126,7 @@ fn read_state_with_parameterized_wasm_func_returns_transformed_state() { name: "OtherName".into(), }; - let actual_state = program + let actual_state: Option = program .read_state_using_wasm( FUNC_NAME, META_WASM_V2.to_vec(), @@ -151,7 +151,7 @@ fn read_state_with_two_args_wasm_func_returns_transformed_state() { let name = "OtherName".to_string(); let surname = "OtherSurname".to_string(); - let actual_state = program + let actual_state: Option = program .read_state_using_wasm( FUNC_NAME, META_WASM_V2.to_vec(), diff --git a/gcli/Cargo.toml b/gcli/Cargo.toml index f676cbac66d..9d9821b9bf3 100644 --- a/gcli/Cargo.toml +++ b/gcli/Cargo.toml @@ -40,10 +40,12 @@ clap = { workspace = true, features = ["derive"] } thiserror.workspace = true tokio = { workspace = true, features = [ "full" ] } whoami.workspace = true -core-processor.workspace = true +core-processor = { workspace = true, features = [ "std" ] } gear-backend-sandbox = { workspace = true, features = [ "std" ] } +gear-lazy-pages-common = { workspace = true, features = [ "std" ] } reqwest = { workspace = true, default-features = false, features = [ "json", "rustls-tls" ] } etc.workspace = true +sp-io = { workspace = true, features = [ "std" ] } [dev-dependencies] rand.workspace = true diff --git a/gcli/src/meta/mod.rs b/gcli/src/meta/mod.rs index fe8b3772c83..059d0fac8bc 100644 --- a/gcli/src/meta/mod.rs +++ b/gcli/src/meta/mod.rs @@ -73,6 +73,8 @@ pub enum Meta { } impl Meta { + const PAGE_STORAGE_PREFIX: [u8; 32] = *b"gcligcligcligcligcligcligcligcli"; + fn format_metadata(meta: &MetadataRepr, fmt: &mut fmt::Formatter) -> fmt::Result { let registry = PortableRegistry::decode(&mut meta.registry.as_ref()).map_err(|_| fmt::Error)?; @@ -107,20 +109,25 @@ impl Meta { /// Execute meta method. fn execute(wasm: InstrumentedCode, method: &str) -> Result> { - core_processor::informational::execute_for_reply::< - gear_backend_sandbox::SandboxEnvironment, - String, - >( - method.into(), - wasm, - None, - None, - None, - Default::default(), - u64::MAX, - BlockInfo::default(), - ) - .map_err(Error::WasmExecution) + assert!(gear_lazy_pages_common::try_to_enable_lazy_pages( + Self::PAGE_STORAGE_PREFIX + )); + + sp_io::TestExternalities::default().execute_with(|| { + core_processor::informational::execute_for_reply::< + gear_backend_sandbox::SandboxEnvironment, + String, + >( + method.into(), + wasm, + None, + None, + Default::default(), + u64::MAX, + BlockInfo::default(), + ) + .map_err(Error::WasmExecution) + }) } /// Decode metawasm from wasm binary. diff --git a/gtest/Cargo.toml b/gtest/Cargo.toml index 55886642194..fc1ab748a54 100644 --- a/gtest/Cargo.toml +++ b/gtest/Cargo.toml @@ -10,10 +10,13 @@ gear-core.workspace = true gear-core-errors.workspace = true gear-backend-common.workspace = true gear-backend-sandbox = { workspace = true, features = ["std"] } -core-processor.workspace = true +core-processor = { workspace = true, features = ["std"] } +gear-lazy-pages-common = { workspace = true, features = ["std"] } gear-wasm-builder.workspace = true gear-utils.workspace = true +sp-io = { workspace = true, features = ["std"] } + anyhow.workspace = true codec = { workspace = true, features = ["derive"] } hex.workspace = true diff --git a/gtest/src/manager.rs b/gtest/src/manager.rs index 23a5d0cb964..54a41e9bd16 100644 --- a/gtest/src/manager.rs +++ b/gtest/src/manager.rs @@ -19,7 +19,7 @@ use crate::{ log::{CoreLog, RunResult}, program::{Gas, WasmProgram}, - Result, TestError, DISPATCH_HOLD_COST, EPOCH_DURATION_IN_BLOCKS, EXISTENTIAL_DEPOSIT, + Result, System, TestError, DISPATCH_HOLD_COST, EPOCH_DURATION_IN_BLOCKS, EXISTENTIAL_DEPOSIT, INITIAL_RANDOM_SEED, MAILBOX_THRESHOLD, MAX_RESERVATIONS, MODULE_INSTANTIATION_BYTE_COST, MODULE_INSTRUMENTATION_BYTE_COST, MODULE_INSTRUMENTATION_COST, READ_COST, READ_PER_BYTE_COST, RENT_COST, RESERVATION_COST, RESERVE_FOR, WAITLIST_COST, WRITE_COST, WRITE_PER_BYTE_COST, @@ -45,9 +45,12 @@ use gear_core::{ use gear_core_errors::{ErrorReplyReason, SignalCode, SimpleExecutionError}; use gear_wasm_instrument::wasm_instrument::gas_metering::ConstantCostRules; use rand::{rngs::StdRng, RngCore, SeedableRng}; +use sp_io::TestExternalities; use std::{ + cell::RefCell, collections::{BTreeMap, BTreeSet, HashMap, VecDeque}, convert::TryInto, + rc::Rc, time::{SystemTime, UNIX_EPOCH}, }; @@ -117,13 +120,7 @@ impl TestActor { } // Gets a new executable actor derived from the inner program. - fn get_executable_actor_data( - &self, - ) -> Option<( - ExecutableActorData, - CoreProgram, - BTreeMap, - )> { + fn get_executable_actor_data(&self) -> Option<(ExecutableActorData, CoreProgram)> { let (program, pages_data, code_id, gas_reservation_map) = match self { TestActor::Initialized(Program::Genuine { program, @@ -161,7 +158,6 @@ impl TestActor { gas_reservation_map, }, program, - pages_data, )) } } @@ -219,6 +215,8 @@ pub(crate) struct ExtManager { pub(crate) gas_limits: BTreeMap, pub(crate) delayed_dispatches: HashMap>, + pub(crate) externalities: Rc>, + // Last run info pub(crate) origin: ProgramId, pub(crate) msg_id: MessageId, @@ -325,6 +323,29 @@ impl ExtManager { } } + pub(crate) fn with_externalities(&mut self, f: F) -> R + where + F: FnOnce(&mut Self) -> R, + { + let externalities = self.externalities.clone(); + let mut externalities = externalities.borrow_mut(); + externalities.execute_with(|| f(self)) + } + + fn update_storage_pages(program_id: ProgramId, memory_pages: &BTreeMap) { + // write pages into storage so lazy-pages can access them + for (page, buf) in memory_pages { + let page_no: u32 = (*page).into(); + let prefix = [ + System::PAGE_STORAGE_PREFIX.as_slice(), + program_id.into_bytes().as_slice(), + page_no.to_le_bytes().as_slice(), + ] + .concat(); + sp_io::storage::set(&prefix, buf); + } + } + #[track_caller] fn validate_dispatch(&mut self, dispatch: &Dispatch) { if 0 < dispatch.value() && dispatch.value() < crate::EXISTENTIAL_DEPOSIT { @@ -362,7 +383,7 @@ impl ExtManager { pub(crate) fn validate_and_run_dispatch(&mut self, dispatch: Dispatch) -> RunResult { self.validate_dispatch(&dispatch); - self.run_dispatch(dispatch) + self.with_externalities(|this| this.run_dispatch(dispatch)) } #[track_caller] @@ -409,14 +430,8 @@ impl ExtManager { if actor.is_dormant() { self.process_dormant(balance, dispatch); - } else if let Some((data, program, memory_pages)) = actor.get_executable_actor_data() { - self.process_normal( - balance, - data, - program.code().clone(), - memory_pages, - dispatch, - ); + } else if let Some((data, program)) = actor.get_executable_actor_data() { + self.process_normal(balance, data, program.code().clone(), dispatch); } else if let Some(mock) = actor.take_mock() { self.process_mock(mock, dispatch); } else { @@ -447,11 +462,10 @@ impl ExtManager { .get_mut(program_id) .ok_or_else(|| TestError::ActorNotFound(*program_id))?; - if let Some((_, program, memory_pages)) = actor.get_executable_actor_data() { + if let Some((_, program)) = actor.get_executable_actor_data() { core_processor::informational::execute_for_reply::, _>( String::from("state"), program.code().clone(), - Some(memory_pages), Some(program.allocations().clone()), Some(*program_id), Default::default(), @@ -494,7 +508,6 @@ impl ExtManager { mapping_code, None, None, - None, mapping_code_payload, u64::MAX, self.block_info, @@ -592,9 +605,11 @@ impl ExtManager { }; match program { - Program::Genuine { pages_data, .. } => *pages_data = memory_pages, + Program::Genuine { pages_data, .. } => *pages_data = memory_pages.clone(), Program::Mock(_) => panic!("Can't read memory of mock program"), } + + self.with_externalities(|_this| Self::update_storage_pages(*program_id, &memory_pages)) } #[track_caller] @@ -775,14 +790,13 @@ impl ExtManager { balance: u128, data: ExecutableActorData, code: InstrumentedCode, - memory_pages: BTreeMap, dispatch: StoredDispatch, ) { - self.process_dispatch(balance, Some((data, code)), memory_pages, dispatch); + self.process_dispatch(balance, Some((data, code)), dispatch); } fn process_dormant(&mut self, balance: u128, dispatch: StoredDispatch) { - self.process_dispatch(balance, None, Default::default(), dispatch); + self.process_dispatch(balance, None, dispatch); } #[track_caller] @@ -790,7 +804,6 @@ impl ExtManager { &mut self, balance: u128, data: Option<(ExecutableActorData, InstrumentedCode)>, - memory_pages: BTreeMap, dispatch: StoredDispatch, ) { let dest = dispatch.destination(); @@ -868,7 +881,6 @@ impl ExtManager { &block_config, (context, code, balance).into(), self.random_data.clone(), - memory_pages, ) .unwrap_or_else(|e| unreachable!("core-processor logic violated: {}", e)); @@ -1001,6 +1013,8 @@ impl JournalHandler for ExtManager { .expect("Can't find existing program"); if let Some(actor_pages_data) = actor.get_pages_data_mut() { + Self::update_storage_pages(program_id, &pages_data); + actor_pages_data.append(&mut pages_data); } else { unreachable!("No pages data found for program") diff --git a/gtest/src/program.rs b/gtest/src/program.rs index cc0c4e5b426..dca23cfb66a 100644 --- a/gtest/src/program.rs +++ b/gtest/src/program.rs @@ -447,7 +447,9 @@ impl<'a> Program<'a> { /// Reads the program’s state as a byte vector. pub fn read_state_bytes(&self) -> Result> { - self.manager.borrow_mut().read_state_bytes(&self.id) + self.manager + .borrow_mut() + .with_externalities(|this| this.read_state_bytes(&self.id)) } /// Reads the program’s transformed state as a byte vector. The transformed @@ -502,9 +504,9 @@ impl<'a> Program<'a> { wasm: Vec, args: Option>, ) -> Result> { - self.manager - .borrow_mut() - .read_state_bytes_using_wasm(&self.id, fn_name, wasm, args) + self.manager.borrow_mut().with_externalities(|this| { + this.read_state_bytes_using_wasm(&self.id, fn_name, wasm, args) + }) } /// Reads and decodes the program's state . diff --git a/gtest/src/system.rs b/gtest/src/system.rs index 81462312b43..b4e3c3a70b1 100644 --- a/gtest/src/system.rs +++ b/gtest/src/system.rs @@ -37,8 +37,13 @@ impl Default for System { } impl System { + pub(crate) const PAGE_STORAGE_PREFIX: [u8; 32] = *b"gtestgtestgtestgtestgtestgtest00"; + /// Create a new system. pub fn new() -> Self { + assert!(gear_lazy_pages_common::try_to_enable_lazy_pages( + Self::PAGE_STORAGE_PREFIX + )); Default::default() } diff --git a/node/cli/Cargo.toml b/node/cli/Cargo.toml index 02fe1c8c9d2..5a52ca5e042 100644 --- a/node/cli/Cargo.toml +++ b/node/cli/Cargo.toml @@ -63,7 +63,7 @@ gcli = { workspace = true, optional = true } substrate-build-script-utils.workspace = true [features] -default = ["gear-native", "vara-native", "lazy-pages"] +default = ["gear-native", "vara-native"] gear-native = [ "service/gear-native", "gear-runtime", @@ -73,11 +73,6 @@ vara-native = [ "vara-runtime", "pallet-gear-staking-rewards", ] -lazy-pages = [ - "service/lazy-pages", - "vara-runtime?/lazy-pages", - "gear-runtime?/lazy-pages", -] runtime-benchmarks = [ "service/runtime-benchmarks", "frame-benchmarking", diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 707bd61836a..c78f087ddbf 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -111,10 +111,6 @@ vara-native = [ "pallet-im-online", "sp-authority-discovery" ] -lazy-pages = [ - "gear-runtime?/lazy-pages", - "vara-runtime?/lazy-pages", -] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-benchmarking-cli/runtime-benchmarks", diff --git a/pallets/gear-debug/Cargo.toml b/pallets/gear-debug/Cargo.toml index af5b894aecf..f139f859414 100644 --- a/pallets/gear-debug/Cargo.toml +++ b/pallets/gear-debug/Cargo.toml @@ -75,5 +75,4 @@ runtime-benchmarks = [ "frame-system/runtime-benchmarks", "frame-support/runtime-benchmarks", ] -lazy-pages = ["pallet-gear/lazy-pages"] try-runtime = ["frame-support/try-runtime"] diff --git a/pallets/gear-debug/src/tests/mod.rs b/pallets/gear-debug/src/tests/mod.rs index 2008ae84895..683853ff36c 100644 --- a/pallets/gear-debug/src/tests/mod.rs +++ b/pallets/gear-debug/src/tests/mod.rs @@ -25,13 +25,11 @@ use common::{ ActiveProgram, CodeStorage, Origin as _, PausedProgramStorage, ProgramStorage, }; use frame_support::{assert_err, assert_ok}; -#[cfg(feature = "lazy-pages")] -use gear_core::pages::GearPage; use gear_core::{ ids::{CodeId, MessageId, ProgramId}, memory::PageBuf, message::{DispatchKind, StoredDispatch, StoredMessage, UserMessage}, - pages::{PageNumber, PageU32Size, WasmPage}, + pages::{GearPage, PageNumber, PageU32Size, WasmPage}, }; use gear_wasm_instrument::STACK_END_EXPORT_NAME; use pallet_gear::{ @@ -393,7 +391,6 @@ fn get_last_snapshot() -> DebugData { } } -#[cfg(feature = "lazy-pages")] #[test] fn check_not_allocated_pages() { // Currently we has no mechanism to restrict not allocated pages access during wasm execution @@ -595,7 +592,6 @@ fn check_not_allocated_pages() { }) } -#[cfg(feature = "lazy-pages")] #[test] fn check_changed_pages_in_storage() { // This test checks that only pages, which has been write accessed, @@ -903,12 +899,6 @@ fn check_gear_stack_end() { persistent_pages.insert(gear_page2, page_data.clone()); persistent_pages.insert(gear_page3, page_data); - #[cfg(feature = "lazy-pages")] - log::debug!("LAZY-PAGES IS ON"); - - #[cfg(not(feature = "lazy-pages"))] - log::debug!("LAZY-PAGES IS OFF"); - System::assert_last_event( crate::Event::DebugDataSnapshot(DebugData { dispatch_queue: vec![], diff --git a/pallets/gear-scheduler/Cargo.toml b/pallets/gear-scheduler/Cargo.toml index b8d9a29ccb6..d85e5827e3b 100644 --- a/pallets/gear-scheduler/Cargo.toml +++ b/pallets/gear-scheduler/Cargo.toml @@ -31,7 +31,7 @@ sp-std.workspace = true sp-io.workspace = true [dev-dependencies] -core-processor.workspace = true +core-processor = { workspace = true, features = ["std"] } pallet-gear-bank = { workspace = true, features = ["std"] } pallet-gear = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index ac6f96b0a64..cfb8ed21892 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -26,7 +26,7 @@ static_assertions.workspace = true # Internal deps common.workspace = true gear-runtime-interface = { workspace = true } -gear-lazy-pages-common = { workspace = true, optional = true } +gear-lazy-pages-common.workspace = true core-processor.workspace = true gear-core.workspace = true gear-core-errors.workspace = true @@ -136,7 +136,9 @@ std = [ "frame-system/std", "gear-wasm-instrument/std", "scopeguard/use_std", + "core-processor/std", "gear-backend-sandbox/std", + "gear-lazy-pages-common/std", "scale-info/std", "sp-io/std", "sp-std/std", @@ -154,7 +156,6 @@ std = [ "pallet-gear-proc-macro/full", "primitive-types/std", "serde/std", - "gear-lazy-pages-common?/std", "sp-consensus-babe/std", "test-syscalls?/std", "demo-read-big-state?/std", @@ -190,5 +191,4 @@ runtime-benchmarks = [ ] runtime-benchmarks-checkers = [] try-runtime = ["frame-support/try-runtime"] -lazy-pages = ["gear-lazy-pages-common"] fuzz = ["pallet-gear-gas/fuzz", "common/fuzz"] diff --git a/pallets/gear/src/benchmarking/mod.rs b/pallets/gear/src/benchmarking/mod.rs index 354379bfe16..d41682ab355 100644 --- a/pallets/gear/src/benchmarking/mod.rs +++ b/pallets/gear/src/benchmarking/mod.rs @@ -238,7 +238,6 @@ where &exec.block_config, exec.context, exec.random_data, - exec.memory_pages, ) .unwrap_or_else(|e| unreachable!("core-processor logic invalidated: {}", e)) } @@ -369,7 +368,6 @@ pub struct Exec { block_config: BlockConfig, context: ProcessExecutionContext, random_data: (Vec, u32), - memory_pages: BTreeMap, } benchmarks! { @@ -388,12 +386,10 @@ benchmarks! { check_all { syscalls_integrity::main_test::(); tests::check_stack_overflow::(); - #[cfg(feature = "lazy-pages")] - { - tests::lazy_pages::lazy_pages_charging::(); - tests::lazy_pages::lazy_pages_charging_special::(); - tests::lazy_pages::lazy_pages_gas_exceed::(); - } + + tests::lazy_pages::lazy_pages_charging::(); + tests::lazy_pages::lazy_pages_charging_special::(); + tests::lazy_pages::lazy_pages_gas_exceed::(); } : {} #[extra] @@ -403,12 +399,9 @@ benchmarks! { #[extra] check_lazy_pages_all { - #[cfg(feature = "lazy-pages")] - { - tests::lazy_pages::lazy_pages_charging::(); - tests::lazy_pages::lazy_pages_charging_special::(); - tests::lazy_pages::lazy_pages_gas_exceed::(); - } + tests::lazy_pages::lazy_pages_charging::(); + tests::lazy_pages::lazy_pages_charging_special::(); + tests::lazy_pages::lazy_pages_gas_exceed::(); } : {} #[extra] @@ -418,19 +411,16 @@ benchmarks! { #[extra] check_lazy_pages_charging { - #[cfg(feature = "lazy-pages")] tests::lazy_pages::lazy_pages_charging::(); }: {} #[extra] check_lazy_pages_charging_special { - #[cfg(feature = "lazy-pages")] tests::lazy_pages::lazy_pages_charging_special::(); }: {} #[extra] check_lazy_pages_gas_exceed { - #[cfg(feature = "lazy-pages")] tests::lazy_pages::lazy_pages_gas_exceed::(); }: {} diff --git a/pallets/gear/src/benchmarking/tests/lazy_pages.rs b/pallets/gear/src/benchmarking/tests/lazy_pages.rs index 10e3513d270..94a92d7e6df 100644 --- a/pallets/gear/src/benchmarking/tests/lazy_pages.rs +++ b/pallets/gear/src/benchmarking/tests/lazy_pages.rs @@ -307,7 +307,6 @@ where &exec.block_config, exec.context, exec.random_data, - exec.memory_pages, ) .unwrap_or_else(|e| unreachable!("core-processor logic invalidated: {}", e)); @@ -384,7 +383,6 @@ where &exec.block_config, exec.context, exec.random_data, - exec.memory_pages, ) .unwrap_or_else(|e| unreachable!("core-processor logic invalidated: {}", e)); @@ -544,7 +542,6 @@ where &exec.block_config, exec.context, exec.random_data, - exec.memory_pages, ) .unwrap_or_else(|e| unreachable!("core-processor logic invalidated: {}", e)); @@ -588,7 +585,6 @@ where &exec.block_config, exec.context, exec.random_data, - exec.memory_pages, ) .unwrap_or_else(|e| unreachable!("core-processor logic invalidated: {}", e)); @@ -630,7 +626,6 @@ where &exec.block_config, exec.context, exec.random_data, - exec.memory_pages, ) .unwrap_or_else(|e| unreachable!("core-processor logic invalidated: {}", e)); diff --git a/pallets/gear/src/benchmarking/tests/mod.rs b/pallets/gear/src/benchmarking/tests/mod.rs index d163bcf2baf..e07981baff9 100644 --- a/pallets/gear/src/benchmarking/tests/mod.rs +++ b/pallets/gear/src/benchmarking/tests/mod.rs @@ -23,7 +23,6 @@ use super::*; -#[cfg(feature = "lazy-pages")] pub mod lazy_pages; pub mod syscalls_integrity; mod utils; @@ -76,7 +75,6 @@ where &exec.block_config, exec.context, exec.random_data, - exec.memory_pages, ) .unwrap() .into_iter() diff --git a/pallets/gear/src/benchmarking/utils.rs b/pallets/gear/src/benchmarking/utils.rs index 60992c73675..d04a116c50a 100644 --- a/pallets/gear/src/benchmarking/utils.rs +++ b/pallets/gear/src/benchmarking/utils.rs @@ -21,10 +21,10 @@ use super::Exec; use crate::{ manager::{CodeInfo, ExtManager, HandleKind}, - Config, CostsPerBlockOf, CurrencyOf, DbWeightOf, MailboxOf, Pallet as Gear, QueueOf, - RentCostPerBlockOf, + Config, CostsPerBlockOf, CurrencyOf, DbWeightOf, MailboxOf, Pallet as Gear, ProgramStorageOf, + QueueOf, RentCostPerBlockOf, }; -use common::{scheduler::SchedulingCostsPerBlock, storage::*, CodeStorage, Origin}; +use common::{scheduler::SchedulingCostsPerBlock, storage::*, CodeStorage, Origin, ProgramStorage}; use core_processor::{ configs::{BlockConfig, BlockInfo}, ContextChargedForCode, ContextChargedForInstrumentation, @@ -40,11 +40,6 @@ use sp_core::H256; use sp_runtime::traits::UniqueSaturatedInto; use sp_std::{convert::TryInto, prelude::*}; -#[cfg(feature = "lazy-pages")] -use crate::ProgramStorageOf; -#[cfg(feature = "lazy-pages")] -use common::ProgramStorage; - const DEFAULT_BLOCK_NUMBER: u32 = 0; const DEFAULT_INTERVAL: u32 = 1_000; @@ -119,7 +114,6 @@ where T: Config, T::AccountId: Origin, { - #[cfg(feature = "lazy-pages")] assert!(gear_lazy_pages_common::try_to_enable_lazy_pages( ProgramStorageOf::::pages_final_prefix() )); @@ -295,6 +289,5 @@ where block_config, context: (context, code, balance).into(), random_data: (vec![0u8; 32], 0), - memory_pages: Default::default(), }) } diff --git a/pallets/gear/src/ext.rs b/pallets/gear/src/ext.rs deleted file mode 100644 index a278c23b06e..00000000000 --- a/pallets/gear/src/ext.rs +++ /dev/null @@ -1,367 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -use alloc::{collections::BTreeSet, vec::Vec}; -use core_processor::{ - AllocExtError, Ext, FallibleExtError, ProcessorContext, ProcessorExternalities, - UnrecoverableExtError, -}; -use gear_backend_common::{ - lazy_pages::{GlobalsAccessConfig, LazyPagesWeights, Status}, - memory::ProcessAccessError, - BackendExternalities, ExtInfo, -}; -use gear_core::{ - costs::RuntimeCosts, - env::{Externalities, PayloadSliceLock, UnlockPayloadBound}, - gas::{ChargeError, CounterType, CountersOwner, GasAmount, GasLeft}, - ids::{MessageId, ProgramId, ReservationId}, - memory::{GrowHandler, Memory, MemoryError, MemoryInterval}, - message::{HandlePacket, InitPacket, ReplyPacket}, - pages::{GearPage, PageU32Size, WasmPage}, -}; -use gear_core_errors::{ReplyCode, SignalCode}; -use gear_lazy_pages_common as lazy_pages; -use gear_wasm_instrument::syscalls::SysCallName; - -/// Ext with lazy pages support. -pub struct LazyPagesExt { - inner: Ext, -} - -impl BackendExternalities for LazyPagesExt { - fn into_ext_info(self, memory: &impl Memory) -> Result { - let pages_for_data = - |static_pages: WasmPage, allocations: &BTreeSet| -> Vec { - // Accessed pages are all pages, that had been released and are in allocations set or static. - let mut accessed_pages = lazy_pages::get_write_accessed_pages(); - accessed_pages.retain(|p| { - let wasm_page = p.to_page(); - wasm_page < static_pages || allocations.contains(&wasm_page) - }); - log::trace!("accessed pages numbers = {:?}", accessed_pages); - accessed_pages - }; - self.inner.into_ext_info_inner(memory, pages_for_data) - } - - fn gas_amount(&self) -> GasAmount { - self.inner.context.gas_counter.to_amount() - } - - fn pre_process_memory_accesses( - reads: &[MemoryInterval], - writes: &[MemoryInterval], - gas_counter: &mut u64, - ) -> Result<(), ProcessAccessError> { - lazy_pages::pre_process_memory_accesses(reads, writes, gas_counter) - } -} - -impl ProcessorExternalities for LazyPagesExt { - const LAZY_PAGES_ENABLED: bool = true; - - fn new(context: ProcessorContext) -> Self { - Self { - inner: Ext::new(context), - } - } - - fn lazy_pages_init_for_program( - mem: &mut impl Memory, - prog_id: ProgramId, - stack_end: Option, - globals_config: GlobalsAccessConfig, - lazy_pages_weights: LazyPagesWeights, - ) { - lazy_pages::init_for_program(mem, prog_id, stack_end, globals_config, lazy_pages_weights); - } - - fn lazy_pages_post_execution_actions(mem: &mut impl Memory) { - lazy_pages::remove_lazy_pages_prot(mem); - } - - fn lazy_pages_status() -> Status { - lazy_pages::get_status() - } -} - -struct LazyGrowHandler { - old_mem_addr: Option, - old_mem_size: WasmPage, -} - -impl GrowHandler for LazyGrowHandler { - fn before_grow_action(mem: &mut impl Memory) -> Self { - // New pages allocation may change wasm memory buffer location. - // So we remove protections from lazy-pages - // and then in `after_grow_action` we set protection back for new wasm memory buffer. - let old_mem_addr = mem.get_buffer_host_addr(); - lazy_pages::remove_lazy_pages_prot(mem); - Self { - old_mem_addr, - old_mem_size: mem.size(), - } - } - - fn after_grow_action(self, mem: &mut impl Memory) { - // Add new allocations to lazy pages. - // Protect all lazy pages including new allocations. - let new_mem_addr = mem.get_buffer_host_addr().unwrap_or_else(|| { - unreachable!("Memory size cannot be zero after grow is applied for memory") - }); - lazy_pages::update_lazy_pages_and_protect_again( - mem, - self.old_mem_addr, - self.old_mem_size, - new_mem_addr, - ); - } -} - -impl CountersOwner for LazyPagesExt { - fn charge_gas_runtime(&mut self, cost: RuntimeCosts) -> Result<(), ChargeError> { - self.inner.charge_gas_runtime(cost) - } - - fn charge_gas_runtime_if_enough(&mut self, cost: RuntimeCosts) -> Result<(), ChargeError> { - self.inner.charge_gas_runtime_if_enough(cost) - } - - fn charge_gas_if_enough(&mut self, amount: u64) -> Result<(), ChargeError> { - self.inner.charge_gas_if_enough(amount) - } - - fn gas_left(&self) -> GasLeft { - self.inner.gas_left() - } - - fn current_counter_type(&self) -> CounterType { - self.inner.current_counter_type() - } - - fn decrease_current_counter_to(&mut self, amount: u64) { - self.inner.decrease_current_counter_to(amount) - } - - fn define_current_counter(&mut self) -> u64 { - self.inner.define_current_counter() - } -} - -impl Externalities for LazyPagesExt { - type UnrecoverableError = UnrecoverableExtError; - type FallibleError = FallibleExtError; - type AllocError = AllocExtError; - - fn alloc( - &mut self, - pages_num: u32, - mem: &mut impl Memory, - ) -> Result { - self.inner.alloc_inner::(pages_num, mem) - } - - fn free(&mut self, page: WasmPage) -> Result<(), Self::AllocError> { - self.inner.free(page) - } - - fn block_height(&self) -> Result { - self.inner.block_height() - } - - fn block_timestamp(&self) -> Result { - self.inner.block_timestamp() - } - - fn send_init(&mut self) -> Result { - self.inner.send_init() - } - - fn send_push(&mut self, handle: u32, buffer: &[u8]) -> Result<(), Self::FallibleError> { - self.inner.send_push(handle, buffer) - } - - fn send_push_input( - &mut self, - handle: u32, - offset: u32, - len: u32, - ) -> Result<(), Self::FallibleError> { - self.inner.send_push_input(handle, offset, len) - } - - fn reply_push(&mut self, buffer: &[u8]) -> Result<(), Self::FallibleError> { - self.inner.reply_push(buffer) - } - - fn send_commit( - &mut self, - handle: u32, - msg: HandlePacket, - delay: u32, - ) -> Result { - self.inner.send_commit(handle, msg, delay) - } - - fn reservation_send_commit( - &mut self, - id: ReservationId, - handle: u32, - msg: HandlePacket, - delay: u32, - ) -> Result { - self.inner.reservation_send_commit(id, handle, msg, delay) - } - - fn reply_commit(&mut self, msg: ReplyPacket) -> Result { - self.inner.reply_commit(msg) - } - - fn reservation_reply_commit( - &mut self, - id: ReservationId, - msg: ReplyPacket, - ) -> Result { - self.inner.reservation_reply_commit(id, msg) - } - - fn reply_to(&self) -> Result { - self.inner.reply_to() - } - - fn signal_from(&self) -> Result { - self.inner.signal_from() - } - - fn reply_push_input(&mut self, offset: u32, len: u32) -> Result<(), Self::FallibleError> { - self.inner.reply_push_input(offset, len) - } - - fn source(&self) -> Result { - self.inner.source() - } - - fn reply_code(&self) -> Result { - self.inner.reply_code() - } - - fn signal_code(&self) -> Result { - self.inner.signal_code() - } - - fn message_id(&self) -> Result { - self.inner.message_id() - } - - fn pay_program_rent( - &mut self, - program_id: ProgramId, - rent: u128, - ) -> Result<(u128, u32), Self::FallibleError> { - self.inner.pay_program_rent(program_id, rent) - } - - fn program_id(&self) -> Result { - self.inner.program_id() - } - - fn debug(&self, data: &str) -> Result<(), Self::UnrecoverableError> { - self.inner.debug(data) - } - - fn size(&self) -> Result { - self.inner.size() - } - - fn random(&self) -> Result<(&[u8], u32), Self::UnrecoverableError> { - self.inner.random() - } - - fn reserve_gas( - &mut self, - amount: u64, - blocks: u32, - ) -> Result { - self.inner.reserve_gas(amount, blocks) - } - - fn unreserve_gas(&mut self, id: ReservationId) -> Result { - self.inner.unreserve_gas(id) - } - - fn system_reserve_gas(&mut self, amount: u64) -> Result<(), Self::FallibleError> { - self.inner.system_reserve_gas(amount) - } - - fn gas_available(&self) -> Result { - self.inner.gas_available() - } - - fn value(&self) -> Result { - self.inner.value() - } - - fn wait(&mut self) -> Result<(), Self::UnrecoverableError> { - self.inner.wait() - } - - fn wait_for(&mut self, duration: u32) -> Result<(), Self::UnrecoverableError> { - self.inner.wait_for(duration) - } - - fn wait_up_to(&mut self, duration: u32) -> Result { - self.inner.wait_up_to(duration) - } - - fn wake(&mut self, waker_id: MessageId, delay: u32) -> Result<(), Self::FallibleError> { - self.inner.wake(waker_id, delay) - } - - fn value_available(&self) -> Result { - self.inner.value_available() - } - - fn create_program( - &mut self, - packet: InitPacket, - delay: u32, - ) -> Result<(MessageId, ProgramId), Self::FallibleError> { - self.inner.create_program(packet, delay) - } - - fn reply_deposit( - &mut self, - message_id: MessageId, - amount: u64, - ) -> Result<(), Self::FallibleError> { - self.inner.reply_deposit(message_id, amount) - } - - fn forbidden_funcs(&self) -> &BTreeSet { - &self.inner.context.forbidden_funcs - } - - fn lock_payload(&mut self, at: u32, len: u32) -> Result { - self.inner.lock_payload(at, len) - } - - fn unlock_payload(&mut self, payload_holder: &mut PayloadSliceLock) -> UnlockPayloadBound { - self.inner.unlock_payload(payload_holder) - } -} diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 0db25c86d60..1363b7166a2 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -24,9 +24,6 @@ extern crate alloc; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; -#[cfg(feature = "lazy-pages")] -mod ext; - mod internal; mod queue; mod runtime_api; @@ -58,6 +55,7 @@ use core::marker::PhantomData; use core_processor::{ common::{DispatchOutcome as CoreDispatchOutcome, ExecutableActorData, JournalNote}, configs::{BlockConfig, BlockInfo}, + Ext, }; use frame_support::{ dispatch::{DispatchError, DispatchResultWithPostInfo, PostDispatchInfo}, @@ -74,6 +72,7 @@ use gear_core::{ message::*, pages::{GearPage, WasmPage}, }; +use gear_lazy_pages_common as lazy_pages; use manager::{CodeInfo, QueuePostProcessingData}; use primitive_types::H256; use sp_runtime::{ @@ -86,15 +85,6 @@ use sp_std::{ prelude::*, }; -#[cfg(feature = "lazy-pages")] -use gear_lazy_pages_common as lazy_pages; - -#[cfg(feature = "lazy-pages")] -use ext::LazyPagesExt as Ext; - -#[cfg(not(feature = "lazy-pages"))] -use core_processor::Ext; - type ExecutionEnvironment = gear_backend_sandbox::SandboxEnvironment; pub(crate) type AccountIdOf = ::AccountId; @@ -1023,48 +1013,13 @@ pub mod pallet { } } - pub(crate) fn enable_lazy_pages() -> bool { - #[cfg(feature = "lazy-pages")] - { - let prefix = ProgramStorageOf::::pages_final_prefix(); - if !lazy_pages::try_to_enable_lazy_pages(prefix) { - unreachable!("By some reasons we cannot run lazy-pages on this machine"); - } - true - } - - #[cfg(not(feature = "lazy-pages"))] - { - false + pub(crate) fn enable_lazy_pages() { + let prefix = ProgramStorageOf::::pages_final_prefix(); + if !lazy_pages::try_to_enable_lazy_pages(prefix) { + unreachable!("By some reasons we cannot run lazy-pages on this machine"); } } - pub(crate) fn get_and_track_memory_pages( - manager: &mut ExtManager, - program_id: ProgramId, - pages_with_data: &BTreeSet, - lazy_pages_enabled: bool, - ) -> Option> { - let pages = if lazy_pages_enabled { - Default::default() - } else { - match ProgramStorageOf::::get_program_data_for_pages( - program_id, - pages_with_data.iter(), - ) { - Ok(data) => data, - Err(err) => { - log::error!("Cannot get data for program pages: {err:?}"); - return None; - } - } - }; - - manager.insert_program_id_loaded_pages(program_id); - - Some(pages) - } - pub(crate) fn block_config() -> BlockConfig { let block_info = BlockInfo { height: Self::block_number().unique_saturated_into(), diff --git a/pallets/gear/src/manager/journal.rs b/pallets/gear/src/manager/journal.rs index b60e65d147f..f5c4deed77d 100644 --- a/pallets/gear/src/manager/journal.rs +++ b/pallets/gear/src/manager/journal.rs @@ -333,6 +333,8 @@ where ProgramStorageOf::::update_active_program(program_id, |p| { for (page, data) in pages_data { + log::trace!("{:?} has been write accessed, update it in storage", page); + ProgramStorageOf::::set_program_page_data(program_id, page, data); p.pages_with_data.insert(page); } diff --git a/pallets/gear/src/queue.rs b/pallets/gear/src/queue.rs index c4381b91543..7bc4280f9a3 100644 --- a/pallets/gear/src/queue.rs +++ b/pallets/gear/src/queue.rs @@ -21,7 +21,6 @@ use core_processor::{common::PrechargedDispatch, ContextChargedForInstrumentatio pub(crate) struct QueueStep<'a, T: Config, F> { pub block_config: &'a BlockConfig, - pub lazy_pages_enabled: bool, pub ext_manager: &'a mut ExtManager, pub gas_limit: GasBalanceOf, pub dispatch: StoredDispatch, @@ -31,7 +30,6 @@ pub(crate) struct QueueStep<'a, T: Config, F> { #[derive(Debug)] pub(crate) enum QueueStepError { - NoMemoryPages, ActorData(PrechargedDispatch), } @@ -46,7 +44,6 @@ where pub(crate) fn execute(self) -> Result, QueueStepError> { let Self { block_config, - lazy_pages_enabled, ext_manager, gas_limit, dispatch, @@ -136,13 +133,7 @@ where }; // Load program memory pages. - let memory_pages = Pallet::::get_and_track_memory_pages( - ext_manager, - program_id, - &context.actor_data().pages_with_data, - lazy_pages_enabled, - ) - .ok_or(QueueStepError::NoMemoryPages)?; + ext_manager.insert_program_id_loaded_pages(program_id); let (random, bn) = T::Randomness::random(dispatch_id.as_ref()); @@ -150,7 +141,6 @@ where block_config, (context, code, balance).into(), (random.encode(), bn.unique_saturated_into()), - memory_pages, ) .unwrap_or_else(|e| unreachable!("core-processor logic invalidated: {}", e)); @@ -169,14 +159,14 @@ where { /// Message Queue processing. pub(crate) fn process_queue(mut ext_manager: ExtManager) { + Self::enable_lazy_pages(); + let block_config = Self::block_config(); if T::DebugInfo::is_remap_id_enabled() { T::DebugInfo::remap_id(); } - let lazy_pages_enabled = Self::enable_lazy_pages(); - while QueueProcessingOf::::allowed() { let dispatch = match QueueOf::::dequeue() .unwrap_or_else(|e| unreachable!("Message queue corrupted! {:?}", e)) @@ -226,7 +216,6 @@ where let step = QueueStep { block_config: &block_config, - lazy_pages_enabled, ext_manager: &mut ext_manager, gas_limit, dispatch, @@ -257,7 +246,6 @@ where MessageWaitedSystemReason::ProgramIsNotInitialized.into_reason(), ); } - Err(QueueStepError::NoMemoryPages) => continue, } } diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index a37fea57381..d3dc1d94a9a 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -30,7 +30,6 @@ pub(crate) const RUNTIME_API_BLOCK_LIMITS_COUNT: u64 = 6; pub(crate) struct CodeWithMemoryData { pub instrumented_code: InstrumentedCode, pub allocations: BTreeSet, - pub program_pages: Option>, } impl Pallet @@ -46,6 +45,8 @@ where allow_other_panics: bool, allow_skip_zero_replies: bool, ) -> Result> { + Self::enable_lazy_pages(); + let account = ::from_origin(source); let balance = CurrencyOf::::free_balance(&account); @@ -102,8 +103,6 @@ where let mut block_config = Self::block_config(); block_config.forbidden_funcs = [SysCallName::GasAvailable].into(); - let lazy_pages_enabled = Self::enable_lazy_pages(); - let mut min_limit = 0; let mut reserved = 0; let mut burned = 0; @@ -144,7 +143,6 @@ where let step = QueueStep { block_config: &block_config, - lazy_pages_enabled, ext_manager: &mut ext_manager, gas_limit, dispatch: queued_dispatch, @@ -250,24 +248,11 @@ where let instrumented_code = T::CodeStorage::get_code(code_id) .ok_or_else(|| String::from("Failed to get code for given program id"))?; - #[cfg(not(feature = "lazy-pages"))] - let program_pages = Some( - ProgramStorageOf::::get_program_data_for_pages( - program_id, - program.pages_with_data.iter(), - ) - .map_err(|e| format!("Get program pages data error: {e:?}"))?, - ); - - #[cfg(feature = "lazy-pages")] - let program_pages = None; - let allocations = program.allocations; Ok(CodeWithMemoryData { instrumented_code, allocations, - program_pages, }) } @@ -278,13 +263,7 @@ where wasm: Vec, argument: Option>, ) -> Result, String> { - #[cfg(feature = "lazy-pages")] - { - let prefix = ProgramStorageOf::::pages_final_prefix(); - if !lazy_pages::try_to_enable_lazy_pages(prefix) { - unreachable!("By some reasons we cannot run lazy-pages on this machine"); - } - } + Self::enable_lazy_pages(); let schedule = T::Schedule::get(); @@ -322,7 +301,6 @@ where instrumented_code, None, None, - None, payload, BlockGasLimitOf::::get() * RUNTIME_API_BLOCK_LIMITS_COUNT, block_info, @@ -333,20 +311,13 @@ where program_id: ProgramId, payload: Vec, ) -> Result, String> { - #[cfg(feature = "lazy-pages")] - { - let prefix = ProgramStorageOf::::pages_final_prefix(); - if !lazy_pages::try_to_enable_lazy_pages(prefix) { - unreachable!("By some reasons we cannot run lazy-pages on this machine"); - } - } + Self::enable_lazy_pages(); log::debug!("Reading state of {program_id:?}"); let CodeWithMemoryData { instrumented_code, allocations, - program_pages, } = Self::code_with_memory(program_id)?; let block_info = BlockInfo { @@ -357,7 +328,6 @@ where core_processor::informational::execute_for_reply::, String>( String::from("state"), instrumented_code, - program_pages, Some(allocations), Some(program_id), payload, @@ -367,20 +337,13 @@ where } pub(crate) fn read_metahash_impl(program_id: ProgramId) -> Result { - #[cfg(feature = "lazy-pages")] - { - let prefix = ProgramStorageOf::::pages_final_prefix(); - if !lazy_pages::try_to_enable_lazy_pages(prefix) { - unreachable!("By some reasons we cannot run lazy-pages on this machine"); - } - } + Self::enable_lazy_pages(); log::debug!("Reading metahash of {program_id:?}"); let CodeWithMemoryData { instrumented_code, allocations, - program_pages, } = Self::code_with_memory(program_id)?; let block_info = BlockInfo { @@ -391,7 +354,6 @@ where core_processor::informational::execute_for_reply::, String>( String::from("metahash"), instrumented_code, - program_pages, Some(allocations), Some(program_id), Default::default(), diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 019d2ac293b..fef0874afa1 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -2989,7 +2989,6 @@ fn restrict_start_section() { }); } -#[cfg(feature = "lazy-pages")] #[test] fn memory_access_cases() { // This test access different pages in wasm linear memory. @@ -3231,7 +3230,6 @@ fn memory_access_cases() { }); } -#[cfg(feature = "lazy-pages")] #[test] fn lazy_pages() { use gear_core::pages::{GearPage, PageU32Size}; @@ -4170,16 +4168,12 @@ fn claim_value_works() { // In `calculate_gas_info` program start to work with page data in storage, // so need to take in account gas, which spent for data loading. - let charged_for_page_load = if cfg!(feature = "lazy-pages") { - gas_price( - ::Schedule::get() - .memory_weights - .load_page_data - .ref_time(), - ) - } else { - 0 - }; + let charged_for_page_load = gas_price( + ::Schedule::get() + .memory_weights + .load_page_data + .ref_time(), + ); // Gas left returns to sender from consuming of value tree while claiming. let expected_sender_balance = diff --git a/pallets/payment/Cargo.toml b/pallets/payment/Cargo.toml index 93c809367f0..84d09e5244c 100644 --- a/pallets/payment/Cargo.toml +++ b/pallets/payment/Cargo.toml @@ -75,5 +75,4 @@ runtime-benchmarks = [ "frame-support/runtime-benchmarks", "parity-wasm", ] -lazy-pages = ["pallet-gear/lazy-pages"] try-runtime = ["frame-support/try-runtime"] diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index b673f851b3d..a35574095b4 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -53,6 +53,7 @@ std = [ "pallet-gear-bank/std", "pallet-gear-messenger/std", "runtime-primitives/std", + "gear-core-processor/std", "sp-runtime/std", "sp-std/std", "validator-set/std", diff --git a/runtime/gear/Cargo.toml b/runtime/gear/Cargo.toml index c68acce6ee8..77751e6991e 100644 --- a/runtime/gear/Cargo.toml +++ b/runtime/gear/Cargo.toml @@ -181,8 +181,3 @@ try-runtime = [ "runtime-common/try-runtime", ] dev = ["pallet-gear-debug", "pallet-gear-program/dev"] -lazy-pages = [ - "pallet-gear/lazy-pages", - "pallet-gear-payment/lazy-pages", - "pallet-gear-debug?/lazy-pages", -] diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index 40e450428e2..1640bc001fb 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -262,8 +262,3 @@ dev = [ "pallet-gear-program/dev", "pallet-sudo", ] -lazy-pages = [ - "pallet-gear/lazy-pages", - "pallet-gear-payment/lazy-pages", - "pallet-gear-debug?/lazy-pages", -] diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh index 628a9490a6e..e7c24ae2bc1 100755 --- a/scripts/ci_build.sh +++ b/scripts/ci_build.sh @@ -24,13 +24,8 @@ echo "Check: Gear runtime imports" echo "Check: Vara runtime imports" ./target/release/wasm-proc --check-runtime-imports target/release/wbuild/vara-runtime/vara_runtime.compact.wasm -echo "Test: Gear pallet tests with lazy pages" - cargo test -p pallet-gear --features=lazy-pages --release --locked - cargo test -p pallet-gear-debug --features=lazy-pages --release --locked - cargo test -p pallet-gear-payment --features=lazy-pages --release --locked - echo "Test: Gear workspace" - ./scripts/gear.sh test gear --exclude gclient --exclude gcli --features pallet-gear-debug/lazy-pages --release --locked + ./scripts/gear.sh test gear --exclude gclient --exclude gcli --release --locked echo "Test: `gcli`" ./scripts/gear.sh test gcli --release --locked --retries 3 diff --git a/utils/runtime-fuzzer/Cargo.toml b/utils/runtime-fuzzer/Cargo.toml index 410ab54b0f9..e78ce560ea4 100644 --- a/utils/runtime-fuzzer/Cargo.toml +++ b/utils/runtime-fuzzer/Cargo.toml @@ -26,7 +26,7 @@ runtime-primitives.workspace = true gear-common.workspace = true gear-core.workspace = true gear-utils.workspace = true -gear-runtime = { workspace = true, features = ["std", "fuzz", "lazy-pages"] } +gear-runtime = { workspace = true, features = ["std", "fuzz"] } pallet-gear.workspace = true pallet-gear-bank.workspace = true diff --git a/utils/wasm-gen/Cargo.toml b/utils/wasm-gen/Cargo.toml index 9b9c6464ea9..ea4e5c01fbf 100644 --- a/utils/wasm-gen/Cargo.toml +++ b/utils/wasm-gen/Cargo.toml @@ -26,4 +26,5 @@ proptest.workspace = true gear-backend-sandbox = { workspace = true, features = ["std"] } gear-backend-common = { workspace = true, features = ["mock"] } -gear-core-processor = { workspace = true, features = ["mock"] } +gear-core-processor = { workspace = true, features = ["std", "mock"] } +gear-lazy-pages-common = { workspace = true, features = ["std"] } diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index 57019510d32..ab09d5081e8 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -22,6 +22,7 @@ use gear_backend_common::{BackendReport, Environment, TerminationReason, TrapExp use gear_backend_sandbox::SandboxEnvironment; use gear_core::{ code::Code, + ids::{CodeId, ProgramId}, memory::Memory, message::{ ContextSettings, DispatchKind, IncomingDispatch, IncomingMessage, MessageContext, @@ -242,6 +243,12 @@ fn execute_wasm_with_syscall_injected( const INITIAL_PAGES: u16 = 1; const INJECTED_SYSCALLS: u32 = 8; + const PROGRAM_STORAGE_PREFIX: [u8; 32] = *b"execute_wasm_with_syscall_inject"; + + assert!(gear_lazy_pages_common::try_to_enable_lazy_pages( + PROGRAM_STORAGE_PREFIX + )); + // We create Unstructured from zeroes here as we just need any let buf = vec![0; UNSTRUCTURED_SIZE]; let mut unstructured = Unstructured::new(&buf); @@ -295,10 +302,14 @@ fn execute_wasm_with_syscall_injected( // Imitate that reply was already sent. let _ = message_context.reply_commit(ReplyPacket::auto(), None); + let code_id = CodeId::generate(code.original_code()); + let program_id = ProgramId::generate(code_id, b""); + let processor_context = ProcessorContext { message_context, max_pages: INITIAL_PAGES.into(), rent_cost: 10, + program_id, ..ProcessorContext::new_mock() }; @@ -313,7 +324,15 @@ fn execute_wasm_with_syscall_injected( .expect("Failed to create environment"); let report = env - .execute(|mem, _, _| -> Result<(), u32> { + .execute(|mem, _stack_end, globals_config| -> Result<(), u32> { + gear_core_processor::Ext::lazy_pages_init_for_program( + mem, + program_id, + Some(mem.size()), + globals_config, + Default::default(), + ); + if let Some(mem_write) = initial_memory_write { return mem .write(mem_write.offset, &mem_write.content) From 51669483c6a7db2559f640b9e9e49b706c9fb5d0 Mon Sep 17 00:00:00 2001 From: mqxf Date: Mon, 18 Sep 2023 22:57:46 +0200 Subject: [PATCH 151/165] refactor(pallet-gear): Allow `calculate_gas_info` on terminated program. (#3278) --- pallets/gear/src/runtime_api.rs | 23 ++++++++++++++----- pallets/gear/src/tests.rs | 39 +++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index d3dc1d94a9a..f2f09ac4bc6 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -17,9 +17,10 @@ // along with this program. If not, see . use super::*; -use crate::queue::QueueStep; +use crate::queue::{ActorResult, QueueStep}; use common::ActiveProgram; use core::convert::TryFrom; +use core_processor::common::PrechargedDispatch; use gear_core::{code::TryNewCodeConfig, pages::WasmPage}; use gear_wasm_instrument::syscalls::SysCallName; @@ -126,10 +127,20 @@ where }; let actor_id = queued_dispatch.destination(); + let dispatch_id = queued_dispatch.id(); + let dispatch_reply = queued_dispatch.reply_details().is_some(); + + let balance = CurrencyOf::::free_balance(&::from_origin( + actor_id.into_origin(), + )); - let actor = ext_manager - .get_actor(actor_id) - .ok_or_else(|| b"Program not found in the storage".to_vec())?; + let get_actor_data = |precharged_dispatch: PrechargedDispatch| { + // At this point gas counters should be changed accordingly so fetch the program data. + match Self::get_active_actor_data(actor_id, dispatch_id, dispatch_reply) { + ActorResult::Data(data) => Ok((precharged_dispatch, data)), + ActorResult::Continue => Err(precharged_dispatch), + } + }; let dispatch_id = queued_dispatch.id(); let success_reply = queued_dispatch @@ -146,8 +157,8 @@ where ext_manager: &mut ext_manager, gas_limit, dispatch: queued_dispatch, - balance: actor.balance, - get_actor_data: |dispatch| Ok((dispatch, actor.executable_data)), + balance: balance.unique_saturated_into(), + get_actor_data, }; let journal = step.execute().unwrap_or_else(|e| unreachable!("{e:?}")); diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index fef0874afa1..1a234ddff62 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -14317,6 +14317,45 @@ fn gear_block_number_math_adds_up() { }) } +#[test] +fn test_gas_info_of_terminated_program() { + use demo_constructor::{Calls, Scheme}; + + init_logger(); + new_test_ext().execute_with(|| { + // Dies in init + let init_dead = Calls::builder().panic("Die in init"); + let handle_dead = Calls::builder().panic("Called after being terminated!"); + let (_, pid_dead) = utils::submit_constructor_with_args( + USER_1, + b"salt1", + Scheme::predefined(init_dead, handle_dead, Calls::default()), + 0, + ); + + // Sends in handle message do dead program + let handle_proxy = Calls::builder().send(pid_dead.into_bytes(), []); + let (_, proxy_pid) = utils::submit_constructor_with_args( + USER_1, + b"salt2", + Scheme::predefined(Calls::default(), handle_proxy, Calls::default()), + 0, + ); + + run_to_next_block(None); + + let _gas_info = Gear::calculate_gas_info( + USER_1.into_origin(), + HandleKind::Handle(proxy_pid), + EMPTY_PAYLOAD.to_vec(), + 0, + true, + true, + ) + .expect("failed getting gas info"); + }) +} + mod utils { #![allow(unused)] From ee5ce18c9c5fced558a5494586c840e0cd469c2f Mon Sep 17 00:00:00 2001 From: mqxf Date: Tue, 19 Sep 2023 13:13:51 +0200 Subject: [PATCH 152/165] feat(gtest): Add payload to `Program::read_state*` (#3254) Co-authored-by: Sabaun Taraki --- examples/autoreply/src/lib.rs | 7 ++++- examples/new-meta/tests/read_state.rs | 24 +++++++++++++--- gtest/src/manager.rs | 11 +++++-- gtest/src/program.rs | 41 ++++++++++++++------------- 4 files changed, 56 insertions(+), 27 deletions(-) diff --git a/examples/autoreply/src/lib.rs b/examples/autoreply/src/lib.rs index 90a59205f62..0c98a3a8179 100644 --- a/examples/autoreply/src/lib.rs +++ b/examples/autoreply/src/lib.rs @@ -18,6 +18,8 @@ #![no_std] +extern crate alloc; + #[cfg(feature = "std")] mod code { include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); @@ -31,6 +33,7 @@ mod wasm; #[cfg(test)] mod tests { + use alloc::vec::Vec; use gstd::ActorId; use gtest::{Program, System}; @@ -58,7 +61,9 @@ mod tests { assert!(!res.main_failed()); // Check whether the auto-reply was received - let reply_received: bool = prog2.read_state().expect("Failed to read state"); + let reply_received: bool = prog2 + .read_state(Vec::::default()) + .expect("Failed to read state"); assert!(reply_received); } } diff --git a/examples/new-meta/tests/read_state.rs b/examples/new-meta/tests/read_state.rs index 7ee30cc09bb..9c7fffdc380 100644 --- a/examples/new-meta/tests/read_state.rs +++ b/examples/new-meta/tests/read_state.rs @@ -10,7 +10,7 @@ fn read_state_bytes_returns_full_state() { let program = initialize_current_program(&system); let actual_state = program - .read_state_bytes() + .read_state_bytes(Default::default()) .expect("Unable to read program state"); let expected_state = Wallet::test_sequence().encode(); @@ -26,7 +26,12 @@ fn read_state_bytes_with_wasm_func_returns_transformed_state() { assert!(META_EXPORTS_V1.contains(&FUNC_NAME)); let actual_state = program - .read_state_bytes_using_wasm(FUNC_NAME, META_WASM_V1.to_vec(), state_args_encoded!()) + .read_state_bytes_using_wasm( + Default::default(), + FUNC_NAME, + META_WASM_V1.to_vec(), + state_args_encoded!(), + ) .expect("Unable to read program state"); let expected_state = Wallet::test_sequence().first().encode(); @@ -47,6 +52,7 @@ fn read_state_bytes_with_parameterized_wasm_func_returns_transformed_state() { let actual_state = program .read_state_bytes_using_wasm( + Default::default(), FUNC_NAME, META_WASM_V2.to_vec(), state_args_encoded!(&other_person), @@ -73,6 +79,7 @@ fn read_state_bytes_with_two_args_wasm_func_returns_transformed_state() { let actual_state = program .read_state_bytes_using_wasm( + Default::default(), FUNC_NAME, META_WASM_V2.to_vec(), state_args_encoded!(name.clone(), surname.clone()), @@ -92,7 +99,9 @@ fn read_state_returns_full_state() { let system = System::new(); let program = initialize_current_program(&system); - let actual_state: Vec = program.read_state().expect("Unable to read program state"); + let actual_state: Vec = program + .read_state(Vec::::default()) + .expect("Unable to read program state"); let expected_state = Wallet::test_sequence(); @@ -107,7 +116,12 @@ fn read_state_with_wasm_func_returns_transformed_state() { assert!(META_EXPORTS_V1.contains(&FUNC_NAME)); let actual_state: Option = program - .read_state_using_wasm(FUNC_NAME, META_WASM_V1.to_vec(), state_args!()) + .read_state_using_wasm( + Vec::::default(), + FUNC_NAME, + META_WASM_V1.to_vec(), + state_args!(), + ) .expect("Unable to read program state"); let expected_state = Wallet::test_sequence().first().cloned(); @@ -128,6 +142,7 @@ fn read_state_with_parameterized_wasm_func_returns_transformed_state() { let actual_state: Option = program .read_state_using_wasm( + Vec::::default(), FUNC_NAME, META_WASM_V2.to_vec(), state_args!(other_person.clone()), @@ -153,6 +168,7 @@ fn read_state_with_two_args_wasm_func_returns_transformed_state() { let actual_state: Option = program .read_state_using_wasm( + Vec::::default(), FUNC_NAME, META_WASM_V2.to_vec(), state_args!(name.clone(), surname.clone()), diff --git a/gtest/src/manager.rs b/gtest/src/manager.rs index 54a41e9bd16..48cbe8ebfbb 100644 --- a/gtest/src/manager.rs +++ b/gtest/src/manager.rs @@ -456,7 +456,11 @@ impl ExtManager { /// Call non-void meta function from actor stored in manager. /// Warning! This is a static call that doesn't change actors pages data. - pub(crate) fn read_state_bytes(&mut self, program_id: &ProgramId) -> Result> { + pub(crate) fn read_state_bytes( + &mut self, + payload: Vec, + program_id: &ProgramId, + ) -> Result> { let (actor, _balance) = self .actors .get_mut(program_id) @@ -468,7 +472,7 @@ impl ExtManager { program.code().clone(), Some(program.allocations().clone()), Some(*program_id), - Default::default(), + payload, u64::MAX, self.block_info, ) @@ -484,6 +488,7 @@ impl ExtManager { pub(crate) fn read_state_bytes_using_wasm( &mut self, + payload: Vec, program_id: &ProgramId, fn_name: &str, wasm: Vec, @@ -501,7 +506,7 @@ impl ExtManager { .0; let mut mapping_code_payload = args.unwrap_or_default(); - mapping_code_payload.append(&mut self.read_state_bytes(program_id)?); + mapping_code_payload.append(&mut self.read_state_bytes(payload, program_id)?); core_processor::informational::execute_for_reply::, _>( String::from(fn_name), diff --git a/gtest/src/program.rs b/gtest/src/program.rs index dca23cfb66a..674e92f1531 100644 --- a/gtest/src/program.rs +++ b/gtest/src/program.rs @@ -446,10 +446,10 @@ impl<'a> Program<'a> { } /// Reads the program’s state as a byte vector. - pub fn read_state_bytes(&self) -> Result> { + pub fn read_state_bytes(&self, payload: Vec) -> Result> { self.manager .borrow_mut() - .with_externalities(|this| this.read_state_bytes(&self.id)) + .with_externalities(|this| this.read_state_bytes(payload, &self.id)) } /// Reads the program’s transformed state as a byte vector. The transformed @@ -482,36 +482,37 @@ impl<'a> Program<'a> { /// # let ARG_2 = 0u8; /// //Read state bytes with no arguments passed to wasm. /// # let WASM = vec![]; - /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, Option::>::None)?; + /// let _ = program.read_state_bytes_using_wasm(Default::default(), "fn_name", WASM, Option::>::None)?; /// # let WASM = vec![]; - /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, state_args_encoded!())?; + /// let _ = program.read_state_bytes_using_wasm(Default::default(), "fn_name", WASM, state_args_encoded!())?; /// // Read state bytes with one argument passed to wasm. /// # let WASM = vec![]; - /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, Some(ARG_1.encode()))?; + /// let _ = program.read_state_bytes_using_wasm(Default::default(), "fn_name", WASM, Some(ARG_1.encode()))?; /// # let WASM = vec![]; - /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, state_args_encoded!(ARG_1))?; + /// let _ = program.read_state_bytes_using_wasm(Default::default(), "fn_name", WASM, state_args_encoded!(ARG_1))?; /// // Read state bytes with multiple arguments passed to wasm. /// # let WASM = vec![]; - /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, Some((ARG_1, ARG_2).encode()))?; + /// let _ = program.read_state_bytes_using_wasm(Default::default(), "fn_name", WASM, Some((ARG_1, ARG_2).encode()))?; /// # let WASM = vec![]; - /// let _ = program.read_state_bytes_using_wasm("fn_name", WASM, state_args_encoded!(ARG_1, ARG_2))?; + /// let _ = program.read_state_bytes_using_wasm(Default::default(), "fn_name", WASM, state_args_encoded!(ARG_1, ARG_2))?; /// # Ok(()) /// # } /// ``` pub fn read_state_bytes_using_wasm( &self, + payload: Vec, fn_name: &str, wasm: Vec, args: Option>, ) -> Result> { self.manager.borrow_mut().with_externalities(|this| { - this.read_state_bytes_using_wasm(&self.id, fn_name, wasm, args) + this.read_state_bytes_using_wasm(payload, &self.id, fn_name, wasm, args) }) } /// Reads and decodes the program's state . - pub fn read_state(&self) -> Result { - let state_bytes = self.read_state_bytes()?; + pub fn read_state(&self, payload: P) -> Result { + let state_bytes = self.read_state_bytes(payload.encode())?; D::decode(&mut state_bytes.as_ref()).map_err(Into::into) } @@ -544,30 +545,32 @@ impl<'a> Program<'a> { /// # let ARG_2 = 0u8; /// //Read state bytes with no arguments passed to wasm. /// # let WASM = vec![]; - /// let _ = program.read_state_using_wasm("fn_name", WASM, Option::<()>::None)?; + /// let _ = program.read_state_using_wasm(Vec::::default(), "fn_name", WASM, Option::<()>::None)?; /// # let WASM = vec![]; - /// let _ = program.read_state_using_wasm("fn_name", WASM, state_args!())?; + /// let _ = program.read_state_using_wasm(Vec::::default(), "fn_name", WASM, state_args!())?; /// // Read state bytes with one argument passed to wasm. /// # let WASM = vec![]; - /// let _ = program.read_state_using_wasm("fn_name", WASM, Some(ARG_1))?; + /// let _ = program.read_state_using_wasm(Vec::::default(), "fn_name", WASM, Some(ARG_1))?; /// # let WASM = vec![]; - /// let _ = program.read_state_using_wasm("fn_name", WASM, state_args!(ARG_1))?; + /// let _ = program.read_state_using_wasm(Vec::::default(), "fn_name", WASM, state_args!(ARG_1))?; /// // Read state bytes with multiple arguments passed to wasm. /// # let WASM = vec![]; - /// let _ = program.read_state_using_wasm("fn_name", WASM, Some((ARG_1, ARG_2)))?; + /// let _ = program.read_state_using_wasm(Vec::::default(), "fn_name", WASM, Some((ARG_1, ARG_2)))?; /// # let WASM = vec![]; - /// let _ = program.read_state_using_wasm("fn_name", WASM, state_args!(ARG_1, ARG_2))?; + /// let _ = program.read_state_using_wasm(Vec::::default(), "fn_name", WASM, state_args!(ARG_1, ARG_2))?; /// # Ok(()) /// # } /// ``` - pub fn read_state_using_wasm( + pub fn read_state_using_wasm( &self, + payload: P, fn_name: &str, wasm: Vec, argument: Option, ) -> Result { let argument_bytes = argument.map(|arg| arg.encode()); - let state_bytes = self.read_state_bytes_using_wasm(fn_name, wasm, argument_bytes)?; + let state_bytes = + self.read_state_bytes_using_wasm(payload.encode(), fn_name, wasm, argument_bytes)?; D::decode(&mut state_bytes.as_ref()).map_err(Into::into) } From 3e3254e4734c16d20f2a9eead58ea854f249bc12 Mon Sep 17 00:00:00 2001 From: Georgy Shepelev Date: Tue, 19 Sep 2023 16:44:19 +0400 Subject: [PATCH 153/165] chore(tests): Adjust `block_max_gas_works` test of gear-authorship (#3300) --- Cargo.lock | 1 + node/authorship/Cargo.toml | 4 +++- node/authorship/src/tests.rs | 40 +++++++++++++++++++++++++++--------- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3041ea8580e..9fe9a6d4da1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3754,6 +3754,7 @@ dependencies = [ "pallet-balances", "pallet-gear", "pallet-gear-messenger", + "pallet-gear-program", "pallet-gear-rpc-runtime-api", "pallet-sudo", "pallet-timestamp", diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index 7b474e043a6..2e59fc84df7 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -42,6 +42,7 @@ frame-system = { workspace = true, features = ["std"] } prometheus-endpoint.workspace = true [dev-dependencies] +common = { workspace = true, features = ["std"] } sc-transaction-pool.workspace = true frame-support = { workspace = true, features = ["std"] } sp-io = { workspace = true, features = ["std"] } @@ -54,8 +55,9 @@ pallet-timestamp = { workspace = true, features = ["std"] } pallet-balances = { workspace = true, features = ["std"] } pallet-gear = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } +pallet-gear-program = { workspace = true, features = ["std"] } testing = {workspace = true, features = ["vara-native"] } vara-runtime = { workspace = true, features = ["std", "dev"] } -demo-mul-by-const.workspace = true +demo-mul-by-const = { workspace = true, features = ["debug"] } env_logger.workspace = true service = { workspace = true, features = ["dev", "vara-native"] } diff --git a/node/authorship/src/tests.rs b/node/authorship/src/tests.rs index afbc17b4bbd..c845fbbf692 100644 --- a/node/authorship/src/tests.rs +++ b/node/authorship/src/tests.rs @@ -23,10 +23,12 @@ use crate::authorship::*; -use codec::Encode; +use codec::{Decode, Encode}; +use common::Program; use core::convert::TryFrom; use frame_support::{storage::storage_prefix, traits::PalletInfoAccess}; use futures::executor::block_on; +use runtime_primitives::BlockNumber; use sc_client_api::Backend; use sc_transaction_pool::BasicPool; use sc_transaction_pool_api::{ @@ -53,6 +55,7 @@ use testing::{ use vara_runtime::{AccountId, Runtime, RuntimeCall, UncheckedExtrinsic, SLOT_DURATION, VERSION}; const SOURCE: TransactionSource = TransactionSource::External; +const DEFAULT_GAS_LIMIT: u64 = 865_000_000; fn chain_event(header: B::Header) -> ChainEvent where @@ -91,7 +94,7 @@ fn checked_extrinsics(n: u32, signer: AccountId, nonce: &mut u32) -> Vec::name().as_bytes(), + "ProgramStorage".as_bytes(), + ); + let mut iter_args = IterArgs::default(); + iter_args.prefix = Some(&programs_prefix); + + // The fact that 2 init messages out of 5 have been processed means + // that there should be 2 inited programs. + let inited_count = state.pairs(iter_args).unwrap().fold(0u32, |count, pair| { + let value = match pair { + Ok((_key, value)) => value, + _ => return count, + }; + + match Program::::decode(&mut &value[..]) { + Ok(p) if p.is_initialized() => count + 1, + _ => count, + } + }); + assert_eq!(inited_count, 2); } #[test] From b386b2a1ac98658fe1845cf69a811373d4e48f86 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Wed, 20 Sep 2023 01:07:10 +0800 Subject: [PATCH 154/165] chore(core): move GasInfo to core (#3130) --- Cargo.lock | 1 + core/Cargo.toml | 5 +++++ core/src/gas.rs | 26 +++++++++++++++++++++++++- gsdk/Cargo.toml | 2 +- gsdk/src/lib.rs | 15 ++------------- pallets/gear/rpc/Cargo.toml | 2 +- pallets/gear/src/lib.rs | 22 +--------------------- 7 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9fe9a6d4da1..ab33d6e89a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3936,6 +3936,7 @@ dependencies = [ "paste", "proptest", "scale-info", + "serde", "static_assertions", "wabt", "wasmparser-nostd 0.100.1", diff --git a/core/Cargo.toml b/core/Cargo.toml index 666e400433f..6fb6635d08e 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -26,10 +26,15 @@ paste = { workspace = true } enum-iterator.workspace = true byteorder.workspace = true +# Optional dependencies +serde = { workspace = true, features = [ "derive" ], optional = true } + [dev-dependencies] wabt.workspace = true env_logger.workspace = true proptest.workspace = true [features] +default = [] strict = [] +std = ["serde/std"] diff --git a/core/src/gas.rs b/core/src/gas.rs index 8cfe903e66b..022d10116d3 100644 --- a/core/src/gas.rs +++ b/core/src/gas.rs @@ -20,7 +20,10 @@ use crate::costs::RuntimeCosts; use enum_iterator::Sequence; -use scale_info::scale::{Decode, Encode}; +use scale_info::{ + scale::{Decode, Encode}, + TypeInfo, +}; /// The id of the gas lock. #[derive(Debug, Clone, Copy, PartialEq, Eq, Sequence)] @@ -329,6 +332,27 @@ impl From<(i64, i64)> for GasLeft { } } +/// The struct contains results of gas calculation required to process +/// a message. +#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] +#[cfg_attr(feature = "std", derive(serde::Serialize, serde::Deserialize))] +pub struct GasInfo { + /// Represents minimum gas limit required for execution. + pub min_limit: u64, + /// Gas amount that we reserve for some other on-chain interactions. + pub reserved: u64, + /// Contains number of gas burned during message processing. + pub burned: u64, + /// The value may be returned if a program happens to be executed + /// the second or next time in a block. + pub may_be_returned: u64, + /// Was the message placed into waitlist at the end of calculating. + /// + /// This flag shows, that `min_limit` makes sense and have some guarantees + /// only before insertion into waitlist. + pub waited: bool, +} + #[cfg(test)] mod tests { use super::{ChargeResult, GasCounter}; diff --git a/gsdk/Cargo.toml b/gsdk/Cargo.toml index 3985dbc5494..34946780c3d 100644 --- a/gsdk/Cargo.toml +++ b/gsdk/Cargo.toml @@ -15,7 +15,7 @@ anyhow.workspace = true base64.workspace = true futures-util.workspace = true futures.workspace = true -gear-core.workspace = true +gear-core = { workspace = true, features = [ "std" ] } gear-core-errors.workspace = true hex.workspace = true jsonrpsee = { workspace = true, features = [ "http-client", "ws-client" ] } diff --git a/gsdk/src/lib.rs b/gsdk/src/lib.rs index f4705522088..ea229d6adf6 100644 --- a/gsdk/src/lib.rs +++ b/gsdk/src/lib.rs @@ -31,9 +31,9 @@ use crate::{ ActiveProgram, }, }; +pub use gear_core::gas::GasInfo; use gear_core::ids::{MessageId, ReservationId}; -use parity_scale_codec::{Decode, Encode}; -use serde::{Deserialize, Serialize}; +use parity_scale_codec::Decode; use sp_runtime::AccountId32; use std::collections::HashMap; pub use subxt::dynamic::Value; @@ -71,17 +71,6 @@ pub mod gp { /// Block number type pub type BlockNumber = u32; -/// Information of gas -#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, Serialize, Deserialize)] -pub struct GasInfo { - /// Represents minimum gas limit required for execution. - pub min_limit: u64, - /// Gas amount that we reserve for some other on-chain interactions. - pub reserved: u64, - /// Contains number of gas burned during message processing. - pub burned: u64, -} - /// Gear gas node id. pub type GearGasNodeId = GasNodeId; diff --git a/pallets/gear/rpc/Cargo.toml b/pallets/gear/rpc/Cargo.toml index 366c3bb3a48..505792028f9 100644 --- a/pallets/gear/rpc/Cargo.toml +++ b/pallets/gear/rpc/Cargo.toml @@ -18,7 +18,7 @@ sp-rpc.workspace = true sp-runtime.workspace = true # Local packages -gear-core.workspace = true +gear-core = { workspace = true, features = ["std"] } gear-core-errors = { workspace = true, features = ["codec"] } gear-common.workspace = true pallet-gear-rpc-runtime-api.workspace = true diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 1363b7166a2..61409700809 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -43,6 +43,7 @@ pub use crate::{ pallet::*, schedule::{HostFnWeights, InstructionWeights, Limits, MemoryWeights, Schedule}, }; +pub use gear_core::gas::GasInfo; pub use weights::WeightInfo; use alloc::{format, string::String}; @@ -139,27 +140,6 @@ impl DebugInfo for () { } } -/// The struct contains results of gas calculation required to process -/// a message. -#[derive(Clone, Debug, Decode, Encode, PartialEq, Eq, TypeInfo)] -#[cfg_attr(feature = "std", derive(serde::Deserialize, serde::Serialize))] -pub struct GasInfo { - /// Represents minimum gas limit required for execution. - pub min_limit: u64, - /// Gas amount that we reserve for some other on-chain interactions. - pub reserved: u64, - /// Contains number of gas burned during message processing. - pub burned: u64, - /// The value may be returned if a program happens to be executed - /// the second or next time in a block. - pub may_be_returned: u64, - /// Was the message placed into waitlist at the end of calculating. - /// - /// This flag shows, that `min_limit` makes sense and have some guarantees - /// only before insertion into waitlist. - pub waited: bool, -} - #[frame_support::pallet] pub mod pallet { use super::*; From f15ba78005a5f81be34648298c1cccff9bcc92a2 Mon Sep 17 00:00:00 2001 From: Shamil <66209982+shamilsan@users.noreply.github.com> Date: Tue, 19 Sep 2023 21:51:35 +0300 Subject: [PATCH 155/165] refactor(examples): make demos be more consistent (#3138) --- Cargo.lock | 1 - examples/async-custom-entry/Cargo.toml | 11 +- examples/async-custom-entry/src/lib.rs | 31 +- examples/async-custom-entry/src/wasm.rs | 46 ++ examples/async-init/Cargo.toml | 7 +- examples/async-init/src/lib.rs | 72 +-- examples/async-init/src/wasm.rs | 82 ++++ examples/async-recursion/Cargo.toml | 3 +- examples/async-recursion/src/lib.rs | 37 +- examples/async-recursion/src/wasm.rs | 52 +++ examples/async-signal-entry/Cargo.toml | 11 +- examples/async-signal-entry/src/lib.rs | 26 +- examples/async-signal-entry/src/wasm.rs | 41 ++ examples/async-tester/Cargo.toml | 9 +- examples/async-tester/src/lib.rs | 4 +- .../async-tester/src/{code.rs => wasm.rs} | 6 +- examples/async/Cargo.toml | 5 +- examples/async/src/lib.rs | 48 +- examples/async/src/wasm.rs | 63 +++ examples/calc-hash/Cargo.toml | 9 +- examples/calc-hash/in-one-block/Cargo.toml | 9 +- examples/calc-hash/in-one-block/src/lib.rs | 4 +- .../in-one-block/src/{code.rs => wasm.rs} | 0 examples/calc-hash/over-blocks/Cargo.toml | 9 +- examples/calc-hash/over-blocks/src/lib.rs | 4 +- .../over-blocks/src/{code.rs => wasm.rs} | 4 +- examples/compose/Cargo.toml | 11 +- examples/compose/src/lib.rs | 109 +---- examples/compose/src/wasm.rs | 131 ++++++ examples/constructor/Cargo.toml | 5 +- examples/custom/Cargo.toml | 3 +- examples/delayed-sender/Cargo.toml | 7 +- examples/delayed-sender/src/lib.rs | 4 +- .../delayed-sender/src/{code.rs => wasm.rs} | 10 +- examples/distributor/Cargo.toml | 11 +- examples/distributor/src/lib.rs | 169 +------ examples/distributor/src/wasm.rs | 182 ++++++++ examples/fungible-token/Cargo.toml | 19 +- examples/fungible-token/io/Cargo.toml | 7 +- examples/fungible-token/src/lib.rs | 2 +- .../src/{contract.rs => wasm.rs} | 0 examples/futures-unordered/Cargo.toml | 7 +- examples/futures-unordered/src/lib.rs | 111 +---- examples/futures-unordered/src/wasm.rs | 126 +++++ examples/gas-burned/Cargo.toml | 7 +- examples/gas-burned/src/lib.rs | 24 +- examples/gas-burned/src/wasm.rs | 21 + examples/incomplete-async-payloads/Cargo.toml | 5 +- examples/incomplete-async-payloads/src/lib.rs | 58 +-- .../incomplete-async-payloads/src/wasm.rs | 73 +++ examples/init-fail-sender/Cargo.toml | 9 +- examples/init-fail-sender/src/lib.rs | 18 +- examples/init-fail-sender/src/wasm.rs | 15 + examples/init-wait-reply-exit/Cargo.toml | 9 +- examples/init-wait-reply-exit/src/lib.rs | 4 +- .../src/{code.rs => wasm.rs} | 0 examples/init-wait/Cargo.toml | 3 +- examples/init-wait/src/lib.rs | 4 +- examples/init-wait/src/{code.rs => wasm.rs} | 2 +- examples/messager/Cargo.toml | 3 +- examples/messager/src/lib.rs | 4 +- examples/messager/src/{code.rs => wasm.rs} | 0 examples/mul-by-const/Cargo.toml | 11 +- examples/mul-by-const/src/lib.rs | 58 +-- examples/mul-by-const/src/wasm.rs | 80 ++++ examples/ncompose/Cargo.toml | 11 +- examples/ncompose/src/lib.rs | 132 +----- examples/ncompose/src/wasm.rs | 154 +++++++ examples/new-meta/Cargo.toml | 9 +- examples/new-meta/io/Cargo.toml | 9 +- examples/new-meta/state-v1/Cargo.toml | 3 +- examples/new-meta/state-v2/Cargo.toml | 3 +- examples/new-meta/state-v3/Cargo.toml | 3 +- examples/node/Cargo.toml | 11 +- examples/node/src/lib.rs | 232 +--------- examples/node/src/wasm.rs | 248 ++++++++++ examples/out-of-memory/Cargo.toml | 7 +- examples/out-of-memory/src/lib.rs | 15 +- examples/out-of-memory/src/wasm.rs | 28 ++ examples/piggy-bank/Cargo.toml | 3 +- examples/piggy-bank/src/lib.rs | 18 +- examples/piggy-bank/src/wasm.rs | 33 ++ examples/ping/Cargo.toml | 3 +- examples/ping/src/lib.rs | 13 +- examples/ping/src/wasm.rs | 28 ++ examples/program-factory/Cargo.toml | 13 +- examples/program-factory/src/lib.rs | 55 +-- examples/program-factory/src/wasm.rs | 71 +++ examples/program-generator/Cargo.toml | 3 +- examples/program-generator/src/lib.rs | 31 +- examples/program-generator/src/wasm.rs | 41 ++ examples/proxy-relay/Cargo.toml | 13 +- examples/proxy-relay/src/lib.rs | 82 +--- examples/proxy-relay/src/wasm.rs | 97 ++++ .../proxy-reservation-with-gas/Cargo.toml | 13 +- .../proxy-reservation-with-gas/src/lib.rs | 33 +- .../proxy-reservation-with-gas/src/wasm.rs | 48 ++ examples/proxy/Cargo.toml | 15 +- examples/proxy/src/lib.rs | 26 +- examples/proxy/src/wasm.rs | 40 ++ examples/read-big-state/Cargo.toml | 5 +- examples/read-big-state/src/lib.rs | 22 +- examples/read-big-state/src/wasm.rs | 37 ++ examples/reservation-manager/Cargo.toml | 5 +- examples/reservation-manager/src/lib.rs | 31 +- examples/reservation-manager/src/wasm.rs | 46 ++ examples/reserve-gas/Cargo.toml | 5 +- examples/reserve-gas/src/lib.rs | 190 +------- examples/reserve-gas/src/wasm.rs | 199 ++++++++ examples/rwlock/Cargo.toml | 5 +- examples/rwlock/src/lib.rs | 109 +---- examples/rwlock/src/wasm.rs | 124 +++++ examples/send-from-reservation/Cargo.toml | 11 +- examples/send-from-reservation/src/lib.rs | 82 +--- examples/send-from-reservation/src/wasm.rs | 92 ++++ examples/signal-entry/Cargo.toml | 12 +- examples/signal-entry/src/lib.rs | 259 +---------- examples/signal-entry/src/wasm.rs | 274 +++++++++++ examples/stack-allocations/Cargo.toml | 9 +- examples/stack-allocations/src/lib.rs | 42 +- examples/stack-allocations/src/wasm.rs | 62 +++ examples/state-rollback/Cargo.toml | 3 +- examples/state-rollback/src/lib.rs | 29 +- examples/state-rollback/src/wasm.rs | 44 ++ examples/sync-duplicate/Cargo.toml | 3 +- examples/sync-duplicate/src/lib.rs | 31 +- examples/sync-duplicate/src/wasm.rs | 46 ++ examples/sys-calls/Cargo.toml | 13 +- examples/sys-calls/src/lib.rs | 427 +---------------- examples/sys-calls/src/wasm.rs | 432 ++++++++++++++++++ examples/syscall-error/Cargo.toml | 11 +- examples/syscall-error/src/lib.rs | 17 +- examples/syscall-error/src/wasm.rs | 35 ++ examples/vec/Cargo.toml | 3 +- examples/vec/src/lib.rs | 37 +- examples/vec/src/wasm.rs | 52 +++ examples/wait-timeout/Cargo.toml | 15 +- examples/wait-timeout/src/lib.rs | 4 +- .../wait-timeout/src/{code.rs => wasm.rs} | 19 +- examples/wait/Cargo.toml | 3 +- examples/wait/src/lib.rs | 38 +- examples/wait/src/wasm.rs | 53 +++ examples/wait_wake/Cargo.toml | 5 +- examples/wait_wake/src/lib.rs | 36 +- examples/wait_wake/src/wasm.rs | 50 ++ examples/waiter/Cargo.toml | 9 +- examples/waiter/src/lib.rs | 4 +- examples/waiter/src/{code.rs => wasm.rs} | 19 +- examples/waiting-proxy/Cargo.toml | 9 +- examples/waiting-proxy/src/lib.rs | 29 +- examples/waiting-proxy/src/wasm.rs | 44 ++ examples/wat/Cargo.toml | 5 +- 152 files changed, 3611 insertions(+), 2995 deletions(-) create mode 100644 examples/async-custom-entry/src/wasm.rs create mode 100644 examples/async-init/src/wasm.rs create mode 100644 examples/async-recursion/src/wasm.rs create mode 100644 examples/async-signal-entry/src/wasm.rs rename examples/async-tester/src/{code.rs => wasm.rs} (91%) create mode 100644 examples/async/src/wasm.rs rename examples/calc-hash/in-one-block/src/{code.rs => wasm.rs} (100%) rename examples/calc-hash/over-blocks/src/{code.rs => wasm.rs} (96%) create mode 100644 examples/compose/src/wasm.rs rename examples/delayed-sender/src/{code.rs => wasm.rs} (89%) create mode 100644 examples/distributor/src/wasm.rs rename examples/fungible-token/src/{contract.rs => wasm.rs} (100%) create mode 100644 examples/futures-unordered/src/wasm.rs create mode 100644 examples/gas-burned/src/wasm.rs create mode 100644 examples/incomplete-async-payloads/src/wasm.rs create mode 100644 examples/init-fail-sender/src/wasm.rs rename examples/init-wait-reply-exit/src/{code.rs => wasm.rs} (100%) rename examples/init-wait/src/{code.rs => wasm.rs} (97%) rename examples/messager/src/{code.rs => wasm.rs} (100%) create mode 100644 examples/mul-by-const/src/wasm.rs create mode 100644 examples/ncompose/src/wasm.rs create mode 100644 examples/node/src/wasm.rs create mode 100644 examples/out-of-memory/src/wasm.rs create mode 100644 examples/piggy-bank/src/wasm.rs create mode 100644 examples/ping/src/wasm.rs create mode 100644 examples/program-factory/src/wasm.rs create mode 100644 examples/program-generator/src/wasm.rs create mode 100644 examples/proxy-relay/src/wasm.rs create mode 100644 examples/proxy-reservation-with-gas/src/wasm.rs create mode 100644 examples/proxy/src/wasm.rs create mode 100644 examples/read-big-state/src/wasm.rs create mode 100644 examples/reservation-manager/src/wasm.rs create mode 100644 examples/reserve-gas/src/wasm.rs create mode 100644 examples/rwlock/src/wasm.rs create mode 100644 examples/send-from-reservation/src/wasm.rs create mode 100644 examples/signal-entry/src/wasm.rs create mode 100644 examples/stack-allocations/src/wasm.rs create mode 100644 examples/state-rollback/src/wasm.rs create mode 100644 examples/sync-duplicate/src/wasm.rs create mode 100644 examples/sys-calls/src/wasm.rs create mode 100644 examples/syscall-error/src/wasm.rs create mode 100644 examples/vec/src/wasm.rs rename examples/wait-timeout/src/{code.rs => wasm.rs} (84%) create mode 100644 examples/wait/src/wasm.rs create mode 100644 examples/wait_wake/src/wasm.rs rename examples/waiter/src/{code.rs => wasm.rs} (94%) create mode 100644 examples/waiting-proxy/src/wasm.rs diff --git a/Cargo.lock b/Cargo.lock index ab33d6e89a9..83e641b6e76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2227,7 +2227,6 @@ dependencies = [ "gear-core", "gear-wasm-builder", "gstd", - "gsys", "gtest", "parity-scale-codec", ] diff --git a/examples/async-custom-entry/Cargo.toml b/examples/async-custom-entry/Cargo.toml index 7a059c0d776..ce820c11930 100644 --- a/examples/async-custom-entry/Cargo.toml +++ b/examples/async-custom-entry/Cargo.toml @@ -2,13 +2,14 @@ name = "demo-async-custom-entry" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true @@ -16,8 +17,6 @@ gear-wasm-builder.workspace = true [dev-dependencies] gtest.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std"] diff --git a/examples/async-custom-entry/src/lib.rs b/examples/async-custom-entry/src/lib.rs index 6a7b7d54ea0..b20b99554f5 100644 --- a/examples/async-custom-entry/src/lib.rs +++ b/examples/async-custom-entry/src/lib.rs @@ -27,33 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{msg, ActorId}; - - static mut USER: ActorId = ActorId::zero(); - - #[gstd::async_init(handle_reply = my_handle_reply, handle_signal = my_handle_signal)] - async fn init() { - gstd::Config::set_system_reserve(10_000_000_000).expect("Failed to set system reserve"); - - unsafe { USER = msg::source() } - } - - #[gstd::async_main] - async fn main() { - #[allow(clippy::empty_loop)] - loop {} - } - - fn my_handle_reply() { - unsafe { - msg::send_bytes(USER, b"my_handle_reply", 0).unwrap(); - } - } - - fn my_handle_signal() { - unsafe { - msg::send_bytes(USER, b"my_handle_signal", 0).unwrap(); - } - } -} +mod wasm; diff --git a/examples/async-custom-entry/src/wasm.rs b/examples/async-custom-entry/src/wasm.rs new file mode 100644 index 00000000000..a8f110f5bb2 --- /dev/null +++ b/examples/async-custom-entry/src/wasm.rs @@ -0,0 +1,46 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{msg, ActorId}; + +static mut USER: ActorId = ActorId::zero(); + +#[gstd::async_init(handle_reply = my_handle_reply, handle_signal = my_handle_signal)] +async fn init() { + gstd::Config::set_system_reserve(10_000_000_000).expect("Failed to set system reserve"); + + unsafe { USER = msg::source() } +} + +#[gstd::async_main] +async fn main() { + #[allow(clippy::empty_loop)] + loop {} +} + +fn my_handle_reply() { + unsafe { + msg::send_bytes(USER, b"my_handle_reply", 0).unwrap(); + } +} + +fn my_handle_signal() { + unsafe { + msg::send_bytes(USER, b"my_handle_signal", 0).unwrap(); + } +} diff --git a/examples/async-init/Cargo.toml b/examples/async-init/Cargo.toml index 950e247e59d..eb2eb78d4b6 100644 --- a/examples/async-init/Cargo.toml +++ b/examples/async-init/Cargo.toml @@ -4,12 +4,13 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } -futures = { workspace = true, features = ["alloc"] } +parity-scale-codec.workspace = true +futures.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/async-init/src/lib.rs b/examples/async-init/src/lib.rs index d5111c026cd..f58aab75c33 100644 --- a/examples/async-init/src/lib.rs +++ b/examples/async-init/src/lib.rs @@ -57,74 +57,4 @@ impl InputArgs { } #[cfg(not(feature = "std"))] -mod wasm { - /* The program demonstrates asynchronous execution and - * how to use macros `gstd::async_init`/`gstd::async_main`. - * - * `Init` method gets three addresses, sends "PING" messages - * to them and waits for at least two replies with any payload ("approvals"). - * - * `Handle` processes only "PING" messages. When `handle` gets such message - * it sends empty requests to the three addresses and waits for just one approval. - * If an approval is obtained the method replies with "PONG". - */ - - use crate::InputArgs; - use futures::future; - use gstd::{msg, prelude::*, ActorId}; - - // One of the addresses supposed to be non-program. - static mut ARGUMENTS: InputArgs = InputArgs { - approver_first: ActorId::zero(), - approver_second: ActorId::zero(), - approver_third: ActorId::zero(), - }; - - static mut RESPONSES: u8 = 0; - - #[gstd::async_init] - async fn init() { - let arguments: InputArgs = msg::load().expect("Failed to load arguments"); - - let mut requests = arguments - .iter() - .map(|&addr| { - msg::send_bytes_for_reply(addr, "PING", 0, 0).expect("Failed to send message") - }) - .collect::>(); - - unsafe { - ARGUMENTS = arguments; - } - - while !requests.is_empty() { - let (.., remaining) = future::select_all(requests).await; - unsafe { - RESPONSES += 1; - } - - if unsafe { RESPONSES } >= 2 { - break; - } - - requests = remaining; - } - } - - #[gstd::async_main] - async fn main() { - let message = msg::load_bytes().expect("Failed to load bytes"); - - assert_eq!(message, b"PING"); - - let requests = unsafe { ARGUMENTS.iter() } - .map(|&addr| { - msg::send_bytes_for_reply(addr, "PING", 0, 0).expect("Failed to send message") - }) - .collect::>(); - - let _ = future::select_all(requests).await; - - msg::reply(unsafe { RESPONSES }, 0).expect("Failed to send reply"); - } -} +mod wasm; diff --git a/examples/async-init/src/wasm.rs b/examples/async-init/src/wasm.rs new file mode 100644 index 00000000000..0b12705ca91 --- /dev/null +++ b/examples/async-init/src/wasm.rs @@ -0,0 +1,82 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! The program demonstrates asynchronous execution and +//! how to use macros `gstd::async_init`/`gstd::async_main`. +//! +//! `Init` method gets three addresses, sends "PING" messages +//! to them and waits for at least two replies with any payload ("approvals"). +//! +//! `Handle` processes only "PING" messages. When `handle` gets such message +//! it sends empty requests to the three addresses and waits for just one approval. +//! If an approval is obtained the method replies with "PONG". + +use crate::InputArgs; +use futures::future; +use gstd::{msg, prelude::*, ActorId}; + +// One of the addresses supposed to be non-program. +static mut ARGUMENTS: InputArgs = InputArgs { + approver_first: ActorId::zero(), + approver_second: ActorId::zero(), + approver_third: ActorId::zero(), +}; + +static mut RESPONSES: u8 = 0; + +#[gstd::async_init] +async fn init() { + let arguments: InputArgs = msg::load().expect("Failed to load arguments"); + + let mut requests = arguments + .iter() + .map(|&addr| msg::send_bytes_for_reply(addr, "PING", 0, 0).expect("Failed to send message")) + .collect::>(); + + unsafe { + ARGUMENTS = arguments; + } + + while !requests.is_empty() { + let (.., remaining) = future::select_all(requests).await; + unsafe { + RESPONSES += 1; + } + + if unsafe { RESPONSES } >= 2 { + break; + } + + requests = remaining; + } +} + +#[gstd::async_main] +async fn main() { + let message = msg::load_bytes().expect("Failed to load bytes"); + + assert_eq!(message, b"PING"); + + let requests = unsafe { ARGUMENTS.iter() } + .map(|&addr| msg::send_bytes_for_reply(addr, "PING", 0, 0).expect("Failed to send message")) + .collect::>(); + + let _ = future::select_all(requests).await; + + msg::reply(unsafe { RESPONSES }, 0).expect("Failed to send reply"); +} diff --git a/examples/async-recursion/Cargo.toml b/examples/async-recursion/Cargo.toml index 8bdf01eb582..99fc3c4f579 100644 --- a/examples/async-recursion/Cargo.toml +++ b/examples/async-recursion/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/async-recursion/src/lib.rs b/examples/async-recursion/src/lib.rs index 7d32db1717b..fbc08d47a0b 100644 --- a/examples/async-recursion/src/lib.rs +++ b/examples/async-recursion/src/lib.rs @@ -27,39 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - use async_recursion::async_recursion; - use gstd::{msg, prelude::*, ActorId}; - - static mut DESTINATION: ActorId = ActorId::zero(); - - #[no_mangle] - extern "C" fn init() { - let destination = msg::load().expect("Failed to load destination"); - unsafe { DESTINATION = destination }; - } - - /// Send message "PING" and wait for a reply, then recursively - /// repeat with `val` decreased by reply len while `val` > reply len. - #[async_recursion] - async fn rec_func(val: i32) { - let reply = msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) - .expect("Failed to send message") - .await - .expect("Received error reply"); - - msg::send(msg::source(), val, 0).expect("Failed to send message"); - - let reply_len = reply.len() as i32; - - if val - reply_len > 0 { - rec_func(val - reply_len).await; - } - } - - #[gstd::async_main] - async fn main() { - let arg = msg::load().expect("Failed to load argument"); - rec_func(arg).await; - } -} +mod wasm; diff --git a/examples/async-recursion/src/wasm.rs b/examples/async-recursion/src/wasm.rs new file mode 100644 index 00000000000..40648a95b08 --- /dev/null +++ b/examples/async-recursion/src/wasm.rs @@ -0,0 +1,52 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use async_recursion::async_recursion; +use gstd::{msg, prelude::*, ActorId}; + +static mut DESTINATION: ActorId = ActorId::zero(); + +#[no_mangle] +extern "C" fn init() { + let destination = msg::load().expect("Failed to load destination"); + unsafe { DESTINATION = destination }; +} + +/// Send message "PING" and wait for a reply, then recursively +/// repeat with `val` decreased by reply len while `val` > reply len. +#[async_recursion] +async fn rec_func(val: i32) { + let reply = msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) + .expect("Failed to send message") + .await + .expect("Received error reply"); + + msg::send(msg::source(), val, 0).expect("Failed to send message"); + + let reply_len = reply.len() as i32; + + if val - reply_len > 0 { + rec_func(val - reply_len).await; + } +} + +#[gstd::async_main] +async fn main() { + let arg = msg::load().expect("Failed to load argument"); + rec_func(arg).await; +} diff --git a/examples/async-signal-entry/Cargo.toml b/examples/async-signal-entry/Cargo.toml index e60c5baaceb..66067c35b43 100644 --- a/examples/async-signal-entry/Cargo.toml +++ b/examples/async-signal-entry/Cargo.toml @@ -2,13 +2,14 @@ name = "demo-async-signal-entry" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true @@ -16,8 +17,6 @@ gear-wasm-builder.workspace = true [dev-dependencies] gtest.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std"] diff --git a/examples/async-signal-entry/src/lib.rs b/examples/async-signal-entry/src/lib.rs index 921725da3ef..a6e3c737ab1 100644 --- a/examples/async-signal-entry/src/lib.rs +++ b/examples/async-signal-entry/src/lib.rs @@ -35,28 +35,4 @@ pub enum InitAction { } #[cfg(not(feature = "std"))] -mod wasm { - use super::*; - use gstd::{exec, msg}; - - #[gstd::async_init] - async fn init() { - let action = msg::load().unwrap(); - match action { - InitAction::None => {} - InitAction::Panic => { - let _bytes = msg::send_for_reply(msg::source(), b"init", 0, 0) - .unwrap() - .await - .unwrap(); - panic!(); - } - } - } - - #[gstd::async_main] - async fn main() { - msg::send(msg::source(), b"handle_signal", 0).unwrap(); - exec::wait(); - } -} +mod wasm; diff --git a/examples/async-signal-entry/src/wasm.rs b/examples/async-signal-entry/src/wasm.rs new file mode 100644 index 00000000000..a9192d60fd4 --- /dev/null +++ b/examples/async-signal-entry/src/wasm.rs @@ -0,0 +1,41 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::InitAction; +use gstd::{exec, msg}; + +#[gstd::async_init] +async fn init() { + let action = msg::load().unwrap(); + match action { + InitAction::None => {} + InitAction::Panic => { + let _bytes = msg::send_for_reply(msg::source(), b"init", 0, 0) + .unwrap() + .await + .unwrap(); + panic!(); + } + } +} + +#[gstd::async_main] +async fn main() { + msg::send(msg::source(), b"handle_signal", 0).unwrap(); + exec::wait(); +} diff --git a/examples/async-tester/Cargo.toml b/examples/async-tester/Cargo.toml index 114ec3a62a3..4e75128315a 100644 --- a/examples/async-tester/Cargo.toml +++ b/examples/async-tester/Cargo.toml @@ -2,13 +2,14 @@ name = "demo-async-tester" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/async-tester/src/lib.rs b/examples/async-tester/src/lib.rs index 41822dd4176..d752d462007 100644 --- a/examples/async-tester/src/lib.rs +++ b/examples/async-tester/src/lib.rs @@ -10,9 +10,7 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - include! {"./code.rs"} -} +mod wasm; #[derive(Clone, Copy, Debug, Decode, Encode, PartialEq, Eq)] pub enum Kind { diff --git a/examples/async-tester/src/code.rs b/examples/async-tester/src/wasm.rs similarity index 91% rename from examples/async-tester/src/code.rs rename to examples/async-tester/src/wasm.rs index 3cad9d5052f..fe32ce5f66e 100644 --- a/examples/async-tester/src/code.rs +++ b/examples/async-tester/src/wasm.rs @@ -36,14 +36,16 @@ async fn main() { Kind::SendCommit => { let handle = MessageHandle::init().expect("init message failed"); handle.push(&encoded_kind).expect("push payload failed"); - handle.commit_for_reply(msg::source(), 0, 0) + handle + .commit_for_reply(msg::source(), 0, 0) .expect("send message failed") .await } Kind::SendCommitWithGas(gas) => { let handle = MessageHandle::init().expect("init message failed"); handle.push(&encoded_kind).expect("push payload failed"); - handle.commit_with_gas_for_reply(msg::source(), gas, 0, 0) + handle + .commit_with_gas_for_reply(msg::source(), gas, 0, 0) .expect("send message failed") .await } diff --git a/examples/async/Cargo.toml b/examples/async/Cargo.toml index be01a96165c..45a6b2ddb94 100644 --- a/examples/async/Cargo.toml +++ b/examples/async/Cargo.toml @@ -4,11 +4,12 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/async/src/lib.rs b/examples/async/src/lib.rs index c193368d6d4..113fcda6c27 100644 --- a/examples/async/src/lib.rs +++ b/examples/async/src/lib.rs @@ -35,50 +35,4 @@ pub enum Command { } #[cfg(not(feature = "std"))] -mod wasm { - use crate::Command; - use gstd::{msg, prelude::*, sync::Mutex, ActorId}; - - static mut DESTINATION: ActorId = ActorId::zero(); - static MUTEX: Mutex = Mutex::new(0); - - #[no_mangle] - extern "C" fn init() { - let destination = msg::load().expect("Failed to load destination"); - unsafe { DESTINATION = destination }; - } - - async fn ping() -> Vec { - msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) - .expect("Failed to send message") - .await - .expect("Received error reply") - } - - #[gstd::async_main] - async fn main() { - let command = msg::load().expect("Failed to load command"); - - match command { - Command::Common => { - let r1 = ping().await; - let r2 = ping().await; - let r3 = ping().await; - - assert_eq!(r1, b"PONG"); - assert_eq!(r1, r2); - assert_eq!(r2, r3); - } - Command::Mutex => { - let _val = MUTEX.lock().await; - - msg::send(msg::source(), msg::id(), 0).expect("Failed to send message"); - let r = ping().await; - - assert_eq!(r, b"PONG"); - } - } - - msg::reply(msg::id(), 0).expect("Failed to send reply"); - } -} +mod wasm; diff --git a/examples/async/src/wasm.rs b/examples/async/src/wasm.rs new file mode 100644 index 00000000000..1b12121d16f --- /dev/null +++ b/examples/async/src/wasm.rs @@ -0,0 +1,63 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::Command; +use gstd::{msg, prelude::*, sync::Mutex, ActorId}; + +static mut DESTINATION: ActorId = ActorId::zero(); +static MUTEX: Mutex = Mutex::new(0); + +#[no_mangle] +extern "C" fn init() { + let destination = msg::load().expect("Failed to load destination"); + unsafe { DESTINATION = destination }; +} + +async fn ping() -> Vec { + msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) + .expect("Failed to send message") + .await + .expect("Received error reply") +} + +#[gstd::async_main] +async fn main() { + let command = msg::load().expect("Failed to load command"); + + match command { + Command::Common => { + let r1 = ping().await; + let r2 = ping().await; + let r3 = ping().await; + + assert_eq!(r1, b"PONG"); + assert_eq!(r1, r2); + assert_eq!(r2, r3); + } + Command::Mutex => { + let _val = MUTEX.lock().await; + + msg::send(msg::source(), msg::id(), 0).expect("Failed to send message"); + let r = ping().await; + + assert_eq!(r, b"PONG"); + } + } + + msg::reply(msg::id(), 0).expect("Failed to send reply"); +} diff --git a/examples/calc-hash/Cargo.toml b/examples/calc-hash/Cargo.toml index b61fb33ecf3..41a8bd8947a 100644 --- a/examples/calc-hash/Cargo.toml +++ b/examples/calc-hash/Cargo.toml @@ -2,12 +2,13 @@ name = "demo-calc-hash" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"]} +parity-scale-codec.workspace = true sha2 = { version = "0.10.6", default-features = false } [build-dependencies] diff --git a/examples/calc-hash/in-one-block/Cargo.toml b/examples/calc-hash/in-one-block/Cargo.toml index fcd0da368bb..7192e5baca9 100644 --- a/examples/calc-hash/in-one-block/Cargo.toml +++ b/examples/calc-hash/in-one-block/Cargo.toml @@ -2,13 +2,14 @@ name = "demo-calc-hash-in-one-block" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"]} gstd.workspace = true +parity-scale-codec.workspace = true shared = { path = "..", package = "demo-calc-hash" } [build-dependencies] diff --git a/examples/calc-hash/in-one-block/src/lib.rs b/examples/calc-hash/in-one-block/src/lib.rs index fafd39d6b22..1d609b29753 100644 --- a/examples/calc-hash/in-one-block/src/lib.rs +++ b/examples/calc-hash/in-one-block/src/lib.rs @@ -27,9 +27,7 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - include! {"./code.rs"} -} +mod wasm; /// Package with expected #[derive(Encode, Decode)] diff --git a/examples/calc-hash/in-one-block/src/code.rs b/examples/calc-hash/in-one-block/src/wasm.rs similarity index 100% rename from examples/calc-hash/in-one-block/src/code.rs rename to examples/calc-hash/in-one-block/src/wasm.rs diff --git a/examples/calc-hash/over-blocks/Cargo.toml b/examples/calc-hash/over-blocks/Cargo.toml index f3795a7d0b0..5d93098fe37 100644 --- a/examples/calc-hash/over-blocks/Cargo.toml +++ b/examples/calc-hash/over-blocks/Cargo.toml @@ -2,13 +2,14 @@ name = "demo-calc-hash-over-blocks" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"]} gstd.workspace = true +parity-scale-codec.workspace = true shared = { path = "../", package = "demo-calc-hash" } [build-dependencies] diff --git a/examples/calc-hash/over-blocks/src/lib.rs b/examples/calc-hash/over-blocks/src/lib.rs index 7c0054dd056..ab716fcd2da 100644 --- a/examples/calc-hash/over-blocks/src/lib.rs +++ b/examples/calc-hash/over-blocks/src/lib.rs @@ -29,9 +29,7 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - include! {"./code.rs"} -} +mod wasm; /// Program methods. #[derive(Debug, Encode, Decode)] diff --git a/examples/calc-hash/over-blocks/src/code.rs b/examples/calc-hash/over-blocks/src/wasm.rs similarity index 96% rename from examples/calc-hash/over-blocks/src/code.rs rename to examples/calc-hash/over-blocks/src/wasm.rs index 2d304ce3493..2cdc19f8526 100644 --- a/examples/calc-hash/over-blocks/src/code.rs +++ b/examples/calc-hash/over-blocks/src/wasm.rs @@ -15,7 +15,9 @@ extern "C" fn handle() { match method { Method::Start { expected, id, src } => { - registry.entry(id).or_insert_with(|| Package::new(expected, src)); + registry + .entry(id) + .or_insert_with(|| Package::new(expected, src)); let pkg = registry.get(&id).expect("Calculation not found."); diff --git a/examples/compose/Cargo.toml b/examples/compose/Cargo.toml index ed7edbd9bda..bd4a1891822 100644 --- a/examples/compose/Cargo.toml +++ b/examples/compose/Cargo.toml @@ -2,19 +2,18 @@ name = "demo-compose" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -hex = { version = "0.4.3", default-features = false, features = ["alloc"] } +hex.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = [] diff --git a/examples/compose/src/lib.rs b/examples/compose/src/lib.rs index 442e6d7ea0f..cc2e84c6fc0 100644 --- a/examples/compose/src/lib.rs +++ b/examples/compose/src/lib.rs @@ -34,111 +34,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - extern crate alloc; - - use gstd::{debug, exec, msg, prelude::*, ActorId}; - - static mut STATE: State = State { - contract_a: Program { - handle: ActorId::new([0u8; 32]), - }, - contract_b: Program { - handle: ActorId::new([0u8; 32]), - }, - }; - - struct State { - contract_a: Program, - contract_b: Program, - } - - impl State { - fn new(actor_a: impl Into, actor_b: impl Into) -> Self { - Self { - contract_a: Program::new(actor_a), - contract_b: Program::new(actor_b), - } - } - - async fn compose(&mut self, input: Vec) -> Result, &'static str> { - debug!( - "[0x{} compose::compose] Composing programs 0x{} and 0x{} on input {input:?}", - hex::encode(exec::program_id()), - hex::encode(self.contract_a.handle), - hex::encode(self.contract_b.handle), - ); - debug!( - "[0x{} compose::compose] Calling contract #1 at 0x{}", - hex::encode(exec::program_id()), - hex::encode(self.contract_a.handle) - ); - let output_a = self.contract_a.call(input).await?; - debug!( - "[0x{} compose::compose] Calling contract #2 at 0x{}", - hex::encode(exec::program_id()), - hex::encode(self.contract_b.handle) - ); - let output = self.contract_b.call(output_a).await?; - debug!( - "[0x{} compose::compose] Composition output: {output:?}", - hex::encode(exec::program_id()), - ); - - Ok(output) - } - } - - #[derive(Eq, Ord, PartialEq, PartialOrd)] - struct Program { - handle: ActorId, - } - - impl Program { - fn new(handle: impl Into) -> Self { - Self { - handle: handle.into(), - } - } - - async fn call(&self, input: Vec) -> Result, &'static str> { - let reply_bytes = msg::send_bytes_for_reply(self.handle, &input[..], 0, 0) - .expect("Error sending message") - .await - .map_err(|_| "Error in async message processing")?; - debug!( - "[0x{} compose::Program::call] Received reply from remote contract: {}", - hex::encode(exec::program_id()), - hex::encode(&reply_bytes) - ); - - Ok(reply_bytes) - } - } - - #[gstd::async_main] - async fn main() { - let input = msg::load_bytes().expect("Failed to load payload bytes"); - debug!( - "[0x{} compose::handle] input = {input:?}, gas_available = {}", - hex::encode(exec::program_id()), - exec::gas_available() - ); - - if let Ok(outcome) = (unsafe { STATE.compose(input) }).await { - debug!( - "[0x{} compose::handle] Composition output: {outcome:?}", - hex::encode(exec::program_id()), - ); - msg::reply(outcome, 0).unwrap(); - } - } - - #[no_mangle] - extern "C" fn init() { - let (contract_a, contract_b): (ActorId, ActorId) = - msg::load().expect("Expecting two contract addresses"); - unsafe { STATE = State::new(contract_a, contract_b) }; - msg::reply_bytes([], 0).unwrap(); - } -} +mod wasm; diff --git a/examples/compose/src/wasm.rs b/examples/compose/src/wasm.rs new file mode 100644 index 00000000000..a9c9c70a9a1 --- /dev/null +++ b/examples/compose/src/wasm.rs @@ -0,0 +1,131 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! This contract recursively composes itself with another contract (the other contract +//! being applied to the input data first): `c(f) = (c(f) . f) x`. +//! Every call to the auto_composer contract increments the internal `ITER` counter. +//! As soon as the counter reaches the `MAX_ITER`, the recursion stops. +//! Effectively, this procedure executes a composition of `MAX_ITER` contracts `f` +//! where the output of the previous call is fed to the input of the next call. + +extern crate alloc; + +use gstd::{debug, exec, msg, prelude::*, ActorId}; + +static mut STATE: State = State { + contract_a: Program { + handle: ActorId::new([0u8; 32]), + }, + contract_b: Program { + handle: ActorId::new([0u8; 32]), + }, +}; + +struct State { + contract_a: Program, + contract_b: Program, +} + +impl State { + fn new(actor_a: impl Into, actor_b: impl Into) -> Self { + Self { + contract_a: Program::new(actor_a), + contract_b: Program::new(actor_b), + } + } + + async fn compose(&mut self, input: Vec) -> Result, &'static str> { + debug!( + "[0x{} compose::compose] Composing programs 0x{} and 0x{} on input {input:?}", + hex::encode(exec::program_id()), + hex::encode(self.contract_a.handle), + hex::encode(self.contract_b.handle), + ); + debug!( + "[0x{} compose::compose] Calling contract #1 at 0x{}", + hex::encode(exec::program_id()), + hex::encode(self.contract_a.handle) + ); + let output_a = self.contract_a.call(input).await?; + debug!( + "[0x{} compose::compose] Calling contract #2 at 0x{}", + hex::encode(exec::program_id()), + hex::encode(self.contract_b.handle) + ); + let output = self.contract_b.call(output_a).await?; + debug!( + "[0x{} compose::compose] Composition output: {output:?}", + hex::encode(exec::program_id()), + ); + + Ok(output) + } +} + +#[derive(Eq, Ord, PartialEq, PartialOrd)] +struct Program { + handle: ActorId, +} + +impl Program { + fn new(handle: impl Into) -> Self { + Self { + handle: handle.into(), + } + } + + async fn call(&self, input: Vec) -> Result, &'static str> { + let reply_bytes = msg::send_bytes_for_reply(self.handle, &input[..], 0, 0) + .expect("Error sending message") + .await + .map_err(|_| "Error in async message processing")?; + debug!( + "[0x{} compose::Program::call] Received reply from remote contract: {}", + hex::encode(exec::program_id()), + hex::encode(&reply_bytes) + ); + + Ok(reply_bytes) + } +} + +#[gstd::async_main] +async fn main() { + let input = msg::load_bytes().expect("Failed to load payload bytes"); + debug!( + "[0x{} compose::handle] input = {input:?}, gas_available = {}", + hex::encode(exec::program_id()), + exec::gas_available() + ); + + if let Ok(outcome) = (unsafe { STATE.compose(input) }).await { + debug!( + "[0x{} compose::handle] Composition output: {outcome:?}", + hex::encode(exec::program_id()), + ); + msg::reply(outcome, 0).unwrap(); + } +} + +#[no_mangle] +extern "C" fn init() { + let (contract_a, contract_b): (ActorId, ActorId) = + msg::load().expect("Expecting two contract addresses"); + unsafe { STATE = State::new(contract_a, contract_b) }; + msg::reply_bytes([], 0).unwrap(); +} diff --git a/examples/constructor/Cargo.toml b/examples/constructor/Cargo.toml index 383ed6e29f7..093e3a2b005 100644 --- a/examples/constructor/Cargo.toml +++ b/examples/constructor/Cargo.toml @@ -4,13 +4,14 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gcore.workspace = true gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } hex.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/custom/Cargo.toml b/examples/custom/Cargo.toml index 164f8415084..bcf618a3c63 100644 --- a/examples/custom/Cargo.toml +++ b/examples/custom/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/delayed-sender/Cargo.toml b/examples/delayed-sender/Cargo.toml index 7c386c1b22a..199aaa4efa4 100644 --- a/examples/delayed-sender/Cargo.toml +++ b/examples/delayed-sender/Cargo.toml @@ -2,9 +2,10 @@ name = "demo-delayed-sender" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/delayed-sender/src/lib.rs b/examples/delayed-sender/src/lib.rs index 1175ebd0d91..a2bb360b9a4 100644 --- a/examples/delayed-sender/src/lib.rs +++ b/examples/delayed-sender/src/lib.rs @@ -27,6 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "wasm-wrapper"))] -mod wasm { - include! {"./code.rs"} -} +mod wasm; diff --git a/examples/delayed-sender/src/code.rs b/examples/delayed-sender/src/wasm.rs similarity index 89% rename from examples/delayed-sender/src/code.rs rename to examples/delayed-sender/src/wasm.rs index c1c1c2d61f8..395f2e7e03e 100644 --- a/examples/delayed-sender/src/code.rs +++ b/examples/delayed-sender/src/wasm.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use gstd::{msg, MessageId, exec}; +use gstd::{exec, msg, MessageId}; static mut MID: Option = None; static mut DONE: bool = false; @@ -33,11 +33,15 @@ extern "C" fn handle() { if let Some(message_id) = unsafe { MID.take() } { let delay: u32 = msg::load().unwrap(); - unsafe { DONE = true; } + unsafe { + DONE = true; + } exec::wake_delayed(message_id, delay).expect("Failed to wake message"); } else if unsafe { !DONE } { - unsafe { MID = Some(msg::id()); } + unsafe { + MID = Some(msg::id()); + } exec::wait(); } diff --git a/examples/distributor/Cargo.toml b/examples/distributor/Cargo.toml index 00d2f03613f..73887d6fd87 100644 --- a/examples/distributor/Cargo.toml +++ b/examples/distributor/Cargo.toml @@ -2,13 +2,14 @@ name = "demo-distributor" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true @@ -17,8 +18,6 @@ gear-wasm-builder.workspace = true gstd = { workspace = true, features = ["debug"] } gtest.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std"] diff --git a/examples/distributor/src/lib.rs b/examples/distributor/src/lib.rs index 0508f3a4d2c..53fd344ee84 100644 --- a/examples/distributor/src/lib.rs +++ b/examples/distributor/src/lib.rs @@ -52,174 +52,7 @@ struct Program { } #[cfg(not(feature = "std"))] -mod wasm { - use super::*; - - use alloc::collections::BTreeSet; - use core::future::Future; - use gstd::{debug, msg, sync::Mutex}; - - static mut STATE: Option = None; - - struct ProgramState { - nodes: Mutex>, - amount: u64, - } - - impl Default for ProgramState { - fn default() -> Self { - Self { - nodes: Mutex::new(BTreeSet::default()), - amount: 0, - } - } - } - - impl Program { - fn new(handle: impl Into) -> Self { - Self { - handle: handle.into(), - } - } - - fn do_request( - &self, - request: Req, - ) -> impl Future> { - let encoded_request: Vec = request.encode(); - - let program_handle = self.handle; - async move { - let reply_bytes = - msg::send_bytes_for_reply(program_handle, &encoded_request[..], 0, 0) - .expect("Error in message sending") - .await - .expect("Error in async message processing"); - - Rep::decode(&mut &reply_bytes[..]).map_err(|_| "Failed to decode reply") - } - } - - async fn do_send(&self, amount: u64) -> Result<(), &'static str> { - match self.do_request(Request::Receive(amount)).await? { - Reply::Success => Ok(()), - _ => Err("Unexpected send reply"), - } - } - - async fn do_report(&self) -> Result { - match self.do_request(Request::Report).await? { - Reply::Amount(amount) => Ok(amount), - _ => Err("Unexpected send reply"), - } - } - - fn nodes() -> &'static Mutex> { - unsafe { &mut STATE.as_mut().expect("STATE UNINITIALIZED!").nodes } - } - - fn amount() -> &'static mut u64 { - unsafe { &mut STATE.as_mut().expect("STATE UNINITIALIZED!").amount } - } - - async fn handle_request() { - let reply = match msg::load::() { - Ok(request) => match request { - Request::Receive(amount) => Self::handle_receive(amount).await, - Request::Join(program_id) => Self::handle_join(program_id).await, - Request::Report => Self::handle_report().await, - }, - Err(e) => { - debug!("Error processing request: {e:?}"); - Reply::Failure - } - }; - - debug!("Handle request finished"); - msg::reply(reply, 0).unwrap(); - } - - async fn handle_receive(amount: u64) -> Reply { - debug!("Handling receive {amount}"); - - let nodes = Program::nodes().lock().await; - let subnodes_count = nodes.as_ref().len() as u64; - - if subnodes_count > 0 { - let distributed_per_node = amount / subnodes_count; - let distributed_total = distributed_per_node * subnodes_count; - let mut left_over = amount - distributed_total; - - if distributed_per_node > 0 { - for program in nodes.as_ref().iter() { - if program.do_send(distributed_per_node).await.is_err() { - // reclaiming amount from nodes that fail! - left_over += distributed_per_node; - } - } - } - - debug!("Set own amount to: {left_over}"); - *Self::amount() = *Self::amount() + left_over; - } else { - debug!("Set own amount to: {amount}"); - *Self::amount() = *Self::amount() + amount; - } - - Reply::Success - } - - async fn handle_join(program_id: ActorId) -> Reply { - let mut nodes = Self::nodes().lock().await; - debug!("Inserting into nodes"); - nodes.as_mut().insert(Program::new(program_id)); - Reply::Success - } - - async fn handle_report() -> Reply { - let mut amount = *Program::amount(); - debug!("Own amount: {amount}"); - - let nodes = Program::nodes().lock().await; - - for program in nodes.as_ref().iter() { - debug!("Querying next node"); - amount += match program.do_report().await { - Ok(amount) => { - debug!("Sub-node result: {amount}"); - amount - } - Err(_) => { - // skipping erroneous sub-nodes! - debug!("Skipping erroneous node"); - 0 - } - } - } - - Reply::Amount(amount) - } - } - - #[no_mangle] - extern "C" fn handle() { - debug!("Handling sequence started"); - gstd::message_loop(Program::handle_request()); - debug!("Handling sequence terminated"); - } - - #[no_mangle] - extern "C" fn handle_reply() { - gstd::record_reply(); - } - - #[no_mangle] - extern "C" fn init() { - unsafe { STATE = Some(Default::default()) }; - msg::reply((), 0).unwrap(); - debug!("Program initialized"); - } -} +mod wasm; #[cfg(test)] mod tests { diff --git a/examples/distributor/src/wasm.rs b/examples/distributor/src/wasm.rs new file mode 100644 index 00000000000..0fd4ce4b30d --- /dev/null +++ b/examples/distributor/src/wasm.rs @@ -0,0 +1,182 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{Program, Reply, Request}; +use core::future::Future; +use gstd::{collections::BTreeSet, debug, msg, prelude::*, sync::Mutex, ActorId}; +use parity_scale_codec::{Decode, Encode}; + +static mut STATE: Option = None; + +struct ProgramState { + nodes: Mutex>, + amount: u64, +} + +impl Default for ProgramState { + fn default() -> Self { + Self { + nodes: Mutex::new(BTreeSet::default()), + amount: 0, + } + } +} + +impl Program { + fn new(handle: impl Into) -> Self { + Self { + handle: handle.into(), + } + } + + fn do_request( + &self, + request: Req, + ) -> impl Future> { + let encoded_request: Vec = request.encode(); + + let program_handle = self.handle; + async move { + let reply_bytes = msg::send_bytes_for_reply(program_handle, &encoded_request[..], 0, 0) + .expect("Error in message sending") + .await + .expect("Error in async message processing"); + + Rep::decode(&mut &reply_bytes[..]).map_err(|_| "Failed to decode reply") + } + } + + async fn do_send(&self, amount: u64) -> Result<(), &'static str> { + match self.do_request(Request::Receive(amount)).await? { + Reply::Success => Ok(()), + _ => Err("Unexpected send reply"), + } + } + + async fn do_report(&self) -> Result { + match self.do_request(Request::Report).await? { + Reply::Amount(amount) => Ok(amount), + _ => Err("Unexpected send reply"), + } + } + + fn nodes() -> &'static Mutex> { + unsafe { &mut STATE.as_mut().expect("STATE UNINITIALIZED!").nodes } + } + + fn amount() -> &'static mut u64 { + unsafe { &mut STATE.as_mut().expect("STATE UNINITIALIZED!").amount } + } + + async fn handle_request() { + let reply = match msg::load::() { + Ok(request) => match request { + Request::Receive(amount) => Self::handle_receive(amount).await, + Request::Join(program_id) => Self::handle_join(program_id).await, + Request::Report => Self::handle_report().await, + }, + Err(e) => { + debug!("Error processing request: {e:?}"); + Reply::Failure + } + }; + + debug!("Handle request finished"); + msg::reply(reply, 0).unwrap(); + } + + async fn handle_receive(amount: u64) -> Reply { + debug!("Handling receive {amount}"); + + let nodes = Program::nodes().lock().await; + let subnodes_count = nodes.as_ref().len() as u64; + + if subnodes_count > 0 { + let distributed_per_node = amount / subnodes_count; + let distributed_total = distributed_per_node * subnodes_count; + let mut left_over = amount - distributed_total; + + if distributed_per_node > 0 { + for program in nodes.as_ref().iter() { + if program.do_send(distributed_per_node).await.is_err() { + // reclaiming amount from nodes that fail! + left_over += distributed_per_node; + } + } + } + + debug!("Set own amount to: {left_over}"); + *Self::amount() = *Self::amount() + left_over; + } else { + debug!("Set own amount to: {amount}"); + *Self::amount() = *Self::amount() + amount; + } + + Reply::Success + } + + async fn handle_join(program_id: ActorId) -> Reply { + let mut nodes = Self::nodes().lock().await; + debug!("Inserting into nodes"); + nodes.as_mut().insert(Program::new(program_id)); + Reply::Success + } + + async fn handle_report() -> Reply { + let mut amount = *Program::amount(); + debug!("Own amount: {amount}"); + + let nodes = Program::nodes().lock().await; + + for program in nodes.as_ref().iter() { + debug!("Querying next node"); + amount += match program.do_report().await { + Ok(amount) => { + debug!("Sub-node result: {amount}"); + amount + } + Err(_) => { + // skipping erroneous sub-nodes! + debug!("Skipping erroneous node"); + 0 + } + } + } + + Reply::Amount(amount) + } +} + +#[no_mangle] +extern "C" fn handle() { + debug!("Handling sequence started"); + gstd::message_loop(Program::handle_request()); + debug!("Handling sequence terminated"); +} + +#[no_mangle] +extern "C" fn handle_reply() { + gstd::record_reply(); +} + +#[no_mangle] +extern "C" fn init() { + unsafe { STATE = Some(Default::default()) }; + msg::reply((), 0).unwrap(); + debug!("Program initialized"); +} diff --git a/examples/fungible-token/Cargo.toml b/examples/fungible-token/Cargo.toml index 11d3a446136..18d977de144 100644 --- a/examples/fungible-token/Cargo.toml +++ b/examples/fungible-token/Cargo.toml @@ -4,25 +4,26 @@ version = "0.1.4" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] -gstd = { workspace = true } -hashbrown = { workspace = true } -gmeta = { workspace = true } +gstd.workspace = true +hashbrown.workspace = true +gmeta.workspace = true ft-io = { path = "io" } [dev-dependencies] gstd = { workspace = true, features = ["debug"] } gear-core.workspace = true -tokio = { workspace = true, features = ["full", "test-util"] } -gclient = { workspace = true } -futures = "0.3" -rand = { version = "0.8" } +tokio.workspace = true +gclient.workspace = true +futures.workspace = true +rand.workspace = true statrs = "0.16" [build-dependencies] -gear-wasm-builder = { workspace = true } +gear-wasm-builder.workspace = true [features] debug = ["gstd/debug"] diff --git a/examples/fungible-token/io/Cargo.toml b/examples/fungible-token/io/Cargo.toml index 2f7fefeaa90..7fd0537bf5c 100644 --- a/examples/fungible-token/io/Cargo.toml +++ b/examples/fungible-token/io/Cargo.toml @@ -4,8 +4,9 @@ version = "0.1.4" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../../" +homepage.workspace = true +repository.workspace = true [dependencies] -gstd = { workspace = true } -gmeta = { workspace = true } +gstd.workspace = true +gmeta.workspace = true diff --git a/examples/fungible-token/src/lib.rs b/examples/fungible-token/src/lib.rs index f135d5bfcd3..3c6944afdde 100644 --- a/examples/fungible-token/src/lib.rs +++ b/examples/fungible-token/src/lib.rs @@ -30,4 +30,4 @@ pub use code::WASM_BINARY_OPT as WASM_BINARY; pub const WASM_BINARY: &[u8] = &[]; #[cfg(not(feature = "std"))] -pub mod contract; +pub mod wasm; diff --git a/examples/fungible-token/src/contract.rs b/examples/fungible-token/src/wasm.rs similarity index 100% rename from examples/fungible-token/src/contract.rs rename to examples/fungible-token/src/wasm.rs diff --git a/examples/futures-unordered/Cargo.toml b/examples/futures-unordered/Cargo.toml index df6d483f4a6..b20a78af317 100644 --- a/examples/futures-unordered/Cargo.toml +++ b/examples/futures-unordered/Cargo.toml @@ -4,12 +4,13 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } -futures = { workspace = true, features = ["alloc", "async-await"] } +parity-scale-codec.workspace = true +futures = { workspace = true, features = ["async-await"] } [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/futures-unordered/src/lib.rs b/examples/futures-unordered/src/lib.rs index 0144a88f59a..aafc99aa7fd 100644 --- a/examples/futures-unordered/src/lib.rs +++ b/examples/futures-unordered/src/lib.rs @@ -36,113 +36,4 @@ pub enum Command { } #[cfg(not(feature = "std"))] -mod wasm { - use crate::Command; - use futures::{ - join, select_biased, - stream::{FuturesUnordered, StreamExt}, - }; - use gstd::{debug, msg, prelude::*, ActorId}; - - static mut DEMO_ASYNC: ActorId = ActorId::new([0u8; 32]); - static mut DEMO_PING: ActorId = ActorId::new([0u8; 32]); - - #[no_mangle] - extern "C" fn init() { - let (demo_async, demo_ping) = msg::load().expect("Failed to load destination"); - unsafe { - DEMO_ASYNC = demo_async; - DEMO_PING = demo_ping; - } - } - - enum Dest { - Async, - Ping, - } - - #[gstd::async_main] - async fn main() { - let command = msg::load().expect("Failed to load command"); - let source = msg::source(); - - let send_fut = |dest: Dest| { - let (destination, payload) = match dest { - Dest::Async => (unsafe { DEMO_ASYNC }, vec![0]), // demo_async::Command::Common - Dest::Ping => (unsafe { DEMO_PING }, b"PING".to_vec()), - }; - - msg::send_bytes_for_reply(destination, payload, 0, 0).expect("Failed to send message") - }; - - match command { - // Directly using stream from futures unordered - // to step through each future ready - Command::Unordered => { - debug!("UNORDERED: Before any sending"); - - let requests = vec![send_fut(Dest::Async), send_fut(Dest::Ping)]; - let mut unordered: FuturesUnordered<_> = requests.into_iter().collect(); - - debug!("Before any polls"); - - let first = unordered.next().await; - msg::send_bytes( - source, - first.expect("Infallible").expect("Received error reply"), - 0, - ) - .expect("Failed to send message"); - - debug!("First (from demo_ping) done"); - - let second = unordered.next().await; - msg::send_bytes( - source, - second.expect("Infallible").expect("Received error reply"), - 0, - ) - .expect("Failed to send message"); - - debug!("Second (from demo_async) done"); - } - // Using select! macro to wait for first future ready - Command::Select => { - debug!("SELECT: Before any sending"); - - select_biased! { - res = send_fut(Dest::Async) => { - debug!("Received msg from demo_async"); - msg::send_bytes(source, res.expect("Received error reply"), 0).expect("Failed to send message"); - }, - res = send_fut(Dest::Ping) => { - debug!("Received msg from demo_ping"); - msg::send_bytes(source, res.expect("Received error reply"), 0).expect("Failed to send message"); - }, - }; - - debug!("Finish after select"); - } - // Using join! macros to wait all features ready - Command::Join => { - debug!("JOIN: Before any sending"); - - let res = join!(send_fut(Dest::Async), send_fut(Dest::Ping)); - - debug!("Finish after join"); - - let mut r1 = res.0.expect("Received error reply"); - let mut r2 = res.1.expect("Received error reply"); - - let mut res = Vec::with_capacity(r1.len() + r2.len()); - - res.append(&mut r1); - res.append(&mut r2); - - msg::send_bytes(source, res, 0).expect("Failed to send message"); - } - } - - msg::reply_bytes(msg::id(), 0).expect("Failed to send reply"); - } -} +mod wasm; diff --git a/examples/futures-unordered/src/wasm.rs b/examples/futures-unordered/src/wasm.rs new file mode 100644 index 00000000000..dcc301caaf2 --- /dev/null +++ b/examples/futures-unordered/src/wasm.rs @@ -0,0 +1,126 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::Command; +use futures::{ + join, select_biased, + stream::{FuturesUnordered, StreamExt}, +}; +use gstd::{debug, msg, prelude::*, ActorId}; + +static mut DEMO_ASYNC: ActorId = ActorId::new([0u8; 32]); +static mut DEMO_PING: ActorId = ActorId::new([0u8; 32]); + +#[no_mangle] +extern "C" fn init() { + let (demo_async, demo_ping) = msg::load().expect("Failed to load destination"); + unsafe { + DEMO_ASYNC = demo_async; + DEMO_PING = demo_ping; + } +} + +enum Dest { + Async, + Ping, +} + +#[gstd::async_main] +async fn main() { + let command = msg::load().expect("Failed to load command"); + let source = msg::source(); + + let send_fut = |dest: Dest| { + let (destination, payload) = match dest { + Dest::Async => (unsafe { DEMO_ASYNC }, vec![0]), // demo_async::Command::Common + Dest::Ping => (unsafe { DEMO_PING }, b"PING".to_vec()), + }; + + msg::send_bytes_for_reply(destination, payload, 0, 0).expect("Failed to send message") + }; + + match command { + // Directly using stream from futures unordered + // to step through each future ready + Command::Unordered => { + debug!("UNORDERED: Before any sending"); + + let requests = vec![send_fut(Dest::Async), send_fut(Dest::Ping)]; + let mut unordered: FuturesUnordered<_> = requests.into_iter().collect(); + + debug!("Before any polls"); + + let first = unordered.next().await; + msg::send_bytes( + source, + first.expect("Infallible").expect("Received error reply"), + 0, + ) + .expect("Failed to send message"); + + debug!("First (from demo_ping) done"); + + let second = unordered.next().await; + msg::send_bytes( + source, + second.expect("Infallible").expect("Received error reply"), + 0, + ) + .expect("Failed to send message"); + + debug!("Second (from demo_async) done"); + } + // Using select! macro to wait for first future ready + Command::Select => { + debug!("SELECT: Before any sending"); + + select_biased! { + res = send_fut(Dest::Async) => { + debug!("Received msg from demo_async"); + msg::send_bytes(source, res.expect("Received error reply"), 0).expect("Failed to send message"); + }, + res = send_fut(Dest::Ping) => { + debug!("Received msg from demo_ping"); + msg::send_bytes(source, res.expect("Received error reply"), 0).expect("Failed to send message"); + }, + }; + + debug!("Finish after select"); + } + // Using join! macros to wait all features ready + Command::Join => { + debug!("JOIN: Before any sending"); + + let res = join!(send_fut(Dest::Async), send_fut(Dest::Ping)); + + debug!("Finish after join"); + + let mut r1 = res.0.expect("Received error reply"); + let mut r2 = res.1.expect("Received error reply"); + + let mut res = Vec::with_capacity(r1.len() + r2.len()); + + res.append(&mut r1); + res.append(&mut r2); + + msg::send_bytes(source, res, 0).expect("Failed to send message"); + } + } + + msg::reply_bytes(msg::id(), 0).expect("Failed to send reply"); +} diff --git a/examples/gas-burned/Cargo.toml b/examples/gas-burned/Cargo.toml index 656a5b96c4c..9ad1445febf 100644 --- a/examples/gas-burned/Cargo.toml +++ b/examples/gas-burned/Cargo.toml @@ -2,9 +2,10 @@ name = "demo-gas-burned" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/gas-burned/src/lib.rs b/examples/gas-burned/src/lib.rs index 85514ae9dbb..45e628fea74 100644 --- a/examples/gas-burned/src/lib.rs +++ b/examples/gas-burned/src/lib.rs @@ -9,29 +9,7 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{msg, prelude::*}; - - const SHORT: usize = 100; - const LONG: usize = 10000; - - #[no_mangle] - extern "C" fn init() { - let mut v = vec![0; SHORT]; - for (i, item) in v.iter_mut().enumerate() { - *item = i * i; - } - msg::reply_bytes(format!("init: {}", v.into_iter().sum::()), 0).unwrap(); - } - - #[no_mangle] - extern "C" fn handle() { - let mut v = vec![0; LONG]; - for (i, item) in v.iter_mut().enumerate() { - *item = i * i; - } - } -} +mod wasm; #[cfg(test)] mod tests { diff --git a/examples/gas-burned/src/wasm.rs b/examples/gas-burned/src/wasm.rs new file mode 100644 index 00000000000..9e4fcf19f35 --- /dev/null +++ b/examples/gas-burned/src/wasm.rs @@ -0,0 +1,21 @@ +use gstd::{msg, prelude::*}; + +const SHORT: usize = 100; +const LONG: usize = 10000; + +#[no_mangle] +extern "C" fn init() { + let mut v = vec![0; SHORT]; + for (i, item) in v.iter_mut().enumerate() { + *item = i * i; + } + msg::reply_bytes(format!("init: {}", v.into_iter().sum::()), 0).unwrap(); +} + +#[no_mangle] +extern "C" fn handle() { + let mut v = vec![0; LONG]; + for (i, item) in v.iter_mut().enumerate() { + *item = i * i; + } +} diff --git a/examples/incomplete-async-payloads/Cargo.toml b/examples/incomplete-async-payloads/Cargo.toml index 10dd073012e..1c4ef56a519 100644 --- a/examples/incomplete-async-payloads/Cargo.toml +++ b/examples/incomplete-async-payloads/Cargo.toml @@ -4,11 +4,12 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/incomplete-async-payloads/src/lib.rs b/examples/incomplete-async-payloads/src/lib.rs index eb8cc63eb20..4e40051df18 100644 --- a/examples/incomplete-async-payloads/src/lib.rs +++ b/examples/incomplete-async-payloads/src/lib.rs @@ -37,60 +37,4 @@ pub enum Command { } #[cfg(not(feature = "std"))] -mod wasm { - use crate::Command; - use gstd::{ - msg::{self, MessageHandle}, - prelude::*, - ActorId, - }; - - static mut DESTINATION: ActorId = ActorId::zero(); - - #[no_mangle] - extern "C" fn init() { - let destination = msg::load().expect("Failed to load destination"); - unsafe { DESTINATION = destination }; - } - - async fn ping() { - msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) - .expect("Failed to send message") - .await - .expect("Received error reply"); - } - - #[gstd::async_main] - async fn main() { - let command = msg::load().expect("Failed to load command"); - - match command { - Command::HandleStore => { - let handle = MessageHandle::init().expect("Failed to init message"); - handle.push(b"STORED ").expect("Failed to push payload"); - ping().await; - handle.push("COMMON").expect("Failed to push payload"); - handle - .commit(msg::source(), 0) - .expect("Failed to commit message"); - } - Command::ReplyStore => { - msg::reply_push(b"STORED ").expect("Failed to push reply payload"); - ping().await; - msg::reply_push(b"REPLY").expect("Failed to push reply payload"); - msg::reply_commit(0).expect("Failed to commit reply"); - } - Command::Handle => { - let handle = MessageHandle::init().expect("Failed to init message"); - handle.push(b"OK PING").expect("Failed to push payload"); - handle - .commit(msg::source(), 0) - .expect("Failed to commit message"); - } - Command::Reply => { - msg::reply_push(b"OK REPLY").expect("Failed to push reply payload"); - msg::reply_commit(0).expect("Failed to commit reply"); - } - } - } -} +mod wasm; diff --git a/examples/incomplete-async-payloads/src/wasm.rs b/examples/incomplete-async-payloads/src/wasm.rs new file mode 100644 index 00000000000..987f22ff05d --- /dev/null +++ b/examples/incomplete-async-payloads/src/wasm.rs @@ -0,0 +1,73 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::Command; +use gstd::{ + msg::{self, MessageHandle}, + prelude::*, + ActorId, +}; + +static mut DESTINATION: ActorId = ActorId::zero(); + +#[no_mangle] +extern "C" fn init() { + let destination = msg::load().expect("Failed to load destination"); + unsafe { DESTINATION = destination }; +} + +async fn ping() { + msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) + .expect("Failed to send message") + .await + .expect("Received error reply"); +} + +#[gstd::async_main] +async fn main() { + let command = msg::load().expect("Failed to load command"); + + match command { + Command::HandleStore => { + let handle = MessageHandle::init().expect("Failed to init message"); + handle.push(b"STORED ").expect("Failed to push payload"); + ping().await; + handle.push("COMMON").expect("Failed to push payload"); + handle + .commit(msg::source(), 0) + .expect("Failed to commit message"); + } + Command::ReplyStore => { + msg::reply_push(b"STORED ").expect("Failed to push reply payload"); + ping().await; + msg::reply_push(b"REPLY").expect("Failed to push reply payload"); + msg::reply_commit(0).expect("Failed to commit reply"); + } + Command::Handle => { + let handle = MessageHandle::init().expect("Failed to init message"); + handle.push(b"OK PING").expect("Failed to push payload"); + handle + .commit(msg::source(), 0) + .expect("Failed to commit message"); + } + Command::Reply => { + msg::reply_push(b"OK REPLY").expect("Failed to push reply payload"); + msg::reply_commit(0).expect("Failed to commit reply"); + } + } +} diff --git a/examples/init-fail-sender/Cargo.toml b/examples/init-fail-sender/Cargo.toml index 7406dd2fd2d..34611c8f1fb 100644 --- a/examples/init-fail-sender/Cargo.toml +++ b/examples/init-fail-sender/Cargo.toml @@ -2,9 +2,10 @@ name = "demo-init-fail-sender" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true @@ -12,8 +13,6 @@ gstd.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = [] diff --git a/examples/init-fail-sender/src/lib.rs b/examples/init-fail-sender/src/lib.rs index 81a7e8ec5a3..a9c048cd09d 100644 --- a/examples/init-fail-sender/src/lib.rs +++ b/examples/init-fail-sender/src/lib.rs @@ -17,20 +17,4 @@ pub fn reply_duration() -> u32 { } #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{msg, ActorId}; - - #[gstd::async_init] - async fn init() { - let value_receiver: ActorId = msg::load().unwrap(); - - msg::send_bytes_with_gas(value_receiver, [], 50_000, 1_000).unwrap(); - msg::send_bytes_with_gas_for_reply(msg::source(), [], 30_000, 0, 0) - .unwrap() - .exactly(Some(super::reply_duration())) - .unwrap() - .await - .expect("Failed to send message"); - panic!(); - } -} +mod wasm; diff --git a/examples/init-fail-sender/src/wasm.rs b/examples/init-fail-sender/src/wasm.rs new file mode 100644 index 00000000000..4bca976c3bb --- /dev/null +++ b/examples/init-fail-sender/src/wasm.rs @@ -0,0 +1,15 @@ +use gstd::{msg, ActorId}; + +#[gstd::async_init] +async fn init() { + let value_receiver: ActorId = msg::load().unwrap(); + + msg::send_bytes_with_gas(value_receiver, [], 50_000, 1_000).unwrap(); + msg::send_bytes_with_gas_for_reply(msg::source(), [], 30_000, 0, 0) + .unwrap() + .exactly(Some(super::reply_duration())) + .unwrap() + .await + .expect("Failed to send message"); + panic!(); +} diff --git a/examples/init-wait-reply-exit/Cargo.toml b/examples/init-wait-reply-exit/Cargo.toml index 52f98b3149b..71b6321fe47 100644 --- a/examples/init-wait-reply-exit/Cargo.toml +++ b/examples/init-wait-reply-exit/Cargo.toml @@ -2,9 +2,10 @@ name = "demo-init-wait-reply-exit" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true @@ -12,8 +13,6 @@ gstd.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = [] diff --git a/examples/init-wait-reply-exit/src/lib.rs b/examples/init-wait-reply-exit/src/lib.rs index e5e4ef17484..813a4f3ed30 100644 --- a/examples/init-wait-reply-exit/src/lib.rs +++ b/examples/init-wait-reply-exit/src/lib.rs @@ -9,6 +9,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - include! {"./code.rs"} -} +mod wasm; diff --git a/examples/init-wait-reply-exit/src/code.rs b/examples/init-wait-reply-exit/src/wasm.rs similarity index 100% rename from examples/init-wait-reply-exit/src/code.rs rename to examples/init-wait-reply-exit/src/wasm.rs diff --git a/examples/init-wait/Cargo.toml b/examples/init-wait/Cargo.toml index 5a7c643798f..de95cd060ee 100644 --- a/examples/init-wait/Cargo.toml +++ b/examples/init-wait/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/init-wait/src/lib.rs b/examples/init-wait/src/lib.rs index a4fc7ea8b42..6099c100244 100644 --- a/examples/init-wait/src/lib.rs +++ b/examples/init-wait/src/lib.rs @@ -27,6 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "wasm-wrapper"))] -mod wasm { - include! {"./code.rs"} -} +mod wasm; diff --git a/examples/init-wait/src/code.rs b/examples/init-wait/src/wasm.rs similarity index 97% rename from examples/init-wait/src/code.rs rename to examples/init-wait/src/wasm.rs index c6ef0bc9edc..7d3ecdc3f0b 100644 --- a/examples/init-wait/src/code.rs +++ b/examples/init-wait/src/wasm.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use gstd::{exec, msg, collections::BTreeMap, MessageId}; +use gstd::{collections::BTreeMap, exec, msg, MessageId}; #[derive(PartialEq, Debug)] enum State { diff --git a/examples/messager/Cargo.toml b/examples/messager/Cargo.toml index cc570e340ab..884b045bec8 100644 --- a/examples/messager/Cargo.toml +++ b/examples/messager/Cargo.toml @@ -2,9 +2,8 @@ name = "demo-messager" version = "0.1.0" authors.workspace = true -license = "GPL-3.0" +license.workspace = true edition.workspace = true -workspace = "../../" [dependencies] gstd.workspace = true diff --git a/examples/messager/src/lib.rs b/examples/messager/src/lib.rs index 3616ca8a492..fd16790cf82 100644 --- a/examples/messager/src/lib.rs +++ b/examples/messager/src/lib.rs @@ -27,9 +27,7 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - include! {"./code.rs"} -} +mod wasm; pub const SEND_REPLY: &[u8] = b"send"; pub const REPLY_REPLY: &[u8] = b"reply"; diff --git a/examples/messager/src/code.rs b/examples/messager/src/wasm.rs similarity index 100% rename from examples/messager/src/code.rs rename to examples/messager/src/wasm.rs diff --git a/examples/mul-by-const/Cargo.toml b/examples/mul-by-const/Cargo.toml index adbd0248877..64e2f97f889 100644 --- a/examples/mul-by-const/Cargo.toml +++ b/examples/mul-by-const/Cargo.toml @@ -2,19 +2,18 @@ name = "demo-mul-by-const" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -hex = { version = "0.4.3", default-features = false, features = ["alloc"] } +hex.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = [] diff --git a/examples/mul-by-const/src/lib.rs b/examples/mul-by-const/src/lib.rs index 0076d711649..cc2e84c6fc0 100644 --- a/examples/mul-by-const/src/lib.rs +++ b/examples/mul-by-const/src/lib.rs @@ -34,60 +34,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - extern crate alloc; - - use gstd::{debug, exec, msg, String}; - - static mut DEBUG: DebugInfo = DebugInfo { me: String::new() }; - static mut STATE: State = State { intrinsic: 0 }; - - struct DebugInfo { - me: String, - } - - struct State { - intrinsic: u64, - } - - impl State { - fn new(value: u64) -> Self { - Self { intrinsic: value } - } - - unsafe fn unchecked_mul(&mut self, other: u64) -> u64 { - let z: u64 = self - .intrinsic - .checked_mul(other) - .expect("Multiplication overflow"); - debug!( - "[0x{} mul_by_const::unchecked_mul] Calculated {} x {other} == {z}", - DEBUG.me, self.intrinsic - ); - z - } - } - - #[no_mangle] - extern "C" fn handle() { - let x: u64 = msg::load().expect("Expecting a u64 number"); - - msg::reply(unsafe { STATE.unchecked_mul(x) }, 0).unwrap(); - } - - #[no_mangle] - extern "C" fn init() { - let val: u64 = msg::load().expect("Expecting a u64 number"); - unsafe { - STATE = State::new(val); - DEBUG = DebugInfo { - me: hex::encode(exec::program_id()), - }; - } - msg::reply_bytes([], 0).unwrap(); - debug!( - "[0x{} mul_by_const::init] Program initialized with input {val}", - unsafe { &DEBUG.me }, - ); - } -} +mod wasm; diff --git a/examples/mul-by-const/src/wasm.rs b/examples/mul-by-const/src/wasm.rs new file mode 100644 index 00000000000..15dfeb404c8 --- /dev/null +++ b/examples/mul-by-const/src/wasm.rs @@ -0,0 +1,80 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// This contract recursively composes itself with another contract (the other contract +// being applied to the input data first): `c(f) = (c(f) . f) x`. +// Every call to the auto_composer contract increments the internal `ITER` counter. +// As soon as the counter reaches the `MAX_ITER`, the recursion stops. +// Effectively, this procedure executes a composition of `MAX_ITER` contracts `f` +// where the output of the previous call is fed to the input of the next call. + +extern crate alloc; + +use gstd::{debug, exec, msg, String}; + +static mut DEBUG: DebugInfo = DebugInfo { me: String::new() }; +static mut STATE: State = State { intrinsic: 0 }; + +struct DebugInfo { + me: String, +} + +struct State { + intrinsic: u64, +} + +impl State { + fn new(value: u64) -> Self { + Self { intrinsic: value } + } + + unsafe fn unchecked_mul(&mut self, other: u64) -> u64 { + let z: u64 = self + .intrinsic + .checked_mul(other) + .expect("Multiplication overflow"); + debug!( + "[0x{} mul_by_const::unchecked_mul] Calculated {} x {other} == {z}", + DEBUG.me, self.intrinsic + ); + z + } +} + +#[no_mangle] +extern "C" fn handle() { + let x: u64 = msg::load().expect("Expecting a u64 number"); + + msg::reply(unsafe { STATE.unchecked_mul(x) }, 0).unwrap(); +} + +#[no_mangle] +extern "C" fn init() { + let val: u64 = msg::load().expect("Expecting a u64 number"); + unsafe { + STATE = State::new(val); + DEBUG = DebugInfo { + me: hex::encode(exec::program_id()), + }; + } + msg::reply_bytes([], 0).unwrap(); + debug!( + "[0x{} mul_by_const::init] Program initialized with input {val}", + unsafe { &DEBUG.me }, + ); +} diff --git a/examples/ncompose/Cargo.toml b/examples/ncompose/Cargo.toml index c5ae98c9182..9cb597e461a 100644 --- a/examples/ncompose/Cargo.toml +++ b/examples/ncompose/Cargo.toml @@ -2,19 +2,18 @@ name = "demo-ncompose" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -hex = { version = "0.4.3", default-features = false, features = ["alloc"] } +hex.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = [] diff --git a/examples/ncompose/src/lib.rs b/examples/ncompose/src/lib.rs index 5aa2d603784..cc2e84c6fc0 100644 --- a/examples/ncompose/src/lib.rs +++ b/examples/ncompose/src/lib.rs @@ -34,134 +34,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - extern crate alloc; - - use gstd::{debug, exec, msg, prelude::*, ActorId}; - - static mut STATE: State = State { - iter: 0, - max_iter: 0, - me: Program { - handle: ActorId::new([0u8; 32]), - }, - other: Program { - handle: ActorId::new([0u8; 32]), - }, - }; - - struct State { - iter: u16, - max_iter: u16, - me: Program, - other: Program, - } - - impl State { - fn new(max_iter: u16, actor: impl Into) -> Self { - Self { - iter: 0, - max_iter, - me: Program::new(exec::program_id()), - other: Program::new(actor), - } - } - - fn inc(&mut self) { - self.iter += 1; - } - - async fn compose_with_self(&mut self, input: Vec) -> Result, &'static str> { - if self.iter >= self.max_iter { - debug!( - "[0x{} ncompose::compose_with_self] Max number of iterations {} reached; no further progress is possible", - hex::encode(self.me.handle), - self.max_iter - ); - return Err("Max iteration reached"); - } - // Increase iter - self.inc(); - - debug!( - "[ncompose::compose_with_self] Iter: {} out of {}", - self.iter, self.max_iter - ); - - // Pass the input to the `other` contract first - debug!( - "[0x{} ncompose::compose_with_self] Calling contract 0x{}", - hex::encode(self.me.handle), - hex::encode(self.other.handle) - ); - let output_other = self.other.call(input).await?; - debug!( - "[0x{} ncompose::compose_with_self] Calling self", - hex::encode(exec::program_id()) - ); - let output = self.me.call(output_other).await?; - debug!( - "[0x{} ncompose::compose_with_self] Composition output: {output:?}", - hex::encode(exec::program_id()), - ); - - Ok(output) - } - } - - #[derive(Eq, Ord, PartialEq, PartialOrd)] - struct Program { - handle: ActorId, - } - - impl Program { - fn new(handle: impl Into) -> Self { - Self { - handle: handle.into(), - } - } - - async fn call(&self, input: Vec) -> Result, &'static str> { - let reply_bytes = msg::send_bytes_for_reply(self.handle, &input[..], 0, 0) - .expect("Error sending message") - .await - .map_err(|_| "Error in async message processing")?; - debug!( - "[0x{} ncompose::Program::call] Received reply from remote contract: {:?}", - hex::encode(exec::program_id()), - hex::encode(&reply_bytes) - ); - - Ok(reply_bytes) - } - } - - #[gstd::async_main] - async fn main() { - let input = msg::load_bytes().expect("Failed to load payload bytes"); - debug!( - "[0x{} ncompose::handle] input = {input:?}", - hex::encode(unsafe { STATE.me.handle }), - ); - - if let Ok(outcome) = (unsafe { STATE.compose_with_self(input) }).await { - debug!( - "[0x{} ncompose::handle] Composition output: {outcome:?}", - hex::encode(exec::program_id()), - ); - msg::reply(outcome, 0).unwrap(); - } - } - - #[no_mangle] - extern "C" fn init() { - let (actor, max_iter): (ActorId, u16) = - msg::load().expect("Malformed input: expecting a program ID and a number"); - unsafe { STATE = State::new(max_iter, actor) }; - msg::reply_bytes([], 0).unwrap(); - debug!( - "[0x{} ncompose::init] Program initialized", - hex::encode(exec::program_id()) - ); - } -} +mod wasm; diff --git a/examples/ncompose/src/wasm.rs b/examples/ncompose/src/wasm.rs new file mode 100644 index 00000000000..1b4c1276c5e --- /dev/null +++ b/examples/ncompose/src/wasm.rs @@ -0,0 +1,154 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// This contract recursively composes itself with another contract (the other contract +// being applied to the input data first): `c(f) = (c(f) . f) x`. +// Every call to the auto_composer contract increments the internal `ITER` counter. +// As soon as the counter reaches the `MAX_ITER`, the recursion stops. +// Effectively, this procedure executes a composition of `MAX_ITER` contracts `f` +// where the output of the previous call is fed to the input of the next call. + +extern crate alloc; + +use gstd::{debug, exec, msg, prelude::*, ActorId}; + +static mut STATE: State = State { + iter: 0, + max_iter: 0, + me: Program { + handle: ActorId::new([0u8; 32]), + }, + other: Program { + handle: ActorId::new([0u8; 32]), + }, +}; + +struct State { + iter: u16, + max_iter: u16, + me: Program, + other: Program, +} + +impl State { + fn new(max_iter: u16, actor: impl Into) -> Self { + Self { + iter: 0, + max_iter, + me: Program::new(exec::program_id()), + other: Program::new(actor), + } + } + + fn inc(&mut self) { + self.iter += 1; + } + + async fn compose_with_self(&mut self, input: Vec) -> Result, &'static str> { + if self.iter >= self.max_iter { + debug!( + "[0x{} ncompose::compose_with_self] Max number of iterations {} reached; no further progress is possible", + hex::encode(self.me.handle), + self.max_iter + ); + return Err("Max iteration reached"); + } + // Increase iter + self.inc(); + + debug!( + "[ncompose::compose_with_self] Iter: {} out of {}", + self.iter, self.max_iter + ); + + // Pass the input to the `other` contract first + debug!( + "[0x{} ncompose::compose_with_self] Calling contract 0x{}", + hex::encode(self.me.handle), + hex::encode(self.other.handle) + ); + let output_other = self.other.call(input).await?; + debug!( + "[0x{} ncompose::compose_with_self] Calling self", + hex::encode(exec::program_id()) + ); + let output = self.me.call(output_other).await?; + debug!( + "[0x{} ncompose::compose_with_self] Composition output: {output:?}", + hex::encode(exec::program_id()), + ); + + Ok(output) + } +} + +#[derive(Eq, Ord, PartialEq, PartialOrd)] +struct Program { + handle: ActorId, +} + +impl Program { + fn new(handle: impl Into) -> Self { + Self { + handle: handle.into(), + } + } + + async fn call(&self, input: Vec) -> Result, &'static str> { + let reply_bytes = msg::send_bytes_for_reply(self.handle, &input[..], 0, 0) + .expect("Error sending message") + .await + .map_err(|_| "Error in async message processing")?; + debug!( + "[0x{} ncompose::Program::call] Received reply from remote contract: {:?}", + hex::encode(exec::program_id()), + hex::encode(&reply_bytes) + ); + + Ok(reply_bytes) + } +} + +#[gstd::async_main] +async fn main() { + let input = msg::load_bytes().expect("Failed to load payload bytes"); + debug!( + "[0x{} ncompose::handle] input = {input:?}", + hex::encode(unsafe { STATE.me.handle }), + ); + + if let Ok(outcome) = (unsafe { STATE.compose_with_self(input) }).await { + debug!( + "[0x{} ncompose::handle] Composition output: {outcome:?}", + hex::encode(exec::program_id()), + ); + msg::reply(outcome, 0).unwrap(); + } +} + +#[no_mangle] +extern "C" fn init() { + let (actor, max_iter): (ActorId, u16) = + msg::load().expect("Malformed input: expecting a program ID and a number"); + unsafe { STATE = State::new(max_iter, actor) }; + msg::reply_bytes([], 0).unwrap(); + debug!( + "[0x{} ncompose::init] Program initialized", + hex::encode(exec::program_id()) + ); +} diff --git a/examples/new-meta/Cargo.toml b/examples/new-meta/Cargo.toml index fb1bb189f7c..f78115c3251 100644 --- a/examples/new-meta/Cargo.toml +++ b/examples/new-meta/Cargo.toml @@ -2,17 +2,18 @@ name = "demo-new-meta" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] +gstd.workspace = true parity-scale-codec.workspace = true demo-meta-io = { path = "io" } demo-meta-state-v1 = { path = "state-v1", default-features = false, optional = true } demo-meta-state-v2 = { path = "state-v2", default-features = false, optional = true } demo-meta-state-v3 = { path = "state-v3", default-features = false, optional = true } -gstd.workspace = true [build-dependencies] demo-meta-io = { path = "io" } diff --git a/examples/new-meta/io/Cargo.toml b/examples/new-meta/io/Cargo.toml index 071bf9c8993..6bd4fedeaed 100644 --- a/examples/new-meta/io/Cargo.toml +++ b/examples/new-meta/io/Cargo.toml @@ -4,9 +4,10 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../../" +homepage.workspace = true +repository.workspace = true [dependencies] -gmeta = { workspace = true } -scale-info = { workspace = true, features = ["derive"] } -parity-scale-codec = { workspace = true, features = ["derive"] } +gmeta.workspace = true +scale-info.workspace = true +parity-scale-codec.workspace = true diff --git a/examples/new-meta/state-v1/Cargo.toml b/examples/new-meta/state-v1/Cargo.toml index 901bd45dde5..df273f240cf 100644 --- a/examples/new-meta/state-v1/Cargo.toml +++ b/examples/new-meta/state-v1/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/new-meta/state-v2/Cargo.toml b/examples/new-meta/state-v2/Cargo.toml index b5c0becefb6..b63c6aec983 100644 --- a/examples/new-meta/state-v2/Cargo.toml +++ b/examples/new-meta/state-v2/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/new-meta/state-v3/Cargo.toml b/examples/new-meta/state-v3/Cargo.toml index 379155bff3f..7724c477251 100644 --- a/examples/new-meta/state-v3/Cargo.toml +++ b/examples/new-meta/state-v3/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/node/Cargo.toml b/examples/node/Cargo.toml index 097453824e4..d0e5078b4f4 100644 --- a/examples/node/Cargo.toml +++ b/examples/node/Cargo.toml @@ -2,13 +2,14 @@ name = "demo-node" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true @@ -17,8 +18,6 @@ gear-wasm-builder.workspace = true gstd = { workspace = true, features = ["debug"] } gtest.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std"] diff --git a/examples/node/src/lib.rs b/examples/node/src/lib.rs index ee8ff58f89e..1b64af59594 100644 --- a/examples/node/src/lib.rs +++ b/examples/node/src/lib.rs @@ -20,8 +20,7 @@ extern crate alloc; -use alloc::collections::BTreeSet; -use gstd::{debug, exec, msg, prelude::*, ActorId, MessageId}; +use gstd::ActorId; use parity_scale_codec::{Decode, Encode}; #[cfg(feature = "std")] @@ -56,233 +55,8 @@ pub enum Reply { Failure, } -enum TransitionState { - Ready, - NotReady, - Failed, -} - -struct Transition { - #[allow(dead_code)] - to_status: u32, - origin: ActorId, - query_list: Vec, - message_id: MessageId, - last_sent_message_id: MessageId, - query_index: usize, - state: TransitionState, -} - -struct NodeState { - #[allow(dead_code)] - status: u32, - sub_nodes: BTreeSet, - transition: Option, -} - -static mut STATE: Option = None; - -#[no_mangle] -extern "C" fn handle() { - let reply = match msg::load() { - Ok(request) => process(request), - Err(e) => { - debug!("Error processing request: {e:?}"); - Reply::Failure - } - }; - - msg::reply(reply, 0).unwrap(); -} - -fn state() -> &'static mut NodeState { - unsafe { STATE.as_mut().unwrap() } -} - -fn process(request: Request) -> Reply { - if let Some(mut transition) = state().transition.take() { - if transition.message_id == msg::id() { - // one of the answers has set failed state - if let TransitionState::Failed = transition.state { - return Reply::Failure; - } - - // this means that we received replies from all subnodes - if transition.query_index == transition.query_list.len() { - match transition.state { - TransitionState::NotReady => { - transition.state = TransitionState::Ready; - - debug!("Returning final ready signal"); - - // this is ready to further process with committing - state().transition = Some(transition); - return Reply::Success; - } - TransitionState::Ready => { - // this means we successfully committed and we can - // drop the transition returning success - debug!("Returning final commit signal"); - - return Reply::Success; - } - _ => { - // this is some invalid state already - return Reply::Failure; - } - } - } - - // this means we need to send another sub-node query - let next_sub_node = transition - .query_list - .get(transition.query_index) - .expect("Checked above that it has that number of elements; qed"); - - transition.last_sent_message_id = msg::send(*next_sub_node, request, 0).unwrap(); - - state().transition = Some(transition); - - exec::wait(); - } else { - // this is just a new message that should be processed normally, without continuation. - state().transition = Some(transition); - } - } - - match request { - Request::IsReady => { - if state().transition.is_none() { - Reply::Yes - } else { - Reply::No - } - } - Request::Begin(Operation { to_status }) => { - if state().transition.is_some() { - Reply::Failure - } else { - let mut transition = Transition { - to_status, - origin: msg::source(), - query_index: 0, - query_list: vec![], - state: TransitionState::NotReady, - message_id: msg::id(), - last_sent_message_id: MessageId::default(), - }; - - debug!("Transition started"); - - if !state().sub_nodes.is_empty() { - debug!("Transition started is complex"); - - transition.query_list = state().sub_nodes.iter().cloned().collect(); - let first_sub_node = *transition - .query_list - .get(0) - .expect("Checked above that sub_nodes is not empty; qed"); - transition.last_sent_message_id = - msg::send(first_sub_node, request, 0).unwrap(); - state().transition = Some(transition); - exec::wait() - } else { - transition.state = TransitionState::Ready; - state().transition = Some(transition); - Reply::Success - } - } - } - Request::Commit => { - if state().sub_nodes.is_empty() { - let (transition, reply) = match state().transition.take() { - Some(transition) => { - if transition.origin != msg::source() { - (Some(transition), Reply::Failure) - } else { - (None, Reply::Success) - } - } - None => (None, Reply::Failure), - }; - - state().transition = transition; - - reply - } else if let Some(mut transition) = state().transition.take() { - if let TransitionState::Ready = transition.state { - let first_sub_node = *transition - .query_list - .get(0) - .expect("Checked above that sub_nodes is not empty; qed"); - - transition.query_index = 0; - - transition.message_id = msg::id(); - - transition.last_sent_message_id = - msg::send(first_sub_node, request, 0).unwrap(); - - state().transition = Some(transition); - - exec::wait() - } else { - debug!("Returning failure because current state is not READY"); - Reply::Failure - } - } else { - debug!("Returning failure because there is no transition in process"); - Reply::Failure - } - } - Request::Add(sub_node) => { - state().sub_nodes.insert(sub_node); - Reply::Success - } - } -} - -#[no_mangle] -extern "C" fn handle_reply() { - if let Some(ref mut transition) = state().transition { - if msg::reply_to().unwrap() != transition.last_sent_message_id { - return; - } - - match msg::load() { - Ok(reply) => { - transition.query_index += 1; - if let Reply::Success = reply { - } else { - transition.state = TransitionState::Failed; - } - exec::wake(transition.message_id).unwrap(); - } - Err(e) => { - transition.state = TransitionState::Failed; - debug!("Error processing reply: {e:?}"); - exec::wake(transition.message_id).unwrap(); - } - } - } else { - debug!("Got some reply that can not be processed"); - } -} - -#[no_mangle] -extern "C" fn init() { - let init: Initialization = msg::load().expect("Failed to decode init"); - - unsafe { - STATE = Some(NodeState { - status: init.status, - sub_nodes: BTreeSet::default(), - transition: None, - }); - } - - msg::reply((), 0).unwrap(); -} +#[cfg(not(feature = "std"))] +mod wasm; #[cfg(test)] mod tests { diff --git a/examples/node/src/wasm.rs b/examples/node/src/wasm.rs new file mode 100644 index 00000000000..83c9acefa07 --- /dev/null +++ b/examples/node/src/wasm.rs @@ -0,0 +1,248 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{Initialization, Operation, Reply, Request}; +use gstd::{collections::BTreeSet, debug, exec, msg, prelude::*, ActorId, MessageId}; + +static mut STATE: Option = None; + +enum TransitionState { + Ready, + NotReady, + Failed, +} + +struct Transition { + #[allow(dead_code)] + to_status: u32, + origin: ActorId, + query_list: Vec, + message_id: MessageId, + last_sent_message_id: MessageId, + query_index: usize, + state: TransitionState, +} + +struct NodeState { + #[allow(dead_code)] + status: u32, + sub_nodes: BTreeSet, + transition: Option, +} + +#[no_mangle] +extern "C" fn handle() { + let reply = match msg::load() { + Ok(request) => process(request), + Err(e) => { + debug!("Error processing request: {e:?}"); + Reply::Failure + } + }; + + msg::reply(reply, 0).unwrap(); +} + +fn state() -> &'static mut NodeState { + unsafe { STATE.as_mut().unwrap() } +} + +fn process(request: Request) -> Reply { + if let Some(mut transition) = state().transition.take() { + if transition.message_id == msg::id() { + // one of the answers has set failed state + if let TransitionState::Failed = transition.state { + return Reply::Failure; + } + + // this means that we received replies from all subnodes + if transition.query_index == transition.query_list.len() { + match transition.state { + TransitionState::NotReady => { + transition.state = TransitionState::Ready; + + debug!("Returning final ready signal"); + + // this is ready to further process with committing + state().transition = Some(transition); + return Reply::Success; + } + TransitionState::Ready => { + // this means we successfully committed and we can + // drop the transition returning success + debug!("Returning final commit signal"); + + return Reply::Success; + } + _ => { + // this is some invalid state already + return Reply::Failure; + } + } + } + + // this means we need to send another sub-node query + let next_sub_node = transition + .query_list + .get(transition.query_index) + .expect("Checked above that it has that number of elements; qed"); + + transition.last_sent_message_id = msg::send(*next_sub_node, request, 0).unwrap(); + + state().transition = Some(transition); + + exec::wait(); + } else { + // this is just a new message that should be processed normally, without continuation. + state().transition = Some(transition); + } + } + + match request { + Request::IsReady => { + if state().transition.is_none() { + Reply::Yes + } else { + Reply::No + } + } + Request::Begin(Operation { to_status }) => { + if state().transition.is_some() { + Reply::Failure + } else { + let mut transition = Transition { + to_status, + origin: msg::source(), + query_index: 0, + query_list: vec![], + state: TransitionState::NotReady, + message_id: msg::id(), + last_sent_message_id: MessageId::default(), + }; + + debug!("Transition started"); + + if !state().sub_nodes.is_empty() { + debug!("Transition started is complex"); + + transition.query_list = state().sub_nodes.iter().cloned().collect(); + let first_sub_node = *transition + .query_list + .get(0) + .expect("Checked above that sub_nodes is not empty; qed"); + transition.last_sent_message_id = + msg::send(first_sub_node, request, 0).unwrap(); + state().transition = Some(transition); + exec::wait() + } else { + transition.state = TransitionState::Ready; + state().transition = Some(transition); + Reply::Success + } + } + } + Request::Commit => { + if state().sub_nodes.is_empty() { + let (transition, reply) = match state().transition.take() { + Some(transition) => { + if transition.origin != msg::source() { + (Some(transition), Reply::Failure) + } else { + (None, Reply::Success) + } + } + None => (None, Reply::Failure), + }; + + state().transition = transition; + + reply + } else if let Some(mut transition) = state().transition.take() { + if let TransitionState::Ready = transition.state { + let first_sub_node = *transition + .query_list + .get(0) + .expect("Checked above that sub_nodes is not empty; qed"); + + transition.query_index = 0; + + transition.message_id = msg::id(); + + transition.last_sent_message_id = + msg::send(first_sub_node, request, 0).unwrap(); + + state().transition = Some(transition); + + exec::wait() + } else { + debug!("Returning failure because current state is not READY"); + Reply::Failure + } + } else { + debug!("Returning failure because there is no transition in process"); + Reply::Failure + } + } + Request::Add(sub_node) => { + state().sub_nodes.insert(sub_node); + Reply::Success + } + } +} + +#[no_mangle] +extern "C" fn handle_reply() { + if let Some(ref mut transition) = state().transition { + if msg::reply_to().unwrap() != transition.last_sent_message_id { + return; + } + + match msg::load() { + Ok(reply) => { + transition.query_index += 1; + if let Reply::Success = reply { + } else { + transition.state = TransitionState::Failed; + } + exec::wake(transition.message_id).unwrap(); + } + Err(e) => { + transition.state = TransitionState::Failed; + debug!("Error processing reply: {e:?}"); + exec::wake(transition.message_id).unwrap(); + } + } + } else { + debug!("Got some reply that can not be processed"); + } +} + +#[no_mangle] +extern "C" fn init() { + let init: Initialization = msg::load().expect("Failed to decode init"); + + unsafe { + STATE = Some(NodeState { + status: init.status, + sub_nodes: BTreeSet::default(), + transition: None, + }); + } + + msg::reply((), 0).unwrap(); +} diff --git a/examples/out-of-memory/Cargo.toml b/examples/out-of-memory/Cargo.toml index ac2f3feaa37..3b039d61913 100644 --- a/examples/out-of-memory/Cargo.toml +++ b/examples/out-of-memory/Cargo.toml @@ -2,9 +2,10 @@ name = "demo-out-of-memory" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/out-of-memory/src/lib.rs b/examples/out-of-memory/src/lib.rs index ca12845c8fc..b64f1e21f2f 100644 --- a/examples/out-of-memory/src/lib.rs +++ b/examples/out-of-memory/src/lib.rs @@ -29,16 +29,5 @@ mod code { #[cfg(feature = "std")] pub use code::WASM_BINARY_OPT as WASM_BINARY; -#[cfg(target_arch = "wasm32")] -mod wasm { - use alloc::alloc::Layout; - - #[no_mangle] - extern "C" fn init() { - unsafe { - // Force rustc not to remove memory import - *(10usize as *mut u8) = 10; - } - alloc::alloc::handle_alloc_error(Layout::new::<[u8; 64 * 1024]>()); - } -} +#[cfg(not(feature = "std"))] +mod wasm; diff --git a/examples/out-of-memory/src/wasm.rs b/examples/out-of-memory/src/wasm.rs new file mode 100644 index 00000000000..6ac5382b67a --- /dev/null +++ b/examples/out-of-memory/src/wasm.rs @@ -0,0 +1,28 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use alloc::alloc::Layout; + +#[no_mangle] +extern "C" fn init() { + unsafe { + // Force rustc not to remove memory import + *(10usize as *mut u8) = 10; + } + alloc::alloc::handle_alloc_error(Layout::new::<[u8; 64 * 1024]>()); +} diff --git a/examples/piggy-bank/Cargo.toml b/examples/piggy-bank/Cargo.toml index 77e2791deae..12e17ebc57b 100644 --- a/examples/piggy-bank/Cargo.toml +++ b/examples/piggy-bank/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/piggy-bank/src/lib.rs b/examples/piggy-bank/src/lib.rs index 4ddfa5a7498..fbc08d47a0b 100644 --- a/examples/piggy-bank/src/lib.rs +++ b/examples/piggy-bank/src/lib.rs @@ -27,20 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{debug, exec, msg}; - - #[no_mangle] - extern "C" fn handle() { - msg::with_read_on_stack(|msg| { - let available_value = exec::value_available(); - let value = msg::value(); - debug!("inserted: {value}, total: {available_value}"); - - if msg.expect("Failed to load payload bytes") == b"smash" { - debug!("smashing, total: {available_value}"); - msg::reply_bytes(b"send", available_value).unwrap(); - } - }); - } -} +mod wasm; diff --git a/examples/piggy-bank/src/wasm.rs b/examples/piggy-bank/src/wasm.rs new file mode 100644 index 00000000000..cc8ea523c1c --- /dev/null +++ b/examples/piggy-bank/src/wasm.rs @@ -0,0 +1,33 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{debug, exec, msg}; + +#[no_mangle] +extern "C" fn handle() { + msg::with_read_on_stack(|msg| { + let available_value = exec::value_available(); + let value = msg::value(); + debug!("inserted: {value}, total: {available_value}"); + + if msg.expect("Failed to load payload bytes") == b"smash" { + debug!("smashing, total: {available_value}"); + msg::reply_bytes(b"send", available_value).unwrap(); + } + }); +} diff --git a/examples/ping/Cargo.toml b/examples/ping/Cargo.toml index fa79445e23f..50dd1ce8605 100644 --- a/examples/ping/Cargo.toml +++ b/examples/ping/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/ping/src/lib.rs b/examples/ping/src/lib.rs index 0c48715a6b0..fbc08d47a0b 100644 --- a/examples/ping/src/lib.rs +++ b/examples/ping/src/lib.rs @@ -27,15 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{msg, prelude::*}; - - #[no_mangle] - extern "C" fn handle() { - let payload = msg::load_bytes().expect("Failed to load payload"); - - if payload == b"PING" { - msg::reply_bytes("PONG", 0).expect("Failed to send reply"); - } - } -} +mod wasm; diff --git a/examples/ping/src/wasm.rs b/examples/ping/src/wasm.rs new file mode 100644 index 00000000000..69b988852d2 --- /dev/null +++ b/examples/ping/src/wasm.rs @@ -0,0 +1,28 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{msg, prelude::*}; + +#[no_mangle] +extern "C" fn handle() { + let payload = msg::load_bytes().expect("Failed to load payload"); + + if payload == b"PING" { + msg::reply_bytes("PONG", 0).expect("Failed to send reply"); + } +} diff --git a/examples/program-factory/Cargo.toml b/examples/program-factory/Cargo.toml index 09539fd458c..104d6b64ff3 100644 --- a/examples/program-factory/Cargo.toml +++ b/examples/program-factory/Cargo.toml @@ -2,14 +2,15 @@ name = "demo-program-factory" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true -hex-literal = "*" +parity-scale-codec.workspace = true +hex-literal.workspace = true [build-dependencies] gear-wasm-builder.workspace = true @@ -17,8 +18,6 @@ gear-wasm-builder.workspace = true [dev-dependencies] gtest.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std"] diff --git a/examples/program-factory/src/lib.rs b/examples/program-factory/src/lib.rs index 2cb14dfee0e..9a919f1cd11 100644 --- a/examples/program-factory/src/lib.rs +++ b/examples/program-factory/src/lib.rs @@ -48,60 +48,7 @@ const CHILD_CODE_HASH: [u8; 32] = hex_literal::hex!("abf3746e72a6e8740bd9e12b879fbdd59e052cb390f116454e9116c22021ae4a"); #[cfg(not(feature = "std"))] -mod wasm { - use super::{CreateProgram, CHILD_CODE_HASH}; - use gstd::{msg, prog, ActorId}; - - static mut COUNTER: i32 = 0; - static mut ORIGIN: Option = None; - - #[no_mangle] - extern "C" fn init() { - unsafe { ORIGIN = Some(msg::source()) }; - } - - #[no_mangle] - extern "C" fn handle() { - match msg::load().expect("provided invalid payload") { - CreateProgram::Default => { - let submitted_code = CHILD_CODE_HASH.into(); - let (_message_id, new_program_id) = prog::create_program_bytes_with_gas( - submitted_code, - unsafe { COUNTER.to_le_bytes() }, - [], - 10_000_000_000, - 0, - ) - .unwrap(); - msg::send_bytes(new_program_id, [], 0).unwrap(); - - unsafe { COUNTER += 1 }; - } - CreateProgram::Custom(custom_child_data) => { - for (code_hash, salt, gas_limit) in custom_child_data { - let submitted_code = code_hash.into(); - let (_message_id, new_program_id) = prog::create_program_bytes_with_gas( - submitted_code, - &salt, - [], - gas_limit, - 0, - ) - .unwrap(); - msg::send_bytes(new_program_id, [], 0).expect("Failed to send message"); - } - } - }; - } - - #[no_mangle] - extern "C" fn handle_reply() { - if !msg::reply_code().unwrap().is_success() { - let origin = unsafe { ORIGIN.unwrap() }; - msg::send_bytes(origin, [], 0).unwrap(); - } - } -} +mod wasm; #[cfg(test)] mod tests { diff --git a/examples/program-factory/src/wasm.rs b/examples/program-factory/src/wasm.rs new file mode 100644 index 00000000000..f0cd48f1db5 --- /dev/null +++ b/examples/program-factory/src/wasm.rs @@ -0,0 +1,71 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! An example of `create_program_with_gas` sys-call. +//! +//! The program is mainly used for testing the sys-call logic in pallet `gear` tests. +//! It works as a program factory: depending on input type it sends program creation +//! request (message). + +use crate::{CreateProgram, CHILD_CODE_HASH}; +use gstd::{msg, prog, ActorId}; + +static mut COUNTER: i32 = 0; +static mut ORIGIN: Option = None; + +#[no_mangle] +extern "C" fn init() { + unsafe { ORIGIN = Some(msg::source()) }; +} + +#[no_mangle] +extern "C" fn handle() { + match msg::load().expect("provided invalid payload") { + CreateProgram::Default => { + let submitted_code = CHILD_CODE_HASH.into(); + let (_message_id, new_program_id) = prog::create_program_bytes_with_gas( + submitted_code, + unsafe { COUNTER.to_le_bytes() }, + [], + 10_000_000_000, + 0, + ) + .unwrap(); + msg::send_bytes(new_program_id, [], 0).unwrap(); + + unsafe { COUNTER += 1 }; + } + CreateProgram::Custom(custom_child_data) => { + for (code_hash, salt, gas_limit) in custom_child_data { + let submitted_code = code_hash.into(); + let (_message_id, new_program_id) = + prog::create_program_bytes_with_gas(submitted_code, &salt, [], gas_limit, 0) + .unwrap(); + msg::send_bytes(new_program_id, [], 0).expect("Failed to send message"); + } + } + }; +} + +#[no_mangle] +extern "C" fn handle_reply() { + if !msg::reply_code().unwrap().is_success() { + let origin = unsafe { ORIGIN.unwrap() }; + msg::send_bytes(origin, [], 0).unwrap(); + } +} diff --git a/examples/program-generator/Cargo.toml b/examples/program-generator/Cargo.toml index d3c686e1030..9782f2a468f 100644 --- a/examples/program-generator/Cargo.toml +++ b/examples/program-generator/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/program-generator/src/lib.rs b/examples/program-generator/src/lib.rs index aaf1295970a..4333e8bd24e 100644 --- a/examples/program-generator/src/lib.rs +++ b/examples/program-generator/src/lib.rs @@ -38,33 +38,4 @@ pub const CHILD_WAT: &str = r#" "#; #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{collections::BTreeSet, prelude::*, prog::ProgramGenerator, CodeId}; - - fn check_salt_uniqueness() { - let salts: Vec<_> = (0..10).map(|_| ProgramGenerator::get_salt()).collect(); - let salts_len = salts.len(); - - // The set's length should be equal to the vector's one - // if there are no repetitive values. - let salts_set: BTreeSet<_> = salts.into_iter().collect(); - assert_eq!(salts_len, salts_set.len()); - } - - #[no_mangle] - extern "C" fn handle() { - let submitted_code: CodeId = - hex_literal::hex!("abf3746e72a6e8740bd9e12b879fbdd59e052cb390f116454e9116c22021ae4a") - .into(); - - ProgramGenerator::create_program_bytes_with_gas( - submitted_code, - b"payload", - 10_000_000_000, - 0, - ) - .unwrap(); - - check_salt_uniqueness(); - } -} +mod wasm; diff --git a/examples/program-generator/src/wasm.rs b/examples/program-generator/src/wasm.rs new file mode 100644 index 00000000000..cdf11b1a684 --- /dev/null +++ b/examples/program-generator/src/wasm.rs @@ -0,0 +1,41 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{collections::BTreeSet, prelude::*, prog::ProgramGenerator, CodeId}; + +fn check_salt_uniqueness() { + let salts: Vec<_> = (0..10).map(|_| ProgramGenerator::get_salt()).collect(); + let salts_len = salts.len(); + + // The set's length should be equal to the vector's one + // if there are no repetitive values. + let salts_set: BTreeSet<_> = salts.into_iter().collect(); + assert_eq!(salts_len, salts_set.len()); +} + +#[no_mangle] +extern "C" fn handle() { + let submitted_code: CodeId = + hex_literal::hex!("abf3746e72a6e8740bd9e12b879fbdd59e052cb390f116454e9116c22021ae4a") + .into(); + + ProgramGenerator::create_program_bytes_with_gas(submitted_code, b"payload", 10_000_000_000, 0) + .unwrap(); + + check_salt_uniqueness(); +} diff --git a/examples/proxy-relay/Cargo.toml b/examples/proxy-relay/Cargo.toml index b12547ba515..4378c75e4e3 100644 --- a/examples/proxy-relay/Cargo.toml +++ b/examples/proxy-relay/Cargo.toml @@ -2,20 +2,19 @@ name = "demo-proxy-relay" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true -scale-info = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true +scale-info.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std", "scale-info/std"] diff --git a/examples/proxy-relay/src/lib.rs b/examples/proxy-relay/src/lib.rs index 4852a5435f1..00ff90ce91d 100644 --- a/examples/proxy-relay/src/lib.rs +++ b/examples/proxy-relay/src/lib.rs @@ -49,84 +49,4 @@ pub enum RelayCall { } #[cfg(not(feature = "std"))] -mod wasm { - use super::*; - use gstd::msg::{self, MessageHandle}; - - static mut RELAY_CALL: Option = None; - - fn resend_push(resend_pushes: &[ResendPushData]) { - for data in resend_pushes { - let msg_handle = MessageHandle::init().expect("Failed to obtain new message handle"); - - let ResendPushData { - destination, - start, - end, - } = data; - - let end = end.map(|(e, flag)| (e as usize, flag)); - match start.map(|s| s as usize) { - Some(s) => match end { - None => { - msg_handle.push_input(s..).expect("Push failed"); - } - Some((e, true)) => { - msg_handle.push_input(s..=e).expect("Push failed"); - } - Some((e, _)) => { - msg_handle.push_input(s..e).expect("Push failed"); - } - }, - None => match end { - None => { - msg_handle.push_input(..).expect("Push failed"); - } - Some((e, true)) => { - msg_handle.push_input(..=e).expect("Push failed"); - } - Some((e, _)) => { - msg_handle.push_input(..e).expect("Push failed"); - } - }, - } - - msg_handle - .commit(*destination, msg::value()) - .expect("Commit failed"); - } - } - - #[no_mangle] - extern "C" fn handle() { - use RelayCall::*; - let relay_call = unsafe { RELAY_CALL.as_ref().expect("Relay call is not initialized") }; - - match relay_call { - Resend(d) => { - msg::send_input(*d, msg::value(), ..msg::size()).expect("Resend failed"); - } - ResendWithGas(d, gas) => { - msg::send_input_with_gas(*d, *gas, msg::value(), ..).expect("Resend wgas failed"); - } - ResendPush(data) => { - resend_push(data); - } - Rereply => { - msg::reply_input(msg::value(), 0..msg::size()).expect("Rereply failed"); - } - RereplyPush => { - msg::reply_push_input(0..).expect("Push failed"); - msg::reply_commit(msg::value()).expect("Commit failed"); - } - RereplyWithGas(gas) => { - msg::reply_input_with_gas(*gas, msg::value(), ..).expect("Rereply wgas failed"); - } - } - } - - #[no_mangle] - extern "C" fn init() { - unsafe { RELAY_CALL = Some(msg::load().expect("Failed to decode `RelayCall'")) }; - } -} +mod wasm; diff --git a/examples/proxy-relay/src/wasm.rs b/examples/proxy-relay/src/wasm.rs new file mode 100644 index 00000000000..8e5f1594df4 --- /dev/null +++ b/examples/proxy-relay/src/wasm.rs @@ -0,0 +1,97 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{RelayCall, ResendPushData}; +use gstd::msg::{self, MessageHandle}; + +static mut RELAY_CALL: Option = None; + +fn resend_push(resend_pushes: &[ResendPushData]) { + for data in resend_pushes { + let msg_handle = MessageHandle::init().expect("Failed to obtain new message handle"); + + let ResendPushData { + destination, + start, + end, + } = data; + + let end = end.map(|(e, flag)| (e as usize, flag)); + match start.map(|s| s as usize) { + Some(s) => match end { + None => { + msg_handle.push_input(s..).expect("Push failed"); + } + Some((e, true)) => { + msg_handle.push_input(s..=e).expect("Push failed"); + } + Some((e, _)) => { + msg_handle.push_input(s..e).expect("Push failed"); + } + }, + None => match end { + None => { + msg_handle.push_input(..).expect("Push failed"); + } + Some((e, true)) => { + msg_handle.push_input(..=e).expect("Push failed"); + } + Some((e, _)) => { + msg_handle.push_input(..e).expect("Push failed"); + } + }, + } + + msg_handle + .commit(*destination, msg::value()) + .expect("Commit failed"); + } +} + +#[no_mangle] +extern "C" fn handle() { + use RelayCall::*; + let relay_call = unsafe { RELAY_CALL.as_ref().expect("Relay call is not initialized") }; + + match relay_call { + Resend(d) => { + msg::send_input(*d, msg::value(), ..msg::size()).expect("Resend failed"); + } + ResendWithGas(d, gas) => { + msg::send_input_with_gas(*d, *gas, msg::value(), ..).expect("Resend wgas failed"); + } + ResendPush(data) => { + resend_push(data); + } + Rereply => { + msg::reply_input(msg::value(), 0..msg::size()).expect("Rereply failed"); + } + RereplyPush => { + msg::reply_push_input(0..).expect("Push failed"); + msg::reply_commit(msg::value()).expect("Commit failed"); + } + RereplyWithGas(gas) => { + msg::reply_input_with_gas(*gas, msg::value(), ..).expect("Rereply wgas failed"); + } + } +} + +#[no_mangle] +extern "C" fn init() { + unsafe { RELAY_CALL = Some(msg::load().expect("Failed to decode `RelayCall'")) }; +} diff --git a/examples/proxy-reservation-with-gas/Cargo.toml b/examples/proxy-reservation-with-gas/Cargo.toml index 4371dac5811..c8e775cdf43 100644 --- a/examples/proxy-reservation-with-gas/Cargo.toml +++ b/examples/proxy-reservation-with-gas/Cargo.toml @@ -2,20 +2,19 @@ name = "demo-proxy-reservation-with-gas" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true -scale-info = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true +scale-info.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std", "scale-info/std"] diff --git a/examples/proxy-reservation-with-gas/src/lib.rs b/examples/proxy-reservation-with-gas/src/lib.rs index 00a5c6f8a6a..427db5013d6 100644 --- a/examples/proxy-reservation-with-gas/src/lib.rs +++ b/examples/proxy-reservation-with-gas/src/lib.rs @@ -37,35 +37,4 @@ pub struct InputArgs { } #[cfg(not(feature = "std"))] -mod wasm { - use crate::InputArgs; - use gstd::{msg, ActorId, ReservationId}; - - static mut DESTINATION: ActorId = ActorId::new([0u8; 32]); - static mut DELAY: u32 = 0; - static mut RESERVATION_AMOUNT: u64 = 0; - - #[no_mangle] - extern "C" fn handle() { - let reservation_id = ReservationId::reserve(unsafe { RESERVATION_AMOUNT }, 80) - .expect("Failed to reserve gas"); - msg::send_delayed_from_reservation( - reservation_id, - unsafe { DESTINATION }, - b"proxied message", - msg::value(), - unsafe { DELAY }, - ) - .expect("Failed to proxy message"); - } - - #[no_mangle] - extern "C" fn init() { - let args: InputArgs = msg::load().expect("Failed to decode `InputArgs'"); - unsafe { - DESTINATION = args.destination; - DELAY = args.delay; - RESERVATION_AMOUNT = args.reservation_amount; - } - } -} +mod wasm; diff --git a/examples/proxy-reservation-with-gas/src/wasm.rs b/examples/proxy-reservation-with-gas/src/wasm.rs new file mode 100644 index 00000000000..695e6678d4b --- /dev/null +++ b/examples/proxy-reservation-with-gas/src/wasm.rs @@ -0,0 +1,48 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::InputArgs; +use gstd::{msg, ActorId, ReservationId}; + +static mut DESTINATION: ActorId = ActorId::new([0u8; 32]); +static mut DELAY: u32 = 0; +static mut RESERVATION_AMOUNT: u64 = 0; + +#[no_mangle] +extern "C" fn handle() { + let reservation_id = + ReservationId::reserve(unsafe { RESERVATION_AMOUNT }, 80).expect("Failed to reserve gas"); + msg::send_delayed_from_reservation( + reservation_id, + unsafe { DESTINATION }, + b"proxied message", + msg::value(), + unsafe { DELAY }, + ) + .expect("Failed to proxy message"); +} + +#[no_mangle] +extern "C" fn init() { + let args: InputArgs = msg::load().expect("Failed to decode `InputArgs'"); + unsafe { + DESTINATION = args.destination; + DELAY = args.delay; + RESERVATION_AMOUNT = args.reservation_amount; + } +} diff --git a/examples/proxy/Cargo.toml b/examples/proxy/Cargo.toml index e3603c7e609..f679ca89cd5 100644 --- a/examples/proxy/Cargo.toml +++ b/examples/proxy/Cargo.toml @@ -2,20 +2,19 @@ name = "demo-proxy" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -gstd = { workspace = true } -parity-scale-codec = { workspace = true, features = ["derive"] } -scale-info = { workspace = true, features = ["derive"] } +gstd.workspace = true +parity-scale-codec.workspace = true +scale-info.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] wasm-wrapper = [] diff --git a/examples/proxy/src/lib.rs b/examples/proxy/src/lib.rs index 91cc0648d14..3afdf022b59 100644 --- a/examples/proxy/src/lib.rs +++ b/examples/proxy/src/lib.rs @@ -37,28 +37,4 @@ pub struct InputArgs { pub const HANDLE_REPLY_EXPECT: &str = "I will fail"; #[cfg(not(feature = "wasm-wrapper"))] -mod wasm { - use crate::{InputArgs, HANDLE_REPLY_EXPECT}; - use gstd::{msg, ActorId}; - - static mut DESTINATION: ActorId = ActorId::new([0u8; 32]); - - #[no_mangle] - extern "C" fn init() { - let args: InputArgs = msg::load().expect("Failed to decode `InputArgs'"); - unsafe { DESTINATION = args.destination.into() }; - } - - #[no_mangle] - extern "C" fn handle() { - let payload = msg::load_bytes().expect("failed to load bytes"); - msg::send_bytes(unsafe { DESTINATION }, payload, msg::value()) - .expect("failed to send bytes"); - } - - #[no_mangle] - extern "C" fn handle_reply() { - // Will panic here as replies denied in `handle_reply`. - msg::reply_bytes([], 0).expect(HANDLE_REPLY_EXPECT); - } -} +mod wasm; diff --git a/examples/proxy/src/wasm.rs b/examples/proxy/src/wasm.rs new file mode 100644 index 00000000000..b4c78b974c3 --- /dev/null +++ b/examples/proxy/src/wasm.rs @@ -0,0 +1,40 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{InputArgs, HANDLE_REPLY_EXPECT}; +use gstd::{msg, ActorId}; + +static mut DESTINATION: ActorId = ActorId::new([0u8; 32]); + +#[no_mangle] +extern "C" fn init() { + let args: InputArgs = msg::load().expect("Failed to decode `InputArgs'"); + unsafe { DESTINATION = args.destination.into() }; +} + +#[no_mangle] +extern "C" fn handle() { + let payload = msg::load_bytes().expect("failed to load bytes"); + msg::send_bytes(unsafe { DESTINATION }, payload, msg::value()).expect("failed to send bytes"); +} + +#[no_mangle] +extern "C" fn handle_reply() { + // Will panic here as replies denied in `handle_reply`. + msg::reply_bytes([], 0).expect(HANDLE_REPLY_EXPECT); +} diff --git a/examples/read-big-state/Cargo.toml b/examples/read-big-state/Cargo.toml index 120c31ee6f2..c20badfe83a 100644 --- a/examples/read-big-state/Cargo.toml +++ b/examples/read-big-state/Cargo.toml @@ -4,11 +4,12 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/read-big-state/src/lib.rs b/examples/read-big-state/src/lib.rs index 3f7d147551c..81cf6042e3b 100644 --- a/examples/read-big-state/src/lib.rs +++ b/examples/read-big-state/src/lib.rs @@ -60,24 +60,4 @@ impl State { } #[cfg(not(feature = "wasm-wrapper"))] -mod wasm { - use super::*; - use gstd::{msg, prelude::*}; - - static mut STATE: Option = None; - - fn state_mut() -> &'static mut State { - unsafe { STATE.get_or_insert_with(State::new) } - } - - #[no_mangle] - extern "C" fn handle() { - let strings = msg::load().expect("Failed to load state"); - state_mut().insert(strings); - } - - #[no_mangle] - extern "C" fn state() { - msg::reply(state_mut(), 0).expect("Error in reply of state"); - } -} +mod wasm; diff --git a/examples/read-big-state/src/wasm.rs b/examples/read-big-state/src/wasm.rs new file mode 100644 index 00000000000..65f13db548c --- /dev/null +++ b/examples/read-big-state/src/wasm.rs @@ -0,0 +1,37 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::State; +use gstd::{msg, prelude::*}; + +static mut STATE: Option = None; + +fn state_mut() -> &'static mut State { + unsafe { STATE.get_or_insert_with(State::new) } +} + +#[no_mangle] +extern "C" fn handle() { + let strings = msg::load().expect("Failed to load state"); + state_mut().insert(strings); +} + +#[no_mangle] +extern "C" fn state() { + msg::reply(state_mut(), 0).expect("Error in reply of state"); +} diff --git a/examples/reservation-manager/Cargo.toml b/examples/reservation-manager/Cargo.toml index df7f282d5ff..372ecdbd5aa 100644 --- a/examples/reservation-manager/Cargo.toml +++ b/examples/reservation-manager/Cargo.toml @@ -4,11 +4,12 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/reservation-manager/src/lib.rs b/examples/reservation-manager/src/lib.rs index c6a1ddf5522..9e8281a1918 100644 --- a/examples/reservation-manager/src/lib.rs +++ b/examples/reservation-manager/src/lib.rs @@ -35,33 +35,4 @@ pub enum Action { } #[cfg(not(feature = "std"))] -mod wasm { - use super::*; - use gstd::{msg, prelude::*, Reservations}; - - static mut RESERVATIONS: Reservations = Reservations::new(); - - #[no_mangle] - extern "C" fn handle() { - let action: Action = msg::load().expect("Failed to load message"); - - unsafe { - match action { - Action::Reserve { amount, duration } => { - RESERVATIONS - .reserve(amount, duration) - .expect("Failed to reserve gas"); - } - Action::SendMessageFromReservation { gas_amount } => { - let reservation = RESERVATIONS.try_take_reservation(gas_amount); - if let Some(reservation) = reservation { - msg::send_bytes_from_reservation(reservation.id(), msg::source(), [], 0) - .expect("Failed to send message from reservation"); - } else { - panic!("Reservation not found"); - } - } - } - } - } -} +mod wasm; diff --git a/examples/reservation-manager/src/wasm.rs b/examples/reservation-manager/src/wasm.rs new file mode 100644 index 00000000000..a9d81564c0b --- /dev/null +++ b/examples/reservation-manager/src/wasm.rs @@ -0,0 +1,46 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::Action; +use gstd::{msg, prelude::*, Reservations}; + +static mut RESERVATIONS: Reservations = Reservations::new(); + +#[no_mangle] +extern "C" fn handle() { + let action: Action = msg::load().expect("Failed to load message"); + + unsafe { + match action { + Action::Reserve { amount, duration } => { + RESERVATIONS + .reserve(amount, duration) + .expect("Failed to reserve gas"); + } + Action::SendMessageFromReservation { gas_amount } => { + let reservation = RESERVATIONS.try_take_reservation(gas_amount); + if let Some(reservation) = reservation { + msg::send_bytes_from_reservation(reservation.id(), msg::source(), [], 0) + .expect("Failed to send message from reservation"); + } else { + panic!("Reservation not found"); + } + } + } + } +} diff --git a/examples/reserve-gas/Cargo.toml b/examples/reserve-gas/Cargo.toml index 132b43911fa..896a36a5d0b 100644 --- a/examples/reserve-gas/Cargo.toml +++ b/examples/reserve-gas/Cargo.toml @@ -4,11 +4,12 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/reserve-gas/src/lib.rs b/examples/reserve-gas/src/lib.rs index 7644c983bb7..ca903da75b8 100644 --- a/examples/reserve-gas/src/lib.rs +++ b/examples/reserve-gas/src/lib.rs @@ -63,195 +63,7 @@ pub type GasAmount = u64; pub type BlockCount = u32; #[cfg(not(feature = "wasm-wrapper"))] -mod wasm { - use super::*; - use gstd::{ - errors::{Error, ExecutionError, ExtError, ReservationError}, - exec, msg, - prelude::*, - MessageId, ReservationId, - }; - - static mut RESERVATION_ID: Option = None; - static mut RESERVATIONS: Vec = Vec::new(); - static mut INIT_MSG: MessageId = MessageId::new([0; 32]); - static mut WAKE_STATE: WakeState = WakeState::Initial; - - #[derive(Debug, Eq, PartialEq)] - enum WakeState { - Initial, - Panic, - Exit, - } - - #[no_mangle] - extern "C" fn init() { - unsafe { INIT_MSG = msg::id() }; - - let action: InitAction = msg::load().unwrap(); - - match action { - InitAction::Normal(ref reservations) => { - for (amount, duration) in reservations { - let _ = ReservationId::reserve(*amount, *duration).expect("reservation"); - } - - // no actual reservation and unreservation is occurred - let noop_reservation = - ReservationId::reserve(50_000, 10).expect("noop reservation"); - let unreserved_amount = noop_reservation.unreserve().expect("noop unreservation"); - assert_eq!(unreserved_amount, 50_000); - - unsafe { - RESERVATION_ID = Some( - ReservationId::reserve(RESERVATION_AMOUNT, 15) - .expect("reservation across executions"), - ) - }; - } - InitAction::Wait => match unsafe { &WAKE_STATE } { - WakeState::Initial => { - let _reservation = ReservationId::reserve(50_000, 10); - // to find message to reply to in test - msg::send(msg::source(), (), 0).unwrap(); - exec::wait(); - } - WakeState::Panic => { - panic!() - } - WakeState::Exit => { - exec::exit(msg::source()); - } - }, - InitAction::CheckArgs { mailbox_threshold } => { - assert_eq!( - ReservationId::reserve(0, 10), - Err(Error::Core( - ExtError::Reservation(ReservationError::ReservationBelowMailboxThreshold) - .into() - )) - ); - - assert_eq!( - ReservationId::reserve(50_000, 0), - Err(Error::Core( - ExtError::Reservation(ReservationError::ZeroReservationDuration).into() - )) - ); - - assert_eq!( - ReservationId::reserve(mailbox_threshold - 1, 1), - Err(Error::Core( - ExtError::Reservation(ReservationError::ReservationBelowMailboxThreshold) - .into() - )) - ); - - assert_eq!( - ReservationId::reserve(mailbox_threshold, u32::MAX), - Err(Error::Core( - ExtError::Execution(ExecutionError::NotEnoughGas).into() - )) - ); - - assert_eq!( - ReservationId::reserve(u64::MAX, 1), - Err(Error::Core( - ExtError::Execution(ExecutionError::NotEnoughGas).into() - )) - ); - } - InitAction::FreshReserveUnreserve => { - let id = ReservationId::reserve(10_000, 10).unwrap(); - gstd::msg::send_from_reservation(id, msg::source(), b"fresh_reserve_unreserve", 0) - .unwrap(); - assert_eq!( - id.unreserve(), - Err(Error::Core( - ExtError::Reservation(ReservationError::InvalidReservationId).into() - )) - ); - } - } - } - - #[no_mangle] - extern "C" fn handle() { - let action: HandleAction = msg::load().unwrap(); - match action { - HandleAction::Unreserve => { - let id = unsafe { RESERVATION_ID.take().unwrap() }; - id.unreserve().expect("unreservation across executions"); - } - HandleAction::Exit => { - exec::exit(msg::source()); - } - HandleAction::ReplyFromReservation => { - let id = unsafe { RESERVATION_ID.take().unwrap() }; - msg::reply_from_reservation(id, REPLY_FROM_RESERVATION_PAYLOAD, 0) - .expect("unable to reply from reservation"); - } - HandleAction::AddReservationToList(amount, block_count) => { - let reservation_id = - ReservationId::reserve(amount, block_count).expect("Unable to reserve gas"); - unsafe { - RESERVATIONS.push(reservation_id); - } - } - HandleAction::ConsumeReservationsFromList => { - let reservations = unsafe { mem::take(&mut RESERVATIONS) }; - for reservation_id in reservations { - msg::send_from_reservation( - reservation_id, - exec::program_id(), - HandleAction::RunInifitely, - 0, - ) - .expect("Unable to send using reservation"); - } - } - HandleAction::RunInifitely => { - if msg::source() != exec::program_id() { - panic!( - "Invalid caller, this is a private method reserved for the program itself." - ); - } - loop { - let _msg_source = msg::source(); - } - } - HandleAction::SendFromReservationAndUnreserve => { - let id = unsafe { RESERVATION_ID.take().unwrap() }; - gstd::msg::send_from_reservation( - id, - msg::source(), - b"existing_reserve_unreserve", - 0, - ) - .unwrap(); - assert_eq!( - id.unreserve(), - Err(Error::Core( - ExtError::Reservation(ReservationError::InvalidReservationId).into() - )) - ); - } - } - } - - // must be called after `InitAction::Wait` - #[no_mangle] - extern "C" fn handle_reply() { - let action: ReplyAction = msg::load().unwrap(); - unsafe { - WAKE_STATE = match action { - ReplyAction::Panic => WakeState::Panic, - ReplyAction::Exit => WakeState::Exit, - }; - exec::wake(INIT_MSG).unwrap(); - } - } -} +mod wasm; #[cfg(test)] mod tests { diff --git a/examples/reserve-gas/src/wasm.rs b/examples/reserve-gas/src/wasm.rs new file mode 100644 index 00000000000..09e1d4ab2d9 --- /dev/null +++ b/examples/reserve-gas/src/wasm.rs @@ -0,0 +1,199 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{ + HandleAction, InitAction, ReplyAction, REPLY_FROM_RESERVATION_PAYLOAD, RESERVATION_AMOUNT, +}; +use gstd::{ + errors::{Error, ExecutionError, ExtError, ReservationError}, + exec, msg, + prelude::*, + MessageId, ReservationId, +}; + +static mut RESERVATION_ID: Option = None; +static mut RESERVATIONS: Vec = Vec::new(); +static mut INIT_MSG: MessageId = MessageId::new([0; 32]); +static mut WAKE_STATE: WakeState = WakeState::Initial; + +#[derive(Debug, Eq, PartialEq)] +enum WakeState { + Initial, + Panic, + Exit, +} + +#[no_mangle] +extern "C" fn init() { + unsafe { INIT_MSG = msg::id() }; + + let action: InitAction = msg::load().unwrap(); + + match action { + InitAction::Normal(ref reservations) => { + for (amount, duration) in reservations { + let _ = ReservationId::reserve(*amount, *duration).expect("reservation"); + } + + // no actual reservation and unreservation is occurred + let noop_reservation = ReservationId::reserve(50_000, 10).expect("noop reservation"); + let unreserved_amount = noop_reservation.unreserve().expect("noop unreservation"); + assert_eq!(unreserved_amount, 50_000); + + unsafe { + RESERVATION_ID = Some( + ReservationId::reserve(RESERVATION_AMOUNT, 15) + .expect("reservation across executions"), + ) + }; + } + InitAction::Wait => match unsafe { &WAKE_STATE } { + WakeState::Initial => { + let _reservation = ReservationId::reserve(50_000, 10); + // to find message to reply to in test + msg::send(msg::source(), (), 0).unwrap(); + exec::wait(); + } + WakeState::Panic => { + panic!() + } + WakeState::Exit => { + exec::exit(msg::source()); + } + }, + InitAction::CheckArgs { mailbox_threshold } => { + assert_eq!( + ReservationId::reserve(0, 10), + Err(Error::Core( + ExtError::Reservation(ReservationError::ReservationBelowMailboxThreshold) + .into() + )) + ); + + assert_eq!( + ReservationId::reserve(50_000, 0), + Err(Error::Core( + ExtError::Reservation(ReservationError::ZeroReservationDuration).into() + )) + ); + + assert_eq!( + ReservationId::reserve(mailbox_threshold - 1, 1), + Err(Error::Core( + ExtError::Reservation(ReservationError::ReservationBelowMailboxThreshold) + .into() + )) + ); + + assert_eq!( + ReservationId::reserve(mailbox_threshold, u32::MAX), + Err(Error::Core( + ExtError::Execution(ExecutionError::NotEnoughGas).into() + )) + ); + + assert_eq!( + ReservationId::reserve(u64::MAX, 1), + Err(Error::Core( + ExtError::Execution(ExecutionError::NotEnoughGas).into() + )) + ); + } + InitAction::FreshReserveUnreserve => { + let id = ReservationId::reserve(10_000, 10).unwrap(); + gstd::msg::send_from_reservation(id, msg::source(), b"fresh_reserve_unreserve", 0) + .unwrap(); + assert_eq!( + id.unreserve(), + Err(Error::Core( + ExtError::Reservation(ReservationError::InvalidReservationId).into() + )) + ); + } + } +} + +#[no_mangle] +extern "C" fn handle() { + let action: HandleAction = msg::load().unwrap(); + match action { + HandleAction::Unreserve => { + let id = unsafe { RESERVATION_ID.take().unwrap() }; + id.unreserve().expect("unreservation across executions"); + } + HandleAction::Exit => { + exec::exit(msg::source()); + } + HandleAction::ReplyFromReservation => { + let id = unsafe { RESERVATION_ID.take().unwrap() }; + msg::reply_from_reservation(id, REPLY_FROM_RESERVATION_PAYLOAD, 0) + .expect("unable to reply from reservation"); + } + HandleAction::AddReservationToList(amount, block_count) => { + let reservation_id = + ReservationId::reserve(amount, block_count).expect("Unable to reserve gas"); + unsafe { + RESERVATIONS.push(reservation_id); + } + } + HandleAction::ConsumeReservationsFromList => { + let reservations = unsafe { mem::take(&mut RESERVATIONS) }; + for reservation_id in reservations { + msg::send_from_reservation( + reservation_id, + exec::program_id(), + HandleAction::RunInifitely, + 0, + ) + .expect("Unable to send using reservation"); + } + } + HandleAction::RunInifitely => { + if msg::source() != exec::program_id() { + panic!("Invalid caller, this is a private method reserved for the program itself."); + } + loop { + let _msg_source = msg::source(); + } + } + HandleAction::SendFromReservationAndUnreserve => { + let id = unsafe { RESERVATION_ID.take().unwrap() }; + gstd::msg::send_from_reservation(id, msg::source(), b"existing_reserve_unreserve", 0) + .unwrap(); + assert_eq!( + id.unreserve(), + Err(Error::Core( + ExtError::Reservation(ReservationError::InvalidReservationId).into() + )) + ); + } + } +} + +// must be called after `InitAction::Wait` +#[no_mangle] +extern "C" fn handle_reply() { + let action: ReplyAction = msg::load().unwrap(); + unsafe { + WAKE_STATE = match action { + ReplyAction::Panic => WakeState::Panic, + ReplyAction::Exit => WakeState::Exit, + }; + exec::wake(INIT_MSG).unwrap(); + } +} diff --git a/examples/rwlock/Cargo.toml b/examples/rwlock/Cargo.toml index 2d9f2e5bf74..b7a8621cb12 100644 --- a/examples/rwlock/Cargo.toml +++ b/examples/rwlock/Cargo.toml @@ -4,11 +4,12 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd = { workspace = true, features = ["debug"] } -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/rwlock/src/lib.rs b/examples/rwlock/src/lib.rs index 23e073c2fea..8011edf5d94 100644 --- a/examples/rwlock/src/lib.rs +++ b/examples/rwlock/src/lib.rs @@ -39,111 +39,4 @@ pub enum Command { } #[cfg(not(feature = "std"))] -mod wasm { - use crate::Command; - use core::{ - future::Future, - pin::Pin, - ptr, - task::{Context, RawWaker, RawWakerVTable, Waker}, - }; - use gstd::{msg, prelude::*, sync::RwLock, ActorId}; - - static mut DESTINATION: ActorId = ActorId::zero(); - static RW_LOCK: RwLock = RwLock::new(0); - - async fn ping() { - msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) - .expect("Failed to send message") - .await - .expect("Received error reply"); - } - - #[no_mangle] - extern "C" fn init() { - let destination = msg::load().expect("Failed to load destination"); - unsafe { DESTINATION = destination }; - } - - #[gstd::async_main] - async fn main() { - if let Ok(command) = msg::load() { - match command { - Command::Get => { - let value = RW_LOCK.read().await; - msg::reply(*value, 0).expect("Failed to send reply"); - } - Command::Inc => { - let mut value = RW_LOCK.write().await; - *value += 1; - } - Command::PingGet => { - ping().await; - let value = RW_LOCK.read().await; - msg::reply(*value, 0).expect("Failed to send reply"); - } - Command::IncPing => { - let mut value = RW_LOCK.write().await; - *value += 1; - ping().await; - } - Command::GetPing => { - let value = RW_LOCK.read().await; - ping().await; - msg::reply(*value, 0).expect("Failed to send reply"); - } - Command::CheckReaders => { - let mut storage = Vec::with_capacity(RwLock::::READERS_LIMIT as usize); - - for _ in 0..RwLock::::READERS_LIMIT { - storage.push(RW_LOCK.read().await); - } - - let waker = unsafe { Waker::from_raw(clone_waker(ptr::null())) }; - let mut cx = Context::from_waker(&waker); - - // Read future just for extra testing - let mut wf = RW_LOCK.write(); - - assert!( - !Pin::new(&mut wf).poll(&mut cx).is_ready(), - "Ready, but shouldn't" - ); - - let mut rf = RW_LOCK.read(); - - assert!( - !Pin::new(&mut rf).poll(&mut cx).is_ready(), - "Ready, but shouldn't" - ); - - // Drop of single reader. - storage.pop(); - - // Read future just for extra testing - assert!( - !Pin::new(&mut wf).poll(&mut cx).is_ready(), - "Ready, but shouldn't" - ); - assert!( - Pin::new(&mut rf).poll(&mut cx).is_ready(), - "Not ready, but shouldn't" - ); - - let value = rf.await; - msg::reply(*value, 0).expect("Failed to send reply"); - } - } - } else { - let _write = RW_LOCK.write().await; - RW_LOCK.read().await; - } - } - - unsafe fn clone_waker(ptr: *const ()) -> RawWaker { - RawWaker::new( - ptr, - &RawWakerVTable::new(clone_waker, |_| {}, |_| {}, |_| {}), - ) - } -} +mod wasm; diff --git a/examples/rwlock/src/wasm.rs b/examples/rwlock/src/wasm.rs new file mode 100644 index 00000000000..813f733a4b1 --- /dev/null +++ b/examples/rwlock/src/wasm.rs @@ -0,0 +1,124 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::Command; +use core::{ + future::Future, + pin::Pin, + ptr, + task::{Context, RawWaker, RawWakerVTable, Waker}, +}; +use gstd::{msg, prelude::*, sync::RwLock, ActorId}; + +static mut DESTINATION: ActorId = ActorId::zero(); +static RW_LOCK: RwLock = RwLock::new(0); + +async fn ping() { + msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) + .expect("Failed to send message") + .await + .expect("Received error reply"); +} + +#[no_mangle] +extern "C" fn init() { + let destination = msg::load().expect("Failed to load destination"); + unsafe { DESTINATION = destination }; +} + +#[gstd::async_main] +async fn main() { + if let Ok(command) = msg::load() { + match command { + Command::Get => { + let value = RW_LOCK.read().await; + msg::reply(*value, 0).expect("Failed to send reply"); + } + Command::Inc => { + let mut value = RW_LOCK.write().await; + *value += 1; + } + Command::PingGet => { + ping().await; + let value = RW_LOCK.read().await; + msg::reply(*value, 0).expect("Failed to send reply"); + } + Command::IncPing => { + let mut value = RW_LOCK.write().await; + *value += 1; + ping().await; + } + Command::GetPing => { + let value = RW_LOCK.read().await; + ping().await; + msg::reply(*value, 0).expect("Failed to send reply"); + } + Command::CheckReaders => { + let mut storage = Vec::with_capacity(RwLock::::READERS_LIMIT as usize); + + for _ in 0..RwLock::::READERS_LIMIT { + storage.push(RW_LOCK.read().await); + } + + let waker = unsafe { Waker::from_raw(clone_waker(ptr::null())) }; + let mut cx = Context::from_waker(&waker); + + // Read future just for extra testing + let mut wf = RW_LOCK.write(); + + assert!( + !Pin::new(&mut wf).poll(&mut cx).is_ready(), + "Ready, but shouldn't" + ); + + let mut rf = RW_LOCK.read(); + + assert!( + !Pin::new(&mut rf).poll(&mut cx).is_ready(), + "Ready, but shouldn't" + ); + + // Drop of single reader. + storage.pop(); + + // Read future just for extra testing + assert!( + !Pin::new(&mut wf).poll(&mut cx).is_ready(), + "Ready, but shouldn't" + ); + assert!( + Pin::new(&mut rf).poll(&mut cx).is_ready(), + "Not ready, but shouldn't" + ); + + let value = rf.await; + msg::reply(*value, 0).expect("Failed to send reply"); + } + } + } else { + let _write = RW_LOCK.write().await; + RW_LOCK.read().await; + } +} + +unsafe fn clone_waker(ptr: *const ()) -> RawWaker { + RawWaker::new( + ptr, + &RawWakerVTable::new(clone_waker, |_| {}, |_| {}, |_| {}), + ) +} diff --git a/examples/send-from-reservation/Cargo.toml b/examples/send-from-reservation/Cargo.toml index 0cfee5b00e8..cbde057d74b 100644 --- a/examples/send-from-reservation/Cargo.toml +++ b/examples/send-from-reservation/Cargo.toml @@ -2,13 +2,14 @@ name = "demo-send-from-reservation" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true @@ -16,8 +17,6 @@ gear-wasm-builder.workspace = true [dev-dependencies] gtest.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std"] diff --git a/examples/send-from-reservation/src/lib.rs b/examples/send-from-reservation/src/lib.rs index aa927e0333e..7348f9fbb6d 100644 --- a/examples/send-from-reservation/src/lib.rs +++ b/examples/send-from-reservation/src/lib.rs @@ -42,84 +42,4 @@ pub enum HandleAction { } #[cfg(not(feature = "std"))] -mod wasm { - use super::*; - use gstd::{msg, prelude::*, ReservationId}; - - #[derive(Debug, Encode, Decode)] - pub struct Receive([u8; 32]); - - #[no_mangle] - extern "C" fn handle() { - let action: HandleAction = msg::load().expect("Failed to load handle payload"); - match action { - HandleAction::SendToUser => { - let id = ReservationId::reserve(3_000_000_000, 50).expect("Failed to reserve gas"); - msg::send_bytes_from_reservation(id, msg::source(), b"send_to_user", 500) - .expect("Failed to send message"); - } - HandleAction::SendToUserDelayed => { - let id = ReservationId::reserve(4_000_000_000, 60).expect("Failed to reserve gas"); - msg::send_bytes_delayed_from_reservation( - id, - msg::source(), - b"send_to_user_delayed", - 600, - 1, - ) - .expect("Failed to send message"); - } - HandleAction::SendToProgram { pid, user } => { - let id = ReservationId::reserve(5_000_000_000, 70).expect("Failed to reserve gas"); - msg::send_from_reservation( - id, - pid.into(), - HandleAction::ReceiveFromProgram(user), - 700, - ) - .expect("Failed to send message"); - } - HandleAction::SendToProgramDelayed { pid, user } => { - let id = ReservationId::reserve(6_000_000_000, 80).expect("Failed to reserve gas"); - msg::send_delayed_from_reservation( - id, - pid.into(), - HandleAction::ReceiveFromProgramDelayed(user), - 800, - 1, - ) - .expect("Failed to send message"); - } - HandleAction::ReplyToUser => { - let id = ReservationId::reserve(7_000_000_000, 90).expect("Failed to reserve gas"); - msg::reply_bytes_from_reservation(id, b"reply_to_user", 900) - .expect("Failed to send message"); - } - HandleAction::ReplyToProgram { pid, user } => { - msg::send(pid.into(), HandleAction::ReplyToProgramStep2(user), 900) - .expect("Failed to reserve gas"); - } - HandleAction::ReplyToProgramStep2(user) => { - let id = ReservationId::reserve(7_000_000_000, 90).expect("Failed to reserve gas"); - msg::reply_from_reservation(id, Receive(user), 900).expect("Failed to reply"); - } - HandleAction::ReceiveFromProgram(user) => { - assert_eq!(msg::value(), 700); - msg::send_bytes(user.into(), b"receive_from_program", 700) - .expect("Failed to send message"); - } - HandleAction::ReceiveFromProgramDelayed(user) => { - assert_eq!(msg::value(), 800); - msg::send_bytes(user.into(), b"receive_from_program_delayed", 800) - .expect("Failed to send message"); - } - } - } - - #[no_mangle] - extern "C" fn handle_reply() { - let Receive(user) = msg::load().expect("Failed to load handle payload"); - assert_eq!(msg::value(), 900); - msg::send_bytes(user.into(), b"reply", 900).expect("Failed to send message"); - } -} +mod wasm; diff --git a/examples/send-from-reservation/src/wasm.rs b/examples/send-from-reservation/src/wasm.rs new file mode 100644 index 00000000000..a8281f605ec --- /dev/null +++ b/examples/send-from-reservation/src/wasm.rs @@ -0,0 +1,92 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::HandleAction; +use gstd::{msg, prelude::*, ReservationId}; + +#[derive(Debug, Encode, Decode)] +pub struct Receive([u8; 32]); + +#[no_mangle] +extern "C" fn handle() { + let action: HandleAction = msg::load().expect("Failed to load handle payload"); + match action { + HandleAction::SendToUser => { + let id = ReservationId::reserve(3_000_000_000, 50).expect("Failed to reserve gas"); + msg::send_bytes_from_reservation(id, msg::source(), b"send_to_user", 500) + .expect("Failed to send message"); + } + HandleAction::SendToUserDelayed => { + let id = ReservationId::reserve(4_000_000_000, 60).expect("Failed to reserve gas"); + msg::send_bytes_delayed_from_reservation( + id, + msg::source(), + b"send_to_user_delayed", + 600, + 1, + ) + .expect("Failed to send message"); + } + HandleAction::SendToProgram { pid, user } => { + let id = ReservationId::reserve(5_000_000_000, 70).expect("Failed to reserve gas"); + msg::send_from_reservation(id, pid.into(), HandleAction::ReceiveFromProgram(user), 700) + .expect("Failed to send message"); + } + HandleAction::SendToProgramDelayed { pid, user } => { + let id = ReservationId::reserve(6_000_000_000, 80).expect("Failed to reserve gas"); + msg::send_delayed_from_reservation( + id, + pid.into(), + HandleAction::ReceiveFromProgramDelayed(user), + 800, + 1, + ) + .expect("Failed to send message"); + } + HandleAction::ReplyToUser => { + let id = ReservationId::reserve(7_000_000_000, 90).expect("Failed to reserve gas"); + msg::reply_bytes_from_reservation(id, b"reply_to_user", 900) + .expect("Failed to send message"); + } + HandleAction::ReplyToProgram { pid, user } => { + msg::send(pid.into(), HandleAction::ReplyToProgramStep2(user), 900) + .expect("Failed to reserve gas"); + } + HandleAction::ReplyToProgramStep2(user) => { + let id = ReservationId::reserve(7_000_000_000, 90).expect("Failed to reserve gas"); + msg::reply_from_reservation(id, Receive(user), 900).expect("Failed to reply"); + } + HandleAction::ReceiveFromProgram(user) => { + assert_eq!(msg::value(), 700); + msg::send_bytes(user.into(), b"receive_from_program", 700) + .expect("Failed to send message"); + } + HandleAction::ReceiveFromProgramDelayed(user) => { + assert_eq!(msg::value(), 800); + msg::send_bytes(user.into(), b"receive_from_program_delayed", 800) + .expect("Failed to send message"); + } + } +} + +#[no_mangle] +extern "C" fn handle_reply() { + let Receive(user) = msg::load().expect("Failed to load handle payload"); + assert_eq!(msg::value(), 900); + msg::send_bytes(user.into(), b"reply", 900).expect("Failed to send message"); +} diff --git a/examples/signal-entry/Cargo.toml b/examples/signal-entry/Cargo.toml index 4dca39ea3ef..7826e3d3394 100644 --- a/examples/signal-entry/Cargo.toml +++ b/examples/signal-entry/Cargo.toml @@ -2,17 +2,17 @@ name = "demo-signal-entry" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd = { workspace = true, features = [ "debug", ] } # debug is used here, because `signal_backend_error_invalid_debug_works` test in `pallet-gear` requires it to be working correctly in release mode -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true gear-core.workspace = true -gsys.workspace = true [build-dependencies] gear-wasm-builder.workspace = true @@ -20,8 +20,6 @@ gear-wasm-builder.workspace = true [dev-dependencies] gtest.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = [] diff --git a/examples/signal-entry/src/lib.rs b/examples/signal-entry/src/lib.rs index dcf9c054f97..7d6a1de52de 100644 --- a/examples/signal-entry/src/lib.rs +++ b/examples/signal-entry/src/lib.rs @@ -59,264 +59,7 @@ pub enum HandleAction { pub const WAIT_AND_RESERVE_WITH_PANIC_GAS: u64 = 10_000_000_000; #[cfg(not(feature = "std"))] -mod wasm { - use super::*; - use gear_core::ids::ProgramId; - use gstd::{ - debug, - errors::{ExtError, ReservationError, SignalCode, SimpleExecutionError}, - exec, - ext::oom_panic, - msg, - prelude::*, - ActorId, MessageId, - }; - - static mut INITIATOR: ActorId = ActorId::zero(); - static mut HANDLE_MSG: Option = None; - static mut DO_PANIC: bool = false; - static mut DO_EXIT: bool = false; - static mut HANDLE_SIGNAL_STATE: HandleSignalState = HandleSignalState::Normal; - - enum HandleSignalState { - Normal, - Panic, - ForbiddenCall([u8; 32]), - Assert(SignalCode), - } - - #[no_mangle] - extern "C" fn init() { - unsafe { INITIATOR = msg::source() }; - } - - #[no_mangle] - extern "C" fn handle() { - unsafe { HANDLE_MSG = Some(msg::id()) }; - let do_panic = unsafe { &mut DO_PANIC }; - - let action: HandleAction = msg::load().unwrap(); - match action { - HandleAction::Simple => { - // must be unreserved as unused - exec::system_reserve_gas(100).unwrap(); - } - HandleAction::Wait => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - // used to found message id in test - msg::send(msg::source(), 0, 0).unwrap(); - exec::wait(); - } - HandleAction::WaitAndPanic => { - if *do_panic { - panic!(); - } - - *do_panic = !*do_panic; - - exec::system_reserve_gas(200).unwrap(); - // used to found message id in test - msg::send(msg::source(), 0, 0).unwrap(); - exec::wait(); - } - HandleAction::WaitAndReserveWithPanic => { - if *do_panic { - exec::system_reserve_gas(1_000_000_000).unwrap(); - panic!(); - } - - *do_panic = !*do_panic; - - exec::system_reserve_gas(WAIT_AND_RESERVE_WITH_PANIC_GAS).unwrap(); - // used to found message id in test - msg::send(msg::source(), 0, 0).unwrap(); - exec::wait(); - } - HandleAction::WaitAndExit => { - if unsafe { DO_EXIT } { - msg::send_bytes(msg::source(), b"wait_and_exit", 0).unwrap(); - exec::exit(msg::source()); - } - - unsafe { DO_EXIT = !DO_EXIT }; - - exec::system_reserve_gas(900).unwrap(); - // used to found message id in test - msg::send(msg::source(), 0, 0).unwrap(); - exec::wait(); - } - HandleAction::Panic => { - exec::system_reserve_gas(5_000_000_000).unwrap(); - panic!(); - } - HandleAction::WaitWithReserveAmountAndPanic(gas_amount) => { - if *do_panic { - panic!(); - } - - *do_panic = !*do_panic; - - exec::system_reserve_gas(gas_amount).unwrap(); - // used to found message id in test - msg::send(msg::source(), 0, 0).unwrap(); - exec::wait(); - } - HandleAction::Exit => { - exec::system_reserve_gas(4_000_000_000).unwrap(); - msg::reply_bytes(b"exit", 0).unwrap(); - exec::exit(msg::source()); - } - HandleAction::Accumulate => { - exec::system_reserve_gas(1000).unwrap(); - exec::system_reserve_gas(234).unwrap(); - exec::wait(); - } - HandleAction::OutOfGas => { - exec::system_reserve_gas(5_000_000_000).unwrap(); - // used to found message id in test - msg::send(msg::source(), 0, 0).unwrap(); - #[allow(clippy::empty_loop)] - loop {} - } - HandleAction::AcrossWaits => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - // used to found message id in test - // we use send instead of reply to avoid duplicated reply error. - msg::send(msg::source(), 0, 0).unwrap(); - exec::wait(); - } - HandleAction::PanicInSignal => { - unsafe { HANDLE_SIGNAL_STATE = HandleSignalState::Panic }; - exec::system_reserve_gas(5_000_000_000).unwrap(); - exec::wait(); - } - HandleAction::ZeroReserve => { - let res = exec::system_reserve_gas(0); - assert_eq!( - res, - Err(ExtError::Reservation(ReservationError::ZeroReservationAmount).into()) - ); - } - HandleAction::ForbiddenCallInSignal(user) => { - unsafe { HANDLE_SIGNAL_STATE = HandleSignalState::ForbiddenCall(user) }; - exec::system_reserve_gas(1_000_000_000).unwrap(); - exec::wait(); - } - HandleAction::ForbiddenAction => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - - msg::send(ActorId::new(ProgramId::SYSTEM.into()), "hello", 0) - .expect("cannot send message"); - } - HandleAction::SaveSignal(signal_received) => { - debug!("handle: signal_received={:?}", signal_received); - - unsafe { HANDLE_SIGNAL_STATE = HandleSignalState::Assert(signal_received) }; - } - HandleAction::ExceedMemory => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - - oom_panic(); - } - HandleAction::UnreachableInstruction => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - - #[cfg(target_arch = "wasm32")] - core::arch::wasm32::unreachable(); - } - HandleAction::InvalidDebugCall => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - - #[allow(clippy::invalid_utf8_in_unchecked)] - let invalid_string = unsafe { core::str::from_utf8_unchecked(&[0, 159, 146, 150]) }; - debug!("{}", invalid_string); - } - HandleAction::UnrecoverableExt => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - - exec::wait_up_to(0); - } - HandleAction::IncorrectFree => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - - extern "C" { - fn free(ptr: *mut u8) -> *mut u8; - } - - unsafe { - free(usize::MAX as *mut u8); - } - } - HandleAction::WaitWithoutSendingMessage => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - - exec::wait(); - } - HandleAction::MemoryAccess => { - exec::system_reserve_gas(1_000_000_000).unwrap(); - - const ARRAY_SIZE: usize = 1_000_000; - let arr = [42u8; ARRAY_SIZE]; - - #[allow(clippy::needless_range_loop)] - for i in 0..ARRAY_SIZE { - let _value = arr[i]; - } - } - } - } - - #[no_mangle] - extern "C" fn handle_signal() { - match unsafe { &HANDLE_SIGNAL_STATE } { - HandleSignalState::Normal => { - msg::send(unsafe { INITIATOR }, b"handle_signal", 0).unwrap(); - let signal_code = msg::signal_code() - .expect("Incorrect call") - .expect("Unsupported code"); - assert!(matches!( - signal_code, - SignalCode::Execution( - SimpleExecutionError::UserspacePanic | SimpleExecutionError::RanOutOfGas - ) - )); - - if let Some(handle_msg) = unsafe { HANDLE_MSG } { - assert_eq!(msg::signal_from(), Ok(handle_msg)); - } - - // TODO: check gas limit (#1796) - // assert_eq!(msg::gas_limit(), 5_000_000_000); - } - HandleSignalState::Panic => { - // to be sure state rolls back so this message won't appear in mailbox in test - msg::send(unsafe { INITIATOR }, b"handle_signal_panic", 0).unwrap(); - panic!(); - } - HandleSignalState::ForbiddenCall(user) => { - msg::send_bytes((*user).into(), b"handle_signal_forbidden_call", 0).unwrap(); - let _ = msg::source(); - } - HandleSignalState::Assert(signal_saved) => { - let signal_received = msg::signal_code() - .expect("Incorrect call") - .expect("Unsupported code"); - - if signal_received == *signal_saved { - msg::send(unsafe { INITIATOR }, true, 0).unwrap(); - } else { - msg::send(unsafe { INITIATOR }, false, 0).unwrap(); - } - } - } - } - - #[no_mangle] - extern "C" fn handle_reply() { - let handle_msg = unsafe { HANDLE_MSG.unwrap() }; - exec::wake(handle_msg).unwrap(); - } -} +mod wasm; #[cfg(test)] mod tests { diff --git a/examples/signal-entry/src/wasm.rs b/examples/signal-entry/src/wasm.rs new file mode 100644 index 00000000000..b483538a356 --- /dev/null +++ b/examples/signal-entry/src/wasm.rs @@ -0,0 +1,274 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::{HandleAction, WAIT_AND_RESERVE_WITH_PANIC_GAS}; +use gear_core::ids::ProgramId; +use gstd::{ + debug, + errors::{ExtError, ReservationError, SignalCode, SimpleExecutionError}, + exec, + ext::oom_panic, + msg, + prelude::*, + ActorId, MessageId, +}; + +static mut INITIATOR: ActorId = ActorId::zero(); +static mut HANDLE_MSG: Option = None; +static mut DO_PANIC: bool = false; +static mut DO_EXIT: bool = false; +static mut HANDLE_SIGNAL_STATE: HandleSignalState = HandleSignalState::Normal; + +enum HandleSignalState { + Normal, + Panic, + ForbiddenCall([u8; 32]), + Assert(SignalCode), +} + +#[no_mangle] +extern "C" fn init() { + unsafe { INITIATOR = msg::source() }; +} + +#[no_mangle] +extern "C" fn handle() { + unsafe { HANDLE_MSG = Some(msg::id()) }; + let do_panic = unsafe { &mut DO_PANIC }; + + let action: HandleAction = msg::load().unwrap(); + match action { + HandleAction::Simple => { + // must be unreserved as unused + exec::system_reserve_gas(100).unwrap(); + } + HandleAction::Wait => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + // used to found message id in test + msg::send(msg::source(), 0, 0).unwrap(); + exec::wait(); + } + HandleAction::WaitAndPanic => { + if *do_panic { + panic!(); + } + + *do_panic = !*do_panic; + + exec::system_reserve_gas(200).unwrap(); + // used to found message id in test + msg::send(msg::source(), 0, 0).unwrap(); + exec::wait(); + } + HandleAction::WaitAndReserveWithPanic => { + if *do_panic { + exec::system_reserve_gas(1_000_000_000).unwrap(); + panic!(); + } + + *do_panic = !*do_panic; + + exec::system_reserve_gas(WAIT_AND_RESERVE_WITH_PANIC_GAS).unwrap(); + // used to found message id in test + msg::send(msg::source(), 0, 0).unwrap(); + exec::wait(); + } + HandleAction::WaitAndExit => { + if unsafe { DO_EXIT } { + msg::send_bytes(msg::source(), b"wait_and_exit", 0).unwrap(); + exec::exit(msg::source()); + } + + unsafe { DO_EXIT = !DO_EXIT }; + + exec::system_reserve_gas(900).unwrap(); + // used to found message id in test + msg::send(msg::source(), 0, 0).unwrap(); + exec::wait(); + } + HandleAction::Panic => { + exec::system_reserve_gas(5_000_000_000).unwrap(); + panic!(); + } + HandleAction::WaitWithReserveAmountAndPanic(gas_amount) => { + if *do_panic { + panic!(); + } + + *do_panic = !*do_panic; + + exec::system_reserve_gas(gas_amount).unwrap(); + // used to found message id in test + msg::send(msg::source(), 0, 0).unwrap(); + exec::wait(); + } + HandleAction::Exit => { + exec::system_reserve_gas(4_000_000_000).unwrap(); + msg::reply_bytes(b"exit", 0).unwrap(); + exec::exit(msg::source()); + } + HandleAction::Accumulate => { + exec::system_reserve_gas(1000).unwrap(); + exec::system_reserve_gas(234).unwrap(); + exec::wait(); + } + HandleAction::OutOfGas => { + exec::system_reserve_gas(5_000_000_000).unwrap(); + // used to found message id in test + msg::send(msg::source(), 0, 0).unwrap(); + #[allow(clippy::empty_loop)] + loop {} + } + HandleAction::AcrossWaits => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + // used to found message id in test + // we use send instead of reply to avoid duplicated reply error. + msg::send(msg::source(), 0, 0).unwrap(); + exec::wait(); + } + HandleAction::PanicInSignal => { + unsafe { HANDLE_SIGNAL_STATE = HandleSignalState::Panic }; + exec::system_reserve_gas(5_000_000_000).unwrap(); + exec::wait(); + } + HandleAction::ZeroReserve => { + let res = exec::system_reserve_gas(0); + assert_eq!( + res, + Err(ExtError::Reservation(ReservationError::ZeroReservationAmount).into()) + ); + } + HandleAction::ForbiddenCallInSignal(user) => { + unsafe { HANDLE_SIGNAL_STATE = HandleSignalState::ForbiddenCall(user) }; + exec::system_reserve_gas(1_000_000_000).unwrap(); + exec::wait(); + } + HandleAction::ForbiddenAction => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + msg::send(ActorId::new(ProgramId::SYSTEM.into()), "hello", 0) + .expect("cannot send message"); + } + HandleAction::SaveSignal(signal_received) => { + debug!("handle: signal_received={:?}", signal_received); + + unsafe { HANDLE_SIGNAL_STATE = HandleSignalState::Assert(signal_received) }; + } + HandleAction::ExceedMemory => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + oom_panic(); + } + HandleAction::UnreachableInstruction => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + #[cfg(target_arch = "wasm32")] + core::arch::wasm32::unreachable(); + } + HandleAction::InvalidDebugCall => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + #[allow(clippy::invalid_utf8_in_unchecked)] + let invalid_string = unsafe { core::str::from_utf8_unchecked(&[0, 159, 146, 150]) }; + debug!("{}", invalid_string); + } + HandleAction::UnrecoverableExt => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + exec::wait_up_to(0); + } + HandleAction::IncorrectFree => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + extern "C" { + fn free(ptr: *mut u8) -> *mut u8; + } + + unsafe { + free(usize::MAX as *mut u8); + } + } + HandleAction::WaitWithoutSendingMessage => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + exec::wait(); + } + HandleAction::MemoryAccess => { + exec::system_reserve_gas(1_000_000_000).unwrap(); + + const ARRAY_SIZE: usize = 1_000_000; + let arr = [42u8; ARRAY_SIZE]; + + #[allow(clippy::needless_range_loop)] + for i in 0..ARRAY_SIZE { + let _value = arr[i]; + } + } + } +} + +#[no_mangle] +extern "C" fn handle_signal() { + match unsafe { &HANDLE_SIGNAL_STATE } { + HandleSignalState::Normal => { + msg::send(unsafe { INITIATOR }, b"handle_signal", 0).unwrap(); + let signal_code = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + assert!(matches!( + signal_code, + SignalCode::Execution( + SimpleExecutionError::UserspacePanic | SimpleExecutionError::RanOutOfGas + ) + )); + + if let Some(handle_msg) = unsafe { HANDLE_MSG } { + assert_eq!(msg::signal_from(), Ok(handle_msg)); + } + + // TODO: check gas limit (#1796) + // assert_eq!(msg::gas_limit(), 5_000_000_000); + } + HandleSignalState::Panic => { + // to be sure state rolls back so this message won't appear in mailbox in test + msg::send(unsafe { INITIATOR }, b"handle_signal_panic", 0).unwrap(); + panic!(); + } + HandleSignalState::ForbiddenCall(user) => { + msg::send_bytes((*user).into(), b"handle_signal_forbidden_call", 0).unwrap(); + let _ = msg::source(); + } + HandleSignalState::Assert(signal_saved) => { + let signal_received = msg::signal_code() + .expect("Incorrect call") + .expect("Unsupported code"); + + if signal_received == *signal_saved { + msg::send(unsafe { INITIATOR }, true, 0).unwrap(); + } else { + msg::send(unsafe { INITIATOR }, false, 0).unwrap(); + } + } + } +} + +#[no_mangle] +extern "C" fn handle_reply() { + let handle_msg = unsafe { HANDLE_MSG.unwrap() }; + exec::wake(handle_msg).unwrap(); +} diff --git a/examples/stack-allocations/Cargo.toml b/examples/stack-allocations/Cargo.toml index 5cf923ff1e8..e6b8fe0c32e 100644 --- a/examples/stack-allocations/Cargo.toml +++ b/examples/stack-allocations/Cargo.toml @@ -4,16 +4,17 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true [dev-dependencies] gtest.workspace = true -rand_pcg = { workspace = true } -rand = "0.8" +rand_pcg.workspace = true +rand.workspace = true static_assertions.workspace = true [build-dependencies] diff --git a/examples/stack-allocations/src/lib.rs b/examples/stack-allocations/src/lib.rs index 43440bf2ba4..5aa80e5d0aa 100644 --- a/examples/stack-allocations/src/lib.rs +++ b/examples/stack-allocations/src/lib.rs @@ -59,47 +59,7 @@ pub struct ReplyData { } #[cfg(not(feature = "std"))] -mod wasm { - use crate::{Action, HandleData, ReplyData, Vec}; - use gstd::msg; - - struct State { - actions: Vec, - } - - static mut STATE: State = State { - actions: Vec::new(), - }; - - fn do_actions(mut actions: Vec) -> u32 { - let check_sum = match actions.pop() { - Some(Action::Read) => msg::with_read_on_stack(|payload| { - payload - .map(|payload| payload.iter().fold(0u32, |acc, x| acc + *x as u32)) - .expect("Failed to read payload") - }), - Some(Action::Load) => { - let HandleData { data } = msg::load().expect("Failed to load handle config"); - data.iter().fold(0, |acc, x| acc + *x as u32) - } - None => return 0, - }; - check_sum + do_actions(actions) - } - - #[no_mangle] - extern "C" fn handle() { - let check_sum = do_actions(unsafe { STATE.actions.clone() }); - msg::reply(ReplyData { check_sum }, 0).expect("Failed to reply"); - } - - #[no_mangle] - extern "C" fn init() { - unsafe { - STATE.actions = msg::load().expect("Failed to load init config"); - } - } -} +mod wasm; #[cfg(test)] mod tests { diff --git a/examples/stack-allocations/src/wasm.rs b/examples/stack-allocations/src/wasm.rs new file mode 100644 index 00000000000..2f7876db301 --- /dev/null +++ b/examples/stack-allocations/src/wasm.rs @@ -0,0 +1,62 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! This contract recursively calls payload stack allocated read or load, +//! depends on actions vector, which is set in init. +//! For each recursion step we call check_sum, which is sum of all payload bytes. +//! Then reply summary check_sum back to source account. + +use crate::{Action, HandleData, ReplyData, Vec}; +use gstd::msg; + +struct State { + actions: Vec, +} + +static mut STATE: State = State { + actions: Vec::new(), +}; + +fn do_actions(mut actions: Vec) -> u32 { + let check_sum = match actions.pop() { + Some(Action::Read) => msg::with_read_on_stack(|payload| { + payload + .map(|payload| payload.iter().fold(0u32, |acc, x| acc + *x as u32)) + .expect("Failed to read payload") + }), + Some(Action::Load) => { + let HandleData { data } = msg::load().expect("Failed to load handle config"); + data.iter().fold(0, |acc, x| acc + *x as u32) + } + None => return 0, + }; + check_sum + do_actions(actions) +} + +#[no_mangle] +extern "C" fn handle() { + let check_sum = do_actions(unsafe { STATE.actions.clone() }); + msg::reply(ReplyData { check_sum }, 0).expect("Failed to reply"); +} + +#[no_mangle] +extern "C" fn init() { + unsafe { + STATE.actions = msg::load().expect("Failed to load init config"); + } +} diff --git a/examples/state-rollback/Cargo.toml b/examples/state-rollback/Cargo.toml index 99d46e405c5..c4d156bc250 100644 --- a/examples/state-rollback/Cargo.toml +++ b/examples/state-rollback/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/state-rollback/src/lib.rs b/examples/state-rollback/src/lib.rs index b430f5f52ca..fbc08d47a0b 100644 --- a/examples/state-rollback/src/lib.rs +++ b/examples/state-rollback/src/lib.rs @@ -27,31 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{exec, msg, prelude::*}; - - static mut PAYLOAD: Option> = None; - - #[no_mangle] - extern "C" fn handle() { - let payload = msg::load_bytes().expect("Failed to load payload"); - - // Previous value - msg::send(msg::source(), unsafe { &PAYLOAD }, 0).expect("Failed to send message"); - - let is_panic = payload == b"panic"; - let is_leave = payload == b"leave"; - - // New value setting - unsafe { PAYLOAD = Some(payload) }; - - // Newly set value - msg::reply(unsafe { &PAYLOAD }, 0).expect("Failed to send reply"); - - // Stop execution with panic. - is_panic.then(|| panic!()); - - // Stop execution with leave. - is_leave.then(|| exec::leave()); - } -} +mod wasm; diff --git a/examples/state-rollback/src/wasm.rs b/examples/state-rollback/src/wasm.rs new file mode 100644 index 00000000000..6499386ef5e --- /dev/null +++ b/examples/state-rollback/src/wasm.rs @@ -0,0 +1,44 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{exec, msg, prelude::*}; + +static mut PAYLOAD: Option> = None; + +#[no_mangle] +extern "C" fn handle() { + let payload = msg::load_bytes().expect("Failed to load payload"); + + // Previous value + msg::send(msg::source(), unsafe { &PAYLOAD }, 0).expect("Failed to send message"); + + let is_panic = payload == b"panic"; + let is_leave = payload == b"leave"; + + // New value setting + unsafe { PAYLOAD = Some(payload) }; + + // Newly set value + msg::reply(unsafe { &PAYLOAD }, 0).expect("Failed to send reply"); + + // Stop execution with panic. + is_panic.then(|| panic!()); + + // Stop execution with leave. + is_leave.then(|| exec::leave()); +} diff --git a/examples/sync-duplicate/Cargo.toml b/examples/sync-duplicate/Cargo.toml index 8f9ae9d0e87..f0d0a3adf96 100644 --- a/examples/sync-duplicate/Cargo.toml +++ b/examples/sync-duplicate/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/sync-duplicate/src/lib.rs b/examples/sync-duplicate/src/lib.rs index 745af7ac4ce..fbc08d47a0b 100644 --- a/examples/sync-duplicate/src/lib.rs +++ b/examples/sync-duplicate/src/lib.rs @@ -27,33 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{msg, prelude::*, ActorId}; - - static mut COUNTER: i32 = 0; - static mut DESTINATION: ActorId = ActorId::zero(); - - #[no_mangle] - extern "C" fn init() { - let destination = msg::load().expect("Failed to load destination"); - unsafe { DESTINATION = destination }; - } - - #[gstd::async_main] - async fn main() { - let payload = msg::load_bytes().expect("Failed to load payload"); - - if payload == b"async" { - unsafe { COUNTER += 1 }; - - let _ = msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) - .expect("Failed to send message") - .await - .expect("Received error reply"); - - msg::reply(unsafe { COUNTER }, 0).expect("Failed to send reply"); - - unsafe { COUNTER = 0 }; - } - } -} +mod wasm; diff --git a/examples/sync-duplicate/src/wasm.rs b/examples/sync-duplicate/src/wasm.rs new file mode 100644 index 00000000000..f949f4afdcd --- /dev/null +++ b/examples/sync-duplicate/src/wasm.rs @@ -0,0 +1,46 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{msg, prelude::*, ActorId}; + +static mut COUNTER: i32 = 0; +static mut DESTINATION: ActorId = ActorId::zero(); + +#[no_mangle] +extern "C" fn init() { + let destination = msg::load().expect("Failed to load destination"); + unsafe { DESTINATION = destination }; +} + +#[gstd::async_main] +async fn main() { + let payload = msg::load_bytes().expect("Failed to load payload"); + + if payload == b"async" { + unsafe { COUNTER += 1 }; + + let _ = msg::send_bytes_for_reply(unsafe { DESTINATION }, "PING", 0, 0) + .expect("Failed to send message") + .await + .expect("Received error reply"); + + msg::reply(unsafe { COUNTER }, 0).expect("Failed to send reply"); + + unsafe { COUNTER = 0 }; + } +} diff --git a/examples/sys-calls/Cargo.toml b/examples/sys-calls/Cargo.toml index ba8908b4021..1e0e64155bd 100644 --- a/examples/sys-calls/Cargo.toml +++ b/examples/sys-calls/Cargo.toml @@ -2,19 +2,18 @@ name = "test-syscalls" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -gstd = { workspace = true } -parity-scale-codec = { workspace = true, features = ["derive"] } +gstd.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] wasm-wrapper = [] diff --git a/examples/sys-calls/src/lib.rs b/examples/sys-calls/src/lib.rs index 48940fc8bbe..ea6d8473761 100644 --- a/examples/sys-calls/src/lib.rs +++ b/examples/sys-calls/src/lib.rs @@ -105,429 +105,4 @@ pub enum Kind { pub const PAY_PROGRAM_RENT_EXPECT: &str = "Unable to pay rent"; #[cfg(not(feature = "wasm-wrapper"))] -mod wasm { - use super::Kind; - use gstd::{ - errors::{ReplyCode, SignalCode, SimpleExecutionError}, - exec, format, - msg::{self, MessageHandle}, - prog, ActorId, CodeId, MessageId, ReservationId, Vec, - }; - use parity_scale_codec::Encode; - - static mut CODE_ID: CodeId = CodeId::new([0u8; 32]); - static mut SIGNAL_DETAILS: (MessageId, SignalCode, ActorId) = ( - MessageId::new([0; 32]), - SignalCode::Execution(SimpleExecutionError::Unsupported), - ActorId::zero(), - ); - static mut DO_PANIC: bool = false; - - #[no_mangle] - extern "C" fn init() { - let code_id_bytes: [u8; 32] = msg::load().expect("internal error: invalid payload"); - - unsafe { CODE_ID = code_id_bytes.into() }; - } - - #[no_mangle] - extern "C" fn handle() { - let syscall_kinds: Vec = msg::load().expect("internal error: invalid payload"); - for syscall_kind in syscall_kinds { - process(syscall_kind); - } - - // Report test executed successfully - msg::send_delayed(msg::source(), b"ok", 0, 0).expect("internal error: report send failed"); - } - - fn process(syscall_kind: Kind) { - match syscall_kind { - Kind::CreateProgram(salt, gas_opt, (expected_mid, expected_pid)) => { - let salt = salt.to_le_bytes(); - let res = match gas_opt { - Some(gas) => prog::create_program_bytes_with_gas_delayed( - unsafe { CODE_ID }, - salt, - "payload", - gas, - 0, - 0, - ), - None => prog::create_program_bytes_delayed( - unsafe { CODE_ID }, - salt, - "payload", - 0, - 0, - ), - }; - let (actual_mid, actual_pid) = res.expect("internal error: create program failed"); - let actual_mid: [u8; 32] = actual_mid.into(); - let actual_pid: [u8; 32] = actual_pid.into(); - assert_eq!( - expected_mid, actual_mid, - "Kind::CreateProgram: mid test failed" - ); - assert_eq!( - expected_pid, actual_pid, - "Kind::CreateProgram: pid test failed" - ); - } - Kind::Error(message_value, expected_err) => { - let actual_err = msg::reply(b"", message_value).expect_err("not enough balance"); - assert_eq!( - expected_err, - format!("{actual_err}"), - "Kind::Error: test failed" - ); - } - Kind::Send(gas_opt, expected_mid) => { - let actual_mid_res = match gas_opt { - Some(gas) => msg::send_with_gas_delayed(msg::source(), b"payload", gas, 0, 0), - None => msg::send_delayed(msg::source(), b"payload", 0, 0), - }; - assert_eq!( - Ok(expected_mid.into()), - actual_mid_res, - "Kind::Send: mid test failed" - ); - } - Kind::SendInput(gas_opt, expected_mid) => { - let actual_mid_res = match gas_opt { - Some(gas) => msg::send_input_with_gas_delayed(msg::source(), gas, 0, .., 0), - None => msg::send_input_delayed(msg::source(), 0, .., 0), - }; - assert_eq!( - Ok(expected_mid.into()), - actual_mid_res, - "Kind::SendInput: mid test failed" - ); - } - Kind::SendPushInput(expected_mid) => { - // Sending these 2 to increase internal handler returned by `send_init`. - let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); - let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); - - let handle = MessageHandle::init().expect("internal error: failed send init"); - - // check handle - handle - .push_input(0..) - .expect("internal error: push_input failed"); - - let actual_mid_res = handle.commit_delayed(msg::source(), 0, 0); - assert_eq!( - Ok(expected_mid.into()), - actual_mid_res, - "Kind::SendPushInput: mid test failed" - ); - } - Kind::SendRaw(payload, gas_opt, expected_mid) => { - // Sending these 2 to increase internal handler returned by `send_init`. - let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); - let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); - - let handle = MessageHandle::init().expect("internal error: failed send init"); - // check handle - handle - .push(payload) - .expect("internal error: failed send_push"); - let actual_mid_res = match gas_opt { - Some(gas) => handle.commit_with_gas_delayed(msg::source(), gas, 0, 0), - None => handle.commit_delayed(msg::source(), 0, 0), - }; - assert_eq!( - Ok(expected_mid.into()), - actual_mid_res, - "Kind::SendRaw: mid test failed" - ); - } - Kind::Size(expected_size) => { - let actual_size = msg::size(); - assert_eq!( - expected_size as usize, actual_size, - "Kind::Size: size test failed" - ); - } - Kind::MessageId(expected_mid) => { - let actual_mid: [u8; 32] = msg::id().into(); - assert_eq!(expected_mid, actual_mid, "Kind::MessageId: mid test failed"); - } - Kind::PayProgramRent(program_id, rent, expected) => { - let (unused_value, paid_block_count) = - exec::pay_program_rent(program_id.into(), rent) - .expect(super::PAY_PROGRAM_RENT_EXPECT); - if let Some((expected_unused_value, expected_paid_block_count)) = expected { - assert_eq!(unused_value, expected_unused_value); - assert_eq!(paid_block_count, expected_paid_block_count); - } - } - Kind::ProgramId(expected_pid) => { - let actual_pid: [u8; 32] = exec::program_id().into(); - assert_eq!(expected_pid, actual_pid, "Kind::ProgramId: pid test failed"); - } - Kind::Source(expected_actor) => { - let actual_actor: [u8; 32] = msg::source().into(); - assert_eq!( - expected_actor, actual_actor, - "Kind::Source: actor test failed" - ); - } - Kind::Value(expected_value) => { - let actual_value = msg::value(); - assert_eq!( - expected_value, actual_value, - "Kind::Value: value test failed" - ); - } - Kind::ValueAvailable(expected_value) => { - let _ = msg::send_delayed(msg::source(), b"payload", 2000, 0); - let actual_value = exec::value_available(); - assert_eq!( - expected_value, actual_value, - "Kind::ValueAvailable: value test failed" - ); - } - Kind::Reply(gas_opt, expected_mid) => { - let actual_mid_res = match gas_opt { - Some(gas) => msg::reply_with_gas(b"payload", gas, 0), - None => msg::reply(b"payload", 0), - }; - assert_eq!( - Ok(expected_mid.into()), - actual_mid_res, - "Kind::Reply: mid test failed" - ); - } - Kind::ReplyRaw(payload, gas_opt, expected_mid) => { - msg::reply_push(payload).expect("internal error: failed reply push"); - let actual_mid_res = match gas_opt { - Some(gas) => msg::reply_commit_with_gas(gas, 0), - None => msg::reply_commit(0), - }; - assert_eq!( - Ok(expected_mid.into()), - actual_mid_res, - "Kind::ReplyRaw: mid test failed" - ); - } - Kind::ReplyInput(gas_opt, expected_mid) => { - let actual_mid_res = match gas_opt { - Some(gas) => msg::reply_input_with_gas(gas, 0, ..), - None => msg::reply_input(0, ..), - }; - assert_eq!( - Ok(expected_mid.into()), - actual_mid_res, - "Kind::ReplyInput: mid test failed" - ); - } - Kind::ReplyPushInput(expected_mid) => { - msg::reply_push_input(..).expect("internal error: reply_push_input failed"); - let actual_mid_res = msg::reply_commit(0); - assert_eq!( - Ok(expected_mid.into()), - actual_mid_res, - "Kind::ReplyPushInput: mid test failed" - ); - } - Kind::ReplyDetails(..) => { - // Actual test in handle reply, here just sends a reply - let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); - // To prevent from sending to mailbox "ok" message - exec::leave(); - } - Kind::SignalDetails => { - if unsafe { DO_PANIC } { - // issue a signal - panic!(); - } else { - unsafe { - SIGNAL_DETAILS = ( - msg::id(), - SignalCode::Execution(SimpleExecutionError::UserspacePanic), - msg::source(), - ); - DO_PANIC = true; - } - exec::system_reserve_gas(1_000_000_000).unwrap(); - let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); - exec::wait_for(2); - } - } - Kind::SignalDetailsWake => { - panic!("must be called in handle_reply"); - } - Kind::BlockHeight(expected_height) => { - let actual_height = exec::block_height(); - assert_eq!( - expected_height, actual_height, - "Kind::BlockHeight:: block height test failed" - ); - } - Kind::BlockTimestamp(expected_timestamp) => { - let actual_timestamp = exec::block_timestamp(); - assert_eq!( - expected_timestamp, actual_timestamp, - "Kind::BlockTimestamp:: block timestamp test failed" - ); - } - Kind::Reserve(expected_id) => { - // do 2 reservations to increase internal nonce - let _ = ReservationId::reserve(10_000, 3); - let _ = ReservationId::reserve(20_000, 5); - let actual_id = - ReservationId::reserve(30_000, 7).expect("internal error: reservation failed"); - assert_eq!( - expected_id, - actual_id.encode(), - "Kind::Reserve: reserve gas test failed" - ); - } - Kind::Unreserve(expected_amount) => { - let reservation = ReservationId::reserve(expected_amount, 3) - .expect("internal error: reservation failed"); - let actual_amount = reservation.unreserve(); - assert_eq!( - Ok(expected_amount), - actual_amount, - "Kind::Unreserve: unreserve gas test failed" - ); - } - Kind::Random(salt, (expected_hash, expected_bn)) => { - let (actual_hash, actual_bn) = - exec::random(salt).expect("internal error: random call failed"); - assert_eq!(expected_hash, actual_hash, "Kind::Random: hash test failed"); - assert_eq!(expected_bn, actual_bn, "Kind::Random: bn test failed"); - } - Kind::GasAvailable(lower, upper) => { - let gas_available = exec::gas_available(); - assert!( - gas_available >= lower, - "Kind::GasAvailable: lower bound test failed" - ); - assert!( - gas_available <= upper, - "Kind::GasAvailable: upper bound test failed" - ); - } - Kind::ReservationSend(expected_mid) => { - let reservation_id = - ReservationId::reserve(25_000_000_000, 1).expect("reservation failed"); - let actual_mid = msg::send_bytes_delayed_from_reservation( - reservation_id, - msg::source(), - b"", - 0, - 0, - ); - assert_eq!( - Ok(expected_mid.into()), - actual_mid, - "Kind::ReservationSend: mid test failed" - ); - } - Kind::ReservationSendRaw(payload, expected_mid) => { - let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); - let reservation_id = - ReservationId::reserve(25_000_000_000, 1).expect("reservation failed"); - - let handle = MessageHandle::init().expect("internal error: failed send init"); - // check handle - handle - .push(payload) - .expect("internal error: failed send_push"); - let actual_mid = - handle.commit_delayed_from_reservation(reservation_id, msg::source(), 0, 0); - assert_eq!( - Ok(expected_mid.into()), - actual_mid, - "Kind::ReservationSendRaw: mid test failed" - ); - } - Kind::ReservationReply(expected_mid) => { - let reservation_id = - ReservationId::reserve(25_000_000_000, 1).expect("reservation failed"); - let actual_mid = msg::reply_bytes_from_reservation(reservation_id, b"", 0); - assert_eq!( - Ok(expected_mid.into()), - actual_mid, - "Kind::ReservationReply: mid test failed" - ); - } - Kind::ReservationReplyCommit(payload, expected_mid) => { - let reservation_id = - ReservationId::reserve(25_000_000_000, 1).expect("reservation failed"); - msg::reply_push(payload).expect("internal error: failed reply push"); - let actual_mid = msg::reply_commit_from_reservation(reservation_id, 0); - assert_eq!( - Ok(expected_mid.into()), - actual_mid, - "Kind::ReservationReplyCommit: mid test failed" - ); - } - Kind::SystemReserveGas(amount) => { - exec::system_reserve_gas(amount).expect("Kind::SystemReserveGas: call test failed"); - // The only case with wait, so we send report before ending execution, instead of - // waking the message - msg::send_delayed(msg::source(), b"ok", 0, 0) - .expect("internal error: report send failed"); - exec::wait_for(2); - } - Kind::ReplyDeposit(amount) => { - let mid = msg::send_bytes(ActorId::zero(), [], 0) - .expect("internal error: failed to send message"); - - exec::reply_deposit(mid, amount).expect("Kind::ReplyDeposit: call test failed"); - } - } - } - - #[no_mangle] - extern "C" fn handle_reply() { - match msg::load() { - Ok(Kind::ReplyDetails(expected_reply_to, expected_reply_code_bytes)) => { - let expected_reply_code = ReplyCode::from_bytes(expected_reply_code_bytes); - let actual_reply_to = msg::reply_to(); - assert_eq!( - Ok(expected_reply_to.into()), - actual_reply_to, - "Kind::ReplyDetails: reply_to test failed" - ); - let actual_reply_code = msg::reply_code(); - assert_eq!( - Ok(expected_reply_code), - actual_reply_code, - "Kind::ReplyDetails: reply code test failed" - ); - - // Report test executed successfully - msg::send_delayed(msg::source(), b"ok", 0, 0) - .expect("internal error: report send failed"); - } - Ok(Kind::SignalDetailsWake) => unsafe { - exec::wake(SIGNAL_DETAILS.0).unwrap(); - }, - _ => panic!("internal error: invalid payload for `handle_reply`"), - } - } - - #[no_mangle] - extern "C" fn handle_signal() { - let (signal_from, signal_code, source) = unsafe { SIGNAL_DETAILS }; - - assert_eq!( - msg::signal_code(), - Ok(Some(signal_code)), - "Kind::SignalDetails: status code test failed" - ); - assert_eq!( - msg::signal_from(), - Ok(signal_from), - "Kind::SignalDetails: signal_from test failed" - ); - - msg::send_delayed(source, b"ok", 0, 0).expect("internal error: report send failed"); - } -} +mod wasm; diff --git a/examples/sys-calls/src/wasm.rs b/examples/sys-calls/src/wasm.rs new file mode 100644 index 00000000000..06a194c8fdc --- /dev/null +++ b/examples/sys-calls/src/wasm.rs @@ -0,0 +1,432 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::Kind; +use gstd::{ + errors::{ReplyCode, SignalCode, SimpleExecutionError}, + exec, format, + msg::{self, MessageHandle}, + prog, ActorId, CodeId, MessageId, ReservationId, Vec, +}; +use parity_scale_codec::Encode; + +static mut CODE_ID: CodeId = CodeId::new([0u8; 32]); +static mut SIGNAL_DETAILS: (MessageId, SignalCode, ActorId) = ( + MessageId::new([0; 32]), + SignalCode::Execution(SimpleExecutionError::Unsupported), + ActorId::zero(), +); +static mut DO_PANIC: bool = false; + +#[no_mangle] +extern "C" fn init() { + let code_id_bytes: [u8; 32] = msg::load().expect("internal error: invalid payload"); + + unsafe { CODE_ID = code_id_bytes.into() }; +} + +#[no_mangle] +extern "C" fn handle() { + let syscall_kinds: Vec = msg::load().expect("internal error: invalid payload"); + for syscall_kind in syscall_kinds { + process(syscall_kind); + } + + // Report test executed successfully + msg::send_delayed(msg::source(), b"ok", 0, 0).expect("internal error: report send failed"); +} + +fn process(syscall_kind: Kind) { + match syscall_kind { + Kind::CreateProgram(salt, gas_opt, (expected_mid, expected_pid)) => { + let salt = salt.to_le_bytes(); + let res = match gas_opt { + Some(gas) => prog::create_program_bytes_with_gas_delayed( + unsafe { CODE_ID }, + salt, + "payload", + gas, + 0, + 0, + ), + None => { + prog::create_program_bytes_delayed(unsafe { CODE_ID }, salt, "payload", 0, 0) + } + }; + let (actual_mid, actual_pid) = res.expect("internal error: create program failed"); + let actual_mid: [u8; 32] = actual_mid.into(); + let actual_pid: [u8; 32] = actual_pid.into(); + assert_eq!( + expected_mid, actual_mid, + "Kind::CreateProgram: mid test failed" + ); + assert_eq!( + expected_pid, actual_pid, + "Kind::CreateProgram: pid test failed" + ); + } + Kind::Error(message_value, expected_err) => { + let actual_err = msg::reply(b"", message_value).expect_err("not enough balance"); + assert_eq!( + expected_err, + format!("{actual_err}"), + "Kind::Error: test failed" + ); + } + Kind::Send(gas_opt, expected_mid) => { + let actual_mid_res = match gas_opt { + Some(gas) => msg::send_with_gas_delayed(msg::source(), b"payload", gas, 0, 0), + None => msg::send_delayed(msg::source(), b"payload", 0, 0), + }; + assert_eq!( + Ok(expected_mid.into()), + actual_mid_res, + "Kind::Send: mid test failed" + ); + } + Kind::SendInput(gas_opt, expected_mid) => { + let actual_mid_res = match gas_opt { + Some(gas) => msg::send_input_with_gas_delayed(msg::source(), gas, 0, .., 0), + None => msg::send_input_delayed(msg::source(), 0, .., 0), + }; + assert_eq!( + Ok(expected_mid.into()), + actual_mid_res, + "Kind::SendInput: mid test failed" + ); + } + Kind::SendPushInput(expected_mid) => { + // Sending these 2 to increase internal handler returned by `send_init`. + let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); + let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); + + let handle = MessageHandle::init().expect("internal error: failed send init"); + + // check handle + handle + .push_input(0..) + .expect("internal error: push_input failed"); + + let actual_mid_res = handle.commit_delayed(msg::source(), 0, 0); + assert_eq!( + Ok(expected_mid.into()), + actual_mid_res, + "Kind::SendPushInput: mid test failed" + ); + } + Kind::SendRaw(payload, gas_opt, expected_mid) => { + // Sending these 2 to increase internal handler returned by `send_init`. + let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); + let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); + + let handle = MessageHandle::init().expect("internal error: failed send init"); + // check handle + handle + .push(payload) + .expect("internal error: failed send_push"); + let actual_mid_res = match gas_opt { + Some(gas) => handle.commit_with_gas_delayed(msg::source(), gas, 0, 0), + None => handle.commit_delayed(msg::source(), 0, 0), + }; + assert_eq!( + Ok(expected_mid.into()), + actual_mid_res, + "Kind::SendRaw: mid test failed" + ); + } + Kind::Size(expected_size) => { + let actual_size = msg::size(); + assert_eq!( + expected_size as usize, actual_size, + "Kind::Size: size test failed" + ); + } + Kind::MessageId(expected_mid) => { + let actual_mid: [u8; 32] = msg::id().into(); + assert_eq!(expected_mid, actual_mid, "Kind::MessageId: mid test failed"); + } + Kind::PayProgramRent(program_id, rent, expected) => { + let (unused_value, paid_block_count) = exec::pay_program_rent(program_id.into(), rent) + .expect(super::PAY_PROGRAM_RENT_EXPECT); + if let Some((expected_unused_value, expected_paid_block_count)) = expected { + assert_eq!(unused_value, expected_unused_value); + assert_eq!(paid_block_count, expected_paid_block_count); + } + } + Kind::ProgramId(expected_pid) => { + let actual_pid: [u8; 32] = exec::program_id().into(); + assert_eq!(expected_pid, actual_pid, "Kind::ProgramId: pid test failed"); + } + Kind::Source(expected_actor) => { + let actual_actor: [u8; 32] = msg::source().into(); + assert_eq!( + expected_actor, actual_actor, + "Kind::Source: actor test failed" + ); + } + Kind::Value(expected_value) => { + let actual_value = msg::value(); + assert_eq!( + expected_value, actual_value, + "Kind::Value: value test failed" + ); + } + Kind::ValueAvailable(expected_value) => { + let _ = msg::send_delayed(msg::source(), b"payload", 2000, 0); + let actual_value = exec::value_available(); + assert_eq!( + expected_value, actual_value, + "Kind::ValueAvailable: value test failed" + ); + } + Kind::Reply(gas_opt, expected_mid) => { + let actual_mid_res = match gas_opt { + Some(gas) => msg::reply_with_gas(b"payload", gas, 0), + None => msg::reply(b"payload", 0), + }; + assert_eq!( + Ok(expected_mid.into()), + actual_mid_res, + "Kind::Reply: mid test failed" + ); + } + Kind::ReplyRaw(payload, gas_opt, expected_mid) => { + msg::reply_push(payload).expect("internal error: failed reply push"); + let actual_mid_res = match gas_opt { + Some(gas) => msg::reply_commit_with_gas(gas, 0), + None => msg::reply_commit(0), + }; + assert_eq!( + Ok(expected_mid.into()), + actual_mid_res, + "Kind::ReplyRaw: mid test failed" + ); + } + Kind::ReplyInput(gas_opt, expected_mid) => { + let actual_mid_res = match gas_opt { + Some(gas) => msg::reply_input_with_gas(gas, 0, ..), + None => msg::reply_input(0, ..), + }; + assert_eq!( + Ok(expected_mid.into()), + actual_mid_res, + "Kind::ReplyInput: mid test failed" + ); + } + Kind::ReplyPushInput(expected_mid) => { + msg::reply_push_input(..).expect("internal error: reply_push_input failed"); + let actual_mid_res = msg::reply_commit(0); + assert_eq!( + Ok(expected_mid.into()), + actual_mid_res, + "Kind::ReplyPushInput: mid test failed" + ); + } + Kind::ReplyDetails(..) => { + // Actual test in handle reply, here just sends a reply + let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); + // To prevent from sending to mailbox "ok" message + exec::leave(); + } + Kind::SignalDetails => { + if unsafe { DO_PANIC } { + // issue a signal + panic!(); + } else { + unsafe { + SIGNAL_DETAILS = ( + msg::id(), + SignalCode::Execution(SimpleExecutionError::UserspacePanic), + msg::source(), + ); + DO_PANIC = true; + } + exec::system_reserve_gas(1_000_000_000).unwrap(); + let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); + exec::wait_for(2); + } + } + Kind::SignalDetailsWake => { + panic!("must be called in handle_reply"); + } + Kind::BlockHeight(expected_height) => { + let actual_height = exec::block_height(); + assert_eq!( + expected_height, actual_height, + "Kind::BlockHeight:: block height test failed" + ); + } + Kind::BlockTimestamp(expected_timestamp) => { + let actual_timestamp = exec::block_timestamp(); + assert_eq!( + expected_timestamp, actual_timestamp, + "Kind::BlockTimestamp:: block timestamp test failed" + ); + } + Kind::Reserve(expected_id) => { + // do 2 reservations to increase internal nonce + let _ = ReservationId::reserve(10_000, 3); + let _ = ReservationId::reserve(20_000, 5); + let actual_id = + ReservationId::reserve(30_000, 7).expect("internal error: reservation failed"); + assert_eq!( + expected_id, + actual_id.encode(), + "Kind::Reserve: reserve gas test failed" + ); + } + Kind::Unreserve(expected_amount) => { + let reservation = ReservationId::reserve(expected_amount, 3) + .expect("internal error: reservation failed"); + let actual_amount = reservation.unreserve(); + assert_eq!( + Ok(expected_amount), + actual_amount, + "Kind::Unreserve: unreserve gas test failed" + ); + } + Kind::Random(salt, (expected_hash, expected_bn)) => { + let (actual_hash, actual_bn) = + exec::random(salt).expect("internal error: random call failed"); + assert_eq!(expected_hash, actual_hash, "Kind::Random: hash test failed"); + assert_eq!(expected_bn, actual_bn, "Kind::Random: bn test failed"); + } + Kind::GasAvailable(lower, upper) => { + let gas_available = exec::gas_available(); + assert!( + gas_available >= lower, + "Kind::GasAvailable: lower bound test failed" + ); + assert!( + gas_available <= upper, + "Kind::GasAvailable: upper bound test failed" + ); + } + Kind::ReservationSend(expected_mid) => { + let reservation_id = + ReservationId::reserve(25_000_000_000, 1).expect("reservation failed"); + let actual_mid = + msg::send_bytes_delayed_from_reservation(reservation_id, msg::source(), b"", 0, 0); + assert_eq!( + Ok(expected_mid.into()), + actual_mid, + "Kind::ReservationSend: mid test failed" + ); + } + Kind::ReservationSendRaw(payload, expected_mid) => { + let _ = msg::send_delayed(msg::source(), b"payload", 0, 0); + let reservation_id = + ReservationId::reserve(25_000_000_000, 1).expect("reservation failed"); + + let handle = MessageHandle::init().expect("internal error: failed send init"); + // check handle + handle + .push(payload) + .expect("internal error: failed send_push"); + let actual_mid = + handle.commit_delayed_from_reservation(reservation_id, msg::source(), 0, 0); + assert_eq!( + Ok(expected_mid.into()), + actual_mid, + "Kind::ReservationSendRaw: mid test failed" + ); + } + Kind::ReservationReply(expected_mid) => { + let reservation_id = + ReservationId::reserve(25_000_000_000, 1).expect("reservation failed"); + let actual_mid = msg::reply_bytes_from_reservation(reservation_id, b"", 0); + assert_eq!( + Ok(expected_mid.into()), + actual_mid, + "Kind::ReservationReply: mid test failed" + ); + } + Kind::ReservationReplyCommit(payload, expected_mid) => { + let reservation_id = + ReservationId::reserve(25_000_000_000, 1).expect("reservation failed"); + msg::reply_push(payload).expect("internal error: failed reply push"); + let actual_mid = msg::reply_commit_from_reservation(reservation_id, 0); + assert_eq!( + Ok(expected_mid.into()), + actual_mid, + "Kind::ReservationReplyCommit: mid test failed" + ); + } + Kind::SystemReserveGas(amount) => { + exec::system_reserve_gas(amount).expect("Kind::SystemReserveGas: call test failed"); + // The only case with wait, so we send report before ending execution, instead of + // waking the message + msg::send_delayed(msg::source(), b"ok", 0, 0) + .expect("internal error: report send failed"); + exec::wait_for(2); + } + Kind::ReplyDeposit(amount) => { + let mid = msg::send_bytes(ActorId::zero(), [], 0) + .expect("internal error: failed to send message"); + + exec::reply_deposit(mid, amount).expect("Kind::ReplyDeposit: call test failed"); + } + } +} + +#[no_mangle] +extern "C" fn handle_reply() { + match msg::load() { + Ok(Kind::ReplyDetails(expected_reply_to, expected_reply_code_bytes)) => { + let expected_reply_code = ReplyCode::from_bytes(expected_reply_code_bytes); + let actual_reply_to = msg::reply_to(); + assert_eq!( + Ok(expected_reply_to.into()), + actual_reply_to, + "Kind::ReplyDetails: reply_to test failed" + ); + let actual_reply_code = msg::reply_code(); + assert_eq!( + Ok(expected_reply_code), + actual_reply_code, + "Kind::ReplyDetails: reply code test failed" + ); + + // Report test executed successfully + msg::send_delayed(msg::source(), b"ok", 0, 0) + .expect("internal error: report send failed"); + } + Ok(Kind::SignalDetailsWake) => unsafe { + exec::wake(SIGNAL_DETAILS.0).unwrap(); + }, + _ => panic!("internal error: invalid payload for `handle_reply`"), + } +} + +#[no_mangle] +extern "C" fn handle_signal() { + let (signal_from, signal_code, source) = unsafe { SIGNAL_DETAILS }; + + assert_eq!( + msg::signal_code(), + Ok(Some(signal_code)), + "Kind::SignalDetails: status code test failed" + ); + assert_eq!( + msg::signal_from(), + Ok(signal_from), + "Kind::SignalDetails: signal_from test failed" + ); + + msg::send_delayed(source, b"ok", 0, 0).expect("internal error: report send failed"); +} diff --git a/examples/syscall-error/Cargo.toml b/examples/syscall-error/Cargo.toml index 885b3139f81..b454bad67bc 100644 --- a/examples/syscall-error/Cargo.toml +++ b/examples/syscall-error/Cargo.toml @@ -2,12 +2,13 @@ name = "demo-syscall-error" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true gstd.workspace = true gsys.workspace = true @@ -17,8 +18,6 @@ gear-wasm-builder.workspace = true [dev-dependencies] gtest.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std"] diff --git a/examples/syscall-error/src/lib.rs b/examples/syscall-error/src/lib.rs index a22dca29e2e..216ee1b7aa1 100644 --- a/examples/syscall-error/src/lib.rs +++ b/examples/syscall-error/src/lib.rs @@ -18,8 +18,6 @@ #![cfg_attr(not(feature = "std"), no_std)] -use gstd::{msg, prelude::*, ActorId}; - #[cfg(feature = "std")] mod code { include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); @@ -27,18 +25,9 @@ mod code { #[cfg(feature = "std")] pub use code::WASM_BINARY_OPT as WASM_BINARY; -use gstd::errors::{Error, ExtError, MessageError}; - -#[no_mangle] -extern "C" fn init() { - let res = msg::send(ActorId::default(), "dummy", 250); - assert_eq!( - res, - Err(Error::Core( - ExtError::Message(MessageError::InsufficientValue).into() - )) - ); -} + +#[cfg(not(feature = "std"))] +mod wasm; #[cfg(test)] mod tests { diff --git a/examples/syscall-error/src/wasm.rs b/examples/syscall-error/src/wasm.rs new file mode 100644 index 00000000000..74a45d9a3aa --- /dev/null +++ b/examples/syscall-error/src/wasm.rs @@ -0,0 +1,35 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{ + errors::{Error, ExtError, MessageError}, + msg, + prelude::*, + ActorId, +}; + +#[no_mangle] +extern "C" fn init() { + let res = msg::send(ActorId::default(), "dummy", 250); + assert_eq!( + res, + Err(Error::Core( + ExtError::Message(MessageError::InsufficientValue).into() + )) + ); +} diff --git a/examples/vec/Cargo.toml b/examples/vec/Cargo.toml index 1d9d8417fba..176929ad803 100644 --- a/examples/vec/Cargo.toml +++ b/examples/vec/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd = { workspace = true, features = ["debug"] } diff --git a/examples/vec/src/lib.rs b/examples/vec/src/lib.rs index 90ea46965f4..fbc08d47a0b 100644 --- a/examples/vec/src/lib.rs +++ b/examples/vec/src/lib.rs @@ -27,39 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{debug, msg, prelude::*}; - - static mut MESSAGE_LOG: Vec = vec![]; - - #[no_mangle] - extern "C" fn handle() { - let size = msg::load::().expect("Failed to load `i32`") as usize; - - let request = format!("Request: size = {size}"); - - debug!("{request}"); - unsafe { MESSAGE_LOG.push(request) }; - - let vec = vec![42u8; size]; - let last_idx = size - 1; - - debug!("vec.len() = {:?}", vec.len()); - debug!( - "vec[{last_idx}]: {:p} -> {:#04x}", - &vec[last_idx], vec[last_idx] - ); - - msg::reply(size as i32, 0).expect("Failed to send reply"); - - // The test idea is to allocate two wasm pages and check this allocation, - // so we must skip `v` destruction. - core::mem::forget(vec); - - let requests_amount = unsafe { MESSAGE_LOG.len() }; - debug!("Total requests amount: {requests_amount}"); - unsafe { - MESSAGE_LOG.iter().for_each(|log| debug!("{log}")); - } - } -} +mod wasm; diff --git a/examples/vec/src/wasm.rs b/examples/vec/src/wasm.rs new file mode 100644 index 00000000000..fe0eeb50827 --- /dev/null +++ b/examples/vec/src/wasm.rs @@ -0,0 +1,52 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{debug, msg, prelude::*}; + +static mut MESSAGE_LOG: Vec = vec![]; + +#[no_mangle] +extern "C" fn handle() { + let size = msg::load::().expect("Failed to load `i32`") as usize; + + let request = format!("Request: size = {size}"); + + debug!("{request}"); + unsafe { MESSAGE_LOG.push(request) }; + + let vec = vec![42u8; size]; + let last_idx = size - 1; + + debug!("vec.len() = {:?}", vec.len()); + debug!( + "vec[{last_idx}]: {:p} -> {:#04x}", + &vec[last_idx], vec[last_idx] + ); + + msg::reply(size as i32, 0).expect("Failed to send reply"); + + // The test idea is to allocate two wasm pages and check this allocation, + // so we must skip `v` destruction. + core::mem::forget(vec); + + let requests_amount = unsafe { MESSAGE_LOG.len() }; + debug!("Total requests amount: {requests_amount}"); + unsafe { + MESSAGE_LOG.iter().for_each(|log| debug!("{log}")); + } +} diff --git a/examples/wait-timeout/Cargo.toml b/examples/wait-timeout/Cargo.toml index dcd5f2521bd..c1e7c4e47a0 100644 --- a/examples/wait-timeout/Cargo.toml +++ b/examples/wait-timeout/Cargo.toml @@ -2,22 +2,19 @@ name = "demo-wait-timeout" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } gstd.workspace = true -futures = { version = "0.3", default-features = false, features = ["alloc"] } +futures.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[dev-dependencies] - -[lib] - [features] debug = ["gstd/debug"] std = ["parity-scale-codec/std"] diff --git a/examples/wait-timeout/src/lib.rs b/examples/wait-timeout/src/lib.rs index 51c746d1082..2d9e85303aa 100644 --- a/examples/wait-timeout/src/lib.rs +++ b/examples/wait-timeout/src/lib.rs @@ -30,9 +30,7 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - include! {"./code.rs"} -} +mod wasm; // Re-exports for testing pub fn default_wait_up_to_duration() -> u32 { diff --git a/examples/wait-timeout/src/code.rs b/examples/wait-timeout/src/wasm.rs similarity index 84% rename from examples/wait-timeout/src/code.rs rename to examples/wait-timeout/src/wasm.rs index 7f0ff9e13ba..6bb31bafdbf 100644 --- a/examples/wait-timeout/src/code.rs +++ b/examples/wait-timeout/src/wasm.rs @@ -1,5 +1,22 @@ -use crate::Command; +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::Command; use futures::future; use gstd::{exec, msg, MessageId}; diff --git a/examples/wait/Cargo.toml b/examples/wait/Cargo.toml index 172e9f4cc06..1ef9502fc9c 100644 --- a/examples/wait/Cargo.toml +++ b/examples/wait/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true diff --git a/examples/wait/src/lib.rs b/examples/wait/src/lib.rs index 72b8ae64946..fbc08d47a0b 100644 --- a/examples/wait/src/lib.rs +++ b/examples/wait/src/lib.rs @@ -27,40 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - // for panic/oom handlers - extern crate gstd; - - use gcore::{exec, msg, MessageId}; - - static mut STATE: u32 = 0; - static mut MSG_ID_1: MessageId = MessageId::zero(); - static mut MSG_ID_2: MessageId = MessageId::zero(); - - #[no_mangle] - extern "C" fn handle() { - let state = unsafe { &mut STATE }; - gstd::debug!("{state}"); - - match *state { - 0 => { - *state = 1; - unsafe { MSG_ID_1 = msg::id() }; - exec::wait(); - } - 1 => { - *state = 2; - unsafe { MSG_ID_2 = msg::id() }; - exec::wait(); - } - 2 => { - *state = 3; - exec::wake(unsafe { MSG_ID_1 }).unwrap(); - exec::wake(unsafe { MSG_ID_2 }).unwrap(); - } - _ => { - msg::send(msg::source(), msg::id().as_slice(), 0).unwrap(); - } - } - } -} +mod wasm; diff --git a/examples/wait/src/wasm.rs b/examples/wait/src/wasm.rs new file mode 100644 index 00000000000..b6c0a6afafc --- /dev/null +++ b/examples/wait/src/wasm.rs @@ -0,0 +1,53 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// for panic/oom handlers +extern crate gstd; + +use gcore::{exec, msg, MessageId}; + +static mut STATE: u32 = 0; +static mut MSG_ID_1: MessageId = MessageId::zero(); +static mut MSG_ID_2: MessageId = MessageId::zero(); + +#[no_mangle] +extern "C" fn handle() { + let state = unsafe { &mut STATE }; + gstd::debug!("{state}"); + + match *state { + 0 => { + *state = 1; + unsafe { MSG_ID_1 = msg::id() }; + exec::wait(); + } + 1 => { + *state = 2; + unsafe { MSG_ID_2 = msg::id() }; + exec::wait(); + } + 2 => { + *state = 3; + exec::wake(unsafe { MSG_ID_1 }).unwrap(); + exec::wake(unsafe { MSG_ID_2 }).unwrap(); + } + _ => { + msg::send(msg::source(), msg::id().as_slice(), 0).unwrap(); + } + } +} diff --git a/examples/wait_wake/Cargo.toml b/examples/wait_wake/Cargo.toml index 0f23aad78dc..b92655788c4 100644 --- a/examples/wait_wake/Cargo.toml +++ b/examples/wait_wake/Cargo.toml @@ -4,11 +4,12 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true -parity-scale-codec = { workspace = true, features = ["derive"] } +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true diff --git a/examples/wait_wake/src/lib.rs b/examples/wait_wake/src/lib.rs index fd86d83b2d5..cbfe0514f7f 100644 --- a/examples/wait_wake/src/lib.rs +++ b/examples/wait_wake/src/lib.rs @@ -35,41 +35,7 @@ pub enum Request { } #[cfg(not(feature = "std"))] -mod wasm { - use super::*; - use gstd::{collections::BTreeMap, exec, msg, prelude::*, MessageId}; - - static mut ECHOES: Option> = None; - - fn process_request(request: Request) { - match request { - Request::EchoWait(n) => { - unsafe { - ECHOES - .get_or_insert_with(BTreeMap::new) - .insert(msg::id(), n) - }; - exec::wait(); - } - Request::Wake(id) => exec::wake(id.into()).unwrap(), - } - } - - #[no_mangle] - extern "C" fn init() { - msg::reply((), 0).unwrap(); - } - - #[no_mangle] - extern "C" fn handle() { - if let Some(reply) = unsafe { ECHOES.get_or_insert_with(BTreeMap::new).remove(&msg::id()) } - { - msg::reply(reply, 0).unwrap(); - } else { - msg::load::().map(process_request).unwrap(); - } - } -} +mod wasm; #[cfg(test)] mod tests { diff --git a/examples/wait_wake/src/wasm.rs b/examples/wait_wake/src/wasm.rs new file mode 100644 index 00000000000..a4cd16f8ed2 --- /dev/null +++ b/examples/wait_wake/src/wasm.rs @@ -0,0 +1,50 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use crate::Request; +use gstd::{collections::BTreeMap, exec, msg, prelude::*, MessageId}; + +static mut ECHOES: Option> = None; + +fn process_request(request: Request) { + match request { + Request::EchoWait(n) => { + unsafe { + ECHOES + .get_or_insert_with(BTreeMap::new) + .insert(msg::id(), n) + }; + exec::wait(); + } + Request::Wake(id) => exec::wake(id.into()).unwrap(), + } +} + +#[no_mangle] +extern "C" fn init() { + msg::reply((), 0).unwrap(); +} + +#[no_mangle] +extern "C" fn handle() { + if let Some(reply) = unsafe { ECHOES.get_or_insert_with(BTreeMap::new).remove(&msg::id()) } { + msg::reply(reply, 0).unwrap(); + } else { + msg::load::().map(process_request).unwrap(); + } +} diff --git a/examples/waiter/Cargo.toml b/examples/waiter/Cargo.toml index 3090fc3f7a0..546e34a37f7 100644 --- a/examples/waiter/Cargo.toml +++ b/examples/waiter/Cargo.toml @@ -4,13 +4,14 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] -parity-scale-codec = { workspace = true, features = ["derive"] } futures.workspace = true gstd.workspace = true gcore.workspace = true +parity-scale-codec.workspace = true [build-dependencies] gear-wasm-builder.workspace = true @@ -18,9 +19,7 @@ gear-wasm-builder.workspace = true [dev-dependencies] gtest.workspace = true gear-core.workspace = true -demo-waiter = { path = ".", features = ["debug"] } - -[lib] +demo-waiter = { workspace = true, features = ["debug"] } [features] debug = ["gstd/debug"] diff --git a/examples/waiter/src/lib.rs b/examples/waiter/src/lib.rs index b7d4619f789..7f9122757eb 100644 --- a/examples/waiter/src/lib.rs +++ b/examples/waiter/src/lib.rs @@ -35,9 +35,7 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "wasm-wrapper"))] -mod wasm { - include! {"./code.rs"} -} +mod wasm; #[cfg(feature = "std")] pub fn system_reserve() -> u64 { diff --git a/examples/waiter/src/code.rs b/examples/waiter/src/wasm.rs similarity index 94% rename from examples/waiter/src/code.rs rename to examples/waiter/src/wasm.rs index 7a68dd08957..5c5a848c613 100644 --- a/examples/waiter/src/code.rs +++ b/examples/waiter/src/wasm.rs @@ -44,29 +44,33 @@ async fn main() { .expect("send message failed") .exactly(Some(duration)) .expect("Invalid wait duration.") - .await; + .await + .expect("Failed to send message"); } Command::SendUpTo(to, duration) => { msg::send_bytes_for_reply(to.into(), [], 0, 0) .expect("send message failed") .up_to(Some(duration)) .expect("Invalid wait duration.") - .await; + .await + .expect("Failed to send message"); } Command::SendUpToWait(to, duration) => { msg::send_bytes_for_reply(to.into(), [], 0, 0) .expect("send message failed") .up_to(Some(duration)) .expect("Invalid wait duration.") - .await; + .await + .expect("Failed to send message"); // after waking, wait again. msg::send_bytes_for_reply(to.into(), [], 0, 0) .expect("send message failed") - .await; + .await + .expect("Failed to send message"); } Command::SendAndWaitFor(duration, to) => { - msg::send(to.into(), b"ping", 0); + msg::send(to.into(), b"ping", 0).expect("send message failed"); exec::wait_for(duration); } Command::ReplyAndWait(subcommand) => { @@ -89,7 +93,6 @@ async fn main() { SleepForWaitType::Any => { future::select_all(sleep_futures).await; } - _ => unreachable!(), } msg::send( msg::source(), @@ -195,9 +198,7 @@ async fn process_lock_continuation( match continuation { LockContinuation::Nothing => {} LockContinuation::SleepFor(duration) => exec::sleep_for(duration).await, - LockContinuation::MoveToStatic => unsafe { - *static_lock_guard = Some(lock_guard); - }, + LockContinuation::MoveToStatic => *static_lock_guard = Some(lock_guard), LockContinuation::Wait => exec::wait(), LockContinuation::Forget => { gstd::mem::forget(lock_guard); diff --git a/examples/waiting-proxy/Cargo.toml b/examples/waiting-proxy/Cargo.toml index 9ae7ce44ea6..076c2520096 100644 --- a/examples/waiting-proxy/Cargo.toml +++ b/examples/waiting-proxy/Cargo.toml @@ -2,9 +2,10 @@ name = "demo-waiting-proxy" version = "0.1.0" authors.workspace = true -edition = "2021" -license = "GPL-3.0" -workspace = "../../" +edition.workspace = true +license.workspace = true +homepage.workspace = true +repository.workspace = true [dependencies] gstd.workspace = true @@ -12,8 +13,6 @@ gstd.workspace = true [build-dependencies] gear-wasm-builder.workspace = true -[lib] - [features] debug = ["gstd/debug"] std = [] diff --git a/examples/waiting-proxy/src/lib.rs b/examples/waiting-proxy/src/lib.rs index ade290c2ec9..b20b99554f5 100644 --- a/examples/waiting-proxy/src/lib.rs +++ b/examples/waiting-proxy/src/lib.rs @@ -27,31 +27,4 @@ mod code { pub use code::WASM_BINARY_OPT as WASM_BINARY; #[cfg(not(feature = "std"))] -mod wasm { - use gstd::{msg, ActorId}; - - static mut DESTINATION: ActorId = ActorId::new([0u8; 32]); - static mut REPLY_DEPOSIT: u64 = 0; - - #[gstd::async_main] - async fn main() { - let input = msg::load_bytes().expect("Failed to load payload bytes"); - if let Ok(outcome) = - msg::send_bytes_for_reply(unsafe { DESTINATION }, input, 0, unsafe { REPLY_DEPOSIT }) - .expect("Error sending message") - .await - { - msg::reply_bytes(outcome, 0).expect("Failed to send reply"); - } - } - - #[no_mangle] - extern "C" fn init() { - let (destination, reply_deposit) = msg::load().expect("Expecting a contract address"); - unsafe { - DESTINATION = destination; - REPLY_DEPOSIT = reply_deposit; - } - msg::reply((), 0).expect("Failed to send reply"); - } -} +mod wasm; diff --git a/examples/waiting-proxy/src/wasm.rs b/examples/waiting-proxy/src/wasm.rs new file mode 100644 index 00000000000..833c5e2a293 --- /dev/null +++ b/examples/waiting-proxy/src/wasm.rs @@ -0,0 +1,44 @@ +// This file is part of Gear. + +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gstd::{msg, ActorId}; + +static mut DESTINATION: ActorId = ActorId::new([0u8; 32]); +static mut REPLY_DEPOSIT: u64 = 0; + +#[gstd::async_main] +async fn main() { + let input = msg::load_bytes().expect("Failed to load payload bytes"); + if let Ok(outcome) = + msg::send_bytes_for_reply(unsafe { DESTINATION }, input, 0, unsafe { REPLY_DEPOSIT }) + .expect("Error sending message") + .await + { + msg::reply_bytes(outcome, 0).expect("Failed to send reply"); + } +} + +#[no_mangle] +extern "C" fn init() { + let (destination, reply_deposit) = msg::load().expect("Expecting a contract address"); + unsafe { + DESTINATION = destination; + REPLY_DEPOSIT = reply_deposit; + } + msg::reply((), 0).expect("Failed to send reply"); +} diff --git a/examples/wat/Cargo.toml b/examples/wat/Cargo.toml index 9ea0380a9bb..f4cfbee18e0 100644 --- a/examples/wat/Cargo.toml +++ b/examples/wat/Cargo.toml @@ -4,8 +4,9 @@ version = "0.1.0" authors.workspace = true edition.workspace = true license.workspace = true -workspace = "../../" +homepage.workspace = true +repository.workspace = true [dependencies] -hex = { workspace = true, features = ["alloc"] } +hex.workspace = true wabt.workspace = true From 8772a3055efdcb70c418295193683e1f44c37716 Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Wed, 20 Sep 2023 10:35:31 +0300 Subject: [PATCH 156/165] chore(versioning): Update runtime version (#3301) --- Cargo.lock | 86 ++++++++++++++++++++--------------------- Cargo.toml | 2 +- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 4 files changed, 46 insertions(+), 46 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 83e641b6e76..752909e37e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3632,14 +3632,14 @@ dependencies = [ [[package]] name = "galloc" -version = "1.0.0" +version = "1.0.1" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "base64 0.21.3", @@ -3680,7 +3680,7 @@ dependencies = [ [[package]] name = "gclient" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "async-trait", @@ -3724,7 +3724,7 @@ dependencies = [ [[package]] name = "gcore" -version = "1.0.0" +version = "1.0.1" dependencies = [ "galloc", "gear-core-errors", @@ -3737,7 +3737,7 @@ dependencies = [ [[package]] name = "gear-authorship" -version = "1.0.0" +version = "1.0.1" dependencies = [ "demo-mul-by-const", "env_logger", @@ -3781,7 +3781,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "1.0.0" +version = "1.0.1" dependencies = [ "proc-macro2", "quote", @@ -3790,7 +3790,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "1.0.0" +version = "1.0.1" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3849,7 +3849,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "1.0.0" +version = "1.0.1" dependencies = [ "clap 4.4.2", "frame-benchmarking", @@ -3883,7 +3883,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "1.0.0" +version = "1.0.1" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3911,7 +3911,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "1.0.0" +version = "1.0.1" dependencies = [ "quote", "syn 2.0.31", @@ -3919,7 +3919,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "1.0.0" +version = "1.0.1" dependencies = [ "blake2-rfc", "byteorder", @@ -3943,7 +3943,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "1.0.0" +version = "1.0.1" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3952,7 +3952,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "1.0.0" +version = "1.0.1" dependencies = [ "actor-system-error", "derive_more", @@ -3970,7 +3970,7 @@ dependencies = [ [[package]] name = "gear-lazy-pages" -version = "1.0.0" +version = "1.0.1" dependencies = [ "cfg-if", "derive_more", @@ -4010,7 +4010,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "arbitrary", @@ -4042,7 +4042,7 @@ dependencies = [ [[package]] name = "gear-node-testing" -version = "1.0.0" +version = "1.0.1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4111,7 +4111,7 @@ dependencies = [ [[package]] name = "gear-runtime" -version = "1.0.0" +version = "1.0.1" dependencies = [ "const-str", "frame-benchmarking", @@ -4173,7 +4173,7 @@ dependencies = [ [[package]] name = "gear-runtime-common" -version = "1.0.0" +version = "1.0.1" dependencies = [ "frame-benchmarking", "frame-support", @@ -4199,7 +4199,7 @@ dependencies = [ [[package]] name = "gear-runtime-interface" -version = "1.0.0" +version = "1.0.1" dependencies = [ "byteorder", "derive_more", @@ -4221,7 +4221,7 @@ dependencies = [ [[package]] name = "gear-runtime-primitives" -version = "1.0.0" +version = "1.0.1" dependencies = [ "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-runtime 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", @@ -4274,7 +4274,7 @@ dependencies = [ [[package]] name = "gear-service" -version = "1.0.0" +version = "1.0.1" dependencies = [ "frame-benchmarking", "frame-benchmarking-cli", @@ -4355,7 +4355,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "1.0.0" +version = "1.0.1" dependencies = [ "cc", ] @@ -4449,7 +4449,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "1.0.0" +version = "1.0.1" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4619,7 +4619,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "1.0.0" +version = "1.0.1" dependencies = [ "blake2-rfc", "derive_more", @@ -4633,7 +4633,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "1.0.0" +version = "1.0.1" dependencies = [ "gmeta", "gstd", @@ -4657,7 +4657,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "1.0.0" +version = "1.0.1" dependencies = [ "anyhow", "base64 0.21.3", @@ -4708,7 +4708,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "1.0.0" +version = "1.0.1" dependencies = [ "proc-macro2", "quote", @@ -4717,7 +4717,7 @@ dependencies = [ [[package]] name = "gstd" -version = "1.0.0" +version = "1.0.1" dependencies = [ "bs58", "futures", @@ -4746,7 +4746,7 @@ dependencies = [ [[package]] name = "gsys" -version = "1.0.0" +version = "1.0.1" [[package]] name = "gtest" @@ -7314,7 +7314,7 @@ dependencies = [ [[package]] name = "pallet-gear" -version = "1.0.0" +version = "1.0.1" dependencies = [ "blake2-rfc", "demo-async", @@ -7412,7 +7412,7 @@ dependencies = [ [[package]] name = "pallet-gear-bank" -version = "1.0.0" +version = "1.0.1" dependencies = [ "frame-benchmarking", "frame-support", @@ -7430,7 +7430,7 @@ dependencies = [ [[package]] name = "pallet-gear-debug" -version = "1.0.0" +version = "1.0.1" dependencies = [ "demo-vec", "env_logger", @@ -7467,7 +7467,7 @@ dependencies = [ [[package]] name = "pallet-gear-gas" -version = "1.0.0" +version = "1.0.1" dependencies = [ "env_logger", "frame-benchmarking", @@ -7496,7 +7496,7 @@ dependencies = [ [[package]] name = "pallet-gear-messenger" -version = "1.0.0" +version = "1.0.1" dependencies = [ "env_logger", "frame-benchmarking", @@ -7520,7 +7520,7 @@ dependencies = [ [[package]] name = "pallet-gear-payment" -version = "1.0.0" +version = "1.0.1" dependencies = [ "env_logger", "frame-benchmarking", @@ -7554,7 +7554,7 @@ dependencies = [ [[package]] name = "pallet-gear-proc-macro" -version = "1.0.0" +version = "1.0.1" dependencies = [ "proc-macro2", "quote", @@ -7563,7 +7563,7 @@ dependencies = [ [[package]] name = "pallet-gear-program" -version = "1.0.0" +version = "1.0.1" dependencies = [ "frame-support", "frame-system", @@ -7588,7 +7588,7 @@ dependencies = [ [[package]] name = "pallet-gear-rpc" -version = "1.0.0" +version = "1.0.1" dependencies = [ "gear-common", "gear-core", @@ -7604,7 +7604,7 @@ dependencies = [ [[package]] name = "pallet-gear-rpc-runtime-api" -version = "1.0.0" +version = "1.0.1" dependencies = [ "pallet-gear", "sp-api", @@ -7615,7 +7615,7 @@ dependencies = [ [[package]] name = "pallet-gear-scheduler" -version = "1.0.0" +version = "1.0.1" dependencies = [ "env_logger", "frame-benchmarking", @@ -7646,7 +7646,7 @@ dependencies = [ [[package]] name = "pallet-gear-staking-rewards" -version = "1.0.0" +version = "1.0.1" dependencies = [ "env_logger", "frame-benchmarking", @@ -7698,7 +7698,7 @@ dependencies = [ [[package]] name = "pallet-gear-voucher" -version = "1.0.0" +version = "1.0.1" dependencies = [ "env_logger", "frame-benchmarking", @@ -13495,7 +13495,7 @@ checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" [[package]] name = "vara-runtime" -version = "1.0.0" +version = "1.0.1" dependencies = [ "const-str", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index eecdbf0432f..041ef5687ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "1.0.0" +version = "1.0.1" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index da93e6fce77..9bedffb36e0 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 1000, + spec_version: 1010, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index f0446824539..11b503790d2 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -142,7 +142,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 1000, + spec_version: 1010, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 6327b8064bc1015caab55a92cfd6f600924a9808 Mon Sep 17 00:00:00 2001 From: Gregory Sobol Date: Wed, 20 Sep 2023 13:56:04 +0400 Subject: [PATCH 157/165] chore(galloc): Update dlmalloc (#3305) --- Cargo.lock | 25 +++++++++++++------------ Cargo.toml | 2 +- galloc/Cargo.toml | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 752909e37e7..8b464367d09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2581,11 +2581,11 @@ checksum = "86e3bdc80eee6e16b2b6b0f87fbc98c04bee3455e35174c0de1a125d0688c632" [[package]] name = "dlmalloc" version = "0.1.4" -source = "git+https://github.com/gear-tech/dlmalloc-rust.git?rev=9135baa#9135baa728ef9a9a04a887998e019733c4b093af" +source = "git+https://github.com/gear-tech/dlmalloc-rust.git#15352f969112faa463302f2490bbb7f6e1cb904d" dependencies = [ "libc", - "libc_print", - "page_size 0.4.2", + "libc-print", + "page_size 0.6.0", "static_assertions", "str-buf", ] @@ -5606,9 +5606,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] -name = "libc_print" -version = "0.1.16" -source = "git+https://github.com/grishasobol/rust-libc-print.git#b300804809e7a5f1c8fab4d2d11bcea29217bc70" +name = "libc-print" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06cea5d58bd9ba4717bbf5c6c5bb11bb6e9e76685b7fff34039b80f50ce86c11" dependencies = [ "libc", ] @@ -7115,9 +7116,9 @@ dependencies = [ [[package]] name = "page_size" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eebde548fbbf1ea81a99b128872779c437752fb99f217c45245e1a61dcd9edcd" +checksum = "1b7663cbd190cfd818d08efa8497f6cd383076688c49a391ef7c0d03cd12b561" dependencies = [ "libc", "winapi", @@ -7125,9 +7126,9 @@ dependencies = [ [[package]] name = "page_size" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b7663cbd190cfd818d08efa8497f6cd383076688c49a391ef7c0d03cd12b561" +checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" dependencies = [ "libc", "winapi", @@ -12344,9 +12345,9 @@ dependencies = [ [[package]] name = "str-buf" -version = "2.0.5" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0873cb29201126440dcc78d0b1f5a13d917e78831778429a7920ca9c7f3dae1e" +checksum = "e75b72ee54e2f93c3ea1354066162be893ee5e25773ab743de3e088cecbb4f31" [[package]] name = "strsim" diff --git a/Cargo.toml b/Cargo.toml index 041ef5687ec..95f1b55982d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -105,7 +105,7 @@ colored = "2.0.0" const-str = "0.5" derive_more = "0.99.17" dirs = "4.0.0" -dlmalloc = { git = "https://github.com/gear-tech/dlmalloc-rust.git", rev = "9135baa", default-features = false } +dlmalloc = { git = "https://github.com/gear-tech/dlmalloc-rust.git" } dyn-clonable = "0.9.0" enum-iterator = "1.4.0" env_logger = "0.10" diff --git a/galloc/Cargo.toml b/galloc/Cargo.toml index 3f08c572dd3..fa5f19ddc84 100644 --- a/galloc/Cargo.toml +++ b/galloc/Cargo.toml @@ -7,7 +7,7 @@ license.workspace = true [dependencies] # add "checks" feature to enable hard checks in allocator -dlmalloc = { workspace = true, features = ["global"] } +dlmalloc.workspace = true [features] debug = ["dlmalloc/debug"] From 607c4f41066883aab5f8cc470ebfac31ff7dc478 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Wed, 20 Sep 2023 14:14:31 +0300 Subject: [PATCH 158/165] ci: add new functions to benchmark workflow (#3253) --- .github/workflows/benchmarks.yml | 31 +++++++++++---- .github/workflows/comparison-table.yml | 46 ++++++++++++++++++++++ .github/workflows/time-consuming-tests.yml | 2 +- scripts/weight-diff.sh | 17 +++++--- utils/weight-diff/src/main.rs | 6 +-- 5 files changed, 84 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/comparison-table.yml diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index cdb98420dac..8ec90626b45 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -3,10 +3,15 @@ name: Benchmarks on: workflow_dispatch: inputs: - create_pr: - description: Whether to create a pull request after the benchmarks are completed - required: false - type: boolean + change-type: + description: How should changes be made after the benchmarks are completed? + required: true + default: ignore + type: choice + options: + - ignore + - commit + - pull_request env: CARGO_TERM_COLOR: always @@ -15,6 +20,9 @@ env: jobs: benchmarks: runs-on: bench + permissions: + contents: write + pull-requests: write env: RUSTUP_HOME: /tmp/rustup_home steps: @@ -65,11 +73,18 @@ jobs: run: | echo "::notice::You can download the artifacts and use script \`./scripts/unpack-weights.sh\` to apply the changes to your branch" - - name: Create Pull Request - if: ${{ inputs.create_pr }} + - name: Create commit + if: ${{ inputs.change-type == 'commit' }} + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: >- + chore(runtime): update weights + file_pattern: "pallets/gear/src/ runtime/gear/src/weights/ runtime/vara/src/weights/" + + - name: Create pull Request + if: ${{ inputs.change-type == 'pull_request' }} uses: peter-evans/create-pull-request@v5 with: - token: ${{ secrets.GH_TOKEN_FOR_PR }} add-paths: | pallets/gear/src/ runtime/gear/src/weights/ @@ -78,7 +93,7 @@ jobs: branch: weights/patch branch-suffix: short-commit-hash title: >- - chore: update weights + chore(runtime): update weights body: | `run_all_benchmarks.sh` script is applied to update weights (branch: `${{ github.ref_name }}`, commit ${{ github.sha }}) **Note:** If CI fails, try manually updating the heuristic tests: `runtime/{gear, vara}/src/tests.rs` diff --git a/.github/workflows/comparison-table.yml b/.github/workflows/comparison-table.yml new file mode 100644 index 00000000000..17f39581145 --- /dev/null +++ b/.github/workflows/comparison-table.yml @@ -0,0 +1,46 @@ +name: Comparison table + +on: + workflow_dispatch: + inputs: + runtime: + description: For which runtime generate comparison table? + required: true + type: choice + options: + - gear + - vara + +env: + CARGO_TERM_COLOR: always + TERM: xterm-256color + +jobs: + comparison-table: + runs-on: [kuberunner] + env: + RUSTUP_HOME: /tmp/rustup_home + steps: + - name: "ACTIONS: Checkout & fetch all history" + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: "Install: Set cargo path" + run: echo "/tmp/cargo/bin" >> $GITHUB_PATH + + - name: "Install: Rust toolchain" + uses: dsherret/rust-toolchain-file@v1 + + - name: "Build: Init" + run: ./scripts/gear.sh init cargo + + - name: "Generate comparison tables (${{ inputs.runtime }})" + run: | + ./scripts/weight-diff.sh master $(git branch --show-current) ${{ inputs.runtime }} --display-units > ${{ inputs.runtime }}-tables.txt + + - name: "ACTIONS: Upload artifact with comparison tables (${{ inputs.runtime }})" + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.runtime }}-tables + path: ${{ inputs.runtime }}-tables.txt diff --git a/.github/workflows/time-consuming-tests.yml b/.github/workflows/time-consuming-tests.yml index 126744ebcfa..9c75a58480c 100644 --- a/.github/workflows/time-consuming-tests.yml +++ b/.github/workflows/time-consuming-tests.yml @@ -24,7 +24,7 @@ jobs: - name: "Install: Rust toolchain" uses: dsherret/rust-toolchain-file@v1 - - name: "Buid: Init" + - name: "Build: Init" run: ./scripts/gear.sh init cargo - name: "Build: Node" diff --git a/scripts/weight-diff.sh b/scripts/weight-diff.sh index ae52c2c55c3..11a1baed4db 100755 --- a/scripts/weight-diff.sh +++ b/scripts/weight-diff.sh @@ -39,18 +39,23 @@ flag=$4 dump_path="weight-dumps" mkdir -p "$dump_path" -set -x +if [ -z $CI ] ; then + set -x + CARGO_FLAGS="" +else + CARGO_FLAGS="--quiet" +fi git checkout "$branch1" dump_path1="$dump_path/${branch1//\//-}.json" -cargo run --package gear-weight-diff --release -- dump "$dump_path1" --label "$branch1" +cargo run $CARGO_FLAGS --package gear-weight-diff --release -- dump "$dump_path1" --label "$branch1" git checkout "$branch2" dump_path2="$dump_path/${branch2//\//-}.json" -cargo run --package gear-weight-diff --release -- dump "$dump_path2" --label "$branch2" +cargo run $CARGO_FLAGS --package gear-weight-diff --release -- dump "$dump_path2" --label "$branch2" git checkout "$current_branch" -cargo run --package gear-weight-diff --release -- diff "$dump_path1" "$dump_path2" "$runtime" "instruction" $flag -cargo run --package gear-weight-diff --release -- diff "$dump_path1" "$dump_path2" "$runtime" "host-fn" $flag -cargo run --package gear-weight-diff --release -- diff "$dump_path1" "$dump_path2" "$runtime" "memory" $flag +cargo run $CARGO_FLAGS --package gear-weight-diff --release -- diff "$dump_path1" "$dump_path2" "$runtime" "instruction" $flag +cargo run $CARGO_FLAGS --package gear-weight-diff --release -- diff "$dump_path1" "$dump_path2" "$runtime" "host-fn" $flag +cargo run $CARGO_FLAGS --package gear-weight-diff --release -- diff "$dump_path1" "$dump_path2" "$runtime" "memory" $flag diff --git a/utils/weight-diff/src/main.rs b/utils/weight-diff/src/main.rs index f99233311d9..a40f85b1090 100644 --- a/utils/weight-diff/src/main.rs +++ b/utils/weight-diff/src/main.rs @@ -66,13 +66,13 @@ enum Commands { }, } -#[derive(Debug, Clone, ValueEnum)] +#[derive(Debug, Copy, Clone, ValueEnum)] enum Runtime { Gear, Vara, } -#[derive(Debug, Clone, ValueEnum)] +#[derive(Debug, Copy, Clone, ValueEnum)] enum WeightsKind { Instruction, HostFn, @@ -247,7 +247,7 @@ fn main() { } } - println!("Comparison table for {runtime:?} runtime"); + println!("Comparison table for {runtime:?} runtime for {kind:?}"); println!(); let mut builder = Builder::default(); From 89493e6ebabf162251d512cd0bc5394c4bd68300 Mon Sep 17 00:00:00 2001 From: sergey filyanin Date: Wed, 20 Sep 2023 16:42:42 +0200 Subject: [PATCH 159/165] Add workflow to check changes on validator (#3303) Co-authored-by: Nikolay Volf --- .github/workflows/validation.yml | 69 ++++++++++++++++++++++++++++++++ docker/Dockerfile | 2 +- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/validation.yml diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml new file mode 100644 index 00000000000..09ca0e73dc1 --- /dev/null +++ b/.github/workflows/validation.yml @@ -0,0 +1,69 @@ +name: Live check on Vara Network Validator machine + +on: + pull_request: + types: [synchronize, labeled, opened, reopened, ready_for_review] + branches: [master] + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + tag-image: + runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'check-validator') + outputs: + image_tag: ${{ steps.image-tag.outputs.tag }} + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Create image tag + id: image-tag + run: echo "tag=ghcr.io/gear-tech/node:0.1.0-`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT + + build-update-validator: + runs-on: [kuberunner] + if: contains(github.event.pull_request.labels.*.name, 'check-validator') + needs: tag-image + steps: + + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Echo tag + run: echo ${{ needs.tag-image.outputs.image_tag }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + id: docker_build + uses: docker/build-push-action@v4 + with: + context: . + file: ./docker/Dockerfile + push: true + tags: ghcr.io/gear-tech/node:latest, ${{ needs.tag-image.outputs.image_tag }} + + - name: SSH into VM + uses: appleboy/ssh-action@v1.0.0 + env: + NEW_IMAGE: ${{ needs.tag-image.outputs.image_tag }} + with: + host: ${{ secrets.VARA_VALIDATOR_8 }} + username: ${{ secrets.SSH_VARA_USERNAME }} + key: ${{ secrets.VARA_SSH_PRIVATE_KEY }} + envs: NEW_IMAGE + script: | + sudo docker-compose -f /home/gear/docker-compose.yaml down + awk -v new_image="$NEW_IMAGE" '{gsub(/image: ghcr.io\/gear-tech\/node:.*/, "image: " new_image)}1' /home/gear/docker-compose.yaml > tmp && mv tmp /home/gear/docker-compose.yaml + sudo docker-compose -f /home/gear/docker-compose.yaml up -d diff --git a/docker/Dockerfile b/docker/Dockerfile index a36437d090c..c15e2bd8d13 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -37,7 +37,7 @@ RUN cargo build -p gear-cli --profile $PROFILE # ===== SECOND STAGE ====== -FROM ubuntu:22.10 +FROM ubuntu:22.04 MAINTAINER GEAR LABEL description="This is the 2nd stage: a very small image where we copy the Gear binary." ARG PROFILE=production From 586a85284e603f0c827d3799555b777e3bcadf21 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Wed, 20 Sep 2023 20:43:46 +0300 Subject: [PATCH 160/165] feat(wasm-gen): Introduce `unreachable_enabled` in `wasm-gen` (#3307) --- Cargo.lock | 6 +++--- utils/node-loader/src/utils.rs | 1 + utils/runtime-fuzzer/src/arbitrary_call.rs | 1 + utils/wasm-gen/src/config.rs | 11 +++++++++-- utils/wasm-gen/src/config/module.rs | 6 ++++++ utils/wasm-gen/src/tests.rs | 1 + 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b464367d09..3e01a9c8622 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13752,7 +13752,7 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-encoder" version = "0.16.0" -source = "git+https://github.com/gear-tech/wasm-tools.git?branch=gear-stable#2db6004e21aa014f411f8b575a99969284cff702" +source = "git+https://github.com/gear-tech/wasm-tools.git?branch=gear-stable#9942645b3891607e13f11f6444ca320ba36a6a1f" dependencies = [ "leb128", ] @@ -13839,7 +13839,7 @@ dependencies = [ [[package]] name = "wasm-smith" version = "0.11.4" -source = "git+https://github.com/gear-tech/wasm-tools.git?branch=gear-stable#2db6004e21aa014f411f8b575a99969284cff702" +source = "git+https://github.com/gear-tech/wasm-tools.git?branch=gear-stable#9942645b3891607e13f11f6444ca320ba36a6a1f" dependencies = [ "arbitrary", "flagset", @@ -14221,7 +14221,7 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "wasmparser" version = "0.90.0" -source = "git+https://github.com/gear-tech/wasm-tools.git?branch=gear-stable#2db6004e21aa014f411f8b575a99969284cff702" +source = "git+https://github.com/gear-tech/wasm-tools.git?branch=gear-stable#9942645b3891607e13f11f6444ca320ba36a6a1f" dependencies = [ "indexmap 1.9.3", ] diff --git a/utils/node-loader/src/utils.rs b/utils/node-loader/src/utils.rs index d63d12ea75a..e7640fa21c1 100644 --- a/utils/node-loader/src/utils.rs +++ b/utils/node-loader/src/utils.rs @@ -239,6 +239,7 @@ pub fn get_wasm_gen_config( injection_amounts, params_config, initial_pages: initial_pages as u32, + unreachable_enabled: false, ..Default::default() } } diff --git a/utils/runtime-fuzzer/src/arbitrary_call.rs b/utils/runtime-fuzzer/src/arbitrary_call.rs index 5f4d9f5836f..9882efb8f47 100644 --- a/utils/runtime-fuzzer/src/arbitrary_call.rs +++ b/utils/runtime-fuzzer/src/arbitrary_call.rs @@ -233,6 +233,7 @@ fn config( log_info, params_config, initial_pages: initial_pages as u32, + unreachable_enabled: false, ..Default::default() } } diff --git a/utils/wasm-gen/src/config.rs b/utils/wasm-gen/src/config.rs index 5993ab0283e..05ff15c2a1e 100644 --- a/utils/wasm-gen/src/config.rs +++ b/utils/wasm-gen/src/config.rs @@ -39,7 +39,8 @@ //! ], //! max_instructions: 100_000, //! min_funcs: 15, -//! max_funcs: 30 +//! max_funcs: 30, +//! unreachable_enabled: true, //! }; //! let arbitrary = ArbitraryParams::arbitrary(u)?; //! Ok((selectable_params, arbitrary).into()) @@ -140,7 +141,7 @@ pub struct StandardGearWasmConfigsBundle { pub existing_addresses: Option>, /// Flag which signals whether recursions must be removed. pub remove_recursion: bool, - /// Flag which signals whether `call_indirect` instruction must not be used + /// Flag which signals whether `call_indirect` instruction must be used /// during wasm generation. pub call_indirect_enabled: bool, /// Injection amount ranges for each sys-call. @@ -153,6 +154,9 @@ pub struct StandardGearWasmConfigsBundle { pub stack_end_page: Option, /// Sys-calls params config pub params_config: SysCallsParamsConfig, + /// Flag which signals whether `unreachable` instruction must be used + /// during wasm generation. + pub unreachable_enabled: bool, } impl Default for StandardGearWasmConfigsBundle { @@ -167,6 +171,7 @@ impl Default for StandardGearWasmConfigsBundle { initial_pages: DEFAULT_INITIAL_SIZE, stack_end_page: None, params_config: SysCallsParamsConfig::default(), + unreachable_enabled: true, } } } @@ -183,10 +188,12 @@ impl> ConfigsBundle for StandardGearWasmConfigsBundle { initial_pages, stack_end_page, params_config, + unreachable_enabled, } = self; let selectable_params = SelectableParams { call_indirect_enabled, + unreachable_enabled, ..SelectableParams::default() }; diff --git a/utils/wasm-gen/src/config/module.rs b/utils/wasm-gen/src/config/module.rs index 7b0323deed4..46ac8f927f7 100644 --- a/utils/wasm-gen/src/config/module.rs +++ b/utils/wasm-gen/src/config/module.rs @@ -85,6 +85,7 @@ impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { max_instructions, min_funcs, max_funcs, + unreachable_enabled, } = selectable_params; let ArbitraryParams { @@ -173,6 +174,7 @@ impl From<(SelectableParams, ArbitraryParams)> for WasmModuleConfig { table_max_size_required, memory_grow_enabled, call_indirect_enabled, + unreachable_instruction_enabled: unreachable_enabled, }) } } @@ -354,6 +356,9 @@ pub struct SelectableParams { /// Maximum amount of functions `wasm-gen` will insert /// into generated wasm. pub max_funcs: usize, + /// Flag signalizing whether `unreachable` instruction + /// must be used or not. + pub unreachable_enabled: bool, } impl Default for SelectableParams { @@ -366,6 +371,7 @@ impl Default for SelectableParams { max_instructions: 100_000, min_funcs: 15, max_funcs: 30, + unreachable_enabled: true, } } } diff --git a/utils/wasm-gen/src/tests.rs b/utils/wasm-gen/src/tests.rs index ab09d5081e8..c8489a0e98d 100644 --- a/utils/wasm-gen/src/tests.rs +++ b/utils/wasm-gen/src/tests.rs @@ -286,6 +286,7 @@ fn execute_wasm_with_syscall_injected( max_instructions: 0, min_funcs: 1, max_funcs: 1, + unreachable_enabled: true, }, ); From 808149fbd2f25c8976ad6ca3a164814b05d429ef Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Thu, 21 Sep 2023 23:38:07 +0800 Subject: [PATCH 161/165] feat(gsdk): introduce backtrace system (#3170) --- Cargo.lock | 2 + gclient/src/api/calls.rs | 15 +- gsdk/Cargo.toml | 2 + gsdk/src/backtrace.rs | 101 +++++++++++++ gsdk/src/lib.rs | 1 + gsdk/src/signer/calls.rs | 301 +++---------------------------------- gsdk/src/signer/mod.rs | 43 ++++-- gsdk/src/signer/rpc.rs | 4 +- gsdk/src/signer/storage.rs | 172 +++++++++++++++++++++ gsdk/src/signer/utils.rs | 152 ++++++++++++++++++- gsdk/tests/backtrace.rs | 45 ++++++ gsdk/tests/rpc.rs | 34 +---- gsdk/tests/utils/mod.rs | 49 ++++++ 13 files changed, 584 insertions(+), 337 deletions(-) create mode 100644 gsdk/src/backtrace.rs create mode 100644 gsdk/src/signer/storage.rs create mode 100644 gsdk/tests/backtrace.rs create mode 100644 gsdk/tests/utils/mod.rs diff --git a/Cargo.lock b/Cargo.lock index 3e01a9c8622..bda8e9987c2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4671,9 +4671,11 @@ dependencies = [ "gsdk", "gsdk-codegen", "hex", + "indexmap 2.0.0", "jsonrpsee", "log", "parity-scale-codec", + "parking_lot 0.12.1", "rand 0.8.5", "scale-decode", "scale-value", diff --git a/gclient/src/api/calls.rs b/gclient/src/api/calls.rs index 69e93065b9e..5932d0e0acf 100644 --- a/gclient/src/api/calls.rs +++ b/gclient/src/api/calls.rs @@ -210,7 +210,7 @@ impl GearApi { let amount = calls.len(); - let tx = self.0.force_batch(calls).await?; + let tx = self.0.calls.force_batch(calls).await?; let mut res = Vec::with_capacity(amount); for event in tx.wait_for_success().await?.iter() { @@ -677,7 +677,7 @@ impl GearApi { let amount = calls.len(); - let tx = self.0.force_batch(calls).await?; + let tx = self.0.calls.force_batch(calls).await?; let mut res = Vec::with_capacity(amount); for event in tx.wait_for_success().await?.iter() { @@ -773,7 +773,7 @@ impl GearApi { let amount = calls.len(); - let tx = self.0.force_batch(calls).await?; + let tx = self.0.calls.force_batch(calls).await?; let mut res = Vec::with_capacity(amount); for event in tx.wait_for_success().await?.iter() { @@ -913,7 +913,7 @@ impl GearApi { let amount = calls.len(); - let tx = self.0.force_batch(calls).await?; + let tx = self.0.calls.force_batch(calls).await?; let mut res = Vec::with_capacity(amount); for event in tx.wait_for_success().await?.iter() { @@ -1012,7 +1012,7 @@ impl GearApi { let amount = calls.len(); - let tx = self.0.force_batch(calls).await?; + let tx = self.0.calls.force_batch(calls).await?; let mut res = Vec::with_capacity(amount); for event in tx.wait_for_success().await?.iter() { @@ -1143,7 +1143,7 @@ impl GearApi { let amount = calls.len(); - let tx = self.0.force_batch(calls).await?; + let tx = self.0.calls.force_batch(calls).await?; let mut res = Vec::with_capacity(amount); for event in tx.wait_for_success().await?.iter() { @@ -1251,6 +1251,7 @@ impl GearApi { pub async fn set_code(&self, code: impl AsRef<[u8]>) -> Result { let events = self .0 + .calls .sudo_unchecked_weight( RuntimeCall::System(SystemCall::set_code { code: code.as_ref().to_vec(), @@ -1283,6 +1284,7 @@ impl GearApi { pub async fn set_code_without_checks(&self, code: impl AsRef<[u8]>) -> Result { let events = self .0 + .calls .sudo_unchecked_weight( RuntimeCall::System(SystemCall::set_code_without_checks { code: code.as_ref().to_vec(), @@ -1318,6 +1320,7 @@ impl GearApi { ) -> Result { let events = self .0 + .calls .sudo_unchecked_weight( RuntimeCall::Balances(BalancesCall::set_balance { who: to.into().convert(), diff --git a/gsdk/Cargo.toml b/gsdk/Cargo.toml index 34946780c3d..9ecf26935dc 100644 --- a/gsdk/Cargo.toml +++ b/gsdk/Cargo.toml @@ -18,6 +18,7 @@ futures.workspace = true gear-core = { workspace = true, features = [ "std" ] } gear-core-errors.workspace = true hex.workspace = true +indexmap.workspace = true jsonrpsee = { workspace = true, features = [ "http-client", "ws-client" ] } log.workspace = true scale-value.workspace = true @@ -28,6 +29,7 @@ thiserror.workspace = true sp-runtime = { workspace = true, features = [ "std" ] } sp-core.workspace = true gsdk-codegen = { path = "codegen" } +parking_lot.workspace = true # Importing these two libraries for trimming # the the size of the generated file. diff --git a/gsdk/src/backtrace.rs b/gsdk/src/backtrace.rs new file mode 100644 index 00000000000..0478eb07ee8 --- /dev/null +++ b/gsdk/src/backtrace.rs @@ -0,0 +1,101 @@ +// This file is part of Gear. +// +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +//! Backtrace support for `gsdk` + +use crate::TxStatus; +use indexmap::IndexMap; +use parking_lot::Mutex; +use sp_core::H256; +use std::{collections::BTreeMap, sync::Arc, time::SystemTime}; + +/// Transaction Status for Backtrace +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum BacktraceStatus { + Future, + Ready, + Broadcast(Vec), + InBlock { + block_hash: H256, + extrinsic_hash: H256, + }, + Retracted { + block_hash: H256, + }, + FinalityTimeout { + block_hash: H256, + }, + Finalized { + block_hash: H256, + extrinsic_hash: H256, + }, + Usurped { + extrinsic_hash: H256, + }, + Dropped, + Invalid, +} + +impl<'s> From<&'s TxStatus> for BacktraceStatus { + fn from(status: &'s TxStatus) -> BacktraceStatus { + match status { + TxStatus::Future => BacktraceStatus::Future, + TxStatus::Ready => BacktraceStatus::Ready, + TxStatus::Broadcast(v) => BacktraceStatus::Broadcast(v.clone()), + TxStatus::InBlock(b) => BacktraceStatus::InBlock { + block_hash: b.block_hash(), + extrinsic_hash: b.extrinsic_hash(), + }, + TxStatus::Retracted(h) => BacktraceStatus::Retracted { block_hash: *h }, + TxStatus::FinalityTimeout(h) => BacktraceStatus::FinalityTimeout { block_hash: *h }, + TxStatus::Finalized(b) => BacktraceStatus::Finalized { + block_hash: b.block_hash(), + extrinsic_hash: b.extrinsic_hash(), + }, + TxStatus::Usurped(h) => BacktraceStatus::Usurped { extrinsic_hash: *h }, + TxStatus::Dropped => BacktraceStatus::Dropped, + TxStatus::Invalid => BacktraceStatus::Invalid, + } + } +} + +/// Backtrace support for transactions +#[derive(Clone, Debug, Default)] +pub struct Backtrace { + inner: Arc>>>, +} + +impl Backtrace { + /// Append status to transaction + pub fn append(&self, tx: H256, status: impl Into) { + let mut inner = self.inner.lock(); + + if let Some(map) = inner.get_mut(&tx) { + map.insert(SystemTime::now(), status.into()); + } else { + let mut map: BTreeMap = Default::default(); + map.insert(SystemTime::now(), status.into()); + inner.insert(tx, map); + }; + } + + /// Get backtrace of transaction + pub fn get(&self, tx: H256) -> Option> { + self.inner.lock().get(&tx).cloned() + } +} diff --git a/gsdk/src/lib.rs b/gsdk/src/lib.rs index ea229d6adf6..3eff02f20a5 100644 --- a/gsdk/src/lib.rs +++ b/gsdk/src/lib.rs @@ -43,6 +43,7 @@ use subxt::{ }; mod api; +pub mod backtrace; mod client; pub mod config; mod constants; diff --git a/gsdk/src/signer/calls.rs b/gsdk/src/signer/calls.rs index 2dc3d2bece5..3ab66b71e3c 100644 --- a/gsdk/src/signer/calls.rs +++ b/gsdk/src/signer/calls.rs @@ -17,56 +17,26 @@ // along with this program. If not, see . //! gear api calls -use super::SignerInner; +use super::Inner; use crate::{ config::GearConfig, metadata::{ calls::{BalancesCall, GearCall, SudoCall, UtilityCall}, gear_runtime::RuntimeCall, - runtime_types::{ - frame_system::pallet::Call, - gear_common::{ActiveProgram, Program}, - gear_core::code::InstrumentedCode, - pallet_gear_bank::pallet::BankAccount, - sp_weights::weight_v2::Weight, - }, - storage::{GearBankStorage, GearGasStorage, GearProgramStorage}, - sudo::Event as SudoEvent, - Event, + runtime_types::sp_weights::weight_v2::Weight, }, - signer::SignerRpc, - utils::storage_address_bytes, - Api, BlockNumber, Error, GearGasNode, GearGasNodeId, GearPages, Result, TxInBlock, TxStatus, + Error, Result, TxInBlock, }; -use anyhow::anyhow; -use gear_core::{ - ids::*, - memory::{PageBuf, PageBufInner}, -}; -use hex::ToHex; -use parity_scale_codec::Encode; +use gear_core::ids::*; use sp_runtime::AccountId32; use std::sync::Arc; -use subxt::{ - blocks::ExtrinsicEvents, - dynamic::Value, - metadata::EncodeWithMetadata, - storage::StorageAddress, - tx::{DynamicPayload, TxProgress}, - utils::Static, - Error as SubxtError, OnlineClient, -}; +use subxt::{blocks::ExtrinsicEvents, dynamic::Value}; -type TxProgressT = TxProgress>; type EventsResult = Result, Error>; /// Implementation of calls to programs/other users for [`Signer`]. #[derive(Clone)] -pub struct SignerCalls(pub(crate) Arc); - -/// Implementation of storage calls for [`Signer`]. -#[derive(Clone)] -pub struct SignerStorage(pub(crate) Arc); +pub struct SignerCalls(pub(crate) Arc); // pallet-balances impl SignerCalls { @@ -194,257 +164,34 @@ impl SignerCalls { } // pallet-utility -impl SignerInner { +impl SignerCalls { /// `pallet_utility::force_batch` pub async fn force_batch(&self, calls: Vec) -> Result { - self.run_tx( - UtilityCall::ForceBatch, - vec![calls.into_iter().map(Value::from).collect::>()], - ) - .await + self.0 + .run_tx( + UtilityCall::ForceBatch, + vec![calls.into_iter().map(Value::from).collect::>()], + ) + .await } } // pallet-sudo -impl SignerInner { - pub async fn process_sudo(&self, tx: DynamicPayload) -> EventsResult { - let tx = self.process(tx).await?; - let events = tx.wait_for_success().await?; - for event in events.iter() { - let event = event?.as_root_event::()?; - if let Event::Sudo(SudoEvent::Sudid { - sudo_result: Err(err), - }) = event - { - return Err(self.api().decode_error(err).into()); - } - } - - Ok(events) - } - +impl SignerCalls { /// `pallet_sudo::sudo_unchecked_weight` pub async fn sudo_unchecked_weight(&self, call: RuntimeCall, weight: Weight) -> EventsResult { - self.sudo_run_tx( - SudoCall::SudoUncheckedWeight, - // As `call` implements conversion to `Value`. - vec![ - call.into(), - Value::named_composite([ - ("ref_time", Value::u128(weight.ref_time as u128)), - ("proof_size", Value::u128(weight.proof_size as u128)), - ]), - ], - ) - .await - } - - /// `pallet_sudo::sudo` - pub async fn sudo(&self, call: RuntimeCall) -> EventsResult { - self.sudo_run_tx(SudoCall::Sudo, vec![Value::from(call)]) - .await - } -} - -// pallet-system -impl SignerStorage { - /// Sets storage values via calling sudo pallet - pub async fn set_storage(&self, items: &[(impl StorageAddress, impl Encode)]) -> EventsResult { - let metadata = self.0.api().metadata(); - let mut items_to_set = Vec::with_capacity(items.len()); - for item in items { - let item_key = storage_address_bytes(&item.0, &metadata)?; - let mut item_value_bytes = Vec::new(); - let item_value_type_id = crate::storage::storage_type_id(&metadata, &item.0)?; - Static(&item.1).encode_with_metadata( - item_value_type_id, - &metadata, - &mut item_value_bytes, - )?; - items_to_set.push((item_key, item_value_bytes)); - } - self.0 - .sudo(RuntimeCall::System(Call::set_storage { - items: items_to_set, - })) - .await - } -} - -// pallet-gas -impl SignerStorage { - /// Writes gas total issuance into storage. - pub async fn set_total_issuance(&self, value: u64) -> EventsResult { - let addr = Api::storage_root(GearGasStorage::TotalIssuance); - self.set_storage(&[(addr, value)]).await - } - - /// Writes Gear gas nodes into storage at their ids. - pub async fn set_gas_nodes( - &self, - gas_nodes: &impl AsRef<[(GearGasNodeId, GearGasNode)]>, - ) -> EventsResult { - let gas_nodes = gas_nodes.as_ref(); - let mut gas_nodes_to_set = Vec::with_capacity(gas_nodes.len()); - for gas_node in gas_nodes { - let addr = Api::storage(GearGasStorage::GasNodes, vec![Static(gas_node.0)]); - gas_nodes_to_set.push((addr, &gas_node.1)); - } - self.set_storage(&gas_nodes_to_set).await - } -} - -// pallet-gear-bank -impl SignerStorage { - /// Writes given BankAccount info into storage at `AccountId32`. - pub async fn set_bank_account_storage( - &self, - dest: impl Into, - value: BankAccount, - ) -> EventsResult { - let addr = Api::storage(GearBankStorage::Bank, vec![Value::from_bytes(dest.into())]); - self.set_storage(&[(addr, value)]).await - } -} - -// pallet-gear-program -impl SignerStorage { - /// Writes `InstrumentedCode` length into storage at `CodeId` - pub async fn set_code_len_storage(&self, code_id: CodeId, code_len: u32) -> EventsResult { - let addr = Api::storage( - GearProgramStorage::CodeLenStorage, - vec![Value::from_bytes(code_id)], - ); - self.set_storage(&[(addr, code_len)]).await - } - - /// Writes `InstrumentedCode` into storage at `CodeId` - pub async fn set_code_storage(&self, code_id: CodeId, code: &InstrumentedCode) -> EventsResult { - let addr = Api::storage( - GearProgramStorage::CodeStorage, - vec![Value::from_bytes(code_id)], - ); - self.set_storage(&[(addr, code)]).await - } - - /// Writes `GearPages` into storage at `program_id` - pub async fn set_gpages( - &self, - program_id: ProgramId, - program_pages: &GearPages, - ) -> EventsResult { - let mut program_pages_to_set = Vec::with_capacity(program_pages.len()); - for program_page in program_pages { - let addr = Api::storage( - GearProgramStorage::MemoryPageStorage, + .sudo_run_tx( + SudoCall::SudoUncheckedWeight, + // As `call` implements conversion to `Value`. vec![ - subxt::dynamic::Value::from_bytes(program_id), - subxt::dynamic::Value::u128(*program_page.0 as u128), + call.into(), + Value::named_composite([ + ("ref_time", Value::u128(weight.ref_time as u128)), + ("proof_size", Value::u128(weight.proof_size as u128)), + ]), ], - ); - let page_buf_inner = PageBufInner::try_from(program_page.1.clone()) - .map_err(|_| Error::PageInvalid(*program_page.0, program_id.encode_hex()))?; - let value = PageBuf::from_inner(page_buf_inner); - program_pages_to_set.push((addr, value)); - } - self.set_storage(&program_pages_to_set).await - } - - /// Writes `ActiveProgram` into storage at `program_id` - pub async fn set_gprog( - &self, - program_id: ProgramId, - program: ActiveProgram, - ) -> EventsResult { - let addr = Api::storage( - GearProgramStorage::ProgramStorage, - vec![Value::from_bytes(program_id)], - ); - self.set_storage(&[(addr, &Program::Active(program))]).await - } -} - -// Singer utils -impl SignerInner { - /// Propagates log::info for given status. - pub(crate) fn log_status(&self, status: &TxStatus) { - match status { - TxStatus::Future => log::info!(" Status: Future"), - TxStatus::Ready => log::info!(" Status: Ready"), - TxStatus::Broadcast(v) => log::info!(" Status: Broadcast( {v:?} )"), - TxStatus::InBlock(b) => log::info!( - " Status: InBlock( block hash: {}, extrinsic hash: {} )", - b.block_hash(), - b.extrinsic_hash() - ), - TxStatus::Retracted(h) => log::warn!(" Status: Retracted( {h} )"), - TxStatus::FinalityTimeout(h) => log::error!(" Status: FinalityTimeout( {h} )"), - TxStatus::Finalized(b) => log::info!( - " Status: Finalized( block hash: {}, extrinsic hash: {} )", - b.block_hash(), - b.extrinsic_hash() - ), - TxStatus::Usurped(h) => log::error!(" Status: Usurped( {h} )"), - TxStatus::Dropped => log::error!(" Status: Dropped"), - TxStatus::Invalid => log::error!(" Status: Invalid"), - } - } - - /// Wrapper for submit and watch with nonce. - async fn sign_and_submit_then_watch<'a>( - &self, - tx: &DynamicPayload, - ) -> Result { - if let Some(nonce) = self.nonce { - self.api - .tx() - .create_signed_with_nonce(tx, &self.signer, nonce, Default::default())? - .submit_and_watch() - .await - } else { - self.api - .tx() - .sign_and_submit_then_watch_default(tx, &self.signer) - .await - } - } - - /// Listen transaction process and print logs. - pub async fn process<'a>(&self, tx: DynamicPayload) -> Result { - use subxt::tx::TxStatus::*; - - let signer_rpc = SignerRpc(Arc::new(self.clone())); - let before = signer_rpc.get_balance().await?; - - let mut process = self.sign_and_submit_then_watch(&tx).await?; - let (pallet, name) = (tx.pallet_name(), tx.call_name()); - - log::info!("Submitted extrinsic {}::{}", pallet, name); - - while let Some(status) = process.next_item().await { - let status = status?; - self.log_status(&status); - match status { - Future | Ready | Broadcast(_) | InBlock(_) | Retracted(_) => (), - Finalized(b) => { - log::info!( - "Successfully submitted call {}::{} {} at {}!", - pallet, - name, - b.extrinsic_hash(), - b.block_hash() - ); - self.log_balance_spent(before).await?; - return Ok(b); - } - _ => { - self.log_balance_spent(before).await?; - return Err(status.into()); - } - } - } - - Err(anyhow!("Transaction wasn't found").into()) + ) + .await } } diff --git a/gsdk/src/signer/mod.rs b/gsdk/src/signer/mod.rs index d8e1f1161b5..e1136977ba8 100644 --- a/gsdk/src/signer/mod.rs +++ b/gsdk/src/signer/mod.rs @@ -19,31 +19,34 @@ //! Gear api with signer use crate::{ + backtrace::Backtrace, config::GearConfig, result::{Error, Result}, Api, }; -use calls::{SignerCalls, SignerStorage}; +use calls::SignerCalls; use core::ops::Deref; pub use pair_signer::PairSigner; use rpc::SignerRpc; use sp_core::{crypto::Ss58Codec, sr25519::Pair, Pair as PairT}; use sp_runtime::AccountId32; use std::sync::Arc; +use storage::SignerStorage; mod calls; mod pair_signer; mod rpc; +mod storage; mod utils; /// Signer representation that provides access to gear API. -/// Implements low-level methods such as [`run_tx`](`SignerInner::run_tx`) -/// and [`force_batch`](`SignerInner::force_batch`). +/// Implements low-level methods such as [`run_tx`](`Inner::run_tx`) +/// and [`force_batch`](`Signer.calls()::force_batch`). /// Other higher-level calls are provided by [`Signer::storage`], /// [`Signer::calls`], [`Signer::rpc`]. #[derive(Clone)] pub struct Signer { - signer: Arc, + signer: Arc, /// Calls that get or set storage. pub storage: SignerStorage, /// Calls for interaction with on-chain programs. @@ -54,28 +57,35 @@ pub struct Signer { /// Implementation of low-level calls for [`Signer`]. #[derive(Clone)] -pub struct SignerInner { +pub struct Inner { api: Api, /// Current signer. signer: PairSigner, nonce: Option, + backtrace: Backtrace, } impl Signer { + /// Get backtrace of the signer. + pub fn backtrace(&self) -> Backtrace { + self.calls.0.backtrace.clone() + } + /// New signer api. pub fn new(api: Api, suri: &str, passwd: Option<&str>) -> Result { - let signer = SignerInner { + let signer = Inner { api, signer: PairSigner::new( Pair::from_string(suri, passwd).map_err(|_| Error::InvalidSecret)?, ), nonce: None, + backtrace: Default::default(), }; Ok(Self::from_inner(signer)) } - fn from_inner(signer: SignerInner) -> Self { + fn from_inner(signer: Inner) -> Self { let signer = Arc::new(signer); Self { @@ -86,8 +96,10 @@ impl Signer { } } - #[deny(unused_variables)] - fn replace_inner(&mut self, inner: SignerInner) { + fn replace_inner(&mut self, mut inner: Inner) { + let backtrace = self.backtrace(); + inner.backtrace = backtrace; + let Signer { signer, storage, @@ -106,7 +118,7 @@ impl Signer { let signer = PairSigner::new(Pair::from_string(suri, passwd).map_err(|_| Error::InvalidSecret)?); - self.replace_inner(SignerInner { + self.replace_inner(Inner { signer, ..self.signer.as_ref().clone() }); @@ -116,14 +128,14 @@ impl Signer { /// Set nonce of the signer pub fn set_nonce(&mut self, nonce: u32) { - self.replace_inner(SignerInner { + self.replace_inner(Inner { nonce: Some(nonce), ..self.signer.as_ref().clone() }); } } -impl SignerInner { +impl Inner { /// Get address of the current signer pub fn address(&self) -> String { self.account_id().to_ss58check() @@ -142,10 +154,11 @@ impl SignerInner { impl From<(Api, PairSigner)> for Signer { fn from((api, signer): (Api, PairSigner)) -> Self { - let signer = SignerInner { + let signer = Inner { api, signer, nonce: None, + backtrace: Backtrace::default(), }; Self::from_inner(signer) @@ -153,9 +166,9 @@ impl From<(Api, PairSigner)> for Signer { } impl Deref for Signer { - type Target = SignerInner; + type Target = Inner; - fn deref(&self) -> &SignerInner { + fn deref(&self) -> &Inner { self.signer.as_ref() } } diff --git a/gsdk/src/signer/rpc.rs b/gsdk/src/signer/rpc.rs index 912531fd809..4a9e5413ba5 100644 --- a/gsdk/src/signer/rpc.rs +++ b/gsdk/src/signer/rpc.rs @@ -18,14 +18,14 @@ //! RPC calls with signer -use crate::{result::Result, signer::SignerInner, GasInfo}; +use crate::{result::Result, signer::Inner, GasInfo}; use gear_core::ids::{CodeId, MessageId, ProgramId}; use sp_core::H256; use std::sync::Arc; /// Implementation of calls to node RPC for [`Signer`]. #[derive(Clone)] -pub struct SignerRpc(pub(crate) Arc); +pub struct SignerRpc(pub(crate) Arc); impl SignerRpc { /// public key of the signer in H256 diff --git a/gsdk/src/signer/storage.rs b/gsdk/src/signer/storage.rs new file mode 100644 index 00000000000..25628995559 --- /dev/null +++ b/gsdk/src/signer/storage.rs @@ -0,0 +1,172 @@ +// This file is part of Gear. +// +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Storage interfaces +use crate::{ + config::GearConfig, + metadata::{ + gear_runtime::RuntimeCall, + runtime_types::{ + frame_system::pallet::Call, + gear_common::{ActiveProgram, Program}, + gear_core::code::InstrumentedCode, + pallet_gear_bank::pallet::BankAccount, + }, + storage::{GearBankStorage, GearGasStorage, GearProgramStorage}, + }, + signer::Inner, + utils::storage_address_bytes, + Api, BlockNumber, Error, GearGasNode, GearGasNodeId, GearPages, Result, +}; +use gear_core::{ + ids::*, + memory::{PageBuf, PageBufInner}, +}; +use hex::ToHex; +use parity_scale_codec::Encode; +use sp_runtime::AccountId32; +use std::sync::Arc; +use subxt::{ + blocks::ExtrinsicEvents, dynamic::Value, metadata::EncodeWithMetadata, storage::StorageAddress, + utils::Static, +}; + +type EventsResult = Result, Error>; + +/// Implementation of storage calls for [`Signer`]. +#[derive(Clone)] +pub struct SignerStorage(pub(crate) Arc); + +// pallet-system +impl SignerStorage { + /// Sets storage values via calling sudo pallet + pub async fn set_storage(&self, items: &[(impl StorageAddress, impl Encode)]) -> EventsResult { + let metadata = self.0.api().metadata(); + let mut items_to_set = Vec::with_capacity(items.len()); + for item in items { + let item_key = storage_address_bytes(&item.0, &metadata)?; + let mut item_value_bytes = Vec::new(); + let item_value_type_id = crate::storage::storage_type_id(&metadata, &item.0)?; + Static(&item.1).encode_with_metadata( + item_value_type_id, + &metadata, + &mut item_value_bytes, + )?; + items_to_set.push((item_key, item_value_bytes)); + } + + self.0 + .sudo(RuntimeCall::System(Call::set_storage { + items: items_to_set, + })) + .await + } +} + +// pallet-gas +impl SignerStorage { + /// Writes gas total issuance into storage. + pub async fn set_total_issuance(&self, value: u64) -> EventsResult { + let addr = Api::storage_root(GearGasStorage::TotalIssuance); + self.set_storage(&[(addr, value)]).await + } + + /// Writes Gear gas nodes into storage at their ids. + pub async fn set_gas_nodes( + &self, + gas_nodes: &impl AsRef<[(GearGasNodeId, GearGasNode)]>, + ) -> EventsResult { + let gas_nodes = gas_nodes.as_ref(); + let mut gas_nodes_to_set = Vec::with_capacity(gas_nodes.len()); + for gas_node in gas_nodes { + let addr = Api::storage(GearGasStorage::GasNodes, vec![Static(gas_node.0)]); + gas_nodes_to_set.push((addr, &gas_node.1)); + } + self.set_storage(&gas_nodes_to_set).await + } +} + +// pallet-gear-bank +impl SignerStorage { + /// Writes given BankAccount info into storage at `AccountId32`. + pub async fn set_bank_account_storage( + &self, + dest: impl Into, + value: BankAccount, + ) -> EventsResult { + let addr = Api::storage(GearBankStorage::Bank, vec![Value::from_bytes(dest.into())]); + self.set_storage(&[(addr, value)]).await + } +} + +// pallet-gear-program +impl SignerStorage { + /// Writes `InstrumentedCode` length into storage at `CodeId` + pub async fn set_code_len_storage(&self, code_id: CodeId, code_len: u32) -> EventsResult { + let addr = Api::storage( + GearProgramStorage::CodeLenStorage, + vec![Value::from_bytes(code_id)], + ); + self.set_storage(&[(addr, code_len)]).await + } + + /// Writes `InstrumentedCode` into storage at `CodeId` + pub async fn set_code_storage(&self, code_id: CodeId, code: &InstrumentedCode) -> EventsResult { + let addr = Api::storage( + GearProgramStorage::CodeStorage, + vec![Value::from_bytes(code_id)], + ); + self.set_storage(&[(addr, code)]).await + } + + /// Writes `GearPages` into storage at `program_id` + pub async fn set_gpages( + &self, + program_id: ProgramId, + program_pages: &GearPages, + ) -> EventsResult { + let mut program_pages_to_set = Vec::with_capacity(program_pages.len()); + for program_page in program_pages { + let addr = Api::storage( + GearProgramStorage::MemoryPageStorage, + vec![ + subxt::dynamic::Value::from_bytes(program_id), + subxt::dynamic::Value::u128(*program_page.0 as u128), + ], + ); + let page_buf_inner = PageBufInner::try_from(program_page.1.clone()) + .map_err(|_| Error::PageInvalid(*program_page.0, program_id.encode_hex()))?; + let value = PageBuf::from_inner(page_buf_inner); + program_pages_to_set.push((addr, value)); + } + self.set_storage(&program_pages_to_set).await + } + + /// Writes `ActiveProgram` into storage at `program_id` + pub async fn set_gprog( + &self, + program_id: ProgramId, + program: ActiveProgram, + ) -> EventsResult { + let addr = Api::storage( + GearProgramStorage::ProgramStorage, + vec![Value::from_bytes(program_id)], + ); + self.set_storage(&[(addr, &Program::Active(program))]).await + } +} diff --git a/gsdk/src/signer/utils.rs b/gsdk/src/signer/utils.rs index f4d88a5f4a5..24b56bef50b 100644 --- a/gsdk/src/signer/utils.rs +++ b/gsdk/src/signer/utils.rs @@ -18,18 +18,32 @@ //! Utils -use std::sync::Arc; - -use super::SignerInner; +use super::Inner; use crate::{ - config::GearConfig, metadata::CallInfo, result::Result, signer::SignerRpc, Error, TxInBlock, + backtrace::BacktraceStatus, + config::GearConfig, + metadata::{ + calls::SudoCall, gear_runtime::RuntimeCall, sudo::Event as SudoEvent, CallInfo, Event, + }, + result::Result, + signer::SignerRpc, + Error, TxInBlock, TxStatus, }; +use anyhow::anyhow; use scale_value::Composite; -use subxt::blocks::ExtrinsicEvents; +use sp_core::H256; +use std::sync::Arc; +use subxt::{ + blocks::ExtrinsicEvents, + dynamic::Value, + tx::{DynamicPayload, TxProgress}, + Error as SubxtError, OnlineClient, +}; +type TxProgressT = TxProgress>; type EventsResult = Result, Error>; -impl SignerInner { +impl Inner { /// Logging balance spent pub async fn log_balance_spent(&self, before: u128) -> Result<()> { let signer_rpc = SignerRpc(Arc::new(self.clone())); @@ -39,6 +53,107 @@ impl SignerInner { Ok(()) } + /// Propagates log::info for given status. + pub(crate) fn log_status(status: &TxStatus) { + match status { + TxStatus::Future => log::info!(" Status: Future"), + TxStatus::Ready => log::info!(" Status: Ready"), + TxStatus::Broadcast(v) => log::info!(" Status: Broadcast( {v:?} )"), + TxStatus::InBlock(b) => log::info!( + " Status: InBlock( block hash: {}, extrinsic hash: {} )", + b.block_hash(), + b.extrinsic_hash() + ), + TxStatus::Retracted(h) => log::warn!(" Status: Retracted( {h} )"), + TxStatus::FinalityTimeout(h) => log::error!(" Status: FinalityTimeout( {h} )"), + TxStatus::Finalized(b) => log::info!( + " Status: Finalized( block hash: {}, extrinsic hash: {} )", + b.block_hash(), + b.extrinsic_hash() + ), + TxStatus::Usurped(h) => log::error!(" Status: Usurped( {h} )"), + TxStatus::Dropped => log::error!(" Status: Dropped"), + TxStatus::Invalid => log::error!(" Status: Invalid"), + } + } + + /// Listen transaction process and print logs. + pub async fn process<'a>(&self, tx: DynamicPayload) -> Result { + use subxt::tx::TxStatus::*; + + let signer_rpc = SignerRpc(Arc::new(self.clone())); + let before = signer_rpc.get_balance().await?; + + let mut process = self.sign_and_submit_then_watch(&tx).await?; + let (pallet, name) = (tx.pallet_name(), tx.call_name()); + + log::info!("Submitted extrinsic {}::{}", pallet, name); + + let mut queue: Vec = Default::default(); + let mut hash: Option = None; + + while let Some(status) = process.next_item().await { + let status = status?; + Self::log_status(&status); + + if let Some(h) = &hash { + self.backtrace + .clone() + .append(*h, BacktraceStatus::from(&status)); + } else { + queue.push((&status).into()); + } + + match status { + Future | Ready | Broadcast(_) | Retracted(_) => (), + InBlock(b) => { + hash = Some(b.extrinsic_hash()); + self.backtrace.append( + b.extrinsic_hash(), + BacktraceStatus::InBlock { + block_hash: b.block_hash(), + extrinsic_hash: b.extrinsic_hash(), + }, + ); + } + Finalized(b) => { + log::info!( + "Successfully submitted call {}::{} {} at {}!", + pallet, + name, + b.extrinsic_hash(), + b.block_hash() + ); + self.log_balance_spent(before).await?; + return Ok(b); + } + _ => { + self.log_balance_spent(before).await?; + return Err(status.into()); + } + } + } + + Err(anyhow!("Transaction wasn't found").into()) + } + + /// Process sudo transaction. + pub async fn process_sudo(&self, tx: DynamicPayload) -> EventsResult { + let tx = self.process(tx).await?; + let events = tx.wait_for_success().await?; + for event in events.iter() { + let event = event?.as_root_event::()?; + if let Event::Sudo(SudoEvent::Sudid { + sudo_result: Err(err), + }) = event + { + return Err(self.api().decode_error(err).into()); + } + } + + Ok(events) + } + /// Run transaction. /// /// This function allows us to execute any transactions in gear. @@ -98,4 +213,29 @@ impl SignerInner { self.process_sudo(tx).await } + + /// `pallet_sudo::sudo` + pub async fn sudo(&self, call: RuntimeCall) -> EventsResult { + self.sudo_run_tx(SudoCall::Sudo, vec![Value::from(call)]) + .await + } + + /// Wrapper for submit and watch with nonce. + async fn sign_and_submit_then_watch<'a>( + &self, + tx: &DynamicPayload, + ) -> Result { + if let Some(nonce) = self.nonce { + self.api + .tx() + .create_signed_with_nonce(tx, &self.signer, nonce, Default::default())? + .submit_and_watch() + .await + } else { + self.api + .tx() + .sign_and_submit_then_watch_default(tx, &self.signer) + .await + } + } } diff --git a/gsdk/tests/backtrace.rs b/gsdk/tests/backtrace.rs new file mode 100644 index 00000000000..2907371c0ac --- /dev/null +++ b/gsdk/tests/backtrace.rs @@ -0,0 +1,45 @@ +// This file is part of Gear. +// +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gsdk::{backtrace::BacktraceStatus, signer::Signer, Api, Result}; +use utils::{alice_account_id, dev_node, node_uri}; + +mod utils; + +#[tokio::test] +async fn transfer_backtrace() -> Result<()> { + let node = dev_node(); + let api = Api::new(Some(&node_uri(&node))).await?; + let signer = Signer::new(api, "//Alice", None)?; + let alice: [u8; 32] = *alice_account_id().as_ref(); + + let tx = signer.calls.transfer(alice, 42).await?; + let backtrace = signer + .backtrace() + .get(tx.extrinsic_hash()) + .expect("Failed to get backtrace of transfer"); + + assert!(matches!( + backtrace.values().collect::>()[..], + [ + BacktraceStatus::InBlock { .. }, + BacktraceStatus::Finalized { .. }, + ] + )); + Ok(()) +} diff --git a/gsdk/tests/rpc.rs b/gsdk/tests/rpc.rs index 376af7741de..8aef161cd86 100644 --- a/gsdk/tests/rpc.rs +++ b/gsdk/tests/rpc.rs @@ -19,42 +19,14 @@ //! Requires node to be built in release mode use gear_core::ids::{CodeId, ProgramId}; -use gsdk::{ - ext::{sp_core::crypto::Ss58Codec, sp_runtime::AccountId32}, - testing::Node, - Api, Error, Result, -}; +use gsdk::{Api, Error, Result}; use jsonrpsee::types::error::{CallError, ErrorObject}; use parity_scale_codec::Encode; use std::{borrow::Cow, process::Command, str::FromStr}; use subxt::{config::Header, error::RpcError, Error as SubxtError}; +use utils::{alice_account_id, dev_node, node_uri}; -fn dev_node() -> Node { - // Use release build because of performance reasons. - let bin_path = env!("CARGO_MANIFEST_DIR").to_owned() + "/../target/release/gear"; - - #[cfg(not(feature = "vara-testing"))] - let args = vec!["--tmp", "--dev"]; - #[cfg(feature = "vara-testing")] - let args = vec![ - "--tmp", - "--chain=vara-dev", - "--alice", - "--validator", - "--reserved-only", - ]; - - Node::try_from_path(bin_path, args) - .expect("Failed to start node: Maybe it isn't built with --release flag?") -} - -fn node_uri(node: &Node) -> String { - format!("ws://{}", &node.address()) -} - -fn alice_account_id() -> AccountId32 { - AccountId32::from_ss58check("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY").unwrap() -} +mod utils; #[tokio::test] async fn test_calculate_upload_gas() -> Result<()> { diff --git a/gsdk/tests/utils/mod.rs b/gsdk/tests/utils/mod.rs new file mode 100644 index 00000000000..6c0696c2b28 --- /dev/null +++ b/gsdk/tests/utils/mod.rs @@ -0,0 +1,49 @@ +// This file is part of Gear. +// +// Copyright (C) 2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +use gsdk::{ + ext::{sp_core::crypto::Ss58Codec, sp_runtime::AccountId32}, + testing::Node, +}; + +pub fn dev_node() -> Node { + // Use release build because of performance reasons. + let bin_path = env!("CARGO_MANIFEST_DIR").to_owned() + "/../target/release/gear"; + + #[cfg(not(feature = "vara-testing"))] + let args = vec!["--tmp", "--dev"]; + #[cfg(feature = "vara-testing")] + let args = vec![ + "--tmp", + "--chain=vara-dev", + "--alice", + "--validator", + "--reserved-only", + ]; + + Node::try_from_path(bin_path, args) + .expect("Failed to start node: Maybe it isn't built with --release flag?") +} + +pub fn node_uri(node: &Node) -> String { + format!("ws://{}", &node.address()) +} + +pub fn alice_account_id() -> AccountId32 { + AccountId32::from_ss58check("5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY").unwrap() +} From 6c647983ff2d1c82e653e81688f331b553fa5a4e Mon Sep 17 00:00:00 2001 From: Krinitsyn Vladislav Date: Thu, 21 Sep 2023 20:03:50 +0200 Subject: [PATCH 162/165] + CI docker-gear release version (#3314) --- .github/workflows/CI-docker-gear.yml | 49 ++++++++++++++++++++++++++++ docker/Dockerfile-release | 17 ++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/workflows/CI-docker-gear.yml create mode 100644 docker/Dockerfile-release diff --git a/.github/workflows/CI-docker-gear.yml b/.github/workflows/CI-docker-gear.yml new file mode 100644 index 00000000000..69ec358f421 --- /dev/null +++ b/.github/workflows/CI-docker-gear.yml @@ -0,0 +1,49 @@ +name: CI | docker-gear release version + +on: + workflow_dispatch: + inputs: + release_version: + description: 'Release version from https://get.gear.rs Example: v1.0.0. *Null = latest' + required: false + default: '' + +env: + RELEASE_VERSION: ${{ github.event.inputs.release_version }} + +jobs: + build: + runs-on: [kuberunner] + steps: + - uses: actions/checkout@v4 + - uses: docker/setup-buildx-action@v2 + + - uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-gear-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-gear + + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - run: | + if [ -z "${{ env.RELEASE_VERSION }}" ]; then + echo "DOCKER_TAGS=ghcr.io/gear-tech/node:latest" >> $GITHUB_ENV + else + echo "DOCKER_TAGS=ghcr.io/gear-tech/node:latest,ghcr.io/gear-tech/node:${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV + fi + + - uses: docker/build-push-action@v4 + with: + file: ./docker/Dockerfile-release + push: true + tags: ${{ env.DOCKER_TAGS }} + build-args: | + RELEASE_VERSION=${{ env.RELEASE_VERSION }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache diff --git a/docker/Dockerfile-release b/docker/Dockerfile-release new file mode 100644 index 00000000000..d5181c2092c --- /dev/null +++ b/docker/Dockerfile-release @@ -0,0 +1,17 @@ +FROM debian:12-slim + +ARG RELEASE_VERSION + +RUN apt-get update && \ + apt-get install -y curl sudo xz-utils && \ + rm -rf /var/lib/apt/lists/* + +RUN if [ -z "$RELEASE_VERSION" ]; then \ + curl --proto '=https' --tlsv1.2 -sSf https://get.gear.rs/install.sh | bash -s -- --to /usr/local/bin/ ; \ + else \ + curl --proto '=https' --tlsv1.2 -sSf https://get.gear.rs/install.sh | bash -s -- --tag ${RELEASE_VERSION} --to /usr/local/bin/ ; \ + fi + +RUN gear --version + +CMD ["gear"] From cd25480850a6e490f25d339697ff92b1eb220f0a Mon Sep 17 00:00:00 2001 From: Nikolay Volf Date: Fri, 22 Sep 2023 00:33:02 +0300 Subject: [PATCH 163/165] fix(gcli): Use vara runtime ss58 prefix by default (#3321) --- Cargo.lock | 2 ++ gcli/Cargo.toml | 2 ++ gcli/bin/gcli.rs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index bda8e9987c2..faa1e879ab3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3671,9 +3671,11 @@ dependencies = [ "schnorrkel", "serde", "serde_json", + "sp-core 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "thiserror", "tokio", + "vara-runtime", "which", "whoami", ] diff --git a/gcli/Cargo.toml b/gcli/Cargo.toml index 9d9821b9bf3..8be088e5f8f 100644 --- a/gcli/Cargo.toml +++ b/gcli/Cargo.toml @@ -46,6 +46,8 @@ gear-lazy-pages-common = { workspace = true, features = [ "std" ] } reqwest = { workspace = true, default-features = false, features = [ "json", "rustls-tls" ] } etc.workspace = true sp-io = { workspace = true, features = [ "std" ] } +sp-core = { workspace = true, features = [ "std" ] } +vara-runtime = { workspace = true, features = [ "std" ] } [dev-dependencies] rand.workspace = true diff --git a/gcli/bin/gcli.rs b/gcli/bin/gcli.rs index 38b951ba1fc..02fa6f9385c 100644 --- a/gcli/bin/gcli.rs +++ b/gcli/bin/gcli.rs @@ -23,6 +23,8 @@ use color_eyre::eyre::Result; async fn main() -> Result<()> { color_eyre::install()?; + sp_core::crypto::set_default_ss58_version(vara_runtime::SS58Prefix::get().try_into().unwrap()); + if let Err(e) = gcli::cmd::Opt::run().await { log::error!("{}", e); } From 23ccf19c19ff6b665fe0093ec82b43ea0aa62d6c Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Fri, 22 Sep 2023 14:41:16 +0800 Subject: [PATCH 164/165] chore(depbot): not skipping ci (#3322) --- .github/dependabot.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index aeca1843545..9a3a838c9cf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,27 +2,27 @@ version: 2 updates: - package-ecosystem: "cargo" directory: "/" - labels: ["A4-insubstantial", "E2-forcemacos"] + labels: ["A0-pleasereview", "A4-insubstantial", "E2-forcemacos"] schedule: interval: "weekly" day: "friday" commit-message: - prefix: "[skip ci] " + prefix: "[depbot] " - package-ecosystem: "cargo" directory: "/examples/" - labels: ["A4-insubstantial"] + labels: ["A0-pleasereview", "A4-insubstantial"] schedule: interval: "weekly" day: "friday" commit-message: - prefix: "[skip ci] " + prefix: "[depbot] " - package-ecosystem: "github-actions" directory: "/" - labels: ["A4-insubstantial"] + labels: ["A0-pleasereview", "A4-insubstantial"] schedule: interval: "weekly" day: "friday" commit-message: - prefix: "[skip ci] " + prefix: "[depbot] " From 2943b7492226eb09ce3ecf10b574fda078f5a45d Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Fri, 22 Sep 2023 19:48:03 +0800 Subject: [PATCH 165/165] [skip-ci] ci(skip): skip CI with green spot (#3324) --- .github/actions/label/skip.js | 28 ++++++++++++++++++++++++++++ .github/workflows/PR.yml | 10 ++++++++++ .github/workflows/docs.yml | 6 +++--- DEVELOPMENT.md | 9 +++++++++ 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 .github/actions/label/skip.js create mode 100644 DEVELOPMENT.md diff --git a/.github/actions/label/skip.js b/.github/actions/label/skip.js new file mode 100644 index 00000000000..f779d41f275 --- /dev/null +++ b/.github/actions/label/skip.js @@ -0,0 +1,28 @@ +/** + * Javascript module for skipping CI + */ + +const SKIP_CI = "[skip-ci]"; +const { TITLE, HEAD_SHA } = process.env; +const CHECKS = ["check", "build"] +const [owner, repo] = ["gear-tech", "gear"]; + +module.exports = async ({ github, core }) => { + if (!TITLE.includes(SKIP_CI)) return; + + core.info(`Skipping CI for ${TITLE}`); + + for (check of CHECKS) { + const { data: res } = await github.rest.checks.create({ + owner, + repo, + name: `${check} / linux`, + head_sha: HEAD_SHA, + status: "completed", + conclusion: "success", + }); + + core.info(`Created check ${check}`); + core.info(JSON.stringify(res, null, 2)); + } +} diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index c4379322bff..13070db5aaa 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -25,6 +25,15 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/github-script@v6 + env: + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + TITLE: ${{ github.event.pull_request.title }} + with: + script: | + const script = require('./.github/actions/label/skip.js'); + await script({ github, core }); + - name: Check Commit Message id: check-commit-message run: | @@ -45,6 +54,7 @@ jobs: check: needs: status + if: ${{ !contains(github.event.pull_request.title, '[skip-ci]') }} uses: ./.github/workflows/check.yml with: cache: ${{ needs.status.outputs.cache }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d9cbb97a2ce..a0968811a72 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest env: RUSTUP_HOME: /tmp/rustup_home - if: github.actor != 'dependabot[bot]' + if: ${{ !contains(github.event.pull_request.title, '[skip-ci]') }} steps: - uses: actions/checkout@v4 @@ -39,8 +39,8 @@ jobs: publish_dir: ./target/doc cname: docs.gear.rs force_orphan: true - user_name: 'github-actions[bot]' - user_email: 'github-actions[bot]@users.noreply.github.com' + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" - name: Deploy PR if: github.event_name == 'pull_request' diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 00000000000..32ab448af60 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,9 @@ +# Development Guidelines + +## CI + +Since we have required checks in our PR flow, simply `[skip ci]` will leave PRs +with expected build checks, hangs with yellow spot in the UI of github. Here we +have introduced `[skip-ci]` in this repo for providing green spots. + +Reference: [Skipping workflow runs](https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs)

(&external, gas_amount) + .expect("Failed to deposit gas"); + + // Just random approximate amount of operations, + // that will be meant as write operations. + // + // Two writes into balances (system_pallet), single write + // into gear-bank pallet and several read that will with + // optimizations result into ~4 writes. + ops += 4; + } + + let mut deposit = |source: ProgramId, value: u128| { + let source = AccountIdOf::::from_origin(source.into_origin()); + let value = value.unique_saturated_into(); + Balances::::unreserve(&source, value); + GearBank::::deposit_value(&source, value).expect("Failed to deposit value"); + + // Just random approximate amount of operations, + // that will be meant as write operations. + ops += 3; + }; + + // Dispatches value migration. + let dispatches_iter = DispatchesOf::::iter_values(); + for LinkedNode { + value: dispatch, .. + } in dispatches_iter + { + deposit(dispatch.source(), dispatch.value()); + } + + // Mailbox value migration. + let mailbox_iter = MailboxOf::::iter_values(); + for (message, _) in mailbox_iter { + deposit(message.source(), message.value()); + } + + // Waitlist value migration. + let waitlist_iter = WaitlistOf::::iter_values(); + for (dispatch, _) in waitlist_iter { + deposit(dispatch.source(), dispatch.value()); + } + + // DispatchStash value migration. + let dispatch_stash_iter = DispatchStashOf::::iter_values(); + for (dispatch, _) in dispatch_stash_iter { + deposit(dispatch.source(), dispatch.value()); + } + + // Depositing value. + let accounts_iter = AccountsOf::::iter(); + for (account_id, AccountInfo { data, .. }) in accounts_iter { + let reserve = data.reserved; + if !reserve.is_zero() { + Balances::::unreserve(&account_id, reserve); + } + } + + T::DbWeight::get().writes(ops) + } else { + log::info!( + "❌ Migration to gear-bank did not execute. This probably should be removed" + ); + Zero::zero() + } + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(_state: Vec) -> Result<(), &'static str> { + log::info!("Runtime successfully migrated to gear-bank."); + Ok(()) + } +} diff --git a/runtime/gear/Cargo.toml b/runtime/gear/Cargo.toml index 6697ee67445..00cf7a60141 100644 --- a/runtime/gear/Cargo.toml +++ b/runtime/gear/Cargo.toml @@ -62,6 +62,7 @@ runtime-common.workspace = true pallet-gear-scheduler.workspace = true pallet-gear-messenger.workspace = true pallet-gear-program.workspace = true +pallet-gear-bank.workspace = true pallet-gear.workspace = true pallet-gear-debug = { workspace = true, optional = true } pallet-gear-gas.workspace = true @@ -94,6 +95,7 @@ std = [ "pallet-balances/std", "pallet-gear-program/std", "pallet-gear-scheduler/std", + "pallet-gear-bank/std", "pallet-gear/std", "pallet-gear-debug?/std", "pallet-gear-gas/std", @@ -156,6 +158,7 @@ try-runtime = [ "pallet-gear-payment/try-runtime", "pallet-gear-program/try-runtime", "pallet-gear-gas/try-runtime", + "pallet-gear-bank/try-runtime", "pallet-gear-scheduler/try-runtime", "pallet-gear-voucher/try-runtime", "pallet-gear-debug?/try-runtime", @@ -171,6 +174,7 @@ try-runtime = [ "pallet-transaction-payment/try-runtime", "pallet-utility/try-runtime", "validator-set/try-runtime", + "runtime-common/try-runtime", ] debug-mode = ["pallet-gear-debug", "pallet-gear-program/debug-mode"] lazy-pages = [ diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 1399506bf3e..16278447f93 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -54,6 +54,7 @@ use pallet_grandpa::{ fg_primitives, AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList, }; pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier}; +use runtime_common::constants::BANK_ADDRESS; pub use runtime_common::{ constants::{RENT_RESUME_WEEK_FACTOR, RESUME_SESSION_DURATION_HOUR_FACTOR}, impl_runtime_apis_plus_common, BlockHashCount, DealWithFees, GasConverter, @@ -451,12 +452,17 @@ parameter_types! { parameter_types! { pub Schedule: pallet_gear::Schedule = Default::default(); + pub BankAddress: AccountId = BANK_ADDRESS.into(); +} + +impl pallet_gear_bank::Config for Runtime { + type Currency = Balances; + type BankAddress = BankAddress; } impl pallet_gear::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Randomness = pallet_babe::RandomnessFromOneEpochAgo; - type Currency = Balances; type GasPrice = GasConverter; type WeightInfo = weights::pallet_gear::SubstrateWeight; type Schedule = Schedule; @@ -612,6 +618,7 @@ construct_runtime!( Gear: pallet_gear = 104, GearPayment: pallet_gear_payment = 105, GearVoucher: pallet_gear_voucher = 106, + GearBank: pallet_gear_bank = 107, // Only available with "debug-mode" feature on GearDebug: pallet_gear_debug = 199, @@ -647,6 +654,7 @@ construct_runtime!( Gear: pallet_gear = 104, GearPayment: pallet_gear_payment = 105, GearVoucher: pallet_gear_voucher = 106, + GearBank: pallet_gear_bank = 107, } ); diff --git a/runtime/gear/src/migrations.rs b/runtime/gear/src/migrations.rs index 8dbc0dc0886..19efd2314f0 100644 --- a/runtime/gear/src/migrations.rs +++ b/runtime/gear/src/migrations.rs @@ -16,4 +16,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -pub type Migrations = (); +use crate::*; + +pub type Migrations = (runtime_common::migrations::MigrateToGearBank,); diff --git a/runtime/vara/Cargo.toml b/runtime/vara/Cargo.toml index 4067654e694..99fa7782b58 100644 --- a/runtime/vara/Cargo.toml +++ b/runtime/vara/Cargo.toml @@ -90,6 +90,7 @@ pallet-gear-scheduler.workspace = true pallet-gear-messenger.workspace = true pallet-gear-program.workspace = true pallet-gear.workspace = true +pallet-gear-bank.workspace = true pallet-gear-debug = { workspace = true, optional = true } pallet-gear-gas.workspace = true pallet-gear-payment.workspace = true @@ -136,6 +137,7 @@ std = [ "pallet-election-provider-multi-phase/std", "pallet-gear-gas/std", "pallet-gear/std", + "pallet-gear-bank/std", "pallet-gear-debug?/std", "pallet-gear-messenger/std", "pallet-gear-payment/std", @@ -219,6 +221,7 @@ try-runtime = [ "pallet-gear-program/try-runtime", "pallet-gear-staking-rewards/try-runtime", "pallet-gear-gas/try-runtime", + "pallet-gear-bank/try-runtime", "pallet-gear-scheduler/try-runtime", "pallet-gear-voucher/try-runtime", "pallet-gear-debug?/try-runtime", @@ -254,6 +257,7 @@ try-runtime = [ "pallet-whitelist/try-runtime", "pallet-airdrop/try-runtime", "pallet-bags-list/try-runtime", + "runtime-common/try-runtime", ] debug-mode = ["pallet-gear-debug", "pallet-gear-program/debug-mode"] lazy-pages = [ diff --git a/runtime/vara/src/integration_tests.rs b/runtime/vara/src/integration_tests.rs index 976b9ad2f6d..9b1aadbc07c 100644 --- a/runtime/vara/src/integration_tests.rs +++ b/runtime/vara/src/integration_tests.rs @@ -138,20 +138,22 @@ impl ExtBuilder { .build_storage::() .unwrap(); - pallet_balances::GenesisConfig:: { - balances: self - .initial_authorities - .iter() - .map(|x| (x.0.clone(), self.stash)) - .chain( - self.endowed_accounts - .iter() - .map(|k| (k.clone(), self.endowment)), - ) - .collect(), - } - .assimilate_storage(&mut storage) - .unwrap(); + let mut balances = self + .initial_authorities + .iter() + .map(|x| (x.0.clone(), self.stash)) + .chain( + self.endowed_accounts + .iter() + .map(|k| (k.clone(), self.endowment)), + ) + .collect::>(); + + balances.push((BankAddress::get(), EXISTENTIAL_DEPOSIT)); + + pallet_balances::GenesisConfig:: { balances } + .assimilate_storage(&mut storage) + .unwrap(); SessionConfig { keys: self @@ -477,9 +479,15 @@ fn tokens_locking_works() { 10_000_000_000, 10 * UNITS, ), - pallet_gear::Error::::InsufficientBalance + pallet_gear_bank::Error::::InsufficientBalance ); + // TODO: delete lines below (issue #3081). + core::mem::drop(Balances::deposit_creating( + &alice.to_account_id(), + 10 * UNITS, + )); + // Locked funds can't be transferred to a program as a message `value` assert_ok!(Gear::upload_program( RuntimeOrigin::signed(alice.to_account_id()), @@ -504,7 +512,7 @@ fn tokens_locking_works() { 11 * UNITS, false, ), - pallet_gear::Error::::InsufficientBalance + pallet_gear_bank::Error::::InsufficientBalance ); }); } diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 03774c08b01..605a3d18c5f 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -64,6 +64,7 @@ use pallet_im_online::sr25519::AuthorityId as ImOnlineId; use pallet_session::historical::{self as pallet_session_historical}; pub use pallet_timestamp::Call as TimestampCall; pub use pallet_transaction_payment::{CurrencyAdapter, Multiplier}; +use runtime_common::constants::BANK_ADDRESS; pub use runtime_common::{ constants::{RENT_RESUME_WEEK_FACTOR, RESUME_SESSION_DURATION_HOUR_FACTOR}, impl_runtime_apis_plus_common, BlockHashCount, DealWithFees, GasConverter, @@ -945,12 +946,17 @@ parameter_types! { parameter_types! { pub Schedule: pallet_gear::Schedule = Default::default(); + pub BankAddress: AccountId = BANK_ADDRESS.into(); +} + +impl pallet_gear_bank::Config for Runtime { + type Currency = Balances; + type BankAddress = BankAddress; } impl pallet_gear::Config for Runtime { type RuntimeEvent = RuntimeEvent; type Randomness = pallet_babe::RandomnessFromOneEpochAgo; - type Currency = Balances; type GasPrice = GasConverter; type WeightInfo = weights::pallet_gear::SubstrateWeight; type Schedule = Schedule; @@ -1146,6 +1152,7 @@ construct_runtime!( GearPayment: pallet_gear_payment = 105, StakingRewards: pallet_gear_staking_rewards = 106, GearVoucher: pallet_gear_voucher = 107, + GearBank: pallet_gear_bank = 108, // TODO: Remove in stage 3 Sudo: pallet_sudo = 99, @@ -1210,6 +1217,7 @@ construct_runtime!( GearPayment: pallet_gear_payment = 105, StakingRewards: pallet_gear_staking_rewards = 106, GearVoucher: pallet_gear_voucher = 107, + GearBank: pallet_gear_bank = 108, // TODO: Remove in stage 3 Sudo: pallet_sudo = 99, diff --git a/utils/runtime-fuzzer/src/runtime/mod.rs b/utils/runtime-fuzzer/src/runtime/mod.rs index 42d5a046481..f14e5b7c301 100644 --- a/utils/runtime-fuzzer/src/runtime/mod.rs +++ b/utils/runtime-fuzzer/src/runtime/mod.rs @@ -24,7 +24,9 @@ use frame_support::{ }; use frame_system::GenesisConfig as SystemConfig; use gear_common::GasPrice; -use gear_runtime::{AccountId, Balances, Runtime, RuntimeOrigin, SessionConfig, SessionKeys}; +use gear_runtime::{ + AccountId, Balances, BankAddress, Runtime, RuntimeOrigin, SessionConfig, SessionKeys, +}; use pallet_balances::{GenesisConfig as BalancesConfig, Pallet as BalancesPallet}; use pallet_gear::Config as GearConfig; use sp_io::TestExternalities; @@ -41,7 +43,10 @@ pub fn new_test_ext() -> TestExternalities { let authorities = vec![authority_keys_from_seed("Authority")]; // Vector of tuples of accounts and their balances - let balances = vec![(account(account::alice()), account::acc_max_balance())]; + let balances = vec![ + (account(account::alice()), account::acc_max_balance()), + (BankAddress::get(), Balances::minimum_balance()), + ]; BalancesConfig:: { balances: balances From ac6a2441dafc908fe303573261f72120dc754409 Mon Sep 17 00:00:00 2001 From: nikvolf Date: Wed, 23 Aug 2023 22:12:28 +0400 Subject: [PATCH 089/165] Update to new version --- Cargo.lock | 44 ++++++++++++++++++++--------------------- Cargo.toml | 2 +- runtime/gear/src/lib.rs | 2 +- runtime/vara/src/lib.rs | 2 +- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 50b33ee6f38..dd74162b287 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3569,14 +3569,14 @@ dependencies = [ [[package]] name = "galloc" -version = "0.3.1" +version = "0.3.2" dependencies = [ "dlmalloc", ] [[package]] name = "gcli" -version = "0.3.1" +version = "0.3.2" dependencies = [ "anyhow", "base64 0.21.2", @@ -3615,7 +3615,7 @@ dependencies = [ [[package]] name = "gclient" -version = "0.3.1" +version = "0.3.2" dependencies = [ "anyhow", "async-trait", @@ -3659,7 +3659,7 @@ dependencies = [ [[package]] name = "gcore" -version = "0.3.1" +version = "0.3.2" dependencies = [ "galloc", "gear-core-errors", @@ -3714,7 +3714,7 @@ dependencies = [ [[package]] name = "gear-backend-codegen" -version = "0.3.1" +version = "0.3.2" dependencies = [ "proc-macro2", "quote", @@ -3723,7 +3723,7 @@ dependencies = [ [[package]] name = "gear-backend-common" -version = "0.3.1" +version = "0.3.2" dependencies = [ "actor-system-error", "blake2-rfc", @@ -3758,7 +3758,7 @@ dependencies = [ [[package]] name = "gear-backend-wasmi" -version = "0.3.1" +version = "0.3.2" dependencies = [ "derive_more", "gear-backend-common", @@ -3796,7 +3796,7 @@ dependencies = [ [[package]] name = "gear-cli" -version = "0.3.1" +version = "0.3.2" dependencies = [ "clap 4.3.21", "frame-benchmarking", @@ -3830,7 +3830,7 @@ dependencies = [ [[package]] name = "gear-common" -version = "0.3.1" +version = "0.3.2" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3858,7 +3858,7 @@ dependencies = [ [[package]] name = "gear-common-codegen" -version = "0.3.1" +version = "0.3.2" dependencies = [ "quote", "syn 2.0.28", @@ -3866,7 +3866,7 @@ dependencies = [ [[package]] name = "gear-core" -version = "0.3.1" +version = "0.3.2" dependencies = [ "blake2-rfc", "byteorder", @@ -3888,7 +3888,7 @@ dependencies = [ [[package]] name = "gear-core-errors" -version = "0.3.1" +version = "0.3.2" dependencies = [ "derive_more", "enum-iterator 1.4.1", @@ -3897,7 +3897,7 @@ dependencies = [ [[package]] name = "gear-core-processor" -version = "0.3.1" +version = "0.3.2" dependencies = [ "actor-system-error", "derive_more", @@ -3955,7 +3955,7 @@ dependencies = [ [[package]] name = "gear-node-loader" -version = "0.3.1" +version = "0.3.2" dependencies = [ "anyhow", "arbitrary", @@ -4293,7 +4293,7 @@ dependencies = [ [[package]] name = "gear-stack-buffer" -version = "0.3.1" +version = "0.3.2" dependencies = [ "cc", ] @@ -4381,7 +4381,7 @@ dependencies = [ [[package]] name = "gear-wasm-instrument" -version = "0.3.1" +version = "0.3.2" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", @@ -4551,7 +4551,7 @@ dependencies = [ [[package]] name = "gmeta" -version = "0.3.1" +version = "0.3.2" dependencies = [ "blake2-rfc", "derive_more", @@ -4565,7 +4565,7 @@ dependencies = [ [[package]] name = "gmeta-codegen" -version = "0.3.1" +version = "0.3.2" dependencies = [ "gmeta", "gstd", @@ -4589,7 +4589,7 @@ dependencies = [ [[package]] name = "gsdk" -version = "0.3.1" +version = "0.3.2" dependencies = [ "anyhow", "base64 0.21.2", @@ -4640,7 +4640,7 @@ dependencies = [ [[package]] name = "gsdk-codegen" -version = "0.3.1" +version = "0.3.2" dependencies = [ "proc-macro2", "quote", @@ -4649,7 +4649,7 @@ dependencies = [ [[package]] name = "gstd" -version = "0.3.1" +version = "0.3.2" dependencies = [ "bs58", "futures", @@ -4678,7 +4678,7 @@ dependencies = [ [[package]] name = "gsys" -version = "0.3.1" +version = "0.3.2" [[package]] name = "gtest" diff --git a/Cargo.toml b/Cargo.toml index 70d408e6b6f..e6b7e21d4b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.3.1" +version = "0.3.2" authors = ["Gear Technologies"] edition = "2021" license = "GPL-3.0" diff --git a/runtime/gear/src/lib.rs b/runtime/gear/src/lib.rs index 16278447f93..af2ce7c48ca 100644 --- a/runtime/gear/src/lib.rs +++ b/runtime/gear/src/lib.rs @@ -122,7 +122,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { impl_name: create_runtime_str!("gear"), apis: RUNTIME_API_VERSIONS, authoring_version: 1, - spec_version: 310, + spec_version: 320, impl_version: 1, transaction_version: 1, state_version: 1, diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index 605a3d18c5f..f48b4d1a9bc 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -143,7 +143,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // The version of the runtime specification. A full node will not attempt to use its native // runtime in substitute for the on-chain Wasm runtime unless all of `spec_name`, // `spec_version`, and `authoring_version` are the same between Wasm and native. - spec_version: 310, + spec_version: 320, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From 89b4188d5269a0ae0883f6f916274a5d57e11107 Mon Sep 17 00:00:00 2001 From: Dmitry Novikov Date: Wed, 23 Aug 2023 22:36:38 +0400 Subject: [PATCH 090/165] fix(migrations): Adjust version check (#3163) --- runtime/common/src/migrations.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/common/src/migrations.rs b/runtime/common/src/migrations.rs index 21c4ec60290..bd16325cb63 100644 --- a/runtime/common/src/migrations.rs +++ b/runtime/common/src/migrations.rs @@ -53,8 +53,7 @@ where log::info!("🚚 Running migration to gear-bank with current spec version {version:?}"); - // TODO: consider version here. - if version <= 220 { + if version < 320 { let mut ops = 0u64; // Depositing gas from gas nodes. From 8c7b689cced1c6f27a85dd2a74afdaac6e8a5552 Mon Sep 17 00:00:00 2001 From: Vadim Smirnov Date: Thu, 24 Aug 2023 08:30:10 +0400 Subject: [PATCH 091/165] fix(vara): Update MAXIMUM_BLOCK_WEIGHT to 1 sec (#3164) --- runtime/vara/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runtime/vara/src/lib.rs b/runtime/vara/src/lib.rs index f48b4d1a9bc..e72c4f703ad 100644 --- a/runtime/vara/src/lib.rs +++ b/runtime/vara/src/lib.rs @@ -164,9 +164,11 @@ const_assert!((WEIGHT_REF_TIME_PER_SECOND / 3).checked_mul(2).is_some()); /// We allow for 1/3 of block time for computations, with maximum proof size. /// -/// It's 2/3 sec for vara runtime with 2 second block duration. -const MAXIMUM_BLOCK_WEIGHT: Weight = - Weight::from_parts(WEIGHT_REF_TIME_PER_SECOND * 2 / 3, u64::MAX); +/// It's 3/3 sec for vara runtime with 3 second block duration. +const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts( + WEIGHT_REF_TIME_PER_MILLIS * MILLISECS_PER_BLOCK / 3, + u64::MAX, +); /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] From 37b91688dcd1ed2079be48333ee37d7b01f5832d Mon Sep 17 00:00:00 2001 From: ekovalev Date: Thu, 24 Aug 2023 09:53:09 +0400 Subject: [PATCH 092/165] feat(node): Make sure `pallet_gear::run()` pseudo-inherent only runs once per block (#3135) --- gclient/src/api/listener/iterator.rs | 4 +- gsdk/src/metadata/generated.rs | 9 ++- node/authorship/Cargo.toml | 2 +- node/authorship/src/tests.rs | 106 ++++++++++++++++++++++++++- pallets/gear-debug/src/mock.rs | 2 +- pallets/gear-scheduler/src/mock.rs | 2 +- pallets/gear/src/lib.rs | 50 ++++++------- pallets/gear/src/mock.rs | 2 +- pallets/gear/src/tests.rs | 51 +++++++++++++ utils/node-loader/src/batch_pool.rs | 2 +- 10 files changed, 192 insertions(+), 38 deletions(-) diff --git a/gclient/src/api/listener/iterator.rs b/gclient/src/api/listener/iterator.rs index 4e3206171f6..0cdc74306b2 100644 --- a/gclient/src/api/listener/iterator.rs +++ b/gclient/src/api/listener/iterator.rs @@ -90,7 +90,7 @@ impl EventProcessor for EventListener { impl EventListener { /// Look through finalized blocks to find the - /// [`QueueProcessingReverted`](https://docs.gear.rs/pallet_gear/pallet/enum.Event.html#variant.QueueProcessingReverted) + /// [`QueueNotProcessed`](https://docs.gear.rs/pallet_gear/pallet/enum.Event.html#variant.QueueNotProcessed) /// event. pub async fn queue_processing_reverted(&mut self) -> Result { while let Some(events) = self.0.next_events().await { @@ -98,7 +98,7 @@ impl EventListener { let events_bh = events.block_hash(); if let Some(res) = self.proc_events_inner(events, |e| { - matches!(e, Event::Gear(GearEvent::QueueProcessingReverted)).then_some(events_bh) + matches!(e, Event::Gear(GearEvent::QueueNotProcessed)).then_some(events_bh) }) { return Ok(res); } diff --git a/gsdk/src/metadata/generated.rs b/gsdk/src/metadata/generated.rs index 868e93a71ce..61587b0a6af 100644 --- a/gsdk/src/metadata/generated.rs +++ b/gsdk/src/metadata/generated.rs @@ -2711,6 +2711,9 @@ pub mod runtime_types { #[codec(index = 14)] #[doc = "Voucher can't be redemmed"] FailureRedeemingVoucher, + #[codec(index = 15)] + #[doc = "Gear::run() already included in current block."] + GearRunAlreadyInBlock, } #[derive(Debug, crate::gp::Decode, crate::gp::DecodeAsType, crate::gp::Encode)] #[doc = "\n\t\t\tThe [event](https://docs.substrate.io/main-docs/build/events-errors/) emitted\n\t\t\tby this pallet.\n\t\t\t"] @@ -2796,7 +2799,7 @@ pub mod runtime_types { }, #[codec(index = 8)] #[doc = "The pseudo-inherent extrinsic that runs queue processing rolled back or not executed."] - QueueProcessingReverted, + QueueNotProcessed, #[codec(index = 9)] #[doc = "Program resume session has been started."] ProgramResumeSessionStarted { @@ -10167,7 +10170,7 @@ pub mod storage { pub enum GearStorage { ExecuteInherent, BlockNumber, - LastGearBlockNumber, + GearRunInBlock, } impl StorageInfo for GearStorage { const PALLET: &'static str = "Gear"; @@ -10175,7 +10178,7 @@ pub mod storage { match self { Self::ExecuteInherent => "ExecuteInherent", Self::BlockNumber => "BlockNumber", - Self::LastGearBlockNumber => "LastGearBlockNumber", + Self::GearRunInBlock => "GearRunInBlock", } } } diff --git a/node/authorship/Cargo.toml b/node/authorship/Cargo.toml index d8a95695478..a445c9d5f08 100644 --- a/node/authorship/Cargo.toml +++ b/node/authorship/Cargo.toml @@ -55,7 +55,7 @@ pallet-timestamp = { workspace = true, features = ["std"] } pallet-balances = { workspace = true, features = ["std"] } pallet-gear = { workspace = true, features = ["std"] } pallet-gear-messenger = { workspace = true, features = ["std"] } -testing.workspace = true +testing = {workspace = true, features = ["vara-native"] } vara-runtime = { workspace = true, features = ["std"] } demo-mul-by-const.workspace = true env_logger.workspace = true diff --git a/node/authorship/src/tests.rs b/node/authorship/src/tests.rs index cd9cf21fa08..afbc17b4bbd 100644 --- a/node/authorship/src/tests.rs +++ b/node/authorship/src/tests.rs @@ -50,7 +50,7 @@ use testing::{ client::{ClientBlockImportExt, TestClientBuilder, TestClientBuilderExt}, keyring::{alice, bob, sign, signed_extra, CheckedExtrinsic}, }; -use vara_runtime::{AccountId, Runtime, RuntimeCall, SLOT_DURATION, VERSION}; +use vara_runtime::{AccountId, Runtime, RuntimeCall, UncheckedExtrinsic, SLOT_DURATION, VERSION}; const SOURCE: TransactionSource = TransactionSource::External; @@ -631,3 +631,107 @@ fn block_max_gas_works() { // 2 out of 5 messages have been processed, 3 remain in the queue assert_eq!(queue_len, 3); } + +#[test] +fn terminal_extrinsic_discarded_from_txpool() { + init_logger(); + + let client_builder = TestClientBuilder::new() + .set_execution_strategy(sc_client_api::ExecutionStrategy::NativeWhenPossible); + let mut client = Arc::new(client_builder.build()); + let spawner = sp_core::testing::TaskExecutor::new(); + let txpool = BasicPool::new_full( + Default::default(), + true.into(), + None, + spawner.clone(), + client.clone(), + ); + + let genesis_hash = + <[u8; 32]>::try_from(&client.info().best_hash[..]).expect("H256 is a 32 byte type"); + + // Create Gear::run() extrinsic - both unsigned and signed + let unsigned_gear_run_xt = + UncheckedExtrinsic::new_unsigned(RuntimeCall::Gear(pallet_gear::Call::run { + max_gas: None, + })); + let signed_gear_run_xt = sign( + CheckedExtrinsic { + signed: Some((bob(), signed_extra(0))), + function: RuntimeCall::Gear(pallet_gear::Call::run { max_gas: None }), + }, + VERSION.spec_version, + VERSION.transaction_version, + genesis_hash, + ); + // A `DispatchClass::Normal` exrinsic - supposed to end up in the txpool + let legit_xt = sign( + CheckedExtrinsic { + signed: Some((alice(), signed_extra(0))), + function: pre_fund_bank_account_call(), + }, + VERSION.spec_version, + VERSION.transaction_version, + genesis_hash, + ); + + let extrinsics = vec![ + unsigned_gear_run_xt.into(), + signed_gear_run_xt.into(), + legit_xt.into(), + ]; + + // Attempt to submit extrinsics to txpool; expecting only one of the three to be validated + block_on(txpool.submit_at(&BlockId::number(0), SOURCE, extrinsics)).unwrap(); + + let new_header = client + .block_hash_from_id(&BlockId::Number(0_u32)) + .unwrap() + .unwrap(); + block_on( + txpool.maintain(chain_event( + client + .header(new_header) + .expect("header get error") + .expect("there should be header"), + )), + ); + + let mut proposer_factory = + ProposerFactory::new(spawner, client.clone(), txpool, None, None, None); + + let timestamp_provider = sp_timestamp::InherentDataProvider::from_system_time(); + + let proposer = block_on( + proposer_factory.init( + &client + .header(new_header) + .expect("Database error querying block #0") + .expect("Block #0 should exist"), + ), + ) + .expect("Proposer initialization failed"); + + let inherent_data = + block_on(timestamp_provider.create_inherent_data()).expect("Create inherent data failed"); + let time_slot = sp_timestamp::Timestamp::current().as_millis() / SLOT_DURATION; + + let proposal = block_on(proposer.propose( + inherent_data, + pre_digest(time_slot, 0), + time::Duration::from_secs(600), + None, + )) + .unwrap(); + + // Both mandatory extrinsics should have been discarded, therefore there are only 3 txs + // in the block: 1 timestamp inherent + 1 normal extrinsic + 1 terminal + assert_eq!(proposal.block.extrinsics().len(), 3); + + // Importing block #1 + block_on(client.import(BlockOrigin::Own, proposal.block.clone())).unwrap(); + + let best_hash = client.info().best_hash; + assert_eq!(best_hash, proposal.block.hash()); +} diff --git a/pallets/gear-debug/src/mock.rs b/pallets/gear-debug/src/mock.rs index 14b7fb1f58f..eca1476f51d 100644 --- a/pallets/gear-debug/src/mock.rs +++ b/pallets/gear-debug/src/mock.rs @@ -263,7 +263,7 @@ pub fn run_to_block(n: u64, remaining_weight: Option) { assert!(!System::events().iter().any(|e| { matches!( e.event, - RuntimeEvent::Gear(pallet_gear::Event::QueueProcessingReverted) + RuntimeEvent::Gear(pallet_gear::Event::QueueNotProcessed) ) })) } diff --git a/pallets/gear-scheduler/src/mock.rs b/pallets/gear-scheduler/src/mock.rs index 2e9a6747993..e13eec3dcdf 100644 --- a/pallets/gear-scheduler/src/mock.rs +++ b/pallets/gear-scheduler/src/mock.rs @@ -263,7 +263,7 @@ pub fn run_to_block(n: u64, remaining_weight: Option) { assert!(!System::events().iter().any(|e| { matches!( e.event, - RuntimeEvent::Gear(pallet_gear::Event::QueueProcessingReverted) + RuntimeEvent::Gear(pallet_gear::Event::QueueNotProcessed) ) })) } diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index dbce52d2b54..6e36f6e05fe 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -406,7 +406,7 @@ pub mod pallet { }, /// The pseudo-inherent extrinsic that runs queue processing rolled back or not executed. - QueueProcessingReverted, + QueueNotProcessed, /// Program resume session has been started. ProgramResumeSessionStarted { @@ -469,6 +469,8 @@ pub mod pallet { ProgramNotFound, /// Voucher can't be redemmed FailureRedeemingVoucher, + /// Gear::run() already included in current block. + GearRunAlreadyInBlock, } #[cfg(feature = "runtime-benchmarks")] @@ -497,13 +499,13 @@ pub mod pallet { } } - /// The Gear block number before processing messages. + /// A guard to prohibit all but the first execution of `pallet_gear::run()` call in a block. /// - /// A helper variable that mirrors the `BlockNumber` at the beginning of a block. - /// Allows to gauge the actual `BlockNumber` progress. + /// Set to `Some(())` if the extrinsic is executed for the first time in a block. + /// All subsequent attempts would fail with `Error::::GearRunAlreadyInBlock` error. + /// Set back to `None` in the `on_finalize()` hook at the end of the block. #[pallet::storage] - #[pallet::getter(fn last_gear_block_number)] - pub(crate) type LastGearBlockNumber = StorageValue<_, T::BlockNumber>; + pub(crate) type GearRunInBlock = StorageValue<_, ()>; #[pallet::hooks] impl Hooks> for Pallet @@ -521,30 +523,21 @@ pub mod pallet { // Incrementing Gear block number BlockNumber::::mutate(|bn| *bn = bn.saturating_add(One::one())); - // Align the last gear block number before inherent execution with current value - >::put(Self::block_number()); - log::debug!(target: "gear::runtime", "⚙️ Initialization of block #{bn:?} (gear #{:?})", Self::block_number()); - // The `LastGearBlockNumber` is killed at the end of a block therefore its value - // will only exist in overlay and never be committed to storage. - // The respective write weight can be omitted and not accounted for. T::DbWeight::get().writes(1) } /// Finalization fn on_finalize(bn: BlockNumberFor) { - // Check if the queue has been processed, that is gear block number bumped again. - // If not (while the queue processing enabled), fire an event. - if let Some(last_gear_block_number) = >::take() { - if Self::execute_inherent() && Self::block_number() <= last_gear_block_number { - Self::deposit_event(Event::QueueProcessingReverted); - } + // Check if the queue has been processed. + // If not (while the queue processing enabled), fire an event and revert + // the Gear internal block number increment made in `on_initialize()`. + if GearRunInBlock::::take().is_none() && Self::execute_inherent() { + Self::deposit_event(Event::QueueNotProcessed); + BlockNumber::::mutate(|bn| *bn = bn.saturating_sub(One::one())); } - // Undoing Gear block number increment that was done upfront in `on_initialize` - BlockNumber::::mutate(|bn| *bn = bn.saturating_sub(One::one())); - log::debug!(target: "gear::runtime", "⚙️ Finalization of block #{bn:?} (gear #{:?})", Self::block_number()); } } @@ -1753,6 +1746,15 @@ pub mod pallet { Error::::MessageQueueProcessingDisabled ); + ensure!( + !GearRunInBlock::::exists(), + Error::::GearRunAlreadyInBlock + ); + // The below doesn't create an extra db write, because the value will be "taken" + // (set to `None`) at the end of the block, therefore, will only exist in the + // overlay and never be committed to storage. + GearRunInBlock::::set(Some(())); + let weight_used = >::block_weight(); let max_weight = ::BlockWeights::get().max_block; let remaining_weight = max_weight.saturating_sub(weight_used.total()); @@ -1779,12 +1781,6 @@ pub mod pallet { Self::block_number(), ); - // Incrementing Gear block number one more time to indicate that the queue processing - // has been successfully completed in the current block. - // Caveat: this increment must be done strictly after all extrinsics in the block have - // been handled to ensure correct block number math. - BlockNumber::::mutate(|bn| *bn = bn.saturating_add(One::one())); - Ok(PostDispatchInfo { actual_weight: Some( Weight::from_parts(actual_weight, 0) diff --git a/pallets/gear/src/mock.rs b/pallets/gear/src/mock.rs index 04a7d914fdb..38ec31a3144 100644 --- a/pallets/gear/src/mock.rs +++ b/pallets/gear/src/mock.rs @@ -388,7 +388,7 @@ pub fn run_to_block_maybe_with_queue( assert!(!System::events().iter().any(|e| { matches!( e.event, - RuntimeEvent::Gear(pallet_gear::Event::QueueProcessingReverted) + RuntimeEvent::Gear(pallet_gear::Event::QueueNotProcessed) ) })) } diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index eff79074ed7..1814423b1e8 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -13761,6 +13761,57 @@ fn wasm_ref_types_doesnt_work() { }); } +/// Test that the `Gear::run()` extrinsic can only run once per block, +/// even if somehow included in a block multiple times. +#[test] +fn gear_run_only_runs_once_per_block() { + use frame_support::{ + dispatch::RawOrigin, + traits::{OnFinalize, OnInitialize}, + }; + + fn init_block(bn: u32) { + System::set_block_number(bn); + GasAllowanceOf::::put(1_000_000_000); + Gear::on_initialize(bn); + } + + init_logger(); + new_test_ext().execute_with(|| { + init_block(2); + assert_ok!(Gear::run(RawOrigin::None.into(), None,)); + // Second run in a block is not allowed + assert_noop!( + Gear::run(RawOrigin::None.into(), None,), + Error::::GearRunAlreadyInBlock + ); + Gear::on_finalize(2); + + // Everything goes back to normal in the next block + init_block(3); + assert_ok!(Gear::run(RawOrigin::None.into(), None,)); + }) +} + +/// Test that the Gear internal block numbering is consistent. +#[test] +fn gear_block_number_math_adds_up() { + init_logger(); + new_test_ext().execute_with(|| { + run_to_block(100, None); + assert_eq!(Gear::block_number(), 100); + + run_to_block_maybe_with_queue(120, None, None); + assert_eq!(System::block_number(), 120); + assert_eq!(Gear::block_number(), 100); + + System::reset_events(); + run_to_block(150, None); + assert_eq!(System::block_number(), 150); + assert_eq!(Gear::block_number(), 130); + }) +} + mod utils { #![allow(unused)] diff --git a/utils/node-loader/src/batch_pool.rs b/utils/node-loader/src/batch_pool.rs index a29425b4bfa..e83d93d683c 100644 --- a/utils/node-loader/src/batch_pool.rs +++ b/utils/node-loader/src/batch_pool.rs @@ -358,7 +358,7 @@ async fn inspect_crash_events(mut rx: EventsReceiver) -> Result<()> { let bh = events.block_hash(); for event in events.iter() { let event = event?.as_root_event::()?; - if matches!(event, Event::Gear(GearEvent::QueueProcessingReverted)) { + if matches!(event, Event::Gear(GearEvent::QueueNotProcessed)) { let crash_err = CrashAlert::MsgProcessingStopped; tracing::info!("{crash_err} at block hash {bh:?}"); return Err(crash_err.into()); From e279e6c2ccf31d64fae4f4d5998de1be8cb800f5 Mon Sep 17 00:00:00 2001 From: Sabaun Taraki Date: Thu, 24 Aug 2023 12:33:07 +0400 Subject: [PATCH 093/165] fix(node-loader): Fix anoying error with too large RPC data (#3162) --- gsdk/src/client.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gsdk/src/client.rs b/gsdk/src/client.rs index dfe5cd08204..72346d6415e 100644 --- a/gsdk/src/client.rs +++ b/gsdk/src/client.rs @@ -37,6 +37,7 @@ use subxt::{ const DEFAULT_GEAR_ENDPOINT: &str = "wss://rpc-node.gear-tech.io:443"; const DEFAULT_TIMEOUT: u64 = 60_000; +const ONE_HUNDRED_MEGA_BYTES: u32 = 100 * 1024 * 1024; struct Params(Option>); @@ -63,6 +64,11 @@ impl RpcClient { if url.starts_with("ws") { Ok(Self::Ws( WsClientBuilder::default() + // Actually that stand for the response too. + // *WARNING*: + // After updating jsonrpsee to 0.20.0 and higher + // use another method created only for that. + .max_request_body_size(ONE_HUNDRED_MEGA_BYTES) .connection_timeout(Duration::from_millis(timeout)) .request_timeout(Duration::from_millis(timeout)) .build(url) From 9d1689cf7f323971d3fcaf21485669a4967d4054 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Thu, 24 Aug 2023 16:05:30 +0300 Subject: [PATCH 094/165] chore(gstd): remove `MaybeMaxEncodedLen` trait (#3165) --- .github/workflows/check.yml | 6 ++++++ gstd/src/lib.rs | 2 -- gstd/src/util.rs | 35 +++-------------------------------- 3 files changed, 9 insertions(+), 34 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c193a2031bf..bfba0acb7af 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -55,6 +55,12 @@ jobs: exit 1 fi + - name: "Install: Rust stable toolchain" + uses: dtolnay/rust-toolchain@stable + + - name: "Check: Compiling gstd on stable" + run: cargo +stable check -p gstd + - run: sccache --show-stats fuzzer: diff --git a/gstd/src/lib.rs b/gstd/src/lib.rs index cc5790ba1ad..1b48cde9657 100644 --- a/gstd/src/lib.rs +++ b/gstd/src/lib.rs @@ -131,8 +131,6 @@ #![cfg_attr(feature = "strict", deny(warnings))] #![doc(html_logo_url = "https://docs.gear.rs/logo.svg")] #![doc(test(attr(deny(warnings), allow(unused_variables, unused_assignments))))] -#![allow(incomplete_features)] -#![feature(specialization)] extern crate alloc; #[cfg(target_arch = "wasm32")] diff --git a/gstd/src/util.rs b/gstd/src/util.rs index 3beabfa9abc..a66513c58ef 100644 --- a/gstd/src/util.rs +++ b/gstd/src/util.rs @@ -20,7 +20,7 @@ pub use scale_info::MetaType; use scale_info::{ - scale::{Encode, MaxEncodedLen, Output}, + scale::{Encode, Output}, PortableRegistry, Registry, }; @@ -29,36 +29,8 @@ use crate::prelude::{ Box, String, Vec, }; -/// Items implementing [`MaybeMaxEncodedLen`] **might** have a statically known -/// maximum encoded size. -pub(crate) trait MaybeMaxEncodedLen: Encode { - /// If the data type implements [`MaxEncodedLen`], this method returns - /// `Some(::max_encoded_len())`. - /// - /// Otherwise, this method returns [`None`]. - fn maybe_max_encoded_len() -> Option; -} - -/// Default implementation for all types that implement [`Encode`], but not -/// [`MaxEncodedLen`]. -impl MaybeMaxEncodedLen for T { - default fn maybe_max_encoded_len() -> Option { - None - } -} - -/// Specialization for types that implement [`MaxEncodedLen`]. -impl MaybeMaxEncodedLen for T { - fn maybe_max_encoded_len() -> Option { - Some(T::max_encoded_len()) - } -} - /// An auxiliary function that reduces gas consumption during payload encoding. -pub(crate) fn with_optimized_encode( - payload: E, - f: impl FnOnce(&[u8]) -> T, -) -> T { +pub(crate) fn with_optimized_encode(payload: E, f: impl FnOnce(&[u8]) -> T) -> T { struct ExternalBufferOutput<'a> { buffer: &'a mut [MaybeUninit], offset: usize, @@ -78,8 +50,7 @@ pub(crate) fn with_optimized_encode( } } - let size = E::maybe_max_encoded_len().unwrap_or_else(|| payload.encoded_size()); - gcore::stack_buffer::with_byte_buffer(size, |buffer| { + gcore::stack_buffer::with_byte_buffer(payload.encoded_size(), |buffer| { let mut output = ExternalBufferOutput { buffer, offset: 0 }; payload.encode_to(&mut output); let ExternalBufferOutput { buffer, offset } = output; From de049a9b511a7269921d8494203790266deb7ba3 Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Thu, 24 Aug 2023 19:37:37 +0300 Subject: [PATCH 095/165] refactor(wasm-gen): add methods to generate precise sys-calls (#3116) --- .../src/generator/syscalls/imports.rs | 124 +++++++++++------- 1 file changed, 79 insertions(+), 45 deletions(-) diff --git a/utils/wasm-gen/src/generator/syscalls/imports.rs b/utils/wasm-gen/src/generator/syscalls/imports.rs index df5d5caa747..6cfd6620697 100644 --- a/utils/wasm-gen/src/generator/syscalls/imports.rs +++ b/utils/wasm-gen/src/generator/syscalls/imports.rs @@ -30,7 +30,7 @@ use arbitrary::{Result, Unstructured}; use gear_wasm_instrument::{ parity_wasm::{ builder, - elements::{BlockType, Instruction, Instructions}, + elements::{BlockType, Instruction, Instructions, Local}, }, syscalls::SysCallName, }; @@ -242,36 +242,91 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { } impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { - /// Generates a function which calls "properly" the `gr_reservation_send`. - fn generate_send_from_reservation(&mut self) { - let (reserve_gas_idx, reservation_send_idx) = { - let maybe_reserve_gas = self - .sys_calls_imports - .get(&InvocableSysCall::Loose(SysCallName::ReserveGas)) - .map(|&(_, call_indexes_handle)| call_indexes_handle); - let maybe_reservation_send = self - .sys_calls_imports - .get(&InvocableSysCall::Loose(SysCallName::ReservationSend)) - .map(|&(_, call_indexes_handle)| call_indexes_handle); - - match maybe_reserve_gas.zip(maybe_reservation_send) { - Some(indexes) => indexes, + /// Returns the indexes of invocable sys-calls. + fn invocable_sys_calls_indexes( + &self, + sys_calls: [SysCallName; N], + ) -> Option<[usize; N]> { + let mut indexes = [0; N]; + let iter = sys_calls.iter().map(|&sys_call| { + self.sys_calls_imports + .get(&InvocableSysCall::Loose(sys_call)) + .map(|&(_, call_indexes_handle)| call_indexes_handle) + }); + + for (index, maybe_index) in indexes.iter_mut().zip(iter) { + match maybe_index { + Some(idx) => *index = idx, None => { - log::trace!("Wasm hasn't got either gr_reserve_gas, or gr_reservation_send, or both of them"); - return; + log::trace!( + "The following sys-calls must be imported: {missing_sys_calls:?}", + missing_sys_calls = sys_calls.map(|sys_call| sys_call.to_str()), + ); + return None; } } - }; + } + + Some(indexes) + } - let invocable_sys_call = InvocableSysCall::Precise(SysCallName::ReservationSend); - let send_from_reservation_signature = invocable_sys_call.into_signature(); + /// Generates a function which calls "properly" the given sys-call. + fn generate_proper_sys_call_invocation( + &mut self, + sys_call: SysCallName, + func_instructions: Instructions, + func_locals: Option>, + ) { + let invocable_sys_call = InvocableSysCall::Precise(sys_call); + let signature = invocable_sys_call.into_signature(); - let send_from_reservation_func_ty = send_from_reservation_signature.func_type(); + let func_ty = signature.func_type(); let func_signature = builder::signature() - .with_params(send_from_reservation_func_ty.params().iter().copied()) - .with_results(send_from_reservation_func_ty.results().iter().copied()) + .with_params(func_ty.params().iter().copied()) + .with_results(func_ty.results().iter().copied()) .build_sig(); + let func_idx = self.module.with(|module| { + let mut module_builder = builder::from_module(module); + let idx = module_builder.push_function( + builder::function() + .with_signature(func_signature) + .body() + .with_instructions(func_instructions) + .with_locals(func_locals.unwrap_or_default()) + .build() + .build(), + ); + + (module_builder.build(), idx) + }); + + log::trace!( + "Built proper call to {precise_sys_call_name}", + precise_sys_call_name = InvocableSysCall::Precise(sys_call).to_str() + ); + + let call_indexes_handle = self.call_indexes.len(); + self.call_indexes.add_func(func_idx.signature as usize); + + // TODO: make separate config for precise sys-calls (#3122) + self.sys_calls_imports + .insert(invocable_sys_call, (1, call_indexes_handle)); + } + + /// Generates a function which calls "properly" the `gr_reservation_send`. + fn generate_send_from_reservation(&mut self) { + let sys_call = SysCallName::ReservationSend; + log::trace!( + "Constructing {name} sys-call...", + name = InvocableSysCall::Precise(sys_call).to_str() + ); + + let Some([reserve_gas_idx, reservation_send_idx]) = self + .invocable_sys_calls_indexes([SysCallName::ReserveGas, SysCallName::ReservationSend]) else { + return; + }; + let memory_size_in_bytes = { let initial_mem_size: WasmPageCount = self .module @@ -343,28 +398,7 @@ impl<'a, 'b> SysCallsImportsGenerator<'a, 'b> { Instruction::End, ]); - let send_from_reservation_func_idx = self.module.with(|module| { - let mut module_builder = builder::from_module(module); - let idx = module_builder.push_function( - builder::function() - .with_signature(func_signature) - .body() - .with_instructions(func_instructions) - .build() - .build(), - ); - - (module_builder.build(), idx) - }); - - log::trace!("Built proper reservation send call"); - - let call_indexes_handle = self.call_indexes.len(); - self.call_indexes - .add_func(send_from_reservation_func_idx.signature as usize); - - self.sys_calls_imports - .insert(invocable_sys_call, (1, call_indexes_handle)); + self.generate_proper_sys_call_invocation(sys_call, func_instructions, None); } } From 04b4d850e67f36ddd429fd4f15069b7618e0bd68 Mon Sep 17 00:00:00 2001 From: sergey filyanin Date: Thu, 24 Aug 2023 20:47:10 +0200 Subject: [PATCH 096/165] Update Build-gear-loader-network.yml (#3169) Co-authored-by: Sabaun Taraki --- .../workflows/Build-gear-loader-network.yml | 2 +- .github/workflows/Update-testnet.yml | 162 +++++++++--------- 2 files changed, 78 insertions(+), 86 deletions(-) diff --git a/.github/workflows/Build-gear-loader-network.yml b/.github/workflows/Build-gear-loader-network.yml index 9789b0d6232..31fd4324a28 100644 --- a/.github/workflows/Build-gear-loader-network.yml +++ b/.github/workflows/Build-gear-loader-network.yml @@ -9,7 +9,7 @@ env: jobs: build-gear-loader: - runs-on: [self-hosted, epyc-4, k8s-runner] + runs-on: [kuberunner] env: RUSTUP_HOME: /tmp/rustup_home steps: diff --git a/.github/workflows/Update-testnet.yml b/.github/workflows/Update-testnet.yml index 57db72d2d20..a682d2ebf2e 100644 --- a/.github/workflows/Update-testnet.yml +++ b/.github/workflows/Update-testnet.yml @@ -20,7 +20,7 @@ jobs: run: echo "tag=ghcr.io/gear-tech/node:0.1.0-`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT docker: - runs-on: [self-hosted, epyc-4, k8s-runner] + runs-on: [kuberunner] needs: tag-image steps: - name: Checkout repo @@ -48,87 +48,79 @@ jobs: push: true tags: ghcr.io/gear-tech/node:latest, ${{ needs.tag-image.outputs.image_tag }} - deploy-one-validator: - runs-on: ubuntu-latest - needs: [docker, tag-image] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install Info - run: | - ls -l . - ls -l ../.. - pwd - - - name: Send telegram notify before run playbook - uses: appleboy/telegram-action@master - with: - to: ${{ secrets.TELEGRAM_CHANNEL_ID }} - token: ${{ secrets.TELEGRAM_BOT_TOKEN }} - message: | - Attention! Instances will be temporarily unavailable! - Update second validator! - ${{ github.actor }} run build with commit: "${{ github.event.commits[0].message }}" - Build number: ${{ github.run_number }} - - - name: Run playbook - uses: dawidd6/action-ansible-playbook@v2 - with: - # Required, playbook filepath - directory: ./ansible/ - playbook: main.yaml - # Optional, SSH private key - key: ${{secrets.SSH_PRIVATE_KEY}} - # Optional, literal inventory file contents - inventory: | - [gearNodes:children] - nodes - [nodes] - ${{secrets.GEAR_NODE_2}} name=testnet-gear02 validator=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} - - deploy-all-validators: - runs-on: ubuntu-latest - environment: production - needs: [docker, deploy-one-validator,tag-image] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install Info - run: | - ls -l . - ls -l ../.. - pwd - - - name: Send telegram notify before run playbook - uses: appleboy/telegram-action@master - with: - to: ${{ secrets.TELEGRAM_CHANNEL_ID }} - token: ${{ secrets.TELEGRAM_BOT_TOKEN }} - message: | - Attention! Instances will be temporarily unavailable! - Update all testnet! - ${{ github.actor }} run build with commit: "${{ github.event.commits[0].message }}" - Build number: ${{ github.run_number }} - - - name: Run playbook - uses: dawidd6/action-ansible-playbook@v2 - with: - # Required, playbook filepath - directory: ./ansible/ - playbook: main.yaml - # Optional, SSH private key - key: ${{secrets.SSH_PRIVATE_KEY}} - # Optional, literal inventory file contents - inventory: | - [gearNodes:children] - bootnode - nodes - [bootnode] - ${{secrets.GEAR_NODE}} name=testnet-gear01 loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} - [nodes] - ${{secrets.GEAR_NODE_3}} name=testnet-rpc-node rpc=yes unsafe=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} - ${{secrets.GEAR_NODE_4}} name=testnet-gear03 validator=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} - ${{secrets.GEAR_NODE_5}} name=testnet-gear04 validator=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} - ${{secrets.ARCHIVE_RPC_NODE}} name=testnet-archive-rpc-node rpc=yes unsafe=no archive_node=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} +# deploy-one-validator: +# runs-on: ubuntu-latest +# needs: [docker, tag-image] +# steps: +# - name: Checkout +# uses: actions/checkout@v3 + + + +# - name: Send telegram notify before run playbook +# uses: appleboy/telegram-action@master +# with: +# to: ${{ secrets.TELEGRAM_CHANNEL_ID }} +# token: ${{ secrets.TELEGRAM_BOT_TOKEN }} +# message: | +# Attention! Instances will be temporarily unavailable! +# Update second validator! +# ${{ github.actor }} run build with commit: "${{ github.event.commits[0].message }}" +# Build number: ${{ github.run_number }} + +# - name: Run playbook +# uses: dawidd6/action-ansible-playbook@v2 +# with: +# # Required, playbook filepath +# directory: ./ansible/ +# playbook: main.yaml +# # Optional, SSH private key +# key: ${{secrets.SSH_PRIVATE_KEY}} +# # Optional, literal inventory file contents +# inventory: | +# [gearNodes:children] +# nodes +# [nodes] +# ${{secrets.GEAR_NODE_2}} name=testnet-gear02 validator=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} + +# deploy-all-validators: +# runs-on: ubuntu-latest +# environment: production +# needs: [docker, deploy-one-validator,tag-image] +# steps: +# - name: Checkout +# uses: actions/checkout@v3 + + + +# - name: Send telegram notify before run playbook +# uses: appleboy/telegram-action@master +# with: +# to: ${{ secrets.TELEGRAM_CHANNEL_ID }} +# token: ${{ secrets.TELEGRAM_BOT_TOKEN }} +# message: | +# Attention! Instances will be temporarily unavailable! +# Update all testnet! +# ${{ github.actor }} run build with commit: "${{ github.event.commits[0].message }}" +# Build number: ${{ github.run_number }} + +# - name: Run playbook +# uses: dawidd6/action-ansible-playbook@v2 +# with: +# # Required, playbook filepath +# directory: ./ansible/ +# playbook: main.yaml +# # Optional, SSH private key +# key: ${{secrets.SSH_PRIVATE_KEY}} +# # Optional, literal inventory file contents +# inventory: | +# [gearNodes:children] +# bootnode +# nodes +# [bootnode] +# ${{secrets.GEAR_NODE}} name=testnet-gear01 loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} +# [nodes] +# ${{secrets.GEAR_NODE_3}} name=testnet-rpc-node rpc=yes unsafe=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} +# ${{secrets.GEAR_NODE_4}} name=testnet-gear03 validator=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} +# ${{secrets.GEAR_NODE_5}} name=testnet-gear04 validator=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} +# ${{secrets.ARCHIVE_RPC_NODE}} name=testnet-archive-rpc-node rpc=yes unsafe=no archive_node=yes loki=yes loki_url=${{secrets.LOKI_URL}} gear_image_tag=${{ needs.tag-image.outputs.image_tag }} From 93f9eb1bf9b6ab0074564ee80676d12e4a25d3a9 Mon Sep 17 00:00:00 2001 From: ekovalev Date: Fri, 25 Aug 2023 10:33:12 +0400 Subject: [PATCH 097/165] feat(tests, cli): Add subcommand to `gear-replay-cli` tool (#3033) --- Cargo.lock | 1 + utils/gear-replay-cli/Cargo.toml | 12 +- utils/gear-replay-cli/README.md | 29 ++- utils/gear-replay-cli/src/cmd/gear_run.rs | 186 ++++++++++++++++ utils/gear-replay-cli/src/cmd/mod.rs | 20 ++ utils/gear-replay-cli/src/cmd/replay_block.rs | 205 ++++++++++++++++++ utils/gear-replay-cli/src/lib.rs | 118 ++++++++++ utils/gear-replay-cli/src/main.rs | 203 +---------------- utils/gear-replay-cli/src/parse.rs | 50 ++--- utils/gear-replay-cli/src/util.rs | 10 +- 10 files changed, 593 insertions(+), 241 deletions(-) create mode 100644 utils/gear-replay-cli/src/cmd/gear_run.rs create mode 100644 utils/gear-replay-cli/src/cmd/mod.rs create mode 100644 utils/gear-replay-cli/src/cmd/replay_block.rs create mode 100644 utils/gear-replay-cli/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index dd74162b287..ef84b4aaa7c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4035,6 +4035,7 @@ dependencies = [ "gear-runtime-interface", "gear-runtime-primitives", "gear-service", + "hex", "log", "parity-scale-codec", "sc-cli", diff --git a/utils/gear-replay-cli/Cargo.toml b/utils/gear-replay-cli/Cargo.toml index cb62d7fea0a..9b6ced5b567 100644 --- a/utils/gear-replay-cli/Cargo.toml +++ b/utils/gear-replay-cli/Cargo.toml @@ -7,10 +7,10 @@ license.workspace = true [dependencies] # Internal -vara-runtime = { workspace = true, optional = true } -gear-runtime = { workspace = true, optional = true } -gear-runtime-interface = { workspace = true, features = ["std"], optional = true } +gear-runtime-interface.workspace = true runtime-primitives.workspace = true +gear-runtime = { workspace = true, optional = true } +vara-runtime = { workspace = true, optional = true } service = { workspace = true, optional = true } # Substrate Primitives @@ -35,6 +35,7 @@ substrate-rpc-client.workspace = true # third-party codec.workspace = true clap = { workspace = true, features = ["derive"] } +hex.workspace = true log.workspace = true tokio = { workspace = true, features = ["macros"] } @@ -52,12 +53,11 @@ std = [ "sp-externalities/std", "sc-executor/std", "frame-system/std", + "gear-runtime-interface/std", "gear-runtime?/std", "vara-runtime?/std", ] -always-wasm = [ - "gear-runtime-interface", -] +always-wasm = [] vara-native = [ "service/vara-native", "vara-runtime", diff --git a/utils/gear-replay-cli/README.md b/utils/gear-replay-cli/README.md index ac8898c8538..67be521ba3f 100644 --- a/utils/gear-replay-cli/README.md +++ b/utils/gear-replay-cli/README.md @@ -104,12 +104,33 @@ Another difference from the `try-runtime` API is that in `gear-replay-cli` the b In order to use the native runtime build make sure the node is built with the Runtime spec version that matches the one currently uploaded on chain. -- Replay a block on Vara live chain +General command format and available subcommand are: + +```bash + gear-replay-cli -h + Commands of `gear-replay` CLI + + Usage: gear-replay-cli [OPTIONS] + + Commands: + replay-block Replay block subcommand + gear-run GearRun subcommand + help Print this message or the help of the given subcommand(s) + + Options: + -u, --uri The RPC url [default: wss://archive-rpc.vara-network.io:443] + -l, --log [...] Sets a custom logging filter. Syntax is `=`, e.g. -lsync=debug + -h, --help Print help (see more with '--help') +``` + +Currently supported cases include: + +- Replaying a block on a live chain - current latest finalized block on Vara chain ```bash - gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 -lgear::runtime=debug -lpallet_gear,gear_common,pallet_gear_scheduler=debug + gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 -lgear::runtime,pallet_gear,gear_common,pallet_gear_scheduler=debug replay-block ``` - block with `$HASH` or `$BLOCK_NUM` @@ -118,8 +139,8 @@ In order to use the native runtime build make sure the node is built with the Ru export HASH=0x8dc1e32576c1ad4e28dc141769576efdbc19d0170d427b69edb2261cfc36e905 export BLOCK_NUM=2000000 - gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 --block "$HASH" -lgear::runtime=debug -lpallet_gear,gear_common=debug - gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 --block "$BLOCK_NUM" -lgear::runtime=debug -lpallet_gear,gear_common=debug + gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 -lgear::runtime,pallet_gear,gear_common=debug replay-block --block "$HASH" + gear-replay-cli --uri wss://archive-rpc.vara-network.io:443 -lgear::runtime,pallet_gear,gear_common=debug replay-block --block "$BLOCK_NUM" ```
diff --git a/utils/gear-replay-cli/src/cmd/gear_run.rs b/utils/gear-replay-cli/src/cmd/gear_run.rs new file mode 100644 index 00000000000..1a946886978 --- /dev/null +++ b/utils/gear-replay-cli/src/cmd/gear_run.rs @@ -0,0 +1,186 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Replaying a block against the live chain state + +use crate::{parse, util::*, BlockHashOrNumber, SharedParams, LOG_TARGET}; +use clap::Parser; +use codec::{Decode, Encode, Joiner}; +#[cfg(feature = "always-wasm")] +use sc_executor::sp_wasm_interface::ExtendedHostFunctions; +#[cfg(all(not(feature = "always-wasm"), feature = "gear-native"))] +use service::GearExecutorDispatch; +#[cfg(all(not(feature = "always-wasm"), feature = "vara-native"))] +use service::VaraExecutorDispatch; +use sp_runtime::{ + generic::SignedBlock, + traits::{Block as BlockT, Header as HeaderT, One}, + ApplyExtrinsicResult, DeserializeOwned, Saturating, +}; +use sp_state_machine::ExecutionStrategy; +use std::{fmt::Debug, str::FromStr}; +use substrate_rpc_client::{ws_client, ChainApi}; + +/// GearRun subcommand +#[derive(Clone, Debug, Parser)] +pub struct GearRunCmd { + /// The block hash or number as of which the state (including the runtime) is fetched. + /// If omitted, the latest finalized block is used. + #[arg( + short, + long, + value_parser = parse::block, + )] + block: Option>, +} + +pub(crate) async fn gear_run( + shared: SharedParams, + command: GearRunCmd, +) -> sc_cli::Result<()> +where + Block: BlockT + DeserializeOwned, + Block::Header: DeserializeOwned, + Block::Hash: FromStr, + ::Err: Debug, +{ + // Initialize the RPC client. + // get the block number associated with this block. + let block_ws_uri = shared.uri.clone(); + let rpc = ws_client(&block_ws_uri).await?; + + let block_hash_or_num = match command.block.clone() { + Some(b) => b, + None => { + let height = ChainApi::< + (), + ::Hash, + ::Header, + SignedBlock, + >::finalized_head(&rpc) + .await + .map_err(rpc_err_handler)?; + + log::info!( + target: LOG_TARGET, + "Block is not provided, setting it to the latest finalized head: {:?}", + height + ); + + BlockHashOrNumber::Hash(height) + } + }; + + let (current_number, current_hash) = match block_hash_or_num { + BlockHashOrNumber::Number(n) => (n, block_number_to_hash::(&rpc, n).await?), + BlockHashOrNumber::Hash(hash) => (block_hash_to_number::(&rpc, hash).await?, hash), + }; + + // Get the state at the height corresponding to previous block. + let previous_hash = + block_number_to_hash::(&rpc, current_number.saturating_sub(One::one())).await?; + log::info!( + target: LOG_TARGET, + "Fetching state from {:?} at {:?}", + shared.uri, + previous_hash, + ); + let ext = + build_externalities::(shared.uri.clone(), Some(previous_hash), vec![], true).await?; + + log::info!(target: LOG_TARGET, "Fetching block {:?} ", current_hash); + let block = fetch_block::(&rpc, current_hash).await?; + + // A digest item gets added when the runtime is processing the block, so we need to pop + // the last one to be consistent with what a gossiped block would contain. + let (header, extrinsics) = block.deconstruct(); + + // Create executor, suitable for usage in conjunction with the preferred execution strategy. + #[cfg(all(not(feature = "always-wasm"), feature = "vara-native"))] + let executor = build_executor::(); + #[cfg(all(not(feature = "always-wasm"), feature = "gear-native"))] + let executor = build_executor::(); + #[cfg(feature = "always-wasm")] + let executor = build_executor::< + ExtendedHostFunctions< + sp_io::SubstrateHostFunctions, + ( + gear_runtime_interface::gear_ri::HostFunctions, + gear_runtime_interface::sandbox::HostFunctions, + ), + >, + >(); + + #[cfg(not(feature = "always-wasm"))] + let strategy = ExecutionStrategy::NativeElseWasm; + #[cfg(feature = "always-wasm")] + let strategy = ExecutionStrategy::AlwaysWasm; + + let (_changes, _enc_res) = state_machine_call( + &ext, + &executor, + "Core_initialize_block", + &vec![].and(&header), + full_extensions(), + strategy, + )?; + log::info!( + target: LOG_TARGET, + "Core_initialize_block completed for block {:?}", + header.number() + ); + + // Encoded `Gear::run` extrinsic: length byte 12 (3 << 2) + 104th pallet + 6th extrinsic + let gear_run_tx = vec![12_u8, 4, 104, 6]; + + // Drop the timestamp extrinsic which is always the first in the block + let extrinsics = extrinsics.into_iter().skip(1).collect::>(); + + for extrinsic in extrinsics { + let tx_encoded = extrinsic.encode(); + if tx_encoded != gear_run_tx { + // Apply all extrinsics in the block except for the timestamp and gear::run + let _ = state_machine_call( + &ext, + &executor, + "BlockBuilder_apply_extrinsic", + &tx_encoded, + full_extensions(), + strategy, + )?; + } + } + + // Applying the `gear_run()` in the end + let (_changes, enc_res) = state_machine_call( + &ext, + &executor, + "BlockBuilder_apply_extrinsic", + &gear_run_tx, + full_extensions(), + strategy, + )?; + let r = ApplyExtrinsicResult::decode(&mut &enc_res[..]).unwrap(); + log::info!( + target: LOG_TARGET, + "BlockBuilder_apply_extrinsic done with result {:?}", + r + ); + + Ok(()) +} diff --git a/utils/gear-replay-cli/src/cmd/mod.rs b/utils/gear-replay-cli/src/cmd/mod.rs new file mode 100644 index 00000000000..bc459aa569e --- /dev/null +++ b/utils/gear-replay-cli/src/cmd/mod.rs @@ -0,0 +1,20 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pub mod gear_run; +pub mod replay_block; diff --git a/utils/gear-replay-cli/src/cmd/replay_block.rs b/utils/gear-replay-cli/src/cmd/replay_block.rs new file mode 100644 index 00000000000..7be6ede95bc --- /dev/null +++ b/utils/gear-replay-cli/src/cmd/replay_block.rs @@ -0,0 +1,205 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Replaying a block against the live chain state + +use crate::{parse, util::*, BlockHashOrNumber, SharedParams, LOG_TARGET}; +use clap::Parser; +use codec::{Decode, Encode}; +#[cfg(feature = "always-wasm")] +use sc_executor::sp_wasm_interface::ExtendedHostFunctions; +#[cfg(all(not(feature = "always-wasm"), feature = "gear-native"))] +use service::GearExecutorDispatch; +#[cfg(all(not(feature = "always-wasm"), feature = "vara-native"))] +use service::VaraExecutorDispatch; +use sp_runtime::{ + generic::SignedBlock, + traits::{Block as BlockT, Header as HeaderT, One}, + DeserializeOwned, Saturating, +}; +use sp_state_machine::ExecutionStrategy; +use std::{fmt::Debug, str::FromStr}; +use substrate_rpc_client::{ws_client, ChainApi}; + +/// Replay block subcommand +#[derive(Clone, Debug, Parser)] +pub struct ReplayBlockCmd { + /// The block hash or number we want to replay. If omitted, the latest finalized block is used. + /// The blockchain state at previous block with respect to this parameter will be scraped. + #[arg( + short, + long, + value_parser = parse::block, + )] + block: Option>, + + /// Pallet(s) to scrape. Comma-separated multiple items are also accepted. + /// If empty, entire chain state will be scraped. + #[arg(short, long, num_args = 1..)] + pallet: Vec, + + /// Fetch the child-keys as well. + /// + /// Default is `false`, if specific `--pallets` are specified, `true` otherwise. In other + /// words, if you scrape the whole state the child tree data is included out of the box. + /// Otherwise, it must be enabled explicitly using this flag. + #[arg(long)] + child_tree: bool, + + /// Forces `Gear::run()` inherent to be placed in the block. + /// + /// In case the `Gear::run()` extrinsic has been dropped from a block due to panic, this flag + /// can be used to force the `Gear::run()` inherent to be placed in the block to reproduce the + /// issue. + #[arg(long, short)] + force_run: bool, +} + +pub(crate) async fn replay_block( + shared: SharedParams, + command: ReplayBlockCmd, +) -> sc_cli::Result<()> +where + Block: BlockT + DeserializeOwned, + Block::Header: DeserializeOwned, + Block::Hash: FromStr, + ::Err: Debug, +{ + // Initialize the RPC client. + // get the block number associated with this block. + let block_ws_uri = shared.uri.clone(); + let rpc = ws_client(&block_ws_uri).await?; + + let block_hash_or_num = match command.block.clone() { + Some(b) => b, + None => { + let height = ChainApi::< + (), + ::Hash, + ::Header, + SignedBlock, + >::finalized_head(&rpc) + .await + .map_err(rpc_err_handler)?; + + log::info!( + target: LOG_TARGET, + "Block is not provided, setting it to the latest finalized head: {:?}", + height + ); + + BlockHashOrNumber::Hash(height) + } + }; + + let (current_number, current_hash) = match block_hash_or_num { + BlockHashOrNumber::Number(n) => (n, block_number_to_hash::(&rpc, n).await?), + BlockHashOrNumber::Hash(hash) => (block_hash_to_number::(&rpc, hash).await?, hash), + }; + + // Get the state at the height corresponding to previous block. + let previous_hash = + block_number_to_hash::(&rpc, current_number.saturating_sub(One::one())).await?; + log::info!( + target: LOG_TARGET, + "Fetching state from {:?} at {:?}", + shared.uri, + previous_hash, + ); + let ext = build_externalities::( + shared.uri.clone(), + Some(previous_hash), + command.pallet.clone(), + command.child_tree, + ) + .await?; + + log::info!(target: LOG_TARGET, "Fetching block {:?} ", current_hash); + let block = fetch_block::(&rpc, current_hash).await?; + + let (mut header, mut extrinsics) = block.deconstruct(); + + // A digest item gets added when the runtime is processing the block, so we need to pop + // the last one to be consistent with what a gossiped block would contain. + header.digest_mut().pop(); + + // In case the `Gear::run()` extrinsic has been dropped due to panic, we re-insert it here. + // Timestamp inherent is always present hence `extrinsics` vector is not empty + assert!(!extrinsics.is_empty()); + + if command.force_run { + // Encoded `Gear::run` extrinsic: length byte 12 (3 << 2) + 104th pallet + 6th extrinsic + let gear_run_encoded = vec![12_u8, 4, 104, 6]; + // `Gear::run()`, is present, is always the last in the block. + let maybe_gear_run_idx = extrinsics.len() - 1; + if extrinsics[maybe_gear_run_idx].encode() != gear_run_encoded { + let gear_run_tx = ::Extrinsic::decode(&mut &gear_run_encoded[..]) + .expect("Failed to decode `Gear::run()` extrinsic"); + extrinsics.push(gear_run_tx); + } + } + + let block = Block::new(header, extrinsics); + + // Create executor, suitable for usage in conjunction with the preferred execution strategy. + #[cfg(all(not(feature = "always-wasm"), feature = "vara-native"))] + let executor = build_executor::(); + #[cfg(all(not(feature = "always-wasm"), feature = "gear-native"))] + let executor = build_executor::(); + #[cfg(feature = "always-wasm")] + let executor = build_executor::< + ExtendedHostFunctions< + sp_io::SubstrateHostFunctions, + ( + gear_runtime_interface::gear_ri::HostFunctions, + gear_runtime_interface::sandbox::HostFunctions, + ), + >, + >(); + + // for now, hardcoded for the sake of simplicity. We might customize them one day. + #[cfg(not(feature = "try-runtime"))] + let payload = block.encode(); + #[cfg(feature = "try-runtime")] + let payload = (block, false, false, "none").encode(); + #[cfg(not(feature = "try-runtime"))] + let method = "Core_execute_block"; + #[cfg(feature = "try-runtime")] + let method = "TryRuntime_execute_block"; + + #[cfg(not(feature = "always-wasm"))] + let strategy = ExecutionStrategy::NativeElseWasm; + #[cfg(feature = "always-wasm")] + let strategy = ExecutionStrategy::AlwaysWasm; + + let (_changes, _enc_res) = state_machine_call( + &ext, + &executor, + method, + &payload, + full_extensions(), + strategy, + )?; + log::info!( + target: LOG_TARGET, + "Core_execute_block for block {} completed", + current_number + ); + + Ok(()) +} diff --git a/utils/gear-replay-cli/src/lib.rs b/utils/gear-replay-cli/src/lib.rs new file mode 100644 index 00000000000..1f54a00d61f --- /dev/null +++ b/utils/gear-replay-cli/src/lib.rs @@ -0,0 +1,118 @@ +// This file is part of Gear. + +// Copyright (C) 2021-2023 Gear Technologies Inc. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Replaying a block against the live chain state + +use clap::{Parser, Subcommand}; +use cmd::*; +use runtime_primitives::Block; +use sc_tracing::logging::LoggerBuilder; +use sp_runtime::traits::{Block as BlockT, Header as HeaderT}; +use std::fmt::Debug; + +pub(crate) const LOG_TARGET: &str = "gear_replay"; + +mod cmd; +mod parse; +mod util; + +const VARA_SS58_PREFIX: u8 = 137; +const GEAR_SS58_PREFIX: u8 = 42; + +pub(crate) type HashFor = ::Hash; +pub(crate) type NumberFor = <::Header as HeaderT>::Number; + +#[derive(Clone, Debug)] +pub(crate) enum BlockHashOrNumber { + Hash(HashFor), + Number(NumberFor), +} + +/// Commands of `gear-replay` CLI +#[derive(Debug, Subcommand)] +pub enum Command { + ReplayBlock(replay_block::ReplayBlockCmd), + GearRun(gear_run::GearRunCmd), +} + +/// Parameters shared across the subcommands +#[derive(Clone, Debug, Parser)] +#[group(skip)] +pub struct SharedParams { + /// The RPC url. + #[arg( + short, + long, + value_parser = parse::url, + default_value = "wss://archive-rpc.vara-network.io:443" + )] + uri: String, + + /// Sets a custom logging filter. Syntax is `=`, e.g. -lsync=debug. + /// + /// Log levels (least to most verbose) are error, warn, info, debug, and trace. + /// By default, all targets log `info`. The global log level can be set with `-l`. + #[arg(short = 'l', long, value_name = "NODE_LOG", num_args = 0..)] + pub log: Vec, +} + +#[derive(Debug, Parser)] +struct ReplayCli { + #[clap(flatten)] + pub shared: SharedParams, + + /// Commands. + #[command(subcommand)] + pub command: Command, +} + +impl ReplayCli { + fn log_filters(&self) -> sc_cli::Result { + Ok(self.shared.log.join(",")) + } + + fn init_logger(&self) -> sc_cli::Result<()> { + let logger = LoggerBuilder::new(self.log_filters()?); + Ok(logger.init()?) + } +} + +pub async fn run() -> sc_cli::Result<()> { + gear_runtime_interface::sandbox_init(); + + let options = ReplayCli::parse(); + + options.init_logger()?; + + let ss58_prefix = match options.shared.uri.contains("vara") { + true => VARA_SS58_PREFIX, + false => GEAR_SS58_PREFIX, + }; + sp_core::crypto::set_default_ss58_version(ss58_prefix.try_into().unwrap()); + + match &options.command { + Command::ReplayBlock(cmd) => { + cmd::replay_block::replay_block::(options.shared.clone(), cmd.clone()).await? + } + Command::GearRun(cmd) => { + cmd::gear_run::gear_run::(options.shared.clone(), cmd.clone()).await? + } + } + + Ok(()) +} diff --git a/utils/gear-replay-cli/src/main.rs b/utils/gear-replay-cli/src/main.rs index ec3d332bc1c..2cc62fd4c07 100644 --- a/utils/gear-replay-cli/src/main.rs +++ b/utils/gear-replay-cli/src/main.rs @@ -1,6 +1,6 @@ // This file is part of Gear. -// Copyright (C) 2021-2022 Gear Technologies Inc. +// Copyright (C) 2021-2023 Gear Technologies Inc. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -16,206 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -//! Replaying a block against the live chain state - -use clap::Parser; -use codec::Encode; -use runtime_primitives::Block; -#[cfg(feature = "always-wasm")] -use sc_executor::sp_wasm_interface::ExtendedHostFunctions; -use sc_tracing::logging::LoggerBuilder; -#[cfg(all(not(feature = "always-wasm"), feature = "gear-native"))] -use service::GearExecutorDispatch; -#[cfg(all(not(feature = "always-wasm"), feature = "vara-native"))] -use service::VaraExecutorDispatch; -use sp_runtime::{ - generic::SignedBlock, - traits::{Block as BlockT, Header as HeaderT, One}, -}; -use sp_state_machine::ExecutionStrategy; -use std::fmt::Debug; -use substrate_rpc_client::{ws_client, ChainApi}; -use util::*; - -pub(crate) const LOG_TARGET: &str = "gear_replay"; - -mod parse; -mod util; - -const VARA_SS58_PREFIX: u8 = 137; -const GEAR_SS58_PREFIX: u8 = 42; - -pub(crate) type HashFor = ::Hash; -pub(crate) type NumberFor = <::Header as HeaderT>::Number; - -#[derive(Clone, Debug)] -pub(crate) enum BlockHashOrNumber { - Hash(HashFor), - Number(NumberFor), -} - -#[derive(Clone, Debug, Parser)] -struct Opt { - /// The RPC url. - #[arg( - short, - long, - value_parser = parse::url, - default_value = "wss://archive-rpc.vara-network.io:443" - )] - uri: String, - - /// The block hash or number we want to replay. If omitted, the latest finalized block is used. - /// The blockchain state at previous block with respect to this parameter will be scraped. - #[arg( - short, - long, - value_parser = parse::block, - )] - block: Option>, - - /// Pallet(s) to scrape. Comma-separated multiple items are also accepted. - /// If empty, entire chain state will be scraped. - #[arg(short, long, num_args = 1..)] - pallet: Vec, - - /// Fetch the child-keys as well. - /// - /// Default is `false`, if specific `--pallets` are specified, `true` otherwise. In other - /// words, if you scrape the whole state the child tree data is included out of the box. - /// Otherwise, it must be enabled explicitly using this flag. - #[arg(long)] - child_tree: bool, - - /// Sets a custom logging filter. Syntax is `=`, e.g. -lsync=debug. - /// - /// Log levels (least to most verbose) are error, warn, info, debug, and trace. - /// By default, all targets log `info`. The global log level can be set with `-l`. - #[arg(short = 'l', long, value_name = "NODE_LOG", num_args = 0..)] - pub log: Vec, -} - -impl Opt { - fn log_filters(&self) -> sc_cli::Result { - Ok(self.log.join(",")) - } -} - #[tokio::main] async fn main() -> sc_cli::Result<()> { - let options = Opt::parse(); - - let logger = LoggerBuilder::new(options.log_filters()?); - logger.init()?; - - let ss58_prefix = match options.uri.contains("vara") { - true => VARA_SS58_PREFIX, - false => GEAR_SS58_PREFIX, - }; - sp_core::crypto::set_default_ss58_version(ss58_prefix.try_into().unwrap()); - - // Initialize the RPC client. - // get the block number associated with this block. - let block_ws_uri = options.uri.clone(); - let rpc = ws_client(&block_ws_uri).await?; - - let block_hash_or_num = match options.block { - Some(b) => b, - None => { - let height = ChainApi::< - (), - ::Hash, - ::Header, - SignedBlock, - >::finalized_head(&rpc) - .await - .map_err(rpc_err_handler)?; - - log::info!( - target: LOG_TARGET, - "Block is not provided, setting it to the latest finalized head: {:?}", - height - ); - - BlockHashOrNumber::Hash(height) - } - }; - - let (current_number, current_hash) = match block_hash_or_num { - BlockHashOrNumber::Number(n) => (n, block_number_to_hash::(&rpc, n).await?), - BlockHashOrNumber::Hash(hash) => (block_hash_to_number::(&rpc, hash).await?, hash), - }; - - // Get the state at the height corresponding to previous block. - let previous_hash = - block_number_to_hash::(&rpc, current_number.saturating_sub(One::one())).await?; - log::info!( - target: LOG_TARGET, - "Fetching state from {:?} at {:?}", - options.uri, - previous_hash, - ); - let ext = build_externalities::( - options.uri, - Some(previous_hash), - options.pallet, - options.child_tree, - ) - .await?; - - log::info!(target: LOG_TARGET, "Fetching block {:?} ", current_hash); - let block = fetch_block::(&rpc, current_hash).await?; - - // A digest item gets added when the runtime is processing the block, so we need to pop - // the last one to be consistent with what a gossiped block would contain. - let (mut header, extrinsics) = block.deconstruct(); - header.digest_mut().pop(); - let block = Block::new(header, extrinsics); - - // Create executor, suitable for usage in conjunction with the preferred execution strategy. - #[cfg(all(not(feature = "always-wasm"), feature = "vara-native"))] - let executor = build_executor::(); - #[cfg(all(not(feature = "always-wasm"), feature = "gear-native"))] - let executor = build_executor::(); - #[cfg(feature = "always-wasm")] - let executor = build_executor::< - ExtendedHostFunctions< - sp_io::SubstrateHostFunctions, - ( - gear_runtime_interface::gear_ri::HostFunctions, - gear_runtime_interface::sandbox::HostFunctions, - ), - >, - >(); - - // for now, hardcoded for the sake of simplicity. We might customize them one day. - #[cfg(not(feature = "try-runtime"))] - let payload = block.encode(); - #[cfg(feature = "try-runtime")] - let payload = (block, false, false, "none").encode(); - #[cfg(not(feature = "try-runtime"))] - let method = "Core_execute_block"; - #[cfg(feature = "try-runtime")] - let method = "TryRuntime_execute_block"; - - #[cfg(not(feature = "always-wasm"))] - let strategy = ExecutionStrategy::NativeElseWasm; - #[cfg(feature = "always-wasm")] - let strategy = ExecutionStrategy::AlwaysWasm; - - let (_changes, _enc_res) = state_machine_call( - &ext, - &executor, - method, - &payload, - full_extensions(), - strategy, - )?; - log::info!( - target: LOG_TARGET, - "Core_execute_block for block {} completed", - current_number - ); - - Ok(()) + gear_replay_cli::run().await } diff --git a/utils/gear-replay-cli/src/parse.rs b/utils/gear-replay-cli/src/parse.rs index 2bc57a62644..39582f3cb4b 100644 --- a/utils/gear-replay-cli/src/parse.rs +++ b/utils/gear-replay-cli/src/parse.rs @@ -1,6 +1,6 @@ // This file is part of Gear. -// Copyright (C) 2021-2022 Gear Technologies Inc. +// Copyright (C) 2021-2023 Gear Technologies Inc. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -18,21 +18,8 @@ //! Utils for parsing input args -use crate::{Block, BlockHashOrNumber, HashFor, NumberFor}; - -pub(crate) fn hash(block_hash: &str) -> Result { - let (block_hash, offset) = if let Some(block_hash) = block_hash.strip_prefix("0x") { - (block_hash, 2) - } else { - (block_hash, 0) - }; - - if let Some(pos) = block_hash.chars().position(|c| !c.is_ascii_hexdigit()) { - Err(offset + pos) - } else { - Ok(block_hash.into()) - } -} +use crate::{Block, BlockHashOrNumber, NumberFor}; +use hex::FromHexError; pub(crate) fn url(s: &str) -> Result { if s.starts_with("ws://") || s.starts_with("wss://") { @@ -46,18 +33,29 @@ pub(crate) fn block(block_hash_or_number: &str) -> Result>() { Ok(BlockHashOrNumber::Number(block_number)) } else { - let block_hash = hash(block_hash_or_number).map_err(|e| { - format!("Expected block hash or number, found illegal hex character at position {e}") - })?; - if block_hash.len() != 64 { + // Check that the hexadecimal input is, in fact, a hex string + let block_hash_bytes = + hex::decode(block_hash_or_number.trim_start_matches("0x")).map_err(|e| match e { + FromHexError::InvalidHexCharacter { c, index } => { + format!("invalid hex character '{}' at position {}", c, index) + } + FromHexError::OddLength => "hex string has an odd number of characters".to_string(), + _ => { + format!("failed to parse block hash: {e}") + } + })?; + + // Check the length is correct + if block_hash_bytes.len() != 32 { return Err(format!( "Expected block hash or number, found a hex string of length {}", - block_hash.len() + block_hash_bytes.len() * 2 )); - }; - block_hash - .parse::>() - .map(BlockHashOrNumber::Hash) - .map_err(|e| format!("Failed to parse block hash: {e}")) + } + + let mut block_hash = [0; 32]; + block_hash.copy_from_slice(&block_hash_bytes); + + Ok(BlockHashOrNumber::Hash(block_hash.into())) } } diff --git a/utils/gear-replay-cli/src/util.rs b/utils/gear-replay-cli/src/util.rs index e9d1b10b7fd..f6724c7d257 100644 --- a/utils/gear-replay-cli/src/util.rs +++ b/utils/gear-replay-cli/src/util.rs @@ -1,6 +1,6 @@ // This file is part of Gear. -// Copyright (C) 2021-2022 Gear Technologies Inc. +// Copyright (C) 2021-2023 Gear Technologies Inc. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify @@ -23,11 +23,11 @@ use crate::{HashFor, NumberFor, LOG_TARGET}; use frame_remote_externalities::{ Builder, Mode, OnlineConfig, RemoteExternalities, TestExternalities, }; -use sc_executor::WasmExecutor; #[cfg(feature = "always-wasm")] -use sc_executor::{sp_wasm_interface::HostFunctions, WasmtimeInstantiationStrategy}; +use sc_executor::sp_wasm_interface::HostFunctions; #[cfg(not(feature = "always-wasm"))] use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch}; +use sc_executor::{WasmExecutor, WasmtimeInstantiationStrategy}; use sp_core::{ offchain::{ testing::{TestOffchainExt, TestTransactionPoolExt}, @@ -59,7 +59,9 @@ pub(crate) fn build_executor() -> NativeElseWasmExec let runtime_cache_size = 2; NativeElseWasmExecutor::::new_with_wasm_executor(WasmExecutor::new( - sc_executor::WasmExecutionMethod::Interpreted, + sc_executor::WasmExecutionMethod::Compiled { + instantiation_strategy: WasmtimeInstantiationStrategy::RecreateInstanceCopyOnWrite, + }, heap_pages, max_runtime_instances, None, From d96408ef955b0c5fd5a731c199a062595935ed12 Mon Sep 17 00:00:00 2001 From: Dennis Diatlov Date: Fri, 25 Aug 2023 10:48:18 +0100 Subject: [PATCH 098/165] feat(rpc)!: Introduce payload parameter for read_state_using_wasm rpc call (#3173) --- gcli/src/cmd/program.rs | 2 +- gclient/src/api/rpc.rs | 32 +++++++++++--- gclient/tests/state.rs | 1 + gsdk/src/rpc.rs | 2 + pallets/gear/rpc/runtime-api/src/lib.rs | 3 +- pallets/gear/rpc/src/lib.rs | 3 ++ pallets/gear/src/lib.rs | 3 +- pallets/gear/src/runtime_api.rs | 4 +- pallets/gear/src/tests.rs | 56 +++++++++++++++++++------ runtime/common/src/apis.rs | 3 +- 10 files changed, 86 insertions(+), 23 deletions(-) diff --git a/gcli/src/cmd/program.rs b/gcli/src/cmd/program.rs index e57de57616b..b3ccfdd9b0e 100644 --- a/gcli/src/cmd/program.rs +++ b/gcli/src/cmd/program.rs @@ -93,7 +93,7 @@ impl Program { at: Option, ) -> Result<()> { let state = api - .read_state_using_wasm(pid, method, wasm, args, at) + .read_state_using_wasm(pid, Default::default(), method, wasm, args, at) .await?; println!("{}", state); Ok(()) diff --git a/gclient/src/api/rpc.rs b/gclient/src/api/rpc.rs index e1afb50312b..7659c4acfdf 100644 --- a/gclient/src/api/rpc.rs +++ b/gclient/src/api/rpc.rs @@ -262,11 +262,12 @@ impl GearApi { pub async fn read_state_bytes_using_wasm( &self, program_id: ProgramId, + payload: Vec, fn_name: &str, wasm: Vec, argument: Option>, ) -> Result> { - self.read_state_bytes_using_wasm_at(program_id, fn_name, wasm, argument, None) + self.read_state_bytes_using_wasm_at(program_id, payload, fn_name, wasm, argument, None) .await } @@ -274,6 +275,7 @@ impl GearApi { pub async fn read_state_bytes_using_wasm_at( &self, program_id: ProgramId, + payload: Vec, fn_name: &str, wasm: Vec, argument: Option>, @@ -282,7 +284,14 @@ impl GearApi { let response: String = self .0 .api() - .read_state_using_wasm(H256(program_id.into()), fn_name, wasm, argument, at) + .read_state_using_wasm( + H256(program_id.into()), + payload, + fn_name, + wasm, + argument, + at, + ) .await?; crate::utils::hex_to_vec(response).map_err(Into::into) } @@ -291,11 +300,12 @@ impl GearApi { pub async fn read_state_using_wasm( &self, program_id: ProgramId, + payload: Vec, fn_name: &str, wasm: Vec, argument: Option, ) -> Result { - self.read_state_using_wasm_at(program_id, fn_name, wasm, argument, None) + self.read_state_using_wasm_at(program_id, payload, fn_name, wasm, argument, None) .await } @@ -304,6 +314,7 @@ impl GearApi { pub async fn read_state_using_wasm_at( &self, program_id: ProgramId, + payload: Vec, fn_name: &str, wasm: Vec, argument: Option, @@ -312,6 +323,7 @@ impl GearApi { let bytes = self .read_state_bytes_using_wasm_at( program_id, + payload, fn_name, wasm, argument.map(|v| v.encode()), @@ -327,18 +339,22 @@ impl GearApi { pub async fn read_state_bytes_using_wasm_by_path( &self, program_id: ProgramId, + payload: Vec, fn_name: &str, path: impl AsRef, argument: Option>, ) -> Result> { - self.read_state_bytes_using_wasm_by_path_at(program_id, fn_name, path, argument, None) - .await + self.read_state_bytes_using_wasm_by_path_at( + program_id, payload, fn_name, path, argument, None, + ) + .await } /// Same as [`read_state_using_wasm_by_path`](Self::read_state_using_wasm_by_path), but reads the program's state at the block identified by its hash. pub async fn read_state_bytes_using_wasm_by_path_at( &self, program_id: ProgramId, + payload: Vec, fn_name: &str, path: impl AsRef, argument: Option>, @@ -346,6 +362,7 @@ impl GearApi { ) -> Result> { self.read_state_bytes_using_wasm_at( program_id, + payload, fn_name, utils::code_from_os(path.as_ref())?, argument, @@ -359,11 +376,12 @@ impl GearApi { pub async fn read_state_using_wasm_by_path( &self, program_id: ProgramId, + payload: Vec, fn_name: &str, path: impl AsRef, argument: Option, ) -> Result { - self.read_state_using_wasm_by_path_at(program_id, fn_name, path, argument, None) + self.read_state_using_wasm_by_path_at(program_id, payload, fn_name, path, argument, None) .await } @@ -371,6 +389,7 @@ impl GearApi { pub async fn read_state_using_wasm_by_path_at( &self, program_id: ProgramId, + payload: Vec, fn_name: &str, path: impl AsRef, argument: Option, @@ -379,6 +398,7 @@ impl GearApi { let bytes = self .read_state_bytes_using_wasm_by_path_at( program_id, + payload, fn_name, path, argument.map(|v| v.encode()), diff --git a/gclient/tests/state.rs b/gclient/tests/state.rs index 10f7beb7ee5..82783058664 100644 --- a/gclient/tests/state.rs +++ b/gclient/tests/state.rs @@ -67,6 +67,7 @@ async fn get_state() -> anyhow::Result<()> { let wallet: Option = api .read_state_using_wasm( program_id, + Default::default(), "first_wallet", demo_new_meta::META_WASM_V1.to_vec(), >::None, diff --git a/gsdk/src/rpc.rs b/gsdk/src/rpc.rs index ecab4c28339..af866e0f6f2 100644 --- a/gsdk/src/rpc.rs +++ b/gsdk/src/rpc.rs @@ -156,6 +156,7 @@ impl Api { pub async fn read_state_using_wasm( &self, pid: H256, + payload: Vec, method: &str, wasm: Vec, args: Option>, @@ -166,6 +167,7 @@ impl Api { "gear_readStateUsingWasm", rpc_params![ pid, + hex::encode(payload), hex::encode(method), hex::encode(wasm), args.map(hex::encode), diff --git a/pallets/gear/rpc/runtime-api/src/lib.rs b/pallets/gear/rpc/runtime-api/src/lib.rs index 6de80ffcfe8..20a92db927e 100644 --- a/pallets/gear/rpc/runtime-api/src/lib.rs +++ b/pallets/gear/rpc/runtime-api/src/lib.rs @@ -33,7 +33,8 @@ sp_api::decl_runtime_apis! { fn read_state(program_id: H256, payload: Vec) -> Result, Vec>; - fn read_state_using_wasm(program_id: H256, fn_name: Vec, wasm: Vec, argument: Option>) -> Result, Vec>; + #[allow(clippy::too_many_arguments)] + fn read_state_using_wasm(program_id: H256, payload: Vec, fn_name: Vec, wasm: Vec, argument: Option>) -> Result, Vec>; fn read_metahash(program_id: H256) -> Result>; } diff --git a/pallets/gear/rpc/src/lib.rs b/pallets/gear/rpc/src/lib.rs index ad5d763d1b9..0ede52fdf16 100644 --- a/pallets/gear/rpc/src/lib.rs +++ b/pallets/gear/rpc/src/lib.rs @@ -105,6 +105,7 @@ pub trait GearApi { fn read_state_using_wasm( &self, program_id: H256, + payload: Bytes, fn_name: Bytes, wasm: Bytes, argument: Option, @@ -338,6 +339,7 @@ where fn read_state_using_wasm( &self, program_id: H256, + payload: Bytes, fn_name: Bytes, wasm: Bytes, argument: Option, @@ -349,6 +351,7 @@ where api.read_state_using_wasm( at_hash, program_id, + payload.to_vec(), fn_name.to_vec(), wasm.to_vec(), argument.map(|v| v.to_vec()), diff --git a/pallets/gear/src/lib.rs b/pallets/gear/src/lib.rs index 6e36f6e05fe..0378c728232 100644 --- a/pallets/gear/src/lib.rs +++ b/pallets/gear/src/lib.rs @@ -697,6 +697,7 @@ pub mod pallet { pub fn read_state_using_wasm( program_id: H256, + payload: Vec, fn_name: Vec, wasm: Vec, argument: Option>, @@ -706,7 +707,7 @@ pub mod pallet { let fn_name = String::from_utf8(fn_name) .map_err(|_| "Non-utf8 function name".as_bytes().to_vec())?; - Self::read_state_using_wasm_impl(program_id, fn_name, wasm, argument) + Self::read_state_using_wasm_impl(program_id, payload, fn_name, wasm, argument) .map_err(String::into_bytes) } diff --git a/pallets/gear/src/runtime_api.rs b/pallets/gear/src/runtime_api.rs index 96793ae3b51..f59c4e568fb 100644 --- a/pallets/gear/src/runtime_api.rs +++ b/pallets/gear/src/runtime_api.rs @@ -272,6 +272,7 @@ where pub(crate) fn read_state_using_wasm_impl( program_id: ProgramId, + payload: Vec, function: impl Into, wasm: Vec, argument: Option>, @@ -307,8 +308,9 @@ where let instrumented_code = code_and_id.into_parts().0; + let payload_arg = payload; let mut payload = argument.unwrap_or_default(); - payload.append(&mut Self::read_state_impl(program_id, Default::default())?); + payload.append(&mut Self::read_state_impl(program_id, payload_arg)?); let block_info = BlockInfo { height: Self::block_number().unique_saturated_into(), diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index 1814423b1e8..f770797b74b 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -2038,8 +2038,14 @@ fn read_state_using_wasm_works() { let func1 = "last_wallet"; assert!(META_EXPORTS_V1.contains(&func1)); - let res = Gear::read_state_using_wasm_impl(program_id, func1, META_WASM_V1.to_vec(), None) - .expect("Failed to read state"); + let res = Gear::read_state_using_wasm_impl( + program_id, + Default::default(), + func1, + META_WASM_V1.to_vec(), + None, + ) + .expect("Failed to read state"); assert_eq!(res, expected); @@ -2059,6 +2065,7 @@ fn read_state_using_wasm_works() { let res = Gear::read_state_using_wasm_impl( program_id, + Default::default(), func2, META_WASM_V2.to_vec(), Some(id.encode()), @@ -2078,6 +2085,7 @@ fn read_state_bn_and_timestamp_works() { let res = Gear::read_state_using_wasm_impl( program_id, + Default::default(), "block_number", META_WASM_V3.to_vec(), None, @@ -2091,6 +2099,7 @@ fn read_state_bn_and_timestamp_works() { let res = Gear::read_state_using_wasm_impl( program_id, + Default::default(), "block_timestamp", META_WASM_V3.to_vec(), None, @@ -2149,9 +2158,14 @@ fn wasm_metadata_generation_works() { assert!(Gear::is_initialized(program_id)); - let m1 = - Gear::read_state_using_wasm_impl(program_id, "metadata", META_WASM_V1.to_vec(), None) - .expect("Failed to read state"); + let m1 = Gear::read_state_using_wasm_impl( + program_id, + Default::default(), + "metadata", + META_WASM_V1.to_vec(), + None, + ) + .expect("Failed to read state"); let metadata1 = gmeta::MetawasmData::decode(&mut m1.as_ref()).expect("Failed to decode metadata"); @@ -2162,9 +2176,14 @@ fn wasm_metadata_generation_works() { expected_exports_1.sort(); assert_eq!(exports1, expected_exports_1); - let m2 = - Gear::read_state_using_wasm_impl(program_id, "metadata", META_WASM_V2.to_vec(), None) - .expect("Failed to read state"); + let m2 = Gear::read_state_using_wasm_impl( + program_id, + Default::default(), + "metadata", + META_WASM_V2.to_vec(), + None, + ) + .expect("Failed to read state"); let metadata2 = gmeta::MetawasmData::decode(&mut m2.as_ref()).expect("Failed to decode metadata"); @@ -2212,17 +2231,30 @@ fn read_state_using_wasm_errors() { // Inexistent function assert!(Gear::read_state_using_wasm_impl( program_id, + Default::default(), "inexistent", meta_wasm.clone(), None ) .is_err()); // Empty function - assert!( - Gear::read_state_using_wasm_impl(program_id, "empty", meta_wasm.clone(), None).is_err() - ); + assert!(Gear::read_state_using_wasm_impl( + program_id, + Default::default(), + "empty", + meta_wasm.clone(), + None + ) + .is_err()); // Greed function - assert!(Gear::read_state_using_wasm_impl(program_id, "loop", meta_wasm, None).is_err()); + assert!(Gear::read_state_using_wasm_impl( + program_id, + Default::default(), + "loop", + meta_wasm, + None + ) + .is_err()); }); } diff --git a/runtime/common/src/apis.rs b/runtime/common/src/apis.rs index 4d604c6dafd..c94c2d03934 100644 --- a/runtime/common/src/apis.rs +++ b/runtime/common/src/apis.rs @@ -173,11 +173,12 @@ macro_rules! impl_runtime_apis_plus_common { fn read_state_using_wasm( program_id: H256, + payload: Vec, fn_name: Vec, wasm: Vec, argument: Option>, ) -> Result, Vec> { - Gear::read_state_using_wasm(program_id, fn_name, wasm, argument) + Gear::read_state_using_wasm(program_id, payload, fn_name, wasm, argument) } fn read_metahash(program_id: H256) -> Result> { From 0677deae2d9d06576a4b42012063e149a290d72c Mon Sep 17 00:00:00 2001 From: Arsenii Lyashenko Date: Fri, 25 Aug 2023 14:54:17 +0400 Subject: [PATCH 099/165] chore(core-backend)!: Remove `gear-backend-wasmi` (#3151) --- Cargo.lock | 22 +- Cargo.toml | 1 - core-backend/wasmi/Cargo.toml | 29 --- core-backend/wasmi/src/env.rs | 330 --------------------------- core-backend/wasmi/src/funcs_tree.rs | 177 -------------- core-backend/wasmi/src/lib.rs | 32 --- core-backend/wasmi/src/memory.rs | 199 ---------------- core-backend/wasmi/src/runtime.rs | 303 ------------------------ gcli/Cargo.toml | 2 +- gcli/src/meta/mod.rs | 2 +- gtest/Cargo.toml | 2 +- gtest/src/error.rs | 5 - gtest/src/manager.rs | 8 +- pallets/gear/Cargo.toml | 2 - utils/wasm-instrument/Cargo.toml | 5 +- utils/wasm-instrument/src/tests.rs | 4 +- 16 files changed, 14 insertions(+), 1109 deletions(-) delete mode 100644 core-backend/wasmi/Cargo.toml delete mode 100644 core-backend/wasmi/src/env.rs delete mode 100644 core-backend/wasmi/src/funcs_tree.rs delete mode 100644 core-backend/wasmi/src/lib.rs delete mode 100644 core-backend/wasmi/src/memory.rs delete mode 100644 core-backend/wasmi/src/runtime.rs diff --git a/Cargo.lock b/Cargo.lock index ef84b4aaa7c..3077c6e71fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3588,7 +3588,7 @@ dependencies = [ "dirs", "env_logger", "etc", - "gear-backend-wasmi", + "gear-backend-sandbox", "gear-core", "gear-core-errors", "gear-core-processor", @@ -3756,20 +3756,6 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "gear-backend-wasmi" -version = "0.3.2" -dependencies = [ - "derive_more", - "gear-backend-common", - "gear-core", - "gear-core-errors", - "gear-wasm-instrument", - "log", - "parity-scale-codec", - "wasmi 0.14.0", -] - [[package]] name = "gear-bags-thresholds" version = "1.0.0" @@ -4386,7 +4372,7 @@ version = "0.3.2" dependencies = [ "enum-iterator 1.4.1", "gear-backend-common", - "gear-backend-wasmi", + "gear-backend-sandbox", "gear-core", "gwasm-instrument", "wasmparser-nostd 0.100.1", @@ -4694,7 +4680,7 @@ dependencies = [ "derive_more", "env_logger", "gear-backend-common", - "gear-backend-wasmi", + "gear-backend-sandbox", "gear-core", "gear-core-errors", "gear-core-processor", @@ -7343,7 +7329,6 @@ dependencies = [ "frame-system", "gear-backend-common", "gear-backend-sandbox", - "gear-backend-wasmi", "gear-common", "gear-core", "gear-core-errors", @@ -14105,7 +14090,6 @@ dependencies = [ "memory_units", "num-rational", "num-traits", - "region", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e6b7e21d4b4..21140e22694 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -197,7 +197,6 @@ gear-authorship = { path = "node/authorship" } gear-backend-codegen = { path = "core-backend/codegen" } gear-backend-common = { path = "core-backend/common" } gear-backend-sandbox = { path = "core-backend/sandbox", default-features = false } -gear-backend-wasmi = { path = "core-backend/wasmi", default-features = false } gear-call-gen = { path = "utils/call-gen" } gear-common = { path = "common", default-features = false } gear-common-codegen = { path = "common/codegen" } diff --git a/core-backend/wasmi/Cargo.toml b/core-backend/wasmi/Cargo.toml deleted file mode 100644 index 6faac3dd2bc..00000000000 --- a/core-backend/wasmi/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "gear-backend-wasmi" -description = "Wasmi executor for the gear-backend" -keywords = ["gear", "wasm", "wasm-executor"] -categories = ["wasm"] -version.workspace = true -authors.workspace = true -edition.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true - -[dependencies] -gear-core.workspace = true -gear-core-errors = { workspace = true, features = ["codec"] } -gear-backend-common.workspace = true -gear-wasm-instrument.workspace = true - -codec.workspace = true -derive_more.workspace = true -log.workspace = true -wasmi.workspace = true - -[dev-dependencies] -gear-backend-common = { workspace = true, features = ["mock"] } - -[features] -default = ["std"] -std = ["wasmi/virtual_memory", "wasmi/std", "gear-wasm-instrument/std", "log/std"] diff --git a/core-backend/wasmi/src/env.rs b/core-backend/wasmi/src/env.rs deleted file mode 100644 index ddf03c1469c..00000000000 --- a/core-backend/wasmi/src/env.rs +++ /dev/null @@ -1,330 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-lat&er WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! wasmi environment for running a module. - -use crate::{funcs_tree, memory::MemoryWrap}; -use alloc::{collections::BTreeSet, format, string::ToString}; -use core::{any::Any, convert::Infallible, fmt::Display}; -use gear_backend_common::{ - lazy_pages::{GlobalsAccessConfig, GlobalsAccessError, GlobalsAccessMod, GlobalsAccessor}, - runtime::RunFallibleError, - state::{HostState, State}, - ActorTerminationReason, BackendAllocSyscallError, BackendExternalities, BackendReport, - BackendSyscallError, BackendTermination, Environment, EnvironmentError, - EnvironmentExecutionResult, LimitedStr, -}; -use gear_core::{ - env::Externalities, - memory::HostPointer, - message::{DispatchKind, WasmEntryPoint}, - pages::{PageNumber, WasmPage}, -}; -use gear_wasm_instrument::{GLOBAL_NAME_GAS, STACK_END_EXPORT_NAME}; -use wasmi::{ - core::Value, Engine, Extern, Global, Instance, Linker, Memory, MemoryType, Module, Store, -}; - -#[derive(Debug, derive_more::Display, derive_more::From)] -pub enum WasmiEnvironmentError { - #[from] - #[display(fmt = "Failed to create env memory: {_0:?}")] - CreateEnvMemory(wasmi::errors::MemoryError), - #[from] - #[display(fmt = "Unable to link item: {_0:?}")] - Linking(wasmi::errors::LinkerError), - #[display(fmt = "Gas counter not found or has wrong type")] - WrongInjectedGas, -} - -macro_rules! gas_amount { - ($store:ident) => { - $store - .state() - .as_ref() - .unwrap_or_else(|| unreachable!("State must be set in `WasmiEnvironment::new`; qed")) - .ext - .gas_amount() - }; -} - -/// Environment to run one module at a time providing Ext. -pub struct WasmiEnvironment -where - Ext: Externalities, - EntryPoint: WasmEntryPoint, -{ - instance: Instance, - store: Store>, - memory: Memory, - entries: BTreeSet, - entry_point: EntryPoint, -} - -struct GlobalsAccessProvider { - instance: Instance, - store: Option>>, -} - -impl GlobalsAccessProvider { - fn get_global(&self, name: &str) -> Option { - let store = self.store.as_ref()?; - self.instance - .get_export(store, name) - .and_then(|export| export.into_global()) - } -} - -impl GlobalsAccessor for GlobalsAccessProvider { - fn get_i64(&self, name: &LimitedStr) -> Result { - self.get_global(name.as_str()) - .and_then(|global| { - let store = self.store.as_ref()?; - if let Value::I64(val) = global.get(store) { - Some(val) - } else { - None - } - }) - .ok_or(GlobalsAccessError) - } - - fn set_i64(&mut self, name: &LimitedStr, value: i64) -> Result<(), GlobalsAccessError> { - self.get_global(name.as_str()) - .and_then(|global| { - let store = self.store.as_mut()?; - global.set(store, Value::I64(value)).ok() - }) - .ok_or(GlobalsAccessError) - } - - fn as_any_mut(&mut self) -> &mut dyn Any { - self - } -} - -impl Environment for WasmiEnvironment -where - EnvExt: BackendExternalities + 'static, - EnvExt::UnrecoverableError: BackendSyscallError, - RunFallibleError: From, - EnvExt::AllocError: BackendAllocSyscallError, - EntryPoint: WasmEntryPoint, -{ - type Ext = EnvExt; - type Memory = MemoryWrap; - type SystemError = WasmiEnvironmentError; - - fn new( - ext: Self::Ext, - binary: &[u8], - entry_point: EntryPoint, - entries: BTreeSet, - mem_size: WasmPage, - ) -> Result> { - use EnvironmentError::*; - use WasmiEnvironmentError::*; - - let engine = Engine::default(); - let mut store: Store> = Store::new(&engine, None); - - let mut linker: Linker> = Linker::new(); - - let memory_type = MemoryType::new(mem_size.raw(), None); - let memory = - Memory::new(&mut store, memory_type).map_err(|e| System(CreateEnvMemory(e)))?; - - linker - .define("env", "memory", memory) - .map_err(|e| System(Linking(e)))?; - - let entry_forbidden = entry_point - .try_into_kind() - .as_ref() - .map(DispatchKind::forbidden_funcs) - .unwrap_or_default(); - - let forbidden_funcs = ext - .forbidden_funcs() - .iter() - .copied() - .chain(entry_forbidden) - .collect(); - - let functions = funcs_tree::build(&mut store, memory, forbidden_funcs); - for (name, function) in functions { - linker - .define("env", name.to_str(), function) - .map_err(|e| System(Linking(e)))?; - } - let module = Module::new(store.engine(), binary) - .map_err(|e| Actor(ext.gas_amount(), e.to_string()))?; - - let runtime = State { - ext, - memory, - termination_reason: ActorTerminationReason::Success.into(), - }; - - *store.state_mut() = Some(runtime); - - let instance_pre = linker - .instantiate(&mut store, &module) - .map_err(|e| Actor(gas_amount!(store), e.to_string()))?; - - let instance = instance_pre - .ensure_no_start(&mut store) - .map_err(|e| Actor(gas_amount!(store), e.to_string()))?; - - Ok(Self { - instance, - store, - memory, - entries, - entry_point, - }) - } - - fn execute( - self, - prepare_memory: PrepareMemory, - ) -> EnvironmentExecutionResult - where - PrepareMemory: FnOnce( - &mut Self::Memory, - Option, - GlobalsAccessConfig, - ) -> Result<(), PrepareMemoryError>, - PrepareMemoryError: Display, - { - use EnvironmentError::*; - use WasmiEnvironmentError::*; - - let Self { - instance, - mut store, - memory, - entries, - entry_point, - } = self; - - let stack_end = instance - .get_export(&store, STACK_END_EXPORT_NAME) - .and_then(Extern::into_global) - .and_then(|g| g.get(&store).try_into::()); - - let gas = store - .state_mut() - .as_mut() - .unwrap_or_else(|| unreachable!("State must be set in `WasmiEnvironment::new`")) - .ext - .define_current_counter(); - - let gear_gas = instance - .get_export(&store, GLOBAL_NAME_GAS) - .and_then(Extern::into_global) - .and_then(|g| g.set(&mut store, Value::I64(gas as i64)).map(|_| g).ok()) - .ok_or(System(WrongInjectedGas))?; - - let mut globals_provider = GlobalsAccessProvider { - instance, - store: None, - }; - let globals_provider_dyn_ref = &mut globals_provider as &mut dyn GlobalsAccessor; - - let needs_execution = entry_point - .try_into_kind() - .map(|kind| entries.contains(&kind)) - .unwrap_or(true); - - // Pointer to the globals access provider is valid until the end of `execute` method. - // So, we can safely use it inside lazy-pages and be sure that it points to the valid object. - // We cannot guaranty that `store` (and so globals also) will be in a valid state, - // because executor mut-borrows `store` during execution. But if it's in a valid state - // each moment when protect memory signal can occur, than this trick is pretty safe. - let globals_access_ptr = &globals_provider_dyn_ref as *const _ as HostPointer; - - let globals_config = GlobalsAccessConfig { - access_ptr: globals_access_ptr, - access_mod: GlobalsAccessMod::NativeRuntime, - }; - - let mut memory_wrap = MemoryWrap::new(memory, store); - prepare_memory(&mut memory_wrap, stack_end, globals_config).map_err(|e| { - let store = &memory_wrap.store; - PrepareMemory(gas_amount!(store), e) - })?; - - let mut store = memory_wrap.into_store(); - let res = if needs_execution { - let func = instance - .get_export(&store, entry_point.as_entry()) - .and_then(Extern::into_func) - .ok_or(Actor( - gas_amount!(store), - format!("Entry export `{}` not found", entry_point.as_entry()), - ))?; - - let entry_func = func.typed::<(), (), _>(&mut store).map_err(|_| { - Actor( - gas_amount!(store), - format!("Wrong type of entry `{}`", entry_point.as_entry()), - ) - })?; - - let store_option = &mut globals_provider_dyn_ref - .as_any_mut() - .downcast_mut::>() - // Provider is `GlobalsAccessProvider`, so panic is impossible. - .unwrap_or_else(|| unreachable!("Provider must be `GlobalsAccessProvider`")) - .store; - - store_option.replace(store); - let res = entry_func.call( - store_option - .as_mut() - // We set store above, so panic is impossible. - .unwrap_or_else(|| unreachable!("Store must be set before")), - (), - ); - store = globals_provider.store.take().unwrap(); - - res - } else { - Ok(()) - }; - - let gas = gear_gas - .get(&store) - .try_into::() - .ok_or(System(WrongInjectedGas))?; - - let state = store - .state_mut() - .take() - .unwrap_or_else(|| unreachable!("State must be set in `WasmiEnvironment::new`; qed")); - - let (ext, termination_reason) = state.terminate(res, gas as u64); - - Ok(BackendReport { - termination_reason, - memory_wrap: MemoryWrap::new(memory, store), - ext, - }) - } -} diff --git a/core-backend/wasmi/src/funcs_tree.rs b/core-backend/wasmi/src/funcs_tree.rs deleted file mode 100644 index 78dacbf2a9a..00000000000 --- a/core-backend/wasmi/src/funcs_tree.rs +++ /dev/null @@ -1,177 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! `build` function that collects all the syscalls. - -use crate::{runtime::CallerWrap, wasmi::Caller}; -use alloc::collections::{BTreeMap, BTreeSet}; -use gear_backend_common::{ - funcs::FuncsHandler as CommonFuncsHandler, runtime::RunFallibleError, state::HostState, - BackendAllocSyscallError, BackendExternalities, BackendSyscallError, -}; -use gear_wasm_instrument::syscalls::SysCallName::{self, *}; -use wasmi::{core::Trap, Func, Memory, Store}; - -struct FunctionBuilder(BTreeSet); - -impl FunctionBuilder { - fn build(&self, name: SysCallName, handler: Handler) -> (SysCallName, Func) - where - Handler: FnOnce(bool) -> Func, - { - let forbidden = self.0.contains(&name); - (name, handler(forbidden)) - } -} - -#[allow(unused_macros)] -macro_rules! wrap_common_func_internal_ret { - ($func:path, $($arg_name:ident),*) => { - |store: &mut Store<_>, forbidden, memory| { - let func = move |caller: Caller<'_, HostState>, $($arg_name,)*| -> Result<(_, ), Trap> - { - let mut ctx = CallerWrap::prepare(caller, forbidden, memory)?; - // Zero-value argument is an unused gas value for wasmi backend as well - // as the first element of the result tuple. - $func(&mut ctx, 0, $($arg_name,)*).map(|(_, r)| (r,)) - }; - Func::wrap(store, func) - } - } -} - -macro_rules! wrap_common_func_internal_no_ret { - ($func:path, $($arg_name:ident),*) => { - |store: &mut Store<_>, forbidden, memory| { - let func = move |caller: Caller<'_, HostState>, $($arg_name,)*| -> Result<(), Trap> - { - let mut ctx = CallerWrap::prepare(caller, forbidden, memory)?; - // Zero-value argument is an unused gas value for wasmi backend as well - // as the first element of the result tuple. - $func(&mut ctx, 0, $($arg_name,)*) - .map(|(_, r)| r) - }; - Func::wrap(store, func) - } - } -} - -#[rustfmt::skip] -macro_rules! wrap_common_func { - ($func:path, () -> ()) => { wrap_common_func_internal_no_ret!($func,) }; - ($func:path, (1) -> ()) => { wrap_common_func_internal_no_ret!($func, a) }; - ($func:path, (2) -> ()) => { wrap_common_func_internal_no_ret!($func, a, b) }; - ($func:path, (3) -> ()) => { wrap_common_func_internal_no_ret!($func, a, b, c) }; - ($func:path, (4) -> ()) => { wrap_common_func_internal_no_ret!($func, a, b, c, d) }; - ($func:path, (5) -> ()) => { wrap_common_func_internal_no_ret!($func, a, b, c, d, e) }; - ($func:path, (6) -> ()) => { wrap_common_func_internal_no_ret!($func, a, b, c, d, e, f) }; - ($func:path, (7) -> ()) => { wrap_common_func_internal_no_ret!($func, a, b, c, d, e, f, g) }; - ($func:path, (8) -> ()) => { wrap_common_func_internal_no_ret!($func, a, b, c, d, e, f, g, h) }; - - ($func:path, () -> (1)) => { wrap_common_func_internal_ret!($func,)}; - ($func:path, (1) -> (1)) => { wrap_common_func_internal_ret!($func, a)}; - ($func:path, (2) -> (1)) => { wrap_common_func_internal_ret!($func, a, b)}; - ($func:path, (3) -> (1)) => { wrap_common_func_internal_ret!($func, a, b, c)}; - ($func:path, (4) -> (1)) => { wrap_common_func_internal_ret!($func, a, b, c, d)}; - ($func:path, (5) -> (1)) => { wrap_common_func_internal_ret!($func, a, b, c, d, e)}; - ($func:path, (6) -> (1)) => { wrap_common_func_internal_ret!($func, a, b, c, d, e, f)}; - ($func:path, (7) -> (1)) => { wrap_common_func_internal_ret!($func, a, b, c, d, e, f, g)}; - ($func:path, (8) -> (1)) => { wrap_common_func_internal_ret!($func, a, b, c, d, e, f, g, h)}; -} - -pub(crate) fn build( - store: &mut Store>, - memory: Memory, - forbidden_funcs: BTreeSet, -) -> BTreeMap -where - Ext: BackendExternalities + 'static, - Ext::UnrecoverableError: BackendSyscallError, - RunFallibleError: From, - Ext::AllocError: BackendAllocSyscallError, -{ - let f = FunctionBuilder(forbidden_funcs); - - #[rustfmt::skip] - let funcs: BTreeMap<_, _> = [ - f.build(Send, |forbidden| wrap_common_func!(CommonFuncsHandler::send, (5) -> ())(store, forbidden, memory)), - f.build(SendWGas, |forbidden| wrap_common_func!(CommonFuncsHandler::send_wgas, (6) -> ())(store, forbidden, memory)), - f.build(SendCommit, |forbidden| wrap_common_func!(CommonFuncsHandler::send_commit, (4) -> ())(store, forbidden, memory)), - f.build(SendCommitWGas, |forbidden| wrap_common_func!(CommonFuncsHandler::send_commit_wgas, (5) -> ())(store, forbidden, memory)), - f.build(SendInit, |forbidden| wrap_common_func!(CommonFuncsHandler::send_init, (1) -> ())(store, forbidden, memory)), - f.build(SendPush, |forbidden| wrap_common_func!(CommonFuncsHandler::send_push, (4) -> ())(store, forbidden, memory)), - f.build(Read, |forbidden| wrap_common_func!(CommonFuncsHandler::read, (4) -> ())(store, forbidden, memory)), - f.build(Size, |forbidden| wrap_common_func!(CommonFuncsHandler::size, (1) -> ())(store, forbidden, memory)), - f.build(Exit, |forbidden| wrap_common_func!(CommonFuncsHandler::exit, (1) -> ())(store, forbidden, memory)), - f.build(ReplyCode, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_code, (1) -> ())(store, forbidden, memory)), - f.build(SignalCode, |forbidden| wrap_common_func!(CommonFuncsHandler::signal_code, (1) -> ())(store, forbidden, memory)), - f.build(Alloc, |forbidden| wrap_common_func!(CommonFuncsHandler::alloc, (1) -> (1))(store, forbidden, memory)), - f.build(Free, |forbidden| wrap_common_func!(CommonFuncsHandler::free, (1) -> (1))(store, forbidden, memory)), - f.build(BlockHeight, |forbidden| wrap_common_func!(CommonFuncsHandler::block_height, (1) -> ())(store, forbidden, memory)), - f.build(BlockTimestamp, |forbidden| wrap_common_func!(CommonFuncsHandler::block_timestamp, (1) -> ())(store, forbidden, memory)), - f.build(ReservationSend, |forbidden| wrap_common_func!(CommonFuncsHandler::reservation_send, (5) -> ())(store, forbidden, memory)), - f.build(ReservationSendCommit, |forbidden| wrap_common_func!(CommonFuncsHandler::reservation_send_commit, (4) -> ())(store, forbidden, memory)), - f.build(Reply, |forbidden| wrap_common_func!(CommonFuncsHandler::reply, (4) -> ())(store, forbidden, memory)), - f.build(ReplyWGas, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_wgas, (5) -> ())(store, forbidden, memory)), - f.build(ReplyCommit, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_commit, (2) -> ())(store, forbidden, memory)), - f.build(ReplyCommitWGas, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_commit_wgas, (3) -> ())(store, forbidden, memory)), - f.build(ReplyTo, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_to, (1) -> ())(store, forbidden, memory)), - f.build(SignalFrom, |forbidden| wrap_common_func!(CommonFuncsHandler::signal_from, (1) -> ())(store, forbidden, memory)), - f.build(ReplyPush, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_push, (3) -> ())(store, forbidden, memory)), - f.build(ReplyInput, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_input, (4) -> ())(store, forbidden, memory)), - f.build(ReplyPushInput, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_push_input, (3) -> ())(store, forbidden, memory)), - f.build(ReplyInputWGas, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_input_wgas, (5) -> ())(store, forbidden, memory)), - f.build(SendInput, |forbidden| wrap_common_func!(CommonFuncsHandler::send_input, (5) -> ())(store, forbidden, memory)), - f.build(SendPushInput, |forbidden| wrap_common_func!(CommonFuncsHandler::send_push_input, (4) -> ())(store, forbidden, memory)), - f.build(SendInputWGas, |forbidden| wrap_common_func!(CommonFuncsHandler::send_input_wgas, (6) -> ())(store, forbidden, memory)), - f.build(Debug, |forbidden| wrap_common_func!(CommonFuncsHandler::debug, (2) -> ())(store, forbidden, memory)), - f.build(Panic, |forbidden| wrap_common_func!(CommonFuncsHandler::panic, (2) -> ())(store, forbidden, memory)), - f.build(OomPanic, |forbidden| wrap_common_func!(CommonFuncsHandler::oom_panic, () -> ())(store, forbidden, memory)), - f.build(GasAvailable, |forbidden| wrap_common_func!(CommonFuncsHandler::gas_available, (1) -> ())(store, forbidden, memory)), - f.build(MessageId, |forbidden| wrap_common_func!(CommonFuncsHandler::message_id, (1) -> ())(store, forbidden, memory)), - f.build(ReservationReply, |forbidden| wrap_common_func!(CommonFuncsHandler::reservation_reply, (4) -> ())(store, forbidden, memory)), - f.build(ReservationReplyCommit, |forbidden| wrap_common_func!(CommonFuncsHandler::reservation_reply_commit, (2) -> ())(store, forbidden, memory)), - f.build(PayProgramRent, |forbidden| wrap_common_func!(CommonFuncsHandler::pay_program_rent, (2) -> ())(store, forbidden, memory)), - f.build(ProgramId, |forbidden| wrap_common_func!(CommonFuncsHandler::program_id, (1) -> ())(store, forbidden, memory)), - f.build(Source, |forbidden| wrap_common_func!(CommonFuncsHandler::source, (1) -> ())(store, forbidden, memory)), - f.build(Value, |forbidden| wrap_common_func!(CommonFuncsHandler::value, (1) -> ())(store, forbidden, memory)), - f.build(ValueAvailable, |forbidden| wrap_common_func!(CommonFuncsHandler::value_available, (1) -> ())(store, forbidden, memory)), - f.build(Random, |forbidden| wrap_common_func!(CommonFuncsHandler::random, (2) -> ())(store, forbidden, memory)), - f.build(Leave, |forbidden| wrap_common_func!(CommonFuncsHandler::leave, () -> ())(store, forbidden, memory)), - f.build(Wait, |forbidden| wrap_common_func!(CommonFuncsHandler::wait, () -> ())(store, forbidden, memory)), - f.build(WaitFor, |forbidden| wrap_common_func!(CommonFuncsHandler::wait_for, (1) -> ())(store, forbidden, memory)), - f.build(WaitUpTo, |forbidden| wrap_common_func!(CommonFuncsHandler::wait_up_to, (1) -> ())(store, forbidden, memory)), - f.build(Wake, |forbidden| wrap_common_func!(CommonFuncsHandler::wake, (3) -> ())(store, forbidden, memory)), - f.build(CreateProgram, |forbidden| wrap_common_func!(CommonFuncsHandler::create_program, (7) -> ())(store, forbidden, memory)), - f.build(CreateProgramWGas, |forbidden| wrap_common_func!(CommonFuncsHandler::create_program_wgas, (8) -> ())(store, forbidden, memory)), - f.build(ReserveGas, |forbidden| wrap_common_func!(CommonFuncsHandler::reserve_gas, (3) -> ())(store, forbidden, memory)), - f.build(ReplyDeposit, |forbidden| wrap_common_func!(CommonFuncsHandler::reply_deposit, (3) -> ())(store, forbidden, memory)), - f.build(UnreserveGas, |forbidden| wrap_common_func!(CommonFuncsHandler::unreserve_gas, (2) -> ())(store, forbidden, memory)), - f.build(OutOfGas, |_| wrap_common_func!(CommonFuncsHandler::out_of_gas, () -> ())(store, false, memory)), - f.build(SystemReserveGas, |forbidden| wrap_common_func!(CommonFuncsHandler::system_reserve_gas, (2) -> ())(store, forbidden, memory)), - ] - .into(); - - assert_eq!( - funcs.len(), - SysCallName::count(), - "Not all existing sys-calls were added to the module's env." - ); - - funcs -} diff --git a/core-backend/wasmi/src/lib.rs b/core-backend/wasmi/src/lib.rs deleted file mode 100644 index 386cd0397ff..00000000000 --- a/core-backend/wasmi/src/lib.rs +++ /dev/null @@ -1,32 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Provide wasmi support. - -#![cfg_attr(not(feature = "std"), no_std)] - -extern crate alloc; - -pub mod env; -pub mod funcs_tree; -pub mod memory; -pub mod runtime; - -pub use env::WasmiEnvironment; -pub use memory::MemoryWrap; -pub use wasmi; diff --git a/core-backend/wasmi/src/memory.rs b/core-backend/wasmi/src/memory.rs deleted file mode 100644 index e1eb2fdac24..00000000000 --- a/core-backend/wasmi/src/memory.rs +++ /dev/null @@ -1,199 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! wasmi extensions for memory. - -use gear_backend_common::state::HostState; -use gear_core::{ - env::Externalities, - memory::{HostPointer, Memory, MemoryError}, - pages::{PageNumber, PageU32Size, WasmPage}, -}; -use wasmi::{core::memory_units::Pages, Memory as WasmiMemory, Store, StoreContextMut}; - -pub(crate) struct MemoryWrapRef<'a, Ext: Externalities + 'static> { - pub memory: WasmiMemory, - pub store: StoreContextMut<'a, HostState>, -} - -impl<'a, Ext: Externalities + 'static> Memory for MemoryWrapRef<'a, Ext> { - type GrowError = wasmi::errors::MemoryError; - - fn grow(&mut self, pages: WasmPage) -> Result<(), Self::GrowError> { - self.memory - .grow(&mut self.store, Pages(pages.raw() as usize)) - .map(|_| ()) - } - - fn size(&self) -> WasmPage { - WasmPage::new(self.memory.current_pages(&self.store).0 as u32) - .expect("Unexpected backend behavior: wasm size is bigger then u32::MAX") - } - - fn write(&mut self, offset: u32, buffer: &[u8]) -> Result<(), MemoryError> { - self.memory - .write(&mut self.store, offset as usize, buffer) - .map_err(|_| MemoryError::AccessOutOfBounds) - } - - fn read(&self, offset: u32, buffer: &mut [u8]) -> Result<(), MemoryError> { - self.memory - .read(&self.store, offset as usize, buffer) - .map_err(|_| MemoryError::AccessOutOfBounds) - } - - unsafe fn get_buffer_host_addr_unsafe(&mut self) -> HostPointer { - self.memory.data_mut(&mut self.store).as_mut().as_mut_ptr() as HostPointer - } -} - -/// Wrapper for [`wasmi::Memory`]. -pub struct MemoryWrap { - pub(crate) memory: WasmiMemory, - pub(crate) store: Store>, -} - -impl MemoryWrap { - /// Wrap [`wasmi::Memory`] for Memory trait. - pub(crate) fn new(memory: WasmiMemory, store: Store>) -> Self { - MemoryWrap { memory, store } - } - pub(crate) fn into_store(self) -> Store> { - self.store - } -} - -/// Memory interface for the allocator. -impl Memory for MemoryWrap { - type GrowError = wasmi::errors::MemoryError; - - fn grow(&mut self, pages: WasmPage) -> Result<(), Self::GrowError> { - self.memory - .grow(&mut self.store, Pages(pages.raw() as usize)) - .map(|_| ()) - } - - fn size(&self) -> WasmPage { - WasmPage::new(self.memory.current_pages(&self.store).0 as u32) - .expect("Unexpected backend behavior: wasm memory is bigger then u32::MAX") - } - - fn write(&mut self, offset: u32, buffer: &[u8]) -> Result<(), MemoryError> { - self.memory - .write(&mut self.store, offset as usize, buffer) - .map_err(|_| MemoryError::AccessOutOfBounds) - } - - fn read(&self, offset: u32, buffer: &mut [u8]) -> Result<(), MemoryError> { - self.memory - .read(&self.store, offset as usize, buffer) - .map_err(|_| MemoryError::AccessOutOfBounds) - } - - unsafe fn get_buffer_host_addr_unsafe(&mut self) -> HostPointer { - self.memory.data_mut(&mut self.store).as_mut().as_mut_ptr() as HostPointer - } -} - -#[cfg(test)] -mod tests { - - use super::*; - use gear_backend_common::{ - assert_err, assert_ok, mock::MockExt, state::State, ActorTerminationReason, - }; - use gear_core::memory::{AllocError, AllocationsContext, NoopGrowHandler}; - use wasmi::{Engine, Store}; - - fn new_test_memory( - static_pages: u16, - max_pages: u16, - ) -> (AllocationsContext, MemoryWrap) { - use wasmi::MemoryType; - - let memory_type = MemoryType::new(static_pages as u32, Some(max_pages as u32)); - - let engine = Engine::default(); - let mut store = Store::new(&engine, None); - let memory = WasmiMemory::new(&mut store, memory_type).expect("Memory creation failed"); - *store.state_mut() = Some(State { - ext: MockExt::default(), - memory, - termination_reason: ActorTerminationReason::Success.into(), - }); - let memory = MemoryWrap::new(memory, store); - - ( - AllocationsContext::new(Default::default(), static_pages.into(), max_pages.into()), - memory, - ) - } - - #[test] - fn smoky() { - let (mut ctx, mut mem_wrap) = new_test_memory(16, 256); - - assert_ok!( - ctx.alloc::(16.into(), &mut mem_wrap, |_| Ok(())), - 16.into() - ); - - assert_ok!( - ctx.alloc::(0.into(), &mut mem_wrap, |_| Ok(())), - 16.into() - ); - - // there is a space for 14 more - for _ in 0..14 { - assert_ok!(ctx.alloc::(16.into(), &mut mem_wrap, |_| Ok(()))); - } - - // no more mem! - assert_err!( - ctx.alloc::(1.into(), &mut mem_wrap, |_| Ok(())), - AllocError::ProgramAllocOutOfBounds - ); - - // but we free some - assert_ok!(ctx.free(137.into())); - - // and now can allocate page that was freed - assert_ok!( - ctx.alloc::(1.into(), &mut mem_wrap, |_| Ok(())), - 137.into() - ); - - // if we have 2 in a row we can allocate even 2 - assert_ok!(ctx.free(117.into())); - assert_ok!(ctx.free(118.into())); - - assert_ok!( - ctx.alloc::(2.into(), &mut mem_wrap, |_| Ok(())), - 117.into() - ); - - // but if 2 are not in a row, bad luck - assert_ok!(ctx.free(117.into())); - assert_ok!(ctx.free(158.into())); - - assert_err!( - ctx.alloc::(2.into(), &mut mem_wrap, |_| Ok(())), - AllocError::ProgramAllocOutOfBounds - ); - } -} diff --git a/core-backend/wasmi/src/runtime.rs b/core-backend/wasmi/src/runtime.rs deleted file mode 100644 index e21745f43b2..00000000000 --- a/core-backend/wasmi/src/runtime.rs +++ /dev/null @@ -1,303 +0,0 @@ -// This file is part of Gear. - -// Copyright (C) 2022-2023 Gear Technologies Inc. -// SPDX-License-Identifier: GPL-3.0-or-lat&er WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Runtime implementation for wasmi backend. - -use crate::memory::MemoryWrapRef; -use alloc::vec::Vec; -use codec::{Decode, MaxEncodedLen}; -use gear_backend_common::{ - memory::{ - MemoryAccessError, MemoryAccessManager, MemoryAccessRecorder, MemoryOwner, WasmMemoryRead, - WasmMemoryReadAs, WasmMemoryReadDecoded, WasmMemoryWrite, WasmMemoryWriteAs, - }, - runtime::{RunFallibleError, Runtime}, - state::{HostState, State}, - ActorTerminationReason, BackendExternalities, BackendState, TrapExplanation, - UndefinedTerminationReason, -}; -use gear_core::{costs::RuntimeCosts, pages::WasmPage}; -use gear_wasm_instrument::GLOBAL_NAME_GAS; -use wasmi::{ - core::{Trap, TrapCode, Value}, - AsContextMut, Caller, Memory as WasmiMemory, -}; - -#[track_caller] -pub(crate) fn caller_host_state_mut<'a, 'b: 'a, Ext>( - caller: &'a mut Caller<'b, Option>, -) -> &'a mut Ext { - caller - .host_data_mut() - .as_mut() - .unwrap_or_else(|| unreachable!("host_state must be set before execution")) -} - -#[track_caller] -pub(crate) fn caller_host_state_take<'a, 'b: 'a, Ext>( - caller: &'a mut Caller<'b, Option>, -) -> Ext { - caller - .host_data_mut() - .take() - .unwrap_or_else(|| unreachable!("host_state must be set before execution")) -} - -pub(crate) struct CallerWrap<'a, Ext> { - pub caller: Caller<'a, HostState>, - pub manager: MemoryAccessManager, - pub memory: WasmiMemory, -} - -impl<'a, Ext: BackendExternalities + 'static> Runtime for CallerWrap<'a, Ext> { - type Error = Trap; - - fn ext_mut(&mut self) -> &mut Ext { - &mut self - .caller - .host_data_mut() - .as_mut() - .unwrap_or_else(|| unreachable!("host_state must be set before execution")) - .ext - } - - fn unreachable_error() -> Self::Error { - Trap::Code(TrapCode::Unreachable) - } - - #[track_caller] - fn run_any( - &mut self, - _gas: u64, - cost: RuntimeCosts, - f: F, - ) -> Result<(u64, T), Self::Error> - where - F: FnOnce(&mut Self) -> Result, - { - self.with_globals_update(|ctx| { - ctx.host_state_mut().ext.charge_gas_runtime(cost)?; - f(ctx).map(|r| (0, r)) - }) - } - - #[track_caller] - fn run_fallible( - &mut self, - gas: u64, - res_ptr: u32, - cost: RuntimeCosts, - f: F, - ) -> Result<(u64, ()), Self::Error> - where - F: FnOnce(&mut Self) -> Result, - R: From> + Sized, - { - self.run_any( - gas, - cost, - |ctx: &mut Self| -> Result<_, UndefinedTerminationReason> { - let res = f(ctx); - let res = ctx.host_state_mut().process_fallible_func_result(res)?; - - // TODO: move above or make normal process memory access. - let write_res = ctx.register_write_as::(res_ptr); - - ctx.write_as(write_res, R::from(res)).map_err(Into::into) - }, - ) - } - - fn alloc(&mut self, pages: u32) -> Result::AllocError> { - let mut state = caller_host_state_take(&mut self.caller); - let mut mem = CallerWrap::memory(&mut self.caller, self.memory); - let res = state.ext.alloc(pages, &mut mem); - self.caller.host_data_mut().replace(state); - res - } -} - -impl<'a, Ext: BackendExternalities + 'static> CallerWrap<'a, Ext> { - #[track_caller] - pub fn prepare( - caller: Caller<'a, HostState>, - forbidden: bool, - memory: WasmiMemory, - ) -> Result { - let mut wrapper = Self { - caller, - manager: Default::default(), - memory, - }; - - if forbidden { - wrapper.host_state_mut().set_termination_reason( - ActorTerminationReason::Trap(TrapExplanation::ForbiddenFunction).into(), - ); - - return Err(TrapCode::Unreachable.into()); - } - - let f = || { - let gas_global = wrapper.caller.get_export(GLOBAL_NAME_GAS)?.into_global()?; - - Some(gas_global.get(&wrapper.caller).try_into::()? as u64) - }; - - let gas_left = - f().unwrap_or_else(|| unreachable!("Globals must be checked during env creation")); - - wrapper - .host_state_mut() - .ext - .decrease_current_counter_to(gas_left); - - Ok(wrapper) - } - - #[track_caller] - pub fn host_state_mut(&mut self) -> &mut State { - caller_host_state_mut(&mut self.caller) - } - - #[track_caller] - pub fn memory<'b, 'c: 'b>( - caller: &'b mut Caller<'c, Option>>, - memory: WasmiMemory, - ) -> MemoryWrapRef<'b, Ext> { - MemoryWrapRef::<'b, _> { - memory, - store: caller.as_context_mut(), - } - } - - fn update_globals(&mut self) { - let gas = self.host_state_mut().ext.define_current_counter(); - - let mut f = || { - let gas_global = self.caller.get_export(GLOBAL_NAME_GAS)?.into_global()?; - gas_global - .set(&mut self.caller, Value::I64(gas as i64)) - .ok()?; - Some(()) - }; - - f().unwrap_or_else(|| unreachable!("Globals must be checked during env creation")); - } - - fn with_memory(&mut self, f: F) -> Result - where - F: FnOnce( - &mut MemoryAccessManager, - &mut MemoryWrapRef, - &mut u64, - ) -> Result, - { - let mut gas_counter = self.host_state_mut().ext.define_current_counter(); - - let mut memory = Self::memory(&mut self.caller, self.memory); - - // With memory ops do similar subtractions for both counters. - let res = f(&mut self.manager, &mut memory, &mut gas_counter); - - self.host_state_mut() - .ext - .decrease_current_counter_to(gas_counter); - res - } - - fn with_globals_update(&mut self, f: F) -> Result - where - F: FnOnce(&mut Self) -> Result, - { - let result = f(self).map_err(|err| { - self.host_state_mut().set_termination_reason(err); - Trap::from(TrapCode::Unreachable) - }); - - self.update_globals(); - - result - } -} - -impl<'a, Ext> MemoryAccessRecorder for CallerWrap<'a, Ext> { - fn register_read(&mut self, ptr: u32, size: u32) -> WasmMemoryRead { - self.manager.register_read(ptr, size) - } - - fn register_read_as(&mut self, ptr: u32) -> WasmMemoryReadAs { - self.manager.register_read_as(ptr) - } - - fn register_read_decoded( - &mut self, - ptr: u32, - ) -> WasmMemoryReadDecoded { - self.manager.register_read_decoded(ptr) - } - - fn register_write(&mut self, ptr: u32, size: u32) -> WasmMemoryWrite { - self.manager.register_write(ptr, size) - } - - fn register_write_as(&mut self, ptr: u32) -> WasmMemoryWriteAs { - self.manager.register_write_as(ptr) - } -} - -impl BackendState for CallerWrap<'_, Ext> { - fn set_termination_reason(&mut self, reason: UndefinedTerminationReason) { - caller_host_state_mut(&mut self.caller).set_termination_reason(reason); - } -} - -impl<'a, Ext: BackendExternalities + 'static> MemoryOwner for CallerWrap<'a, Ext> { - fn read(&mut self, read: WasmMemoryRead) -> Result, MemoryAccessError> { - self.with_memory(|manager, memory, gas_left| manager.read(memory, read, gas_left)) - } - - fn read_as(&mut self, read: WasmMemoryReadAs) -> Result { - self.with_memory(|manager, memory, gas_left| manager.read_as(memory, read, gas_left)) - } - - fn read_decoded( - &mut self, - read: WasmMemoryReadDecoded, - ) -> Result { - self.with_memory(move |manager, memory, gas_left| { - manager.read_decoded(memory, read, gas_left) - }) - } - - fn write(&mut self, write: WasmMemoryWrite, buff: &[u8]) -> Result<(), MemoryAccessError> { - self.with_memory(move |manager, memory, gas_left| { - manager.write(memory, write, buff, gas_left) - }) - } - - fn write_as( - &mut self, - write: WasmMemoryWriteAs, - obj: T, - ) -> Result<(), MemoryAccessError> { - self.with_memory(move |manager, memory, gas_left| { - manager.write_as(memory, write, obj, gas_left) - }) - } -} diff --git a/gcli/Cargo.toml b/gcli/Cargo.toml index c9f00737360..f676cbac66d 100644 --- a/gcli/Cargo.toml +++ b/gcli/Cargo.toml @@ -41,7 +41,7 @@ thiserror.workspace = true tokio = { workspace = true, features = [ "full" ] } whoami.workspace = true core-processor.workspace = true -gear-backend-wasmi = { workspace = true, features = [ "std" ] } +gear-backend-sandbox = { workspace = true, features = [ "std" ] } reqwest = { workspace = true, default-features = false, features = [ "json", "rustls-tls" ] } etc.workspace = true diff --git a/gcli/src/meta/mod.rs b/gcli/src/meta/mod.rs index 0c964c8191d..647d0deaf0e 100644 --- a/gcli/src/meta/mod.rs +++ b/gcli/src/meta/mod.rs @@ -108,7 +108,7 @@ impl Meta { /// Execute meta method. fn execute(wasm: InstrumentedCode, method: &str) -> Result> { core_processor::informational::execute_for_reply::< - gear_backend_wasmi::WasmiEnvironment, + gear_backend_sandbox::SandboxEnvironment, String, >( method.into(), diff --git a/gtest/Cargo.toml b/gtest/Cargo.toml index da51090797f..efc813abc27 100644 --- a/gtest/Cargo.toml +++ b/gtest/Cargo.toml @@ -9,7 +9,7 @@ license.workspace = true gear-core.workspace = true gear-core-errors.workspace = true gear-backend-common.workspace = true -gear-backend-wasmi = { workspace = true, features = ["std"] } +gear-backend-sandbox = { workspace = true, features = ["std"] } core-processor.workspace = true gear-wasm-builder.workspace = true gear-utils.workspace = true diff --git a/gtest/src/error.rs b/gtest/src/error.rs index 722a3da9b29..c811ff78ea0 100644 --- a/gtest/src/error.rs +++ b/gtest/src/error.rs @@ -17,7 +17,6 @@ // along with this program. If not, see . use codec::Error as CodecError; -use gear_backend_wasmi::wasmi; use gear_core::{ids::ProgramId, pages::WasmPage}; use gear_core_errors::ExtError; @@ -72,10 +71,6 @@ pub enum TestError { #[display(fmt = "{_0}")] MemoryError(gear_core_errors::MemoryError), - /// Wrapper for `wasmi` error (used [`anyhow::Error`] for that). - #[display(fmt = "{_0}")] - WasmiError(wasmi::Error), - /// Wrapper for [`parity_scale_codec::Error`](https://docs.rs/parity-scale-codec/latest/parity_scale_codec/struct.Error.html). #[display(fmt = "{_0}")] ScaleCodecError(CodecError), diff --git a/gtest/src/manager.rs b/gtest/src/manager.rs index c76b2b20571..36e71353afb 100644 --- a/gtest/src/manager.rs +++ b/gtest/src/manager.rs @@ -29,7 +29,7 @@ use core_processor::{ configs::{BlockConfig, BlockInfo, PageCosts, TESTS_MAX_PAGES_NUMBER}, ContextChargedForCode, ContextChargedForInstrumentation, Ext, }; -use gear_backend_wasmi::WasmiEnvironment; +use gear_backend_sandbox::SandboxEnvironment; use gear_core::{ code::{Code, CodeAndId, InstrumentedCode, InstrumentedCodeAndId}, ids::{CodeId, MessageId, ProgramId, ReservationId}, @@ -446,7 +446,7 @@ impl ExtManager { .ok_or_else(|| TestError::ActorNotFound(*program_id))?; if let Some((_, program, memory_pages)) = actor.get_executable_actor_data() { - core_processor::informational::execute_for_reply::, _>( + core_processor::informational::execute_for_reply::, _>( String::from("state"), program.code().clone(), Some(memory_pages), @@ -484,7 +484,7 @@ impl ExtManager { let mut mapping_code_payload = argument.unwrap_or_default(); mapping_code_payload.append(&mut self.read_state_bytes(program_id)?); - core_processor::informational::execute_for_reply::, _>( + core_processor::informational::execute_for_reply::, _>( String::from(fn_name), mapping_code, None, @@ -860,7 +860,7 @@ impl ExtManager { } }; - let journal = core_processor::process::>( + let journal = core_processor::process::>( &block_config, (context, code, balance).into(), self.random_data.clone(), diff --git a/pallets/gear/Cargo.toml b/pallets/gear/Cargo.toml index d95d742196f..74e5051b16b 100644 --- a/pallets/gear/Cargo.toml +++ b/pallets/gear/Cargo.toml @@ -31,7 +31,6 @@ gear-core.workspace = true gear-core-errors.workspace = true gear-backend-common.workspace = true gear-backend-sandbox.workspace = true -gear-backend-wasmi = { workspace = true, optional = true } pallet-gear-proc-macro = { version = "2.0.0", path = "proc-macro" } gsys = { workspace = true, optional = true } pallet-gear-voucher.workspace = true @@ -132,7 +131,6 @@ std = [ "gear-wasm-instrument/std", "scopeguard/use_std", "gear-backend-sandbox/std", - "gear-backend-wasmi/std", "scale-info/std", "sp-io/std", "sp-std/std", diff --git a/utils/wasm-instrument/Cargo.toml b/utils/wasm-instrument/Cargo.toml index a87373ba580..b09d44adca9 100644 --- a/utils/wasm-instrument/Cargo.toml +++ b/utils/wasm-instrument/Cargo.toml @@ -17,14 +17,13 @@ enum-iterator.workspace = true [dev-dependencies] wasmparser.workspace = true wat.workspace = true -gear-backend-wasmi.workspace = true +gear-backend-sandbox.workspace = true gear-backend-common = { workspace = true, features = ["mock"] } gear-core.workspace = true [features] default = ["std"] std = [ - "gear-backend-wasmi/std", - "gear-backend-wasmi/std", + "gear-backend-sandbox/std", "gwasm-instrument/std", ] diff --git a/utils/wasm-instrument/src/tests.rs b/utils/wasm-instrument/src/tests.rs index 86d1cb9fd74..ac102195adf 100644 --- a/utils/wasm-instrument/src/tests.rs +++ b/utils/wasm-instrument/src/tests.rs @@ -623,7 +623,7 @@ test_gas_counter_injection! { fn test_sys_calls_table() { use gas_metering::ConstantCostRules; use gear_backend_common::{mock::MockExt, ActorTerminationReason, BackendReport, Environment}; - use gear_backend_wasmi::WasmiEnvironment; + use gear_backend_sandbox::SandboxEnvironment; use gear_core::message::DispatchKind; use parity_wasm::builder; @@ -657,7 +657,7 @@ fn test_sys_calls_table() { // Execute wasm and check success. let ext = MockExt::default(); - let env = WasmiEnvironment::new(ext, &code, DispatchKind::Init, Default::default(), 0.into()) + let env = SandboxEnvironment::new(ext, &code, DispatchKind::Init, Default::default(), 0.into()) .unwrap(); let report = env .execute(|_, _, _| -> Result<(), u32> { Ok(()) }) From 21590364a4b6707b78c1a5d3544ca3a34a0f4a91 Mon Sep 17 00:00:00 2001 From: clearloop <26088946+clearloop@users.noreply.github.com> Date: Sat, 26 Aug 2023 14:21:56 +0400 Subject: [PATCH 100/165] ci(label): skip duplicated build on PR creation (#3155) --- .github/actions/label/build.js | 51 ++++++++++++++++++++++++++-------- .github/workflows/PR.yml | 1 + .github/workflows/build.yml | 9 ++++++ .github/workflows/label.yml | 8 +++--- 4 files changed, 53 insertions(+), 16 deletions(-) diff --git a/.github/actions/label/build.js b/.github/actions/label/build.js index 39503e28172..c4d456b194e 100644 --- a/.github/actions/label/build.js +++ b/.github/actions/label/build.js @@ -3,8 +3,11 @@ */ const [owner, repo] = ["gear-tech", "gear"]; -const { LABEL, REF, HEAD_SHA } = process.env; -const linux = LABEL === "A0-pleasereview"; +const { LABEL, REF, HEAD_SHA, TITLE, NUMBER } = process.env; +const linux = + LABEL === "A0-pleasereview" || + LABEL === "A4-insubstantial" || + LABEL === "A2-mergeoncegreen"; const checks = linux ? ["linux", "win-cross"] : ["x86"]; const workflow_id = linux ? ".github/workflows/build.yml" @@ -18,7 +21,7 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); /** * If skipping this action. **/ -const skip = async ({ github }) => { +const skip = async ({ core, github }) => { const { data: { check_runs }, } = await github.rest.checks.listForRef({ @@ -27,16 +30,29 @@ const skip = async ({ github }) => { ref: REF, }); + core.info(`check runs: ${check_runs}`); + const runs = linux - ? check_runs.filter((run) => run.name === "build" || run.name === "build / linux") - : check_runs.filter((run) => run.name === "build / macox-x86"); + ? check_runs.filter( + (run) => run.name === "build" || run.name === "build / linux" + ) + : check_runs.filter((run) => run.name === "build / macos-x86"); - if (runs.length === 0) return false; + // Skip this action by default. + let skipped = false; for (run of runs) { - if (run.conclusion !== "skipped") return true; + // Process this action only if the previous build has been skipped. + if ( + (run.name === "build" && run.conclusion === "skipped") + ) + skipped = true; + + // If there is already a build, skip this action without more conditions. + if (run.name === "build / linux" || run.name === "build / macos-x86") + return true; } - return false; + return !skipped; }; /** @@ -72,8 +88,13 @@ const dispatchWorkflow = async ({ core, github }) => { repo, workflow_id, ref: REF, + inputs: { + title: TITLE, + number: NUMBER, + }, }); + // Wait for the workflow to be dispatched. await sleep(10000); // Get the target workflow run @@ -86,12 +107,16 @@ const dispatchWorkflow = async ({ core, github }) => { head_sha: HEAD_SHA, }); - if (workflow_runs.length != 1) { + if (workflow_runs.length === 0) { core.setFailed(`Incorrect workflow runs`); return; } - return workflow_runs[0]; + let sorted_runs = workflow_runs.sort((a, b) => { + return new Date(b.created_at) - new Date(a.created_at); + }); + + return sorted_runs[0]; }; /// List jobs of workflow run. @@ -122,14 +147,16 @@ const listJobs = async ({ github, core, run_id }) => { * The main function. **/ module.exports = async ({ github, core }) => { - if (await skip({ github })) { + if (await skip({ core, github })) { core.info("Build has already been processed."); return; } const run = await dispatchWorkflow({ core, github }); + core.info(`Dispatched workflow ${run.html_url}`); let labelChecks = await createChecks({ core, github }); + // Wait for the jobs to be completed. while (true) { const jobs = await listJobs({ github, core, run_id: run.id }); completed = jobs.filter((job) => job.status === "completed").length; @@ -171,7 +198,7 @@ module.exports = async ({ github, core }) => { if (completed === checks.length) { core.info("All jobs completed."); - break; + return; } else { await sleep(10000); } diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 767f6dc3f33..6849ba7e024 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -53,6 +53,7 @@ jobs: needs: status if: >- contains(github.event.pull_request.labels.*.name, 'A0-pleasereview') + || contains(github.event.pull_request.labels.*.name, 'A4-insubstantial') || contains(github.event.pull_request.labels.*.name, 'A2-mergeoncegreen') uses: ./.github/workflows/build.yml with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 674a0f60ca6..71e687d38d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,6 +10,15 @@ on: type: boolean default: false workflow_dispatch: + inputs: + title: + type: string + description: "Pull request title that triggers this workflow." + number: + type: string + description: "Pull request number that triggers this workflow" + +run-name: ${{ inputs.title }} ( ${{ format('#{0}', inputs.number) }} ) env: CARGO_INCREMENTAL: 0 diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 187032b8adc..9dd2ef902dc 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -5,16 +5,14 @@ on: branches: [master, vara-stage-1, vara-stage-2, vara-stage-3] types: [labeled] -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - jobs: dispatch: runs-on: ubuntu-latest if: >- github.event.label.name == 'A0-pleasereview' || github.event.label.name == 'E2-forcemacos' + || github.event.label.name == 'A4-insubstantial' + || github.event.label.name == 'A2-mergeoncegreen' steps: - uses: actions/checkout@v3 with: @@ -24,6 +22,8 @@ jobs: HEAD_SHA: ${{ github.event.pull_request.head.sha }} LABEL: ${{ github.event.label.name }} REF: ${{ github.head_ref || github.ref_name }} + TITLE: ${{ github.event.pull_request.title }} + NUMBER: ${{ github.event.number }} with: script: | const script = require('./.github/actions/label/build.js'); From 217f3afa2dd5462cb2f3734766c6637c3c324c5e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:08:33 +0300 Subject: [PATCH 101/165] deps: combine dependabot's PRs (#3184) --- Cargo.lock | 928 +++++++++++++++++++++++++++++------------------------ Cargo.toml | 8 +- 2 files changed, 507 insertions(+), 429 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3077c6e71fb..373a3d1c47b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -30,11 +30,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "gimli 0.27.3", + "gimli 0.28.0", ] [[package]] @@ -179,18 +179,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - -[[package]] -name = "aho-corasick" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" dependencies = [ "memchr", ] @@ -227,24 +218,23 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" [[package]] name = "anstyle-parse" @@ -266,9 +256,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -276,9 +266,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "approx" @@ -350,7 +340,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.23", + "time 0.3.27", ] [[package]] @@ -366,7 +356,7 @@ dependencies = [ "num-traits", "rusticata-macros", "thiserror", - "time 0.3.23", + "time 0.3.27", ] [[package]] @@ -449,9 +439,9 @@ dependencies = [ [[package]] name = "async-lock" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" dependencies = [ "event-listener", ] @@ -464,31 +454,31 @@ checksum = "0e97ce7de6cf12de5d7226c73f5ba9811622f4db3a5b91b55c53e987e5f91cba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "async-trait" -version = "0.1.71" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "asynchronous-codec" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06a0daa378f5fd10634e44b0a29b2a87b890657658e072a30d6f26e57ddee182" +checksum = "4057f2c32adbb2fc158e22fb38433c8e9bbf76b75a4732c7c0cbaf695fb65568" dependencies = [ "bytes", "futures-sink", "futures-util", "memchr", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", ] [[package]] @@ -516,16 +506,16 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ - "addr2line 0.20.0", + "addr2line 0.21.0", "cc", "cfg-if", "libc", "miniz_oxide", - "object 0.31.1", + "object 0.32.0", "rustc-demangle", ] @@ -567,9 +557,9 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basic-toml" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f838d03a705d72b12389b8930bd14cacf493be1380bfb15720d4d12db5ab03ac" +checksum = "7bfc506e7a2370ec239e1d072507b2a80c833083699d3c6fa176fbb4de8448c6" dependencies = [ "serde", ] @@ -635,9 +625,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bitvec" @@ -893,9 +883,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbdb825da8a5df079a43676dbe042702f1707b1109f713a01420fbb4cc71fa27" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" dependencies = [ "serde", ] @@ -908,7 +898,7 @@ checksum = "08a1ec454bc3eead8719cb56e15dbbfecdbc14e4b3a3ae4936cc6e31f5fc0d07" dependencies = [ "camino", "cargo-platform", - "semver 1.0.17", + "semver 1.0.18", "serde", "serde_json", "thiserror", @@ -916,11 +906,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -1075,24 +1066,24 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.21" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" +checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" dependencies = [ "clap_builder", - "clap_derive 4.3.12", + "clap_derive 4.4.0", "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.21" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" dependencies = [ "anstream", "anstyle", - "clap_lex 0.5.0", + "clap_lex 0.5.1", "strsim", ] @@ -1111,14 +1102,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -1132,9 +1123,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "cmake" @@ -1234,9 +1225,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795bc6e66a8e340f075fcf6227e417a2dc976b92b91f3cdc778bb858778b6747" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "const-str" @@ -1289,9 +1280,9 @@ dependencies = [ [[package]] name = "corosensei" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9847f90f32a50b0dcbd68bc23ff242798b13080b97b0569f6ed96a45ce4cf2cd" +checksum = "80128832c58ea9cbd041d2a759ec449224487b2c1e400453d99d244eead87a8e" dependencies = [ "autocfg", "cfg-if", @@ -1638,23 +1629,37 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.0.0-rc.1" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d4ba9852b42210c7538b75484f9daa0655e9a3ac04f693747bb0f02cf3cfe16" +checksum = "f711ade317dd348950a9910f81c5947e3d8907ebd2b83f76203ff1807e6a2bc2" dependencies = [ "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", "fiat-crypto", - "packed_simd_2", "platforms 3.0.2", + "rustc_version", "subtle", "zeroize", ] +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.29", +] + [[package]] name = "cxx" -version = "1.0.100" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e928d50d5858b744d1ea920b790641129c347a770d1530c3a85b77705a5ee031" +checksum = "28403c86fc49e3401fdf45499ba37fad6493d9329449d6449d7f0e10f4654d28" dependencies = [ "cc", "cxxbridge-flags", @@ -1664,9 +1669,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.100" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8332ba63f8a8040ca479de693150129067304a3496674477fff6d0c372cc34ae" +checksum = "78da94fef01786dc3e0c76eafcd187abcaa9972c78e05ff4041e24fdf059c285" dependencies = [ "cc", "codespan-reporting", @@ -1674,24 +1679,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "cxxbridge-flags" -version = "1.0.100" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5966a5a87b6e9bb342f5fab7170a93c77096efe199872afffc4b477cfeb86957" +checksum = "e2a6f5e1dfb4b34292ad4ea1facbfdaa1824705b231610087b00b17008641809" [[package]] name = "cxxbridge-macro" -version = "1.0.100" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b2dab6991c7ab1572fea8cb049db819b1aeea1e2dac74c0869f244d9f21a7c" +checksum = "50c49547d73ba8dcfd4ad7325d64c6d5391ff4224d498fc39a6f3f49825a530d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -1706,12 +1711,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0558d22a7b463ed0241e993f76f09f30b126687447751a8638587b864e4b3944" +checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" dependencies = [ - "darling_core 0.20.1", - "darling_macro 0.20.1", + "darling_core 0.20.3", + "darling_macro 0.20.3", ] [[package]] @@ -1730,16 +1735,16 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8bfa2e259f8ee1ce5e97824a3c55ec4404a0d772ca7fa96bf19f0752a046eb" +checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -1755,13 +1760,13 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.1" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" +checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ - "darling_core 0.20.1", + "darling_core 0.20.3", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -2332,6 +2337,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "der-parser" version = "7.0.0" @@ -2360,6 +2375,12 @@ dependencies = [ "rusticata-macros", ] +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" + [[package]] name = "derivative" version = "2.2.0" @@ -2390,7 +2411,7 @@ checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -2536,14 +2557,14 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "dissimilar" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "210ec60ae7d710bed8683e333e9d2855a8a56a3e9892b38bad3bb0d4d29b0d5e" +checksum = "86e3bdc80eee6e16b2b6b0f87fbc98c04bee3455e35174c0de1a125d0688c632" [[package]] name = "dlmalloc" @@ -2571,9 +2592,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dtoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "519b83cd10f5f6e969625a409f735182bea5558cd8b64c655806ceaae36f1999" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" [[package]] name = "dyn-clonable" @@ -2598,9 +2619,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" +checksum = "bbfc4744c1b8f2a09adc0e55242f60b1af195d88596bd8700be74418c056c555" [[package]] name = "dynasm" @@ -2634,10 +2655,10 @@ version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der", + "der 0.6.1", "elliptic-curve", "rfc6979", - "signature", + "signature 1.6.4", ] [[package]] @@ -2646,7 +2667,17 @@ version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ - "signature", + "signature 1.6.4", +] + +[[package]] +name = "ed25519" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" +dependencies = [ + "pkcs8 0.10.2", + "signature 2.1.0", ] [[package]] @@ -2656,13 +2687,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek 3.2.0", - "ed25519", + "ed25519 1.5.3", "rand 0.7.3", "serde", "sha2 0.9.9", "zeroize", ] +[[package]] +name = "ed25519-dalek" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" +dependencies = [ + "curve25519-dalek 4.0.0", + "ed25519 2.2.2", + "rand_core 0.6.4", + "serde", + "sha2 0.10.7", + "zeroize", +] + [[package]] name = "ed25519-zebra" version = "3.1.0" @@ -2679,9 +2724,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -2691,14 +2736,14 @@ checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", "crypto-bigint", - "der", + "der 0.6.1", "digest 0.10.7", "ff", "generic-array 0.14.7", "group", "hkdf 0.12.3", "pem-rfc7468", - "pkcs8", + "pkcs8 0.9.0", "rand_core 0.6.4", "sec1", "subtle", @@ -2713,9 +2758,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] @@ -2769,7 +2814,7 @@ checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -2810,7 +2855,7 @@ checksum = "5e9a1f9f7d83e59740248a6e14ecf93929ade55027844dfcea78beafccc15745" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -2828,10 +2873,10 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08b6c6ab82d70f08844964ba10c7babb716de2ecaeab9be5717918a5177d3af" dependencies = [ - "darling 0.20.1", + "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -2956,6 +3001,12 @@ dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + [[package]] name = "fdlimit" version = "0.2.1" @@ -2993,13 +3044,13 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] @@ -3045,9 +3096,9 @@ checksum = "cda653ca797810c02f7ca4b804b40b8b95ae046eb989d356bce17919a8c25499" [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "libz-sys", @@ -3125,7 +3176,7 @@ dependencies = [ "Inflector", "array-bytes", "chrono", - "clap 4.3.21", + "clap 4.4.0", "comfy-table", "frame-benchmarking", "frame-support", @@ -3418,7 +3469,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eeb4ed9e12f43b7fa0baae3f9cdda28352770132ef2e09a23760c29cae8bd47" dependencies = [ - "rustix 0.38.4", + "rustix 0.38.9", "windows-sys 0.48.0", ] @@ -3491,12 +3542,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", "parking", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", "waker-fn", ] @@ -3508,7 +3559,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -3553,7 +3604,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", "pin-utils", "slab", ] @@ -3580,7 +3631,7 @@ version = "0.3.2" dependencies = [ "anyhow", "base64 0.21.2", - "clap 4.3.21", + "clap 4.4.0", "color-eyre", "demo-messager", "demo-new-meta", @@ -3718,7 +3769,7 @@ version = "0.3.2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -3760,7 +3811,7 @@ dependencies = [ name = "gear-bags-thresholds" version = "1.0.0" dependencies = [ - "clap 4.3.21", + "clap 4.4.0", "generate-bags", "vara-runtime", ] @@ -3784,7 +3835,7 @@ dependencies = [ name = "gear-cli" version = "0.3.2" dependencies = [ - "clap 4.3.21", + "clap 4.4.0", "frame-benchmarking", "frame-benchmarking-cli", "frame-system", @@ -3847,7 +3898,7 @@ name = "gear-common-codegen" version = "0.3.2" dependencies = [ "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -3945,7 +3996,7 @@ version = "0.3.2" dependencies = [ "anyhow", "arbitrary", - "clap 4.3.21", + "clap 4.4.0", "dyn-clonable", "futures", "futures-timer", @@ -4014,7 +4065,7 @@ dependencies = [ name = "gear-replay-cli" version = "1.0.0" dependencies = [ - "clap 4.3.21", + "clap 4.4.0", "frame-remote-externalities", "frame-system", "gear-runtime", @@ -4303,7 +4354,7 @@ dependencies = [ name = "gear-validator-checks" version = "0.1.0" dependencies = [ - "clap 4.3.21", + "clap 4.4.0", "env_logger", "futures", "gsdk", @@ -4383,7 +4434,7 @@ dependencies = [ name = "gear-weight-diff" version = "1.0.0" dependencies = [ - "clap 4.3.21", + "clap 4.4.0", "frame-support", "gear-runtime", "indexmap 2.0.0", @@ -4494,9 +4545,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "git2" @@ -4525,11 +4576,11 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "globset" -version = "0.4.10" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc" +checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" dependencies = [ - "aho-corasick 0.7.20", + "aho-corasick", "bstr", "fnv", "log", @@ -4560,7 +4611,7 @@ dependencies = [ "proc-macro2", "quote", "scale-info", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -4622,7 +4673,7 @@ dependencies = [ "sp-io 7.0.0 (git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox)", "subxt-codegen", "subxt-metadata", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -4631,7 +4682,7 @@ version = "0.3.2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -4659,7 +4710,7 @@ dependencies = [ "gstd", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", "trybuild", ] @@ -4705,9 +4756,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -4910,14 +4961,14 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", ] [[package]] name = "http-range-header" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" +checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" [[package]] name = "httparse" @@ -4927,9 +4978,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -4953,7 +5004,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", "socket2 0.4.9", "tokio", "tower-service", @@ -4974,7 +5025,6 @@ dependencies = [ "rustls-native-certs", "tokio", "tokio-rustls 0.23.4", - "webpki-roots", ] [[package]] @@ -4986,9 +5036,12 @@ dependencies = [ "futures-util", "http", "hyper", - "rustls 0.21.5", + "log", + "rustls 0.21.6", + "rustls-native-certs", "tokio", "tokio-rustls 0.24.1", + "webpki-roots 0.23.1", ] [[package]] @@ -5224,7 +5277,7 @@ dependencies = [ "socket2 0.5.3", "widestring", "windows-sys 0.48.0", - "winreg 0.50.0", + "winreg", ] [[package]] @@ -5240,7 +5293,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.2", - "rustix 0.38.4", + "rustix 0.38.9", "windows-sys 0.48.0", ] @@ -5255,9 +5308,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -5279,9 +5332,9 @@ dependencies = [ [[package]] name = "jsonrpsee" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d291e3a5818a2384645fd9756362e6d89cf0541b0b916fa7702ea4a9833608e" +checksum = "367a292944c07385839818bb71c8d76611138e2dedb0677d035b8da21d29c78b" dependencies = [ "jsonrpsee-client-transport", "jsonrpsee-core", @@ -5295,9 +5348,9 @@ dependencies = [ [[package]] name = "jsonrpsee-client-transport" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965de52763f2004bc91ac5bcec504192440f0b568a5d621c59d9dbd6f886c3fb" +checksum = "c8b3815d9f5d5de348e5f162b316dc9cdf4548305ebb15b4eb9328e66cf27d7a" dependencies = [ "futures-util", "http", @@ -5308,17 +5361,17 @@ dependencies = [ "soketto", "thiserror", "tokio", - "tokio-rustls 0.23.4", + "tokio-rustls 0.24.1", "tokio-util", "tracing", - "webpki-roots", + "webpki-roots 0.25.2", ] [[package]] name = "jsonrpsee-core" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e70b4439a751a5de7dd5ed55eacff78ebf4ffe0fc009cb1ebb11417f5b536b" +checksum = "2b5dde66c53d6dcdc8caea1874a45632ec0fcf5b437789f1e45766a1512ce803" dependencies = [ "anyhow", "arrayvec 0.7.4", @@ -5344,13 +5397,13 @@ dependencies = [ [[package]] name = "jsonrpsee-http-client" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc345b0a43c6bc49b947ebeb936e886a419ee3d894421790c969cc56040542ad" +checksum = "7e5f9fabdd5d79344728521bb65e3106b49ec405a78b66fbff073b72b389fa43" dependencies = [ "async-trait", "hyper", - "hyper-rustls 0.23.2", + "hyper-rustls 0.24.1", "jsonrpsee-core", "jsonrpsee-types", "rustc-hash", @@ -5363,9 +5416,9 @@ dependencies = [ [[package]] name = "jsonrpsee-proc-macros" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baa6da1e4199c10d7b1d0a6e5e8bd8e55f351163b6f4b3cbb044672a69bd4c1c" +checksum = "44e8ab85614a08792b9bff6c8feee23be78c98d0182d4c622c05256ab553892a" dependencies = [ "heck", "proc-macro-crate 1.1.3", @@ -5376,9 +5429,9 @@ dependencies = [ [[package]] name = "jsonrpsee-server" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb69dad85df79527c019659a992498d03f8495390496da2f07e6c24c2b356fc" +checksum = "cf4d945a6008c9b03db3354fb3c83ee02d2faa9f2e755ec1dfb69c3551b8f4ba" dependencies = [ "futures-channel", "futures-util", @@ -5398,9 +5451,9 @@ dependencies = [ [[package]] name = "jsonrpsee-types" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd522fe1ce3702fd94812965d7bb7a3364b1c9aba743944c5a00529aae80f8c" +checksum = "245ba8e5aa633dd1c1e4fae72bce06e71f42d34c14a2767c6b4d173b57bee5e5" dependencies = [ "anyhow", "beef", @@ -5412,9 +5465,9 @@ dependencies = [ [[package]] name = "jsonrpsee-ws-client" -version = "0.16.2" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b83daeecfc6517cfe210df24e570fb06213533dfb990318fae781f4c7119dd9" +checksum = "4e1b3975ed5d73f456478681a417128597acd6a2487855fdb7b4a3d4d195bf5e" dependencies = [ "http", "jsonrpsee-client-transport", @@ -5529,9 +5582,9 @@ dependencies = [ [[package]] name = "libfuzzer-sys" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb09950ae85a0a94b27676cccf37da5ff13f27076aa1adbc6545dd0d0e1bd4e" +checksum = "a96cfd5557eb82f2b83fed4955246c988d331975a002961b07c81584d107e7f7" dependencies = [ "arbitrary", "cc", @@ -5560,12 +5613,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "libm" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" - [[package]] name = "libm" version = "0.2.7" @@ -5574,9 +5621,9 @@ checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libmimalloc-sys" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ac0e912c8ef1b735e92369695618dc5b1819f5a7bf3f167301a3ba1cea515e" +checksum = "25d058a81af0d1c22d7a1c948576bee6d673f7af3c0f35564abd6c81122f513d" dependencies = [ "cc", "libc", @@ -5624,7 +5671,7 @@ checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f" dependencies = [ "asn1_der", "bs58", - "ed25519-dalek", + "ed25519-dalek 1.0.1", "either", "fnv", "futures", @@ -5715,12 +5762,12 @@ dependencies = [ [[package]] name = "libp2p-identity" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e2d584751cecb2aabaa56106be6be91338a60a0f4e420cf2af639204f596fc1" +checksum = "276bb57e7af15d8f100d3c11cbdd32c6752b7eef4ba7a18ecf464972c07abcce" dependencies = [ "bs58", - "ed25519-dalek", + "ed25519-dalek 2.0.0", "log", "multiaddr 0.17.1", "multihash 0.17.0", @@ -6018,7 +6065,7 @@ dependencies = [ "rw-stream-sink", "soketto", "url", - "webpki-roots", + "webpki-roots 0.22.6", ] [[package]] @@ -6100,9 +6147,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "libc", @@ -6157,9 +6204,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" [[package]] name = "lock_api" @@ -6374,9 +6421,9 @@ dependencies = [ [[package]] name = "mimalloc" -version = "0.1.37" +version = "0.1.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e2894987a3459f3ffb755608bd82188f8ed00d0ae077f1edea29c068d639d98" +checksum = "972e5f23f6716f62665760b0f4cbf592576a80c7b879ba9beaafc0e558894127" dependencies = [ "libmimalloc-sys", ] @@ -6812,9 +6859,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -6823,9 +6870,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", ] @@ -6875,12 +6922,12 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", - "libm 0.2.7", + "libm", ] [[package]] @@ -6910,7 +6957,7 @@ checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -6945,9 +6992,9 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" dependencies = [ "memchr", ] @@ -7034,16 +7081,6 @@ dependencies = [ "sha2 0.10.7", ] -[[package]] -name = "packed_simd_2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" -dependencies = [ - "cfg-if", - "libm 0.1.4", -] - [[package]] name = "page_size" version = "0.4.2" @@ -7519,7 +7556,7 @@ version = "2.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -8132,7 +8169,7 @@ checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" [[package]] name = "parity-wasm" version = "0.45.0" -source = "git+https://github.com/gear-tech/parity-wasm?branch=v0.45.0-sign-ext#9028eb9dd59495a6342d244b3c45521ce743edec" +source = "git+https://github.com/gear-tech/parity-wasm?branch=v0.45.0-sign-ext#bad3e1ec78f655f3eec5a0c9c12a3546c8c9d432" [[package]] name = "parking" @@ -8185,7 +8222,7 @@ dependencies = [ "libc", "redox_syscall 0.3.5", "smallvec", - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -8256,9 +8293,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" +checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" dependencies = [ "thiserror", "ucd-trie", @@ -8266,9 +8303,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" +checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" dependencies = [ "pest", "pest_generator", @@ -8276,22 +8313,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" +checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] name = "pest_meta" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" +checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" dependencies = [ "once_cell", "pest", @@ -8300,32 +8337,32 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 1.9.3", + "indexmap 2.0.0", ] [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -8336,9 +8373,9 @@ checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -8352,8 +8389,18 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der", - "spki", + "der 0.6.1", + "spki 0.6.0", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der 0.7.8", + "spki 0.7.2", ] [[package]] @@ -8386,7 +8433,7 @@ dependencies = [ "concurrent-queue", "libc", "log", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", "windows-sys 0.48.0", ] @@ -8427,9 +8474,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "1.4.0" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d220334a184db82b31b83f5ff093e3315280fb2b6bbc032022b2304a509aab7a" +checksum = "31114a898e107c51bb1609ffaf55a0e011cf6a4d7f1170d0015a165082c0338b" [[package]] name = "ppv-lite86" @@ -8754,9 +8801,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c10f662eee9c94ddd7135043e544f3c82fa839a1e7b865911331961b53186c" +checksum = "f31999cfc7927c4e212e60fd50934ab40e8e8bfd2d493d6095d2d306bc0764d9" dependencies = [ "bytes", "rand 0.8.5", @@ -8772,9 +8819,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -8920,7 +8967,7 @@ checksum = "6413f3de1edee53342e6138e75b56d32e7bc6e332b3bd62d497b1929d4cfbcdd" dependencies = [ "pem", "ring", - "time 0.3.23", + "time 0.3.27", "x509-parser 0.13.2", "yasna", ] @@ -8933,7 +8980,7 @@ checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" dependencies = [ "pem", "ring", - "time 0.3.23", + "time 0.3.27", "yasna", ] @@ -8968,22 +9015,22 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1641819477c319ef452a075ac34a4be92eb9ba09f6841f62d594d50fdcf0bf6b" +checksum = "acde58d073e9c79da00f2b5b84eed919c8326832648a5b109b3fce1bb1175280" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68bf53dad9b6086826722cdc99140793afd9f62faa14a1ad07eb4f955e7a7216" +checksum = "7f7473c2cfcf90008193dd0e3e16599455cb601a9fce322b5bb55de799664925" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -9015,7 +9062,7 @@ version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", "regex-automata 0.3.6", "regex-syntax 0.7.4", @@ -9036,7 +9083,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick", "memchr", "regex-syntax 0.7.4", ] @@ -9069,7 +9116,7 @@ dependencies = [ name = "regression-analysis" version = "0.1.0" dependencies = [ - "clap 4.3.21", + "clap 4.4.0", "frame-support", "gear-runtime", "junit-common", @@ -9092,9 +9139,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" dependencies = [ "base64 0.21.2", "bytes", @@ -9112,8 +9159,8 @@ dependencies = [ "mime", "once_cell", "percent-encoding", - "pin-project-lite 0.2.10", - "rustls 0.21.5", + "pin-project-lite 0.2.13", + "rustls 0.21.6", "rustls-pemfile", "serde", "serde_json", @@ -9125,8 +9172,8 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", - "winreg 0.10.1", + "webpki-roots 0.25.2", + "winreg", ] [[package]] @@ -9270,7 +9317,7 @@ version = "0.1.0" dependencies = [ "anyhow", "arbitrary", - "clap 4.3.21", + "clap 4.4.0", "frame-support", "frame-system", "gear-call-gen", @@ -9336,7 +9383,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.17", + "semver 1.0.18", ] [[package]] @@ -9378,14 +9425,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.4" +version = "0.38.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +checksum = "9bfe0f2582b4931a45d1fa608f8a8722e8b3c7ac54dd6d5f3b3212791fedef49" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys 0.4.5", "windows-sys 0.48.0", ] @@ -9416,13 +9463,13 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.5" +version = "0.21.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79ea77c539259495ce8ca47f53e66ae0330a8819f67e23ac96ca02f50e7b7d36" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" dependencies = [ "log", "ring", - "rustls-webpki", + "rustls-webpki 0.101.4", "sct 0.7.0", ] @@ -9449,9 +9496,19 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.1" +version = "0.100.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" +checksum = "e98ff011474fa39949b7e5c0428f9b4937eda7da7848bbb947786b7be0b27dab" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" dependencies = [ "ring", "untrusted", @@ -9459,9 +9516,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rusty-fork" @@ -9488,15 +9545,15 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safe_arch" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a7484307bd40f8f7ccbacccac730108f2cae119a3b11c74485b48aa9ea650f" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" dependencies = [ "bytemuck", ] @@ -9590,7 +9647,7 @@ source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0 dependencies = [ "array-bytes", "chrono", - "clap 4.3.21", + "clap 4.4.0", "fdlimit", "futures", "libp2p", @@ -10368,7 +10425,7 @@ name = "sc-storage-monitor" version = "0.1.0" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" dependencies = [ - "clap 4.3.21", + "clap 4.4.0", "fs4", "futures", "log", @@ -10699,9 +10756,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scratch" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "764cad9e7e1ca5fe15b552859ff5d96a314e6ed2934f2260168cd5dfa5891409" +checksum = "a3cf7c11c38cb994f3d40e8a8cde3bbd1f72a435e4c49e85d6553d8312306152" [[package]] name = "sct" @@ -10748,9 +10805,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ "base16ct", - "der", + "der 0.6.1", "generic-array 0.14.7", - "pkcs8", + "pkcs8 0.9.0", "subtle", "zeroize", ] @@ -10804,9 +10861,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -10817,9 +10874,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -10836,9 +10893,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" dependencies = [ "serde", ] @@ -10851,31 +10908,31 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.179" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a5bf42b8d227d4abf38a1ddb08602e229108a517cd4e5bb28f9c7eaafdce5c0" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.11" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a16be4fe5320ade08736447e3198294a5ea9a6d44dde6f35f0a5e06859c427a" +checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" dependencies = [ "serde", ] [[package]] name = "serde_derive" -version = "1.0.179" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "741e124f5485c7e60c03b043f79f320bff3527f4bbf12cf3831750dc46a0ec2c" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -10891,13 +10948,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.14" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" +checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -11036,6 +11093,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "signature" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" + [[package]] name = "simba" version = "0.6.0" @@ -11070,15 +11133,15 @@ checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -11103,14 +11166,14 @@ checksum = "5e9f0ab6ef7eb7353d9119c170a436d1bf248eea575ac42d19d12f4e34130831" [[package]] name = "snow" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" +checksum = "0c9d1425eb528a21de2755c75af4c9b5d57f50a0d4c3b7f1828a4cd03f8ba155" dependencies = [ "aes-gcm 0.9.4", "blake2", "chacha20poly1305", - "curve25519-dalek 4.0.0-rc.1", + "curve25519-dalek 4.0.0", "rand_core 0.6.4", "ring", "rustc_version", @@ -11592,8 +11655,8 @@ version = "7.0.0" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary#b9a153b1b1d8ba11bc54aebb3732d1930dcba0c8" dependencies = [ "bytes", - "ed25519", - "ed25519-dalek", + "ed25519 1.5.3", + "ed25519-dalek 1.0.1", "futures", "libsecp256k1", "log", @@ -11618,8 +11681,8 @@ version = "7.0.0" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" dependencies = [ "bytes", - "ed25519", - "ed25519-dalek", + "ed25519 1.5.3", + "ed25519-dalek 1.0.1", "futures", "libsecp256k1", "log", @@ -12176,14 +12239,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", - "der", + "der 0.6.1", +] + +[[package]] +name = "spki" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +dependencies = [ + "base64ct", + "der 0.7.8", ] [[package]] name = "ss58-registry" -version = "1.41.0" +version = "1.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfc443bad666016e012538782d9e3006213a7db43e9fb1dda91657dc06a6fa08" +checksum = "5e6915280e2d0db8911e5032a5c275571af6bdded2916abd691a659be25d3439" dependencies = [ "Inflector", "num-format", @@ -12509,7 +12582,7 @@ dependencies = [ "quote", "scale-info", "subxt-metadata", - "syn 2.0.28", + "syn 2.0.29", "thiserror", "tokio", ] @@ -12519,10 +12592,10 @@ name = "subxt-macro" version = "0.29.0" source = "git+https://github.com/gear-tech/subxt?branch=v0.29.0#266ce4eff8987e1efc48fe3471808398c2ca9185" dependencies = [ - "darling 0.20.1", + "darling 0.20.3", "proc-macro-error", "subxt-codegen", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -12550,9 +12623,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", @@ -12624,21 +12697,20 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.9" +version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8e77cb757a61f51b947ec4a7e3646efd825b73561db1c232a8ccb639e611a0" +checksum = "9d0e916b1148c8e263850e1ebcbd046f333e0683c724876bb0da63ea4373dc8a" [[package]] name = "tempfile" -version = "3.6.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ - "autocfg", "cfg-if", - "fastrand", + "fastrand 2.0.0", "redox_syscall 0.3.5", - "rustix 0.37.23", + "rustix 0.38.9", "windows-sys 0.48.0", ] @@ -12674,22 +12746,22 @@ checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -12719,9 +12791,9 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" -version = "0.5.3+5.3.0-patched" +version = "0.5.4+5.3.0-patched" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a678df20055b43e57ef8cddde41cdfda9a3c1a060b67f4c5836dfb1d78543ba8" +checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" dependencies = [ "cc", "libc", @@ -12740,10 +12812,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.23" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e399c068f43a5d116fedaf73b203fa4f9c519f17e2b34f63221d3792f81446" +checksum = "0bb39ee79a6d8de55f48f2293a830e040392f1c5f16e336bdd1788cd0aadce07" dependencies = [ + "deranged", "itoa", "serde", "time-core", @@ -12758,9 +12831,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96ba15a897f3c86766b757e5ac7221554c6750054d74d5b28844fce5fb36a6c4" +checksum = "733d258752e9303d392b94b75230d07b0b9c489350c69b851fc6c065fde3e8f9" dependencies = [ "time-core", ] @@ -12811,20 +12884,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ - "autocfg", "backtrace", "bytes", "libc", "mio", "num_cpus", "parking_lot 0.12.1", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", "signal-hook-registry", - "socket2 0.4.9", + "socket2 0.5.3", "tokio-macros", "windows-sys 0.48.0", ] @@ -12837,7 +12909,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -12857,7 +12929,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.5", + "rustls 0.21.6", "tokio", ] @@ -12868,7 +12940,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", "tokio", "tokio-util", ] @@ -12883,7 +12955,7 @@ dependencies = [ "futures-core", "futures-io", "futures-sink", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", "tokio", "tracing", ] @@ -12920,9 +12992,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.12" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ "indexmap 2.0.0", "serde", @@ -12955,7 +13027,7 @@ dependencies = [ "http", "http-body", "http-range-header", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", "tower-layer", "tower-service", ] @@ -12980,7 +13052,7 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "log", - "pin-project-lite 0.2.10", + "pin-project-lite 0.2.13", "tracing-attributes", "tracing-core", ] @@ -12992,7 +13064,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d48f71a791638519505cefafe162606f706c25592e4bde4d97600c0195312e" dependencies = [ "crossbeam-channel", - "time 0.3.23", + "time 0.3.27", "tracing-subscriber 0.3.17", ] @@ -13004,7 +13076,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] @@ -13182,7 +13254,7 @@ version = "0.10.0-dev" source = "git+https://github.com/gear-tech/substrate.git?branch=gear-polkadot-v0.9.41-canary-no-sandbox#93aa762a96970dc7d5987a8c890a6be4912f3cd3" dependencies = [ "async-trait", - "clap 4.3.21", + "clap 4.4.0", "frame-remote-externalities", "frame-try-runtime", "hex", @@ -13304,9 +13376,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -13386,9 +13458,9 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uuid" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d023da39d1fde5a8a3fe1f3e01ca9632ada0a63e9797de55a879d6e2236277be" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" dependencies = [ "getrandom 0.2.10", ] @@ -13609,7 +13681,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", "wasm-bindgen-shared", ] @@ -13643,7 +13715,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -13664,9 +13736,9 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.31.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41763f20eafed1399fff1afb466496d3a959f58241436cfdc17e3f5ca954de16" +checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" dependencies = [ "leb128", ] @@ -13675,7 +13747,7 @@ dependencies = [ name = "wasm-info" version = "0.1.0" dependencies = [ - "clap 4.3.21", + "clap 4.4.0", "hex", "parity-wasm 0.45.0", ] @@ -13733,7 +13805,7 @@ dependencies = [ name = "wasm-proc" version = "0.1.0" dependencies = [ - "clap 4.3.21", + "clap 4.4.0", "env_logger", "gear-wasm-builder", "log", @@ -14086,7 +14158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57d20cb3c59b788653d99541c646c561c9dd26506f25c0cebfe810659c54c6d7" dependencies = [ "downcast-rs", - "libm 0.2.7", + "libm", "memory_units", "num-rational", "num-traits", @@ -14098,7 +14170,7 @@ version = "0.2.1" source = "git+https://github.com/gear-tech/wasmi?branch=v0.13.2-sign-ext#3a0b1022377919e62aadf4d78b762abd1c3e9a04" dependencies = [ "downcast-rs", - "libm 0.2.7", + "libm", "memory_units", "num-rational", "num-traits", @@ -14111,7 +14183,7 @@ version = "0.12.0" source = "git+https://github.com/gear-tech/wasmi?branch=gear-v0.30.0#c8b0be9c2012e0478959a59074fd953a942782bc" dependencies = [ "downcast-rs", - "libm 0.2.7", + "libm", "num-traits", "paste", "region", @@ -14143,12 +14215,12 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.110.0" +version = "0.112.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dfcdb72d96f01e6c85b6bf20102e7423bdbaad5c337301bab2bbf253d26413c" +checksum = "e986b010f47fcce49cf8ea5d5f9e5d2737832f12b53ae8ae785bbe895d0877bf" dependencies = [ "indexmap 2.0.0", - "semver 1.0.17", + "semver 1.0.18", ] [[package]] @@ -14168,12 +14240,12 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.2.62" +version = "0.2.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd12ed4d96a984e4b598a17457f1126d01640cc7461afbb319642111ff9e7f" +checksum = "34ddf5892036cd4b780d505eff1194a0cbc10ed896097656fdcea3744b5e7c2f" dependencies = [ "anyhow", - "wasmparser 0.110.0", + "wasmparser 0.112.0", ] [[package]] @@ -14357,21 +14429,21 @@ dependencies = [ [[package]] name = "wast" -version = "62.0.1" +version = "64.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8ae06f09dbe377b889fbd620ff8fa21e1d49d1d9d364983c0cdbf9870cb9f1f" +checksum = "a259b226fd6910225aa7baeba82f9d9933b6d00f2ce1b49b80fa4214328237cc" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.31.1", + "wasm-encoder 0.32.0", ] [[package]] name = "wat" -version = "1.0.69" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "842e15861d203fb4a96d314b0751cdeaf0f6f8b35e8d81d2953af2af5e44e637" +checksum = "53253d920ab413fca1c7dc2161d601c79b4fdf631d0ba51dd4343bf9b556c3f6" dependencies = [ "wast", ] @@ -14415,6 +14487,21 @@ dependencies = [ "webpki 0.22.0", ] +[[package]] +name = "webpki-roots" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +dependencies = [ + "rustls-webpki 0.100.2", +] + +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + [[package]] name = "webrtc" version = "0.6.0" @@ -14441,7 +14528,7 @@ dependencies = [ "sha2 0.10.7", "stun", "thiserror", - "time 0.3.23", + "time 0.3.27", "tokio", "turn", "url", @@ -14473,9 +14560,9 @@ dependencies = [ [[package]] name = "webrtc-dtls" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942be5bd85f072c3128396f6e5a9bfb93ca8c1939ded735d177b7bcba9a13d05" +checksum = "c4a00f4242f2db33307347bd5be53263c52a0331c96c14292118c9a6bb48d267" dependencies = [ "aes 0.6.0", "aes-gcm 0.10.2", @@ -14490,25 +14577,24 @@ dependencies = [ "hkdf 0.12.3", "hmac 0.12.1", "log", - "oid-registry 0.6.1", "p256", "p384", "rand 0.8.5", "rand_core 0.6.4", - "rcgen 0.9.3", + "rcgen 0.10.0", "ring", "rustls 0.19.1", "sec1", "serde", "sha1", "sha2 0.10.7", - "signature", + "signature 1.6.4", "subtle", "thiserror", "tokio", "webpki 0.21.4", "webrtc-util", - "x25519-dalek 2.0.0-pre.1", + "x25519-dalek 2.0.0", "x509-parser 0.13.2", ] @@ -14711,7 +14797,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -14757,7 +14843,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.1", + "windows-targets 0.48.5", ] [[package]] @@ -14777,17 +14863,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -14798,9 +14884,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -14822,9 +14908,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -14846,9 +14932,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -14870,9 +14956,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -14894,9 +14980,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -14906,9 +14992,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -14930,28 +15016,19 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.4.9" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a2094c43cc94775293eaa0e499fbc30048a6d824ac82c0351a8c0bf9112529" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - [[package]] name = "winreg" version = "0.50.0" @@ -14984,12 +15061,13 @@ dependencies = [ [[package]] name = "x25519-dalek" -version = "2.0.0-pre.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5da623d8af10a62342bcbbb230e33e58a63255a58012f8653c578e54bab48df" +checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek 4.0.0", "rand_core 0.6.4", + "serde", "zeroize", ] @@ -15009,7 +15087,7 @@ dependencies = [ "ring", "rusticata-macros", "thiserror", - "time 0.3.23", + "time 0.3.27", ] [[package]] @@ -15027,7 +15105,7 @@ dependencies = [ "oid-registry 0.6.1", "rusticata-macros", "thiserror", - "time 0.3.23", + "time 0.3.27", ] [[package]] @@ -15062,7 +15140,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" dependencies = [ - "time 0.3.23", + "time 0.3.27", ] [[package]] @@ -15075,7 +15153,7 @@ dependencies = [ "byteorder", "derivative", "enumflags2 0.6.4", - "fastrand", + "fastrand 1.9.0", "futures", "nb-connect", "nix 0.22.3", @@ -15117,7 +15195,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.29", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 21140e22694..b4861fc1807 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -89,10 +89,10 @@ members = [ ] [workspace.dependencies] -anyhow = "1.0.70" +anyhow = "1.0.75" arbitrary = "1.3.0" async-recursion = "1.0.4" -async-trait = "0.1.68" +async-trait = "0.1.73" base64 = "0.21.0" byteorder = { version = "1.4.3", default-features = false } blake2-rfc = { version = "0.2.18", default-features = false } @@ -128,7 +128,7 @@ primitive-types = { version = "0.12.1", default-features = false } proc-macro2 = { version = "1", default-features = false } proptest = "1.1.0" quick-xml = "0.28" -quote = { version = "1.0.26", default-features = false } +quote = { version = "1.0.33", default-features = false } rand = { version = "0.8", default-features = false } rayon = "1.7" regex = "^1.9" @@ -160,7 +160,7 @@ syn = "2.0.28" thiserror = "1.0.44" tokio = { version = "1.27.0" } url = "2.3.1" -wat = "1.0.69" +wat = "1.0.71" wabt = "0.10.0" wasmi = { version = "0.14.0", default-features = false } wasmparser = { package = "wasmparser-nostd", version = "0.100.1", default-features = false } From 222cac4727b03ed084aef5ed9839c578bc2a360b Mon Sep 17 00:00:00 2001 From: Dmitriy <128726599+Magorsky@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:10:23 +0300 Subject: [PATCH 102/165] feat: fuzzer scripts update (#3188) --- docker/runtime-fuzzer/Dockerfile | 8 ++- docker/runtime-fuzzer/scripts/fuzzer.sh | 93 +++++++++++++++++-------- scripts/gear.sh | 2 +- scripts/src/test.sh | 4 +- 4 files changed, 72 insertions(+), 35 deletions(-) diff --git a/docker/runtime-fuzzer/Dockerfile b/docker/runtime-fuzzer/Dockerfile index 5992dafee38..806a37e574b 100644 --- a/docker/runtime-fuzzer/Dockerfile +++ b/docker/runtime-fuzzer/Dockerfile @@ -18,10 +18,12 @@ RUN apt update -y && \ rustup target add wasm32-unknown-unknown --toolchain nightly; \ rustup default nightly; \ # Install cargo-fuzz \ - cargo install cargo-fuzz; \ + cargo install --git https://github.com/rust-fuzz/cargo-fuzz; \ # Set rights \ - chmod +x ./scripts/gear.sh + chmod +x ./scripts/gear.sh && \ + # Create dir for corpus \ + mkdir -p /corpus/main # Run the fuzzer ENTRYPOINT ["./scripts/gear.sh"] -CMD ["test", "fuzz"] \ No newline at end of file +CMD ["test", "fuzz", "/corpus/main"] diff --git a/docker/runtime-fuzzer/scripts/fuzzer.sh b/docker/runtime-fuzzer/scripts/fuzzer.sh index 2849cdb4dd8..b6ecc6f8978 100755 --- a/docker/runtime-fuzzer/scripts/fuzzer.sh +++ b/docker/runtime-fuzzer/scripts/fuzzer.sh @@ -1,16 +1,27 @@ #!/bin/bash set -e -VOLUME_DIR='/home/ubuntu/fuzzing-seeds-dir/' +WORK_DIR=$(pwd -P) +VOLUME_DIR="$WORK_DIR/fuzzing-seeds-dir/" +CORPUS_DIR="$WORK_DIR/corpus/" +ARTIFACT_DIR="$WORK_DIR/artifacts" ARCHIVE_PATH="/opt/download-archives/" +# DOCKER PARAMS CONTAINER_NAME=node-fuzzer IMAGE='ghcr.io/gear-tech/gear-node-fuzzer:latest' -DOCKER_EXIT_CODE='' +# ALERTING PARAMS +GROUP_ID='***' +BOT_TOKEN='***' -# Function to check if error was OOM +# Function to check container function _check_need_arch { - cmd=$(tail -n 50 node-fuzzer.log | grep 'ERROR: libFuzzer: out-of-memory') - if [[ $cmd ]]; then + _dcode=$(docker inspect ${CONTAINER_NAME} --format='{{.State.ExitCode}}' ) + echo "Container exit code: $_dcode" + cmd=$(docker logs -f --tail 100 ${CONTAINER_NAME} | grep 'ERROR: libFuzzer: out-of-memory') + if [ "$_dcode" -eq 137 ]; then + echo "Container was stopped manually" + return 0 + elif [[ $cmd ]]; then echo "Archiving doesn't needed due to OOM error" return 0 else @@ -29,7 +40,7 @@ function _check_container_runtime { } # Function to start the container and wait for it to stop -function start_container { +function _start_container { # Start the container in the background if [ ! "$(docker ps -a -q -f name=${CONTAINER_NAME})" ]; then if [ "$(docker ps -aq -f status=exited -f name=${CONTAINER_NAME})" ]; then @@ -40,32 +51,52 @@ function start_container { docker run -d --pull=always \ -e TERM=xterm-256color \ -v "${VOLUME_DIR}:/fuzzing-seeds-dir" \ + -v "${CORPUS_DIR}:/corpus/main" \ + -v "${ARTIFACT_DIR}:/gear/utils/runtime-fuzzer/fuzz/artifactis/main" \ --name ${CONTAINER_NAME} ${IMAGE} fi # Wait for the container to stop docker wait node-fuzzer } -function archive_logs { +# Send message+logfile to telegram +function _alert_tg { + docker logs -f --tail 100 ${CONTAINER_NAME} >& node-fuzzer.log + text_message="Node Fuzzer Alert 🔥 + +Problem: Node Fuzzer Container terminated due to an error. +Please check logs. + +Archive link: +
Link" + + echo "$WORK_DIR" + curl -s \ + --data "text=$text_message" --data "chat_id=$GROUP_ID" \ + 'https://api.telegram.org/bot'$BOT_TOKEN'/sendMessage?parse_mode=HTML' + curl -v \ + -F "chat_id=$GROUP_ID" \ + -F document=@$WORK_DIR/node-fuzzer.log \ + 'https://api.telegram.org/bot'$BOT_TOKEN'/sendDocument' + rm node-fuzzer.log +} + +function _archive_logs { ARCHIVE_NAME="node-fuzzer_logs_$(date +%Y-%m-%d_%H-%M-%S).tar.gz" - _dcode=$(docker inspect ${CONTAINER_NAME} --format='{{.State.ExitCode}}' ) echo "Container exit code: $_dcode" - if [ "$_dcode" != 137 ]; then - # Get the logs from the container and archive them with the current timestamp in the filename - docker logs node-fuzzer >& node-fuzzer.log - echo "Copy fuzzing-seeds" - cp ${VOLUME_DIR}fuzzing-seeds ./ - - if [ _check_need_arch ]; then - echo "Creating tar archive: ${ARCHIVE_NAME}" - # Tar logs and seeds - tar -czvf ${ARCHIVE_PATH}/${ARCHIVE_NAME} node-fuzzer.log fuzzing-seeds - fi - echo "Clean tmp files" - rm node-fuzzer.log fuzzing-seeds - else - echo "Container was killed manually" - fi + # Get the logs from the container and archive them with the current timestamp in the filename + docker logs node-fuzzer >& node-fuzzer.log + split -C 1024m --additional-suffix=.log --numeric-suffixes node-fuzzer.log node-fuzzer_part + rm node-fuzzer.log + echo "Copy fuzzing-seeds" + cp ${VOLUME_DIR}fuzzing-seeds ./ + echo "Creating tar archive: ${ARCHIVE_NAME}" + # Tar logs and seeds + tar -czvf ${ARCHIVE_PATH}/${ARCHIVE_NAME} *.log fuzzing-seeds corpus artifacts + # Clean temp files + echo "Clean tmp files" + rm *.log fuzzing-seeds + rm -rf ./atrifacts/* } function start { @@ -73,12 +104,16 @@ function start { while true; do echo "########## $(date) ###########" echo "Start container: ${CONTAINER_NAME}" - start_container - echo "Start archiving logs" - archive_logs + _start_container + if ! _check_need_arch; then + echo "Start archiving logs" + _archive_logs + echo "Create alert" + _alert_tg $ARCHIVE_NAME + fi _check_container_runtime - # Clean up the container - docker rm ${CONTAINER_NAME} + # Clean up the container + docker rm ${CONTAINER_NAME} docker rmi ${IMAGE} # Clean archives older than 30 days find ${ARCHIVE_PATH} -name "node-fuzzer_logs*.tar.gz" -type f -mtime +30 -delete diff --git a/scripts/gear.sh b/scripts/gear.sh index a0aa74b546e..a7e2ebc1d55 100755 --- a/scripts/gear.sh +++ b/scripts/gear.sh @@ -299,7 +299,7 @@ case "$COMMAND" in fuzz) header "Running fuzzer for runtime panic checks" - run_fuzzer "$ROOT_DIR" ;; + run_fuzzer "$ROOT_DIR" "$1"; ;; fuzz-repr) header "Running fuzzer reproduction" diff --git a/scripts/src/test.sh b/scripts/src/test.sh index 41b68731c31..2e8f03f4494 100755 --- a/scripts/src/test.sh +++ b/scripts/src/test.sh @@ -81,13 +81,13 @@ validators() { run_fuzzer() { ROOT_DIR="$1" - + CORPUS_DIR="$2" # Navigate to fuzzer dir cd $ROOT_DIR/utils/runtime-fuzzer # Run fuzzer RUST_LOG=debug,syscalls,gear_wasm_gen=trace,runtime_fuzzer=trace,gear_backend_common=trace \ - cargo fuzz run --release --sanitizer=none main -- -rss_limit_mb=8192 -max_len=35000000 -len_control=0 + cargo fuzz run --release --sanitizer=none main $CORPUS_DIR -- -rss_limit_mb=8192 -max_len=35000000 -len_control=0 } test_fuzzer_reproduction() { From eca00f9f25b2c4d5c4afc065e61d05560de5620e Mon Sep 17 00:00:00 2001 From: StackOverflowExcept1on <109800286+StackOverflowExcept1on@users.noreply.github.com> Date: Wed, 30 Aug 2023 00:45:37 +0300 Subject: [PATCH 103/165] chore(wasm-builder): ignore smoke tests (#3194) --- scripts/src/test.sh | 1 + utils/wasm-builder/tests/smoke.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/scripts/src/test.sh b/scripts/src/test.sh index 2e8f03f4494..07272ce15e9 100755 --- a/scripts/src/test.sh +++ b/scripts/src/test.sh @@ -108,4 +108,5 @@ doc_test() { time_consuming_tests() { $CARGO test -p demo-fungible-token --no-fail-fast "$@" -- --nocapture --ignored + $CARGO test -p gear-wasm-builder --no-fail-fast "$@" -- --nocapture --ignored } diff --git a/utils/wasm-builder/tests/smoke.rs b/utils/wasm-builder/tests/smoke.rs index 9e8ea909eab..6a579155a99 100644 --- a/utils/wasm-builder/tests/smoke.rs +++ b/utils/wasm-builder/tests/smoke.rs @@ -42,21 +42,25 @@ impl CargoRunner { } } +#[ignore] #[test] fn test_debug() { CargoRunner::new().args(["test"]).run(); } +#[ignore] #[test] fn build_debug() { CargoRunner::new().args(["build"]).run() } +#[ignore] #[test] fn test_release() { CargoRunner::new().args(["test", "--release"]).run() } +#[ignore] #[test] fn build_release() { CargoRunner::new().args(["build", "--release"]).run() @@ -69,6 +73,7 @@ fn build_release_for_target() { .run() } +#[ignore] #[test] fn no_infinite_build() { fs::write("test-program/src/rebuild_test.rs", "mod a {}").unwrap(); From 9b1d5edfa2a3d9cd13a096223ac1d8b9e3c50909 Mon Sep 17 00:00:00 2001 From: Elijah <83283675+tltsutltsu@users.noreply.github.com> Date: Wed, 30 Aug 2023 11:01:50 +0600 Subject: [PATCH 104/165] test(core): signals tests (#2986) --- Cargo.lock | 2 + core-errors/signal-code-testing.md | 1175 ++++++++++++++++++++++++++++ core-errors/src/simple.rs | 3 + examples/signal-entry/Cargo.toml | 6 +- examples/signal-entry/src/lib.rs | 89 ++- pallets/gear/src/tests.rs | 257 +++++- 6 files changed, 1519 insertions(+), 13 deletions(-) create mode 100644 core-errors/signal-code-testing.md diff --git a/Cargo.lock b/Cargo.lock index 373a3d1c47b..d665b6eb0af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2214,8 +2214,10 @@ dependencies = [ name = "demo-signal-entry" version = "0.1.0" dependencies = [ + "gear-core", "gear-wasm-builder", "gstd", + "gsys", "gtest", "parity-scale-codec", ] diff --git a/core-errors/signal-code-testing.md b/core-errors/signal-code-testing.md new file mode 100644 index 00000000000..a64b1050fc9 --- /dev/null +++ b/core-errors/signal-code-testing.md @@ -0,0 +1,1175 @@ +# Signal codes testing + +## Contents +1. [Summary](#summary) +1. [Testing technique](#testing-technique) +1. [Cases](#cases) + 1. [Execution signal codes](#execution) + 1. [Userspace panic](#userspace-panic) + 1. [Ran out of gas](#run-out-of-gas) + 1. [Backend error](#backend-error) + 1. [Memory overflow](#memory-overflow) + 1. [Unreachable instruction](#unreachable-instruction) + 1. [Non-execution signal codes](#non-execution) + 1. [Removed from waitlist](#removed-from-waitlist) + +## Summary + + +Our goal is to test _all_ cases where a signal code gets sent and ensure that it is sent and handled correctly. + +Signal codes might be returned during the program's execution or when a significant event occurs outside the program's execution, such as when a message is removed from the waitlist. + +You can find signal codes list in the `SignalCode` enum, located in [core-errors/src/simple.rs](./src/simple.rs). + +## Testing technique + + +In the following section you can find all cases of signal codes. Each case is accompanied by a reference smart contract code and a corresponding reference test. This reference test will demonstrate the specific case, trigger the sending of signal code, and verify that the smart contract receives the appropriate signal code. + +Each test will reserve gas before action. This step ensures that the program doesn't run out of gas during the `handle_signal` execution. + +Tests code will be written as if it were written in the `gear` pallet, because actual testing of these cases is done in the `gear` pallet. + +## Cases + + +### Execution signal codes (`SignalCode::Execution`) + + +These signal codes are sent when the program's execution cannot proceed. Every one of these signal codes contains a `SimpleExecutionError` (refer to [core-errors/src/simple.rs](./src/simple.rs)) within. + +#### Userspace panic + + +This signal code is sent when the runtime detects any Rust panic, such as through `panic!()`, `unreachable!()`, `assert!()`, `unimplemented!()`, and so on. + +> In fact, this signal code is sent when the executor catches a Trap and issues a `TrapExplanation::Panic`. The `TrapExplanation::Panic` is sent every time the `gr_panic` syscall is invoked within the runtime. So to fully cover this case we need just to call the `gr_panic` function – and it will cover all other cases where `gr_panic` might be called. + +