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

Block benchmarks fix #77

Merged
Changes from all commits
Commits
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
9 changes: 6 additions & 3 deletions utils/frame/benchmarking-cli/src/extrinsic/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ where

/// Benchmark a block that does not include any new extrinsics but needs to shuffle previous one
pub fn bench_block(&mut self, ext_builder: &dyn ExtrinsicBuilder) -> Result<Stats> {
let block = self.build_second_block(ext_builder, 0)?;
let block = self.build_second_block(ext_builder, 0, false)?;
let record = self.measure_block(&block.block, BlockId::Number(One::one()))?;
Stats::new(&record)
}
Expand All @@ -271,7 +271,7 @@ where
ext_builder: &dyn ExtrinsicBuilder,
count: usize,
) -> Result<Stats> {
let block = self.build_second_block(ext_builder, count)?;
let block = self.build_second_block(ext_builder, count, true)?;
let num_ext = block.block.extrinsics().len();
let mut records = self.measure_block(&block.block.clone(), BlockId::Number(One::one()))?;

Expand Down Expand Up @@ -363,6 +363,7 @@ where
&mut self,
ext_builder: &dyn ExtrinsicBuilder,
txs_count: usize,
apply_previous_block_extrinsics: bool,
) -> Result<sc_block_builder_ver::BuiltBlock<Block, BA::State>> {
// Return early if we just want a block with inherents and no additional extrinsics.

Expand All @@ -374,7 +375,9 @@ where
builder.push(inherent)?;
}

builder.apply_previous_block_extrinsics(seed.clone(), &mut 0, usize::MAX, || false);
builder.apply_previous_block_extrinsics(seed.clone(), &mut 0, usize::MAX, || {
!apply_previous_block_extrinsics
});

let block = builder.build_with_seed(seed, |_, _| {
(txs_count..(txs_count * 2))
Expand Down