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
@@ -32,7 +32,7 @@ use polkadot_node_network_protocol::{
},
v1 as protocol_v1, OurView, PeerId, UnifiedReputationChange as Rep, View,
};
use polkadot_node_primitives::{PoV, SignedFullStatement, Statement};
use polkadot_node_primitives::{CollationSecondedSignal, PoV, Statement};
use polkadot_node_subsystem_util::{
metrics::{self, prometheus},
runtime::{get_availability_cores, get_group_rotation_info, RuntimeInfo},
@@ -266,7 +266,7 @@ struct State {
collations: HashMap<Hash, Collation>,
/// The result senders per collation.
collation_result_senders: HashMap<CandidateHash, oneshot::Sender<SignedFullStatement>>,
collation_result_senders: HashMap<CandidateHash, oneshot::Sender<CollationSecondedSignal>>,
/// Our validator groups per active leaf.
our_validators_groups: HashMap<Hash, ValidatorGroup>,
@@ -336,7 +336,7 @@ async fn distribute_collation<Context>(
id: ParaId,
receipt: CandidateReceipt,
pov: PoV,
result_sender: Option<oneshot::Sender<SignedFullStatement>>,
result_sender: Option<oneshot::Sender<CollationSecondedSignal>>,
) -> Result<()>
where
Context: SubsystemContext<Message = CollatorProtocolMessage>,
@@ -866,7 +866,7 @@ where
?origin,
"received a `CollationSeconded`",
);
let _ = sender.send(statement);
let _ = sender.send(CollationSecondedSignal { statement, relay_parent });
}
}
},