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
@@ -31,7 +31,7 @@
//! data, like what is the corresponding response type.
//!
//! ## Versioning
//!
//!
//! Versioning for request-response protocols can be done in multiple ways.
//!
//! If you're just changing the protocol name but the binary payloads are the same, just add a new
@@ -22,7 +22,8 @@ use polkadot_node_primitives::{
AvailableData, DisputeMessage, ErasureChunk, PoV, Proof, UncheckedDisputeMessage,
};
use polkadot_primitives::{
CandidateHash, CandidateReceipt, CommittedCandidateReceipt, Hash, Id as ParaId, ValidatorIndex,
CandidateHash, CandidateReceipt, CommittedCandidateReceipt, Hash, HeadData, Id as ParaId,
ValidatorIndex,
};
use super::{IsRequest, Protocol};
@@ -103,6 +104,18 @@ pub enum CollationFetchingResponse {
/// Deliver requested collation.
#[codec(index = 0)]
Collation(CandidateReceipt, PoV),
/// Deliver requested collation along with parent head data.
#[codec(index = 1)]
CollationWithParentHeadData {
/// The receipt of the candidate.
receipt: CandidateReceipt,
/// Candidate's proof of validity.
pov: PoV,
/// The head data of the candidate's parent.
/// This is needed for elastic scaling to work.
parent_head_data: HeadData,
},
}
impl IsRequest for CollationFetchingRequest {