-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
256 audit pdm 006 add weight charging to chain extension calls (#280)
* add placeholder weights to chain extensions * update weights * fix issues and generate weights * fix tests * remove trace, shorten allowance weight info
- Loading branch information
1 parent
0f6cbb5
commit 5b922a2
Showing
7 changed files
with
213 additions
and
56 deletions.
There are no files selected for viewing
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
99 changes: 58 additions & 41 deletions
99
pallets/orml-currencies-allowance-extension/src/default_weights.rs
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 |
---|---|---|
@@ -1,67 +1,84 @@ | ||
|
||
//! Autogenerated weights for orml_currencies_allowance_extension | ||
//! Autogenerated weights for `orml_currencies_allowance_extension` | ||
//! | ||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev | ||
//! DATE: 2023-03-20, STEPS: `100`, REPEAT: 10, LOW RANGE: `[]`, HIGH RANGE: `[]` | ||
//! HOSTNAME: `MacBook-Pro`, CPU: `<UNKNOWN>` | ||
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 | ||
//! DATE: 2023-07-18, STEPS: `100`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]` | ||
//! WORST CASE MAP SIZE: `1000000` | ||
//! HOSTNAME: `Hugos-MacBook-Pro.local`, CPU: `<UNKNOWN>` | ||
//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: Some("foucoco"), DB CACHE: 1024 | ||
|
||
// Executed Command: | ||
// ./target/release/spacewalk-standalone | ||
// ./target/release/pendulum-node | ||
// benchmark | ||
// pallet | ||
// --chain=dev | ||
// --chain=foucoco | ||
// --pallet=orml-currencies-allowance-extension | ||
// --extrinsic=* | ||
// --steps=100 | ||
// --repeat=10 | ||
// --wasm-execution=compiled | ||
// --output=pallets/default_weights.rs | ||
// --template=./.maintain/frame-weight-template.hbs | ||
// --output=pallets/orml-currencies-allowance-extension/src/default_weights.rs | ||
|
||
#![cfg_attr(rustfmt, rustfmt_skip)] | ||
#![allow(unused_parens)] | ||
#![allow(unused_imports)] | ||
#![allow(clippy::unnecessary_cast)] | ||
|
||
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; | ||
use frame_support::{traits::Get, weights::Weight}; | ||
use sp_std::marker::PhantomData; | ||
|
||
/// Weight functions needed for orml_currencies_allowance_extension. | ||
pub trait WeightInfo { | ||
fn add_allowed_currencies() -> Weight; | ||
fn remove_allowed_currencies() -> Weight; | ||
} | ||
|
||
/// Weights for orml_currencies_allowance_extension using the Substrate node and recommended hardware. | ||
pub struct SubstrateWeight<T>(PhantomData<T>); | ||
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> { | ||
// Storage: TokenAllowance AllowedCurrencies (r:0 w:1) | ||
/// Weight functions for `orml_currencies_allowance_extension`. | ||
pub struct WeightInfo<T>(PhantomData<T>); | ||
impl<T: frame_system::Config> crate::WeightInfo for WeightInfo<T> { | ||
/// Storage: TokenAllowance AllowedCurrencies (r:0 w:1) | ||
/// Proof Skipped: TokenAllowance AllowedCurrencies (max_values: None, max_size: None, mode: Measured) | ||
fn add_allowed_currencies() -> Weight { | ||
// Minimum execution time: 12_000 nanoseconds. | ||
Weight::from_parts(14_000_000 as u64, 0) | ||
.saturating_add(T::DbWeight::get().writes(1 as u64)) | ||
// Proof Size summary in bytes: | ||
// Measured: `0` | ||
// Estimated: `0` | ||
// Minimum execution time: 5_000_000 picoseconds. | ||
Weight::from_parts(6_000_000, 0) | ||
.saturating_add(Weight::from_parts(0, 0)) | ||
.saturating_add(T::DbWeight::get().writes(1)) | ||
} | ||
// Storage: TokenAllowance AllowedCurrencies (r:0 w:1) | ||
/// Storage: TokenAllowance AllowedCurrencies (r:0 w:1) | ||
/// Proof Skipped: TokenAllowance AllowedCurrencies (max_values: None, max_size: None, mode: Measured) | ||
fn remove_allowed_currencies() -> Weight { | ||
// Minimum execution time: 31_000 nanoseconds. | ||
Weight::from_parts(32_000_000 as u64, 0) | ||
.saturating_add(T::DbWeight::get().writes(1 as u64)) | ||
// Proof Size summary in bytes: | ||
// Measured: `0` | ||
// Estimated: `0` | ||
// Minimum execution time: 5_000_000 picoseconds. | ||
Weight::from_parts(6_000_000, 0) | ||
.saturating_add(Weight::from_parts(0, 0)) | ||
.saturating_add(T::DbWeight::get().writes(1)) | ||
} | ||
} | ||
|
||
// For backwards compatibility and tests | ||
impl WeightInfo for () { | ||
// Storage: TokenAllowance AllowedCurrencies (r:0 w:1) | ||
fn add_allowed_currencies() -> Weight { | ||
// Minimum execution time: 12_000 nanoseconds. | ||
Weight::from_parts(14_000_000 as u64, 0) | ||
.saturating_add(RocksDbWeight::get().writes(1 as u64)) | ||
/// Storage: TokenAllowance AllowedCurrencies (r:1 w:0) | ||
/// Proof Skipped: TokenAllowance AllowedCurrencies (max_values: None, max_size: None, mode: Measured) | ||
/// Storage: TokenAllowance Approvals (r:1 w:1) | ||
/// Proof Skipped: TokenAllowance Approvals (max_values: None, max_size: None, mode: Measured) | ||
fn approve() -> Weight { | ||
// Proof Size summary in bytes: | ||
// Measured: `184` | ||
// Estimated: `7298` | ||
// Minimum execution time: 11_000_000 picoseconds. | ||
Weight::from_parts(12_000_000, 0) | ||
.saturating_add(Weight::from_parts(0, 7298)) | ||
.saturating_add(T::DbWeight::get().reads(2)) | ||
.saturating_add(T::DbWeight::get().writes(1)) | ||
} | ||
// Storage: TokenAllowance AllowedCurrencies (r:0 w:1) | ||
fn remove_allowed_currencies() -> Weight { | ||
// Minimum execution time: 31_000 nanoseconds. | ||
Weight::from_parts(32_000_000 as u64, 0) | ||
.saturating_add(RocksDbWeight::get().writes(1 as u64)) | ||
/// Storage: TokenAllowance AllowedCurrencies (r:1 w:0) | ||
/// Proof Skipped: TokenAllowance AllowedCurrencies (max_values: None, max_size: None, mode: Measured) | ||
/// Storage: TokenAllowance Approvals (r:1 w:1) | ||
/// Proof Skipped: TokenAllowance Approvals (max_values: None, max_size: None, mode: Measured) | ||
/// Storage: System Account (r:2 w:2) | ||
/// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) | ||
fn transfer_from() -> Weight { | ||
// Proof Size summary in bytes: | ||
// Measured: `561` | ||
// Estimated: `14248` | ||
// Minimum execution time: 29_000_000 picoseconds. | ||
Weight::from_parts(30_000_000, 0) | ||
.saturating_add(Weight::from_parts(0, 14248)) | ||
.saturating_add(T::DbWeight::get().reads(4)) | ||
.saturating_add(T::DbWeight::get().writes(3)) | ||
} | ||
} |
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
Oops, something went wrong.