Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ use polkadot_node_network_protocol::{
PeerId,
};
use polkadot_node_primitives::PoV;
use polkadot_node_subsystem::messages::ParentHeadData;
use polkadot_primitives::{
vstaging::CandidateReceiptV2 as CandidateReceipt, CandidateHash, Hash, Id as ParaId,
vstaging::CandidateReceiptV2 as CandidateReceipt, CandidateHash, Hash, HeadData, Id as ParaId,
};

/// The status of a collation as seen from the collator.
Expand Down Expand Up @@ -72,8 +71,8 @@ pub struct Collation {
pub receipt: CandidateReceipt,
/// Proof to verify the state transition of the parachain.
pub pov: PoV,
/// Parent head-data (or just hash).
pub parent_head_data: ParentHeadData,
/// Parent head-data
pub parent_head_data: HeadData,
/// Collation status.
pub status: CollationStatus,
}
Expand Down
31 changes: 8 additions & 23 deletions polkadot/node/network/collator-protocol/src/collator_side/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ use polkadot_node_network_protocol::{
};
use polkadot_node_primitives::{CollationSecondedSignal, PoV, Statement};
use polkadot_node_subsystem::{
messages::{
CollatorProtocolMessage, NetworkBridgeEvent, NetworkBridgeTxMessage, ParentHeadData,
},
messages::{CollatorProtocolMessage, NetworkBridgeEvent, NetworkBridgeTxMessage},
overseer, FromOrchestra, OverseerSignal,
};
use polkadot_node_subsystem_util::{
Expand Down Expand Up @@ -381,7 +379,6 @@ async fn distribute_collation<Context>(
state: &mut State,
id: ParaId,
receipt: CandidateReceipt,
parent_head_data_hash: Hash,
pov: PoV,
parent_head_data: HeadData,
result_sender: Option<oneshot::Sender<CollationSecondedSignal>>,
Expand Down Expand Up @@ -508,12 +505,6 @@ async fn distribute_collation<Context>(
state.collation_result_senders.insert(candidate_hash, result_sender);
}

let parent_head_data = if elastic_scaling {
ParentHeadData::WithData { hash: parent_head_data_hash, head_data: parent_head_data }
} else {
ParentHeadData::OnlyHash(parent_head_data_hash)
};

let para_head = receipt.descriptor.para_head();
per_relay_parent.collations.insert(
candidate_hash,
Expand Down Expand Up @@ -786,7 +777,7 @@ async fn process_msg<Context>(
},
DistributeCollation {
candidate_receipt,
parent_head_data_hash,
parent_head_data_hash: _,
pov,
parent_head_data,
result_sender,
Expand All @@ -811,7 +802,6 @@ async fn process_msg<Context>(
state,
id,
candidate_receipt,
parent_head_data_hash,
pov,
parent_head_data,
result_sender,
Expand Down Expand Up @@ -859,24 +849,19 @@ async fn send_collation(
request: VersionedCollationRequest,
receipt: CandidateReceipt,
pov: PoV,
parent_head_data: ParentHeadData,
parent_head_data: HeadData,
) {
let (tx, rx) = oneshot::channel();

let relay_parent = request.relay_parent();
let peer_id = request.peer_id();
let candidate_hash = receipt.hash();

let result = match parent_head_data {
ParentHeadData::WithData { head_data, .. } =>
Ok(request_v2::CollationFetchingResponse::CollationWithParentHeadData {
receipt,
pov,
parent_head_data: head_data,
}),
ParentHeadData::OnlyHash(_) =>
Ok(request_v2::CollationFetchingResponse::Collation(receipt, pov)),
};
let result = Ok(request_v2::CollationFetchingResponse::CollationWithParentHeadData {
Comment thread
alexggh marked this conversation as resolved.
receipt,
pov,
parent_head_data,
});

let response =
OutgoingResponse { result, reputation_changes: Vec::new(), sent_feedback: Some(tx) };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,8 @@ fn decode_collation_response(bytes: &[u8]) -> (CandidateReceipt, PoV) {
let response: CollationFetchingResponse =
CollationFetchingResponse::decode(&mut &bytes[..]).expect("Decoding should work");
match response {
CollationFetchingResponse::Collation(receipt, pov) => (receipt, pov),
CollationFetchingResponse::Collation(_, _) =>
panic!("Expected to always receive CollationWithParentHeadData"),
CollationFetchingResponse::CollationWithParentHeadData { receipt, pov, .. } =>
(receipt, pov),
}
Expand Down
11 changes: 11 additions & 0 deletions prdoc/pr_8939.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: Always send full parent header, not only hash, part of collation response
doc:
- audience: Node Dev
description: |-
Implementation of https://github.com/paritytech/polkadot-sdk/issues/7733

# Description
Instead of **conditionally** sending the full parent header in the collation response we now **always** send it (never the hash of it).
crates:
- name: polkadot-collator-protocol
bump: patch
Loading