Downward Message Processing implementation (#1859)

* DMP: data structures and plumbing

* DMP: Implement DMP logic in the router module

DMP: Integrate DMP parts into the inclusion module

* DMP: Introduce the max size limit for the size of a downward message

* DMP: Runtime API for accessing inbound messages

* OCD

Small clean ups

* DMP: fix the naming of the error

* DMP: add caution about a non-existent recipient
This commit is contained in:
Sergei Shulepov
2020-10-28 11:41:42 +01:00
committed by GitHub
parent 1a25c41277
commit 9903bca259
26 changed files with 556 additions and 36 deletions
@@ -23,10 +23,11 @@ use primitives::v1::{
Id as ParaId, OccupiedCoreAssumption, SessionIndex, ValidationCode,
CommittedCandidateReceipt, ScheduledCore, OccupiedCore, CoreOccupied, CoreIndex,
GroupIndex, CandidateEvent, PersistedValidationData, AuthorityDiscoveryId,
InboundDownwardMessage,
};
use sp_runtime::traits::Zero;
use frame_support::debug;
use crate::{initializer, inclusion, scheduler, configuration, paras};
use crate::{initializer, inclusion, scheduler, configuration, paras, router};
/// Implementation for the `validators` function of the runtime API.
pub fn validators<T: initializer::Trait>() -> Vec<ValidatorId> {
@@ -299,3 +300,10 @@ where
validator_index.and_then(|i| authorities.get(i).cloned())
}).collect()
}
/// Implementation for the `dmq_contents` function of the runtime API.
pub fn dmq_contents<T: router::Trait>(
recipient: ParaId,
) -> Vec<InboundDownwardMessage<T::BlockNumber>> {
<router::Module<T>>::dmq_contents(recipient)
}