runtime-api: add validation_code_hash API (#4629)

This is the first step to close
https://github.com/paritytech/polkadot/issues/4524
This commit is contained in:
Sergei Shulepov
2021-12-28 21:16:03 +01:00
committed by GitHub
parent b49291dc76
commit 91aff5d341
13 changed files with 153 additions and 0 deletions
@@ -389,3 +389,16 @@ pub fn submit_pvf_check_statement<T: paras::Config>(
pub fn pvfs_require_precheck<T: paras::Config>() -> Vec<ValidationCodeHash> {
<paras::Pallet<T>>::pvfs_require_precheck()
}
/// Returns the validation code hash for the given parachain making the given `OccupiedCoreAssumption`.
pub fn validation_code_hash<T>(
para_id: ParaId,
assumption: OccupiedCoreAssumption,
) -> Option<ValidationCodeHash>
where
T: inclusion::Config,
{
with_assumption::<T, _, _>(para_id, assumption, || {
<paras::Pallet<T>>::current_code_hash(&para_id)
})
}