Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add setter configurable only for benchmarking or tests #9668

Merged
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
8 changes: 8 additions & 0 deletions primitives/runtime/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,14 @@ pub trait BlockNumberProvider {
/// ```
/// .
fn current_block_number() -> Self::BlockNumber;

/// Utility function only to be used in benchmarking scenarios, to be implemented optionally,
/// else a noop.
///
/// It allows for setting the block number that will later be fetched
/// This is useful in case the block number provider is different than System
#[cfg(feature = "runtime-benchmarks")]
fn set_block_number(_block: Self::BlockNumber) {}
}

#[cfg(test)]
Expand Down