mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 22:51:03 +00:00
* Use `add_benchmark` macro * Return error if `batches` is empty * Update Cargo.lock * Companion for #5463 (#953) * Fix test with genesis block 0 * Update Cargo.lock
This commit is contained in:
Generated
+238
-226
File diff suppressed because it is too large
Load Diff
@@ -787,7 +787,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn basic_setup_works() {
|
fn basic_setup_works() {
|
||||||
new_test_ext().execute_with(|| {
|
new_test_ext().execute_with(|| {
|
||||||
assert_eq!(System::block_number(), 1);
|
assert_eq!(System::block_number(), 0);
|
||||||
assert_eq!(Crowdfund::fund_count(), 0);
|
assert_eq!(Crowdfund::fund_count(), 0);
|
||||||
assert_eq!(Crowdfund::funds(0), None);
|
assert_eq!(Crowdfund::funds(0), None);
|
||||||
let empty: Vec<FundIndex> = Vec::new();
|
let empty: Vec<FundIndex> = Vec::new();
|
||||||
|
|||||||
@@ -899,27 +899,20 @@ sp_api::impl_runtime_apis! {
|
|||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
module: Vec<u8>,
|
pallet: Vec<u8>,
|
||||||
extrinsic: Vec<u8>,
|
benchmark: Vec<u8>,
|
||||||
lowest_range_values: Vec<u32>,
|
lowest_range_values: Vec<u32>,
|
||||||
highest_range_values: Vec<u32>,
|
highest_range_values: Vec<u32>,
|
||||||
steps: Vec<u32>,
|
steps: Vec<u32>,
|
||||||
repeat: u32,
|
repeat: u32,
|
||||||
) -> Result<Vec<frame_benchmarking::BenchmarkResults>, RuntimeString> {
|
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> {
|
||||||
use frame_benchmarking::Benchmarking;
|
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark};
|
||||||
|
|
||||||
let result = match module.as_slice() {
|
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||||
b"claims" => Claims::run_benchmark(
|
let params = (&pallet, &benchmark, &lowest_range_values, &highest_range_values, &steps, repeat);
|
||||||
extrinsic,
|
add_benchmark!(params, batches, b"claims", Claims);
|
||||||
lowest_range_values,
|
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||||
highest_range_values,
|
Ok(batches)
|
||||||
steps,
|
|
||||||
repeat,
|
|
||||||
),
|
|
||||||
_ => Err("Benchmark not found for this pallet."),
|
|
||||||
};
|
|
||||||
|
|
||||||
result.map_err(|e| e.into())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -821,27 +821,20 @@ sp_api::impl_runtime_apis! {
|
|||||||
#[cfg(feature = "runtime-benchmarks")]
|
#[cfg(feature = "runtime-benchmarks")]
|
||||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||||
fn dispatch_benchmark(
|
fn dispatch_benchmark(
|
||||||
module: Vec<u8>,
|
pallet: Vec<u8>,
|
||||||
extrinsic: Vec<u8>,
|
benchmark: Vec<u8>,
|
||||||
lowest_range_values: Vec<u32>,
|
lowest_range_values: Vec<u32>,
|
||||||
highest_range_values: Vec<u32>,
|
highest_range_values: Vec<u32>,
|
||||||
steps: Vec<u32>,
|
steps: Vec<u32>,
|
||||||
repeat: u32,
|
repeat: u32,
|
||||||
) -> Result<Vec<frame_benchmarking::BenchmarkResults>, RuntimeString> {
|
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> {
|
||||||
use frame_benchmarking::Benchmarking;
|
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark};
|
||||||
|
|
||||||
let result = match module.as_slice() {
|
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||||
b"claims" => Claims::run_benchmark(
|
let params = (&pallet, &benchmark, &lowest_range_values, &highest_range_values, &steps, repeat);
|
||||||
extrinsic,
|
add_benchmark!(params, batches, b"claims", Claims);
|
||||||
lowest_range_values,
|
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||||
highest_range_values,
|
Ok(batches)
|
||||||
steps,
|
|
||||||
repeat,
|
|
||||||
),
|
|
||||||
_ => Err("Benchmark not found for this pallet."),
|
|
||||||
};
|
|
||||||
|
|
||||||
result.map_err(|e| e.into())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user