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 <git@kchr.de>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Shawn Tabrizi
2024-04-04 12:20:09 -04:00
committed by GitHub
parent 68cdb12649
commit 9d052b7e09
+3 -3
View File
@@ -2322,12 +2322,12 @@ 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.
/// Utility function only to be used in benchmarking scenarios or tests, 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")]
#[cfg(any(feature = "std", feature = "runtime-benchmarks"))]
fn set_block_number(_block: Self::BlockNumber) {}
}