Skip to content

Commit

Permalink
Make BlockNumberProvider::set_block_number available in tests / std (
Browse files Browse the repository at this point in the history
…paritytech#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>
  • Loading branch information
3 people authored and dharjeezy committed Apr 9, 2024
1 parent dddce07 commit f2abd70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions substrate/primitives/runtime/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
}

Expand Down

0 comments on commit f2abd70

Please sign in to comment.