mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-15 16:05:43 +00:00
grandpa: round catchup messages (#2801)
* grandpa: initial structure for catch up messages * grandpa: answer catch up requests * grandpa: inject catch up messages into global stream * grandpa: keep track of pending catch up request * grandpa: block catchup until all referenced blocks are imported * grandpa: unify catch up and commit streams * grandpa: simplify communication stream/sink types * grandpa: note gossip validator on catch up message import * grandpa: fix cost on catch up message validation * grandpa: check signatures on catch up messages * grandpa: clean up catch up request handling state * grandpa: adjust costs on invalid catch up requests * grandpa: release lock before pushing catch up message * grandpa: validate catch up request against peer view * grandpa: catch up docs * grandpa: fix tests * grandpa: until_imported: add tests for catch up messages * grandpa: add tests for catch up message gossip validation * grandpa: integrate HistoricalVotes changes * grandpa: add test for neighbor packet triggering catch up * grandpa: add test for full voter catch up * grandpa: depend on finality-grandpa 0.8 from crates * granda: use finality-grandpa test helpers * grandpa: add PSM cost for answering catch up requests * grandpa: code style fixes Co-Authored-By: Robert Habermeier <rphmeier@gmail.com> * grandpa: more trailing commas * grandpa: lower cost of invalid catch up requests near set change * grandpa: process catch up sending on import of neighbor message * grandpa: add comments on HistoricalVotes * grandpa: use finality-grandpa v0.8.1 from crates.io * grandpa: fix test compilation
This commit is contained in:
@@ -30,7 +30,7 @@ use runtime_primitives::traits::{NumberFor, Block as BlockT};
|
||||
use substrate_primitives::{H256, Blake2Hasher};
|
||||
|
||||
use crate::{
|
||||
AuthoritySignature, global_communication, CommandOrError, Config, environment,
|
||||
global_communication, CommandOrError, CommunicationIn, Config, environment,
|
||||
LinkHalf, Network, aux_schema::PersistentData, VoterCommand, VoterSetState,
|
||||
};
|
||||
use crate::authorities::SharedAuthoritySet;
|
||||
@@ -70,7 +70,7 @@ fn grandpa_observer<B, E, Block: BlockT<Hash=H256>, RA, S>(
|
||||
E: CallExecutor<Block, Blake2Hasher> + Send + Sync,
|
||||
RA: Send + Sync,
|
||||
S: Stream<
|
||||
Item = voter::CommunicationIn<H256, NumberFor<Block>, AuthoritySignature, AuthorityId>,
|
||||
Item = CommunicationIn<Block>,
|
||||
Error = CommandOrError<Block::Hash, NumberFor<Block>>,
|
||||
>,
|
||||
{
|
||||
@@ -85,8 +85,8 @@ fn grandpa_observer<B, E, Block: BlockT<Hash=H256>, RA, S>(
|
||||
let commit = grandpa::Commit::from(commit);
|
||||
(round, commit, callback)
|
||||
},
|
||||
voter::CommunicationIn::Auxiliary(_) => {
|
||||
// ignore aux messages
|
||||
voter::CommunicationIn::CatchUp(..) => {
|
||||
// ignore catch up messages
|
||||
return future::ok(last_finalized_number);
|
||||
},
|
||||
};
|
||||
@@ -167,15 +167,9 @@ pub fn run_grandpa_observer<B, E, Block: BlockT<Hash=H256>, N, RA, SC>(
|
||||
} = link;
|
||||
|
||||
let PersistentData { authority_set, consensus_changes, set_state } = persistent_data;
|
||||
let initial_state = (authority_set, consensus_changes, set_state.clone(), voter_commands_rx.into_future());
|
||||
|
||||
let (network, network_startup) = NetworkBridge::new(
|
||||
network,
|
||||
config.clone(),
|
||||
None,
|
||||
on_exit.clone(),
|
||||
);
|
||||
|
||||
let initial_state = (authority_set, consensus_changes, set_state, voter_commands_rx.into_future());
|
||||
let (network, network_startup) = NetworkBridge::new(network, config.clone(), set_state, on_exit.clone());
|
||||
|
||||
let observer_work = future::loop_fn(initial_state, move |state| {
|
||||
let (authority_set, consensus_changes, set_state, voter_commands_rx) = state;
|
||||
|
||||
Reference in New Issue
Block a user