mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 17:31:05 +00:00
Add some message types from subsystem definitions (#1265)
* introduce polkadot-node-primitives * guide: change statement distribution message types * guide: remove variant from `CandidateSelectionMessage` * add a few more message types * add TODOs * Almost all messages * NewBackedCandidate notification * Formatting * Use AttestedCandidate as BackedCandidate * Update node/primitives/src/lib.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * Fix the tests * Bring in types from #1242 * Adds network bridge messages * More message types from doc * use fn pointer type * Fixes from the review * Add missing Runtime subsystem message * rename to CandidateValidationMessage and fix tests Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com> Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
87ae6e42f5
commit
c226c4403d
@@ -32,7 +32,7 @@ use sp_blockchain::HeaderBackend;
|
||||
use polkadot_overseer::{
|
||||
self as overseer,
|
||||
BlockInfo, Overseer, OverseerHandler, Subsystem, SubsystemContext, SpawnedSubsystem,
|
||||
ValidationSubsystemMessage, CandidateBackingSubsystemMessage,
|
||||
CandidateValidationMessage, CandidateBackingMessage,
|
||||
};
|
||||
pub use service::{
|
||||
AbstractService, Role, PruningMode, TransactionPoolOptions, Error, RuntimeGenesis,
|
||||
@@ -268,10 +268,10 @@ macro_rules! new_full_start {
|
||||
}}
|
||||
}
|
||||
|
||||
struct ValidationSubsystem;
|
||||
struct CandidateValidationSubsystem;
|
||||
|
||||
impl Subsystem<ValidationSubsystemMessage> for ValidationSubsystem {
|
||||
fn start(&mut self, mut ctx: SubsystemContext<ValidationSubsystemMessage>) -> SpawnedSubsystem {
|
||||
impl Subsystem<CandidateValidationMessage> for CandidateValidationSubsystem {
|
||||
fn start(&mut self, mut ctx: SubsystemContext<CandidateValidationMessage>) -> SpawnedSubsystem {
|
||||
SpawnedSubsystem(Box::pin(async move {
|
||||
while let Ok(_) = ctx.recv().await {}
|
||||
}))
|
||||
@@ -280,8 +280,8 @@ impl Subsystem<ValidationSubsystemMessage> for ValidationSubsystem {
|
||||
|
||||
struct CandidateBackingSubsystem;
|
||||
|
||||
impl Subsystem<CandidateBackingSubsystemMessage> for CandidateBackingSubsystem {
|
||||
fn start(&mut self, mut ctx: SubsystemContext<CandidateBackingSubsystemMessage>) -> SpawnedSubsystem {
|
||||
impl Subsystem<CandidateBackingMessage> for CandidateBackingSubsystem {
|
||||
fn start(&mut self, mut ctx: SubsystemContext<CandidateBackingMessage>) -> SpawnedSubsystem {
|
||||
SpawnedSubsystem(Box::pin(async move {
|
||||
while let Ok(_) = ctx.recv().await {}
|
||||
}))
|
||||
@@ -292,7 +292,7 @@ fn real_overseer<S: futures::task::Spawn>(
|
||||
leaves: impl IntoIterator<Item = BlockInfo>,
|
||||
s: S,
|
||||
) -> Result<(Overseer<S>, OverseerHandler), ServiceError> {
|
||||
let validation = Box::new(ValidationSubsystem);
|
||||
let validation = Box::new(CandidateValidationSubsystem);
|
||||
let candidate_backing = Box::new(CandidateBackingSubsystem);
|
||||
Overseer::new(leaves, validation, candidate_backing, s)
|
||||
.map_err(|e| ServiceError::Other(format!("Failed to create an Overseer: {:?}", e)))
|
||||
|
||||
Reference in New Issue
Block a user