Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarks Fund admin pallet #44

Merged
merged 41 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5a3978d
- Created a new file `benchmarking.rs` with skeleton structure that w…
didiermis Mar 25, 2024
bdfb04b
- Added ./pallets/fund-admin/Cargo.toml to rust-analyzer linked proje…
didiermis Apr 1, 2024
7c0cafd
Updated pallet_fund_admin::Config implementation in mock.rs to use pa…
didiermis Apr 1, 2024
089044d
- Updated source URLs in Cargo.lock to use git protocol instead of ht…
didiermis Apr 1, 2024
e36ce77
- Adjusted new_test_ext() function in mock.rs to remove an unnecessar…
didiermis Apr 1, 2024
0cae64e
Added benchmark tests for the initial_setup, sudo_add_administrator, …
didiermis Apr 1, 2024
5f3645d
Fixed import formatting in the tests module of the fund-admin pallet.…
didiermis Apr 1, 2024
7f56909
- Added functions to generate a batch of users and initialize the pal…
didiermis Apr 2, 2024
5a7762c
- Unused imports such as use frame_support::{parameter_types, traits:…
didiermis Apr 2, 2024
b71887b
A new conditional compilation block (#[cfg(feature = "runtime-benchma…
didiermis Apr 2, 2024
941a6e3
Revised benchmarking code in benchmarking.rs for the create_array_use…
didiermis Apr 2, 2024
3f6ee72
Introduced the users_edit_user benchmark function to test editing use…
didiermis Apr 2, 2024
af545a2
Updated the benchmarking code in benchmarking.rs for the generate_doc…
didiermis Apr 3, 2024
8daf7c9
Updated the benchmarking code in benchmarking.rs to include a new fun…
didiermis Apr 3, 2024
0ebcffe
pdated the benchmarking code in benchmarking.rs to refactor the user …
didiermis Apr 3, 2024
63409c8
Added new functions create_basic_project and create_full_project to c…
didiermis Apr 3, 2024
d1b7692
Added benchmarking function projects_delete_project to test the proje…
didiermis Apr 3, 2024
32edca0
Added benchmarking function projects_assign_user to test the projects…
didiermis Apr 3, 2024
68e5874
- Updated create_array_expenditures function to accept an expenditure…
didiermis Apr 3, 2024
fe241ea
Enhanced the Fund Admin pallet benchmarking function to include drawd…
didiermis Apr 4, 2024
5b57bd7
Enhanced the Fund Admin pallet benchmarking function with more compre…
didiermis Apr 4, 2024
f38d4c7
Updated format
didiermis Apr 4, 2024
e8c508a
Implemented enhancements in the benchmarking module of the Fund Admin…
didiermis Apr 4, 2024
0b0ac66
Added a new benchmark 'up_bulkupload' to the Fund Admin pallet. This …
didiermis Apr 4, 2024
46e2e1f
Extended the benchmarking module for the Fund Admin pallet by adding …
didiermis Apr 4, 2024
8bad448
Increased the benchmarking functionality for the Fund Admin pallet by…
didiermis Apr 4, 2024
2ad7323
Added a new benchmark test for the `approve_revenue` function in the …
didiermis Apr 4, 2024
005c708
Added the benchmark test `reject_revenue` in the Fund Admin pallet wh…
didiermis Apr 4, 2024
7dbe6bd
Reformatted the structure of `transaction` and `revenue_transaction` …
didiermis Apr 4, 2024
ce09abf
Introduced a new benchmark test function `reset_drawdown`. This funct…
didiermis Apr 4, 2024
8fcd2c1
Added a new benchmark test function `recovery_drawdown`. This functio…
didiermis Apr 4, 2024
ec9aef3
Altered the `create_full_project` test data function to create two jo…
didiermis Apr 4, 2024
dc1fc2a
Reformatted a couple of lines in the `recovery_drawdown` and `recover…
didiermis Apr 4, 2024
ca60b2f
Refactored the `create_array_users` function in the fund-admin pallet…
didiermis Apr 5, 2024
6cce738
Refactored the `create_array_job_eligibles` function in the fund-admi…
didiermis Apr 5, 2024
880610b
Refactored the `reject_drawdown` function in the fund-admin benchmark…
didiermis Apr 5, 2024
b64d6b3
Updated the `reject_revenue` benchmark function in the fund-admin ben…
didiermis Apr 5, 2024
33335fb
Added bound to the fund-admin benchmarks to allow for u64 balances.
sebastianmontero Apr 9, 2024
b2c3a40
Simplified fund-admin benchmarks
Dreyhh Apr 17, 2024
06ade91
Merge branch 'feature/benchmarks' into feature/benchmark/fund-admin
Dreyhh Apr 17, 2024
76bc2dc
Generated weights file for fund-admin pallet, updated fund-admin extr…
Dreyhh Apr 19, 2024
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
52 changes: 33 additions & 19 deletions .maintain/frame-weight-template.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{header}}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 9c9e29 - ecd384:
Error: couldn't generate summary

//! Autogenerated weights for {{pallet}}
//! Autogenerated weights for `{{pallet}}`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}}
//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: {{cmd.repeat}}, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}`
//! DATE: {{date}}, STEPS: `{{cmd.steps}}`, REPEAT: `{{cmd.repeat}}`, LOW RANGE: `{{cmd.lowest_range_values}}`, HIGH RANGE: `{{cmd.highest_range_values}}`
//! WORST CASE MAP SIZE: `{{cmd.worst_case_map_values}}`
//! HOSTNAME: `{{hostname}}`, CPU: `{{cpuname}}`
//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}}
//! WASM-EXECUTION: `{{cmd.wasm_execution}}`, CHAIN: `{{cmd.chain}}`, DB CACHE: `{{cmd.db_cache}}`

// Executed Command:
{{#each args as |arg|}}
Expand All @@ -14,11 +15,12 @@
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
use core::marker::PhantomData;

/// Weight functions needed for {{pallet}}.
/// Weight functions needed for `{{pallet}}`.
pub trait WeightInfo {
{{#each benchmarks as |benchmark|}}
fn {{benchmark.name~}}
Expand All @@ -29,7 +31,7 @@ pub trait WeightInfo {
{{/each}}
}

/// Weights for {{pallet}} using the Substrate node and recommended hardware.
/// Weights for `{{pallet}}` using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
{{#if (eq pallet "frame_system")}}
impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
Expand All @@ -38,7 +40,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{/if}}
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
// {{comment}}
/// {{comment}}
{{/each}}
{{#each benchmark.component_ranges as |range|}}
/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.
Expand All @@ -48,33 +50,39 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{~#each benchmark.components as |c| ~}}
{{~#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}})
// Proof Size summary in bytes:
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into()))
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}))
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}}_u64))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}))
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}}_u64))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
{{/each}}
{{#each benchmark.component_calculated_proof_size as |cp|}}
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
{{/each}}
}
{{/each}}
}

// For backwards compatibility and tests
// For backwards compatibility and tests.
impl WeightInfo for () {
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
// {{comment}}
/// {{comment}}
{{/each}}
{{#each benchmark.component_ranges as |range|}}
/// The range of component `{{range.name}}` is `[{{range.min}}, {{range.max}}]`.
Expand All @@ -84,24 +92,30 @@ impl WeightInfo for () {
{{~#each benchmark.components as |c| ~}}
{{~#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}})
// Proof Size summary in bytes:
// Measured: `{{benchmark.base_recorded_proof_size}}{{#each benchmark.component_recorded_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Estimated: `{{benchmark.base_calculated_proof_size}}{{#each benchmark.component_calculated_proof_size as |cp|}} + {{cp.name}} * ({{cp.slope}} ±{{underscore cp.error}}){{/each}}`
// Minimum execution time: {{underscore benchmark.min_execution_time}}_000 picoseconds.
Weight::from_parts({{underscore benchmark.base_weight}}, {{benchmark.base_calculated_proof_size}})
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(Weight::from_ref_time({{underscore cw.slope}}).saturating_mul({{cw.name}}.into()))
.saturating_add(Weight::from_parts({{underscore cw.slope}}, 0).saturating_mul({{cw.name}}.into()))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}))
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}}_u64))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}}_u64).saturating_mul({{cr.name}}.into())))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}))
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}}_u64))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}}_u64).saturating_mul({{cw.name}}.into())))
{{/each}}
{{#each benchmark.component_calculated_proof_size as |cp|}}
.saturating_add(Weight::from_parts(0, {{cp.slope}}).saturating_mul({{cp.name}}.into()))
{{/each}}
}
{{/each}}
}
14 changes: 7 additions & 7 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GPT summary of 60cb53 - 8b4656:
Error: couldn't generate summary

"rust-analyzer.linkedProjects": [
"./pallets/afloat/Cargo.toml",
"./pallets/rbac/Cargo.toml",
"./pallets/gated-marketplace/Cargo.toml",
"./pallets/fruniques/Cargo.toml",
],
"rust-analyzer.showUnlinkedFileNotification": false
"rust-analyzer.linkedProjects": [
"./pallets/afloat/Cargo.toml",
"./pallets/rbac/Cargo.toml",
"./pallets/gated-marketplace/Cargo.toml",
"./pallets/fruniques/Cargo.toml",
],
"rust-analyzer.showUnlinkedFileNotification": false
}
Loading
Loading