Parachains-runtime (#1505)

* Initial commit

* v0 to v1 primitives and remove attestations

* Review fixes

* implement candidate_events

* remove dead code
This commit is contained in:
Fedor Sakharov
2020-07-31 23:42:10 +03:00
committed by GitHub
parent 596ce826e8
commit 047e2fdb21
10 changed files with 1036 additions and 13 deletions
@@ -17,6 +17,7 @@
//! Runtimes implementing the v1 runtime API are recommended to forward directly to these
//! functions.
use sp_std::prelude::*;
use primitives::v1::{
ValidatorId, ValidatorIndex, GroupRotationInfo, CoreState, GlobalValidationData,
Id as ParaId, OccupiedCoreAssumption, LocalValidationData, SessionIndex, ValidationCode,
@@ -239,9 +240,11 @@ pub fn candidate_pending_availability<T: initializer::Trait>(para_id: ParaId)
/// Implementation for the `candidate_events` function of the runtime API.
// NOTE: this runs without block initialization, as it accesses events.
// this means it can run in a different session than other runtime APIs at the same block.
pub fn candidate_events<T: initializer::Trait>(
extract_event: impl Fn(<T as system::Trait>::Event) -> Option<inclusion::Event<T>>,
) -> Vec<CandidateEvent<T::Hash>> {
pub fn candidate_events<T, F>(extract_event: F) -> Vec<CandidateEvent<T::Hash>>
where
T: initializer::Trait,
F: Fn(<T as system::Trait>::Event) -> Option<inclusion::Event<T>>,
{
use inclusion::Event as RawEvent;
<system::Module<T>>::events().into_iter()