-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to update issuance parameters in
pallet-rewards
+ enabl…
…e benchmarking there
- Loading branch information
Showing
9 changed files
with
137 additions
and
30 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,23 @@ | ||
//! Benchmarking for `pallet-rewards`. | ||
|
||
use frame_benchmarking::v2::*; | ||
|
||
#[benchmarks] | ||
mod benchmarks { | ||
use crate::pallet::{ProposerSubsidyParams, VoterSubsidyParams}; | ||
use crate::{Call, Config, IssuanceComponentParams, Pallet}; | ||
use frame_system::RawOrigin; | ||
|
||
#[benchmark] | ||
fn update_issuance_params() { | ||
#[extrinsic_call] | ||
_( | ||
RawOrigin::Root, | ||
IssuanceComponentParams::default(), | ||
IssuanceComponentParams::default(), | ||
); | ||
|
||
assert!(ProposerSubsidyParams::<T>::get().is_some()); | ||
assert!(VoterSubsidyParams::<T>::get().is_some()); | ||
} | ||
} |
This file was deleted.
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,67 @@ | ||
|
||
//! Autogenerated weights for pallet_rewards | ||
//! | ||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev | ||
//! DATE: 2024-02-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` | ||
//! WORST CASE MAP SIZE: `1000000` | ||
//! HOSTNAME: `nazar-pc`, CPU: `13th Gen Intel(R) Core(TM) i9-13900K` | ||
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 | ||
|
||
// Executed Command: | ||
// target/release/subspace-node | ||
// benchmark | ||
// pallet | ||
// --chain=dev | ||
// --steps=50 | ||
// --repeat=20 | ||
// --pallet=pallet_rewards | ||
// --extrinsic=* | ||
// --heap-pages=4096 | ||
// --output=crates/pallet-rewards/src/weights.rs | ||
// --template=frame-weight-template.hbs | ||
|
||
#![cfg_attr(rustfmt, rustfmt_skip)] | ||
#![allow(unused_parens)] | ||
#![allow(unused_imports)] | ||
#![allow(missing_debug_implementations)] | ||
|
||
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; | ||
use core::marker::PhantomData; | ||
|
||
/// Weight functions needed for pallet_rewards. | ||
pub trait WeightInfo { | ||
fn update_issuance_params() -> Weight; | ||
} | ||
|
||
/// Weights for pallet_rewards using the Substrate node and recommended hardware. | ||
pub struct SubstrateWeight<T>(PhantomData<T>); | ||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { | ||
/// Storage: `Rewards::VoterSubsidyParams` (r:0 w:1) | ||
/// Proof: `Rewards::VoterSubsidyParams` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) | ||
/// Storage: `Rewards::ProposerSubsidyParams` (r:0 w:1) | ||
/// Proof: `Rewards::ProposerSubsidyParams` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) | ||
fn update_issuance_params() -> Weight { | ||
// Proof Size summary in bytes: | ||
// Measured: `0` | ||
// Estimated: `0` | ||
// Minimum execution time: 4_198_000 picoseconds. | ||
Weight::from_parts(4_351_000, 0) | ||
.saturating_add(T::DbWeight::get().writes(2_u64)) | ||
} | ||
} | ||
|
||
// For backwards compatibility and tests | ||
impl WeightInfo for () { | ||
/// Storage: `Rewards::VoterSubsidyParams` (r:0 w:1) | ||
/// Proof: `Rewards::VoterSubsidyParams` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) | ||
/// Storage: `Rewards::ProposerSubsidyParams` (r:0 w:1) | ||
/// Proof: `Rewards::ProposerSubsidyParams` (`max_values`: Some(1), `max_size`: Some(40), added: 535, mode: `MaxEncodedLen`) | ||
fn update_issuance_params() -> Weight { | ||
// Proof Size summary in bytes: | ||
// Measured: `0` | ||
// Estimated: `0` | ||
// Minimum execution time: 4_198_000 picoseconds. | ||
Weight::from_parts(4_351_000, 0) | ||
.saturating_add(RocksDbWeight::get().writes(2_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