From 4c28354be1f5eec875d116a1ab7d9429023ef83b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Tue, 4 Feb 2025 22:20:20 +0100 Subject: [PATCH 1/2] revive: Include immutable storage deposit into the contracts `storage_base_deposit` (#7230) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR is centered around a main fix regarding the base deposit and a bunch of drive by or related fixtures that make sense to resolve in one go. It could be broken down more but I am constantly rebasing this PR and would appreciate getting those fixes in as-one. **This adds a multi block migration to Westend AssetHub that wipes the pallet state clean. This is necessary because of the changes to the `ContractInfo` storage item. It will not delete the child storage though. This will leave a tiny bit of garbage behind but won't cause any problems. They will just be orphaned.** ## Record the deposit for immutable data into the `storage_base_deposit` The `storage_base_deposit` are all the deposit a contract has to pay for existing. It included the deposit for its own metadata and a deposit proportional (< 1.0x) to the size of its code. However, the immutable code size was not recorded there. This would lead to the situation where on terminate this portion wouldn't be refunded staying locked into the contract. It would also make the calculation of the deposit changes on `set_code_hash` more complicated when it updates the immutable data (to be done in #6985). Reason is because it didn't know how much was payed before since the storage prices could have changed in the mean time. In order for this solution to work I needed to delay the deposit calculation for a new contract for after the contract is done executing is constructor as only then we know the immutable data size. Before, we just charged this eagerly in `charge_instantiate` before we execute the constructor. Now, we merely send the ED as free balance before the constructor in order to create the account. After the constructor is done we calculate the contract base deposit and charge it. This will make `set_code_hash` much easier to implement. As a side effect it is now legal to call `set_immutable_data` multiple times per constructor (even though I see no reason to do so). It simply overrides the immutable data with the new value. The deposit accounting will be done after the constructor returns (as mentioned above) instead of when setting the immutable data. ## Don't pre-charge for reading immutable data I noticed that we were pre-charging weight for the max allowable immutable data when reading those values and then refunding after read. This is not necessary as we know its length without reading the storage as we store it out of band in contract metadata. This makes reading it free. Less pre-charging less problems. ## Remove delegate locking Fixes #7092 This is also in the spirit of making #6985 easier to implement. The locking complicates `set_code_hash` as we might need to block settings the code hash when locks exist. Check #7092 for further rationale. ## Enforce "no terminate in constructor" eagerly We used to enforce this rule after the contract execution returned. Now we error out early in the host call. This makes it easier to be sure to argue that a contract info still exists (wasn't terminated) when a constructor successfully returns. All around this his just much simpler than dealing this check. ## Moved refcount functions to `CodeInfo` They never really made sense to exist on `Stack`. But now with the locking gone this makes even less sense. The refcount is stored inside `CodeInfo` to lets just move them there. ## Set `CodeHashLockupDepositPercent` for test runtime The test runtime was setting `CodeHashLockupDepositPercent` to zero. This was trivializing many code paths and excluded them from testing. I set it to `30%` which is our default value and fixed up all the tests that broke. This should give us confidence that the lockup doeposit collections properly works. ## Reworked the `MockExecutable` to have both a `deploy` and a `call` entry point This type used for testing could only have either entry points but not both. In order to fix the `immutable_data_set_overrides` I needed to a new function `add_both` to `MockExecutable` that allows to have both entry points. Make sure to make use of it in the future :) --------- Co-authored-by: command-bot <> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: PG Herveou Co-authored-by: Bastian Köcher Co-authored-by: Oliver Tale-Yazdi --- Cargo.lock | 2 + .../assets/asset-hub-westend/Cargo.toml | 4 + .../assets/asset-hub-westend/src/lib.rs | 22 + .../asset-hub-westend/src/weights/mod.rs | 1 + .../src/weights/pallet_migrations.rs | 225 ++++ .../src/weights/pallet_migrations.rs | 193 ++- .../src/weights/pallet_migrations.rs | 193 ++- .../rococo/src/weights/pallet_migrations.rs | 166 ++- .../westend/src/weights/pallet_migrations.rs | 166 ++- prdoc/pr_7230.prdoc | 46 + substrate/frame/migrations/Cargo.toml | 7 +- .../frame/migrations/src/benchmarking.rs | 37 + substrate/frame/migrations/src/lib.rs | 5 + substrate/frame/migrations/src/migrations.rs | 135 ++ substrate/frame/migrations/src/weights.rs | 223 ++-- .../create_storage_and_instantiate.rs | 10 +- .../contracts/locking_delegate_dependency.rs | 77 -- .../fixtures/contracts/self_destruct.rs | 5 +- .../frame/revive/src/benchmarking/mod.rs | 54 +- substrate/frame/revive/src/exec.rs | 289 ++--- substrate/frame/revive/src/lib.rs | 13 +- substrate/frame/revive/src/limits.rs | 3 - substrate/frame/revive/src/storage.rs | 101 +- substrate/frame/revive/src/storage/meter.rs | 54 +- substrate/frame/revive/src/tests.rs | 362 ++---- substrate/frame/revive/src/wasm/mod.rs | 61 +- substrate/frame/revive/src/wasm/runtime.rs | 59 +- substrate/frame/revive/src/weights.rs | 1137 ++++++++--------- substrate/frame/revive/uapi/src/host.rs | 23 - .../frame/revive/uapi/src/host/riscv64.rs | 12 - substrate/frame/support/src/traits/hooks.rs | 4 + 31 files changed, 1944 insertions(+), 1745 deletions(-) create mode 100644 cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_migrations.rs create mode 100644 prdoc/pr_7230.prdoc create mode 100644 substrate/frame/migrations/src/migrations.rs delete mode 100644 substrate/frame/revive/fixtures/contracts/locking_delegate_dependency.rs diff --git a/Cargo.lock b/Cargo.lock index c5633437d42f..c09ed4573340 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1125,6 +1125,7 @@ dependencies = [ "pallet-balances 28.0.0", "pallet-collator-selection 9.0.0", "pallet-message-queue 31.0.0", + "pallet-migrations 1.0.0", "pallet-multisig 28.0.0", "pallet-nft-fractionalization 10.0.0", "pallet-nfts 22.0.0", @@ -14013,6 +14014,7 @@ dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", + "polkadot-sdk-frame 0.1.0", "pretty_assertions", "scale-info", "sp-api 26.0.0", diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml index 65ef63a7fb35..f7fb858de62e 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/Cargo.toml @@ -36,6 +36,7 @@ pallet-assets-freezer = { workspace = true } pallet-aura = { workspace = true } pallet-authorship = { workspace = true } pallet-balances = { workspace = true } +pallet-migrations = { workspace = true } pallet-multisig = { workspace = true } pallet-nft-fractionalization = { workspace = true } pallet-nfts = { workspace = true } @@ -133,6 +134,7 @@ runtime-benchmarks = [ "pallet-balances/runtime-benchmarks", "pallet-collator-selection/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", + "pallet-migrations/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-nft-fractionalization/runtime-benchmarks", "pallet-nfts/runtime-benchmarks", @@ -177,6 +179,7 @@ try-runtime = [ "pallet-balances/try-runtime", "pallet-collator-selection/try-runtime", "pallet-message-queue/try-runtime", + "pallet-migrations/try-runtime", "pallet-multisig/try-runtime", "pallet-nft-fractionalization/try-runtime", "pallet-nfts/try-runtime", @@ -230,6 +233,7 @@ std = [ "pallet-balances/std", "pallet-collator-selection/std", "pallet-message-queue/std", + "pallet-migrations/std", "pallet-multisig/std", "pallet-nft-fractionalization/std", "pallet-nfts-runtime-api/std", diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index 3a7e3ef131c3..ce2ee8f566e0 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -185,6 +185,7 @@ impl frame_system::Config for Runtime { type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; type MaxConsumers = frame_support::traits::ConstU32<16>; + type MultiBlockMigrator = MultiBlockMigrations; } impl cumulus_pallet_weight_reclaim::Config for Runtime { @@ -1095,6 +1096,25 @@ impl TryFrom for pallet_revive::Call { } } +parameter_types! { + pub MbmServiceWeight: Weight = Perbill::from_percent(80) * RuntimeBlockWeights::get().max_block; +} + +impl pallet_migrations::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + #[cfg(not(feature = "runtime-benchmarks"))] + type Migrations = pallet_migrations::migrations::ResetPallet; + // Benchmarks need mocked migrations to guarantee that they succeed. + #[cfg(feature = "runtime-benchmarks")] + type Migrations = pallet_migrations::mock_helpers::MockedMigrations; + type CursorMaxLen = ConstU32<65_536>; + type IdentifierMaxLen = ConstU32<256>; + type MigrationStatusHandler = (); + type FailedMigrationHandler = frame_support::migrations::FreezeChainOnFailedMigration; + type MaxServiceWeight = MbmServiceWeight; + type WeightInfo = weights::pallet_migrations::WeightInfo; +} + // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime @@ -1106,6 +1126,7 @@ construct_runtime!( Timestamp: pallet_timestamp = 3, ParachainInfo: parachain_info = 4, WeightReclaim: cumulus_pallet_weight_reclaim = 5, + MultiBlockMigrations: pallet_migrations = 6, // Monetary stuff. Balances: pallet_balances = 10, @@ -1430,6 +1451,7 @@ mod benches { [pallet_asset_conversion_tx_payment, AssetTxPayment] [pallet_balances, Balances] [pallet_message_queue, MessageQueue] + [pallet_migrations, MultiBlockMigrations] [pallet_multisig, Multisig] [pallet_nft_fractionalization, NftFractionalization] [pallet_nfts, Nfts] diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs index d653838ad80e..86cd12507401 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/mod.rs @@ -30,6 +30,7 @@ pub mod pallet_assets_pool; pub mod pallet_balances; pub mod pallet_collator_selection; pub mod pallet_message_queue; +pub mod pallet_migrations; pub mod pallet_multisig; pub mod pallet_nft_fractionalization; pub mod pallet_nfts; diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_migrations.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_migrations.rs new file mode 100644 index 000000000000..e771059cec85 --- /dev/null +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/pallet_migrations.rs @@ -0,0 +1,225 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `pallet_migrations` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-01-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `17938671047b`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/asset-hub-westend-runtime/asset_hub_westend_runtime.wasm +// --pallet=pallet_migrations +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_migrations`. +pub struct WeightInfo(PhantomData); +impl pallet_migrations::WeightInfo for WeightInfo { + /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:1) + /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + fn onboard_new_mbms() -> Weight { + // Proof Size summary in bytes: + // Measured: `171` + // Estimated: `67035` + // Minimum execution time: 8_697_000 picoseconds. + Weight::from_parts(8_998_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) + /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) + fn progress_mbms_none() -> Weight { + // Proof Size summary in bytes: + // Measured: `42` + // Estimated: `67035` + // Minimum execution time: 2_737_000 picoseconds. + Weight::from_parts(2_813_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(1)) + } + /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) + /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) + fn exec_migration_completed() -> Weight { + // Proof Size summary in bytes: + // Measured: `129` + // Estimated: `3594` + // Minimum execution time: 6_181_000 picoseconds. + Weight::from_parts(6_458_000, 0) + .saturating_add(Weight::from_parts(0, 3594)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Storage: `MultiBlockMigrations::Historic` (r:1 w:0) + /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) + fn exec_migration_skipped_historic() -> Weight { + // Proof Size summary in bytes: + // Measured: `225` + // Estimated: `3731` + // Minimum execution time: 11_932_000 picoseconds. + Weight::from_parts(12_539_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + } + /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Storage: `MultiBlockMigrations::Historic` (r:1 w:0) + /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) + fn exec_migration_advance() -> Weight { + // Proof Size summary in bytes: + // Measured: `171` + // Estimated: `3731` + // Minimum execution time: 11_127_000 picoseconds. + Weight::from_parts(11_584_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + } + /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Storage: `MultiBlockMigrations::Historic` (r:1 w:1) + /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) + fn exec_migration_complete() -> Weight { + // Proof Size summary in bytes: + // Measured: `171` + // Estimated: `3731` + // Minimum execution time: 12_930_000 picoseconds. + Weight::from_parts(13_272_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Storage: `MultiBlockMigrations::Historic` (r:1 w:0) + /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) + /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) + /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) + fn exec_migration_fail() -> Weight { + // Proof Size summary in bytes: + // Measured: `171` + // Estimated: `3731` + // Minimum execution time: 13_709_000 picoseconds. + Weight::from_parts(14_123_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) + } + fn on_init_loop() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 162_000 picoseconds. + Weight::from_parts(188_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + } + /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) + /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) + fn force_set_cursor() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 2_737_000 picoseconds. + Weight::from_parts(2_919_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) + /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) + fn force_set_active_cursor() -> Weight { + // Proof Size summary in bytes: + // Measured: `0` + // Estimated: `0` + // Minimum execution time: 3_087_000 picoseconds. + Weight::from_parts(3_320_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) + } + /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) + /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) + /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) + fn force_onboard_mbms() -> Weight { + // Proof Size summary in bytes: + // Measured: `147` + // Estimated: `67035` + // Minimum execution time: 6_470_000 picoseconds. + Weight::from_parts(6_760_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) + } + /// Storage: `MultiBlockMigrations::Historic` (r:256 w:256) + /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) + /// The range of component `n` is `[0, 256]`. + fn clear_historic(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1022 + n * (271 ±0)` + // Estimated: `3834 + n * (2740 ±0)` + // Minimum execution time: 15_864_000 picoseconds. + Weight::from_parts(24_535_162, 0) + .saturating_add(Weight::from_parts(0, 3834)) + // Standard Error: 8_688 + .saturating_add(Weight::from_parts(1_530_542, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 2740).saturating_mul(n.into())) + } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 2048]`. + fn reset_pallet_migration(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1680 + n * (38 ±0)` + // Estimated: `758 + n * (39 ±0)` + // Minimum execution time: 2_168_000 picoseconds. + Weight::from_parts(2_226_000, 0) + .saturating_add(Weight::from_parts(0, 758)) + // Standard Error: 2_841 + .saturating_add(Weight::from_parts(935_438, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(n.into())) + } +} diff --git a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_migrations.rs b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_migrations.rs index 61857ac8202a..57048b6e7095 100644 --- a/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_migrations.rs +++ b/cumulus/parachains/runtimes/people/people-rococo/src/weights/pallet_migrations.rs @@ -1,19 +1,46 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 +// This file is part of Cumulus. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Cumulus 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. -// Need to rerun! +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `pallet_migrations` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-01-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `17938671047b`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/people-rococo-runtime/people_rococo_runtime.wasm +// --pallet=pallet_migrations +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/people/people-rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -32,22 +59,24 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn onboard_new_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `276` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 7_762_000 picoseconds. - Weight::from_parts(8_100_000, 67035) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 4_483_000 picoseconds. + Weight::from_parts(4_781_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn progress_mbms_none() -> Weight { // Proof Size summary in bytes: - // Measured: `142` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_138_000, 67035) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 864_000 picoseconds. + Weight::from_parts(907_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -55,12 +84,13 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_completed() -> Weight { // Proof Size summary in bytes: - // Measured: `134` - // Estimated: `3599` - // Minimum execution time: 5_868_000 picoseconds. - Weight::from_parts(6_143_000, 3599) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `0` + // Estimated: `3465` + // Minimum execution time: 3_978_000 picoseconds. + Weight::from_parts(4_149_000, 0) + .saturating_add(Weight::from_parts(0, 3465)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -68,11 +98,12 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_skipped_historic() -> Weight { // Proof Size summary in bytes: - // Measured: `330` - // Estimated: `3795` - // Minimum execution time: 10_283_000 picoseconds. - Weight::from_parts(10_964_000, 3795) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `34` + // Estimated: `3731` + // Minimum execution time: 7_432_000 picoseconds. + Weight::from_parts(7_663_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -80,11 +111,12 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_advance() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 9_900_000 picoseconds. - Weight::from_parts(10_396_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 6_915_000 picoseconds. + Weight::from_parts(7_112_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -92,12 +124,13 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_complete() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 11_411_000 picoseconds. - Weight::from_parts(11_956_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 8_561_000 picoseconds. + Weight::from_parts(8_701_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -107,19 +140,21 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_fail() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 12_398_000 picoseconds. - Weight::from_parts(12_910_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 8_998_000 picoseconds. + Weight::from_parts(9_348_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } fn on_init_loop() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 166_000 picoseconds. - Weight::from_parts(193_000, 0) + // Minimum execution time: 145_000 picoseconds. + Weight::from_parts(183_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -127,9 +162,10 @@ impl pallet_migrations::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_686_000 picoseconds. - Weight::from_parts(2_859_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 2_137_000 picoseconds. + Weight::from_parts(2_275_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -137,9 +173,10 @@ impl pallet_migrations::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_070_000 picoseconds. - Weight::from_parts(3_250_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 2_625_000 picoseconds. + Weight::from_parts(2_748_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -147,26 +184,44 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn force_onboard_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `251` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 5_901_000 picoseconds. - Weight::from_parts(6_320_000, 67035) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Minimum execution time: 3_010_000 picoseconds. + Weight::from_parts(3_170_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: `MultiBlockMigrations::Historic` (r:256 w:256) /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 256]`. fn clear_historic(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1122 + n * (271 ±0)` + // Measured: `960 + n * (271 ±0)` // Estimated: `3834 + n * (2740 ±0)` - // Minimum execution time: 15_952_000 picoseconds. - Weight::from_parts(14_358_665, 3834) - // Standard Error: 3_358 - .saturating_add(Weight::from_parts(1_323_674, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 15_088_000 picoseconds. + Weight::from_parts(27_216_754, 0) + .saturating_add(Weight::from_parts(0, 3834)) + // Standard Error: 5_635 + .saturating_add(Weight::from_parts(1_399_330, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2740).saturating_mul(n.into())) } -} \ No newline at end of file + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 2048]`. + fn reset_pallet_migration(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1605 + n * (38 ±0)` + // Estimated: `686 + n * (39 ±0)` + // Minimum execution time: 1_168_000 picoseconds. + Weight::from_parts(1_235_000, 0) + .saturating_add(Weight::from_parts(0, 686)) + // Standard Error: 2_626 + .saturating_add(Weight::from_parts(936_331, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(n.into())) + } +} diff --git a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_migrations.rs b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_migrations.rs index 61857ac8202a..ecc52360a3ce 100644 --- a/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_migrations.rs +++ b/cumulus/parachains/runtimes/people/people-westend/src/weights/pallet_migrations.rs @@ -1,19 +1,46 @@ // Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 +// This file is part of Cumulus. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +// Cumulus 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. -// Need to rerun! +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `pallet_migrations` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-01-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `17938671047b`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/people-westend-runtime/people_westend_runtime.wasm +// --pallet=pallet_migrations +// --header=/__w/polkadot-sdk/polkadot-sdk/cumulus/file_header.txt +// --output=./cumulus/parachains/runtimes/people/people-westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -32,22 +59,24 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn onboard_new_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `276` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 7_762_000 picoseconds. - Weight::from_parts(8_100_000, 67035) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 4_484_000 picoseconds. + Weight::from_parts(4_646_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn progress_mbms_none() -> Weight { // Proof Size summary in bytes: - // Measured: `142` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_138_000, 67035) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 777_000 picoseconds. + Weight::from_parts(841_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -55,12 +84,13 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_completed() -> Weight { // Proof Size summary in bytes: - // Measured: `134` - // Estimated: `3599` - // Minimum execution time: 5_868_000 picoseconds. - Weight::from_parts(6_143_000, 3599) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `0` + // Estimated: `3465` + // Minimum execution time: 3_883_000 picoseconds. + Weight::from_parts(4_097_000, 0) + .saturating_add(Weight::from_parts(0, 3465)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -68,11 +98,12 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_skipped_historic() -> Weight { // Proof Size summary in bytes: - // Measured: `330` - // Estimated: `3795` - // Minimum execution time: 10_283_000 picoseconds. - Weight::from_parts(10_964_000, 3795) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `34` + // Estimated: `3731` + // Minimum execution time: 7_695_000 picoseconds. + Weight::from_parts(8_015_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -80,11 +111,12 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_advance() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 9_900_000 picoseconds. - Weight::from_parts(10_396_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 6_999_000 picoseconds. + Weight::from_parts(7_323_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -92,12 +124,13 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_complete() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 11_411_000 picoseconds. - Weight::from_parts(11_956_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 8_302_000 picoseconds. + Weight::from_parts(8_589_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -107,19 +140,21 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_fail() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 12_398_000 picoseconds. - Weight::from_parts(12_910_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 9_122_000 picoseconds. + Weight::from_parts(9_541_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } fn on_init_loop() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 166_000 picoseconds. - Weight::from_parts(193_000, 0) + // Minimum execution time: 146_000 picoseconds. + Weight::from_parts(168_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -127,9 +162,10 @@ impl pallet_migrations::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_686_000 picoseconds. - Weight::from_parts(2_859_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 2_271_000 picoseconds. + Weight::from_parts(2_367_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -137,9 +173,10 @@ impl pallet_migrations::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_070_000 picoseconds. - Weight::from_parts(3_250_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 2_653_000 picoseconds. + Weight::from_parts(2_798_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -147,26 +184,44 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn force_onboard_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `251` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 5_901_000 picoseconds. - Weight::from_parts(6_320_000, 67035) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Minimum execution time: 3_084_000 picoseconds. + Weight::from_parts(3_233_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: `MultiBlockMigrations::Historic` (r:256 w:256) /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 256]`. fn clear_historic(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1122 + n * (271 ±0)` + // Measured: `960 + n * (271 ±0)` // Estimated: `3834 + n * (2740 ±0)` - // Minimum execution time: 15_952_000 picoseconds. - Weight::from_parts(14_358_665, 3834) - // Standard Error: 3_358 - .saturating_add(Weight::from_parts(1_323_674, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 18_761_000 picoseconds. + Weight::from_parts(22_980_278, 0) + .saturating_add(Weight::from_parts(0, 3834)) + // Standard Error: 5_634 + .saturating_add(Weight::from_parts(1_419_653, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2740).saturating_mul(n.into())) } -} \ No newline at end of file + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 2048]`. + fn reset_pallet_migration(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1605 + n * (38 ±0)` + // Estimated: `686 + n * (39 ±0)` + // Minimum execution time: 1_174_000 picoseconds. + Weight::from_parts(1_216_000, 0) + .saturating_add(Weight::from_parts(0, 686)) + // Standard Error: 3_009 + .saturating_add(Weight::from_parts(952_922, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(n.into())) + } +} diff --git a/polkadot/runtime/rococo/src/weights/pallet_migrations.rs b/polkadot/runtime/rococo/src/weights/pallet_migrations.rs index 4fa07a23bb8a..a0623a9c9513 100644 --- a/polkadot/runtime/rococo/src/weights/pallet_migrations.rs +++ b/polkadot/runtime/rococo/src/weights/pallet_migrations.rs @@ -14,7 +14,31 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -// Need to rerun! +//! Autogenerated weights for `pallet_migrations` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-01-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `17938671047b`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/rococo-runtime/rococo_runtime.wasm +// --pallet=pallet_migrations +// --header=/__w/polkadot-sdk/polkadot-sdk/polkadot/file_header.txt +// --output=./polkadot/runtime/rococo/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -33,22 +57,24 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn onboard_new_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `276` + // Measured: `100` // Estimated: `67035` - // Minimum execution time: 7_762_000 picoseconds. - Weight::from_parts(8_100_000, 67035) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 8_300_000 picoseconds. + Weight::from_parts(8_664_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn progress_mbms_none() -> Weight { // Proof Size summary in bytes: - // Measured: `142` + // Measured: `4` // Estimated: `67035` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_138_000, 67035) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 2_017_000 picoseconds. + Weight::from_parts(2_129_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -56,12 +82,13 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_completed() -> Weight { // Proof Size summary in bytes: - // Measured: `134` - // Estimated: `3599` - // Minimum execution time: 5_868_000 picoseconds. - Weight::from_parts(6_143_000, 3599) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `96` + // Estimated: `3561` + // Minimum execution time: 6_414_000 picoseconds. + Weight::from_parts(6_644_000, 0) + .saturating_add(Weight::from_parts(0, 3561)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -69,11 +96,12 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_skipped_historic() -> Weight { // Proof Size summary in bytes: - // Measured: `330` - // Estimated: `3795` - // Minimum execution time: 10_283_000 picoseconds. - Weight::from_parts(10_964_000, 3795) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `154` + // Estimated: `3731` + // Minimum execution time: 11_600_000 picoseconds. + Weight::from_parts(12_137_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -81,11 +109,12 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_advance() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 9_900_000 picoseconds. - Weight::from_parts(10_396_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `100` + // Estimated: `3731` + // Minimum execution time: 10_944_000 picoseconds. + Weight::from_parts(11_354_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -93,12 +122,13 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_complete() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 11_411_000 picoseconds. - Weight::from_parts(11_956_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `100` + // Estimated: `3731` + // Minimum execution time: 12_525_000 picoseconds. + Weight::from_parts(12_890_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -108,19 +138,21 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_fail() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 12_398_000 picoseconds. - Weight::from_parts(12_910_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `100` + // Estimated: `3731` + // Minimum execution time: 13_749_000 picoseconds. + Weight::from_parts(14_411_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } fn on_init_loop() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 166_000 picoseconds. - Weight::from_parts(193_000, 0) + // Minimum execution time: 174_000 picoseconds. + Weight::from_parts(232_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -128,9 +160,10 @@ impl pallet_migrations::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_686_000 picoseconds. - Weight::from_parts(2_859_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 2_906_000 picoseconds. + Weight::from_parts(3_195_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -138,9 +171,10 @@ impl pallet_migrations::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_070_000 picoseconds. - Weight::from_parts(3_250_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 3_313_000 picoseconds. + Weight::from_parts(3_469_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -148,26 +182,44 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn force_onboard_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `251` + // Measured: `76` // Estimated: `67035` - // Minimum execution time: 5_901_000 picoseconds. - Weight::from_parts(6_320_000, 67035) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Minimum execution time: 5_960_000 picoseconds. + Weight::from_parts(6_262_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: `MultiBlockMigrations::Historic` (r:256 w:256) /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 256]`. fn clear_historic(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1122 + n * (271 ±0)` + // Measured: `984 + n * (271 ±0)` // Estimated: `3834 + n * (2740 ±0)` - // Minimum execution time: 15_952_000 picoseconds. - Weight::from_parts(14_358_665, 3834) - // Standard Error: 3_358 - .saturating_add(Weight::from_parts(1_323_674, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 24_007_000 picoseconds. + Weight::from_parts(19_756_256, 0) + .saturating_add(Weight::from_parts(0, 3834)) + // Standard Error: 6_508 + .saturating_add(Weight::from_parts(1_553_207, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2740).saturating_mul(n.into())) } -} \ No newline at end of file + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 2048]`. + fn reset_pallet_migration(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1676 + n * (38 ±0)` + // Estimated: `754 + n * (39 ±0)` + // Minimum execution time: 2_019_000 picoseconds. + Weight::from_parts(6_578_665, 0) + .saturating_add(Weight::from_parts(0, 754)) + // Standard Error: 5_209 + .saturating_add(Weight::from_parts(894_607, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(n.into())) + } +} diff --git a/polkadot/runtime/westend/src/weights/pallet_migrations.rs b/polkadot/runtime/westend/src/weights/pallet_migrations.rs index 4fa07a23bb8a..f5d4f079ca6d 100644 --- a/polkadot/runtime/westend/src/weights/pallet_migrations.rs +++ b/polkadot/runtime/westend/src/weights/pallet_migrations.rs @@ -14,7 +14,31 @@ // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . -// Need to rerun! +//! Autogenerated weights for `pallet_migrations` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-01-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `17938671047b`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 + +// Executed Command: +// frame-omni-bencher +// v1 +// benchmark +// pallet +// --extrinsic=* +// --runtime=target/production/wbuild/westend-runtime/westend_runtime.wasm +// --pallet=pallet_migrations +// --header=/__w/polkadot-sdk/polkadot-sdk/polkadot/file_header.txt +// --output=./polkadot/runtime/westend/src/weights +// --wasm-execution=compiled +// --steps=50 +// --repeat=20 +// --heap-pages=4096 +// --no-storage-info +// --no-min-squares +// --no-median-slopes #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -33,22 +57,24 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn onboard_new_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `276` + // Measured: `133` // Estimated: `67035` - // Minimum execution time: 7_762_000 picoseconds. - Weight::from_parts(8_100_000, 67035) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 8_228_000 picoseconds. + Weight::from_parts(8_589_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn progress_mbms_none() -> Weight { // Proof Size summary in bytes: - // Measured: `142` + // Measured: `4` // Estimated: `67035` - // Minimum execution time: 2_077_000 picoseconds. - Weight::from_parts(2_138_000, 67035) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 1_980_000 picoseconds. + Weight::from_parts(2_175_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -56,12 +82,13 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_completed() -> Weight { // Proof Size summary in bytes: - // Measured: `134` - // Estimated: `3599` - // Minimum execution time: 5_868_000 picoseconds. - Weight::from_parts(6_143_000, 3599) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `129` + // Estimated: `3594` + // Minimum execution time: 6_390_000 picoseconds. + Weight::from_parts(6_711_000, 0) + .saturating_add(Weight::from_parts(0, 3594)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -69,11 +96,12 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_skipped_historic() -> Weight { // Proof Size summary in bytes: - // Measured: `330` - // Estimated: `3795` - // Minimum execution time: 10_283_000 picoseconds. - Weight::from_parts(10_964_000, 3795) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `187` + // Estimated: `3731` + // Minimum execution time: 14_970_000 picoseconds. + Weight::from_parts(16_023_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -81,11 +109,12 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_advance() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 9_900_000 picoseconds. - Weight::from_parts(10_396_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Measured: `133` + // Estimated: `3731` + // Minimum execution time: 10_908_000 picoseconds. + Weight::from_parts(11_291_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -93,12 +122,13 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_complete() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 11_411_000 picoseconds. - Weight::from_parts(11_956_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `133` + // Estimated: `3731` + // Minimum execution time: 12_433_000 picoseconds. + Weight::from_parts(12_862_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -108,19 +138,21 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_fail() -> Weight { // Proof Size summary in bytes: - // Measured: `276` - // Estimated: `3741` - // Minimum execution time: 12_398_000 picoseconds. - Weight::from_parts(12_910_000, 3741) - .saturating_add(T::DbWeight::get().reads(2_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Measured: `133` + // Estimated: `3731` + // Minimum execution time: 13_407_000 picoseconds. + Weight::from_parts(13_901_000, 0) + .saturating_add(Weight::from_parts(0, 3731)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(1)) } fn on_init_loop() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 166_000 picoseconds. - Weight::from_parts(193_000, 0) + // Minimum execution time: 162_000 picoseconds. + Weight::from_parts(207_000, 0) + .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -128,9 +160,10 @@ impl pallet_migrations::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_686_000 picoseconds. - Weight::from_parts(2_859_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 2_696_000 picoseconds. + Weight::from_parts(2_867_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -138,9 +171,10 @@ impl pallet_migrations::WeightInfo for WeightInfo { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_070_000 picoseconds. - Weight::from_parts(3_250_000, 0) - .saturating_add(T::DbWeight::get().writes(1_u64)) + // Minimum execution time: 3_232_000 picoseconds. + Weight::from_parts(3_436_000, 0) + .saturating_add(Weight::from_parts(0, 0)) + .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -148,26 +182,44 @@ impl pallet_migrations::WeightInfo for WeightInfo { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn force_onboard_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `251` + // Measured: `109` // Estimated: `67035` - // Minimum execution time: 5_901_000 picoseconds. - Weight::from_parts(6_320_000, 67035) - .saturating_add(T::DbWeight::get().reads(2_u64)) + // Minimum execution time: 5_849_000 picoseconds. + Weight::from_parts(6_156_000, 0) + .saturating_add(Weight::from_parts(0, 67035)) + .saturating_add(T::DbWeight::get().reads(2)) } /// Storage: `MultiBlockMigrations::Historic` (r:256 w:256) /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) /// The range of component `n` is `[0, 256]`. fn clear_historic(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1122 + n * (271 ±0)` + // Measured: `984 + n * (271 ±0)` // Estimated: `3834 + n * (2740 ±0)` - // Minimum execution time: 15_952_000 picoseconds. - Weight::from_parts(14_358_665, 3834) - // Standard Error: 3_358 - .saturating_add(Weight::from_parts(1_323_674, 0).saturating_mul(n.into())) - .saturating_add(T::DbWeight::get().reads(1_u64)) + // Minimum execution time: 20_906_000 picoseconds. + Weight::from_parts(15_361_535, 0) + .saturating_add(Weight::from_parts(0, 3834)) + // Standard Error: 7_911 + .saturating_add(Weight::from_parts(1_518_172, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2740).saturating_mul(n.into())) } -} \ No newline at end of file + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 2048]`. + fn reset_pallet_migration(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1676 + n * (38 ±0)` + // Estimated: `754 + n * (39 ±0)` + // Minimum execution time: 1_913_000 picoseconds. + Weight::from_parts(1_986_000, 0) + .saturating_add(Weight::from_parts(0, 754)) + // Standard Error: 2_511 + .saturating_add(Weight::from_parts(919_965, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(n.into())) + } +} diff --git a/prdoc/pr_7230.prdoc b/prdoc/pr_7230.prdoc new file mode 100644 index 000000000000..027694f604fe --- /dev/null +++ b/prdoc/pr_7230.prdoc @@ -0,0 +1,46 @@ +title: 'revive: Include immutable storage deposit into the contracts `storage_base_deposit`' +doc: +- audience: Runtime Dev + description: |- + This PR is centered around a main fix regarding the base deposit and a bunch of drive by or related fixtures that make sense to resolve in one go. It could be broken down more but I am constantly rebasing this PR and would appreciate getting those fixes in as-one. + + ## Record the deposit for immutable data into the `storage_base_deposit` + + The `storage_base_deposit` are all the deposit a contract has to pay for existing. It included the deposit for its own metadata and a deposit proportional (< 1.0x) to the size of its code. However, the immutable code size was not recorded there. This would lead to the situation where on terminate this portion wouldn't be refunded staying locked into the contract. It would also make the calculation of the deposit changes on `set_code_hash` more complicated when it updates the immutable data (to be done in #6985). Reason is because it didn't know how much was payed before since the storage prices could have changed in the mean time. + + In order for this solution to work I needed to delay the deposit calculation for a new contract for after the contract is done executing is constructor as only then we know the immutable data size. Before, we just charged this eagerly in `charge_instantiate` before we execute the constructor. Now, we merely send the ED as free balance before the constructor in order to create the account. After the constructor is done we calculate the contract base deposit and charge it. This will make `set_code_hash` much easier to implement. + + As a side effect it is now legal to call `set_immutable_data` multiple times per constructor (even though I see no reason to do so). It simply overrides the immutable data with the new value. The deposit accounting will be done after the constructor returns (as mentioned above) instead of when setting the immutable data. + + ## Don't pre-charge for reading immutable data + + I noticed that we were pre-charging weight for the max allowable immutable data when reading those values and then refunding after read. This is not necessary as we know its length without reading the storage as we store it out of band in contract metadata. This makes reading it free. Less pre-charging less problems. + + ## Remove delegate locking + + Fixes #7092 + + This is also in the spirit of making #6985 easier to implement. The locking complicates `set_code_hash` as we might need to block settings the code hash when locks exist. Check #7092 for further rationale. + + ## Enforce "no terminate in constructor" eagerly + + We used to enforce this rule after the contract execution returned. Now we error out early in the host call. This makes it easier to be sure to argue that a contract info still exists (wasn't terminated) when a constructor successfully returns. All around this his just much simpler than dealing this check. + + ## Moved refcount functions to `CodeInfo` + + They never really made sense to exist on `Stack`. But now with the locking gone this makes even less sense. The refcount is stored inside `CodeInfo` to lets just move them there. + + ## Set `CodeHashLockupDepositPercent` for test runtime + + The test runtime was setting `CodeHashLockupDepositPercent` to zero. This was trivializing many code paths and excluded them from testing. I set it to `30%` which is our default value and fixed up all the tests that broke. This should give us confidence that the lockup doeposit collections properly works. + + ## Reworked the `MockExecutable` to have both a `deploy` and a `call` entry point + + This type used for testing could only have either entry points but not both. In order to fix the `immutable_data_set_overrides` I needed to a new function `add_both` to `MockExecutable` that allows to have both entry points. Make sure to make use of it in the future :) +crates: +- name: pallet-revive-fixtures + bump: patch +- name: pallet-revive + bump: patch +- name: pallet-revive-uapi + bump: major diff --git a/substrate/frame/migrations/Cargo.toml b/substrate/frame/migrations/Cargo.toml index 469592780beb..f05db314ae57 100644 --- a/substrate/frame/migrations/Cargo.toml +++ b/substrate/frame/migrations/Cargo.toml @@ -18,17 +18,18 @@ impl-trait-for-tuples = { workspace = true } log = { workspace = true, default-features = true } scale-info = { features = ["derive"], workspace = true } +frame = { workspace = true, features = ["runtime"] } frame-benchmarking = { optional = true, workspace = true } frame-support = { workspace = true } frame-system = { workspace = true } sp-core = { workspace = true } +sp-io = { workspace = true } sp-runtime = { workspace = true } [dev-dependencies] frame-executive = { workspace = true, default-features = true } sp-api = { features = ["std"], workspace = true, default-features = true } sp-block-builder = { features = ["std"], workspace = true, default-features = true } -sp-io = { features = ["std"], workspace = true, default-features = true } sp-tracing = { features = ["std"], workspace = true, default-features = true } sp-version = { features = ["std"], workspace = true, default-features = true } @@ -42,9 +43,11 @@ std = [ "frame-benchmarking?/std", "frame-support/std", "frame-system/std", + "frame/std", "log/std", "scale-info/std", "sp-core/std", + "sp-io/std", "sp-runtime/std", ] @@ -52,6 +55,7 @@ runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system/runtime-benchmarks", + "frame/runtime-benchmarks", "sp-runtime/runtime-benchmarks", ] @@ -59,5 +63,6 @@ try-runtime = [ "frame-executive/try-runtime", "frame-support/try-runtime", "frame-system/try-runtime", + "frame/try-runtime", "sp-runtime/try-runtime", ] diff --git a/substrate/frame/migrations/src/benchmarking.rs b/substrate/frame/migrations/src/benchmarking.rs index c076d40bb05c..f06870fa9502 100644 --- a/substrate/frame/migrations/src/benchmarking.rs +++ b/substrate/frame/migrations/src/benchmarking.rs @@ -19,8 +19,11 @@ use super::*; +use core::array; use frame_benchmarking::{v2::*, BenchmarkError}; use frame_system::{Pallet as System, RawOrigin}; +use sp_core::{twox_128, Get}; +use sp_io::{storage, KillStorageResult}; use sp_runtime::traits::One; fn assert_last_event(generic_event: ::RuntimeEvent) { @@ -204,6 +207,40 @@ mod benches { ); } + #[benchmark(skip_meta, pov_mode = Measured)] + fn reset_pallet_migration(n: Linear<0, 2048>) -> Result<(), BenchmarkError> { + let prefix: [u8; 16] = twox_128(b"__ResetPalletBenchmarkPrefix__"); + + for i in 0..n { + // we need to avoid allocations here + let mut iter = prefix.into_iter().chain(i.to_le_bytes()); + let key: [u8; 20] = array::from_fn(|_| iter.next().unwrap()); + // 32 byte will trigger the worst case where the value is + // no longer stored inline + storage::set(&key, &[0u8; 32]); + } + + let result; + #[block] + { + result = storage::clear_prefix(&prefix, None); + } + + // It will always reports no keys removed because they are still in the overlay. + // However, the benchmarking PoV results are correctly dependent on the amount of + // keys removed. + match result { + KillStorageResult::AllRemoved(_i) => { + // during the test the storage is not comitted and `i` will always be 0 + #[cfg(not(test))] + ensure!(_i == n, "Not all keys are removed"); + }, + _ => Err("Not all keys were removed")?, + } + + Ok(()) + } + fn cursor() -> CursorOf { // Note: The weight of a function can depend on the weight of reading the `inner_cursor`. // `Cursor` is a user provided type. Now instead of requiring something like `Cursor: diff --git a/substrate/frame/migrations/src/lib.rs b/substrate/frame/migrations/src/lib.rs index d9490e7dcfe9..fef61468e6e4 100644 --- a/substrate/frame/migrations/src/lib.rs +++ b/substrate/frame/migrations/src/lib.rs @@ -145,6 +145,7 @@ #![cfg_attr(not(feature = "std"), no_std)] mod benchmarking; +pub mod migrations; mod mock; pub mod mock_helpers; mod tests; @@ -298,7 +299,11 @@ type PreUpgradeBytes = pub mod pallet { use super::*; + /// The in-code storage version. + const STORAGE_VERSION: StorageVersion = StorageVersion::new(0); + #[pallet::pallet] + #[pallet::storage_version(STORAGE_VERSION)] pub struct Pallet(_); #[pallet::config(with_default)] diff --git a/substrate/frame/migrations/src/migrations.rs b/substrate/frame/migrations/src/migrations.rs new file mode 100644 index 000000000000..796ff0f95659 --- /dev/null +++ b/substrate/frame/migrations/src/migrations.rs @@ -0,0 +1,135 @@ +// Copyright (C) Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Generic multi block migrations not specific to any pallet. + +use crate::{weights::WeightInfo, Config}; +use codec::Encode; +use core::marker::PhantomData; +use frame_support::{ + migrations::{SteppedMigration, SteppedMigrationError, StoreInCodeStorageVersion}, + traits::{GetStorageVersion, PalletInfoAccess}, + weights::WeightMeter, +}; +use sp_core::{twox_128, Get}; +use sp_io::{storage::clear_prefix, KillStorageResult}; +use sp_runtime::SaturatedConversion; + +/// Remove all of a pallet's state and re-initializes it to the current in-code storage version. +/// +/// It uses the multi block migration frame. Hence it is safe to use even on +/// pallets that contain a lot of storage. +/// +/// # Parameters +/// +/// - T: The runtime. Used to access the weight definition. +/// - P: The pallet to resetted as defined in construct runtime +/// +/// # Note +/// +/// If your pallet does rely of some state in genesis you need to take care of that +/// separately. This migration only sets the storage version after wiping. +pub struct ResetPallet(PhantomData<(T, P)>); + +impl ResetPallet +where + P: PalletInfoAccess, +{ + #[cfg(feature = "try-runtime")] + fn num_keys() -> u64 { + let prefix = P::name_hash().to_vec(); + crate::storage::KeyPrefixIterator::new(prefix.clone(), prefix, |_| Ok(())).count() as _ + } +} + +impl SteppedMigration for ResetPallet +where + T: Config, + P: PalletInfoAccess + GetStorageVersion, + V: StoreInCodeStorageVersion

, +{ + type Cursor = bool; + type Identifier = [u8; 16]; + + fn id() -> Self::Identifier { + ("RemovePallet::", P::name()).using_encoded(twox_128) + } + + fn step( + cursor: Option, + meter: &mut WeightMeter, + ) -> Result, SteppedMigrationError> { + // we write the storage version in a seperate block + if cursor.unwrap_or(false) { + let required = T::DbWeight::get().writes(1); + meter + .try_consume(required) + .map_err(|_| SteppedMigrationError::InsufficientWeight { required })?; + V::store_in_code_storage_version(); + return Ok(None); + } + + let base_weight = T::WeightInfo::reset_pallet_migration(0); + let weight_per_key = T::WeightInfo::reset_pallet_migration(1).saturating_sub(base_weight); + let key_budget = meter + .remaining() + .saturating_sub(base_weight) + .checked_div_per_component(&weight_per_key) + .unwrap_or_default() + .saturated_into(); + + if key_budget == 0 { + return Err(SteppedMigrationError::InsufficientWeight { + required: T::WeightInfo::reset_pallet_migration(1), + }) + } + + let (keys_removed, is_done) = match clear_prefix(&P::name_hash(), Some(key_budget)) { + KillStorageResult::AllRemoved(value) => (value, true), + KillStorageResult::SomeRemaining(value) => (value, false), + }; + + meter.consume(T::WeightInfo::reset_pallet_migration(keys_removed)); + + Ok(Some(is_done)) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + let num_keys: u64 = Self::num_keys(); + log::info!("ResetPallet<{}>: Trying to remove {num_keys} keys.", P::name()); + Ok(num_keys.encode()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(state: alloc::vec::Vec) -> Result<(), sp_runtime::TryRuntimeError> { + use codec::Decode; + let keys_before = u64::decode(&mut state.as_ref()).expect("We encoded as u64 above; qed"); + let keys_now = Self::num_keys(); + log::info!("ResetPallet<{}>: Keys remaining after migration: {keys_now}", P::name()); + + if keys_before <= keys_now { + log::error!("ResetPallet<{}>: Did not remove any keys.", P::name()); + Err("ResetPallet failed")?; + } + + if keys_now != 1 { + log::error!("ResetPallet<{}>: Should have a single key after reset", P::name()); + Err("ResetPallet failed")?; + } + + Ok(()) + } +} diff --git a/substrate/frame/migrations/src/weights.rs b/substrate/frame/migrations/src/weights.rs index 49ae379dba02..10dfd82cbd81 100644 --- a/substrate/frame/migrations/src/weights.rs +++ b/substrate/frame/migrations/src/weights.rs @@ -18,36 +18,38 @@ //! Autogenerated weights for `pallet_migrations` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-11-08, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-01-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `runner-wiukf8gn-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: `1024` +//! HOSTNAME: `17938671047b`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: -// ./target/production/substrate-node +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=dev +// --extrinsic=* +// --runtime=target/production/wbuild/kitchensink-runtime/kitchensink_runtime.wasm +// --pallet=pallet_migrations +// --header=/__w/polkadot-sdk/polkadot-sdk/substrate/HEADER-APACHE2 +// --output=/__w/polkadot-sdk/polkadot-sdk/substrate/frame/migrations/src/weights.rs +// --wasm-execution=compiled // --steps=50 // --repeat=20 -// --pallet=pallet_migrations +// --heap-pages=4096 +// --template=substrate/.maintain/frame-weight-template.hbs // --no-storage-info -// --no-median-slopes // --no-min-squares -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./substrate/frame/migrations/src/weights.rs -// --header=./substrate/HEADER-APACHE2 -// --template=./substrate/.maintain/frame-weight-template.hbs +// --no-median-slopes +// --genesis-builder-policy=none +// --exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic,pallet_nomination_pools,pallet_remark,pallet_transaction_storage #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use core::marker::PhantomData; +use frame::weights_prelude::*; /// Weight functions needed for `pallet_migrations`. pub trait WeightInfo { @@ -63,6 +65,7 @@ pub trait WeightInfo { fn force_set_active_cursor() -> Weight; fn force_onboard_mbms() -> Weight; fn clear_historic(n: u32, ) -> Weight; + fn reset_pallet_migration(n: u32, ) -> Weight; } /// Weights for `pallet_migrations` using the Substrate node and recommended hardware. @@ -74,10 +77,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn onboard_new_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `309` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 9_520_000 picoseconds. - Weight::from_parts(9_934_000, 67035) + // Minimum execution time: 4_422_000 picoseconds. + Weight::from_parts(4_560_000, 67035) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -85,10 +88,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn progress_mbms_none() -> Weight { // Proof Size summary in bytes: - // Measured: `142` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 2_993_000 picoseconds. - Weight::from_parts(3_088_000, 67035) + // Minimum execution time: 678_000 picoseconds. + Weight::from_parts(751_000, 67035) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -97,10 +100,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_completed() -> Weight { // Proof Size summary in bytes: - // Measured: `167` - // Estimated: `3632` - // Minimum execution time: 7_042_000 picoseconds. - Weight::from_parts(7_272_000, 3632) + // Measured: `0` + // Estimated: `3465` + // Minimum execution time: 3_791_000 picoseconds. + Weight::from_parts(3_930_000, 3465) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -110,10 +113,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_skipped_historic() -> Weight { // Proof Size summary in bytes: - // Measured: `363` - // Estimated: `3828` - // Minimum execution time: 16_522_000 picoseconds. - Weight::from_parts(17_082_000, 3828) + // Measured: `34` + // Estimated: `3731` + // Minimum execution time: 7_375_000 picoseconds. + Weight::from_parts(7_630_000, 3731) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -122,10 +125,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_advance() -> Weight { // Proof Size summary in bytes: - // Measured: `309` - // Estimated: `3774` - // Minimum execution time: 12_445_000 picoseconds. - Weight::from_parts(12_797_000, 3774) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 6_771_000 picoseconds. + Weight::from_parts(6_894_000, 3731) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -134,10 +137,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_complete() -> Weight { // Proof Size summary in bytes: - // Measured: `309` - // Estimated: `3774` - // Minimum execution time: 14_057_000 picoseconds. - Weight::from_parts(14_254_000, 3774) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 8_223_000 picoseconds. + Weight::from_parts(8_406_000, 3731) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -149,10 +152,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_fail() -> Weight { // Proof Size summary in bytes: - // Measured: `309` - // Estimated: `3774` - // Minimum execution time: 14_578_000 picoseconds. - Weight::from_parts(14_825_000, 3774) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 8_907_000 picoseconds. + Weight::from_parts(9_168_000, 3731) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -160,8 +163,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 169_000 picoseconds. - Weight::from_parts(197_000, 0) + // Minimum execution time: 143_000 picoseconds. + Weight::from_parts(174_000, 0) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -169,8 +172,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_634_000 picoseconds. - Weight::from_parts(2_798_000, 0) + // Minimum execution time: 2_172_000 picoseconds. + Weight::from_parts(2_259_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) @@ -179,8 +182,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_069_000 picoseconds. - Weight::from_parts(3_293_000, 0) + // Minimum execution time: 2_600_000 picoseconds. + Weight::from_parts(2_728_000, 0) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) @@ -189,10 +192,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn force_onboard_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `284` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 7_674_000 picoseconds. - Weight::from_parts(8_000_000, 67035) + // Minimum execution time: 2_949_000 picoseconds. + Weight::from_parts(3_106_000, 67035) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `MultiBlockMigrations::Historic` (r:256 w:256) @@ -200,17 +203,32 @@ impl WeightInfo for SubstrateWeight { /// The range of component `n` is `[0, 256]`. fn clear_historic(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1122 + n * (271 ±0)` + // Measured: `960 + n * (271 ±0)` // Estimated: `3834 + n * (2740 ±0)` - // Minimum execution time: 16_937_000 picoseconds. - Weight::from_parts(15_713_121, 3834) - // Standard Error: 2_580 - .saturating_add(Weight::from_parts(1_424_239, 0).saturating_mul(n.into())) + // Minimum execution time: 15_122_000 picoseconds. + Weight::from_parts(27_397_644, 3834) + // Standard Error: 6_050 + .saturating_add(Weight::from_parts(1_454_904, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2740).saturating_mul(n.into())) } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 2048]`. + fn reset_pallet_migration(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1605 + n * (38 ±0)` + // Estimated: `686 + n * (39 ±0)` + // Minimum execution time: 1_128_000 picoseconds. + Weight::from_parts(1_180_000, 686) + // Standard Error: 2_597 + .saturating_add(Weight::from_parts(916_593, 0).saturating_mul(n.into())) + .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(n.into())) + } } // For backwards compatibility and tests. @@ -221,10 +239,10 @@ impl WeightInfo for () { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn onboard_new_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `309` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 9_520_000 picoseconds. - Weight::from_parts(9_934_000, 67035) + // Minimum execution time: 4_422_000 picoseconds. + Weight::from_parts(4_560_000, 67035) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -232,10 +250,10 @@ impl WeightInfo for () { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn progress_mbms_none() -> Weight { // Proof Size summary in bytes: - // Measured: `142` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 2_993_000 picoseconds. - Weight::from_parts(3_088_000, 67035) + // Minimum execution time: 678_000 picoseconds. + Weight::from_parts(751_000, 67035) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -244,10 +262,10 @@ impl WeightInfo for () { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_completed() -> Weight { // Proof Size summary in bytes: - // Measured: `167` - // Estimated: `3632` - // Minimum execution time: 7_042_000 picoseconds. - Weight::from_parts(7_272_000, 3632) + // Measured: `0` + // Estimated: `3465` + // Minimum execution time: 3_791_000 picoseconds. + Weight::from_parts(3_930_000, 3465) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -257,10 +275,10 @@ impl WeightInfo for () { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_skipped_historic() -> Weight { // Proof Size summary in bytes: - // Measured: `363` - // Estimated: `3828` - // Minimum execution time: 16_522_000 picoseconds. - Weight::from_parts(17_082_000, 3828) + // Measured: `34` + // Estimated: `3731` + // Minimum execution time: 7_375_000 picoseconds. + Weight::from_parts(7_630_000, 3731) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -269,10 +287,10 @@ impl WeightInfo for () { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_advance() -> Weight { // Proof Size summary in bytes: - // Measured: `309` - // Estimated: `3774` - // Minimum execution time: 12_445_000 picoseconds. - Weight::from_parts(12_797_000, 3774) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 6_771_000 picoseconds. + Weight::from_parts(6_894_000, 3731) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) @@ -281,10 +299,10 @@ impl WeightInfo for () { /// Proof: `MultiBlockMigrations::Historic` (`max_values`: None, `max_size`: Some(266), added: 2741, mode: `MaxEncodedLen`) fn exec_migration_complete() -> Weight { // Proof Size summary in bytes: - // Measured: `309` - // Estimated: `3774` - // Minimum execution time: 14_057_000 picoseconds. - Weight::from_parts(14_254_000, 3774) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 8_223_000 picoseconds. + Weight::from_parts(8_406_000, 3731) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -296,10 +314,10 @@ impl WeightInfo for () { /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) fn exec_migration_fail() -> Weight { // Proof Size summary in bytes: - // Measured: `309` - // Estimated: `3774` - // Minimum execution time: 14_578_000 picoseconds. - Weight::from_parts(14_825_000, 3774) + // Measured: `0` + // Estimated: `3731` + // Minimum execution time: 8_907_000 picoseconds. + Weight::from_parts(9_168_000, 3731) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -307,8 +325,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 169_000 picoseconds. - Weight::from_parts(197_000, 0) + // Minimum execution time: 143_000 picoseconds. + Weight::from_parts(174_000, 0) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) /// Proof: `MultiBlockMigrations::Cursor` (`max_values`: Some(1), `max_size`: Some(65550), added: 66045, mode: `MaxEncodedLen`) @@ -316,8 +334,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_634_000 picoseconds. - Weight::from_parts(2_798_000, 0) + // Minimum execution time: 2_172_000 picoseconds. + Weight::from_parts(2_259_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `MultiBlockMigrations::Cursor` (r:0 w:1) @@ -326,8 +344,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_069_000 picoseconds. - Weight::from_parts(3_293_000, 0) + // Minimum execution time: 2_600_000 picoseconds. + Weight::from_parts(2_728_000, 0) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `MultiBlockMigrations::Cursor` (r:1 w:0) @@ -336,10 +354,10 @@ impl WeightInfo for () { /// Proof: UNKNOWN KEY `0x583359fe0e84d953a9dd84e8addb08a5` (r:1 w:0) fn force_onboard_mbms() -> Weight { // Proof Size summary in bytes: - // Measured: `284` + // Measured: `0` // Estimated: `67035` - // Minimum execution time: 7_674_000 picoseconds. - Weight::from_parts(8_000_000, 67035) + // Minimum execution time: 2_949_000 picoseconds. + Weight::from_parts(3_106_000, 67035) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `MultiBlockMigrations::Historic` (r:256 w:256) @@ -347,15 +365,30 @@ impl WeightInfo for () { /// The range of component `n` is `[0, 256]`. fn clear_historic(n: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1122 + n * (271 ±0)` + // Measured: `960 + n * (271 ±0)` // Estimated: `3834 + n * (2740 ±0)` - // Minimum execution time: 16_937_000 picoseconds. - Weight::from_parts(15_713_121, 3834) - // Standard Error: 2_580 - .saturating_add(Weight::from_parts(1_424_239, 0).saturating_mul(n.into())) + // Minimum execution time: 15_122_000 picoseconds. + Weight::from_parts(27_397_644, 3834) + // Standard Error: 6_050 + .saturating_add(Weight::from_parts(1_454_904, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) .saturating_add(Weight::from_parts(0, 2740).saturating_mul(n.into())) } + /// Storage: `Skipped::Metadata` (r:0 w:0) + /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// The range of component `n` is `[0, 2048]`. + fn reset_pallet_migration(n: u32, ) -> Weight { + // Proof Size summary in bytes: + // Measured: `1605 + n * (38 ±0)` + // Estimated: `686 + n * (39 ±0)` + // Minimum execution time: 1_128_000 picoseconds. + Weight::from_parts(1_180_000, 686) + // Standard Error: 2_597 + .saturating_add(Weight::from_parts(916_593, 0).saturating_mul(n.into())) + .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) + .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) + .saturating_add(Weight::from_parts(0, 39).saturating_mul(n.into())) + } } diff --git a/substrate/frame/revive/fixtures/contracts/create_storage_and_instantiate.rs b/substrate/frame/revive/fixtures/contracts/create_storage_and_instantiate.rs index 3db5ee1c573e..0ee0bd70db97 100644 --- a/substrate/frame/revive/fixtures/contracts/create_storage_and_instantiate.rs +++ b/substrate/frame/revive/fixtures/contracts/create_storage_and_instantiate.rs @@ -20,7 +20,9 @@ #![no_main] use common::{input, u256_bytes}; -use uapi::{HostFn, HostFnImpl as api}; +use uapi::{HostFn, HostFnImpl as api, StorageFlags}; + +static BUFFER: [u8; 16 * 1024 + 1] = [0u8; 16 * 1024 + 1]; #[no_mangle] #[polkavm_derive::polkavm_export] @@ -35,6 +37,12 @@ pub extern "C" fn call() { deposit_limit: &[u8; 32], ); + let len = u32::from_le_bytes(input.try_into().unwrap()); + let data = &BUFFER[..len as usize]; + let mut key = [0u8; 32]; + key[0] = 1; + api::set_storage(StorageFlags::empty(), &key, data); + let value = u256_bytes(10_000u64); let salt = [0u8; 32]; let mut address = [0u8; 20]; diff --git a/substrate/frame/revive/fixtures/contracts/locking_delegate_dependency.rs b/substrate/frame/revive/fixtures/contracts/locking_delegate_dependency.rs deleted file mode 100644 index 6be5d5c72f9a..000000000000 --- a/substrate/frame/revive/fixtures/contracts/locking_delegate_dependency.rs +++ /dev/null @@ -1,77 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! This contract tests the behavior of locking / unlocking delegate_dependencies when delegate -//! calling into a contract. -#![no_std] -#![no_main] - -use common::input; -use uapi::{HostFn, HostFnImpl as api}; - -const ALICE_FALLBACK: [u8; 20] = [1u8; 20]; - -/// Load input data and perform the action specified by the input. -/// If `delegate_call` is true, then delegate call into the contract. -fn load_input(delegate_call: bool) { - input!( - action: u32, - address: &[u8; 20], - code_hash: &[u8; 32], - ); - - match action { - // 1 = Lock delegate dependency - 1 => { - api::lock_delegate_dependency(code_hash); - }, - // 2 = Unlock delegate dependency - 2 => { - api::unlock_delegate_dependency(code_hash); - }, - // 3 = Terminate - 3 => { - api::terminate(&ALICE_FALLBACK); - }, - // Everything else is a noop - _ => {}, - } - - if delegate_call { - api::delegate_call( - uapi::CallFlags::empty(), - address, - u64::MAX, - u64::MAX, - &[u8::MAX; 32], - &[], - None - ).unwrap(); - } -} - -#[no_mangle] -#[polkavm_derive::polkavm_export] -pub extern "C" fn deploy() { - load_input(false); -} - -#[no_mangle] -#[polkavm_derive::polkavm_export] -pub extern "C" fn call() { - load_input(true); -} diff --git a/substrate/frame/revive/fixtures/contracts/self_destruct.rs b/substrate/frame/revive/fixtures/contracts/self_destruct.rs index 053e545deb19..eed7f40ddfed 100644 --- a/substrate/frame/revive/fixtures/contracts/self_destruct.rs +++ b/substrate/frame/revive/fixtures/contracts/self_destruct.rs @@ -25,7 +25,10 @@ const DJANGO_FALLBACK: [u8; 20] = [4u8; 20]; #[no_mangle] #[polkavm_derive::polkavm_export] -pub extern "C" fn deploy() {} +pub extern "C" fn deploy() { + // make sure that the deposit for the immutable data is refunded + api::set_immutable_data(&[1, 2, 3, 4, 5]) +} #[no_mangle] #[polkavm_derive::polkavm_export] diff --git a/substrate/frame/revive/src/benchmarking/mod.rs b/substrate/frame/revive/src/benchmarking/mod.rs index 624fa35570d8..94d8edef7772 100644 --- a/substrate/frame/revive/src/benchmarking/mod.rs +++ b/substrate/frame/revive/src/benchmarking/mod.rs @@ -24,7 +24,7 @@ mod code; use self::{call_builder::CallSetup, code::WasmModule}; use crate::{ evm::runtime::GAS_PRICE, - exec::{Key, MomentOf}, + exec::{Ext, Key, MomentOf}, limits, storage::WriteOutcome, ConversionPrecision, Pallet as Contracts, *, @@ -1073,24 +1073,11 @@ mod benchmarks { } #[benchmark(pov_mode = Measured)] - fn seal_terminate( - n: Linear<0, { limits::DELEGATE_DEPENDENCIES }>, - ) -> Result<(), BenchmarkError> { + fn seal_terminate() -> Result<(), BenchmarkError> { let beneficiary = account::("beneficiary", 0, 0); - let caller = whitelisted_caller(); - T::Currency::set_balance(&caller, caller_funding::()); - let origin = RawOrigin::Signed(caller); - let storage_deposit = default_deposit_limit::(); build_runtime!(runtime, memory: [beneficiary.encode(),]); - (0..n).for_each(|i| { - let new_code = WasmModule::dummy_unique(65 + i); - Contracts::::bare_upload_code(origin.clone().into(), new_code.code, storage_deposit) - .unwrap(); - runtime.ext().lock_delegate_dependency(new_code.hash).unwrap(); - }); - let result; #[block] { @@ -1982,43 +1969,6 @@ mod benchmarks { Ok(()) } - #[benchmark(pov_mode = Measured)] - fn lock_delegate_dependency() -> Result<(), BenchmarkError> { - let code_hash = Contract::::with_index(1, WasmModule::dummy_unique(1), vec![])? - .info()? - .code_hash; - - build_runtime!(runtime, memory: [ code_hash.encode(),]); - - let result; - #[block] - { - result = runtime.bench_lock_delegate_dependency(memory.as_mut_slice(), 0); - } - - assert_ok!(result); - Ok(()) - } - - #[benchmark] - fn unlock_delegate_dependency() -> Result<(), BenchmarkError> { - let code_hash = Contract::::with_index(1, WasmModule::dummy_unique(1), vec![])? - .info()? - .code_hash; - - build_runtime!(runtime, memory: [ code_hash.encode(),]); - runtime.bench_lock_delegate_dependency(memory.as_mut_slice(), 0).unwrap(); - - let result; - #[block] - { - result = runtime.bench_unlock_delegate_dependency(memory.as_mut_slice(), 0); - } - - assert_ok!(result); - Ok(()) - } - // Benchmark the execution of instructions. #[benchmark(pov_mode = Ignored)] fn instr(r: Linear<0, INSTR_BENCHMARK_RUNS>) { diff --git a/substrate/frame/revive/src/exec.rs b/substrate/frame/revive/src/exec.rs index c3adba45403e..dc91c6f30100 100644 --- a/substrate/frame/revive/src/exec.rs +++ b/substrate/frame/revive/src/exec.rs @@ -32,7 +32,6 @@ use core::{fmt::Debug, marker::PhantomData, mem}; use frame_support::{ crypto::ecdsa::ECDSAExt, dispatch::{DispatchResult, DispatchResultWithPostInfo}, - ensure, storage::{with_transaction, TransactionOutcome}, traits::{ fungible::{Inspect, Mutate}, @@ -49,7 +48,7 @@ use frame_system::{ use sp_core::{ ecdsa::Public as ECDSAPublic, sr25519::{Public as SR25519Public, Signature as SR25519Signature}, - ConstU32, Get, H160, H256, U256, + ConstU32, H160, H256, U256, }; use sp_io::{crypto::secp256k1_ecdsa_recover_compressed, hashing::blake2_256}; use sp_runtime::{ @@ -323,6 +322,12 @@ pub trait Ext: sealing::Sealed { ::AddressMapper::to_address(self.account_id()) } + /// Get the length of the immutable data. + /// + /// This query is free as it does not need to load the immutable data from storage. + /// Useful when we need a constant time lookup of the length. + fn immutable_data_len(&mut self) -> u32; + /// Returns the immutable data of the current contract. /// /// Returns `Err(InvalidImmutableAccess)` if called from a constructor. @@ -409,51 +414,6 @@ pub trait Ext: sealing::Sealed { /// Sets new code hash and immutable data for an existing contract. fn set_code_hash(&mut self, hash: H256) -> DispatchResult; - /// Returns the number of times the specified contract exists on the call stack. Delegated calls - /// Increment the reference count of a of a stored code by one. - /// - /// # Errors - /// - /// [`Error::CodeNotFound`] is returned if no stored code found having the specified - /// `code_hash`. - fn increment_refcount(code_hash: H256) -> DispatchResult; - - /// Decrement the reference count of a stored code by one. - /// - /// # Note - /// - /// A contract whose reference count dropped to zero isn't automatically removed. A - /// `remove_code` transaction must be submitted by the original uploader to do so. - fn decrement_refcount(code_hash: H256); - - /// Adds a delegate dependency to [`ContractInfo`]'s `delegate_dependencies` field. - /// - /// This ensures that the delegated contract is not removed while it is still in use. It - /// increases the reference count of the code hash and charges a fraction (see - /// [`Config::CodeHashLockupDepositPercent`]) of the code deposit. - /// - /// # Errors - /// - /// - [`Error::MaxDelegateDependenciesReached`] - /// - [`Error::CannotAddSelfAsDelegateDependency`] - /// - [`Error::DelegateDependencyAlreadyExists`] - fn lock_delegate_dependency(&mut self, code_hash: H256) -> DispatchResult; - - /// Removes a delegate dependency from [`ContractInfo`]'s `delegate_dependencies` field. - /// - /// This is the counterpart of [`Self::lock_delegate_dependency`]. It decreases the reference - /// count and refunds the deposit that was charged by [`Self::lock_delegate_dependency`]. - /// - /// # Errors - /// - /// - [`Error::DelegateDependencyNotFound`] - fn unlock_delegate_dependency(&mut self, code_hash: &H256) -> DispatchResult; - - /// Returns the number of locked delegate dependencies. - /// - /// Note: Requires &mut self to access the contract info. - fn locked_delegate_dependencies_count(&mut self) -> usize; - /// Check if running in read-only context. fn is_read_only(&self) -> bool; @@ -1064,23 +1024,33 @@ where let value_transferred = frame.value_transferred; let account_id = &frame.account_id.clone(); - // We need to charge the storage deposit before the initial transfer so that - // it can create the account in case the initial transfer is < ed. + // We need to make sure that the contract's account exists before calling its + // constructor. if entry_point == ExportedFunction::Constructor { // Root origin can't be used to instantiate a contract, so it is safe to assume that // if we reached this point the origin has an associated account. let origin = &self.origin.account_id()?; - frame.nested_storage.charge_instantiate( - origin, - &account_id, - frame.contract_info.get(&account_id), - executable.code_info(), - self.skip_transfer, - )?; + let ed = >::min_balance(); + frame.nested_storage.record_charge(&StorageDeposit::Charge(ed)); + if self.skip_transfer { + T::Currency::set_balance(account_id, ed); + } else { + T::Currency::transfer(origin, account_id, ed, Preservation::Preserve)?; + } + + // A consumer is added at account creation and removed it on termination, otherwise + // the runtime could remove the account. As long as a contract exists its + // account must exist. With the consumer, a correct runtime cannot remove the + // account. + >::inc_consumers(account_id)?; + // Needs to be incremented before calling into the code so that it is visible // in case of recursion. >::inc_account_nonce(caller.account_id()?); + + // The incremented refcount should be visible to the constructor. + >::increment_refcount(*executable.code_hash())?; } // Every non delegate call or instantiate also optionally transfers the balance. @@ -1097,6 +1067,7 @@ where let contract_address = T::AddressMapper::to_address(account_id); let maybe_caller_address = caller.account_id().map(T::AddressMapper::to_address); + let code_deposit = executable.code_info().deposit(); if_tracing(|tracer| { tracer.enter_child_span( @@ -1131,6 +1102,15 @@ where let frame = self.top_frame_mut(); + // The deposit we charge for a contract depends on the size of the immutable data. + // Hence we need to delay charging the base deposit after execution. + if entry_point == ExportedFunction::Constructor { + let deposit = frame.contract_info().update_base_deposit(code_deposit); + frame + .nested_storage + .charge_deposit(frame.account_id.clone(), StorageDeposit::Charge(deposit)); + } + // The storage deposit is only charged at the end of every call stack. // To make sure that no sub call uses more than it is allowed to, // the limit is manually enforced here. @@ -1140,13 +1120,6 @@ where .enforce_limit(contract) .map_err(|e| ExecError { error: e, origin: ErrorOrigin::Callee })?; - // It is not allowed to terminate a contract inside its constructor. - if entry_point == ExportedFunction::Constructor && - matches!(frame.contract_info, CachedContract::Terminated) - { - return Err(Error::::TerminatedInConstructor.into()); - } - Ok(output) }; @@ -1534,6 +1507,9 @@ where return Err(Error::::TerminatedWhileReentrant.into()); } let frame = self.top_frame_mut(); + if frame.entry_point == ExportedFunction::Constructor { + return Err(Error::::TerminatedInConstructor.into()); + } let info = frame.terminate(); let beneficiary_account = T::AddressMapper::to_account_id(beneficiary); frame.nested_storage.terminate(&info, beneficiary_account); @@ -1542,14 +1518,7 @@ where let account_address = T::AddressMapper::to_address(&frame.account_id); ContractInfoOf::::remove(&account_address); ImmutableDataOf::::remove(&account_address); - Self::decrement_refcount(info.code_hash); - - for (code_hash, deposit) in info.delegate_dependencies() { - Self::decrement_refcount(*code_hash); - frame - .nested_storage - .charge_deposit(frame.account_id.clone(), StorageDeposit::Refund(*deposit)); - } + >::decrement_refcount(info.code_hash)?; Ok(()) } @@ -1655,6 +1624,10 @@ where self.caller_is_origin() && self.origin == Origin::Root } + fn immutable_data_len(&mut self) -> u32 { + self.top_frame_mut().contract_info().immutable_data_len() + } + fn get_immutable_data(&mut self) -> Result { if self.top_frame().entry_point == ExportedFunction::Constructor { return Err(Error::::InvalidImmutableAccess.into()); @@ -1671,17 +1644,12 @@ where } fn set_immutable_data(&mut self, data: ImmutableData) -> Result<(), DispatchError> { - if self.top_frame().entry_point == ExportedFunction::Call { + let frame = self.top_frame_mut(); + if frame.entry_point == ExportedFunction::Call || data.is_empty() { return Err(Error::::InvalidImmutableAccess.into()); } - - let account_id = self.account_id().clone(); - let len = data.len() as u32; - let amount = self.top_frame_mut().contract_info().set_immutable_data_len(len)?; - self.top_frame_mut().nested_storage.charge_deposit(account_id.clone(), amount); - - >::insert(T::AddressMapper::to_address(&account_id), &data); - + frame.contract_info().set_immutable_data_len(data.len() as u32); + >::insert(T::AddressMapper::to_address(&frame.account_id), &data); Ok(()) } @@ -1806,68 +1774,17 @@ where let code_info = CodeInfoOf::::get(hash).ok_or(Error::::CodeNotFound)?; let old_base_deposit = info.storage_base_deposit(); - let new_base_deposit = info.update_base_deposit(&code_info); + let new_base_deposit = info.update_base_deposit(code_info.deposit()); let deposit = StorageDeposit::Charge(new_base_deposit) .saturating_sub(&StorageDeposit::Charge(old_base_deposit)); frame.nested_storage.charge_deposit(frame.account_id.clone(), deposit); - Self::increment_refcount(hash)?; - Self::decrement_refcount(prev_hash); - Ok(()) - } - - fn increment_refcount(code_hash: H256) -> DispatchResult { - >::mutate(code_hash, |existing| -> Result<(), DispatchError> { - if let Some(info) = existing { - *info.refcount_mut() = info.refcount().saturating_add(1); - Ok(()) - } else { - Err(Error::::CodeNotFound.into()) - } - }) - } - - fn decrement_refcount(code_hash: H256) { - >::mutate(code_hash, |existing| { - if let Some(info) = existing { - *info.refcount_mut() = info.refcount().saturating_sub(1); - } - }); - } - - fn lock_delegate_dependency(&mut self, code_hash: H256) -> DispatchResult { - let frame = self.top_frame_mut(); - let info = frame.contract_info.get(&frame.account_id); - ensure!(code_hash != info.code_hash, Error::::CannotAddSelfAsDelegateDependency); - - let code_info = CodeInfoOf::::get(code_hash).ok_or(Error::::CodeNotFound)?; - let deposit = T::CodeHashLockupDepositPercent::get().mul_ceil(code_info.deposit()); - - info.lock_delegate_dependency(code_hash, deposit)?; - Self::increment_refcount(code_hash)?; - frame - .nested_storage - .charge_deposit(frame.account_id.clone(), StorageDeposit::Charge(deposit)); + >::increment_refcount(hash)?; + >::decrement_refcount(prev_hash)?; Ok(()) } - fn unlock_delegate_dependency(&mut self, code_hash: &H256) -> DispatchResult { - let frame = self.top_frame_mut(); - let info = frame.contract_info.get(&frame.account_id); - - let deposit = info.unlock_delegate_dependency(code_hash)?; - Self::decrement_refcount(*code_hash); - frame - .nested_storage - .charge_deposit(frame.account_id.clone(), StorageDeposit::Refund(deposit)); - Ok(()) - } - - fn locked_delegate_dependencies_count(&mut self) -> usize { - self.top_frame_mut().contract_info().delegate_dependencies_count() - } - fn is_read_only(&self) -> bool { self.top_frame().read_only } @@ -1942,7 +1859,7 @@ mod tests { #[derive(Clone)] struct MockExecutable { func: Rc Fn(MockCtx<'a>, &Self) -> ExecResult + 'static>, - func_type: ExportedFunction, + constructor: Rc Fn(MockCtx<'a>, &Self) -> ExecResult + 'static>, code_hash: H256, code_info: CodeInfo, } @@ -1961,6 +1878,39 @@ mod tests { fn insert( func_type: ExportedFunction, f: impl Fn(MockCtx, &MockExecutable) -> ExecResult + 'static, + ) -> H256 { + Loader::mutate(|loader| { + // Generate code hashes from contract index value. + let hash = H256(keccak_256(&loader.counter.to_le_bytes())); + loader.counter += 1; + if func_type == ExportedFunction::Constructor { + loader.map.insert( + hash, + MockExecutable { + func: Rc::new(|_, _| exec_success()), + constructor: Rc::new(f), + code_hash: hash, + code_info: CodeInfo::::new(ALICE), + }, + ); + } else { + loader.map.insert( + hash, + MockExecutable { + func: Rc::new(f), + constructor: Rc::new(|_, _| exec_success()), + code_hash: hash, + code_info: CodeInfo::::new(ALICE), + }, + ); + } + hash + }) + } + + fn insert_both( + constructor: impl Fn(MockCtx, &MockExecutable) -> ExecResult + 'static, + call: impl Fn(MockCtx, &MockExecutable) -> ExecResult + 'static, ) -> H256 { Loader::mutate(|loader| { // Generate code hashes from contract index value. @@ -1969,8 +1919,8 @@ mod tests { loader.map.insert( hash, MockExecutable { - func: Rc::new(f), - func_type, + func: Rc::new(call), + constructor: Rc::new(constructor), code_hash: hash, code_info: CodeInfo::::new(ALICE), }, @@ -1996,9 +1946,6 @@ mod tests { function: ExportedFunction, input_data: Vec, ) -> ExecResult { - if let Constructor = function { - E::increment_refcount(self.code_hash).unwrap(); - } // # Safety // // We know that we **always** call execute with a `MockStack` in this test. @@ -2009,10 +1956,10 @@ mod tests { // `E: Ext`. However, `MockExecutable` can't be generic over `E` as it would // constitute a cycle. let ext = unsafe { mem::transmute(ext) }; - if function == self.func_type { - (self.func)(MockCtx { ext, input_data }, &self) + if function == ExportedFunction::Constructor { + (self.constructor)(MockCtx { ext, input_data }, &self) } else { - exec_success() + (self.func)(MockCtx { ext, input_data }, &self) } } @@ -3166,7 +3113,7 @@ mod tests { #[test] fn termination_from_instantiate_fails() { let terminate_ch = MockLoader::insert(Constructor, |ctx, _| { - ctx.ext.terminate(&ALICE_ADDR).unwrap(); + ctx.ext.terminate(&ALICE_ADDR)?; exec_success() }); @@ -3194,7 +3141,10 @@ mod tests { Some(&[0; 32]), false, ), - Err(Error::::TerminatedInConstructor.into()) + Err(ExecError { + error: Error::::TerminatedInConstructor.into(), + origin: ErrorOrigin::Callee + }) ); assert_eq!(&events(), &[]); @@ -4706,41 +4656,46 @@ mod tests { } #[test] - fn immutable_data_set_works_only_once() { - let dummy_ch = MockLoader::insert(Constructor, move |ctx, _| { - // Calling `set_immutable_data` the first time should work - assert_ok!(ctx.ext.set_immutable_data(vec![0, 1, 2, 3].try_into().unwrap())); - // Calling `set_immutable_data` the second time should error out - assert_eq!( - ctx.ext.set_immutable_data(vec![0, 1, 2, 3].try_into().unwrap()), - Err(Error::::InvalidImmutableAccess.into()) - ); - exec_success() - }); - let instantiator_ch = MockLoader::insert(Call, { + fn immutable_data_set_overrides() { + let hash = MockLoader::insert_both( move |ctx, _| { - let value = ::Currency::minimum_balance().into(); - ctx.ext - .instantiate(Weight::MAX, U256::MAX, dummy_ch, value, vec![], None) - .unwrap(); - + // Calling `set_immutable_data` the first time should work + assert_ok!(ctx.ext.set_immutable_data(vec![0, 1, 2, 3].try_into().unwrap())); + // Calling `set_immutable_data` the second time overrides the original one + assert_ok!(ctx.ext.set_immutable_data(vec![7, 5].try_into().unwrap())); exec_success() - } - }); + }, + move |ctx, _| { + assert_eq!(ctx.ext.get_immutable_data().unwrap().into_inner(), vec![7, 5]); + exec_success() + }, + ); ExtBuilder::default() .with_code_hashes(MockLoader::code_hashes()) .existential_deposit(15) .build() .execute_with(|| { set_balance(&ALICE, 1000); - set_balance(&BOB, 100); - place_contract(&BOB, instantiator_ch); let origin = Origin::from_account_id(ALICE); let mut storage_meter = storage::meter::Meter::new(&origin, 200, 0).unwrap(); + let mut gas_meter = GasMeter::::new(GAS_LIMIT); + + let addr = MockStack::run_instantiate( + ALICE, + MockExecutable::from_storage(hash, &mut gas_meter).unwrap(), + &mut gas_meter, + &mut storage_meter, + U256::zero(), + vec![], + None, + false, + ) + .unwrap() + .0; MockStack::run_call( origin, - BOB_ADDR, + addr, &mut GasMeter::::new(GAS_LIMIT), &mut storage_meter, U256::zero(), diff --git a/substrate/frame/revive/src/lib.rs b/substrate/frame/revive/src/lib.rs index 74b4b12cce18..c54b13c27e90 100644 --- a/substrate/frame/revive/src/lib.rs +++ b/substrate/frame/revive/src/lib.rs @@ -42,7 +42,7 @@ pub mod weights; use crate::{ evm::{runtime::GAS_PRICE, GasEncoder, GenericTransaction}, - exec::{AccountIdOf, ExecError, Executable, Ext, Key, Stack as ExecStack}, + exec::{AccountIdOf, ExecError, Executable, Key, Stack as ExecStack}, gas::GasMeter, storage::{meter::Meter as StorageMeter, ContractInfo, DeletionQueueManager}, wasm::{CodeInfo, RuntimeCosts, WasmBlob}, @@ -211,9 +211,8 @@ pub mod pallet { type DepositPerItem: Get>; /// The percentage of the storage deposit that should be held for using a code hash. - /// Instantiating a contract, or calling [`chain_extension::Ext::lock_delegate_dependency`] - /// protects the code from being removed. In order to prevent abuse these actions are - /// protected with a percentage of the code deposit. + /// Instantiating a contract, protects the code from being removed. In order to prevent + /// abuse these actions are protected with a percentage of the code deposit. #[pallet::constant] type CodeHashLockupDepositPercent: Get; @@ -493,6 +492,8 @@ pub mod pallet { AccountAlreadyMapped, /// The transaction used to dry-run a contract is invalid. InvalidGenericTransaction, + /// The refcount of a code either over or underflowed. + RefcountOverOrUnderflow, } /// A reason for the pallet contracts placing a hold on funds. @@ -908,8 +909,8 @@ pub mod pallet { } else { return Err(>::ContractNotFound.into()); }; - >>::increment_refcount(code_hash)?; - >>::decrement_refcount(contract.code_hash); + >::increment_refcount(code_hash)?; + >::decrement_refcount(contract.code_hash)?; contract.code_hash = code_hash; Ok(()) }) diff --git a/substrate/frame/revive/src/limits.rs b/substrate/frame/revive/src/limits.rs index 61932575a4c1..a4060cf6cc91 100644 --- a/substrate/frame/revive/src/limits.rs +++ b/substrate/frame/revive/src/limits.rs @@ -43,9 +43,6 @@ pub const CALL_STACK_DEPTH: u32 = 5; /// We set it to the same limit that ethereum has. It is unlikely to change. pub const NUM_EVENT_TOPICS: u32 = 4; -/// The maximum number of code hashes a contract can lock. -pub const DELEGATE_DEPENDENCIES: u32 = 32; - /// Maximum size of events (including topics) and storage values. pub const PAYLOAD_BYTES: u32 = 416; diff --git a/substrate/frame/revive/src/storage.rs b/substrate/frame/revive/src/storage.rs index b7156588d44c..a761223aadfd 100644 --- a/substrate/frame/revive/src/storage.rs +++ b/substrate/frame/revive/src/storage.rs @@ -22,11 +22,10 @@ pub mod meter; use crate::{ address::AddressMapper, exec::{AccountIdOf, Key}, - limits, storage::meter::Diff, weights::WeightInfo, - BalanceOf, CodeInfo, Config, ContractInfoOf, DeletionQueue, DeletionQueueCounter, Error, - StorageDeposit, TrieId, SENTINEL, + BalanceOf, Config, ContractInfoOf, DeletionQueue, DeletionQueueCounter, Error, TrieId, + SENTINEL, }; use alloc::vec::Vec; use codec::{Decode, Encode, MaxEncodedLen}; @@ -36,18 +35,14 @@ use frame_support::{ weights::{Weight, WeightMeter}, CloneNoBound, DefaultNoBound, }; -use meter::DepositOf; use scale_info::TypeInfo; -use sp_core::{ConstU32, Get, H160}; +use sp_core::{Get, H160}; use sp_io::KillStorageResult; use sp_runtime::{ traits::{Hash, Saturating, Zero}, - BoundedBTreeMap, DispatchError, DispatchResult, RuntimeDebug, + DispatchError, RuntimeDebug, }; -type DelegateDependencyMap = - BoundedBTreeMap, ConstU32<{ limits::DELEGATE_DEPENDENCIES }>>; - /// Information for managing an account and its sub trie abstraction. /// This is the required info to cache for an account. #[derive(Encode, Decode, CloneNoBound, PartialEq, Eq, RuntimeDebug, TypeInfo, MaxEncodedLen)] @@ -70,12 +65,6 @@ pub struct ContractInfo { /// We need to store this information separately so it is not used when calculating any refunds /// since the base deposit can only ever be refunded on contract termination. storage_base_deposit: BalanceOf, - /// Map of code hashes and deposit balances. - /// - /// Tracks the code hash and deposit held for locking delegate dependencies. Dependencies added - /// to the map can not be removed from the chain state and can be safely used for delegate - /// calls. - delegate_dependencies: DelegateDependencyMap, /// The size of the immutable data of this contract. immutable_data_len: u32, } @@ -110,18 +99,12 @@ impl ContractInfo { storage_byte_deposit: Zero::zero(), storage_item_deposit: Zero::zero(), storage_base_deposit: Zero::zero(), - delegate_dependencies: Default::default(), immutable_data_len: 0, }; Ok(contract) } - /// Returns the number of locked delegate dependencies. - pub fn delegate_dependencies_count(&self) -> usize { - self.delegate_dependencies.len() - } - /// Associated child trie unique id is built from the hash part of the trie id. pub fn child_trie_info(&self) -> ChildInfo { ChildInfo::new_default(self.trie_id.as_ref()) @@ -240,58 +223,27 @@ impl ContractInfo { /// Sets and returns the contract base deposit. /// /// The base deposit is updated when the `code_hash` of the contract changes, as it depends on - /// the deposit paid to upload the contract's code. - pub fn update_base_deposit(&mut self, code_info: &CodeInfo) -> BalanceOf { - let info_deposit = - Diff { bytes_added: self.encoded_size() as u32, items_added: 1, ..Default::default() } - .update_contract::(None) - .charge_or_zero(); + /// the deposit paid to upload the contract's code. It also depends on the size of immutable + /// storage which is also changed when the code hash of a contract is changed. + pub fn update_base_deposit(&mut self, code_deposit: BalanceOf) -> BalanceOf { + let contract_deposit = Diff { + bytes_added: (self.encoded_size() as u32).saturating_add(self.immutable_data_len), + items_added: if self.immutable_data_len == 0 { 1 } else { 2 }, + ..Default::default() + } + .update_contract::(None) + .charge_or_zero(); // Instantiating the contract prevents its code to be deleted, therefore the base deposit // includes a fraction (`T::CodeHashLockupDepositPercent`) of the original storage deposit // to prevent abuse. - let upload_deposit = T::CodeHashLockupDepositPercent::get().mul_ceil(code_info.deposit()); + let code_deposit = T::CodeHashLockupDepositPercent::get().mul_ceil(code_deposit); - let deposit = info_deposit.saturating_add(upload_deposit); + let deposit = contract_deposit.saturating_add(code_deposit); self.storage_base_deposit = deposit; deposit } - /// Adds a new delegate dependency to the contract. - /// The `amount` is the amount of funds that will be reserved for the dependency. - /// - /// Returns an error if the maximum number of delegate_dependencies is reached or if - /// the delegate dependency already exists. - pub fn lock_delegate_dependency( - &mut self, - code_hash: sp_core::H256, - amount: BalanceOf, - ) -> DispatchResult { - self.delegate_dependencies - .try_insert(code_hash, amount) - .map_err(|_| Error::::MaxDelegateDependenciesReached)? - .map_or(Ok(()), |_| Err(Error::::DelegateDependencyAlreadyExists)) - .map_err(Into::into) - } - - /// Removes the delegate dependency from the contract and returns the deposit held for this - /// dependency. - /// - /// Returns an error if the entry doesn't exist. - pub fn unlock_delegate_dependency( - &mut self, - code_hash: &sp_core::H256, - ) -> Result, DispatchError> { - self.delegate_dependencies - .remove(code_hash) - .ok_or(Error::::DelegateDependencyNotFound.into()) - } - - /// Returns the delegate_dependencies of the contract. - pub fn delegate_dependencies(&self) -> &DelegateDependencyMap { - &self.delegate_dependencies - } - /// Push a contract's trie to the deletion queue for lazy removal. /// /// You must make sure that the contract is also removed when queuing the trie for deletion. @@ -367,27 +319,8 @@ impl ContractInfo { } /// Set the number of immutable bytes of this contract. - /// - /// On success, returns the storage deposit to be charged. - /// - /// Returns `Err(InvalidImmutableAccess)` if: - /// - The immutable bytes of this contract are not 0. This indicates that the immutable data - /// have already been set; it is only valid to set the immutable data exactly once. - /// - The provided `immutable_data_len` value was 0; it is invalid to set empty immutable data. - pub fn set_immutable_data_len( - &mut self, - immutable_data_len: u32, - ) -> Result, DispatchError> { - if self.immutable_data_len != 0 || immutable_data_len == 0 { - return Err(Error::::InvalidImmutableAccess.into()); - } - + pub fn set_immutable_data_len(&mut self, immutable_data_len: u32) { self.immutable_data_len = immutable_data_len; - - let amount = T::DepositPerByte::get() - .saturating_mul(immutable_data_len.into()) - .saturating_add(T::DepositPerItem::get()); - Ok(StorageDeposit::Charge(amount)) } } diff --git a/substrate/frame/revive/src/storage/meter.rs b/substrate/frame/revive/src/storage/meter.rs index cd390c86f63a..ddd4a3bae87f 100644 --- a/substrate/frame/revive/src/storage/meter.rs +++ b/substrate/frame/revive/src/storage/meter.rs @@ -18,8 +18,8 @@ //! This module contains functions to meter the storage deposit. use crate::{ - storage::ContractInfo, AccountIdOf, BalanceOf, CodeInfo, Config, Error, HoldReason, Inspect, - Origin, Pallet, StorageDeposit as Deposit, System, LOG_TARGET, + storage::ContractInfo, AccountIdOf, BalanceOf, Config, Error, HoldReason, Inspect, Origin, + StorageDeposit as Deposit, System, LOG_TARGET, }; use alloc::vec::Vec; use core::{fmt::Debug, marker::PhantomData}; @@ -404,49 +404,26 @@ impl> RawMeter { }; } - /// Adds a deposit charge. + /// Adds a charge without recording it in the contract info. /// /// Use this method instead of [`Self::charge`] when the charge is not the result of a storage - /// change. This is the case when a `delegate_dependency` is added or removed, or when the - /// `code_hash` is updated. [`Self::charge`] cannot be used here because we keep track of the - /// deposit charge separately from the storage charge. + /// change within the contract's child trie. This is the case when when the `code_hash` is + /// updated. [`Self::charge`] cannot be used here because we keep track of the deposit charge + /// separately from the storage charge. + /// + /// If this functions is used the amount of the charge has to be stored by the caller somewhere + /// alese in order to be able to refund it. pub fn charge_deposit(&mut self, contract: T::AccountId, amount: DepositOf) { - self.total_deposit = self.total_deposit.saturating_add(&amount); + self.record_charge(&amount); self.charges.push(Charge { contract, amount, state: ContractState::Alive }); } - /// Charges from `origin` a storage deposit for contract instantiation. + /// Record a charge that has taken place externally. /// - /// This immediately transfers the balance in order to create the account. - pub fn charge_instantiate( - &mut self, - origin: &T::AccountId, - contract: &T::AccountId, - contract_info: &mut ContractInfo, - code_info: &CodeInfo, - skip_transfer: bool, - ) -> Result<(), DispatchError> { - debug_assert!(matches!(self.contract_state(), ContractState::Alive)); - - // We need to make sure that the contract's account exists. - let ed = Pallet::::min_balance(); - self.total_deposit = Deposit::Charge(ed); - if skip_transfer { - T::Currency::set_balance(contract, ed); - } else { - T::Currency::transfer(origin, contract, ed, Preservation::Preserve)?; - } - - // A consumer is added at account creation and removed it on termination, otherwise the - // runtime could remove the account. As long as a contract exists its account must exist. - // With the consumer, a correct runtime cannot remove the account. - System::::inc_consumers(contract)?; - - let deposit = contract_info.update_base_deposit(&code_info); - let deposit = Deposit::Charge(deposit); - - self.charge_deposit(contract.clone(), deposit); - Ok(()) + /// This will not perform a charge. It just records it to reflect it in the + /// total amount of storage required for a transaction. + pub fn record_charge(&mut self, amount: &DepositOf) { + self.total_deposit = self.total_deposit.saturating_add(&amount); } /// Call to tell the meter that the currently executing contract was terminated. @@ -660,7 +637,6 @@ mod tests { storage_byte_deposit: info.bytes_deposit, storage_item_deposit: info.items_deposit, storage_base_deposit: Default::default(), - delegate_dependencies: Default::default(), immutable_data_len: info.immutable_data_len, } } diff --git a/substrate/frame/revive/src/tests.rs b/substrate/frame/revive/src/tests.rs index 366a378cfd11..adbbb752be6e 100644 --- a/substrate/frame/revive/src/tests.rs +++ b/substrate/frame/revive/src/tests.rs @@ -28,7 +28,6 @@ use crate::{ evm::{runtime::GAS_PRICE, CallTrace, CallTracer, CallType, GenericTransaction}, exec::Key, limits, - primitives::CodeUploadReturnValue, storage::DeletionQueueManager, test_utils::*, tests::test_utils::{get_contract, get_contract_checked}, @@ -57,7 +56,7 @@ use frame_support::{ weights::{constants::WEIGHT_REF_TIME_PER_SECOND, FixedFee, IdentityFee, Weight, WeightMeter}, }; use frame_system::{EventRecord, Phase}; -use pallet_revive_fixtures::{bench::dummy_unique, compile_module}; +use pallet_revive_fixtures::compile_module; use pallet_revive_uapi::ReturnErrorCode as RuntimeReturnCode; use pallet_transaction_payment::{ConstFeeMultiplier, Multiplier}; use pretty_assertions::{assert_eq, assert_ne}; @@ -100,7 +99,7 @@ macro_rules! assert_refcount { } pub mod test_utils { - use super::{Contracts, DepositPerByte, DepositPerItem, Test}; + use super::{CodeHashLockupDepositPercent, Contracts, DepositPerByte, DepositPerItem, Test}; use crate::{ address::AddressMapper, exec::AccountIdOf, BalanceOf, CodeInfo, CodeInfoOf, Config, ContractInfo, ContractInfoOf, PristineCode, @@ -138,20 +137,26 @@ pub mod test_utils { pub fn get_code_deposit(code_hash: &sp_core::H256) -> BalanceOf { crate::CodeInfoOf::::get(code_hash).unwrap().deposit() } - pub fn contract_info_storage_deposit(addr: &H160) -> BalanceOf { + pub fn lockup_deposit(code_hash: &sp_core::H256) -> BalanceOf { + CodeHashLockupDepositPercent::get().mul_ceil(get_code_deposit(code_hash)).into() + } + pub fn contract_base_deposit(addr: &H160) -> BalanceOf { let contract_info = self::get_contract(&addr); let info_size = contract_info.encoded_size() as u64; - let info_deposit = DepositPerByte::get() + let code_deposit = CodeHashLockupDepositPercent::get() + .mul_ceil(get_code_deposit(&contract_info.code_hash)); + let deposit = DepositPerByte::get() .saturating_mul(info_size) - .saturating_add(DepositPerItem::get()); + .saturating_add(DepositPerItem::get()) + .saturating_add(code_deposit); let immutable_size = contract_info.immutable_data_len() as u64; if immutable_size > 0 { let immutable_deposit = DepositPerByte::get() .saturating_mul(immutable_size) .saturating_add(DepositPerItem::get()); - info_deposit.saturating_add(immutable_deposit) + deposit.saturating_add(immutable_deposit) } else { - info_deposit + deposit } } pub fn expected_deposit(code_len: usize) -> u64 { @@ -435,7 +440,7 @@ impl pallet_dummy::Config for Test {} parameter_types! { pub static DepositPerByte: BalanceOf = 1; pub const DepositPerItem: BalanceOf = 2; - pub static CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(0); + pub const CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(30); pub static ChainId: u64 = 448; } @@ -1197,7 +1202,7 @@ fn transfer_expendable_cannot_kill_account() { assert_eq!( test_utils::get_balance_on_hold(&HoldReason::StorageDepositReserve.into(), &account), - test_utils::contract_info_storage_deposit(&addr) + test_utils::contract_base_deposit(&addr) ); // Some or the total balance is held, so it can't be transferred. @@ -1239,7 +1244,7 @@ fn cannot_self_destruct_through_draining() { // Make sure the account wasn't remove by sending all free balance away. assert_eq!( ::Currency::total_balance(&account), - value + test_utils::contract_info_storage_deposit(&addr) + min_balance, + value + test_utils::contract_base_deposit(&addr) + min_balance, ); }); } @@ -1253,7 +1258,7 @@ fn cannot_self_destruct_through_storage_refund_after_price_change() { // Instantiate the BOB contract. let contract = builder::bare_instantiate(Code::Upload(wasm)).build_and_unwrap_contract(); - let info_deposit = test_utils::contract_info_storage_deposit(&contract.addr); + let info_deposit = test_utils::contract_base_deposit(&contract.addr); // Check that the contract has been instantiated and has the minimum balance assert_eq!(get_contract(&contract.addr).total_deposit(), info_deposit); @@ -2594,7 +2599,7 @@ fn instantiate_with_zero_balance_works() { assert_eq!(::Currency::free_balance(&account_id), min_balance); assert_eq!( ::Currency::total_balance(&account_id), - min_balance + test_utils::contract_info_storage_deposit(&addr) + min_balance + test_utils::contract_base_deposit(&addr) ); assert_eq!( @@ -2651,7 +2656,7 @@ fn instantiate_with_below_existential_deposit_works() { assert_eq!(::Currency::free_balance(&account_id), min_balance + value); assert_eq!( ::Currency::total_balance(&account_id), - min_balance + value + test_utils::contract_info_storage_deposit(&addr) + min_balance + value + test_utils::contract_base_deposit(&addr) ); assert_eq!( @@ -2704,7 +2709,7 @@ fn storage_deposit_works() { let Contract { addr, account_id } = builder::bare_instantiate(Code::Upload(wasm)).build_and_unwrap_contract(); - let mut deposit = test_utils::contract_info_storage_deposit(&addr); + let mut deposit = test_utils::contract_base_deposit(&addr); // Drop previous events initialize_block(2); @@ -2766,7 +2771,7 @@ fn storage_deposit_callee_works() { assert_eq!(test_utils::get_balance(&account_id), min_balance); assert_eq!( callee.total_deposit(), - deposit + test_utils::contract_info_storage_deposit(&addr_callee) + deposit + test_utils::contract_base_deposit(&addr_callee) ); }); } @@ -2850,7 +2855,7 @@ fn slash_cannot_kill_account() { // Drop previous events initialize_block(2); - let info_deposit = test_utils::contract_info_storage_deposit(&addr); + let info_deposit = test_utils::contract_base_deposit(&addr); assert_eq!( test_utils::get_balance_on_hold(&HoldReason::StorageDepositReserve.into(), &account_id), @@ -2989,7 +2994,7 @@ fn storage_deposit_limit_is_enforced() { let Contract { addr, account_id } = builder::bare_instantiate(Code::Upload(wasm)).build_and_unwrap_contract(); - let info_deposit = test_utils::contract_info_storage_deposit(&addr); + let info_deposit = test_utils::contract_base_deposit(&addr); // Check that the BOB contract has been instantiated and has the minimum balance assert_eq!(get_contract(&addr).total_deposit(), info_deposit); assert_eq!( @@ -3135,73 +3140,82 @@ fn deposit_limit_in_nested_instantiate() { .data(vec![0, 0, 0, 0]) .build_and_unwrap_contract(); - let callee_info_len = ContractInfoOf::::get(&addr).unwrap().encoded_size() as u64; - - // We don't set a special deposit limit for the nested instantiation. + // This is the deposit we expect to be charged just for instantiatiting the callee. // - // The deposit limit set for the parent is insufficient for the instantiation, which - // requires: - // - callee_info_len + 2 for storing the new contract info, - // - ED for deployed contract account, + // - callee_info_len + 2 for storing the new contract info + // - the deposit for depending on a code hash + // - ED for deployed contract account // - 2 for the storage item of 0 bytes being created in the callee constructor - // or (callee_info_len + 2 + ED + 2) Balance in total. + let callee_min_deposit = { + let callee_info_len = ContractInfoOf::::get(&addr).unwrap().encoded_size() as u64; + let code_deposit = test_utils::lockup_deposit(&code_hash_callee); + callee_info_len + code_deposit + 2 + ED + 2 + }; + + // The parent just stores an item of the passed size so at least + // we need to pay for the item itself. + let caller_min_deposit = callee_min_deposit + 2; + + // Fail in callee. // - // Provided the limit is set to be 1 Balance less, - // this call should fail on the return from the caller contract. + // We still fail in the sub call because we enforce limits on return from a contract. + // Sub calls return first to they are checked first. let ret = builder::bare_call(addr_caller) .origin(RuntimeOrigin::signed(BOB)) - .storage_deposit_limit(DepositLimit::Balance(callee_info_len + 2 + ED + 1)) - .data((&code_hash_callee, 0u32, &U256::MAX.to_little_endian()).encode()) + .storage_deposit_limit(DepositLimit::Balance(0)) + .data((&code_hash_callee, 100u32, &U256::MAX.to_little_endian()).encode()) .build_and_unwrap_result(); assert_return_code!(ret, RuntimeReturnCode::OutOfResources); // The charges made on instantiation should be rolled back. assert_eq!(::Currency::free_balance(&BOB), 1_000_000); - // Now we give enough limit for the instantiation itself, but require for 1 more storage - // byte in the constructor. Hence +1 Balance to the limit is needed. This should fail on - // the return from constructor. + // Fail in the caller. + // + // For that we need to supply enough storage deposit so that the sub call + // succeeds but the parent call runs out of storage. let ret = builder::bare_call(addr_caller) .origin(RuntimeOrigin::signed(BOB)) - .storage_deposit_limit(DepositLimit::Balance(callee_info_len + 2 + ED + 2)) - .data((&code_hash_callee, 1u32, U256::from(0u64)).encode()) - .build_and_unwrap_result(); - assert_return_code!(ret, RuntimeReturnCode::OutOfResources); + .storage_deposit_limit(DepositLimit::Balance(callee_min_deposit)) + .data((&code_hash_callee, 0u32, &U256::MAX.to_little_endian()).encode()) + .build(); + assert_err!(ret.result, >::StorageDepositLimitExhausted); // The charges made on the instantiation should be rolled back. assert_eq!(::Currency::free_balance(&BOB), 1_000_000); - // Now we set enough limit in parent call, but an insufficient limit for child - // instantiate. This should fail during the charging for the instantiation in - // `RawMeter::charge_instantiate()` + // Fail in the callee with bytes. + // + // Same as above but stores one byte in both caller and callee. let ret = builder::bare_call(addr_caller) .origin(RuntimeOrigin::signed(BOB)) - .storage_deposit_limit(DepositLimit::Balance(callee_info_len + 2 + ED + 2)) - .data((&code_hash_callee, 1u32, U256::from(callee_info_len + 2 + ED + 1)).encode()) + .storage_deposit_limit(DepositLimit::Balance(caller_min_deposit + 1)) + .data((&code_hash_callee, 1u32, U256::from(callee_min_deposit)).encode()) .build_and_unwrap_result(); assert_return_code!(ret, RuntimeReturnCode::OutOfResources); // The charges made on the instantiation should be rolled back. assert_eq!(::Currency::free_balance(&BOB), 1_000_000); - // Same as above but requires for single added storage - // item of 1 byte to be covered by the limit, which implies 3 more Balance. - // Now we set enough limit for the parent call, but insufficient limit for child - // instantiate. This should fail right after the constructor execution. + // Fail in the caller with bytes. + // + // Same as above but stores one byte in both caller and callee. let ret = builder::bare_call(addr_caller) .origin(RuntimeOrigin::signed(BOB)) - .storage_deposit_limit(DepositLimit::Balance(callee_info_len + 2 + ED + 3)) // enough parent limit - .data((&code_hash_callee, 1u32, U256::from(callee_info_len + 2 + ED + 2)).encode()) - .build_and_unwrap_result(); - assert_return_code!(ret, RuntimeReturnCode::OutOfResources); + .storage_deposit_limit(DepositLimit::Balance(callee_min_deposit + 1)) + .data((&code_hash_callee, 1u32, U256::from(callee_min_deposit + 1)).encode()) + .build(); + assert_err!(ret.result, >::StorageDepositLimitExhausted); // The charges made on the instantiation should be rolled back. assert_eq!(::Currency::free_balance(&BOB), 1_000_000); // Set enough deposit limit for the child instantiate. This should succeed. let result = builder::bare_call(addr_caller) .origin(RuntimeOrigin::signed(BOB)) - .storage_deposit_limit((callee_info_len + 2 + ED + 4 + 2).into()) - .data((&code_hash_callee, 1u32, U256::from(callee_info_len + 2 + ED + 3 + 2)).encode()) + .storage_deposit_limit((caller_min_deposit + 2).into()) + .data((&code_hash_callee, 1u32, U256::from(callee_min_deposit + 1)).encode()) .build(); let returned = result.result.unwrap(); + assert!(!returned.did_revert()); + // All balance of the caller except ED has been transferred to the callee. // No deposit has been taken from it. assert_eq!(::Currency::free_balance(&caller_id), ED); @@ -3211,17 +3225,12 @@ fn deposit_limit_in_nested_instantiate() { // 10_000 should be sent to callee from the caller contract, plus ED to be sent from the // origin. assert_eq!(::Currency::free_balance(&callee_account_id), 10_000 + ED); - // The origin should be charged with: - // - callee instantiation deposit = (callee_info_len + 2) - // - callee account ED - // - for writing an item of 1 byte to storage = 3 Balance - // - Immutable data storage item deposit + // The origin should be charged with what the outer call consumed assert_eq!( ::Currency::free_balance(&BOB), - 1_000_000 - (callee_info_len + 2 + ED + 3) + 1_000_000 - (caller_min_deposit + 2), ); - // Check that deposit due to be charged still includes these 3 Balance - assert_eq!(result.storage_deposit.charge_or_zero(), (callee_info_len + 2 + ED + 3)) + assert_eq!(result.storage_deposit.charge_or_zero(), (caller_min_deposit + 2)) }); } @@ -3238,7 +3247,7 @@ fn deposit_limit_honors_liquidity_restrictions() { let Contract { addr, account_id } = builder::bare_instantiate(Code::Upload(wasm)).build_and_unwrap_contract(); - let info_deposit = test_utils::contract_info_storage_deposit(&addr); + let info_deposit = test_utils::contract_base_deposit(&addr); // Check that the contract has been instantiated and has the minimum balance assert_eq!(get_contract(&addr).total_deposit(), info_deposit); assert_eq!( @@ -3277,7 +3286,7 @@ fn deposit_limit_honors_existential_deposit() { let Contract { addr, account_id } = builder::bare_instantiate(Code::Upload(wasm)).build_and_unwrap_contract(); - let info_deposit = test_utils::contract_info_storage_deposit(&addr); + let info_deposit = test_utils::contract_base_deposit(&addr); // Check that the contract has been instantiated and has the minimum balance assert_eq!(get_contract(&addr).total_deposit(), info_deposit); @@ -3311,7 +3320,7 @@ fn deposit_limit_honors_min_leftover() { let Contract { addr, account_id } = builder::bare_instantiate(Code::Upload(wasm)).build_and_unwrap_contract(); - let info_deposit = test_utils::contract_info_storage_deposit(&addr); + let info_deposit = test_utils::contract_base_deposit(&addr); // Check that the contract has been instantiated and has the minimum balance and the // storage deposit @@ -3338,195 +3347,11 @@ fn deposit_limit_honors_min_leftover() { }); } -#[test] -fn locking_delegate_dependency_works() { - // set hash lock up deposit to 30%, to test deposit calculation. - CODE_HASH_LOCKUP_DEPOSIT_PERCENT.with(|c| *c.borrow_mut() = Perbill::from_percent(30)); - - let (wasm_caller, self_code_hash) = compile_module("locking_delegate_dependency").unwrap(); - let callee_codes: Vec<_> = - (0..limits::DELEGATE_DEPENDENCIES + 1).map(|idx| dummy_unique(idx)).collect(); - let callee_hashes: Vec<_> = callee_codes - .iter() - .map(|c| sp_core::H256(sp_io::hashing::keccak_256(c))) - .collect(); - - let hash2addr = |code_hash: &H256| { - let mut addr = H160::zero(); - addr.as_bytes_mut().copy_from_slice(&code_hash.as_ref()[..20]); - addr - }; - - // Define inputs with various actions to test locking / unlocking delegate_dependencies. - // See the contract for more details. - let noop_input = (0u32, callee_hashes[0]); - let lock_delegate_dependency_input = (1u32, callee_hashes[0]); - let unlock_delegate_dependency_input = (2u32, callee_hashes[0]); - let terminate_input = (3u32, callee_hashes[0]); - - // Instantiate the caller contract with the given input. - let instantiate = |input: &(u32, H256)| { - let (action, code_hash) = input; - builder::bare_instantiate(Code::Upload(wasm_caller.clone())) - .origin(RuntimeOrigin::signed(ALICE_FALLBACK)) - .data((action, hash2addr(code_hash), code_hash).encode()) - .build() - }; - - // Call contract with the given input. - let call = |addr_caller: &H160, input: &(u32, H256)| { - let (action, code_hash) = input; - builder::bare_call(*addr_caller) - .origin(RuntimeOrigin::signed(ALICE_FALLBACK)) - .data((action, hash2addr(code_hash), code_hash).encode()) - .build() - }; - const ED: u64 = 2000; - ExtBuilder::default().existential_deposit(ED).build().execute_with(|| { - let _ = Balances::set_balance(&ALICE_FALLBACK, 1_000_000); - - // Instantiate with lock_delegate_dependency should fail since the code is not yet on - // chain. - assert_err!( - instantiate(&lock_delegate_dependency_input).result, - Error::::CodeNotFound - ); - - // Upload all the delegated codes (they all have the same size) - let mut deposit = Default::default(); - for code in callee_codes.iter() { - let CodeUploadReturnValue { deposit: deposit_per_code, code_hash } = - Contracts::bare_upload_code( - RuntimeOrigin::signed(ALICE_FALLBACK), - code.clone(), - deposit_limit::(), - ) - .unwrap(); - deposit = deposit_per_code; - // Mock contract info by using first 20 bytes of code_hash as address. - let addr = hash2addr(&code_hash); - ContractInfoOf::::set(&addr, ContractInfo::new(&addr, 0, code_hash).ok()); - } - - // Instantiate should now work. - let addr_caller = instantiate(&lock_delegate_dependency_input).result.unwrap().addr; - let caller_account_id = ::AddressMapper::to_account_id(&addr_caller); - - // There should be a dependency and a deposit. - let contract = test_utils::get_contract(&addr_caller); - - let dependency_deposit = &CodeHashLockupDepositPercent::get().mul_ceil(deposit); - assert_eq!( - contract.delegate_dependencies().get(&callee_hashes[0]), - Some(dependency_deposit) - ); - assert_eq!( - test_utils::get_balance_on_hold( - &HoldReason::StorageDepositReserve.into(), - &caller_account_id - ), - dependency_deposit + contract.storage_base_deposit() - ); - - // Removing the code should fail, since we have added a dependency. - assert_err!( - Contracts::remove_code(RuntimeOrigin::signed(ALICE_FALLBACK), callee_hashes[0]), - >::CodeInUse - ); - - // Locking an already existing dependency should fail. - assert_err!( - call(&addr_caller, &lock_delegate_dependency_input).result, - Error::::DelegateDependencyAlreadyExists - ); - - // Locking self should fail. - assert_err!( - builder::bare_call(addr_caller) - .origin(RuntimeOrigin::signed(ALICE_FALLBACK)) - .data((1u32, &addr_caller, self_code_hash).encode()) - .build() - .result, - Error::::CannotAddSelfAsDelegateDependency - ); - - // Locking more than the maximum allowed delegate_dependencies should fail. - for hash in &callee_hashes[1..callee_hashes.len() - 1] { - call(&addr_caller, &(1u32, *hash)).result.unwrap(); - } - assert_err!( - call(&addr_caller, &(1u32, *callee_hashes.last().unwrap())).result, - Error::::MaxDelegateDependenciesReached - ); - - // Unlocking all dependency should work. - for hash in &callee_hashes[..callee_hashes.len() - 1] { - call(&addr_caller, &(2u32, *hash)).result.unwrap(); - } - - // Dependency should be removed, and deposit should be returned. - let contract = test_utils::get_contract(&addr_caller); - assert!(contract.delegate_dependencies().is_empty()); - assert_eq!( - test_utils::get_balance_on_hold( - &HoldReason::StorageDepositReserve.into(), - &caller_account_id - ), - contract.storage_base_deposit() - ); - - // Removing a nonexistent dependency should fail. - assert_err!( - call(&addr_caller, &unlock_delegate_dependency_input).result, - Error::::DelegateDependencyNotFound - ); - - // Locking a dependency with a storage limit too low should fail. - assert_err!( - builder::bare_call(addr_caller) - .storage_deposit_limit((dependency_deposit - 1).into()) - .data((1u32, hash2addr(&callee_hashes[0]), callee_hashes[0]).encode()) - .build() - .result, - Error::::StorageDepositLimitExhausted - ); - - // Since we unlocked the dependency we should now be able to remove the code. - assert_ok!(Contracts::remove_code(RuntimeOrigin::signed(ALICE_FALLBACK), callee_hashes[0])); - - // Calling should fail since the delegated contract is not on chain anymore. - assert_err!(call(&addr_caller, &noop_input).result, Error::::CodeNotFound); - - // Add the dependency back. - Contracts::upload_code( - RuntimeOrigin::signed(ALICE_FALLBACK), - callee_codes[0].clone(), - deposit_limit::(), - ) - .unwrap(); - call(&addr_caller, &lock_delegate_dependency_input).result.unwrap(); - - // Call terminate should work, and return the deposit. - let balance_before = test_utils::get_balance(&ALICE_FALLBACK); - assert_ok!(call(&addr_caller, &terminate_input).result); - assert_eq!( - test_utils::get_balance(&ALICE_FALLBACK), - ED + balance_before + contract.storage_base_deposit() + dependency_deposit - ); - - // Terminate should also remove the dependency, so we can remove the code. - assert_ok!(Contracts::remove_code(RuntimeOrigin::signed(ALICE_FALLBACK), callee_hashes[0])); - }); -} - #[test] fn native_dependency_deposit_works() { let (wasm, code_hash) = compile_module("set_code_hash").unwrap(); let (dummy_wasm, dummy_code_hash) = compile_module("dummy").unwrap(); - // Set hash lock up deposit to 30%, to test deposit calculation. - CODE_HASH_LOCKUP_DEPOSIT_PERCENT.with(|c| *c.borrow_mut() = Perbill::from_percent(30)); - // Test with both existing and uploaded code for code in [Code::Upload(wasm.clone()), Code::Existing(code_hash)] { ExtBuilder::default().build().execute_with(|| { @@ -3560,33 +3385,34 @@ fn native_dependency_deposit_works() { let addr = res.result.unwrap().addr; let account_id = ::AddressMapper::to_account_id(&addr); - let base_deposit = test_utils::contract_info_storage_deposit(&addr); + let base_deposit = test_utils::contract_base_deposit(&addr); let upload_deposit = test_utils::get_code_deposit(&code_hash); let extra_deposit = add_upload_deposit.then(|| upload_deposit).unwrap_or_default(); - // Check initial storage_deposit - // The base deposit should be: contract_info_storage_deposit + 30% * deposit - let deposit = - extra_deposit + base_deposit + lockup_deposit_percent.mul_ceil(upload_deposit); - - assert_eq!(res.storage_deposit.charge_or_zero(), deposit + Contracts::min_balance()); + assert_eq!( + res.storage_deposit.charge_or_zero(), + extra_deposit + base_deposit + Contracts::min_balance() + ); // call set_code_hash builder::bare_call(addr) .data(dummy_code_hash.encode()) .build_and_unwrap_result(); - // Check updated storage_deposit - let code_deposit = test_utils::get_code_deposit(&dummy_code_hash); - let deposit = base_deposit + lockup_deposit_percent.mul_ceil(code_deposit); - assert_eq!(test_utils::get_contract(&addr).storage_base_deposit(), deposit); + // Check updated storage_deposit due to code size changes + let deposit_diff = lockup_deposit_percent + .mul_ceil(test_utils::get_code_deposit(&code_hash)) - + lockup_deposit_percent.mul_ceil(test_utils::get_code_deposit(&dummy_code_hash)); + let new_base_deposit = test_utils::contract_base_deposit(&addr); + assert_ne!(deposit_diff, 0); + assert_eq!(base_deposit - new_base_deposit, deposit_diff); assert_eq!( test_utils::get_balance_on_hold( &HoldReason::StorageDepositReserve.into(), &account_id ), - deposit + new_base_deposit ); }); } @@ -4195,15 +4021,21 @@ fn immutable_data_works() { .data(data.to_vec()) .build_and_unwrap_contract(); + let contract = test_utils::get_contract(&addr); + let account = ::AddressMapper::to_account_id(&addr); + let actual_deposit = + test_utils::get_balance_on_hold(&HoldReason::StorageDepositReserve.into(), &account); + + assert_eq!(contract.immutable_data_len(), data.len() as u32); + // Storing immmutable data charges storage deposit; verify it explicitly. + assert_eq!(actual_deposit, test_utils::contract_base_deposit(&addr)); + + // make sure it is also recorded in the base deposit assert_eq!( - test_utils::get_balance_on_hold( - &HoldReason::StorageDepositReserve.into(), - &::AddressMapper::to_account_id(&addr) - ), - test_utils::contract_info_storage_deposit(&addr) + test_utils::get_balance_on_hold(&HoldReason::StorageDepositReserve.into(), &account), + contract.storage_base_deposit(), ); - assert_eq!(test_utils::get_contract(&addr).immutable_data_len(), data.len() as u32); // Call the contract: Asserts the input to equal the immutable data assert_ok!(builder::call(addr).data(data.to_vec()).build()); diff --git a/substrate/frame/revive/src/wasm/mod.rs b/substrate/frame/revive/src/wasm/mod.rs index 527cf1630954..dc49fae26fda 100644 --- a/substrate/frame/revive/src/wasm/mod.rs +++ b/substrate/frame/revive/src/wasm/mod.rs @@ -214,15 +214,11 @@ impl CodeInfo { } /// Returns reference count of the module. + #[cfg(test)] pub fn refcount(&self) -> u64 { self.refcount } - /// Return mutable reference to the refcount of the module. - pub fn refcount_mut(&mut self) -> &mut u64 { - &mut self.refcount - } - /// Returns the deposit of the module. pub fn deposit(&self) -> BalanceOf { self.deposit @@ -232,6 +228,47 @@ impl CodeInfo { pub fn code_len(&self) -> u64 { self.code_len.into() } + + /// Returns the number of times the specified contract exists on the call stack. Delegated calls + /// Increment the reference count of a stored code by one. + /// + /// # Errors + /// + /// [`Error::CodeNotFound`] is returned if no stored code found having the specified + /// `code_hash`. + pub fn increment_refcount(code_hash: H256) -> DispatchResult { + >::mutate(code_hash, |existing| -> Result<(), DispatchError> { + if let Some(info) = existing { + info.refcount = info + .refcount + .checked_add(1) + .ok_or_else(|| >::RefcountOverOrUnderflow)?; + Ok(()) + } else { + Err(Error::::CodeNotFound.into()) + } + }) + } + + /// Decrement the reference count of a stored code by one. + /// + /// # Note + /// + /// A contract whose reference count dropped to zero isn't automatically removed. A + /// `remove_code` transaction must be submitted by the original uploader to do so. + pub fn decrement_refcount(code_hash: H256) -> DispatchResult { + >::mutate(code_hash, |existing| { + if let Some(info) = existing { + info.refcount = info + .refcount + .checked_sub(1) + .ok_or_else(|| >::RefcountOverOrUnderflow)?; + Ok(()) + } else { + Err(Error::::CodeNotFound.into()) + } + }) + } } pub struct PreparedCall<'a, E: Ext> { @@ -287,15 +324,6 @@ impl WasmBlob { Error::::CodeRejected })?; - // This is checked at deploy time but we also want to reject pre-existing - // 32bit programs. - // TODO: Remove when we reset the test net. - // https://github.com/paritytech/contract-issues/issues/11 - if !module.is_64_bit() { - log::debug!(target: LOG_TARGET, "32bit programs are not supported."); - Err(Error::::CodeRejected)?; - } - let entry_program_counter = module .exports() .find(|export| export.symbol().as_bytes() == entry_point.identifier().as_bytes()) @@ -309,11 +337,6 @@ impl WasmBlob { Error::::CodeRejected })?; - // Increment before execution so that the constructor sees the correct refcount - if let ExportedFunction::Constructor = entry_point { - E::increment_refcount(self.code_hash)?; - } - instance.set_gas(gas_limit_polkavm); instance.prepare_call_untyped(entry_program_counter, &[]); diff --git a/substrate/frame/revive/src/wasm/runtime.rs b/substrate/frame/revive/src/wasm/runtime.rs index ad92e5fecee2..279d72b97ee1 100644 --- a/substrate/frame/revive/src/wasm/runtime.rs +++ b/substrate/frame/revive/src/wasm/runtime.rs @@ -339,8 +339,8 @@ pub enum RuntimeCosts { GasLimit, /// Weight of calling `seal_weight_to_fee`. WeightToFee, - /// Weight of calling `seal_terminate`, passing the number of locked dependencies. - Terminate(u32), + /// Weight of calling `seal_terminate`. + Terminate, /// Weight of calling `seal_deposit_event` with the given number of topics and event size. DepositEvent { num_topic: u32, len: u32 }, /// Weight of calling `seal_set_storage` for the given storage item sizes. @@ -395,10 +395,6 @@ pub enum RuntimeCosts { SetCodeHash, /// Weight of calling `ecdsa_to_eth_address` EcdsaToEthAddress, - /// Weight of calling `lock_delegate_dependency` - LockDelegateDependency, - /// Weight of calling `unlock_delegate_dependency` - UnlockDelegateDependency, /// Weight of calling `get_immutable_dependency` GetImmutableData(u32), /// Weight of calling `set_immutable_dependency` @@ -491,7 +487,7 @@ impl Token for RuntimeCosts { Now => T::WeightInfo::seal_now(), GasLimit => T::WeightInfo::seal_gas_limit(), WeightToFee => T::WeightInfo::seal_weight_to_fee(), - Terminate(locked_dependencies) => T::WeightInfo::seal_terminate(locked_dependencies), + Terminate => T::WeightInfo::seal_terminate(), DepositEvent { num_topic, len } => T::WeightInfo::seal_deposit_event(num_topic, len), SetStorage { new_bytes, old_bytes } => { cost_storage!(write, seal_set_storage, new_bytes, old_bytes) @@ -529,8 +525,6 @@ impl Token for RuntimeCosts { ChainExtension(weight) | CallRuntime(weight) | CallXcmExecute(weight) => weight, SetCodeHash => T::WeightInfo::seal_set_code_hash(), EcdsaToEthAddress => T::WeightInfo::seal_ecdsa_to_eth_address(), - LockDelegateDependency => T::WeightInfo::lock_delegate_dependency(), - UnlockDelegateDependency => T::WeightInfo::unlock_delegate_dependency(), GetImmutableData(len) => T::WeightInfo::seal_get_immutable_data(len), SetImmutableData(len) => T::WeightInfo::seal_set_immutable_data(len), } @@ -1142,15 +1136,6 @@ impl<'a, E: Ext, M: ?Sized + Memory> Runtime<'a, E, M> { Err(err) => Ok(Self::exec_error_into_return_code(err)?), } } - - fn terminate(&mut self, memory: &M, beneficiary_ptr: u32) -> Result<(), TrapReason> { - let count = self.ext.locked_delegate_dependencies_count() as _; - self.charge_gas(RuntimeCosts::Terminate(count))?; - - let beneficiary = memory.read_h160(beneficiary_ptr)?; - self.ext.terminate(&beneficiary)?; - Err(TrapReason::Termination) - } } // This is the API exposed to contracts. @@ -1493,9 +1478,10 @@ pub mod env { out_ptr: u32, out_len_ptr: u32, ) -> Result<(), TrapReason> { - let charged = self.charge_gas(RuntimeCosts::GetImmutableData(limits::IMMUTABLE_BYTES))?; + // quering the length is free as it is stored with the contract metadata + let len = self.ext.immutable_data_len(); + self.charge_gas(RuntimeCosts::GetImmutableData(len))?; let data = self.ext.get_immutable_data()?; - self.adjust_gas(charged, RuntimeCosts::GetImmutableData(data.len() as u32)); self.write_sandbox_output(memory, out_ptr, out_len_ptr, &data, false, already_charged)?; Ok(()) } @@ -1970,20 +1956,6 @@ pub mod env { Ok(self.ext.is_contract(&address) as u32) } - /// Adds a new delegate dependency to the contract. - /// See [`pallet_revive_uapi::HostFn::lock_delegate_dependency`]. - #[mutating] - fn lock_delegate_dependency( - &mut self, - memory: &mut M, - code_hash_ptr: u32, - ) -> Result<(), TrapReason> { - self.charge_gas(RuntimeCosts::LockDelegateDependency)?; - let code_hash = memory.read_h256(code_hash_ptr)?; - self.ext.lock_delegate_dependency(code_hash)?; - Ok(()) - } - /// Stores the minimum balance (a.k.a. existential deposit) into the supplied buffer. /// See [`pallet_revive_uapi::HostFn::minimum_balance`]. fn minimum_balance(&mut self, memory: &mut M, out_ptr: u32) -> Result<(), TrapReason> { @@ -2051,20 +2023,6 @@ pub mod env { } } - /// Removes the delegate dependency from the contract. - /// see [`pallet_revive_uapi::HostFn::unlock_delegate_dependency`]. - #[mutating] - fn unlock_delegate_dependency( - &mut self, - memory: &mut M, - code_hash_ptr: u32, - ) -> Result<(), TrapReason> { - self.charge_gas(RuntimeCosts::UnlockDelegateDependency)?; - let code_hash = memory.read_h256(code_hash_ptr)?; - self.ext.unlock_delegate_dependency(&code_hash)?; - Ok(()) - } - /// Retrieve and remove the value under the given key from storage. /// See [`pallet_revive_uapi::HostFn::take_storage`] #[mutating] @@ -2084,7 +2042,10 @@ pub mod env { /// See [`pallet_revive_uapi::HostFn::terminate`]. #[mutating] fn terminate(&mut self, memory: &mut M, beneficiary_ptr: u32) -> Result<(), TrapReason> { - self.terminate(memory, beneficiary_ptr) + self.charge_gas(RuntimeCosts::Terminate)?; + let beneficiary = memory.read_h160(beneficiary_ptr)?; + self.ext.terminate(&beneficiary)?; + Err(TrapReason::Termination) } /// Stores the amount of weight left into the supplied buffer. diff --git a/substrate/frame/revive/src/weights.rs b/substrate/frame/revive/src/weights.rs index 6fee4995c186..42b8a9e5e722 100644 --- a/substrate/frame/revive/src/weights.rs +++ b/substrate/frame/revive/src/weights.rs @@ -18,9 +18,9 @@ //! Autogenerated weights for `pallet_revive` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2025-01-29, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2025-02-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `eacb3695a76e`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! HOSTNAME: `11670a4f427b`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` //! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: `1024` // Executed Command: @@ -48,6 +48,7 @@ #![allow(unused_parens)] #![allow(unused_imports)] #![allow(missing_docs)] +#[allow(dead_code)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use core::marker::PhantomData; @@ -99,7 +100,7 @@ pub trait WeightInfo { fn seal_call_data_load() -> Weight; fn seal_call_data_copy(n: u32, ) -> Weight; fn seal_return(n: u32, ) -> Weight; - fn seal_terminate(n: u32, ) -> Weight; + fn seal_terminate() -> Weight; fn seal_deposit_event(t: u32, n: u32, ) -> Weight; fn get_storage_empty() -> Weight; fn get_storage_full() -> Weight; @@ -131,8 +132,6 @@ pub trait WeightInfo { fn seal_ecdsa_recover() -> Weight; fn seal_ecdsa_to_eth_address() -> Weight; fn seal_set_code_hash() -> Weight; - fn lock_delegate_dependency() -> Weight; - fn unlock_delegate_dependency() -> Weight; fn instr(r: u32, ) -> Weight; } @@ -145,8 +144,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 690_000 picoseconds. - Weight::from_parts(743_000, 1485) + // Minimum execution time: 695_000 picoseconds. + Weight::from_parts(750_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -156,10 +155,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `230 + k * (69 ±0)` // Estimated: `222 + k * (70 ±0)` - // Minimum execution time: 10_913_000 picoseconds. - Weight::from_parts(11_048_000, 222) - // Standard Error: 972 - .saturating_add(Weight::from_parts(1_172_318, 0).saturating_mul(k.into())) + // Minimum execution time: 10_509_000 picoseconds. + Weight::from_parts(10_896_000, 222) + // Standard Error: 2_549 + .saturating_add(Weight::from_parts(1_264_033, 0).saturating_mul(k.into())) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(T::DbWeight::get().writes(2_u64)) @@ -169,7 +168,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Revive::AddressSuffix` (r:2 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::PristineCode` (r:1 w:0) @@ -179,14 +178,12 @@ impl WeightInfo for SubstrateWeight { /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) /// The range of component `c` is `[0, 262144]`. - fn call_with_code_per_byte(c: u32, ) -> Weight { + fn call_with_code_per_byte(_c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1195` - // Estimated: `7135` - // Minimum execution time: 83_080_000 picoseconds. - Weight::from_parts(89_270_264, 7135) - // Standard Error: 0 - .saturating_add(Weight::from_parts(3, 0).saturating_mul(c.into())) + // Measured: `1194` + // Estimated: `7134` + // Minimum execution time: 84_008_000 picoseconds. + Weight::from_parts(91_138_296, 7134) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -197,7 +194,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Timestamp::Now` (r:1 w:0) /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) /// Storage: `System::Account` (r:1 w:1) @@ -210,10 +207,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `93` // Estimated: `6033` - // Minimum execution time: 171_761_000 picoseconds. - Weight::from_parts(158_031_807, 6033) - // Standard Error: 11 - .saturating_add(Weight::from_parts(4_536, 0).saturating_mul(i.into())) + // Minimum execution time: 172_907_000 picoseconds. + Weight::from_parts(153_592_465, 6033) + // Standard Error: 12 + .saturating_add(Weight::from_parts(4_544, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -224,7 +221,7 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Timestamp::Now` (r:1 w:0) /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) /// Storage: `System::Account` (r:1 w:1) @@ -236,17 +233,17 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `987` // Estimated: `4452` - // Minimum execution time: 143_210_000 picoseconds. - Weight::from_parts(121_908_111, 4452) - // Standard Error: 15 - .saturating_add(Weight::from_parts(4_467, 0).saturating_mul(i.into())) + // Minimum execution time: 143_169_000 picoseconds. + Weight::from_parts(120_653_436, 4452) + // Standard Error: 16 + .saturating_add(Weight::from_parts(4_444, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(4_u64)) } /// Storage: `Revive::AddressSuffix` (r:2 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::PristineCode` (r:1 w:0) @@ -257,10 +254,10 @@ impl WeightInfo for SubstrateWeight { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) fn call() -> Weight { // Proof Size summary in bytes: - // Measured: `1195` - // Estimated: `7135` - // Minimum execution time: 136_689_000 picoseconds. - Weight::from_parts(145_358_000, 7135) + // Measured: `1194` + // Estimated: `7134` + // Minimum execution time: 138_392_000 picoseconds. + Weight::from_parts(143_329_000, 7134) .saturating_add(T::DbWeight::get().reads(7_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -271,14 +268,12 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Revive::PristineCode` (r:0 w:1) /// Proof: `Revive::PristineCode` (`max_values`: None, `max_size`: Some(262180), added: 264655, mode: `Measured`) /// The range of component `c` is `[0, 262144]`. - fn upload_code(c: u32, ) -> Weight { + fn upload_code(_c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 43_351_000 picoseconds. - Weight::from_parts(44_896_319, 3465) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1, 0).saturating_mul(c.into())) + // Minimum execution time: 43_420_000 picoseconds. + Weight::from_parts(45_143_767, 3465) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -292,21 +287,21 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `181` // Estimated: `3646` - // Minimum execution time: 36_034_000 picoseconds. - Weight::from_parts(36_595_000, 3646) + // Minimum execution time: 35_828_000 picoseconds. + Weight::from_parts(36_853_000, 3646) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:2 w:2) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `425` - // Estimated: `6365` - // Minimum execution time: 19_484_000 picoseconds. - Weight::from_parts(20_104_000, 6365) + // Measured: `424` + // Estimated: `6364` + // Minimum execution time: 19_678_000 picoseconds. + Weight::from_parts(21_266_000, 6364) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -318,8 +313,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 37_066_000 picoseconds. - Weight::from_parts(37_646_000, 3465) + // Minimum execution time: 37_024_000 picoseconds. + Weight::from_parts(37_440_000, 3465) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -331,8 +326,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `56` // Estimated: `3521` - // Minimum execution time: 31_604_000 picoseconds. - Weight::from_parts(32_557_000, 3521) + // Minimum execution time: 31_228_000 picoseconds. + Weight::from_parts(32_183_000, 3521) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -344,8 +339,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 6_070_000 picoseconds. - Weight::from_parts(6_246_000, 3465) + // Minimum execution time: 6_241_000 picoseconds. + Weight::from_parts(6_467_000, 3465) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// The range of component `r` is `[0, 1600]`. @@ -353,33 +348,33 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_471_000 picoseconds. - Weight::from_parts(7_724_355, 0) - // Standard Error: 245 - .saturating_add(Weight::from_parts(165_331, 0).saturating_mul(r.into())) + // Minimum execution time: 6_397_000 picoseconds. + Weight::from_parts(7_159_300, 0) + // Standard Error: 173 + .saturating_add(Weight::from_parts(167_265, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 239_000 picoseconds. - Weight::from_parts(278_000, 0) + // Minimum execution time: 267_000 picoseconds. + Weight::from_parts(296_000, 0) } fn seal_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 234_000 picoseconds. - Weight::from_parts(264_000, 0) + // Minimum execution time: 227_000 picoseconds. + Weight::from_parts(252_000, 0) } /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) fn seal_is_contract() -> Weight { // Proof Size summary in bytes: // Measured: `202` // Estimated: `3667` - // Minimum execution time: 6_508_000 picoseconds. - Weight::from_parts(6_715_000, 3667) + // Minimum execution time: 6_591_000 picoseconds. + Weight::from_parts(6_770_000, 3667) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Revive::AddressSuffix` (r:1 w:0) @@ -388,80 +383,80 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3609` - // Minimum execution time: 6_190_000 picoseconds. - Weight::from_parts(6_413_000, 3609) + // Minimum execution time: 6_182_000 picoseconds. + Weight::from_parts(6_372_000, 3609) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) fn seal_code_hash() -> Weight { // Proof Size summary in bytes: - // Measured: `299` - // Estimated: `3764` - // Minimum execution time: 7_547_000 picoseconds. - Weight::from_parts(7_742_000, 3764) + // Measured: `298` + // Estimated: `3763` + // Minimum execution time: 7_327_000 picoseconds. + Weight::from_parts(7_612_000, 3763) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 251_000 picoseconds. - Weight::from_parts(274_000, 0) + // Minimum execution time: 232_000 picoseconds. + Weight::from_parts(287_000, 0) } /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) fn seal_code_size() -> Weight { // Proof Size summary in bytes: - // Measured: `369` - // Estimated: `3834` - // Minimum execution time: 10_825_000 picoseconds. - Weight::from_parts(11_185_000, 3834) + // Measured: `368` + // Estimated: `3833` + // Minimum execution time: 10_918_000 picoseconds. + Weight::from_parts(11_323_000, 3833) .saturating_add(T::DbWeight::get().reads(2_u64)) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 325_000 picoseconds. - Weight::from_parts(352_000, 0) + // Minimum execution time: 310_000 picoseconds. + Weight::from_parts(340_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 245_000 picoseconds. - Weight::from_parts(282_000, 0) + // Minimum execution time: 257_000 picoseconds. + Weight::from_parts(292_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 251_000 picoseconds. - Weight::from_parts(274_000, 0) + // Minimum execution time: 240_000 picoseconds. + Weight::from_parts(249_000, 0) } fn seal_weight_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` // Minimum execution time: 599_000 picoseconds. - Weight::from_parts(675_000, 0) + Weight::from_parts(645_000, 0) } fn seal_ref_time_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 245_000 picoseconds. - Weight::from_parts(263_000, 0) + // Minimum execution time: 208_000 picoseconds. + Weight::from_parts(244_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `102` // Estimated: `0` - // Minimum execution time: 4_613_000 picoseconds. - Weight::from_parts(4_768_000, 0) + // Minimum execution time: 4_534_000 picoseconds. + Weight::from_parts(4_689_000, 0) } /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) @@ -471,8 +466,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `160` // Estimated: `3625` - // Minimum execution time: 8_513_000 picoseconds. - Weight::from_parts(8_765_000, 3625) + // Minimum execution time: 8_640_000 picoseconds. + Weight::from_parts(8_971_000, 3625) .saturating_add(T::DbWeight::get().reads(2_u64)) } /// Storage: `Revive::ImmutableDataOf` (r:1 w:0) @@ -482,10 +477,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `134 + n * (1 ±0)` // Estimated: `3599 + n * (1 ±0)` - // Minimum execution time: 4_870_000 picoseconds. - Weight::from_parts(6_309_018, 3599) + // Minimum execution time: 4_875_000 picoseconds. + Weight::from_parts(6_212_863, 3599) // Standard Error: 7 - .saturating_add(Weight::from_parts(645, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(671, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -496,67 +491,67 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_754_000 picoseconds. - Weight::from_parts(1_939_099, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(581, 0).saturating_mul(n.into())) + // Minimum execution time: 1_678_000 picoseconds. + Weight::from_parts(1_883_150, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(579, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().writes(1_u64)) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 243_000 picoseconds. - Weight::from_parts(292_000, 0) + // Minimum execution time: 238_000 picoseconds. + Weight::from_parts(273_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 254_000 picoseconds. - Weight::from_parts(284_000, 0) + // Minimum execution time: 244_000 picoseconds. + Weight::from_parts(260_000, 0) } fn seal_return_data_size() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 242_000 picoseconds. - Weight::from_parts(257_000, 0) + // Minimum execution time: 249_000 picoseconds. + Weight::from_parts(265_000, 0) } fn seal_call_data_size() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 241_000 picoseconds. - Weight::from_parts(261_000, 0) + // Minimum execution time: 243_000 picoseconds. + Weight::from_parts(269_000, 0) } fn seal_gas_limit() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 265_000 picoseconds. - Weight::from_parts(290_000, 0) + // Minimum execution time: 228_000 picoseconds. + Weight::from_parts(268_000, 0) } fn seal_gas_price() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 225_000 picoseconds. - Weight::from_parts(249_000, 0) + // Minimum execution time: 222_000 picoseconds. + Weight::from_parts(251_000, 0) } fn seal_base_fee() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 246_000 picoseconds. - Weight::from_parts(266_000, 0) + // Minimum execution time: 226_000 picoseconds. + Weight::from_parts(250_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 247_000 picoseconds. - Weight::from_parts(267_000, 0) + // Minimum execution time: 228_000 picoseconds. + Weight::from_parts(270_000, 0) } /// Storage: `Session::Validators` (r:1 w:0) /// Proof: `Session::Validators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -564,8 +559,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 13_503_000 picoseconds. - Weight::from_parts(13_907_000, 1485) + // Minimum execution time: 13_597_000 picoseconds. + Weight::from_parts(13_770_000, 1485) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `System::BlockHash` (r:1 w:0) @@ -574,127 +569,121 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 2_251_000 picoseconds. - Weight::from_parts(2_370_000, 3465) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_402_000, 3465) .saturating_add(T::DbWeight::get().reads(1_u64)) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 237_000 picoseconds. - Weight::from_parts(264_000, 0) + // Minimum execution time: 230_000 picoseconds. + Weight::from_parts(256_000, 0) } fn seal_weight_to_fee() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_238_000 picoseconds. - Weight::from_parts(1_311_000, 0) + // Minimum execution time: 1_214_000 picoseconds. + Weight::from_parts(1_283_000, 0) } /// The range of component `n` is `[0, 262140]`. fn seal_copy_to_contract(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 380_000 picoseconds. - Weight::from_parts(524_789, 0) + // Minimum execution time: 376_000 picoseconds. + Weight::from_parts(569_136, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(237, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(236, 0).saturating_mul(n.into())) } fn seal_call_data_load() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 248_000 picoseconds. - Weight::from_parts(267_000, 0) + // Minimum execution time: 243_000 picoseconds. + Weight::from_parts(260_000, 0) } /// The range of component `n` is `[0, 262144]`. fn seal_call_data_copy(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 230_000 picoseconds. - Weight::from_parts(207_234, 0) + // Minimum execution time: 231_000 picoseconds. + Weight::from_parts(379_088, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(150, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(148, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 262140]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 267_000 picoseconds. - Weight::from_parts(357_669, 0) + // Minimum execution time: 227_000 picoseconds. + Weight::from_parts(400_572, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(238, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(237, 0).saturating_mul(n.into())) } /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::DeletionQueueCounter` (r:1 w:1) /// Proof: `Revive::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `Revive::CodeInfoOf` (r:33 w:33) + /// Storage: `Revive::CodeInfoOf` (r:1 w:1) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::DeletionQueue` (r:0 w:1) /// Proof: `Revive::DeletionQueue` (`max_values`: None, `max_size`: Some(142), added: 2617, mode: `Measured`) /// Storage: `Revive::ImmutableDataOf` (r:0 w:1) /// Proof: `Revive::ImmutableDataOf` (`max_values`: None, `max_size`: Some(4118), added: 6593, mode: `Measured`) - /// The range of component `n` is `[0, 32]`. - fn seal_terminate(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `218 + n * (88 ±0)` - // Estimated: `3684 + n * (2563 ±0)` - // Minimum execution time: 14_314_000 picoseconds. - Weight::from_parts(15_353_516, 3684) - // Standard Error: 10_720 - .saturating_add(Weight::from_parts(4_159_489, 0).saturating_mul(n.into())) + fn seal_terminate() -> Weight { + // Proof Size summary in bytes: + // Measured: `215` + // Estimated: `3680` + // Minimum execution time: 14_216_000 picoseconds. + Weight::from_parts(14_533_000, 3680) .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(T::DbWeight::get().writes(4_u64)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2563).saturating_mul(n.into())) } /// The range of component `t` is `[0, 4]`. - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_deposit_event(t: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_968_000 picoseconds. - Weight::from_parts(3_902_423, 0) - // Standard Error: 2_379 - .saturating_add(Weight::from_parts(199_019, 0).saturating_mul(t.into())) - // Standard Error: 24 - .saturating_add(Weight::from_parts(945, 0).saturating_mul(n.into())) + // Minimum execution time: 3_877_000 picoseconds. + Weight::from_parts(3_856_832, 0) + // Standard Error: 2_622 + .saturating_add(Weight::from_parts(201_206, 0).saturating_mul(t.into())) + // Standard Error: 28 + .saturating_add(Weight::from_parts(1_128, 0).saturating_mul(n.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) fn get_storage_empty() -> Weight { // Proof Size summary in bytes: - // Measured: `584` - // Estimated: `584` - // Minimum execution time: 5_980_000 picoseconds. - Weight::from_parts(6_250_000, 584) + // Measured: `552` + // Estimated: `552` + // Minimum execution time: 5_806_000 picoseconds. + Weight::from_parts(6_037_000, 552) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) fn get_storage_full() -> Weight { // Proof Size summary in bytes: - // Measured: `10594` - // Estimated: `10594` - // Minimum execution time: 39_415_000 picoseconds. - Weight::from_parts(40_109_000, 10594) + // Measured: `10562` + // Estimated: `10562` + // Minimum execution time: 39_517_000 picoseconds. + Weight::from_parts(40_698_000, 10562) .saturating_add(T::DbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_storage_empty() -> Weight { // Proof Size summary in bytes: - // Measured: `584` - // Estimated: `584` - // Minimum execution time: 6_844_000 picoseconds. - Weight::from_parts(7_017_000, 584) + // Measured: `552` + // Estimated: `552` + // Minimum execution time: 6_747_000 picoseconds. + Weight::from_parts(7_003_000, 552) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -702,85 +691,85 @@ impl WeightInfo for SubstrateWeight { /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_storage_full() -> Weight { // Proof Size summary in bytes: - // Measured: `10594` - // Estimated: `10594` - // Minimum execution time: 39_496_000 picoseconds. - Weight::from_parts(41_428_000, 10594) + // Measured: `10562` + // Estimated: `10562` + // Minimum execution time: 40_158_000 picoseconds. + Weight::from_parts(41_394_000, 10562) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. - /// The range of component `o` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. + /// The range of component `o` is `[0, 416]`. fn seal_set_storage(n: u32, o: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + o * (1 ±0)` // Estimated: `151 + o * (1 ±0)` - // Minimum execution time: 6_400_000 picoseconds. - Weight::from_parts(7_358_548, 151) - // Standard Error: 67 - .saturating_add(Weight::from_parts(659, 0).saturating_mul(n.into())) - // Standard Error: 67 - .saturating_add(Weight::from_parts(1_273, 0).saturating_mul(o.into())) + // Minimum execution time: 6_360_000 picoseconds. + Weight::from_parts(7_335_152, 151) + // Standard Error: 80 + .saturating_add(Weight::from_parts(716, 0).saturating_mul(n.into())) + // Standard Error: 80 + .saturating_add(Weight::from_parts(1_127, 0).saturating_mul(o.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_clear_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + n * (1 ±0)` // Estimated: `151 + n * (1 ±0)` - // Minimum execution time: 6_090_000 picoseconds. - Weight::from_parts(7_308_548, 151) - // Standard Error: 113 - .saturating_add(Weight::from_parts(1_456, 0).saturating_mul(n.into())) + // Minimum execution time: 5_980_000 picoseconds. + Weight::from_parts(7_164_266, 151) + // Standard Error: 130 + .saturating_add(Weight::from_parts(1_893, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_get_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + n * (1 ±0)` // Estimated: `151 + n * (1 ±0)` - // Minimum execution time: 5_649_000 picoseconds. - Weight::from_parts(7_096_122, 151) - // Standard Error: 120 - .saturating_add(Weight::from_parts(2_127, 0).saturating_mul(n.into())) + // Minimum execution time: 5_823_000 picoseconds. + Weight::from_parts(7_045_557, 151) + // Standard Error: 123 + .saturating_add(Weight::from_parts(2_222, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_contains_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + n * (1 ±0)` // Estimated: `151 + n * (1 ±0)` - // Minimum execution time: 5_261_000 picoseconds. - Weight::from_parts(6_552_943, 151) - // Standard Error: 117 - .saturating_add(Weight::from_parts(1_585, 0).saturating_mul(n.into())) + // Minimum execution time: 5_349_000 picoseconds. + Weight::from_parts(6_506_216, 151) + // Standard Error: 127 + .saturating_add(Weight::from_parts(1_605, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_take_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + n * (1 ±0)` // Estimated: `151 + n * (1 ±0)` - // Minimum execution time: 6_374_000 picoseconds. - Weight::from_parts(7_739_700, 151) - // Standard Error: 122 - .saturating_add(Weight::from_parts(2_264, 0).saturating_mul(n.into())) + // Minimum execution time: 6_151_000 picoseconds. + Weight::from_parts(7_812_180, 151) + // Standard Error: 159 + .saturating_add(Weight::from_parts(2_277, 0).saturating_mul(n.into())) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -789,92 +778,94 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_371_000 picoseconds. - Weight::from_parts(1_446_000, 0) + // Minimum execution time: 1_344_000 picoseconds. + Weight::from_parts(1_462_000, 0) } fn set_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_663_000 picoseconds. - Weight::from_parts(1_786_000, 0) + // Minimum execution time: 1_680_000 picoseconds. + Weight::from_parts(1_785_000, 0) } fn get_transient_storage_empty() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_352_000 picoseconds. - Weight::from_parts(1_425_000, 0) + // Minimum execution time: 1_380_000 picoseconds. + Weight::from_parts(1_502_000, 0) } fn get_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_499_000 picoseconds. - Weight::from_parts(1_569_000, 0) + // Minimum execution time: 1_506_000 picoseconds. + Weight::from_parts(1_604_000, 0) } fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_038_000 picoseconds. - Weight::from_parts(1_091_000, 0) + // Minimum execution time: 972_000 picoseconds. + Weight::from_parts(1_054_000, 0) } - /// The range of component `n` is `[0, 448]`. - /// The range of component `o` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. + /// The range of component `o` is `[0, 416]`. fn seal_set_transient_storage(n: u32, o: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_108_000 picoseconds. - Weight::from_parts(2_300_363, 0) - // Standard Error: 13 - .saturating_add(Weight::from_parts(242, 0).saturating_mul(n.into())) - // Standard Error: 13 - .saturating_add(Weight::from_parts(374, 0).saturating_mul(o.into())) + // Minimum execution time: 2_048_000 picoseconds. + Weight::from_parts(2_304_120, 0) + // Standard Error: 17 + .saturating_add(Weight::from_parts(254, 0).saturating_mul(n.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(321, 0).saturating_mul(o.into())) } - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_clear_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_822_000 picoseconds. - Weight::from_parts(2_150_092, 0) - // Standard Error: 16 - .saturating_add(Weight::from_parts(394, 0).saturating_mul(n.into())) + // Minimum execution time: 1_790_000 picoseconds. + Weight::from_parts(2_141_874, 0) + // Standard Error: 31 + .saturating_add(Weight::from_parts(378, 0).saturating_mul(n.into())) } - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_675_000 picoseconds. - Weight::from_parts(1_873_341, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(273, 0).saturating_mul(n.into())) + // Minimum execution time: 1_662_000 picoseconds. + Weight::from_parts(1_938_172, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(316, 0).saturating_mul(n.into())) } - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_contains_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_555_000 picoseconds. - Weight::from_parts(1_690_236, 0) - // Standard Error: 10 - .saturating_add(Weight::from_parts(185, 0).saturating_mul(n.into())) + // Minimum execution time: 1_570_000 picoseconds. + Weight::from_parts(1_769_617, 0) + // Standard Error: 13 + .saturating_add(Weight::from_parts(152, 0).saturating_mul(n.into())) } - /// The range of component `n` is `[0, 448]`. - fn seal_take_transient_storage(_n: u32, ) -> Weight { + /// The range of component `n` is `[0, 416]`. + fn seal_take_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(2_522_598, 0) + // Minimum execution time: 2_266_000 picoseconds. + Weight::from_parts(2_497_430, 0) + // Standard Error: 21 + .saturating_add(Weight::from_parts(38, 0).saturating_mul(n.into())) } /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::PristineCode` (r:1 w:0) @@ -885,12 +876,12 @@ impl WeightInfo for SubstrateWeight { /// The range of component `i` is `[0, 262144]`. fn seal_call(t: u32, i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1164 + t * (206 ±0)` - // Estimated: `4629 + t * (2417 ±0)` - // Minimum execution time: 30_631_000 picoseconds. - Weight::from_parts(31_328_855, 4629) - // Standard Error: 36_031 - .saturating_add(Weight::from_parts(5_665_922, 0).saturating_mul(t.into())) + // Measured: `1163 + t * (206 ±0)` + // Estimated: `4628 + t * (2417 ±0)` + // Minimum execution time: 30_368_000 picoseconds. + Weight::from_parts(31_023_429, 4628) + // Standard Error: 43_250 + .saturating_add(Weight::from_parts(5_949_452, 0).saturating_mul(t.into())) // Standard Error: 0 .saturating_add(Weight::from_parts(2, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) @@ -899,17 +890,17 @@ impl WeightInfo for SubstrateWeight { .saturating_add(Weight::from_parts(0, 2417).saturating_mul(t.into())) } /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::PristineCode` (r:1 w:0) /// Proof: `Revive::PristineCode` (`max_values`: None, `max_size`: Some(262180), added: 264655, mode: `Measured`) fn seal_delegate_call() -> Weight { // Proof Size summary in bytes: - // Measured: `1109` - // Estimated: `4574` - // Minimum execution time: 25_423_000 picoseconds. - Weight::from_parts(25_957_000, 4574) + // Measured: `1108` + // Estimated: `4573` + // Minimum execution time: 24_707_000 picoseconds. + Weight::from_parts(25_410_000, 4573) .saturating_add(T::DbWeight::get().reads(3_u64)) } /// Storage: `Revive::CodeInfoOf` (r:1 w:1) @@ -917,18 +908,18 @@ impl WeightInfo for SubstrateWeight { /// Storage: `Revive::PristineCode` (r:1 w:0) /// Proof: `Revive::PristineCode` (`max_values`: None, `max_size`: Some(262180), added: 264655, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) /// The range of component `i` is `[0, 262144]`. fn seal_instantiate(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1093` - // Estimated: `4571` - // Minimum execution time: 108_874_000 picoseconds. - Weight::from_parts(98_900_023, 4571) + // Measured: `1094` + // Estimated: `4579` + // Minimum execution time: 107_232_000 picoseconds. + Weight::from_parts(94_844_854, 4579) // Standard Error: 10 - .saturating_add(Weight::from_parts(4_183, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(4_159, 0).saturating_mul(i.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -937,64 +928,64 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 627_000 picoseconds. - Weight::from_parts(3_385_445, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_419, 0).saturating_mul(n.into())) + // Minimum execution time: 617_000 picoseconds. + Weight::from_parts(3_460_054, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_374, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 262144]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_035_000 picoseconds. - Weight::from_parts(3_723_700, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3_637, 0).saturating_mul(n.into())) + // Minimum execution time: 1_040_000 picoseconds. + Weight::from_parts(3_026_644, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(3_607, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 262144]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 626_000 picoseconds. - Weight::from_parts(2_822_237, 0) + // Minimum execution time: 633_000 picoseconds. + Weight::from_parts(3_375_104, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(1_552, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_494, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 262144]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 554_000 picoseconds. - Weight::from_parts(3_287_817, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_542, 0).saturating_mul(n.into())) + // Minimum execution time: 601_000 picoseconds. + Weight::from_parts(3_802_060, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_493, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 261889]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_532_000 picoseconds. - Weight::from_parts(27_976_517, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(5_453, 0).saturating_mul(n.into())) + // Minimum execution time: 42_419_000 picoseconds. + Weight::from_parts(26_760_986, 0) + // Standard Error: 12 + .saturating_add(Weight::from_parts(5_421, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_970_000 picoseconds. - Weight::from_parts(47_747_000, 0) + // Minimum execution time: 48_672_000 picoseconds. + Weight::from_parts(49_840_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_550_000 picoseconds. - Weight::from_parts(12_706_000, 0) + // Minimum execution time: 12_307_000 picoseconds. + Weight::from_parts(12_500_000, 0) } /// Storage: `Revive::CodeInfoOf` (r:1 w:1) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) @@ -1002,30 +993,8 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `196` // Estimated: `3661` - // Minimum execution time: 10_229_000 picoseconds. - Weight::from_parts(10_530_000, 3661) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `Revive::CodeInfoOf` (r:1 w:1) - /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) - fn lock_delegate_dependency() -> Weight { - // Proof Size summary in bytes: - // Measured: `234` - // Estimated: `3699` - // Minimum execution time: 9_743_000 picoseconds. - Weight::from_parts(10_180_000, 3699) - .saturating_add(T::DbWeight::get().reads(1_u64)) - .saturating_add(T::DbWeight::get().writes(1_u64)) - } - /// Storage: `Revive::CodeInfoOf` (r:1 w:1) - /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`) - fn unlock_delegate_dependency() -> Weight { - // Proof Size summary in bytes: - // Measured: `234` - // Estimated: `3561` - // Minimum execution time: 8_717_000 picoseconds. - Weight::from_parts(9_129_000, 3561) + // Minimum execution time: 10_142_000 picoseconds. + Weight::from_parts(10_458_000, 3661) .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -1034,10 +1003,10 @@ impl WeightInfo for SubstrateWeight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_332_000 picoseconds. - Weight::from_parts(9_985_610, 0) - // Standard Error: 187 - .saturating_add(Weight::from_parts(73_915, 0).saturating_mul(r.into())) + // Minimum execution time: 7_893_000 picoseconds. + Weight::from_parts(9_362_667, 0) + // Standard Error: 84 + .saturating_add(Weight::from_parts(74_272, 0).saturating_mul(r.into())) } } @@ -1049,8 +1018,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 690_000 picoseconds. - Weight::from_parts(743_000, 1485) + // Minimum execution time: 695_000 picoseconds. + Weight::from_parts(750_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) @@ -1060,10 +1029,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `230 + k * (69 ±0)` // Estimated: `222 + k * (70 ±0)` - // Minimum execution time: 10_913_000 picoseconds. - Weight::from_parts(11_048_000, 222) - // Standard Error: 972 - .saturating_add(Weight::from_parts(1_172_318, 0).saturating_mul(k.into())) + // Minimum execution time: 10_509_000 picoseconds. + Weight::from_parts(10_896_000, 222) + // Standard Error: 2_549 + .saturating_add(Weight::from_parts(1_264_033, 0).saturating_mul(k.into())) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(k.into()))) .saturating_add(RocksDbWeight::get().writes(2_u64)) @@ -1073,7 +1042,7 @@ impl WeightInfo for () { /// Storage: `Revive::AddressSuffix` (r:2 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::PristineCode` (r:1 w:0) @@ -1083,14 +1052,12 @@ impl WeightInfo for () { /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) /// The range of component `c` is `[0, 262144]`. - fn call_with_code_per_byte(c: u32, ) -> Weight { + fn call_with_code_per_byte(_c: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1195` - // Estimated: `7135` - // Minimum execution time: 83_080_000 picoseconds. - Weight::from_parts(89_270_264, 7135) - // Standard Error: 0 - .saturating_add(Weight::from_parts(3, 0).saturating_mul(c.into())) + // Measured: `1194` + // Estimated: `7134` + // Minimum execution time: 84_008_000 picoseconds. + Weight::from_parts(91_138_296, 7134) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1101,7 +1068,7 @@ impl WeightInfo for () { /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Timestamp::Now` (r:1 w:0) /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) /// Storage: `System::Account` (r:1 w:1) @@ -1114,10 +1081,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `93` // Estimated: `6033` - // Minimum execution time: 171_761_000 picoseconds. - Weight::from_parts(158_031_807, 6033) - // Standard Error: 11 - .saturating_add(Weight::from_parts(4_536, 0).saturating_mul(i.into())) + // Minimum execution time: 172_907_000 picoseconds. + Weight::from_parts(153_592_465, 6033) + // Standard Error: 12 + .saturating_add(Weight::from_parts(4_544, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } @@ -1128,7 +1095,7 @@ impl WeightInfo for () { /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Timestamp::Now` (r:1 w:0) /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) /// Storage: `System::Account` (r:1 w:1) @@ -1140,17 +1107,17 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `987` // Estimated: `4452` - // Minimum execution time: 143_210_000 picoseconds. - Weight::from_parts(121_908_111, 4452) - // Standard Error: 15 - .saturating_add(Weight::from_parts(4_467, 0).saturating_mul(i.into())) + // Minimum execution time: 143_169_000 picoseconds. + Weight::from_parts(120_653_436, 4452) + // Standard Error: 16 + .saturating_add(Weight::from_parts(4_444, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } /// Storage: `Revive::AddressSuffix` (r:2 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::PristineCode` (r:1 w:0) @@ -1161,10 +1128,10 @@ impl WeightInfo for () { /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) fn call() -> Weight { // Proof Size summary in bytes: - // Measured: `1195` - // Estimated: `7135` - // Minimum execution time: 136_689_000 picoseconds. - Weight::from_parts(145_358_000, 7135) + // Measured: `1194` + // Estimated: `7134` + // Minimum execution time: 138_392_000 picoseconds. + Weight::from_parts(143_329_000, 7134) .saturating_add(RocksDbWeight::get().reads(7_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1175,14 +1142,12 @@ impl WeightInfo for () { /// Storage: `Revive::PristineCode` (r:0 w:1) /// Proof: `Revive::PristineCode` (`max_values`: None, `max_size`: Some(262180), added: 264655, mode: `Measured`) /// The range of component `c` is `[0, 262144]`. - fn upload_code(c: u32, ) -> Weight { + fn upload_code(_c: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 43_351_000 picoseconds. - Weight::from_parts(44_896_319, 3465) - // Standard Error: 0 - .saturating_add(Weight::from_parts(1, 0).saturating_mul(c.into())) + // Minimum execution time: 43_420_000 picoseconds. + Weight::from_parts(45_143_767, 3465) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1196,21 +1161,21 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `181` // Estimated: `3646` - // Minimum execution time: 36_034_000 picoseconds. - Weight::from_parts(36_595_000, 3646) + // Minimum execution time: 35_828_000 picoseconds. + Weight::from_parts(36_853_000, 3646) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:2 w:2) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) fn set_code() -> Weight { // Proof Size summary in bytes: - // Measured: `425` - // Estimated: `6365` - // Minimum execution time: 19_484_000 picoseconds. - Weight::from_parts(20_104_000, 6365) + // Measured: `424` + // Estimated: `6364` + // Minimum execution time: 19_678_000 picoseconds. + Weight::from_parts(21_266_000, 6364) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1222,8 +1187,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 37_066_000 picoseconds. - Weight::from_parts(37_646_000, 3465) + // Minimum execution time: 37_024_000 picoseconds. + Weight::from_parts(37_440_000, 3465) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1235,8 +1200,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `56` // Estimated: `3521` - // Minimum execution time: 31_604_000 picoseconds. - Weight::from_parts(32_557_000, 3521) + // Minimum execution time: 31_228_000 picoseconds. + Weight::from_parts(32_183_000, 3521) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -1248,8 +1213,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 6_070_000 picoseconds. - Weight::from_parts(6_246_000, 3465) + // Minimum execution time: 6_241_000 picoseconds. + Weight::from_parts(6_467_000, 3465) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// The range of component `r` is `[0, 1600]`. @@ -1257,33 +1222,33 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 6_471_000 picoseconds. - Weight::from_parts(7_724_355, 0) - // Standard Error: 245 - .saturating_add(Weight::from_parts(165_331, 0).saturating_mul(r.into())) + // Minimum execution time: 6_397_000 picoseconds. + Weight::from_parts(7_159_300, 0) + // Standard Error: 173 + .saturating_add(Weight::from_parts(167_265, 0).saturating_mul(r.into())) } fn seal_caller() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 239_000 picoseconds. - Weight::from_parts(278_000, 0) + // Minimum execution time: 267_000 picoseconds. + Weight::from_parts(296_000, 0) } fn seal_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 234_000 picoseconds. - Weight::from_parts(264_000, 0) + // Minimum execution time: 227_000 picoseconds. + Weight::from_parts(252_000, 0) } /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) fn seal_is_contract() -> Weight { // Proof Size summary in bytes: // Measured: `202` // Estimated: `3667` - // Minimum execution time: 6_508_000 picoseconds. - Weight::from_parts(6_715_000, 3667) + // Minimum execution time: 6_591_000 picoseconds. + Weight::from_parts(6_770_000, 3667) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Revive::AddressSuffix` (r:1 w:0) @@ -1292,80 +1257,80 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `144` // Estimated: `3609` - // Minimum execution time: 6_190_000 picoseconds. - Weight::from_parts(6_413_000, 3609) + // Minimum execution time: 6_182_000 picoseconds. + Weight::from_parts(6_372_000, 3609) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) fn seal_code_hash() -> Weight { // Proof Size summary in bytes: - // Measured: `299` - // Estimated: `3764` - // Minimum execution time: 7_547_000 picoseconds. - Weight::from_parts(7_742_000, 3764) + // Measured: `298` + // Estimated: `3763` + // Minimum execution time: 7_327_000 picoseconds. + Weight::from_parts(7_612_000, 3763) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_own_code_hash() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 251_000 picoseconds. - Weight::from_parts(274_000, 0) + // Minimum execution time: 232_000 picoseconds. + Weight::from_parts(287_000, 0) } /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) fn seal_code_size() -> Weight { // Proof Size summary in bytes: - // Measured: `369` - // Estimated: `3834` - // Minimum execution time: 10_825_000 picoseconds. - Weight::from_parts(11_185_000, 3834) + // Measured: `368` + // Estimated: `3833` + // Minimum execution time: 10_918_000 picoseconds. + Weight::from_parts(11_323_000, 3833) .saturating_add(RocksDbWeight::get().reads(2_u64)) } fn seal_caller_is_origin() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 325_000 picoseconds. - Weight::from_parts(352_000, 0) + // Minimum execution time: 310_000 picoseconds. + Weight::from_parts(340_000, 0) } fn seal_caller_is_root() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 245_000 picoseconds. - Weight::from_parts(282_000, 0) + // Minimum execution time: 257_000 picoseconds. + Weight::from_parts(292_000, 0) } fn seal_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 251_000 picoseconds. - Weight::from_parts(274_000, 0) + // Minimum execution time: 240_000 picoseconds. + Weight::from_parts(249_000, 0) } fn seal_weight_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` // Minimum execution time: 599_000 picoseconds. - Weight::from_parts(675_000, 0) + Weight::from_parts(645_000, 0) } fn seal_ref_time_left() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 245_000 picoseconds. - Weight::from_parts(263_000, 0) + // Minimum execution time: 208_000 picoseconds. + Weight::from_parts(244_000, 0) } fn seal_balance() -> Weight { // Proof Size summary in bytes: // Measured: `102` // Estimated: `0` - // Minimum execution time: 4_613_000 picoseconds. - Weight::from_parts(4_768_000, 0) + // Minimum execution time: 4_534_000 picoseconds. + Weight::from_parts(4_689_000, 0) } /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) @@ -1375,8 +1340,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `160` // Estimated: `3625` - // Minimum execution time: 8_513_000 picoseconds. - Weight::from_parts(8_765_000, 3625) + // Minimum execution time: 8_640_000 picoseconds. + Weight::from_parts(8_971_000, 3625) .saturating_add(RocksDbWeight::get().reads(2_u64)) } /// Storage: `Revive::ImmutableDataOf` (r:1 w:0) @@ -1386,10 +1351,10 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `134 + n * (1 ±0)` // Estimated: `3599 + n * (1 ±0)` - // Minimum execution time: 4_870_000 picoseconds. - Weight::from_parts(6_309_018, 3599) + // Minimum execution time: 4_875_000 picoseconds. + Weight::from_parts(6_212_863, 3599) // Standard Error: 7 - .saturating_add(Weight::from_parts(645, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(671, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } @@ -1400,67 +1365,67 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_754_000 picoseconds. - Weight::from_parts(1_939_099, 0) - // Standard Error: 1 - .saturating_add(Weight::from_parts(581, 0).saturating_mul(n.into())) + // Minimum execution time: 1_678_000 picoseconds. + Weight::from_parts(1_883_150, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(579, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().writes(1_u64)) } fn seal_value_transferred() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 243_000 picoseconds. - Weight::from_parts(292_000, 0) + // Minimum execution time: 238_000 picoseconds. + Weight::from_parts(273_000, 0) } fn seal_minimum_balance() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 254_000 picoseconds. - Weight::from_parts(284_000, 0) + // Minimum execution time: 244_000 picoseconds. + Weight::from_parts(260_000, 0) } fn seal_return_data_size() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 242_000 picoseconds. - Weight::from_parts(257_000, 0) + // Minimum execution time: 249_000 picoseconds. + Weight::from_parts(265_000, 0) } fn seal_call_data_size() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 241_000 picoseconds. - Weight::from_parts(261_000, 0) + // Minimum execution time: 243_000 picoseconds. + Weight::from_parts(269_000, 0) } fn seal_gas_limit() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 265_000 picoseconds. - Weight::from_parts(290_000, 0) + // Minimum execution time: 228_000 picoseconds. + Weight::from_parts(268_000, 0) } fn seal_gas_price() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 225_000 picoseconds. - Weight::from_parts(249_000, 0) + // Minimum execution time: 222_000 picoseconds. + Weight::from_parts(251_000, 0) } fn seal_base_fee() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 246_000 picoseconds. - Weight::from_parts(266_000, 0) + // Minimum execution time: 226_000 picoseconds. + Weight::from_parts(250_000, 0) } fn seal_block_number() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 247_000 picoseconds. - Weight::from_parts(267_000, 0) + // Minimum execution time: 228_000 picoseconds. + Weight::from_parts(270_000, 0) } /// Storage: `Session::Validators` (r:1 w:0) /// Proof: `Session::Validators` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) @@ -1468,8 +1433,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `1485` - // Minimum execution time: 13_503_000 picoseconds. - Weight::from_parts(13_907_000, 1485) + // Minimum execution time: 13_597_000 picoseconds. + Weight::from_parts(13_770_000, 1485) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `System::BlockHash` (r:1 w:0) @@ -1478,127 +1443,121 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `3465` - // Minimum execution time: 2_251_000 picoseconds. - Weight::from_parts(2_370_000, 3465) + // Minimum execution time: 2_199_000 picoseconds. + Weight::from_parts(2_402_000, 3465) .saturating_add(RocksDbWeight::get().reads(1_u64)) } fn seal_now() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 237_000 picoseconds. - Weight::from_parts(264_000, 0) + // Minimum execution time: 230_000 picoseconds. + Weight::from_parts(256_000, 0) } fn seal_weight_to_fee() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_238_000 picoseconds. - Weight::from_parts(1_311_000, 0) + // Minimum execution time: 1_214_000 picoseconds. + Weight::from_parts(1_283_000, 0) } /// The range of component `n` is `[0, 262140]`. fn seal_copy_to_contract(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 380_000 picoseconds. - Weight::from_parts(524_789, 0) + // Minimum execution time: 376_000 picoseconds. + Weight::from_parts(569_136, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(237, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(236, 0).saturating_mul(n.into())) } fn seal_call_data_load() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 248_000 picoseconds. - Weight::from_parts(267_000, 0) + // Minimum execution time: 243_000 picoseconds. + Weight::from_parts(260_000, 0) } /// The range of component `n` is `[0, 262144]`. fn seal_call_data_copy(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 230_000 picoseconds. - Weight::from_parts(207_234, 0) + // Minimum execution time: 231_000 picoseconds. + Weight::from_parts(379_088, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(150, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(148, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 262140]`. fn seal_return(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 267_000 picoseconds. - Weight::from_parts(357_669, 0) + // Minimum execution time: 227_000 picoseconds. + Weight::from_parts(400_572, 0) // Standard Error: 0 - .saturating_add(Weight::from_parts(238, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(237, 0).saturating_mul(n.into())) } /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::DeletionQueueCounter` (r:1 w:1) /// Proof: `Revive::DeletionQueueCounter` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `Measured`) - /// Storage: `Revive::CodeInfoOf` (r:33 w:33) + /// Storage: `Revive::CodeInfoOf` (r:1 w:1) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::DeletionQueue` (r:0 w:1) /// Proof: `Revive::DeletionQueue` (`max_values`: None, `max_size`: Some(142), added: 2617, mode: `Measured`) /// Storage: `Revive::ImmutableDataOf` (r:0 w:1) /// Proof: `Revive::ImmutableDataOf` (`max_values`: None, `max_size`: Some(4118), added: 6593, mode: `Measured`) - /// The range of component `n` is `[0, 32]`. - fn seal_terminate(n: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `218 + n * (88 ±0)` - // Estimated: `3684 + n * (2563 ±0)` - // Minimum execution time: 14_314_000 picoseconds. - Weight::from_parts(15_353_516, 3684) - // Standard Error: 10_720 - .saturating_add(Weight::from_parts(4_159_489, 0).saturating_mul(n.into())) + fn seal_terminate() -> Weight { + // Proof Size summary in bytes: + // Measured: `215` + // Estimated: `3680` + // Minimum execution time: 14_216_000 picoseconds. + Weight::from_parts(14_533_000, 3680) .saturating_add(RocksDbWeight::get().reads(3_u64)) - .saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(n.into()))) .saturating_add(RocksDbWeight::get().writes(4_u64)) - .saturating_add(RocksDbWeight::get().writes((1_u64).saturating_mul(n.into()))) - .saturating_add(Weight::from_parts(0, 2563).saturating_mul(n.into())) } /// The range of component `t` is `[0, 4]`. - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_deposit_event(t: u32, n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 3_968_000 picoseconds. - Weight::from_parts(3_902_423, 0) - // Standard Error: 2_379 - .saturating_add(Weight::from_parts(199_019, 0).saturating_mul(t.into())) - // Standard Error: 24 - .saturating_add(Weight::from_parts(945, 0).saturating_mul(n.into())) + // Minimum execution time: 3_877_000 picoseconds. + Weight::from_parts(3_856_832, 0) + // Standard Error: 2_622 + .saturating_add(Weight::from_parts(201_206, 0).saturating_mul(t.into())) + // Standard Error: 28 + .saturating_add(Weight::from_parts(1_128, 0).saturating_mul(n.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) fn get_storage_empty() -> Weight { // Proof Size summary in bytes: - // Measured: `584` - // Estimated: `584` - // Minimum execution time: 5_980_000 picoseconds. - Weight::from_parts(6_250_000, 584) + // Measured: `552` + // Estimated: `552` + // Minimum execution time: 5_806_000 picoseconds. + Weight::from_parts(6_037_000, 552) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) fn get_storage_full() -> Weight { // Proof Size summary in bytes: - // Measured: `10594` - // Estimated: `10594` - // Minimum execution time: 39_415_000 picoseconds. - Weight::from_parts(40_109_000, 10594) + // Measured: `10562` + // Estimated: `10562` + // Minimum execution time: 39_517_000 picoseconds. + Weight::from_parts(40_698_000, 10562) .saturating_add(RocksDbWeight::get().reads(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_storage_empty() -> Weight { // Proof Size summary in bytes: - // Measured: `584` - // Estimated: `584` - // Minimum execution time: 6_844_000 picoseconds. - Weight::from_parts(7_017_000, 584) + // Measured: `552` + // Estimated: `552` + // Minimum execution time: 6_747_000 picoseconds. + Weight::from_parts(7_003_000, 552) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1606,85 +1565,85 @@ impl WeightInfo for () { /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_storage_full() -> Weight { // Proof Size summary in bytes: - // Measured: `10594` - // Estimated: `10594` - // Minimum execution time: 39_496_000 picoseconds. - Weight::from_parts(41_428_000, 10594) + // Measured: `10562` + // Estimated: `10562` + // Minimum execution time: 40_158_000 picoseconds. + Weight::from_parts(41_394_000, 10562) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. - /// The range of component `o` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. + /// The range of component `o` is `[0, 416]`. fn seal_set_storage(n: u32, o: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + o * (1 ±0)` // Estimated: `151 + o * (1 ±0)` - // Minimum execution time: 6_400_000 picoseconds. - Weight::from_parts(7_358_548, 151) - // Standard Error: 67 - .saturating_add(Weight::from_parts(659, 0).saturating_mul(n.into())) - // Standard Error: 67 - .saturating_add(Weight::from_parts(1_273, 0).saturating_mul(o.into())) + // Minimum execution time: 6_360_000 picoseconds. + Weight::from_parts(7_335_152, 151) + // Standard Error: 80 + .saturating_add(Weight::from_parts(716, 0).saturating_mul(n.into())) + // Standard Error: 80 + .saturating_add(Weight::from_parts(1_127, 0).saturating_mul(o.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(o.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_clear_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + n * (1 ±0)` // Estimated: `151 + n * (1 ±0)` - // Minimum execution time: 6_090_000 picoseconds. - Weight::from_parts(7_308_548, 151) - // Standard Error: 113 - .saturating_add(Weight::from_parts(1_456, 0).saturating_mul(n.into())) + // Minimum execution time: 5_980_000 picoseconds. + Weight::from_parts(7_164_266, 151) + // Standard Error: 130 + .saturating_add(Weight::from_parts(1_893, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_get_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + n * (1 ±0)` // Estimated: `151 + n * (1 ±0)` - // Minimum execution time: 5_649_000 picoseconds. - Weight::from_parts(7_096_122, 151) - // Standard Error: 120 - .saturating_add(Weight::from_parts(2_127, 0).saturating_mul(n.into())) + // Minimum execution time: 5_823_000 picoseconds. + Weight::from_parts(7_045_557, 151) + // Standard Error: 123 + .saturating_add(Weight::from_parts(2_222, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_contains_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + n * (1 ±0)` // Estimated: `151 + n * (1 ±0)` - // Minimum execution time: 5_261_000 picoseconds. - Weight::from_parts(6_552_943, 151) - // Standard Error: 117 - .saturating_add(Weight::from_parts(1_585, 0).saturating_mul(n.into())) + // Minimum execution time: 5_349_000 picoseconds. + Weight::from_parts(6_506_216, 151) + // Standard Error: 127 + .saturating_add(Weight::from_parts(1_605, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) } /// Storage: `Skipped::Metadata` (r:0 w:0) /// Proof: `Skipped::Metadata` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_take_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `152 + n * (1 ±0)` // Estimated: `151 + n * (1 ±0)` - // Minimum execution time: 6_374_000 picoseconds. - Weight::from_parts(7_739_700, 151) - // Standard Error: 122 - .saturating_add(Weight::from_parts(2_264, 0).saturating_mul(n.into())) + // Minimum execution time: 6_151_000 picoseconds. + Weight::from_parts(7_812_180, 151) + // Standard Error: 159 + .saturating_add(Weight::from_parts(2_277, 0).saturating_mul(n.into())) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) .saturating_add(Weight::from_parts(0, 1).saturating_mul(n.into())) @@ -1693,92 +1652,94 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_371_000 picoseconds. - Weight::from_parts(1_446_000, 0) + // Minimum execution time: 1_344_000 picoseconds. + Weight::from_parts(1_462_000, 0) } fn set_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_663_000 picoseconds. - Weight::from_parts(1_786_000, 0) + // Minimum execution time: 1_680_000 picoseconds. + Weight::from_parts(1_785_000, 0) } fn get_transient_storage_empty() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_352_000 picoseconds. - Weight::from_parts(1_425_000, 0) + // Minimum execution time: 1_380_000 picoseconds. + Weight::from_parts(1_502_000, 0) } fn get_transient_storage_full() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_499_000 picoseconds. - Weight::from_parts(1_569_000, 0) + // Minimum execution time: 1_506_000 picoseconds. + Weight::from_parts(1_604_000, 0) } fn rollback_transient_storage() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_038_000 picoseconds. - Weight::from_parts(1_091_000, 0) + // Minimum execution time: 972_000 picoseconds. + Weight::from_parts(1_054_000, 0) } - /// The range of component `n` is `[0, 448]`. - /// The range of component `o` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. + /// The range of component `o` is `[0, 416]`. fn seal_set_transient_storage(n: u32, o: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_108_000 picoseconds. - Weight::from_parts(2_300_363, 0) - // Standard Error: 13 - .saturating_add(Weight::from_parts(242, 0).saturating_mul(n.into())) - // Standard Error: 13 - .saturating_add(Weight::from_parts(374, 0).saturating_mul(o.into())) + // Minimum execution time: 2_048_000 picoseconds. + Weight::from_parts(2_304_120, 0) + // Standard Error: 17 + .saturating_add(Weight::from_parts(254, 0).saturating_mul(n.into())) + // Standard Error: 17 + .saturating_add(Weight::from_parts(321, 0).saturating_mul(o.into())) } - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_clear_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_822_000 picoseconds. - Weight::from_parts(2_150_092, 0) - // Standard Error: 16 - .saturating_add(Weight::from_parts(394, 0).saturating_mul(n.into())) + // Minimum execution time: 1_790_000 picoseconds. + Weight::from_parts(2_141_874, 0) + // Standard Error: 31 + .saturating_add(Weight::from_parts(378, 0).saturating_mul(n.into())) } - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_get_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_675_000 picoseconds. - Weight::from_parts(1_873_341, 0) - // Standard Error: 12 - .saturating_add(Weight::from_parts(273, 0).saturating_mul(n.into())) + // Minimum execution time: 1_662_000 picoseconds. + Weight::from_parts(1_938_172, 0) + // Standard Error: 14 + .saturating_add(Weight::from_parts(316, 0).saturating_mul(n.into())) } - /// The range of component `n` is `[0, 448]`. + /// The range of component `n` is `[0, 416]`. fn seal_contains_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_555_000 picoseconds. - Weight::from_parts(1_690_236, 0) - // Standard Error: 10 - .saturating_add(Weight::from_parts(185, 0).saturating_mul(n.into())) + // Minimum execution time: 1_570_000 picoseconds. + Weight::from_parts(1_769_617, 0) + // Standard Error: 13 + .saturating_add(Weight::from_parts(152, 0).saturating_mul(n.into())) } - /// The range of component `n` is `[0, 448]`. - fn seal_take_transient_storage(_n: u32, ) -> Weight { + /// The range of component `n` is `[0, 416]`. + fn seal_take_transient_storage(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 2_278_000 picoseconds. - Weight::from_parts(2_522_598, 0) + // Minimum execution time: 2_266_000 picoseconds. + Weight::from_parts(2_497_430, 0) + // Standard Error: 21 + .saturating_add(Weight::from_parts(38, 0).saturating_mul(n.into())) } /// Storage: `Revive::AddressSuffix` (r:1 w:0) /// Proof: `Revive::AddressSuffix` (`max_values`: None, `max_size`: Some(32), added: 2507, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::PristineCode` (r:1 w:0) @@ -1789,12 +1750,12 @@ impl WeightInfo for () { /// The range of component `i` is `[0, 262144]`. fn seal_call(t: u32, i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1164 + t * (206 ±0)` - // Estimated: `4629 + t * (2417 ±0)` - // Minimum execution time: 30_631_000 picoseconds. - Weight::from_parts(31_328_855, 4629) - // Standard Error: 36_031 - .saturating_add(Weight::from_parts(5_665_922, 0).saturating_mul(t.into())) + // Measured: `1163 + t * (206 ±0)` + // Estimated: `4628 + t * (2417 ±0)` + // Minimum execution time: 30_368_000 picoseconds. + Weight::from_parts(31_023_429, 4628) + // Standard Error: 43_250 + .saturating_add(Weight::from_parts(5_949_452, 0).saturating_mul(t.into())) // Standard Error: 0 .saturating_add(Weight::from_parts(2, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) @@ -1803,17 +1764,17 @@ impl WeightInfo for () { .saturating_add(Weight::from_parts(0, 2417).saturating_mul(t.into())) } /// Storage: `Revive::ContractInfoOf` (r:1 w:0) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `Revive::CodeInfoOf` (r:1 w:0) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) /// Storage: `Revive::PristineCode` (r:1 w:0) /// Proof: `Revive::PristineCode` (`max_values`: None, `max_size`: Some(262180), added: 264655, mode: `Measured`) fn seal_delegate_call() -> Weight { // Proof Size summary in bytes: - // Measured: `1109` - // Estimated: `4574` - // Minimum execution time: 25_423_000 picoseconds. - Weight::from_parts(25_957_000, 4574) + // Measured: `1108` + // Estimated: `4573` + // Minimum execution time: 24_707_000 picoseconds. + Weight::from_parts(25_410_000, 4573) .saturating_add(RocksDbWeight::get().reads(3_u64)) } /// Storage: `Revive::CodeInfoOf` (r:1 w:1) @@ -1821,18 +1782,18 @@ impl WeightInfo for () { /// Storage: `Revive::PristineCode` (r:1 w:0) /// Proof: `Revive::PristineCode` (`max_values`: None, `max_size`: Some(262180), added: 264655, mode: `Measured`) /// Storage: `Revive::ContractInfoOf` (r:1 w:1) - /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(1779), added: 4254, mode: `Measured`) + /// Proof: `Revive::ContractInfoOf` (`max_values`: None, `max_size`: Some(242), added: 2717, mode: `Measured`) /// Storage: `System::Account` (r:1 w:1) /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `Measured`) /// The range of component `i` is `[0, 262144]`. fn seal_instantiate(i: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `1093` - // Estimated: `4571` - // Minimum execution time: 108_874_000 picoseconds. - Weight::from_parts(98_900_023, 4571) + // Measured: `1094` + // Estimated: `4579` + // Minimum execution time: 107_232_000 picoseconds. + Weight::from_parts(94_844_854, 4579) // Standard Error: 10 - .saturating_add(Weight::from_parts(4_183, 0).saturating_mul(i.into())) + .saturating_add(Weight::from_parts(4_159, 0).saturating_mul(i.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -1841,64 +1802,64 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 627_000 picoseconds. - Weight::from_parts(3_385_445, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_419, 0).saturating_mul(n.into())) + // Minimum execution time: 617_000 picoseconds. + Weight::from_parts(3_460_054, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_374, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 262144]`. fn seal_hash_keccak_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 1_035_000 picoseconds. - Weight::from_parts(3_723_700, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(3_637, 0).saturating_mul(n.into())) + // Minimum execution time: 1_040_000 picoseconds. + Weight::from_parts(3_026_644, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(3_607, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 262144]`. fn seal_hash_blake2_256(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 626_000 picoseconds. - Weight::from_parts(2_822_237, 0) + // Minimum execution time: 633_000 picoseconds. + Weight::from_parts(3_375_104, 0) // Standard Error: 2 - .saturating_add(Weight::from_parts(1_552, 0).saturating_mul(n.into())) + .saturating_add(Weight::from_parts(1_494, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 262144]`. fn seal_hash_blake2_128(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 554_000 picoseconds. - Weight::from_parts(3_287_817, 0) - // Standard Error: 3 - .saturating_add(Weight::from_parts(1_542, 0).saturating_mul(n.into())) + // Minimum execution time: 601_000 picoseconds. + Weight::from_parts(3_802_060, 0) + // Standard Error: 2 + .saturating_add(Weight::from_parts(1_493, 0).saturating_mul(n.into())) } /// The range of component `n` is `[0, 261889]`. fn seal_sr25519_verify(n: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 42_532_000 picoseconds. - Weight::from_parts(27_976_517, 0) - // Standard Error: 11 - .saturating_add(Weight::from_parts(5_453, 0).saturating_mul(n.into())) + // Minimum execution time: 42_419_000 picoseconds. + Weight::from_parts(26_760_986, 0) + // Standard Error: 12 + .saturating_add(Weight::from_parts(5_421, 0).saturating_mul(n.into())) } fn seal_ecdsa_recover() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 45_970_000 picoseconds. - Weight::from_parts(47_747_000, 0) + // Minimum execution time: 48_672_000 picoseconds. + Weight::from_parts(49_840_000, 0) } fn seal_ecdsa_to_eth_address() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 12_550_000 picoseconds. - Weight::from_parts(12_706_000, 0) + // Minimum execution time: 12_307_000 picoseconds. + Weight::from_parts(12_500_000, 0) } /// Storage: `Revive::CodeInfoOf` (r:1 w:1) /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) @@ -1906,30 +1867,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `196` // Estimated: `3661` - // Minimum execution time: 10_229_000 picoseconds. - Weight::from_parts(10_530_000, 3661) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - /// Storage: `Revive::CodeInfoOf` (r:1 w:1) - /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `Measured`) - fn lock_delegate_dependency() -> Weight { - // Proof Size summary in bytes: - // Measured: `234` - // Estimated: `3699` - // Minimum execution time: 9_743_000 picoseconds. - Weight::from_parts(10_180_000, 3699) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) - } - /// Storage: `Revive::CodeInfoOf` (r:1 w:1) - /// Proof: `Revive::CodeInfoOf` (`max_values`: None, `max_size`: Some(96), added: 2571, mode: `MaxEncodedLen`) - fn unlock_delegate_dependency() -> Weight { - // Proof Size summary in bytes: - // Measured: `234` - // Estimated: `3561` - // Minimum execution time: 8_717_000 picoseconds. - Weight::from_parts(9_129_000, 3561) + // Minimum execution time: 10_142_000 picoseconds. + Weight::from_parts(10_458_000, 3661) .saturating_add(RocksDbWeight::get().reads(1_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -1938,9 +1877,9 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_332_000 picoseconds. - Weight::from_parts(9_985_610, 0) - // Standard Error: 187 - .saturating_add(Weight::from_parts(73_915, 0).saturating_mul(r.into())) + // Minimum execution time: 7_893_000 picoseconds. + Weight::from_parts(9_362_667, 0) + // Standard Error: 84 + .saturating_add(Weight::from_parts(74_272, 0).saturating_mul(r.into())) } } diff --git a/substrate/frame/revive/uapi/src/host.rs b/substrate/frame/revive/uapi/src/host.rs index 08806f11c9c5..8e14eefc6364 100644 --- a/substrate/frame/revive/uapi/src/host.rs +++ b/substrate/frame/revive/uapi/src/host.rs @@ -621,18 +621,6 @@ pub trait HostFn: private::Sealed { #[unstable_hostfn] fn is_contract(address: &[u8; 20]) -> bool; - /// Lock a new delegate dependency to the contract. - /// - /// Traps if the maximum number of delegate_dependencies is reached or if - /// the delegate dependency already exists. - /// - /// # Parameters - /// - /// - `code_hash`: The code hash of the dependency. Should be decodable as an `T::Hash`. Traps - /// otherwise. - #[unstable_hostfn] - fn lock_delegate_dependency(code_hash: &[u8; 32]); - /// Stores the minimum balance (a.k.a. existential deposit) into the supplied buffer. /// /// # Parameters @@ -723,17 +711,6 @@ pub trait HostFn: private::Sealed { #[unstable_hostfn] fn terminate(beneficiary: &[u8; 20]) -> !; - /// Removes the delegate dependency from the contract. - /// - /// Traps if the delegate dependency does not exist. - /// - /// # Parameters - /// - /// - `code_hash`: The code hash of the dependency. Should be decodable as an `T::Hash`. Traps - /// otherwise. - #[unstable_hostfn] - fn unlock_delegate_dependency(code_hash: &[u8; 32]); - /// Stores the amount of weight left into the supplied buffer. /// The data is encoded as Weight. /// diff --git a/substrate/frame/revive/uapi/src/host/riscv64.rs b/substrate/frame/revive/uapi/src/host/riscv64.rs index 620c2a9e1f5c..588579dc83eb 100644 --- a/substrate/frame/revive/uapi/src/host/riscv64.rs +++ b/substrate/frame/revive/uapi/src/host/riscv64.rs @@ -147,8 +147,6 @@ mod sys { pub fn set_code_hash(code_hash_ptr: *const u8); pub fn ecdsa_to_eth_address(key_ptr: *const u8, out_ptr: *mut u8) -> ReturnCode; pub fn instantiation_nonce() -> u64; - pub fn lock_delegate_dependency(code_hash_ptr: *const u8); - pub fn unlock_delegate_dependency(code_hash_ptr: *const u8); pub fn xcm_execute(msg_ptr: *const u8, msg_len: u32) -> ReturnCode; pub fn xcm_send( dest_ptr: *const u8, @@ -551,11 +549,6 @@ impl HostFn for HostFnImpl { ret_val.into_bool() } - #[unstable_hostfn] - fn lock_delegate_dependency(code_hash: &[u8; 32]) { - unsafe { sys::lock_delegate_dependency(code_hash.as_ptr()) } - } - #[unstable_hostfn] fn minimum_balance(output: &mut [u8; 32]) { unsafe { sys::minimum_balance(output.as_mut_ptr()) } @@ -608,11 +601,6 @@ impl HostFn for HostFnImpl { panic!("terminate does not return"); } - #[unstable_hostfn] - fn unlock_delegate_dependency(code_hash: &[u8; 32]) { - unsafe { sys::unlock_delegate_dependency(code_hash.as_ptr()) } - } - #[unstable_hostfn] fn weight_left(output: &mut &mut [u8]) { let mut output_len = output.len() as u32; diff --git a/substrate/frame/support/src/traits/hooks.rs b/substrate/frame/support/src/traits/hooks.rs index 012a74d0ae92..51209cb54246 100644 --- a/substrate/frame/support/src/traits/hooks.rs +++ b/substrate/frame/support/src/traits/hooks.rs @@ -584,6 +584,10 @@ pub trait BuildGenesisConfig: sp_runtime::traits::MaybeSerializeDeserialize { fn build(&self); } +impl BuildGenesisConfig for () { + fn build(&self) {} +} + /// A trait to define the build function of a genesis config, T and I are placeholder for pallet /// trait and pallet instance. #[deprecated( From 31abe6117f2deed5928816b1606b9a42aab8838d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= Date: Wed, 5 Feb 2025 10:56:28 +0100 Subject: [PATCH 2/2] Remove pallet_revive benchmarks from Westend AssetHub (#7454) We are using the substrate weights on the test net. Removing the benches so that they are not generated by accident and then not used. --- cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index ce2ee8f566e0..bf26f0ff452b 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -1466,7 +1466,6 @@ mod benches { [cumulus_pallet_xcmp_queue, XcmpQueue] [pallet_xcm_bridge_hub_router, ToRococo] [pallet_asset_conversion_ops, AssetConversionMigration] - [pallet_revive, Revive] // XCM [pallet_xcm, PalletXcmExtrinsicsBenchmark::] // NOTE: Make sure you point to the individual modules below.