mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 21:27:57 +00:00
Backport: Implement basic equivocations detection loop (#2375)
* Implement basic equivocations detection loop (#2367) * FinalityProofsBuf adjustments - store a Vec<FinalityProof> - transform prune `buf_limit` to Option * FinalityProof: add target_header_hash() * Target client: implement best_synced_header_hash() * Implement first version of the equivocations detection loop * Address code review comments * Leftover * polkadot-staging adjustments
This commit is contained in:
committed by
Bastian Köcher
parent
cc3bbc690b
commit
588508acd4
@@ -97,7 +97,11 @@ impl<H: HeaderT> GrandpaJustification<H> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<H: HeaderT> crate::FinalityProof<H::Number> for GrandpaJustification<H> {
|
||||
impl<H: HeaderT> crate::FinalityProof<H::Hash, H::Number> for GrandpaJustification<H> {
|
||||
fn target_header_hash(&self) -> H::Hash {
|
||||
self.commit.target_hash
|
||||
}
|
||||
|
||||
fn target_header_number(&self) -> H::Number {
|
||||
self.commit.target_number
|
||||
}
|
||||
|
||||
@@ -127,7 +127,10 @@ pub struct InitializationData<H: HeaderT> {
|
||||
}
|
||||
|
||||
/// Abstract finality proof that is justifying block finality.
|
||||
pub trait FinalityProof<Number>: Clone + Send + Sync + Debug {
|
||||
pub trait FinalityProof<Hash, Number>: Clone + Send + Sync + Debug {
|
||||
/// Return hash of header that this proof is generated for.
|
||||
fn target_header_hash(&self) -> Hash;
|
||||
|
||||
/// Return number of header that this proof is generated for.
|
||||
fn target_header_number(&self) -> Number;
|
||||
}
|
||||
@@ -209,7 +212,7 @@ impl<Header: HeaderT> TryFrom<StoredHeaderGrandpaInfo<Header>> for HeaderGrandpa
|
||||
/// Helper trait for finding equivocations in finality proofs.
|
||||
pub trait FindEquivocations<FinalityProof, FinalityVerificationContext, EquivocationProof> {
|
||||
/// The type returned when encountering an error while looking for equivocations.
|
||||
type Error;
|
||||
type Error: Debug;
|
||||
|
||||
/// Find equivocations.
|
||||
fn find_equivocations(
|
||||
|
||||
Reference in New Issue
Block a user