mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
implement candidate selection subsystem (#1645)
* choose the straightforward candidate selection algorithm for now * add draft implementation of candidate selection * fix typo in summary * more properly report misbehaving collators * describe how CandidateSelection subsystem becomes aware of candidates * revise candidate selection / collator protocol interaction pattern * implement rest of candidate selection per the guide * review: resolve nits * start writing test suite, harness * implement first test * add second test * implement third test Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>
This commit is contained in:
committed by
GitHub
parent
2f800d1489
commit
d1b1c17285
@@ -47,6 +47,8 @@ pub struct NewBackedCandidate(pub BackedCandidate);
|
||||
/// Messages received by the Candidate Selection subsystem.
|
||||
#[derive(Debug)]
|
||||
pub enum CandidateSelectionMessage {
|
||||
/// A candidate collation can be fetched from a collator and should be considered for seconding.
|
||||
Collation(Hash, ParaId, CollatorId),
|
||||
/// We recommended a particular candidate to be seconded, but it was invalid; penalize the collator.
|
||||
/// The hash is the relay parent.
|
||||
Invalid(Hash, CandidateReceipt),
|
||||
@@ -56,6 +58,7 @@ impl CandidateSelectionMessage {
|
||||
/// If the current variant contains the relay parent hash, return it.
|
||||
pub fn relay_parent(&self) -> Option<Hash> {
|
||||
match self {
|
||||
Self::Collation(hash, ..) => Some(*hash),
|
||||
Self::Invalid(hash, _) => Some(*hash),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user