collator protocol changes for elastic scaling (validator side) (#3302)

Fixes #3128.

This introduces a new variant for the collation response from the
collator that includes the parent head data. For now, collators won't
send this new variant. We'll need to change the collator side of the
collator protocol to detect all the cores assigned to a para and send
the parent head data in the case when it's more than 1 core.

- [x] validate approach
- [x] check head data hash
This commit is contained in:
ordian
2024-03-15 20:43:28 +01:00
committed by GitHub
parent e8b51f60cc
commit 02e1a7f476
16 changed files with 409 additions and 136 deletions
@@ -89,13 +89,21 @@ pub enum SecondingError {
#[error("Received duplicate collation from the peer")]
Duplicate,
#[error("The provided parent head data does not match the hash")]
ParentHeadDataMismatch,
}
impl SecondingError {
/// Returns true if an error indicates that a peer is malicious.
pub fn is_malicious(&self) -> bool {
use SecondingError::*;
matches!(self, PersistedValidationDataMismatch | CandidateHashMismatch | Duplicate)
matches!(
self,
PersistedValidationDataMismatch |
CandidateHashMismatch |
Duplicate | ParentHeadDataMismatch
)
}
}