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

Commit 267dac2

Browse files
girazokibkchr
andauthored
Add setter configurable only for benchmarking or tests (#9668)
* Add setter configurable only fior benchmarking or tests * Update primitives/runtime/src/traits.rs Co-authored-by: Bastian Köcher <[email protected]>
1 parent a8a040c commit 267dac2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

primitives/runtime/src/traits.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,6 +1585,14 @@ pub trait BlockNumberProvider {
15851585
/// ```
15861586
/// .
15871587
fn current_block_number() -> Self::BlockNumber;
1588+
1589+
/// Utility function only to be used in benchmarking scenarios, to be implemented optionally,
1590+
/// else a noop.
1591+
///
1592+
/// It allows for setting the block number that will later be fetched
1593+
/// This is useful in case the block number provider is different than System
1594+
#[cfg(feature = "runtime-benchmarks")]
1595+
fn set_block_number(_block: Self::BlockNumber) {}
15881596
}
15891597

15901598
#[cfg(test)]

0 commit comments

Comments
 (0)