mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 18:41:05 +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
@@ -17,9 +17,9 @@
|
||||
use crate::Network;
|
||||
use crate::state_machine::{ConsensusGossip, Validator, TopicNotification};
|
||||
|
||||
use network::Context;
|
||||
use network::message::generic::ConsensusMessage;
|
||||
use network::{Event, ReputationChange};
|
||||
use sc_network::Context;
|
||||
use sc_network::message::generic::ConsensusMessage;
|
||||
use sc_network::{Event, ReputationChange};
|
||||
|
||||
use futures::{prelude::*, channel::mpsc, compat::Compat01As03, task::SpawnExt as _};
|
||||
use libp2p::PeerId;
|
||||
@@ -215,7 +215,7 @@ impl<B: BlockT> GossipEngine<B> {
|
||||
|
||||
/// Send addressed message to the given peers. The message is not kept or multicast
|
||||
/// later on.
|
||||
pub fn send_message(&self, who: Vec<network::PeerId>, data: Vec<u8>) {
|
||||
pub fn send_message(&self, who: Vec<sc_network::PeerId>, data: Vec<u8>) {
|
||||
let mut inner = self.inner.lock();
|
||||
let inner = &mut *inner;
|
||||
|
||||
@@ -244,7 +244,7 @@ impl<B: BlockT> GossipEngine<B> {
|
||||
///
|
||||
/// Note: this method isn't strictly related to gossiping and should eventually be moved
|
||||
/// somewhere else.
|
||||
pub fn set_sync_fork_request(&self, peers: Vec<network::PeerId>, hash: B::Hash, number: NumberFor<B>) {
|
||||
pub fn set_sync_fork_request(&self, peers: Vec<sc_network::PeerId>, hash: B::Hash, number: NumberFor<B>) {
|
||||
self.inner.lock().context_ext.set_sync_fork_request(peers, hash, number);
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@ impl<B: BlockT, N: Network<B>> Context<B> for ContextOverService<N> {
|
||||
|
||||
trait ContextExt<B: BlockT> {
|
||||
fn announce(&self, block: B::Hash, associated_data: Vec<u8>);
|
||||
fn set_sync_fork_request(&self, peers: Vec<network::PeerId>, hash: B::Hash, number: NumberFor<B>);
|
||||
fn set_sync_fork_request(&self, peers: Vec<sc_network::PeerId>, hash: B::Hash, number: NumberFor<B>);
|
||||
}
|
||||
|
||||
impl<B: BlockT, N: Network<B>> ContextExt<B> for ContextOverService<N> {
|
||||
@@ -295,7 +295,7 @@ impl<B: BlockT, N: Network<B>> ContextExt<B> for ContextOverService<N> {
|
||||
Network::announce(&self.network, block, associated_data)
|
||||
}
|
||||
|
||||
fn set_sync_fork_request(&self, peers: Vec<network::PeerId>, hash: B::Hash, number: NumberFor<B>) {
|
||||
fn set_sync_fork_request(&self, peers: Vec<sc_network::PeerId>, hash: B::Hash, number: NumberFor<B>) {
|
||||
Network::set_sync_fork_request(&self.network, peers, hash, number)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ pub use self::state_machine::{TopicNotification, MessageIntent};
|
||||
pub use self::state_machine::{Validator, ValidatorContext, ValidationResult};
|
||||
pub use self::state_machine::DiscardAll;
|
||||
|
||||
use network::{specialization::NetworkSpecialization, Event, ExHashT, NetworkService, PeerId, ReputationChange};
|
||||
use sc_network::{specialization::NetworkSpecialization, Event, ExHashT, NetworkService, PeerId, ReputationChange};
|
||||
use sp_runtime::{traits::{Block as BlockT, NumberFor}, ConsensusEngineId};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -134,7 +134,7 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Network<B> for Arc<Netw
|
||||
NetworkService::announce_block(self, block, associated_data)
|
||||
}
|
||||
|
||||
fn set_sync_fork_request(&self, peers: Vec<network::PeerId>, hash: B::Hash, number: NumberFor<B>) {
|
||||
fn set_sync_fork_request(&self, peers: Vec<sc_network::PeerId>, hash: B::Hash, number: NumberFor<B>) {
|
||||
NetworkService::set_sync_fork_request(self, peers, hash, number)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ use lru::LruCache;
|
||||
use libp2p::PeerId;
|
||||
use sp_runtime::traits::{Block as BlockT, Hash, HashFor};
|
||||
use sp_runtime::ConsensusEngineId;
|
||||
pub use network::message::generic::{Message, ConsensusMessage};
|
||||
use network::Context;
|
||||
use network::config::Roles;
|
||||
pub use sc_network::message::generic::{Message, ConsensusMessage};
|
||||
use sc_network::Context;
|
||||
use sc_network::config::Roles;
|
||||
|
||||
// FIXME: Add additional spam/DoS attack protection: https://github.com/paritytech/substrate/issues/1115
|
||||
const KNOWN_MESSAGES_CACHE_SIZE: usize = 4096;
|
||||
@@ -34,7 +34,7 @@ const KNOWN_MESSAGES_CACHE_SIZE: usize = 4096;
|
||||
const REBROADCAST_INTERVAL: time::Duration = time::Duration::from_secs(30);
|
||||
|
||||
mod rep {
|
||||
use network::ReputationChange as Rep;
|
||||
use sc_network::ReputationChange as Rep;
|
||||
/// Reputation change when a peer sends us a gossip message that we didn't know about.
|
||||
pub const GOSSIP_SUCCESS: Rep = Rep::new(1 << 4, "Successfull gossip");
|
||||
/// Reputation change when a peer sends us a gossip message that we already knew about.
|
||||
|
||||
Reference in New Issue
Block a user