From 9d052b7e09d7aecf039b96cf6267e05b9b01c0ae Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Thu, 4 Apr 2024 12:20:09 -0400 Subject: [PATCH] Make `BlockNumberProvider::set_block_number` available in tests / std (#3974) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Oliver Tale-Yazdi --- substrate/primitives/runtime/src/traits.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/substrate/primitives/runtime/src/traits.rs b/substrate/primitives/runtime/src/traits.rs index 5a6c306dd2..d023aa045d 100644 --- a/substrate/primitives/runtime/src/traits.rs +++ b/substrate/primitives/runtime/src/traits.rs @@ -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) {} }