mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 19:47:59 +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]
|
||||
fn basic_setup_works() {
|
||||
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::funds(0), None);
|
||||
let empty: Vec<FundIndex> = Vec::new();
|
||||
|
||||
@@ -899,27 +899,20 @@ sp_api::impl_runtime_apis! {
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||
fn dispatch_benchmark(
|
||||
module: Vec<u8>,
|
||||
extrinsic: Vec<u8>,
|
||||
pallet: Vec<u8>,
|
||||
benchmark: 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;
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark};
|
||||
|
||||
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())
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&pallet, &benchmark, &lowest_range_values, &highest_range_values, &steps, repeat);
|
||||
add_benchmark!(params, batches, b"claims", Claims);
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -821,27 +821,20 @@ sp_api::impl_runtime_apis! {
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
impl frame_benchmarking::Benchmark<Block> for Runtime {
|
||||
fn dispatch_benchmark(
|
||||
module: Vec<u8>,
|
||||
extrinsic: Vec<u8>,
|
||||
pallet: Vec<u8>,
|
||||
benchmark: 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;
|
||||
) -> Result<Vec<frame_benchmarking::BenchmarkBatch>, RuntimeString> {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark};
|
||||
|
||||
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())
|
||||
let mut batches = Vec::<BenchmarkBatch>::new();
|
||||
let params = (&pallet, &benchmark, &lowest_range_values, &highest_range_values, &steps, repeat);
|
||||
add_benchmark!(params, batches, b"claims", Claims);
|
||||
if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) }
|
||||
Ok(batches)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user