Implement set_block_number for runtime-bencmarks in RelayBlockNumberProiver (#1187)

This commit is contained in:
girazoki
2022-04-21 10:23:20 +02:00
committed by GitHub
parent 8b31bce403
commit 08bc38ddff
2 changed files with 11 additions and 0 deletions
+4
View File
@@ -73,3 +73,7 @@ std = [
"sp-trie/std",
"xcm/std"
]
runtime-benchmarks = [
"sp-runtime/runtime-benchmarks"
]
+7
View File
@@ -1047,4 +1047,11 @@ impl<T: Config> BlockNumberProvider for RelaychainBlockNumberProvider<T> {
.map(|d| d.relay_parent_number)
.unwrap_or_default()
}
#[cfg(feature = "runtime-benchmarks")]
fn set_block_number(block: Self::BlockNumber) {
if let Some(mut validation_data) = Pallet::<T>::validation_data() {
validation_data.relay_parent_number = block;
ValidationData::<T>::put(validation_data)
}
}
}