diff --git a/frame/datalog/src/lib.rs b/frame/datalog/src/lib.rs index 0bfa27c4..70c484f2 100644 --- a/frame/datalog/src/lib.rs +++ b/frame/datalog/src/lib.rs @@ -26,7 +26,7 @@ pub use weights::WeightInfo; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; -mod weights; +pub mod weights; #[frame_support::pallet] #[allow(clippy::module_inception)] @@ -126,7 +126,7 @@ pub mod pallet { } /// Clear account datalog. - #[pallet::weight(T::WeightInfo::erase(T::WindowSize::get()))] + #[pallet::weight(T::WeightInfo::erase())] #[pallet::call_index(1)] pub fn erase(origin: OriginFor) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; @@ -142,7 +142,7 @@ pub mod pallet { } Self::deposit_event(Event::Erased(sender)); - Ok(Some(T::WeightInfo::erase(count)).into()) + Ok(().into()) } } diff --git a/frame/datalog/src/weights.rs b/frame/datalog/src/weights.rs index c1aa27da..010f4378 100644 --- a/frame/datalog/src/weights.rs +++ b/frame/datalog/src/weights.rs @@ -1,33 +1,73 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright 2018-2024 Robonomics Network -// -// 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. -// -/////////////////////////////////////////////////////////////////////////////// -use frame_support::weights::Weight; +//! Autogenerated weights for `robonomics_datalog` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2025-03-11, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `MacBookAir.sknt.ru`, CPU: `` +//! EXECUTION: ``, WASM-EXECUTION: `Compiled`, CHAIN: `Some("dev")`, DB CACHE: 1024 +// Executed Command: +// ./target/release/robonomics +// benchmark +// pallet +// --chain +// dev +// --pallet +// robonomics_datalog +// --extrinsic +// * +// --steps +// 20 +// --repeat +// 10 +// --output +// ./frame/datalog/src/weights.rs + +#![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. pub trait WeightInfo { - fn record() -> Weight; - fn erase(win: u64) -> Weight; + fn record() -> Weight; + fn erase() -> Weight; } -impl WeightInfo for () { - fn record() -> Weight { - Default::default() - } - - fn erase(_win: u64) -> Weight { - Default::default() - } +/// Weight functions for `robonomics_datalog`. +pub struct RobonomicsWeight(PhantomData); +impl WeightInfo for RobonomicsWeight { + /// Storage: `Timestamp::Now` (r:1 w:0) + /// Proof: `Timestamp::Now` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`) + /// Storage: `Datalog::DatalogIndex` (r:1 w:1) + /// Proof: `Datalog::DatalogIndex` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Datalog::DatalogItem` (r:0 w:1) + /// Proof: `Datalog::DatalogItem` (`max_values`: None, `max_size`: Some(570), added: 3045, mode: `MaxEncodedLen`) + fn record() -> Weight { + // Proof Size summary in bytes: + // Measured: `148` + // Estimated: `3521` + // Minimum execution time: 15_000_000 picoseconds. + Weight::from_parts(16_000_000, 0) + .saturating_add(Weight::from_parts(0, 3521)) + .saturating_add(T::DbWeight::get().reads(2)) + .saturating_add(T::DbWeight::get().writes(2)) + } + /// Storage: `Datalog::DatalogIndex` (r:1 w:1) + /// Proof: `Datalog::DatalogIndex` (`max_values`: None, `max_size`: Some(56), added: 2531, mode: `MaxEncodedLen`) + /// Storage: `Datalog::DatalogItem` (r:0 w:127) + /// Proof: `Datalog::DatalogItem` (`max_values`: None, `max_size`: Some(570), added: 3045, mode: `MaxEncodedLen`) + fn erase() -> Weight { + // Proof Size summary in bytes: + // Measured: `106` + // Estimated: `3521` + // Minimum execution time: 168_000_000 picoseconds. + Weight::from_parts(172_000_000, 0) + .saturating_add(Weight::from_parts(0, 3521)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(128)) + } } diff --git a/runtime/dev/src/lib.rs b/runtime/dev/src/lib.rs index a1e21bcd..b04108da 100644 --- a/runtime/dev/src/lib.rs +++ b/runtime/dev/src/lib.rs @@ -572,7 +572,7 @@ impl pallet_robonomics_datalog::Config for Runtime { type Record = BoundedVec; type RuntimeEvent = RuntimeEvent; type WindowSize = WindowSize; - type WeightInfo = (); + type WeightInfo = pallet_robonomics_datalog::weights::RobonomicsWeight; } impl pallet_robonomics_launch::Config for Runtime {