Subscribe to justifications in Millau->Rialto headers sync (#394)

* maintain MillauHeadersToRialto sync by subscribing to Millau justifications

* more tracing in maintain

* Update relays/substrate/src/headers_maintain.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* Update relays/substrate/src/headers_maintain.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

* -Please

* -TODO

* revert raise recursion limit

* updated comment

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
This commit is contained in:
Svyatoslav Nikolsky
2020-10-26 19:36:29 +03:00
committed by Bastian Köcher
parent e2d9b6393d
commit 1b96e51679
19 changed files with 508 additions and 33 deletions
@@ -44,6 +44,15 @@ pub enum Error {
InvalidPrecommitAncestries,
}
/// Decode justification target.
pub fn decode_justification_target<Header: HeaderT>(
raw_justification: &[u8],
) -> Result<(Header::Hash, Header::Number), Error> {
GrandpaJustification::<Header>::decode(&mut &raw_justification[..])
.map(|justification| (justification.commit.target_hash, justification.commit.target_number))
.map_err(|_| Error::JustificationDecode)
}
/// Verify that justification, that is generated by given authority set, finalizes given header.
pub fn verify_justification<Header: HeaderT>(
finalized_target: (Header::Hash, Header::Number),
+2
View File
@@ -41,6 +41,8 @@ use sp_std::{marker::PhantomData, prelude::*};
// Re-export since the node uses these when configuring genesis
pub use storage::{AuthoritySet, ScheduledChange};
pub use justification::decode_justification_target;
mod justification;
mod storage;
mod storage_proof;