mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 23:21:02 +00:00
[big refactor] Remove crate aliasing. (#4395)
* Rename: Phase 1. * Unify codec. * Fixing: Phase 2 * Fixing: Phase 3. * Fixing: Phase 4. * Fixing: Phase 5. * Fixing: Phase 6. * Fixing: Phase 7. * Fixing: Phase 8. Tests * Fixing: Phase 9. Tests!!! * Fixing: Phase 10. Moar tests! * Finally done! * More fixes. * Rename primitives:: to sp_core:: * Apply renames in finality-grandpa. * Fix benches. * Fix benches 2. * Revert node-template. * Fix frame-system in our modules.
This commit is contained in:
committed by
Gavin Wood
parent
f14d98a439
commit
8778ca7dc8
@@ -31,13 +31,13 @@ use std::sync::Arc;
|
||||
|
||||
use futures::{prelude::*, future::Executor as _, sync::mpsc};
|
||||
use futures03::{compat::Compat, stream::StreamExt, future::FutureExt as _, future::TryFutureExt as _};
|
||||
use grandpa::Message::{Prevote, Precommit, PrimaryPropose};
|
||||
use grandpa::{voter, voter_set::VoterSet};
|
||||
use finality_grandpa::Message::{Prevote, Precommit, PrimaryPropose};
|
||||
use finality_grandpa::{voter, voter_set::VoterSet};
|
||||
use log::{debug, trace};
|
||||
use network::ReputationChange;
|
||||
use network_gossip::{GossipEngine, Network};
|
||||
use codec::{Encode, Decode};
|
||||
use primitives::Pair;
|
||||
use sc_network::ReputationChange;
|
||||
use sc_network_gossip::{GossipEngine, Network};
|
||||
use parity_scale_codec::{Encode, Decode};
|
||||
use sp_core::Pair;
|
||||
use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header as HeaderT, NumberFor};
|
||||
use sc_telemetry::{telemetry, CONSENSUS_DEBUG, CONSENSUS_INFO};
|
||||
|
||||
@@ -49,7 +49,7 @@ use crate::environment::HasVoted;
|
||||
use gossip::{
|
||||
GossipMessage, FullCatchUpMessage, FullCommitMessage, VoteMessage, GossipValidator
|
||||
};
|
||||
use fg_primitives::{
|
||||
use sp_finality_grandpa::{
|
||||
AuthorityPair, AuthorityId, AuthoritySignature, SetId as SetIdNumber, RoundNumber,
|
||||
};
|
||||
|
||||
@@ -59,11 +59,11 @@ mod periodic;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
pub use fg_primitives::GRANDPA_ENGINE_ID;
|
||||
pub use sp_finality_grandpa::GRANDPA_ENGINE_ID;
|
||||
|
||||
// cost scalars for reporting peers.
|
||||
mod cost {
|
||||
use network::ReputationChange as Rep;
|
||||
use sc_network::ReputationChange as Rep;
|
||||
pub(super) const PAST_REJECTION: Rep = Rep::new(-50, "Grandpa: Past message");
|
||||
pub(super) const BAD_SIGNATURE: Rep = Rep::new(-100, "Grandpa: Bad signature");
|
||||
pub(super) const MALFORMED_CATCH_UP: Rep = Rep::new(-1000, "Grandpa: Malformed cath-up");
|
||||
@@ -87,7 +87,7 @@ mod cost {
|
||||
|
||||
// benefit scalars for reporting peers.
|
||||
mod benefit {
|
||||
use network::ReputationChange as Rep;
|
||||
use sc_network::ReputationChange as Rep;
|
||||
pub(super) const NEIGHBOR_MESSAGE: Rep = Rep::new(100, "Grandpa: Neighbor message");
|
||||
pub(super) const ROUND_MESSAGE: Rep = Rep::new(100, "Grandpa: Round message");
|
||||
pub(super) const BASIC_VALIDATED_CATCH_UP: Rep = Rep::new(200, "Grandpa: Catch-up message");
|
||||
@@ -356,7 +356,7 @@ impl<B: BlockT> NetworkBridge<B> {
|
||||
/// If the given vector of peers is empty then the underlying implementation
|
||||
/// should make a best effort to fetch the block from any peers it is
|
||||
/// connected to (NOTE: this assumption will change in the future #3629).
|
||||
pub(crate) fn set_sync_fork_request(&self, peers: Vec<network::PeerId>, hash: B::Hash, number: NumberFor<B>) {
|
||||
pub(crate) fn set_sync_fork_request(&self, peers: Vec<sc_network::PeerId>, hash: B::Hash, number: NumberFor<B>) {
|
||||
self.gossip_engine.set_sync_fork_request(peers, hash, number)
|
||||
}
|
||||
}
|
||||
@@ -370,7 +370,7 @@ fn incoming_global<B: BlockT>(
|
||||
) -> impl Stream<Item = CommunicationIn<B>, Error = Error> {
|
||||
let process_commit = move |
|
||||
msg: FullCommitMessage<B>,
|
||||
mut notification: network_gossip::TopicNotification,
|
||||
mut notification: sc_network_gossip::TopicNotification,
|
||||
gossip_engine: &mut GossipEngine<B>,
|
||||
gossip_validator: &Arc<GossipValidator<B>>,
|
||||
voters: &VoterSet<AuthorityId>,
|
||||
@@ -432,7 +432,7 @@ fn incoming_global<B: BlockT>(
|
||||
|
||||
let process_catch_up = move |
|
||||
msg: FullCatchUpMessage<B>,
|
||||
mut notification: network_gossip::TopicNotification,
|
||||
mut notification: sc_network_gossip::TopicNotification,
|
||||
gossip_engine: &mut GossipEngine<B>,
|
||||
gossip_validator: &Arc<GossipValidator<B>>,
|
||||
voters: &VoterSet<AuthorityId>,
|
||||
@@ -557,15 +557,15 @@ impl<Block: BlockT> Sink for OutgoingMessages<Block>
|
||||
fn start_send(&mut self, mut msg: Message<Block>) -> StartSend<Message<Block>, Error> {
|
||||
// if we've voted on this round previously under the same key, send that vote instead
|
||||
match &mut msg {
|
||||
grandpa::Message::PrimaryPropose(ref mut vote) =>
|
||||
finality_grandpa::Message::PrimaryPropose(ref mut vote) =>
|
||||
if let Some(propose) = self.has_voted.propose() {
|
||||
*vote = propose.clone();
|
||||
},
|
||||
grandpa::Message::Prevote(ref mut vote) =>
|
||||
finality_grandpa::Message::Prevote(ref mut vote) =>
|
||||
if let Some(prevote) = self.has_voted.prevote() {
|
||||
*vote = prevote.clone();
|
||||
},
|
||||
grandpa::Message::Precommit(ref mut vote) =>
|
||||
finality_grandpa::Message::Precommit(ref mut vote) =>
|
||||
if let Some(precommit) = self.has_voted.precommit() {
|
||||
*vote = precommit.clone();
|
||||
},
|
||||
@@ -660,7 +660,7 @@ fn check_compact_commit<Block: BlockT>(
|
||||
.enumerate()
|
||||
{
|
||||
use crate::communication::gossip::Misbehavior;
|
||||
use grandpa::Message as GrandpaMessage;
|
||||
use finality_grandpa::Message as GrandpaMessage;
|
||||
|
||||
if let Err(()) = check_message_sig::<Block>(
|
||||
&GrandpaMessage::Precommit(precommit.clone()),
|
||||
@@ -772,7 +772,7 @@ fn check_catch_up<Block: BlockT>(
|
||||
// check signatures on all contained prevotes.
|
||||
let signatures_checked = check_signatures::<Block, _>(
|
||||
msg.prevotes.iter().map(|vote| {
|
||||
(grandpa::Message::Prevote(vote.prevote.clone()), &vote.id, &vote.signature)
|
||||
(finality_grandpa::Message::Prevote(vote.prevote.clone()), &vote.id, &vote.signature)
|
||||
}),
|
||||
msg.round_number,
|
||||
set_id.0,
|
||||
@@ -782,7 +782,7 @@ fn check_catch_up<Block: BlockT>(
|
||||
// check signatures on all contained precommits.
|
||||
let _ = check_signatures::<Block, _>(
|
||||
msg.precommits.iter().map(|vote| {
|
||||
(grandpa::Message::Precommit(vote.precommit.clone()), &vote.id, &vote.signature)
|
||||
(finality_grandpa::Message::Precommit(vote.precommit.clone()), &vote.id, &vote.signature)
|
||||
}),
|
||||
msg.round_number,
|
||||
set_id.0,
|
||||
|
||||
Reference in New Issue
Block a user