Finality loop: get block justification and authorities change by consensus engine ID (#1619)

* SignedBlock: get justification by consensus engine id

* Define ConsensusLogReader

Making the check for authority changes more generic

* cod review changes
This commit is contained in:
Serban Iorga
2022-10-28 13:12:37 +03:00
committed by Bastian Köcher
parent f58e076ca2
commit 01538bc5fa
9 changed files with 90 additions and 66 deletions
+5 -3
View File
@@ -24,7 +24,7 @@ pub use crate::{
sync_loop_metrics::SyncLoopMetrics,
};
use bp_header_chain::FinalityProof;
use bp_header_chain::{ConsensusLogReader, FinalityProof};
use std::fmt::Debug;
mod finality_loop;
@@ -42,14 +42,16 @@ pub trait FinalitySyncPipeline: 'static + Clone + Debug + Send + Sync {
type Hash: Eq + Clone + Copy + Send + Sync + Debug;
/// Headers we're syncing are identified by this number.
type Number: relay_utils::BlockNumberBase;
/// A reader that can extract the consensus log from the header digest and interpret it.
type ConsensusLogReader: ConsensusLogReader;
/// Type of header that we're syncing.
type Header: SourceHeader<Self::Hash, Self::Number>;
type Header: SourceHeader<Self::Hash, Self::Number, Self::ConsensusLogReader>;
/// Finality proof type.
type FinalityProof: FinalityProof<Self::Number>;
}
/// Header that we're receiving from source node.
pub trait SourceHeader<Hash, Number>: Clone + Debug + PartialEq + Send + Sync {
pub trait SourceHeader<Hash, Number, Reader>: Clone + Debug + PartialEq + Send + Sync {
/// Returns hash of header.
fn hash(&self) -> Hash;
/// Returns number of header.