mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 14:41:11 +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
@@ -20,7 +20,6 @@ use crate::{
|
||||
};
|
||||
use crate::{ExHashT, specialization::NetworkSpecialization};
|
||||
use crate::protocol::{CustomMessageOutcome, Protocol};
|
||||
use consensus::{BlockOrigin, import_queue::{IncomingBlock, Origin}};
|
||||
use futures::prelude::*;
|
||||
use libp2p::NetworkBehaviour;
|
||||
use libp2p::core::{Multiaddr, PeerId, PublicKey};
|
||||
@@ -28,6 +27,7 @@ use libp2p::kad::record;
|
||||
use libp2p::swarm::{NetworkBehaviourAction, NetworkBehaviourEventProcess};
|
||||
use libp2p::core::{nodes::Substream, muxing::StreamMuxerBox};
|
||||
use log::{debug, warn};
|
||||
use sp_consensus::{BlockOrigin, import_queue::{IncomingBlock, Origin}};
|
||||
use sp_runtime::{traits::{Block as BlockT, NumberFor}, Justification};
|
||||
use std::iter;
|
||||
use void;
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
|
||||
//! Blockchain access trait
|
||||
|
||||
use client::Client as SubstrateClient;
|
||||
use sc_client::Client as SubstrateClient;
|
||||
use sp_blockchain::Error;
|
||||
use client_api::{ChangesProof, StorageProof, ClientInfo, CallExecutor};
|
||||
use consensus::{BlockImport, BlockStatus, Error as ConsensusError};
|
||||
use sc_client_api::{ChangesProof, StorageProof, ClientInfo, CallExecutor};
|
||||
use sp_consensus::{BlockImport, BlockStatus, Error as ConsensusError};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};
|
||||
use sp_runtime::generic::{BlockId};
|
||||
use sp_runtime::Justification;
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use primitives::storage::{StorageKey, ChildInfo};
|
||||
use sp_core::{H256, Blake2Hasher};
|
||||
use sp_core::storage::{StorageKey, ChildInfo};
|
||||
|
||||
/// Local client abstraction for the network.
|
||||
pub trait Client<Block: BlockT>: Send + Sync {
|
||||
@@ -93,7 +93,7 @@ impl<Block: BlockT> FinalityProofProvider<Block> for () {
|
||||
}
|
||||
|
||||
impl<B, E, Block, RA> Client<Block> for SubstrateClient<B, E, Block, RA> where
|
||||
B: client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
B: sc_client_api::backend::Backend<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
E: CallExecutor<Block, Blake2Hasher> + Send + Sync + 'static,
|
||||
Self: BlockImport<Block, Error=ConsensusError>,
|
||||
Block: BlockT<Hash=H256>,
|
||||
|
||||
@@ -26,7 +26,7 @@ use crate::chain::{Client, FinalityProofProvider};
|
||||
use crate::on_demand_layer::OnDemand;
|
||||
use crate::service::{ExHashT, TransactionPool};
|
||||
use bitflags::bitflags;
|
||||
use consensus::{block_validation::BlockAnnounceValidator, import_queue::ImportQueue};
|
||||
use sp_consensus::{block_validation::BlockAnnounceValidator, import_queue::ImportQueue};
|
||||
use sp_runtime::traits::{Block as BlockT};
|
||||
use libp2p::identity::{Keypair, ed25519};
|
||||
use libp2p::wasm_ext;
|
||||
|
||||
@@ -63,7 +63,7 @@ use libp2p::multiaddr::Protocol;
|
||||
use log::{debug, info, trace, warn};
|
||||
use std::{cmp, collections::VecDeque, time::Duration};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use primitives::hexdisplay::HexDisplay;
|
||||
use sp_core::hexdisplay::HexDisplay;
|
||||
|
||||
/// Implementation of `NetworkBehaviour` that discovers the nodes on the network.
|
||||
pub struct DiscoveryBehaviour<TSubstream> {
|
||||
|
||||
@@ -195,7 +195,7 @@ pub use libp2p::multiaddr;
|
||||
|
||||
pub use message::{generic as generic_message, RequestId, Status as StatusMessage};
|
||||
pub use on_demand_layer::{OnDemand, RemoteResponse};
|
||||
pub use peerset::ReputationChange;
|
||||
pub use sc_peerset::ReputationChange;
|
||||
|
||||
// Used by the `construct_simple_protocol!` macro.
|
||||
#[doc(hidden)]
|
||||
|
||||
@@ -23,7 +23,7 @@ use futures::{prelude::*, sync::mpsc, sync::oneshot};
|
||||
use futures03::compat::{Compat01As03, Future01CompatExt as _};
|
||||
use parking_lot::Mutex;
|
||||
use sp_blockchain::Error as ClientError;
|
||||
use client_api::{Fetcher, FetchChecker, RemoteHeaderRequest,
|
||||
use sc_client_api::{Fetcher, FetchChecker, RemoteHeaderRequest,
|
||||
RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest,
|
||||
RemoteReadChildRequest, RemoteBodyRequest};
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
|
||||
@@ -24,8 +24,8 @@ use libp2p::{Multiaddr, PeerId};
|
||||
use libp2p::core::{ConnectedPoint, nodes::Substream, muxing::StreamMuxerBox};
|
||||
use libp2p::swarm::{ProtocolsHandler, IntoProtocolsHandler};
|
||||
use libp2p::swarm::{NetworkBehaviour, NetworkBehaviourAction, PollParameters};
|
||||
use primitives::storage::{StorageKey, ChildInfo};
|
||||
use consensus::{
|
||||
use sp_core::storage::{StorageKey, ChildInfo};
|
||||
use sp_consensus::{
|
||||
BlockOrigin,
|
||||
block_validation::BlockAnnounceValidator,
|
||||
import_queue::{BlockImportResult, BlockImportError, IncomingBlock, Origin}
|
||||
@@ -50,7 +50,7 @@ use std::fmt::Write;
|
||||
use std::{cmp, num::NonZeroUsize, time};
|
||||
use log::{log, Level, trace, debug, warn, error};
|
||||
use crate::chain::{Client, FinalityProofProvider};
|
||||
use client_api::{FetchChecker, ChangesProof, StorageProof};
|
||||
use sc_client_api::{FetchChecker, ChangesProof, StorageProof};
|
||||
use crate::error;
|
||||
use util::LruHashSet;
|
||||
|
||||
@@ -89,7 +89,7 @@ const MAX_CONSENSUS_MESSAGES: usize = 256;
|
||||
const LIGHT_MAXIMAL_BLOCKS_DIFFERENCE: u64 = 8192;
|
||||
|
||||
mod rep {
|
||||
use peerset::ReputationChange as Rep;
|
||||
use sc_peerset::ReputationChange as Rep;
|
||||
/// Reputation change when a peer is "clogged", meaning that it's not fast enough to process our
|
||||
/// messages.
|
||||
pub const CLOGGED_PEER: Rep = Rep::new(-(1 << 12), "Clogged message queue");
|
||||
@@ -140,7 +140,7 @@ pub struct Protocol<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> {
|
||||
// Connected peers pending Status message.
|
||||
handshaking_peers: HashMap<PeerId, HandshakingPeer>,
|
||||
/// Used to report reputation changes.
|
||||
peerset_handle: peerset::PeersetHandle,
|
||||
peerset_handle: sc_peerset::PeersetHandle,
|
||||
transaction_pool: Arc<dyn TransactionPool<H, B>>,
|
||||
/// When asked for a proof of finality, we use this struct to build one.
|
||||
finality_proof_provider: Option<Arc<dyn FinalityProofProvider<B>>>,
|
||||
@@ -195,11 +195,11 @@ pub struct PeerInfo<B: BlockT> {
|
||||
|
||||
struct LightDispatchIn<'a> {
|
||||
behaviour: &'a mut LegacyProto<Substream<StreamMuxerBox>>,
|
||||
peerset: peerset::PeersetHandle,
|
||||
peerset: sc_peerset::PeersetHandle,
|
||||
}
|
||||
|
||||
impl<'a, B: BlockT> LightDispatchNetwork<B> for LightDispatchIn<'a> {
|
||||
fn report_peer(&mut self, who: &PeerId, reputation: peerset::ReputationChange) {
|
||||
fn report_peer(&mut self, who: &PeerId, reputation: sc_peerset::ReputationChange) {
|
||||
self.peerset.report_peer(who.clone(), reputation)
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ impl<'a, B: BlockT> LightDispatchNetwork<B> for LightDispatchIn<'a> {
|
||||
pub trait Context<B: BlockT> {
|
||||
/// Adjusts the reputation of the peer. Use this to point out that a peer has been malign or
|
||||
/// irresponsible or appeared lazy.
|
||||
fn report_peer(&mut self, who: PeerId, reputation: peerset::ReputationChange);
|
||||
fn report_peer(&mut self, who: PeerId, reputation: sc_peerset::ReputationChange);
|
||||
|
||||
/// Force disconnecting from a peer. Use this when a peer misbehaved.
|
||||
fn disconnect_peer(&mut self, who: PeerId);
|
||||
@@ -339,21 +339,21 @@ pub trait Context<B: BlockT> {
|
||||
struct ProtocolContext<'a, B: 'a + BlockT, H: 'a + ExHashT> {
|
||||
behaviour: &'a mut LegacyProto<Substream<StreamMuxerBox>>,
|
||||
context_data: &'a mut ContextData<B, H>,
|
||||
peerset_handle: &'a peerset::PeersetHandle,
|
||||
peerset_handle: &'a sc_peerset::PeersetHandle,
|
||||
}
|
||||
|
||||
impl<'a, B: BlockT + 'a, H: 'a + ExHashT> ProtocolContext<'a, B, H> {
|
||||
fn new(
|
||||
context_data: &'a mut ContextData<B, H>,
|
||||
behaviour: &'a mut LegacyProto<Substream<StreamMuxerBox>>,
|
||||
peerset_handle: &'a peerset::PeersetHandle,
|
||||
peerset_handle: &'a sc_peerset::PeersetHandle,
|
||||
) -> Self {
|
||||
ProtocolContext { context_data, peerset_handle, behaviour }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, B: BlockT + 'a, H: ExHashT + 'a> Context<B> for ProtocolContext<'a, B, H> {
|
||||
fn report_peer(&mut self, who: PeerId, reputation: peerset::ReputationChange) {
|
||||
fn report_peer(&mut self, who: PeerId, reputation: sc_peerset::ReputationChange) {
|
||||
self.peerset_handle.report_peer(who, reputation)
|
||||
}
|
||||
|
||||
@@ -437,9 +437,9 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
|
||||
finality_proof_provider: Option<Arc<dyn FinalityProofProvider<B>>>,
|
||||
finality_proof_request_builder: Option<BoxFinalityProofRequestBuilder<B>>,
|
||||
protocol_id: ProtocolId,
|
||||
peerset_config: peerset::PeersetConfig,
|
||||
peerset_config: sc_peerset::PeersetConfig,
|
||||
block_announce_validator: Box<dyn BlockAnnounceValidator<B> + Send>
|
||||
) -> error::Result<(Protocol<B, S, H>, peerset::PeersetHandle)> {
|
||||
) -> error::Result<(Protocol<B, S, H>, sc_peerset::PeersetHandle)> {
|
||||
let info = chain.info();
|
||||
let sync = ChainSync::new(
|
||||
config.roles,
|
||||
@@ -459,7 +459,7 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
|
||||
imp_p
|
||||
};
|
||||
|
||||
let (peerset, peerset_handle) = peerset::Peerset::from_config(peerset_config);
|
||||
let (peerset, peerset_handle) = sc_peerset::Peerset::from_config(peerset_config);
|
||||
let versions = &((MIN_VERSION as u8)..=(CURRENT_VERSION as u8)).collect::<Vec<u8>>();
|
||||
let behaviour = LegacyProto::new(protocol_id, versions, peerset);
|
||||
|
||||
@@ -853,7 +853,7 @@ impl<B: BlockT, S: NetworkSpecialization<B>, H: ExHashT> Protocol<B, S, H> {
|
||||
}
|
||||
|
||||
/// Adjusts the reputation of a node.
|
||||
pub fn report_peer(&self, who: PeerId, reputation: peerset::ReputationChange) {
|
||||
pub fn report_peer(&self, who: PeerId, reputation: sc_peerset::ReputationChange) {
|
||||
self.peerset_handle.report_peer(who, reputation)
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ pub struct LegacyProto< TSubstream> {
|
||||
protocol: RegisteredProtocol,
|
||||
|
||||
/// Receiver for instructions about who to connect to or disconnect from.
|
||||
peerset: peerset::Peerset,
|
||||
peerset: sc_peerset::Peerset,
|
||||
|
||||
/// List of peers in our state.
|
||||
peers: FnvHashMap<PeerId, PeerState>,
|
||||
@@ -76,7 +76,7 @@ pub struct LegacyProto< TSubstream> {
|
||||
|
||||
/// We generate indices to identify incoming connections. This is the next value for the index
|
||||
/// to use when a connection is incoming.
|
||||
next_incoming_index: peerset::IncomingIndex,
|
||||
next_incoming_index: sc_peerset::IncomingIndex,
|
||||
|
||||
/// Events to produce from `poll()`.
|
||||
events: SmallVec<[NetworkBehaviourAction<CustomProtoHandlerIn, LegacyProtoOut>; 4]>,
|
||||
@@ -183,7 +183,7 @@ struct IncomingPeer {
|
||||
/// connection corresponding to it has been closed or replaced already.
|
||||
alive: bool,
|
||||
/// Id that the we sent to the peerset.
|
||||
incoming_id: peerset::IncomingIndex,
|
||||
incoming_id: sc_peerset::IncomingIndex,
|
||||
}
|
||||
|
||||
/// Event that can be emitted by the `LegacyProto`.
|
||||
@@ -230,7 +230,7 @@ impl<TSubstream> LegacyProto<TSubstream> {
|
||||
pub fn new(
|
||||
protocol: impl Into<ProtocolId>,
|
||||
versions: &[u8],
|
||||
peerset: peerset::Peerset,
|
||||
peerset: sc_peerset::Peerset,
|
||||
) -> Self {
|
||||
let protocol = RegisteredProtocol::new(protocol, versions);
|
||||
|
||||
@@ -239,7 +239,7 @@ impl<TSubstream> LegacyProto<TSubstream> {
|
||||
peerset,
|
||||
peers: FnvHashMap::default(),
|
||||
incoming: SmallVec::new(),
|
||||
next_incoming_index: peerset::IncomingIndex(0),
|
||||
next_incoming_index: sc_peerset::IncomingIndex(0),
|
||||
events: SmallVec::new(),
|
||||
marker: PhantomData,
|
||||
}
|
||||
@@ -520,7 +520,7 @@ impl<TSubstream> LegacyProto<TSubstream> {
|
||||
}
|
||||
|
||||
/// Function that is called when the peerset wants us to accept an incoming node.
|
||||
fn peerset_report_accept(&mut self, index: peerset::IncomingIndex) {
|
||||
fn peerset_report_accept(&mut self, index: sc_peerset::IncomingIndex) {
|
||||
let incoming = if let Some(pos) = self.incoming.iter().position(|i| i.incoming_id == index) {
|
||||
self.incoming.remove(pos)
|
||||
} else {
|
||||
@@ -564,7 +564,7 @@ impl<TSubstream> LegacyProto<TSubstream> {
|
||||
}
|
||||
|
||||
/// Function that is called when the peerset wants us to reject an incoming node.
|
||||
fn peerset_report_reject(&mut self, index: peerset::IncomingIndex) {
|
||||
fn peerset_report_reject(&mut self, index: sc_peerset::IncomingIndex) {
|
||||
let incoming = if let Some(pos) = self.incoming.iter().position(|i| i.incoming_id == index) {
|
||||
self.incoming.remove(pos)
|
||||
} else {
|
||||
@@ -942,7 +942,7 @@ where
|
||||
// again in the short term.
|
||||
self.peerset.report_peer(
|
||||
source.clone(),
|
||||
peerset::ReputationChange::new(i32::min_value(), "Protocol error")
|
||||
sc_peerset::ReputationChange::new(i32::min_value(), "Protocol error")
|
||||
);
|
||||
self.disconnect_peer_inner(&source, Some(Duration::from_secs(5)));
|
||||
}
|
||||
@@ -965,16 +965,16 @@ where
|
||||
futures03::Stream::poll_next(Pin::new(&mut self.peerset), cx)
|
||||
).map(|v| Ok::<_, ()>(v)).compat();
|
||||
match peerset01.poll() {
|
||||
Ok(Async::Ready(Some(peerset::Message::Accept(index)))) => {
|
||||
Ok(Async::Ready(Some(sc_peerset::Message::Accept(index)))) => {
|
||||
self.peerset_report_accept(index);
|
||||
}
|
||||
Ok(Async::Ready(Some(peerset::Message::Reject(index)))) => {
|
||||
Ok(Async::Ready(Some(sc_peerset::Message::Reject(index)))) => {
|
||||
self.peerset_report_reject(index);
|
||||
}
|
||||
Ok(Async::Ready(Some(peerset::Message::Connect(id)))) => {
|
||||
Ok(Async::Ready(Some(sc_peerset::Message::Connect(id)))) => {
|
||||
self.peerset_report_connect(id);
|
||||
}
|
||||
Ok(Async::Ready(Some(peerset::Message::Drop(id)))) => {
|
||||
Ok(Async::Ready(Some(sc_peerset::Message::Drop(id)))) => {
|
||||
self.peerset_report_disconnect(id);
|
||||
}
|
||||
Ok(Async::Ready(None)) => {
|
||||
|
||||
@@ -68,7 +68,7 @@ fn build_nodes()
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
|
||||
.boxed();
|
||||
|
||||
let (peerset, _) = peerset::Peerset::from_config(peerset::PeersetConfig {
|
||||
let (peerset, _) = sc_peerset::Peerset::from_config(sc_peerset::PeersetConfig {
|
||||
in_peers: 25,
|
||||
out_peers: 25,
|
||||
bootnodes: if index == 0 {
|
||||
|
||||
@@ -26,14 +26,14 @@ use log::{trace, info};
|
||||
use futures::sync::oneshot::{Sender as OneShotSender};
|
||||
use linked_hash_map::{Entry, LinkedHashMap};
|
||||
use sp_blockchain::Error as ClientError;
|
||||
use client_api::{FetchChecker, RemoteHeaderRequest,
|
||||
use sc_client_api::{FetchChecker, RemoteHeaderRequest,
|
||||
RemoteCallRequest, RemoteReadRequest, RemoteChangesRequest, ChangesProof,
|
||||
RemoteReadChildRequest, RemoteBodyRequest, StorageProof};
|
||||
use crate::message::{self, BlockAttributes, Direction, FromBlock, RequestId};
|
||||
use libp2p::PeerId;
|
||||
use crate::config::Roles;
|
||||
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, NumberFor};
|
||||
use peerset::ReputationChange;
|
||||
use sc_peerset::ReputationChange;
|
||||
|
||||
/// Remote request timeout.
|
||||
const REQUEST_TIMEOUT: Duration = Duration::from_secs(15);
|
||||
@@ -681,10 +681,10 @@ pub mod tests {
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
use futures::{Future, sync::oneshot};
|
||||
use primitives::storage::ChildInfo;
|
||||
use sp_core::storage::ChildInfo;
|
||||
use sp_runtime::traits::{Block as BlockT, NumberFor, Header as HeaderT};
|
||||
use sp_blockchain::{Error as ClientError, Result as ClientResult};
|
||||
use client_api::{FetchChecker, RemoteHeaderRequest,
|
||||
use sc_client_api::{FetchChecker, RemoteHeaderRequest,
|
||||
ChangesProof, RemoteCallRequest, RemoteReadRequest,
|
||||
RemoteReadChildRequest, RemoteChangesRequest, RemoteBodyRequest};
|
||||
use crate::config::Roles;
|
||||
@@ -1233,7 +1233,7 @@ pub mod tests {
|
||||
assert_eq!(light_dispatch.active_peers.len(), 1);
|
||||
|
||||
let block = message::BlockData::<Block> {
|
||||
hash: primitives::H256::random(),
|
||||
hash: sp_core::H256::random(),
|
||||
header: None,
|
||||
body: Some(Vec::new()),
|
||||
message_queue: None,
|
||||
@@ -1271,7 +1271,7 @@ pub mod tests {
|
||||
|
||||
let response = {
|
||||
let blocks: Vec<_> = (0..3).map(|_| message::BlockData::<Block> {
|
||||
hash: primitives::H256::random(),
|
||||
hash: sp_core::H256::random(),
|
||||
header: None,
|
||||
body: Some(Vec::new()),
|
||||
message_queue: None,
|
||||
|
||||
@@ -26,7 +26,7 @@ pub use self::generic::{
|
||||
FinalityProofRequest, FinalityProofResponse,
|
||||
FromBlock, RemoteReadChildRequest,
|
||||
};
|
||||
use client_api::StorageProof;
|
||||
use sc_client_api::StorageProof;
|
||||
|
||||
/// A unique ID of a request.
|
||||
pub type RequestId = u64;
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
//!
|
||||
|
||||
use blocks::BlockCollection;
|
||||
use client_api::ClientInfo;
|
||||
use sc_client_api::ClientInfo;
|
||||
use sp_blockchain::Error as ClientError;
|
||||
use consensus::{BlockOrigin, BlockStatus,
|
||||
use sp_consensus::{BlockOrigin, BlockStatus,
|
||||
block_validation::{BlockAnnounceValidator, Validation},
|
||||
import_queue::{IncomingBlock, BlockImportResult, BlockImportError}
|
||||
};
|
||||
@@ -73,7 +73,7 @@ const MAJOR_SYNC_BLOCKS: u8 = 5;
|
||||
const ANNOUNCE_HISTORY_SIZE: usize = 64;
|
||||
|
||||
mod rep {
|
||||
use peerset::ReputationChange as Rep;
|
||||
use sc_peerset::ReputationChange as Rep;
|
||||
/// Reputation change when a peer sent us a message that led to a
|
||||
/// database read error.
|
||||
pub const BLOCKCHAIN_READ_ERROR: Rep = Rep::new(-(1 << 16), "DB Error");
|
||||
@@ -230,7 +230,7 @@ pub struct Status<B: BlockT> {
|
||||
|
||||
/// A peer did not behave as expected and should be reported.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct BadPeer(pub PeerId, pub peerset::ReputationChange);
|
||||
pub struct BadPeer(pub PeerId, pub sc_peerset::ReputationChange);
|
||||
|
||||
impl fmt::Display for BadPeer {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
||||
@@ -216,7 +216,7 @@ mod test {
|
||||
use super::{BlockCollection, BlockData, BlockRangeState};
|
||||
use crate::{message, PeerId};
|
||||
use sp_runtime::testing::{Block as RawBlock, ExtrinsicWrapper};
|
||||
use primitives::H256;
|
||||
use sp_core::H256;
|
||||
|
||||
type Block = RawBlock<ExtrinsicWrapper<u64>>;
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
use std::{collections::{HashMap, HashSet}, fs, marker::PhantomData, io, path::Path};
|
||||
use std::sync::{Arc, atomic::{AtomicBool, AtomicUsize, Ordering}};
|
||||
|
||||
use consensus::import_queue::{ImportQueue, Link};
|
||||
use consensus::import_queue::{BlockImportResult, BlockImportError};
|
||||
use sp_consensus::import_queue::{ImportQueue, Link};
|
||||
use sp_consensus::import_queue::{BlockImportResult, BlockImportError};
|
||||
use futures::{prelude::*, sync::mpsc};
|
||||
use futures03::TryFutureExt as _;
|
||||
use log::{warn, error, info};
|
||||
@@ -37,7 +37,7 @@ use libp2p::{PeerId, Multiaddr, kad::record};
|
||||
use libp2p::core::{transport::boxed::Boxed, muxing::StreamMuxerBox};
|
||||
use libp2p::swarm::NetworkBehaviour;
|
||||
use parking_lot::Mutex;
|
||||
use peerset::PeersetHandle;
|
||||
use sc_peerset::PeersetHandle;
|
||||
use sp_runtime::{traits::{Block as BlockT, NumberFor}, ConsensusEngineId};
|
||||
|
||||
use crate::{behaviour::{Behaviour, BehaviourOut}, config::{parse_str_addr, parse_addr}};
|
||||
@@ -176,7 +176,7 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> NetworkWorker
|
||||
}
|
||||
}
|
||||
|
||||
let peerset_config = peerset::PeersetConfig {
|
||||
let peerset_config = sc_peerset::PeersetConfig {
|
||||
in_peers: params.network_config.in_peers,
|
||||
out_peers: params.network_config.out_peers,
|
||||
bootnodes,
|
||||
@@ -604,7 +604,7 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> NetworkServic
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> consensus::SyncOracle
|
||||
impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> sp_consensus::SyncOracle
|
||||
for NetworkService<B, S, H>
|
||||
{
|
||||
fn is_major_syncing(&mut self) -> bool {
|
||||
@@ -616,7 +616,7 @@ impl<B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> consensus::Sy
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> consensus::SyncOracle
|
||||
impl<'a, B: BlockT + 'static, S: NetworkSpecialization<B>, H: ExHashT> sp_consensus::SyncOracle
|
||||
for &'a NetworkService<B, S, H>
|
||||
{
|
||||
fn is_major_syncing(&mut self) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user