Skip to content

Commit 569a318

Browse files
shawntabrizibkchrggwpez
authored andcommitted
Make BlockNumberProvider::set_block_number available in tests / std (#3974)
This function is currently only exposed to runtime-benchmarks, where it should be available in all tests. Also made it available in `std` because this is how `set_block_number` works in FRAME System, however, not sure if it is needed in the latest std/no_std paradigm. --------- Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Oliver Tale-Yazdi <[email protected]>
1 parent e8db4e2 commit 569a318

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

substrate/primitives/runtime/src/traits.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2322,12 +2322,12 @@ pub trait BlockNumberProvider {
23222322
/// .
23232323
fn current_block_number() -> Self::BlockNumber;
23242324

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

0 commit comments

Comments
 (0)