Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Implement set_block_number for runtime-bencmarks in RelayBlockNumberP…
Browse files Browse the repository at this point in the history
…roiver (#1187)
  • Loading branch information
girazoki authored Apr 21, 2022
1 parent 8b31bce commit 08bc38d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pallets/parachain-system/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,7 @@ std = [
"sp-trie/std",
"xcm/std"
]

runtime-benchmarks = [
"sp-runtime/runtime-benchmarks"
]
7 changes: 7 additions & 0 deletions pallets/parachain-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

0 comments on commit 08bc38d

Please sign in to comment.