mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 01:51:02 +00:00
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:
@@ -1830,6 +1830,12 @@ sp_api::impl_runtime_apis! {
|
||||
fn pvfs_require_precheck() -> Vec<ValidationCodeHash> {
|
||||
parachains_runtime_api_impl::pvfs_require_precheck::<Runtime>()
|
||||
}
|
||||
|
||||
fn validation_code_hash(para_id: ParaId, assumption: OccupiedCoreAssumption)
|
||||
-> Option<ValidationCodeHash>
|
||||
{
|
||||
parachains_runtime_api_impl::validation_code_hash::<Runtime>(para_id, assumption)
|
||||
}
|
||||
}
|
||||
|
||||
impl beefy_primitives::BeefyApi<Block> for Runtime {
|
||||
|
||||
@@ -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(¶_id)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1797,6 +1797,12 @@ sp_api::impl_runtime_apis! {
|
||||
fn pvfs_require_precheck() -> Vec<ValidationCodeHash> {
|
||||
parachains_runtime_api_impl::pvfs_require_precheck::<Runtime>()
|
||||
}
|
||||
|
||||
fn validation_code_hash(para_id: ParaId, assumption: OccupiedCoreAssumption)
|
||||
-> Option<ValidationCodeHash>
|
||||
{
|
||||
parachains_runtime_api_impl::validation_code_hash::<Runtime>(para_id, assumption)
|
||||
}
|
||||
}
|
||||
|
||||
impl beefy_primitives::BeefyApi<Block> for Runtime {
|
||||
|
||||
@@ -1383,6 +1383,12 @@ sp_api::impl_runtime_apis! {
|
||||
fn pvfs_require_precheck() -> Vec<ValidationCodeHash> {
|
||||
runtime_api_impl::pvfs_require_precheck::<Runtime>()
|
||||
}
|
||||
|
||||
fn validation_code_hash(para_id: ParaId, assumption: OccupiedCoreAssumption)
|
||||
-> Option<ValidationCodeHash>
|
||||
{
|
||||
runtime_api_impl::validation_code_hash::<Runtime>(para_id, assumption)
|
||||
}
|
||||
}
|
||||
|
||||
impl fg_primitives::GrandpaApi<Block> for Runtime {
|
||||
|
||||
@@ -888,6 +888,12 @@ sp_api::impl_runtime_apis! {
|
||||
fn pvfs_require_precheck() -> Vec<ValidationCodeHash> {
|
||||
runtime_impl::pvfs_require_precheck::<Runtime>()
|
||||
}
|
||||
|
||||
fn validation_code_hash(para_id: ParaId, assumption: OccupiedCoreAssumption)
|
||||
-> Option<ValidationCodeHash>
|
||||
{
|
||||
runtime_impl::validation_code_hash::<Runtime>(para_id, assumption)
|
||||
}
|
||||
}
|
||||
|
||||
impl beefy_primitives::BeefyApi<Block> for Runtime {
|
||||
|
||||
@@ -1401,6 +1401,12 @@ sp_api::impl_runtime_apis! {
|
||||
fn pvfs_require_precheck() -> Vec<ValidationCodeHash> {
|
||||
parachains_runtime_api_impl::pvfs_require_precheck::<Runtime>()
|
||||
}
|
||||
|
||||
fn validation_code_hash(para_id: ParaId, assumption: OccupiedCoreAssumption)
|
||||
-> Option<ValidationCodeHash>
|
||||
{
|
||||
parachains_runtime_api_impl::validation_code_hash::<Runtime>(para_id, assumption)
|
||||
}
|
||||
}
|
||||
|
||||
impl beefy_primitives::BeefyApi<Block> for Runtime {
|
||||
|
||||
Reference in New Issue
Block a user