Return relay_parent as result of collation seconded signal as well (#3577)

* Return `relay_parent` as result of collation seconded signal as well

Before we only returned the seconded statement. However, to verify the
statement in a future proof way, we also need the relay parent that was
used as a context to sign the statement.

* FMT
This commit is contained in:
Bastian Köcher
2021-08-05 16:26:02 +02:00
committed by GitHub
parent 49a46f78d3
commit fe5c303893
5 changed files with 25 additions and 14 deletions
+13 -2
View File
@@ -215,6 +215,17 @@ pub struct Collation<BlockNumber = polkadot_primitives::v1::BlockNumber> {
pub hrmp_watermark: BlockNumber,
}
/// Signal that is being returned back when a collation was seconded by a validator.
#[derive(Debug)]
pub struct CollationSecondedSignal {
/// The hash of the relay chain block that was used as context to sign [`Self::statement`].
pub relay_parent: Hash,
/// The statement about seconding the collation.
///
/// Anything else than [`Statement::Seconded`](Statement::Seconded) is forbidden here.
pub statement: SignedFullStatement,
}
/// Result of the [`CollatorFn`] invocation.
pub struct CollationResult {
/// The collation that was build.
@@ -224,14 +235,14 @@ pub struct CollationResult {
/// There is no guarantee that this sender is informed ever about any result, it is completely okay to just drop it.
/// However, if it is called, it should be called with the signed statement of a parachain validator seconding the
/// collation.
pub result_sender: Option<futures::channel::oneshot::Sender<SignedFullStatement>>,
pub result_sender: Option<futures::channel::oneshot::Sender<CollationSecondedSignal>>,
}
impl CollationResult {
/// Convert into the inner values.
pub fn into_inner(
self,
) -> (Collation, Option<futures::channel::oneshot::Sender<SignedFullStatement>>) {
) -> (Collation, Option<futures::channel::oneshot::Sender<CollationSecondedSignal>>) {
(self.collation, self.result_sender)
}
}