Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Update template to remove clippy warnings #12670

Merged
merged 14 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .maintain/frame-weight-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
// Minimum execution time: {{underscore benchmark.min_execution_time}} nanoseconds.
Weight::from_ref_time({{underscore benchmark.base_weight}} as u64)
Weight::from_ref_time({{underscore benchmark.base_weight}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_ref_time({{underscore cw.slope}} as u64).saturating_mul({{cw.name}} as u64))
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}} as u64))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as u64))
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as u64).saturating_mul({{cr.name}} as u64)))
.saturating_add(T::DbWeight::get().reads(({{cr.slope}}).saturating_mul({{cr.name}} as u64)))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as u64))
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as u64).saturating_mul({{cw.name}} as u64)))
.saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}} as u64)))
bkchr marked this conversation as resolved.
Show resolved Hide resolved
{{/each}}
}
{{/each}}
Expand Down
69 changes: 35 additions & 34 deletions frame/lottery/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,25 @@
//! Autogenerated weights for pallet_lottery
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-11-07, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! DATE: 2022-11-10, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024

// Executed Command:
// ./target/production/substrate
// /home/benchbot/cargo_target_dir/production/substrate
// benchmark
// pallet
// --chain=dev
// --steps=50
// --repeat=20
// --pallet=pallet_lottery
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --output=./frame/lottery/src/weights.rs
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/substrate/.git/.artifacts/bench.json
// --pallet=pallet_lottery
// --chain=dev
// --header=./HEADER-APACHE2
// --output=./frame/lottery/src/weights.rs
// --template=./.maintain/frame-weight-template.hbs

#![cfg_attr(rustfmt, rustfmt_skip)]
Expand Down Expand Up @@ -66,33 +67,33 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Account (r:1 w:1)
// Storage: Lottery Tickets (r:0 w:1)
fn buy_ticket() -> Weight {
// Minimum execution time: 52_451 nanoseconds.
Weight::from_ref_time(52_843_000 as u64)
// Minimum execution time: 51_817 nanoseconds.
Weight::from_ref_time(52_360_000 as u64)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(4 as u64))
}
// Storage: Lottery CallIndices (r:0 w:1)
/// The range of component `n` is `[0, 10]`.
fn set_calls(n: u32, ) -> Weight {
// Minimum execution time: 14_389 nanoseconds.
Weight::from_ref_time(15_700_569 as u64)
// Standard Error: 4_677
.saturating_add(Weight::from_ref_time(296_850 as u64).saturating_mul(n as u64))
// Minimum execution time: 13_800 nanoseconds.
Weight::from_ref_time(15_261_461 as u64)
// Standard Error: 6_044
.saturating_add(Weight::from_ref_time(295_476 as u64).saturating_mul(n as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Lottery Lottery (r:1 w:1)
// Storage: Lottery LotteryIndex (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn start_lottery() -> Weight {
// Minimum execution time: 44_814 nanoseconds.
Weight::from_ref_time(45_611_000 as u64)
// Minimum execution time: 43_195 nanoseconds.
Weight::from_ref_time(43_992_000 as u64)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
// Storage: Lottery Lottery (r:1 w:1)
fn stop_repeat() -> Weight {
// Minimum execution time: 10_384 nanoseconds.
Weight::from_ref_time(10_727_000 as u64)
// Minimum execution time: 9_958 nanoseconds.
Weight::from_ref_time(10_227_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
Expand All @@ -102,8 +103,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Lottery TicketsCount (r:1 w:1)
// Storage: Lottery Tickets (r:1 w:0)
fn on_initialize_end() -> Weight {
// Minimum execution time: 62_720 nanoseconds.
Weight::from_ref_time(63_545_000 as u64)
// Minimum execution time: 59_482 nanoseconds.
Weight::from_ref_time(60_357_000 as u64)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(4 as u64))
}
Expand All @@ -114,8 +115,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Lottery Tickets (r:1 w:0)
// Storage: Lottery LotteryIndex (r:1 w:1)
fn on_initialize_repeat() -> Weight {
// Minimum execution time: 63_452 nanoseconds.
Weight::from_ref_time(65_010_000 as u64)
// Minimum execution time: 60_147 nanoseconds.
Weight::from_ref_time(60_773_000 as u64)
.saturating_add(T::DbWeight::get().reads(7 as u64))
.saturating_add(T::DbWeight::get().writes(5 as u64))
}
Expand All @@ -131,33 +132,33 @@ impl WeightInfo for () {
// Storage: System Account (r:1 w:1)
// Storage: Lottery Tickets (r:0 w:1)
fn buy_ticket() -> Weight {
// Minimum execution time: 52_451 nanoseconds.
Weight::from_ref_time(52_843_000 as u64)
// Minimum execution time: 51_817 nanoseconds.
Weight::from_ref_time(52_360_000 as u64)
.saturating_add(RocksDbWeight::get().reads(6 as u64))
.saturating_add(RocksDbWeight::get().writes(4 as u64))
}
// Storage: Lottery CallIndices (r:0 w:1)
/// The range of component `n` is `[0, 10]`.
fn set_calls(n: u32, ) -> Weight {
// Minimum execution time: 14_389 nanoseconds.
Weight::from_ref_time(15_700_569 as u64)
// Standard Error: 4_677
.saturating_add(Weight::from_ref_time(296_850 as u64).saturating_mul(n as u64))
// Minimum execution time: 13_800 nanoseconds.
Weight::from_ref_time(15_261_461 as u64)
// Standard Error: 6_044
.saturating_add(Weight::from_ref_time(295_476 as u64).saturating_mul(n as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
// Storage: Lottery Lottery (r:1 w:1)
// Storage: Lottery LotteryIndex (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn start_lottery() -> Weight {
// Minimum execution time: 44_814 nanoseconds.
Weight::from_ref_time(45_611_000 as u64)
// Minimum execution time: 43_195 nanoseconds.
Weight::from_ref_time(43_992_000 as u64)
.saturating_add(RocksDbWeight::get().reads(3 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
// Storage: Lottery Lottery (r:1 w:1)
fn stop_repeat() -> Weight {
// Minimum execution time: 10_384 nanoseconds.
Weight::from_ref_time(10_727_000 as u64)
// Minimum execution time: 9_958 nanoseconds.
Weight::from_ref_time(10_227_000 as u64)
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
Expand All @@ -167,8 +168,8 @@ impl WeightInfo for () {
// Storage: Lottery TicketsCount (r:1 w:1)
// Storage: Lottery Tickets (r:1 w:0)
fn on_initialize_end() -> Weight {
// Minimum execution time: 62_720 nanoseconds.
Weight::from_ref_time(63_545_000 as u64)
// Minimum execution time: 59_482 nanoseconds.
Weight::from_ref_time(60_357_000 as u64)
.saturating_add(RocksDbWeight::get().reads(6 as u64))
.saturating_add(RocksDbWeight::get().writes(4 as u64))
}
Expand All @@ -179,8 +180,8 @@ impl WeightInfo for () {
// Storage: Lottery Tickets (r:1 w:0)
// Storage: Lottery LotteryIndex (r:1 w:1)
fn on_initialize_repeat() -> Weight {
// Minimum execution time: 63_452 nanoseconds.
Weight::from_ref_time(65_010_000 as u64)
// Minimum execution time: 60_147 nanoseconds.
Weight::from_ref_time(60_773_000 as u64)
.saturating_add(RocksDbWeight::get().reads(7 as u64))
.saturating_add(RocksDbWeight::get().writes(5 as u64))
}
Expand Down
12 changes: 6 additions & 6 deletions utils/frame/benchmarking-cli/src/pallet/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ impl<T: frame_system::Config> {{pallet}}::WeightInfo for WeightInfo<T> {
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
// Minimum execution time: {{underscore benchmark.min_execution_time}} nanoseconds.
Weight::from_ref_time({{underscore benchmark.base_weight}} as u64)
Weight::from_ref_time({{underscore benchmark.base_weight}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_ref_time({{underscore cw.slope}} as u64).saturating_mul({{cw.name}} as u64))
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}} as u64))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as u64))
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as u64).saturating_mul({{cr.name}} as u64)))
.saturating_add(T::DbWeight::get().reads(({{cr.slope}}).saturating_mul({{cr.name}} as u64)))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as u64))
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as u64).saturating_mul({{cw.name}} as u64)))
.saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}} as u64)))
{{/each}}
}
{{/each}}
Expand Down