Add pruning to bechmarks & update weights. (#918)

* Insert headers in benchmarks.

* Fix benchmarks.

* Lower number of headers.

* Avoid hardcoding numbers.

* Update weights.

* cargo fmt --all

* Remove todo.

* Fix test.

* Address review comments.

* Fix borrowed value.
This commit is contained in:
Tomasz Drwięga
2021-04-22 21:07:55 +02:00
committed by Bastian Köcher
parent fd44cab992
commit 479e51c67b
6 changed files with 159 additions and 106 deletions
+22 -8
View File
@@ -409,16 +409,30 @@ impl pallet_session::Config for Runtime {
}
parameter_types! {
// This is a pretty unscientific cap.
//
// Note that once this is hit the pallet will essentially throttle incoming requests down to one
// call per block.
/// This is a pretty unscientific cap.
///
/// Note that once this is hit the pallet will essentially throttle incoming requests down to one
/// call per block.
pub const MaxRequests: u32 = 50;
}
// Number of headers to keep.
//
// Assuming the worst case of every header being finalized, we will keep headers at least for a
// week.
#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
/// Number of headers to keep in benchmarks.
///
/// In benchmarks we always populate with full number of `HeadersToKeep` to make sure that
/// pruning is taken into account.
///
/// Note: This is lower than regular value, to speed up benchmarking setup.
pub const HeadersToKeep: u32 = 1024;
}
#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
/// Number of headers to keep.
///
/// Assuming the worst case of every header being finalized, we will keep headers at least for a
/// week.
pub const HeadersToKeep: u32 = 7 * bp_rialto::DAYS as u32;
}