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

Commit

Permalink
Prepare check_validation_outputs for upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
slumber committed Jan 28, 2022
1 parent cf8fd9b commit 6b50e96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 1 addition & 6 deletions runtime/parachains/src/inclusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,14 +693,9 @@ impl<T: Config> Pallet<T> {
/// Run the acceptance criteria checks on the given candidate commitments.
pub(crate) fn check_validation_outputs_for_runtime_api(
para_id: ParaId,
relay_parent_number: T::BlockNumber,
validation_outputs: primitives::v1::CandidateCommitments,
) -> bool {
// This function is meant to be called from the runtime APIs against the relay-parent, hence
// `relay_parent_number` is equal to `now`.
// TODO [now]: unwind this very deep assumption which is now wrong. probably
// by changing runtime API to choose a relay-parent.
let now = <frame_system::Pallet<T>>::block_number();
let relay_parent_number = now;
let prev_context = <paras::Pallet<T>>::para_most_recent_context(para_id);
let check_ctx = CandidateCheckContext::<T>::new(prev_context);

Expand Down
7 changes: 6 additions & 1 deletion runtime/parachains/src/runtime_api_impl/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,12 @@ pub fn check_validation_outputs<T: initializer::Config>(
para_id: ParaId,
outputs: primitives::v1::CandidateCommitments,
) -> bool {
<inclusion::Pallet<T>>::check_validation_outputs_for_runtime_api(para_id, outputs)
let relay_parent_number = <frame_system::Pallet<T>>::block_number();
<inclusion::Pallet<T>>::check_validation_outputs_for_runtime_api(
para_id,
relay_parent_number,
outputs,
)
}

/// Implementation for the `session_index_for_child` function of the runtime API.
Expand Down

0 comments on commit 6b50e96

Please sign in to comment.