mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +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
@@ -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>>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user