mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-01 02:11:01 +00:00
grandpa: rewrite warp sync proof generation (#8148)
* grandpa: use AuthoritySetChanges to generate warp sync proof * node: init grandpa warp sync protocol * grandpa: iterator for AuthoritySetChanges * grandpa: rewrite warp sync proof generation * grandpa: remove old code for warp sync generation * grandpa: fix indentation * grandpa: fix off by one * grandpa: use binary search to find start idx when generating warp sync proof * grandpa: add method to verify warp sync proofs * grandpa: remove unnecessary code to skip authority set changes * grandpa: add test for warp sync proof generation and verification * grandpa: add missing docs * grandpa: remove trailing comma
This commit is contained in:
@@ -182,9 +182,11 @@ impl<'a, Block: 'a + BlockT> Drop for PendingSetChanges<'a, Block> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn find_scheduled_change<B: BlockT>(header: &B::Header)
|
||||
-> Option<ScheduledChange<NumberFor<B>>>
|
||||
{
|
||||
/// Checks the given header for a consensus digest signalling a **standard** scheduled change and
|
||||
/// extracts it.
|
||||
pub fn find_scheduled_change<B: BlockT>(
|
||||
header: &B::Header,
|
||||
) -> Option<ScheduledChange<NumberFor<B>>> {
|
||||
let id = OpaqueDigestItemId::Consensus(&GRANDPA_ENGINE_ID);
|
||||
|
||||
let filter_log = |log: ConsensusLog<NumberFor<B>>| match log {
|
||||
@@ -197,9 +199,11 @@ pub(crate) fn find_scheduled_change<B: BlockT>(header: &B::Header)
|
||||
header.digest().convert_first(|l| l.try_to(id).and_then(filter_log))
|
||||
}
|
||||
|
||||
pub(crate) fn find_forced_change<B: BlockT>(header: &B::Header)
|
||||
-> Option<(NumberFor<B>, ScheduledChange<NumberFor<B>>)>
|
||||
{
|
||||
/// Checks the given header for a consensus digest signalling a **forced** scheduled change and
|
||||
/// extracts it.
|
||||
pub fn find_forced_change<B: BlockT>(
|
||||
header: &B::Header,
|
||||
) -> Option<(NumberFor<B>, ScheduledChange<NumberFor<B>>)> {
|
||||
let id = OpaqueDigestItemId::Consensus(&GRANDPA_ENGINE_ID);
|
||||
|
||||
let filter_log = |log: ConsensusLog<NumberFor<B>>| match log {
|
||||
|
||||
Reference in New Issue
Block a user