Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6cd2542
Init a new brnach: gas-estimation-for-zk-precompile.
luckychacha Jul 27, 2023
7538ccb
Add a pallet for benchmarking.
luckychacha Jul 28, 2023
7a536c6
Demo benchmarking is working.
luckychacha Jul 28, 2023
6422f44
Create mock file for zk-groth16 verify
luckychacha Jul 31, 2023
8238735
Merge branch 'main' into gas-estimation-for-zk-precompile
luckychacha Jul 31, 2023
7d10229
Update mock file for zk-groth-precompile.
luckychacha Jul 31, 2023
e7d70f5
Update zk-groth16-verify benchmarking file.
luckychacha Aug 1, 2023
16fa807
Debug benchmarking.
luckychacha Aug 1, 2023
034ca00
Rewrite benchmarking...
luckychacha Aug 2, 2023
babd2ce
New demo benchmarking and mock is working.
luckychacha Aug 2, 2023
59905eb
Test benchmarking.
luckychacha Aug 3, 2023
d0f123b
Unit test complete.
luckychacha Aug 3, 2023
efed272
zk groth16 verify precompile benchmark is working.
luckychacha Aug 4, 2023
a56d4d5
Remove some log in benchmarking.
luckychacha Aug 4, 2023
83dcef7
Format code and dependencies.
luckychacha Aug 4, 2023
830689d
Fix cargo fmt error.
luckychacha Aug 6, 2023
c77a840
Add some benchmarking testcase.
luckychacha Aug 7, 2023
bb92a51
Add some benchmarking.
luckychacha Aug 8, 2023
1d39949
Try to deal benchmarking verified fail.
luckychacha Aug 8, 2023
8f53f1a
Try to deal benchmarking verified fail.
luckychacha Aug 9, 2023
29d3661
ZK Groth16 Verify benchamarking working.
luckychacha Aug 9, 2023
5dba20a
Merge branch 'main' into gas-estimation-for-zk-precompile
luckychacha Aug 9, 2023
362e819
Add more benchmarking
luckychacha Aug 10, 2023
1bbda62
Add more benchmarking
luckychacha Aug 11, 2023
6d1b9c1
Update unit test testcase.
luckychacha Aug 14, 2023
5fd865a
Got gas used from benchmarking for gas estimation.
luckychacha Aug 15, 2023
4e762c8
Merge main changes into current branch.
luckychacha Aug 15, 2023
60d10a5
Fix action error.
luckychacha Aug 15, 2023
7eb9f36
Optimize benchmarking code.
luckychacha Aug 16, 2023
96a1cd5
Fix code.
luckychacha Aug 16, 2023
813e2f7
Compatibility with different runtime::SignedExtra for Sydney and Broo…
luckychacha Aug 16, 2023
a239be6
Merge branch 'main' into gas-estimation-for-zk-precompile
luckychacha Aug 19, 2023
8e2c8c8
remove unused dev-dependencies.
luckychacha Aug 21, 2023
82bfe09
Merge branch 'main' into gas-estimation-for-zk-precompile
luckychacha Aug 21, 2023
a6ae9f3
remove comment dependencies.
luckychacha Aug 21, 2023
2da601f
Merge branch 'gas-estimation-for-zk-precompile' of https://github.com…
luckychacha Aug 21, 2023
dccde5a
Merge branch 'main' into gas-estimation-for-zk-precompile
luckychacha Sep 7, 2023
9fd6f78
Resolve conversation.
luckychacha Sep 7, 2023
7846e37
Remove unused dependence.
luckychacha Sep 8, 2023
8bc1541
Merge branch 'gas-estimation-for-zk-precompile' of https://github.com…
luckychacha Sep 26, 2023
23095e6
merge main and deal compile error.
luckychacha Sep 26, 2023
858055e
update chain_id in mock file.
luckychacha Sep 27, 2023
9ff4078
Merge branch 'main' into gas-estimation-for-zk-precompile
luckychacha Sep 27, 2023
dab3353
Deal benchmark running error.
luckychacha Sep 27, 2023
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
114 changes: 114 additions & 0 deletions .maintain/frame-weight-template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// This file is part of Substrate.

// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

//! 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}}`
//! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}}

// Executed Command:
{{#each args as |arg|}}
// {{arg}}
{{/each}}

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

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

/// Weight functions needed for {{pallet}}.
pub trait WeightInfo {
{{#each benchmarks as |benchmark|}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{c.name}}: u32, {{/each~}}
) -> Weight;
{{/each}}
}

/// 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> {
{{else}}
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{/if}}
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
// {{comment}}
{{/each}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
({{underscore benchmark.base_weight}} as Weight)
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
{{/each}}
}
{{/each}}
}

// For backwards compatibility and tests
impl WeightInfo for () {
{{#each benchmarks as |benchmark|}}
{{#each benchmark.comments as |comment|}}
// {{comment}}
{{/each}}
fn {{benchmark.name~}}
(
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
({{underscore benchmark.base_weight}} as Weight)
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
{{/each}}
}
{{/each}}
}
Loading