git.delta.rocks / unique-network / refs/commits / 07a293d2e35e

difftreelog

ci upgrade weight template

Yaroslav Bolyukin2023-04-17parent: #f1240ae.patch.diff
in: master

1 file changed

modified.maintain/frame-weight-template.hbsdiffbeforeafterboth
before · .maintain/frame-weight-template.hbs
1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for {{pallet}}4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}}6//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: {{cmd.repeat}}, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}`7//! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}`8//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}}910// Executed Command:11{{#each args as |arg|}}12// {{arg}}13{{/each}}1415#![cfg_attr(rustfmt, rustfmt_skip)]16#![allow(unused_parens)]17#![allow(unused_imports)]18#![allow(missing_docs)]19#![allow(clippy::unnecessary_cast)]2021use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};22use sp_std::marker::PhantomData;2324/// Weight functions needed for {{pallet}}.25pub trait WeightInfo {26	{{#each benchmarks as |benchmark|}}27	fn {{benchmark.name~}}28	(29		{{~#each benchmark.components as |c| ~}}30		{{c.name}}: u32, {{/each~}}31	) -> Weight;32	{{/each}}33}3435/// Weights for {{pallet}} using the Substrate node and recommended hardware.36pub struct SubstrateWeight<T>(PhantomData<T>);37{{#if (eq pallet "frame_system")}}38impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {39{{else}}40impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {41{{/if}}42	{{#each benchmarks as |benchmark|}}43	{{#each benchmark.comments as |comment|}}44	/// {{comment}}45	{{/each}}46	{{#each benchmark.component_ranges as |range|}}47	/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.48	{{/each}}49	fn {{benchmark.name~}}50	(51		{{~#each benchmark.components as |c| ~}}52		{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}53	) -> Weight {54		// Proof Size summary in bytes:55		//  Measured:  `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`56		//  Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`57		// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.58		Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})59			{{#each benchmark.component_weight as |cw|}}60			// Standard Error: {{underscore cw.error}}61			.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))62			{{/each}}63			{{#if (ne benchmark.base_reads "0")}}64			.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64))65			{{/if}}66			{{#each benchmark.component_reads as |cr|}}67			.saturating_add(T::DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))68			{{/each}}69			{{#if (ne benchmark.base_writes "0")}}70			.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}_u64))71			{{/if}}72			{{#each benchmark.component_writes as |cw|}}73			.saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))74			{{/each}}75			{{#each benchmark.component_calculated_proof_size as |cp|}}76			.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))77			{{/each}}78	}79	{{/each}}80}8182// For backwards compatibility and tests83impl WeightInfo for () {84	{{#each benchmarks as |benchmark|}}85	{{#each benchmark.comments as |comment|}}86	/// {{comment}}87	{{/each}}88	{{#each benchmark.component_ranges as |range|}}89	/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.90	{{/each}}91	fn {{benchmark.name~}}92	(93		{{~#each benchmark.components as |c| ~}}94		{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}95	) -> Weight {96		// Proof Size summary in bytes:97		//  Measured:  `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`98		//  Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`99		// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.100		Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})101			{{#each benchmark.component_weight as |cw|}}102			// Standard Error: {{underscore cw.error}}103			.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))104			{{/each}}105			{{#if (ne benchmark.base_reads "0")}}106			.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64))107			{{/if}}108			{{#each benchmark.component_reads as |cr|}}109			.saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))110			{{/each}}111			{{#if (ne benchmark.base_writes "0")}}112			.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64))113			{{/if}}114			{{#each benchmark.component_writes as |cw|}}115			.saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))116			{{/each}}117			{{#each benchmark.component_calculated_proof_size as |cp|}}118			.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))119			{{/each}}120	}121	{{/each}}122}123