mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Benchmark Polkadot Claims Pallet (#876)
* fix * Starting to add benchmarks * make compile * add benchmarks * Make work with Substrate master * Bench validate unsigned * back to polkadot master * starting to add cli with feature flag * more stuff * Add to kusama * Update Cargo.lock * fix dev dep * bump wasm builder * Remove encode from keccak benchmark * bump spec * Add weight documentation * Update Cargo.lock * Update check_runtime.sh * Update publish_draft_release.sh * Update Cargo.lock Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
|
||||
#![recursion_limit="256"]
|
||||
|
||||
use rstd::prelude::*;
|
||||
use sp_std::prelude::*;
|
||||
use sp_core::u32_trait::{_1, _2, _3, _4, _5};
|
||||
use codec::{Encode, Decode};
|
||||
use primitives::{
|
||||
@@ -39,6 +39,8 @@ use sp_runtime::{
|
||||
curve::PiecewiseLinear,
|
||||
traits::{BlakeTwo256, Block as BlockT, SignedExtension, OpaqueKeys, ConvertInto, IdentityLookup},
|
||||
};
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
use sp_runtime::RuntimeString;
|
||||
use version::RuntimeVersion;
|
||||
use grandpa::{AuthorityId as GrandpaId, fg_primitives};
|
||||
#[cfg(any(feature = "std", test))]
|
||||
@@ -101,7 +103,7 @@ impl SignedExtension for RestrictFunctionality {
|
||||
type Pre = ();
|
||||
type DispatchInfo = DispatchInfo;
|
||||
|
||||
fn additional_signed(&self) -> rstd::result::Result<(), TransactionValidityError> { Ok(()) }
|
||||
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> { Ok(()) }
|
||||
|
||||
fn validate(&self, _: &Self::AccountId, call: &Self::Call, _: DispatchInfo, _: usize)
|
||||
-> TransactionValidity
|
||||
@@ -867,4 +869,31 @@ sp_api::impl_runtime_apis! {
|
||||
TransactionPayment::query_info(uxt, len)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||
fn dispatch_benchmark(
|
||||
module: Vec<u8>,
|
||||
extrinsic: Vec<u8>,
|
||||
lowest_range_values: Vec<u32>,
|
||||
highest_range_values: Vec<u32>,
|
||||
steps: Vec<u32>,
|
||||
repeat: u32,
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkResults>, RuntimeString> {
|
||||
use frame_benchmarking::Benchmarking;
|
||||
|
||||
let result = match module.as_slice() {
|
||||
b"claims" => Claims::run_benchmark(
|
||||
extrinsic,
|
||||
lowest_range_values,
|
||||
highest_range_values,
|
||||
steps,
|
||||
repeat,
|
||||
),
|
||||
_ => Err("Benchmark not found for this pallet."),
|
||||
};
|
||||
|
||||
result.map_err(|e| e.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user