mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 08:11:04 +00:00
Constant Weight Signature in Benchmarking CLI (#7233)
* Don't remove unused components * add more metadata to generated file * unused code * proposed format * Revert "proposed format" This reverts commit ce522c3480157ab6670bcbd9b17e1398168cabf4. * Update weight signatures and unused components in benchmarks * Keep timestamp constant time * remove component from as_derivative
This commit is contained in:
@@ -33,7 +33,7 @@ benchmarks! {
|
||||
_ { }
|
||||
|
||||
set {
|
||||
let t in 1 .. MAX_TIME;
|
||||
let t = MAX_TIME;
|
||||
// Ignore write to `DidUpdate` since it transient.
|
||||
let did_update_key = crate::DidUpdate::hashed_key().to_vec();
|
||||
frame_benchmarking::benchmarking::add_to_whitelist(TrackedStorageKey {
|
||||
@@ -47,7 +47,7 @@ benchmarks! {
|
||||
}
|
||||
|
||||
on_finalize {
|
||||
let t in 1 .. MAX_TIME;
|
||||
let t = MAX_TIME;
|
||||
Timestamp::<T>::set(RawOrigin::None.into(), t.into())?;
|
||||
ensure!(DidUpdate::exists(), "Time was not set.");
|
||||
// Ignore read/write to `DidUpdate` since it is transient.
|
||||
|
||||
@@ -22,13 +22,11 @@
|
||||
use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight};
|
||||
|
||||
impl crate::WeightInfo for () {
|
||||
// WARNING! Some components were not used: ["t"]
|
||||
fn set() -> Weight {
|
||||
(9133000 as Weight)
|
||||
.saturating_add(DbWeight::get().reads(2 as Weight))
|
||||
.saturating_add(DbWeight::get().writes(1 as Weight))
|
||||
}
|
||||
// WARNING! Some components were not used: ["t"]
|
||||
fn on_finalize() -> Weight {
|
||||
(5915000 as Weight)
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ use frame_support::{
|
||||
use sp_runtime::{
|
||||
RuntimeString,
|
||||
traits::{
|
||||
AtLeast32Bit, Zero, SaturatedConversion, Scale
|
||||
AtLeast32Bit, Zero, SaturatedConversion, Scale,
|
||||
}
|
||||
};
|
||||
use frame_system::ensure_none;
|
||||
@@ -159,9 +159,9 @@ decl_module! {
|
||||
/// The dispatch origin for this call must be `Inherent`.
|
||||
///
|
||||
/// # <weight>
|
||||
/// - `O(T)` where `T` complexity of `on_timestamp_set`
|
||||
/// - `O(1)` (Note that implementations of `OnTimestampSet` must also be `O(1)`)
|
||||
/// - 1 storage read and 1 storage mutation (codec `O(1)`). (because of `DidUpdate::take` in `on_finalize`)
|
||||
/// - 1 event handler `on_timestamp_set` `O(T)`.
|
||||
/// - 1 event handler `on_timestamp_set`. Must be `O(1)`.
|
||||
/// # </weight>
|
||||
#[weight = (
|
||||
T::WeightInfo::set(),
|
||||
|
||||
Reference in New Issue
Block a user