collator-side: send parent head data (#3521)

On top of #3302.

We want the validators to upgrade first before we add changes to the
collation side to send the new variants, which is why this part is
extracted into a separate PR.

The detection of when to send the parent head is based on the core
assignments at the relay parent of the candidate. We probably want to
make it more flexible in the future, but for now, it will work for a
simple use case when a para always has multiple cores assigned to it.

---------

Signed-off-by: Matteo Muraca <mmuraca247@gmail.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Matteo Muraca <56828990+muraca@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Juan Ignacio Rios <54085674+JuaniRios@users.noreply.github.com>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
ordian
2024-03-19 16:01:26 +01:00
committed by GitHub
parent 923f27ccab
commit 5fd72a1f5e
9 changed files with 222 additions and 47 deletions
+11 -1
View File
@@ -1114,7 +1114,7 @@ pub struct ProspectiveValidationDataRequest {
}
/// The parent head-data hash with optional data itself.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum ParentHeadData {
/// Parent head-data hash.
OnlyHash(Hash),
@@ -1127,6 +1127,16 @@ pub enum ParentHeadData {
},
}
impl ParentHeadData {
/// Return the hash of the parent head-data.
pub fn hash(&self) -> Hash {
match self {
ParentHeadData::OnlyHash(hash) => *hash,
ParentHeadData::WithData { hash, .. } => *hash,
}
}
}
/// Indicates the relay-parents whose fragment tree a candidate
/// is present in and the depths of that tree the candidate is present in.
pub type FragmentTreeMembership = Vec<(Hash, Vec<usize>)>;