-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
system.remark
, add weights and remove event
- Loading branch information
Showing
9 changed files
with
161 additions
and
51 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//! Benchmarking for the pallet-history-seeding | ||
|
||
use super::*; | ||
use frame_benchmarking::v2::*; | ||
|
||
#[benchmarks] | ||
mod benchmarks { | ||
use super::*; | ||
use crate::Pallet; | ||
use frame_support::pallet_prelude::*; | ||
use frame_system::RawOrigin; | ||
use sp_std::vec; | ||
|
||
#[benchmark] | ||
fn seed_history( | ||
b: Linear<0, { *T::BlockLength::get().max.get(DispatchClass::Normal) }>, | ||
) -> Result<(), BenchmarkError> { | ||
let remark_message = vec![1; b as usize]; | ||
let seeder: T::AccountId = account("HistorySeeder", 1, 0); | ||
|
||
Pallet::<T>::set_history_seeder(RawOrigin::Root.into(), seeder.clone()).unwrap(); | ||
|
||
#[extrinsic_call] | ||
_(RawOrigin::Signed(seeder), remark_message); | ||
|
||
Ok(()) | ||
} | ||
|
||
#[benchmark] | ||
fn set_history_seeder() { | ||
let seeder = account("HistorySeeder", 1, 0); | ||
#[extrinsic_call] | ||
_(RawOrigin::Root, seeder); | ||
} | ||
|
||
impl_benchmark_test_suite!(Pallet, crate::tests::new_test_ext(), crate::tests::Test); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
|
||
//! Autogenerated weights for pallet_history_seeding | ||
//! | ||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.0 | ||
//! DATE: 2024-09-12, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` | ||
//! WORST CASE MAP SIZE: `1000000` | ||
//! HOSTNAME: `MacBook-Pro.local`, CPU: `<UNKNOWN>` | ||
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 1024 | ||
|
||
// Executed Command: | ||
// /Users/dastansamat/.cargo/target/release/subspace-node | ||
// benchmark | ||
// pallet | ||
// --runtime | ||
// /Users/dastansamat/.cargo/target/release/wbuild/subspace-runtime/subspace_runtime.compact.compressed.wasm | ||
// --steps=50 | ||
// --repeat=20 | ||
// --pallet=pallet_history_seeding | ||
// --extrinsic | ||
// * | ||
// --wasm-execution=compiled | ||
// --heap-pages=4096 | ||
// --output=./crates/pallet-history-seeding/src/weights.rs | ||
// --template | ||
// ./frame-weight-template.hbs | ||
|
||
#![cfg_attr(rustfmt, rustfmt_skip)] | ||
#![allow(unused_parens)] | ||
#![allow(unused_imports)] | ||
|
||
use frame_support::{traits::Get, weights::{Weight, constants::ParityDbWeight}}; | ||
use core::marker::PhantomData; | ||
|
||
/// Weight functions needed for pallet_history_seeding. | ||
pub trait WeightInfo { | ||
fn seed_history(b: u32, ) -> Weight; | ||
fn set_history_seeder() -> Weight; | ||
} | ||
|
||
/// Weights for pallet_history_seeding using the Substrate node and recommended hardware. | ||
pub struct SubstrateWeight<T>(PhantomData<T>); | ||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { | ||
/// Storage: `HistorySeeding::HistorySeeder` (r:1 w:0) | ||
/// Proof: `HistorySeeding::HistorySeeder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) | ||
/// The range of component `b` is `[0, 3932160]`. | ||
fn seed_history(b: u32, ) -> Weight { | ||
// Proof Size summary in bytes: | ||
// Measured: `37` | ||
// Estimated: `1517` | ||
// Minimum execution time: 2_000_000 picoseconds. | ||
Weight::from_parts(2_000_000, 1517) | ||
// Standard Error: 0 | ||
.saturating_add(Weight::from_parts(211, 0).saturating_mul(b.into())) | ||
.saturating_add(T::DbWeight::get().reads(1_u64)) | ||
} | ||
/// Storage: `HistorySeeding::HistorySeeder` (r:0 w:1) | ||
/// Proof: `HistorySeeding::HistorySeeder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) | ||
fn set_history_seeder() -> Weight { | ||
// Proof Size summary in bytes: | ||
// Measured: `0` | ||
// Estimated: `0` | ||
// Minimum execution time: 1_000_000 picoseconds. | ||
Weight::from_parts(2_000_000, 0) | ||
.saturating_add(T::DbWeight::get().writes(1_u64)) | ||
} | ||
} | ||
|
||
// For backwards compatibility and tests | ||
impl WeightInfo for () { | ||
/// Storage: `HistorySeeding::HistorySeeder` (r:1 w:0) | ||
/// Proof: `HistorySeeding::HistorySeeder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) | ||
/// The range of component `b` is `[0, 3932160]`. | ||
fn seed_history(b: u32, ) -> Weight { | ||
// Proof Size summary in bytes: | ||
// Measured: `37` | ||
// Estimated: `1517` | ||
// Minimum execution time: 2_000_000 picoseconds. | ||
Weight::from_parts(2_000_000, 1517) | ||
// Standard Error: 0 | ||
.saturating_add(Weight::from_parts(211, 0).saturating_mul(b.into())) | ||
.saturating_add(ParityDbWeight::get().reads(1_u64)) | ||
} | ||
/// Storage: `HistorySeeding::HistorySeeder` (r:0 w:1) | ||
/// Proof: `HistorySeeding::HistorySeeder` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`) | ||
fn set_history_seeder() -> Weight { | ||
// Proof Size summary in bytes: | ||
// Measured: `0` | ||
// Estimated: `0` | ||
// Minimum execution time: 1_000_000 picoseconds. | ||
Weight::from_parts(2_000_000, 0) | ||
.saturating_add(ParityDbWeight::get().writes(1_u64)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters