From ec5a8141eb5ada6357066a4968dd812f3e30a69f Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Fri, 7 Dec 2018 20:16:27 -0700 Subject: [PATCH] cargo fix --edition --- src/bank.rs | 32 ++++++++--------- src/banking_stage.rs | 30 ++++++++-------- src/blob_fetch_stage.rs | 4 +-- src/broadcast_service.rs | 16 ++++----- src/client.rs | 6 ++-- src/cluster_info.rs | 42 +++++++++++----------- src/compute_leader_finality_service.rs | 14 ++++---- src/contact_info.rs | 2 +- src/counter.rs | 2 +- src/crds.rs | 6 ++-- src/crds_gossip.rs | 28 +++++++-------- src/crds_gossip_pull.rs | 16 ++++----- src/crds_gossip_push.rs | 18 +++++----- src/crds_traits_impls.rs | 2 +- src/crds_value.rs | 6 ++-- src/create_vote_account.rs | 4 +-- src/db_ledger.rs | 8 ++--- src/db_window.rs | 22 ++++++------ src/entry.rs | 8 ++--- src/fetch_stage.rs | 4 +-- src/fullnode.rs | 50 ++++++++++++++------------ src/gossip_service.rs | 10 +++--- src/leader_scheduler.rs | 14 ++++---- src/ledger.rs | 26 +++++++------- src/ledger_write_stage.rs | 10 +++--- src/mint.rs | 4 +-- src/netutil.rs | 4 +-- src/packet.rs | 16 ++++----- src/poh.rs | 2 +- src/poh_recorder.rs | 12 +++---- src/poh_service.rs | 18 +++++----- src/recvmmsg.rs | 6 ++-- src/replicate_stage.rs | 46 ++++++++++++------------ src/replicator.rs | 32 ++++++++--------- src/result.rs | 16 ++++----- src/retransmit_stage.rs | 18 +++++----- src/rpc.rs | 28 +++++++-------- src/rpc_pubsub.rs | 20 +++++------ src/rpc_request.rs | 4 +-- src/sigverify.rs | 16 ++++----- src/sigverify_stage.rs | 12 +++---- src/storage_stage.rs | 22 ++++++------ src/store_ledger_stage.rs | 10 +++--- src/streamer.rs | 10 +++--- src/thin_client.rs | 26 +++++++------- src/tpu.rs | 16 ++++----- src/tpu_forwarder.rs | 18 +++++----- src/tvu.rs | 46 ++++++++++++------------ src/vote_stage.rs | 12 +++---- src/wallet.rs | 18 +++++----- src/window.rs | 18 +++++----- src/window_service.rs | 34 +++++++++--------- 52 files changed, 435 insertions(+), 429 deletions(-) diff --git a/src/bank.rs b/src/bank.rs index 2d8a6a9dc6..fd7b9b0d08 100644 --- a/src/bank.rs +++ b/src/bank.rs @@ -3,21 +3,22 @@ //! on behalf of the caller, and a low-level API for when they have //! already been signed and verified. +use crate::counter::Counter; +use crate::entry::Entry; +use crate::jsonrpc_macros::pubsub::Sink; +use crate::leader_scheduler::LeaderScheduler; +use crate::ledger::Block; +use crate::mint::Mint; +use crate::poh_recorder::PohRecorder; +use crate::poh_service::NUM_TICKS_PER_SECOND; +use crate::rpc::RpcSignatureStatus; +use crate::runtime::{self, RuntimeError}; +use crate::storage_stage::StorageState; use bincode::deserialize; use bincode::serialize; -use counter::Counter; -use entry::Entry; use itertools::Itertools; -use jsonrpc_macros::pubsub::Sink; -use leader_scheduler::LeaderScheduler; -use ledger::Block; use log::Level; -use mint::Mint; -use poh_recorder::PohRecorder; -use poh_service::NUM_TICKS_PER_SECOND; use rayon::prelude::*; -use rpc::RpcSignatureStatus; -use runtime::{self, RuntimeError}; use solana_native_loader; use solana_sdk::account::Account; use solana_sdk::bpf_loader; @@ -42,7 +43,6 @@ use std::result; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, Mutex, RwLock}; use std::time::Instant; -use storage_stage::StorageState; use tokio::prelude::Future; /// The number of most recent `last_id` values that the bank will track the signatures @@ -1433,12 +1433,12 @@ impl Bank { #[cfg(test)] mod tests { use super::*; + use crate::entry::next_entry; + use crate::entry::Entry; + use crate::jsonrpc_macros::pubsub::{Subscriber, SubscriptionId}; + use crate::ledger; + use crate::signature::GenKeys; use bincode::serialize; - use entry::next_entry; - use entry::Entry; - use jsonrpc_macros::pubsub::{Subscriber, SubscriptionId}; - use ledger; - use signature::GenKeys; use solana_sdk::hash::hash; use solana_sdk::signature::Keypair; use solana_sdk::signature::KeypairUtil; diff --git a/src/banking_stage.rs b/src/banking_stage.rs index 0e5832599b..1add8f1ef3 100644 --- a/src/banking_stage.rs +++ b/src/banking_stage.rs @@ -2,18 +2,18 @@ //! to contruct a software pipeline. The stage uses all available CPU cores and //! can do its processing in parallel with signature verification on the GPU. -use bank::Bank; +use crate::bank::Bank; +use crate::compute_leader_finality_service::ComputeLeaderFinalityService; +use crate::counter::Counter; +use crate::entry::Entry; +use crate::packet::Packets; +use crate::poh_recorder::{PohRecorder, PohRecorderError}; +use crate::poh_service::{Config, PohService}; +use crate::result::{Error, Result}; +use crate::service::Service; +use crate::sigverify_stage::VerifiedPackets; use bincode::deserialize; -use compute_leader_finality_service::ComputeLeaderFinalityService; -use counter::Counter; -use entry::Entry; use log::Level; -use packet::Packets; -use poh_recorder::{PohRecorder, PohRecorderError}; -use poh_service::{Config, PohService}; -use result::{Error, Result}; -use service::Service; -use sigverify_stage::VerifiedPackets; use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; use solana_sdk::timing; @@ -260,11 +260,11 @@ impl Service for BankingStage { #[cfg(test)] mod tests { use super::*; - use bank::Bank; - use banking_stage::BankingStageReturnType; - use ledger::Block; - use mint::Mint; - use packet::to_packets; + use crate::bank::Bank; + use crate::banking_stage::BankingStageReturnType; + use crate::ledger::Block; + use crate::mint::Mint; + use crate::packet::to_packets; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::system_transaction::SystemTransaction; use solana_sdk::transaction::Transaction; diff --git a/src/blob_fetch_stage.rs b/src/blob_fetch_stage.rs index c60f8a11d9..5cef29271d 100644 --- a/src/blob_fetch_stage.rs +++ b/src/blob_fetch_stage.rs @@ -1,12 +1,12 @@ //! The `blob_fetch_stage` pulls blobs from UDP sockets and sends it to a channel. -use service::Service; +use crate::service::Service; +use crate::streamer::{self, BlobReceiver}; use std::net::UdpSocket; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::channel; use std::sync::Arc; use std::thread::{self, JoinHandle}; -use streamer::{self, BlobReceiver}; pub struct BlobFetchStage { exit: Arc, diff --git a/src/broadcast_service.rs b/src/broadcast_service.rs index b01a81c67a..4d2c2ae65e 100644 --- a/src/broadcast_service.rs +++ b/src/broadcast_service.rs @@ -1,17 +1,18 @@ //! The `broadcast_service` broadcasts data from a leader node to validators //! -use cluster_info::{ClusterInfo, ClusterInfoError, NodeInfo}; -use counter::Counter; -use entry::Entry; +use crate::cluster_info::{ClusterInfo, ClusterInfoError, NodeInfo}; +use crate::counter::Counter; +use crate::entry::Entry; #[cfg(feature = "erasure")] use erasure; -use ledger::Block; +use crate::ledger::Block; +use crate::packet::{index_blobs, SharedBlobs}; +use crate::result::{Error, Result}; +use crate::service::Service; +use crate::window::{SharedWindow, WindowIndex, WindowUtil}; use log::Level; -use packet::{index_blobs, SharedBlobs}; use rayon::prelude::*; -use result::{Error, Result}; -use service::Service; use solana_metrics::{influxdb, submit}; use solana_sdk::pubkey::Pubkey; use solana_sdk::timing::duration_as_ms; @@ -21,7 +22,6 @@ use std::sync::mpsc::{Receiver, RecvTimeoutError}; use std::sync::{Arc, RwLock}; use std::thread::{self, Builder, JoinHandle}; use std::time::{Duration, Instant}; -use window::{SharedWindow, WindowIndex, WindowUtil}; #[derive(Debug, PartialEq, Eq, Clone)] pub enum BroadcastServiceReturnType { diff --git a/src/client.rs b/src/client.rs index 7d278eb3f5..03d281fd6f 100644 --- a/src/client.rs +++ b/src/client.rs @@ -1,6 +1,6 @@ -use cluster_info::{NodeInfo, FULLNODE_PORT_RANGE}; -use netutil::bind_in_range; -use thin_client::ThinClient; +use crate::cluster_info::{NodeInfo, FULLNODE_PORT_RANGE}; +use crate::netutil::bind_in_range; +use crate::thin_client::ThinClient; pub fn mk_client(r: &NodeInfo) -> ThinClient { let (_, transactions_socket) = bind_in_range(FULLNODE_PORT_RANGE).unwrap(); diff --git a/src/cluster_info.rs b/src/cluster_info.rs index faa2f73a14..cbbd335ad3 100644 --- a/src/cluster_info.rs +++ b/src/cluster_info.rs @@ -12,22 +12,24 @@ //! * layer 2 - Everyone else, if layer 1 is `2^10`, layer 2 should be able to fit `2^20` number of nodes. //! //! Bank needs to provide an interface for us to query the stake weight +use crate::bloom::Bloom; +use crate::contact_info::ContactInfo; +use crate::counter::Counter; +use crate::crds_gossip::CrdsGossip; +use crate::crds_gossip_error::CrdsGossipError; +use crate::crds_gossip_pull::CRDS_GOSSIP_PULL_CRDS_TIMEOUT_MS; +use crate::crds_value::{CrdsValue, CrdsValueLabel, LeaderId}; +use crate::ledger::LedgerWindow; +use crate::netutil::{bind_in_range, bind_to, find_available_port_in_range, multi_bind_in_range}; +use crate::packet::{to_blob, Blob, SharedBlob, BLOB_SIZE}; +use crate::result::Result; +use crate::rpc::RPC_PORT; +use crate::streamer::{BlobReceiver, BlobSender}; +use crate::window::{SharedWindow, WindowIndex}; use bincode::{deserialize, serialize}; -use bloom::Bloom; -use contact_info::ContactInfo; -use counter::Counter; -use crds_gossip::CrdsGossip; -use crds_gossip_error::CrdsGossipError; -use crds_gossip_pull::CRDS_GOSSIP_PULL_CRDS_TIMEOUT_MS; -use crds_value::{CrdsValue, CrdsValueLabel, LeaderId}; -use ledger::LedgerWindow; use log::Level; -use netutil::{bind_in_range, bind_to, find_available_port_in_range, multi_bind_in_range}; -use packet::{to_blob, Blob, SharedBlob, BLOB_SIZE}; use rand::{thread_rng, Rng}; use rayon::prelude::*; -use result::Result; -use rpc::RPC_PORT; use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::{Keypair, KeypairUtil, Signable, Signature}; @@ -39,8 +41,6 @@ use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::{Arc, RwLock}; use std::thread::{sleep, Builder, JoinHandle}; use std::time::{Duration, Instant}; -use streamer::{BlobReceiver, BlobSender}; -use window::{SharedWindow, WindowIndex}; pub type NodeInfo = ContactInfo; @@ -1129,18 +1129,18 @@ fn report_time_spent(label: &str, time: &Duration, extra: &str) { #[cfg(test)] mod tests { use super::*; - use crds_value::CrdsValueLabel; - use entry::Entry; - use ledger::{get_tmp_ledger_path, LedgerWindow, LedgerWriter}; - use logger; - use packet::SharedBlob; - use result::Error; + use crate::crds_value::CrdsValueLabel; + use crate::entry::Entry; + use crate::ledger::{get_tmp_ledger_path, LedgerWindow, LedgerWriter}; + use crate::logger; + use crate::packet::SharedBlob; + use crate::result::Error; + use crate::window::default_window; use solana_sdk::hash::{hash, Hash}; use solana_sdk::signature::{Keypair, KeypairUtil}; use std::fs::remove_dir_all; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::{Arc, RwLock}; - use window::default_window; #[test] fn test_cluster_spy_gossip() { diff --git a/src/compute_leader_finality_service.rs b/src/compute_leader_finality_service.rs index 13f0f2b548..a0719980b6 100644 --- a/src/compute_leader_finality_service.rs +++ b/src/compute_leader_finality_service.rs @@ -2,9 +2,9 @@ //! to generate a thread which regularly calculates the last finality times //! observed by the leader -use bank::Bank; +use crate::bank::Bank; -use service::Service; +use crate::service::Service; use solana_metrics::{influxdb, submit}; use solana_sdk::pubkey::Pubkey; use solana_sdk::timing; @@ -148,12 +148,12 @@ impl Service for ComputeLeaderFinalityService { #[cfg(test)] pub mod tests { - use bank::Bank; + use crate::bank::Bank; + use crate::compute_leader_finality_service::ComputeLeaderFinalityService; + use crate::create_vote_account::*; + use crate::logger; + use crate::mint::Mint; use bincode::serialize; - use compute_leader_finality_service::ComputeLeaderFinalityService; - use create_vote_account::*; - use logger; - use mint::Mint; use solana_sdk::hash::hash; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::transaction::Transaction; diff --git a/src/contact_info.rs b/src/contact_info.rs index 889aae330b..5e12f04d5e 100644 --- a/src/contact_info.rs +++ b/src/contact_info.rs @@ -1,5 +1,5 @@ +use crate::rpc::RPC_PORT; use bincode::serialize; -use rpc::RPC_PORT; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::{Keypair, KeypairUtil, Signable, Signature}; use solana_sdk::timing::timestamp; diff --git a/src/counter.rs b/src/counter.rs index 000b6b62d9..38568f8225 100644 --- a/src/counter.rs +++ b/src/counter.rs @@ -96,7 +96,7 @@ impl Counter { } #[cfg(test)] mod tests { - use counter::{Counter, DEFAULT_LOG_RATE}; + use crate::counter::{Counter, DEFAULT_LOG_RATE}; use log::Level; use std::env; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/src/crds.rs b/src/crds.rs index 9fe00ca523..76563ce60c 100644 --- a/src/crds.rs +++ b/src/crds.rs @@ -24,8 +24,8 @@ //! A value is updated to a new version if the labels match, and the value //! wallclock is later, or the value hash is greater. +use crate::crds_value::{CrdsValue, CrdsValueLabel}; use bincode::serialize; -use crds_value::{CrdsValue, CrdsValueLabel}; use indexmap::map::IndexMap; use solana_sdk::hash::{hash, Hash}; use solana_sdk::pubkey::Pubkey; @@ -163,8 +163,8 @@ impl Crds { #[cfg(test)] mod test { use super::*; - use contact_info::ContactInfo; - use crds_value::LeaderId; + use crate::contact_info::ContactInfo; + use crate::crds_value::LeaderId; use solana_sdk::signature::{Keypair, KeypairUtil}; #[test] diff --git a/src/crds_gossip.rs b/src/crds_gossip.rs index 222e4d48fc..30f2363cef 100644 --- a/src/crds_gossip.rs +++ b/src/crds_gossip.rs @@ -3,12 +3,12 @@ //! designed to run with a simulator or over a UDP network connection with messages up to a //! packet::BLOB_DATA_SIZE size. -use bloom::Bloom; -use crds::Crds; -use crds_gossip_error::CrdsGossipError; -use crds_gossip_pull::CrdsGossipPull; -use crds_gossip_push::{CrdsGossipPush, CRDS_GOSSIP_NUM_ACTIVE}; -use crds_value::CrdsValue; +use crate::bloom::Bloom; +use crate::crds::Crds; +use crate::crds_gossip_error::CrdsGossipError; +use crate::crds_gossip_pull::CrdsGossipPull; +use crate::crds_gossip_push::{CrdsGossipPush, CRDS_GOSSIP_NUM_ACTIVE}; +use crate::crds_value::CrdsValue; use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; @@ -158,11 +158,11 @@ impl CrdsGossip { #[cfg(test)] mod test { use super::*; + use crate::cluster_info::NodeInfo; + use crate::contact_info::ContactInfo; + use crate::crds_gossip_push::CRDS_GOSSIP_PUSH_MSG_TIMEOUT_MS; + use crate::crds_value::CrdsValueLabel; use bincode::serialized_size; - use cluster_info::NodeInfo; - use contact_info::ContactInfo; - use crds_gossip_push::CRDS_GOSSIP_PUSH_MSG_TIMEOUT_MS; - use crds_value::CrdsValueLabel; use rayon::prelude::*; use solana_sdk::hash::hash; use solana_sdk::signature::{Keypair, KeypairUtil}; @@ -491,7 +491,7 @@ mod test { #[test] #[ignore] fn test_star_network_large_pull() { - use logger; + use crate::logger; logger::setup(); let mut network = star_network_create(2000); network_simulator_pull_only(&mut network); @@ -499,7 +499,7 @@ mod test { #[test] #[ignore] fn test_rstar_network_large_push() { - use logger; + use crate::logger; logger::setup(); let mut network = rstar_network_create(4000); network_simulator(&mut network); @@ -507,7 +507,7 @@ mod test { #[test] #[ignore] fn test_ring_network_large_push() { - use logger; + use crate::logger; logger::setup(); let mut network = ring_network_create(4001); network_simulator(&mut network); @@ -515,7 +515,7 @@ mod test { #[test] #[ignore] fn test_star_network_large_push() { - use logger; + use crate::logger; logger::setup(); let mut network = star_network_create(4002); network_simulator(&mut network); diff --git a/src/crds_gossip_pull.rs b/src/crds_gossip_pull.rs index a6133ecbb2..a7739b3d85 100644 --- a/src/crds_gossip_pull.rs +++ b/src/crds_gossip_pull.rs @@ -9,13 +9,13 @@ //! with random hash functions. So each subsequent request will have a different distribution //! of false positives. +use crate::bloom::Bloom; +use crate::crds::Crds; +use crate::crds_gossip::CRDS_GOSSIP_BLOOM_SIZE; +use crate::crds_gossip_error::CrdsGossipError; +use crate::crds_value::{CrdsValue, CrdsValueLabel}; +use crate::packet::BLOB_DATA_SIZE; use bincode::serialized_size; -use bloom::Bloom; -use crds::Crds; -use crds_gossip::CRDS_GOSSIP_BLOOM_SIZE; -use crds_gossip_error::CrdsGossipError; -use crds_value::{CrdsValue, CrdsValueLabel}; -use packet::BLOB_DATA_SIZE; use rand; use rand::distributions::{Distribution, WeightedIndex}; use solana_sdk::hash::Hash; @@ -198,8 +198,8 @@ impl CrdsGossipPull { #[cfg(test)] mod test { use super::*; - use contact_info::ContactInfo; - use crds_value::LeaderId; + use crate::contact_info::ContactInfo; + use crate::crds_value::LeaderId; use solana_sdk::signature::{Keypair, KeypairUtil}; #[test] diff --git a/src/crds_gossip_push.rs b/src/crds_gossip_push.rs index 1f6af42b59..d56e78921a 100644 --- a/src/crds_gossip_push.rs +++ b/src/crds_gossip_push.rs @@ -8,15 +8,15 @@ //! the local nodes wallclock window they are drooped silently. //! 2. The prune set is stored in a Bloom filter. +use crate::bloom::Bloom; +use crate::contact_info::ContactInfo; +use crate::crds::{Crds, VersionedCrdsValue}; +use crate::crds_gossip::CRDS_GOSSIP_BLOOM_SIZE; +use crate::crds_gossip_error::CrdsGossipError; +use crate::crds_value::{CrdsValue, CrdsValueLabel}; +use crate::packet::BLOB_DATA_SIZE; use bincode::serialized_size; -use bloom::Bloom; -use contact_info::ContactInfo; -use crds::{Crds, VersionedCrdsValue}; -use crds_gossip::CRDS_GOSSIP_BLOOM_SIZE; -use crds_gossip_error::CrdsGossipError; -use crds_value::{CrdsValue, CrdsValueLabel}; use indexmap::map::IndexMap; -use packet::BLOB_DATA_SIZE; use rand; use rand::seq::SliceRandom; use solana_sdk::hash::Hash; @@ -245,7 +245,7 @@ impl CrdsGossipPush { #[cfg(test)] mod test { use super::*; - use contact_info::ContactInfo; + use crate::contact_info::ContactInfo; use solana_sdk::signature::{Keypair, KeypairUtil}; #[test] fn test_process_push() { @@ -342,7 +342,7 @@ mod test { } #[test] fn test_refresh_active_set() { - use logger; + use crate::logger; logger::setup(); let mut crds = Crds::default(); let mut push = CrdsGossipPush::default(); diff --git a/src/crds_traits_impls.rs b/src/crds_traits_impls.rs index 382a8d50f6..a885e43b9d 100644 --- a/src/crds_traits_impls.rs +++ b/src/crds_traits_impls.rs @@ -1,4 +1,4 @@ -use bloom::BloomHashIndex; +use crate::bloom::BloomHashIndex; use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; diff --git a/src/crds_value.rs b/src/crds_value.rs index c39c13d6eb..cd170656a9 100644 --- a/src/crds_value.rs +++ b/src/crds_value.rs @@ -1,5 +1,5 @@ +use crate::contact_info::ContactInfo; use bincode::serialize; -use contact_info::ContactInfo; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::{Keypair, Signable, Signature}; use solana_sdk::transaction::Transaction; @@ -230,10 +230,10 @@ impl Signable for CrdsValue { #[cfg(test)] mod test { use super::*; - use contact_info::ContactInfo; + use crate::contact_info::ContactInfo; + use crate::test_tx::test_tx; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::timing::timestamp; - use test_tx::test_tx; #[test] fn test_labels() { diff --git a/src/create_vote_account.rs b/src/create_vote_account.rs index 9d98002943..f1f0a5900e 100644 --- a/src/create_vote_account.rs +++ b/src/create_vote_account.rs @@ -1,5 +1,5 @@ -use bank::Bank; -use result::Result; +use crate::bank::Bank; +use crate::result::Result; use solana_sdk::hash::Hash; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::transaction::Transaction; diff --git a/src/db_ledger.rs b/src/db_ledger.rs index e94c812168..1e1adf402f 100644 --- a/src/db_ledger.rs +++ b/src/db_ledger.rs @@ -2,11 +2,11 @@ //! Proof of History ledger as well as iterative read, append write, and random //! access read to a persistent file-based ledger. +use crate::entry::Entry; +use crate::packet::{Blob, SharedBlob, BLOB_HEADER_SIZE}; +use crate::result::{Error, Result}; use bincode::{deserialize, serialize}; use byteorder::{BigEndian, ByteOrder, ReadBytesExt}; -use entry::Entry; -use packet::{Blob, SharedBlob, BLOB_HEADER_SIZE}; -use result::{Error, Result}; use rocksdb::{ColumnFamily, Options, WriteBatch, DB}; use serde::de::DeserializeOwned; use serde::Serialize; @@ -474,7 +474,7 @@ where #[cfg(test)] mod tests { use super::*; - use ledger::{get_tmp_ledger_path, make_tiny_test_entries, Block}; + use crate::ledger::{get_tmp_ledger_path, make_tiny_test_entries, Block}; #[test] fn test_put_get_simple() { diff --git a/src/db_window.rs b/src/db_window.rs index 90057b3766..fbb93c43ae 100644 --- a/src/db_window.rs +++ b/src/db_window.rs @@ -1,14 +1,15 @@ //! Set of functions for emulating windowing functions from a database ledger implementation -use cluster_info::ClusterInfo; -use counter::Counter; -use db_ledger::*; -use entry::Entry; +use crate::cluster_info::ClusterInfo; +use crate::counter::Counter; +use crate::db_ledger::*; +use crate::entry::Entry; +use crate::leader_scheduler::LeaderScheduler; +use crate::packet::{SharedBlob, BLOB_HEADER_SIZE}; +use crate::result::Result; +use crate::streamer::BlobSender; #[cfg(feature = "erasure")] use erasure; -use leader_scheduler::LeaderScheduler; use log::Level; -use packet::{SharedBlob, BLOB_HEADER_SIZE}; -use result::Result; use rocksdb::DBRawIterator; use solana_metrics::{influxdb, submit}; use solana_sdk::pubkey::Pubkey; @@ -17,7 +18,6 @@ use std::net::SocketAddr; use std::sync::atomic::AtomicUsize; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, RwLock}; -use streamer::BlobSender; pub const MAX_REPAIR_LENGTH: usize = 128; @@ -400,14 +400,15 @@ fn try_erasure(db_ledger: &mut DbLedger, slot: u64, consume_queue: &mut Vec) -> Result<(Vec, diff --git a/src/fullnode.rs b/src/fullnode.rs index 9667ec4150..ad8cbd99e9 100644 --- a/src/fullnode.rs +++ b/src/fullnode.rs @@ -1,15 +1,19 @@ //! The `fullnode` module hosts all the fullnode microservices. -use bank::Bank; -use broadcast_service::BroadcastService; -use cluster_info::{ClusterInfo, Node, NodeInfo}; -use db_ledger::{write_entries_to_ledger, DbLedger}; -use gossip_service::GossipService; -use leader_scheduler::LeaderScheduler; -use ledger::read_ledger; -use rpc::JsonRpcService; -use rpc_pubsub::PubSubService; -use service::Service; +use crate::bank::Bank; +use crate::broadcast_service::BroadcastService; +use crate::cluster_info::{ClusterInfo, Node, NodeInfo}; +use crate::db_ledger::{write_entries_to_ledger, DbLedger}; +use crate::gossip_service::GossipService; +use crate::leader_scheduler::LeaderScheduler; +use crate::ledger::read_ledger; +use crate::rpc::JsonRpcService; +use crate::rpc_pubsub::PubSubService; +use crate::service::Service; +use crate::tpu::{Tpu, TpuReturnType}; +use crate::tpu_forwarder::TpuForwarder; +use crate::tvu::{Tvu, TvuReturnType}; +use crate::window::{new_window, SharedWindow}; use solana_sdk::hash::Hash; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::timing::timestamp; @@ -18,11 +22,7 @@ use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, RwLock}; use std::thread::Result; -use tpu::{Tpu, TpuReturnType}; -use tpu_forwarder::TpuForwarder; -use tvu::{Tvu, TvuReturnType}; use untrusted::Input; -use window::{new_window, SharedWindow}; pub enum NodeRole { Leader(LeaderServices), @@ -650,21 +650,25 @@ impl Service for Fullnode { #[cfg(test)] mod tests { - use bank::Bank; - use cluster_info::Node; - use db_ledger::*; - use fullnode::{Fullnode, FullnodeReturnType, NodeRole, TvuReturnType}; - use leader_scheduler::{make_active_set_entries, LeaderScheduler, LeaderSchedulerConfig}; - use ledger::{create_tmp_genesis, create_tmp_sample_ledger, tmp_copy_ledger, LedgerWriter}; - use packet::make_consecutive_blobs; - use service::Service; + use crate::bank::Bank; + use crate::cluster_info::Node; + use crate::db_ledger::*; + use crate::fullnode::{Fullnode, FullnodeReturnType, NodeRole, TvuReturnType}; + use crate::leader_scheduler::{ + make_active_set_entries, LeaderScheduler, LeaderSchedulerConfig, + }; + use crate::ledger::{ + create_tmp_genesis, create_tmp_sample_ledger, tmp_copy_ledger, LedgerWriter, + }; + use crate::packet::make_consecutive_blobs; + use crate::service::Service; + use crate::streamer::responder; use solana_sdk::signature::{Keypair, KeypairUtil}; use std::cmp; use std::fs::remove_dir_all; use std::net::UdpSocket; use std::sync::mpsc::channel; use std::sync::{Arc, RwLock}; - use streamer::responder; #[test] fn validator_exit() { diff --git a/src/gossip_service.rs b/src/gossip_service.rs index 726ef4748b..a8d48c4899 100644 --- a/src/gossip_service.rs +++ b/src/gossip_service.rs @@ -1,14 +1,14 @@ //! The `gossip_service` module implements the network control plane. -use cluster_info::ClusterInfo; -use service::Service; +use crate::cluster_info::ClusterInfo; +use crate::service::Service; +use crate::streamer; +use crate::window::SharedWindow; use std::net::UdpSocket; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::channel; use std::sync::{Arc, RwLock}; use std::thread::{self, JoinHandle}; -use streamer; -use window::SharedWindow; pub struct GossipService { exit: Arc, @@ -67,7 +67,7 @@ impl Service for GossipService { #[cfg(test)] mod tests { use super::*; - use cluster_info::{ClusterInfo, Node}; + use crate::cluster_info::{ClusterInfo, Node}; use std::sync::atomic::AtomicBool; use std::sync::{Arc, RwLock}; diff --git a/src/leader_scheduler.rs b/src/leader_scheduler.rs index f0629b3e06..ad01188297 100644 --- a/src/leader_scheduler.rs +++ b/src/leader_scheduler.rs @@ -1,12 +1,12 @@ //! The `leader_scheduler` module implements a structure and functions for tracking and //! managing the schedule for leader rotation -use bank::Bank; +use crate::bank::Bank; +use crate::entry::Entry; +use crate::ledger::create_ticks; use bincode::serialize; use byteorder::{LittleEndian, ReadBytesExt}; -use entry::Entry; -use ledger::create_ticks; use solana_sdk::hash::{hash, Hash}; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::{Keypair, KeypairUtil}; @@ -508,13 +508,13 @@ pub fn make_active_set_entries( #[cfg(test)] mod tests { - use bank::Bank; - use create_vote_account::*; - use leader_scheduler::{ + use crate::bank::Bank; + use crate::create_vote_account::*; + use crate::leader_scheduler::{ LeaderScheduler, LeaderSchedulerConfig, DEFAULT_BOOTSTRAP_HEIGHT, DEFAULT_LEADER_ROTATION_INTERVAL, DEFAULT_SEED_ROTATION_INTERVAL, }; - use mint::Mint; + use crate::mint::Mint; use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::{Keypair, KeypairUtil}; diff --git a/src/ledger.rs b/src/ledger.rs index 25f50c3a51..be6c151148 100644 --- a/src/ledger.rs +++ b/src/ledger.rs @@ -2,12 +2,12 @@ //! Proof of History ledger as well as iterative read, append write, and random //! access read to a persistent file-based ledger. +use crate::entry::Entry; +use crate::mint::Mint; +use crate::packet::{SharedBlob, BLOB_DATA_SIZE}; use bincode::{self, deserialize_from, serialize_into, serialized_size}; use chrono::prelude::Utc; -use entry::Entry; use log::Level::Trace; -use mint::Mint; -use packet::{SharedBlob, BLOB_DATA_SIZE}; use rayon::prelude::*; use solana_sdk::budget_transaction::BudgetTransaction; use solana_sdk::hash::{hash, Hash}; @@ -702,9 +702,9 @@ pub fn make_large_test_entries(num_entries: usize) -> Vec { #[cfg(test)] mod tests { use super::*; + use crate::entry::{next_entry, reconstruct_entries_from_blobs, Entry}; + use crate::packet::{to_blobs, BLOB_DATA_SIZE, PACKET_DATA_SIZE}; use bincode::{deserialize, serialized_size}; - use entry::{next_entry, reconstruct_entries_from_blobs, Entry}; - use packet::{to_blobs, BLOB_DATA_SIZE, PACKET_DATA_SIZE}; use solana_sdk::hash::hash; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::transaction::Transaction; @@ -714,7 +714,7 @@ mod tests { #[test] fn test_verify_slice() { - use logger; + use crate::logger; logger::setup(); let zero = Hash::default(); let one = hash(&zero.as_ref()); @@ -758,7 +758,7 @@ mod tests { #[test] fn test_entries_to_blobs() { - use logger; + use crate::logger; logger::setup(); let entries = make_test_entries(); @@ -769,7 +769,7 @@ mod tests { #[test] fn test_bad_blobs_attack() { - use logger; + use crate::logger; logger::setup(); let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 8000); let blobs_q = to_blobs(vec![(0, addr)]).unwrap(); // <-- attack! @@ -778,7 +778,7 @@ mod tests { #[test] fn test_next_entries() { - use logger; + use crate::logger; logger::setup(); let id = Hash::default(); let next_id = hash(&id.as_ref()); @@ -827,7 +827,7 @@ mod tests { #[test] fn test_ledger_reader_writer() { - use logger; + use crate::logger; logger::setup(); let ledger_path = get_tmp_ledger_path("test_ledger_reader_writer"); let entries = make_tiny_test_entries(10); @@ -905,7 +905,7 @@ mod tests { #[test] fn test_recover_ledger() { - use logger; + use crate::logger; logger::setup(); let entries = make_tiny_test_entries(10); @@ -956,7 +956,7 @@ mod tests { #[test] fn test_verify_ledger() { - use logger; + use crate::logger; logger::setup(); let entries = make_tiny_test_entries(10); @@ -974,7 +974,7 @@ mod tests { #[test] fn test_get_entries_bytes() { - use logger; + use crate::logger; logger::setup(); let entries = make_tiny_test_entries(10); let ledger_path = get_tmp_ledger_path("test_raw_entries"); diff --git a/src/ledger_write_stage.rs b/src/ledger_write_stage.rs index 884c7886ce..89668308a6 100644 --- a/src/ledger_write_stage.rs +++ b/src/ledger_write_stage.rs @@ -1,12 +1,12 @@ //! The `ledger_write_stage` module implements the ledger write stage. It //! writes entries to the given writer, which is typically a file -use counter::Counter; -use entry::{EntryReceiver, EntrySender}; -use ledger::LedgerWriter; +use crate::counter::Counter; +use crate::entry::{EntryReceiver, EntrySender}; +use crate::ledger::LedgerWriter; +use crate::result::{Error, Result}; +use crate::service::Service; use log::Level; -use result::{Error, Result}; -use service::Service; use solana_sdk::timing::duration_as_ms; use std::sync::atomic::AtomicUsize; use std::sync::mpsc::{channel, RecvTimeoutError}; diff --git a/src/mint.rs b/src/mint.rs index 001bee7fe4..c1b89f455a 100644 --- a/src/mint.rs +++ b/src/mint.rs @@ -1,6 +1,6 @@ //! The `mint` module is a library for generating the chain's genesis block. -use entry::Entry; +use crate::entry::Entry; use ring::rand::SystemRandom; use solana_sdk::hash::{hash, Hash}; use solana_sdk::pubkey::Pubkey; @@ -106,8 +106,8 @@ impl Mint { #[cfg(test)] mod tests { use super::*; + use crate::ledger::Block; use bincode::deserialize; - use ledger::Block; use solana_sdk::system_instruction::SystemInstruction; use solana_sdk::system_program; diff --git a/src/netutil.rs b/src/netutil.rs index 345d238247..a8d9438279 100644 --- a/src/netutil.rs +++ b/src/netutil.rs @@ -203,9 +203,9 @@ pub fn find_available_port_in_range(range: (u16, u16)) -> io::Result { #[cfg(test)] mod tests { + use crate::logger; + use crate::netutil::*; use ipnetwork::IpNetwork; - use logger; - use netutil::*; use pnet_datalink as datalink; #[test] diff --git a/src/packet.rs b/src/packet.rs index 292dcc79ed..506c06fa48 100644 --- a/src/packet.rs +++ b/src/packet.rs @@ -1,14 +1,14 @@ //! The `packet` module defines data structures and methods to pull data from the network. +use crate::counter::Counter; +#[cfg(test)] +use crate::entry::Entry; +#[cfg(test)] +use crate::ledger::Block; +use crate::recvmmsg::{recv_mmsg, NUM_RCVMMSGS}; +use crate::result::{Error, Result}; use bincode::{deserialize, serialize}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; -use counter::Counter; -#[cfg(test)] -use entry::Entry; -#[cfg(test)] -use ledger::Block; use log::Level; -use recvmmsg::{recv_mmsg, NUM_RCVMMSGS}; -use result::{Error, Result}; use serde::Serialize; #[cfg(test)] use solana_sdk::hash::Hash; @@ -473,7 +473,7 @@ pub fn make_consecutive_blobs( #[cfg(test)] mod tests { - use packet::{ + use crate::packet::{ to_packets, Blob, Meta, Packet, Packets, SharedBlob, SharedPackets, NUM_PACKETS, PACKET_DATA_SIZE, }; diff --git a/src/poh.rs b/src/poh.rs index 1b1a908b98..3bee643131 100644 --- a/src/poh.rs +++ b/src/poh.rs @@ -96,7 +96,7 @@ pub fn verify(initial: Hash, entries: &[PohEntry]) -> bool { #[cfg(test)] mod tests { - use poh::{self, PohEntry}; + use crate::poh::{self, PohEntry}; use solana_sdk::hash::Hash; #[test] diff --git a/src/poh_recorder.rs b/src/poh_recorder.rs index 8ced07916f..044b61933d 100644 --- a/src/poh_recorder.rs +++ b/src/poh_recorder.rs @@ -1,10 +1,10 @@ //! The `poh_recorder` module provides an object for synchronizing with Proof of History. //! It synchronizes PoH, bank's register_tick and the ledger //! -use bank::Bank; -use entry::Entry; -use poh::Poh; -use result::{Error, Result}; +use crate::bank::Bank; +use crate::entry::Entry; +use crate::poh::Poh; +use crate::result::{Error, Result}; use solana_sdk::hash::Hash; use solana_sdk::transaction::Transaction; use std::sync::mpsc::Sender; @@ -118,11 +118,11 @@ impl PohRecorder { #[cfg(test)] mod tests { use super::*; - use mint::Mint; + use crate::mint::Mint; + use crate::test_tx::test_tx; use solana_sdk::hash::hash; use std::sync::mpsc::channel; use std::sync::Arc; - use test_tx::test_tx; #[test] fn test_poh() { diff --git a/src/poh_service.rs b/src/poh_service.rs index 3bbecbeb2d..2f758ffd44 100644 --- a/src/poh_service.rs +++ b/src/poh_service.rs @@ -1,9 +1,9 @@ //! The `poh_service` module implements a service that records the passing of //! "ticks", a measure of time in the PoH stream -use poh_recorder::PohRecorder; -use result::Result; -use service::Service; +use crate::poh_recorder::PohRecorder; +use crate::result::Result; +use crate::service::Service; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread::sleep; @@ -97,17 +97,17 @@ impl Service for PohService { #[cfg(test)] mod tests { use super::{Config, PohService}; - use bank::Bank; - use mint::Mint; - use poh_recorder::PohRecorder; - use result::Result; - use service::Service; + use crate::bank::Bank; + use crate::mint::Mint; + use crate::poh_recorder::PohRecorder; + use crate::result::Result; + use crate::service::Service; + use crate::test_tx::test_tx; use solana_sdk::hash::hash; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::channel; use std::sync::Arc; use std::thread::{Builder, JoinHandle}; - use test_tx::test_tx; #[test] fn test_poh_service() { diff --git a/src/recvmmsg.rs b/src/recvmmsg.rs index ce6f89a379..a72b43e90c 100644 --- a/src/recvmmsg.rs +++ b/src/recvmmsg.rs @@ -1,6 +1,6 @@ //! The `recvmmsg` module provides recvmmsg() API implementation -use packet::Packet; +use crate::packet::Packet; use std::cmp; use std::io; use std::net::UdpSocket; @@ -85,8 +85,8 @@ pub fn recv_mmsg(sock: &UdpSocket, packets: &mut [Packet]) -> io::Result #[cfg(test)] mod tests { - use packet::PACKET_DATA_SIZE; - use recvmmsg::*; + use crate::packet::PACKET_DATA_SIZE; + use crate::recvmmsg::*; #[test] pub fn test_recv_mmsg_one_iter() { diff --git a/src/replicate_stage.rs b/src/replicate_stage.rs index 8b8c95549e..c2b1111f23 100644 --- a/src/replicate_stage.rs +++ b/src/replicate_stage.rs @@ -1,16 +1,18 @@ //! The `replicate_stage` replicates transactions broadcast by the leader. -use bank::Bank; -use cluster_info::ClusterInfo; -use counter::Counter; -use entry::{EntryReceiver, EntrySender}; +use crate::bank::Bank; +use crate::cluster_info::ClusterInfo; +use crate::counter::Counter; +use crate::entry::{EntryReceiver, EntrySender}; use solana_sdk::hash::Hash; -use ledger::Block; +use crate::ledger::Block; +use crate::packet::BlobError; +use crate::result::{Error, Result}; +use crate::service::Service; +use crate::streamer::{responder, BlobSender}; +use crate::vote_stage::send_validator_vote; use log::Level; -use packet::BlobError; -use result::{Error, Result}; -use service::Service; use solana_metrics::{influxdb, submit}; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::timing::duration_as_ms; @@ -22,8 +24,6 @@ use std::sync::{Arc, RwLock}; use std::thread::{self, Builder, JoinHandle}; use std::time::Duration; use std::time::Instant; -use streamer::{responder, BlobSender}; -use vote_stage::send_validator_vote; #[derive(Debug, PartialEq, Eq, Clone)] pub enum ReplicateStageReturnType { @@ -244,24 +244,26 @@ impl Service for ReplicateStage { #[cfg(test)] mod test { - use bank::Bank; - use cluster_info::{ClusterInfo, Node}; - use entry::Entry; - use fullnode::Fullnode; - use leader_scheduler::{make_active_set_entries, LeaderScheduler, LeaderSchedulerConfig}; - use ledger::{create_ticks, create_tmp_sample_ledger, LedgerWriter}; - use logger; - use packet::BlobError; - use replicate_stage::{ReplicateStage, ReplicateStageReturnType}; - use result::Error; - use service::Service; + use crate::bank::Bank; + use crate::cluster_info::{ClusterInfo, Node}; + use crate::entry::Entry; + use crate::fullnode::Fullnode; + use crate::leader_scheduler::{ + make_active_set_entries, LeaderScheduler, LeaderSchedulerConfig, + }; + use crate::ledger::{create_ticks, create_tmp_sample_ledger, LedgerWriter}; + use crate::logger; + use crate::packet::BlobError; + use crate::replicate_stage::{ReplicateStage, ReplicateStageReturnType}; + use crate::result::Error; + use crate::service::Service; + use crate::vote_stage::{send_validator_vote, VoteError}; use solana_sdk::hash::Hash; use solana_sdk::signature::{Keypair, KeypairUtil}; use std::fs::remove_dir_all; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::mpsc::channel; use std::sync::{Arc, RwLock}; - use vote_stage::{send_validator_vote, VoteError}; #[test] pub fn test_replicate_stage_leader_rotation_exit() { diff --git a/src/replicator.rs b/src/replicator.rs index 59a22e6468..e6edbe2ad4 100644 --- a/src/replicator.rs +++ b/src/replicator.rs @@ -1,17 +1,21 @@ -use blob_fetch_stage::BlobFetchStage; +use crate::blob_fetch_stage::BlobFetchStage; +use crate::client::mk_client; +use crate::cluster_info::{ClusterInfo, Node, NodeInfo}; +use crate::db_ledger::DbLedger; +use crate::gossip_service::GossipService; +use crate::leader_scheduler::LeaderScheduler; +use crate::ledger::LEDGER_DATA_FILE; +use crate::result::Result; +use crate::rpc_request::{RpcClient, RpcRequest}; +use crate::service::Service; +use crate::store_ledger_stage::StoreLedgerStage; +use crate::streamer::BlobReceiver; +use crate::window; +use crate::window_service::window_service; #[cfg(feature = "chacha")] use chacha::{chacha_cbc_encrypt_file, CHACHA_BLOCK_SIZE}; -use client::mk_client; -use cluster_info::{ClusterInfo, Node, NodeInfo}; -use db_ledger::DbLedger; -use gossip_service::GossipService; -use leader_scheduler::LeaderScheduler; -use ledger::LEDGER_DATA_FILE; use rand::thread_rng; use rand::Rng; -use result::Result; -use rpc_request::{RpcClient, RpcRequest}; -use service::Service; use solana_drone::drone::{request_airdrop_transaction, DRONE_PORT}; use solana_sdk::hash::{Hash, Hasher}; use solana_sdk::signature::{Keypair, KeypairUtil}; @@ -33,10 +37,6 @@ use std::sync::{Arc, RwLock}; use std::thread::sleep; use std::thread::JoinHandle; use std::time::Duration; -use store_ledger_stage::StoreLedgerStage; -use streamer::BlobReceiver; -use window; -use window_service::window_service; pub struct Replicator { gossip_service: GossipService, @@ -280,8 +280,8 @@ impl Replicator { #[cfg(test)] mod tests { - use logger; - use replicator::sample_file; + use crate::logger; + use crate::replicator::sample_file; use solana_sdk::hash::Hash; use solana_sdk::signature::{Keypair, KeypairUtil}; use std::fs::File; diff --git a/src/result.rs b/src/result.rs index 5ae3f1cf62..149afc6c84 100644 --- a/src/result.rs +++ b/src/result.rs @@ -1,18 +1,18 @@ //! The `result` module exposes a Result type that propagates one of many different Error types. -use bank; +use crate::bank; +use crate::cluster_info; +use crate::db_ledger; +use crate::packet; +use crate::poh_recorder; +use crate::vote_stage; use bincode; -use cluster_info; -use db_ledger; #[cfg(feature = "erasure")] use erasure; -use packet; -use poh_recorder; use rocksdb; use serde_json; use std; use std::any::Any; -use vote_stage; #[derive(Debug)] pub enum Error { @@ -124,8 +124,8 @@ impl std::convert::From for Error { #[cfg(test)] mod tests { - use result::Error; - use result::Result; + use crate::result::Error; + use crate::result::Result; use serde_json; use std::io; use std::io::Write; diff --git a/src/retransmit_stage.rs b/src/retransmit_stage.rs index f0e811ad23..e5a3a8474b 100644 --- a/src/retransmit_stage.rs +++ b/src/retransmit_stage.rs @@ -1,14 +1,16 @@ //! The `retransmit_stage` retransmits blobs between validators -use cluster_info::ClusterInfo; -use counter::Counter; -use db_ledger::DbLedger; -use entry::Entry; +use crate::cluster_info::ClusterInfo; +use crate::counter::Counter; +use crate::db_ledger::DbLedger; +use crate::entry::Entry; -use leader_scheduler::LeaderScheduler; +use crate::leader_scheduler::LeaderScheduler; +use crate::result::{Error, Result}; +use crate::service::Service; +use crate::streamer::BlobReceiver; +use crate::window_service::window_service; use log::Level; -use result::{Error, Result}; -use service::Service; use solana_metrics::{influxdb, submit}; use std::net::UdpSocket; use std::sync::atomic::{AtomicBool, AtomicUsize}; @@ -17,8 +19,6 @@ use std::sync::mpsc::{channel, Receiver}; use std::sync::{Arc, RwLock}; use std::thread::{self, Builder, JoinHandle}; use std::time::Duration; -use streamer::BlobReceiver; -use window_service::window_service; fn retransmit( cluster_info: &Arc>, diff --git a/src/rpc.rs b/src/rpc.rs index 6cf0eb7718..72de3963ec 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -1,13 +1,13 @@ //! The `rpc` module implements the Solana RPC interface. -use bank::{Bank, BankError}; +use crate::bank::{Bank, BankError}; +use crate::cluster_info::ClusterInfo; +use crate::jsonrpc_core::*; +use crate::jsonrpc_http_server::*; +use crate::packet::PACKET_DATA_SIZE; +use crate::service::Service; use bincode::{deserialize, serialize}; use bs58; -use cluster_info::ClusterInfo; -use jsonrpc_core::*; -use jsonrpc_http_server::*; -use packet::PACKET_DATA_SIZE; -use service::Service; use solana_drone::drone::{request_airdrop_transaction, DRONE_PORT}; use solana_sdk::account::Account; use solana_sdk::pubkey::Pubkey; @@ -371,17 +371,17 @@ fn verify_signature(input: &str) -> Result { #[cfg(test)] mod tests { use super::*; - use bank::Bank; + use crate::bank::Bank; + use crate::cluster_info::{Node, NodeInfo}; + use crate::fullnode::Fullnode; + use crate::jsonrpc_core::Response; + use crate::leader_scheduler::LeaderScheduler; + use crate::ledger::create_tmp_ledger_with_mint; + use crate::mint::Mint; + use crate::rpc_request::get_rpc_request_str; use bincode::serialize; - use cluster_info::{Node, NodeInfo}; - use fullnode::Fullnode; - use jsonrpc_core::Response; - use leader_scheduler::LeaderScheduler; - use ledger::create_tmp_ledger_with_mint; - use mint::Mint; use reqwest; use reqwest::header::CONTENT_TYPE; - use rpc_request::get_rpc_request_str; use solana_sdk::hash::{hash, Hash}; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::system_transaction::SystemTransaction; diff --git a/src/rpc_pubsub.rs b/src/rpc_pubsub.rs index ebcb26d9fe..f4a88beb30 100644 --- a/src/rpc_pubsub.rs +++ b/src/rpc_pubsub.rs @@ -1,14 +1,14 @@ //! The `pubsub` module implements a threaded subscription service on client RPC request -use bank::Bank; +use crate::bank::Bank; +use crate::jsonrpc_core::futures::Future; +use crate::jsonrpc_core::*; +use crate::jsonrpc_macros::pubsub; +use crate::jsonrpc_pubsub::{PubSubHandler, Session, SubscriptionId}; +use crate::jsonrpc_ws_server::{RequestContext, Sender, ServerBuilder}; +use crate::rpc::{JsonRpcRequestProcessor, RpcSignatureStatus}; +use crate::service::Service; use bs58; -use jsonrpc_core::futures::Future; -use jsonrpc_core::*; -use jsonrpc_macros::pubsub; -use jsonrpc_pubsub::{PubSubHandler, Session, SubscriptionId}; -use jsonrpc_ws_server::{RequestContext, Sender, ServerBuilder}; -use rpc::{JsonRpcRequestProcessor, RpcSignatureStatus}; -use service::Service; use solana_sdk::account::Account; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::{Keypair, KeypairUtil, Signature}; @@ -247,8 +247,8 @@ impl RpcSolPubSub for RpcSolPubSubImpl { #[cfg(test)] mod tests { use super::*; - use jsonrpc_core::futures::sync::mpsc; - use mint::Mint; + use crate::jsonrpc_core::futures::sync::mpsc; + use crate::mint::Mint; use solana_sdk::budget_program; use solana_sdk::budget_transaction::BudgetTransaction; use solana_sdk::signature::{Keypair, KeypairUtil}; diff --git a/src/rpc_request.rs b/src/rpc_request.rs index 4f1584a364..30c9268364 100644 --- a/src/rpc_request.rs +++ b/src/rpc_request.rs @@ -135,8 +135,8 @@ impl error::Error for RpcError { #[cfg(test)] mod tests { use super::*; - use jsonrpc_core::*; - use jsonrpc_http_server::*; + use crate::jsonrpc_core::*; + use crate::jsonrpc_http_server::*; use serde_json::Number; use std::net::{Ipv4Addr, SocketAddr}; use std::sync::mpsc::channel; diff --git a/src/sigverify.rs b/src/sigverify.rs index 0278005975..cfc570df6d 100644 --- a/src/sigverify.rs +++ b/src/sigverify.rs @@ -4,11 +4,11 @@ //! offloaded to the GPU. //! +use crate::counter::Counter; +use crate::packet::{Packet, SharedPackets}; +use crate::result::Result; use byteorder::{LittleEndian, ReadBytesExt}; -use counter::Counter; use log::Level; -use packet::{Packet, SharedPackets}; -use result::Result; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::Signature; #[cfg(test)] @@ -325,16 +325,16 @@ pub fn make_packet_from_transaction(tx: Transaction) -> Packet { #[cfg(test)] mod tests { + use crate::packet::{Packet, SharedPackets}; + use crate::sigverify; + use crate::test_tx::test_tx; use bincode::{deserialize, serialize}; - use packet::{Packet, SharedPackets}; - use sigverify; use solana_sdk::budget_program; use solana_sdk::hash::Hash; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::system_instruction::SystemInstruction; use solana_sdk::system_program; use solana_sdk::transaction::{Instruction, Transaction, SIG_OFFSET}; - use test_tx::test_tx; pub fn memfind(a: &[A], b: &[A]) -> Option { assert!(a.len() >= b.len()); @@ -388,7 +388,7 @@ mod tests { #[test] fn test_system_transaction_userdata_layout() { - use packet::PACKET_DATA_SIZE; + use crate::packet::PACKET_DATA_SIZE; let mut tx0 = test_tx(); tx0.instructions[0].userdata = vec![1, 2, 3]; let sign_data0a = tx0.get_sign_data(); @@ -481,7 +481,7 @@ mod tests { #[test] fn test_verify_multi_sig() { - use logger; + use crate::logger; logger::setup(); let keypair0 = Keypair::new(); let keypair1 = Keypair::new(); diff --git a/src/sigverify_stage.rs b/src/sigverify_stage.rs index b4ad28e51d..23c1641eab 100644 --- a/src/sigverify_stage.rs +++ b/src/sigverify_stage.rs @@ -5,14 +5,15 @@ //! transaction. All processing is done on the CPU by default and on a GPU //! if the `cuda` feature is enabled with `--features=cuda`. -use counter::Counter; +use crate::counter::Counter; +use crate::packet::SharedPackets; +use crate::result::{Error, Result}; +use crate::service::Service; +use crate::sigverify; +use crate::streamer::{self, PacketReceiver}; use log::Level; -use packet::SharedPackets; use rand::{thread_rng, Rng}; -use result::{Error, Result}; -use service::Service; -use sigverify; use solana_metrics::{influxdb, submit}; use solana_sdk::timing; use std::sync::atomic::AtomicUsize; @@ -20,7 +21,6 @@ use std::sync::mpsc::{channel, Receiver, RecvTimeoutError, Sender}; use std::sync::{Arc, Mutex}; use std::thread::{self, spawn, JoinHandle}; use std::time::Instant; -use streamer::{self, PacketReceiver}; pub type VerifiedPackets = Vec<(SharedPackets, Vec)>; diff --git a/src/storage_stage.rs b/src/storage_stage.rs index b6631c6789..6f2ac0088f 100644 --- a/src/storage_stage.rs +++ b/src/storage_stage.rs @@ -2,13 +2,13 @@ // for storage mining. Replicators submit storage proofs, validator then bundles them // to submit its proof for mining to be rewarded. +use crate::entry::EntryReceiver; +use crate::result::{Error, Result}; +use crate::service::Service; #[cfg(all(feature = "chacha", feature = "cuda"))] use chacha_cuda::chacha_cbc_encrypt_file_many_keys; -use entry::EntryReceiver; use rand::{Rng, SeedableRng}; use rand_chacha::ChaChaRng; -use result::{Error, Result}; -use service::Service; use solana_sdk::hash::Hash; use solana_sdk::signature::Keypair; use solana_sdk::signature::Signature; @@ -266,12 +266,15 @@ impl Service for StorageStage { #[cfg(test)] mod tests { - use entry::Entry; - use ledger::make_tiny_test_entries; - use ledger::{create_tmp_sample_ledger, LedgerWriter}; - use logger; + use crate::entry::Entry; + use crate::ledger::make_tiny_test_entries; + use crate::ledger::{create_tmp_sample_ledger, LedgerWriter}; + use crate::logger; + use crate::service::Service; + use crate::storage_stage::StorageState; + use crate::storage_stage::NUM_IDENTITIES; + use crate::storage_stage::{get_identity_index_from_signature, StorageStage}; use rayon::prelude::*; - use service::Service; use solana_sdk::hash::Hash; use solana_sdk::hash::Hasher; use solana_sdk::signature::{Keypair, KeypairUtil, Signature}; @@ -285,9 +288,6 @@ mod tests { use std::sync::Arc; use std::thread::sleep; use std::time::Duration; - use storage_stage::StorageState; - use storage_stage::NUM_IDENTITIES; - use storage_stage::{get_identity_index_from_signature, StorageStage}; #[test] fn test_storage_stage_none_ledger() { diff --git a/src/store_ledger_stage.rs b/src/store_ledger_stage.rs index 02f4063ad6..f68bfa3e9e 100644 --- a/src/store_ledger_stage.rs +++ b/src/store_ledger_stage.rs @@ -1,11 +1,11 @@ //! The `store_ledger` stores the ledger from received entries for storage nodes -use counter::Counter; -use entry::EntryReceiver; -use ledger::LedgerWriter; +use crate::counter::Counter; +use crate::entry::EntryReceiver; +use crate::ledger::LedgerWriter; +use crate::result::{Error, Result}; +use crate::service::Service; use log::Level; -use result::{Error, Result}; -use service::Service; use std::sync::atomic::AtomicUsize; use std::sync::mpsc::RecvTimeoutError; use std::thread::{self, Builder, JoinHandle}; diff --git a/src/streamer.rs b/src/streamer.rs index 47afe0a55b..9a67069bbc 100644 --- a/src/streamer.rs +++ b/src/streamer.rs @@ -1,8 +1,8 @@ //! The `streamer` module defines a set of services for efficiently pulling data from UDP sockets. //! -use packet::{Blob, SharedBlobs, SharedPackets}; -use result::{Error, Result}; +use crate::packet::{Blob, SharedBlobs, SharedPackets}; +use crate::result::{Error, Result}; use solana_metrics::{influxdb, submit}; use solana_sdk::timing::duration_as_ms; use std::net::UdpSocket; @@ -135,7 +135,9 @@ pub fn blob_receiver(sock: Arc, exit: Arc, s: BlobSender) #[cfg(test)] mod test { - use packet::{Blob, Packet, Packets, SharedBlob, PACKET_DATA_SIZE}; + use crate::packet::{Blob, Packet, Packets, SharedBlob, PACKET_DATA_SIZE}; + use crate::streamer::PacketReceiver; + use crate::streamer::{receiver, responder}; use std::io; use std::io::Write; use std::net::UdpSocket; @@ -143,8 +145,6 @@ mod test { use std::sync::mpsc::channel; use std::sync::Arc; use std::time::Duration; - use streamer::PacketReceiver; - use streamer::{receiver, responder}; fn get_msgs(r: PacketReceiver, num: &mut usize) { for _t in 0..5 { diff --git a/src/thin_client.rs b/src/thin_client.rs index 741cafb81b..669f215a94 100644 --- a/src/thin_client.rs +++ b/src/thin_client.rs @@ -3,15 +3,15 @@ //! messages to the network directly. The binary encoding of its messages are //! unstable and may change in future releases. -use bank::Bank; +use crate::bank::Bank; +use crate::cluster_info::{ClusterInfo, ClusterInfoError, NodeInfo}; +use crate::gossip_service::GossipService; +use crate::packet::PACKET_DATA_SIZE; +use crate::result::{Error, Result}; +use crate::rpc_request::{RpcClient, RpcRequest}; use bincode::serialize; use bs58; -use cluster_info::{ClusterInfo, ClusterInfoError, NodeInfo}; -use gossip_service::GossipService; use log::Level; -use packet::PACKET_DATA_SIZE; -use result::{Error, Result}; -use rpc_request::{RpcClient, RpcRequest}; use serde_json; use solana_metrics; use solana_metrics::influxdb; @@ -431,14 +431,14 @@ pub fn retry_get_balance( #[cfg(test)] mod tests { use super::*; - use bank::Bank; + use crate::bank::Bank; + use crate::cluster_info::Node; + use crate::fullnode::Fullnode; + use crate::leader_scheduler::LeaderScheduler; + use crate::ledger::create_tmp_ledger_with_mint; + use crate::logger; + use crate::mint::Mint; use bincode::deserialize; - use cluster_info::Node; - use fullnode::Fullnode; - use leader_scheduler::LeaderScheduler; - use ledger::create_tmp_ledger_with_mint; - use logger; - use mint::Mint; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::system_instruction::SystemInstruction; use solana_sdk::vote_program::VoteProgram; diff --git a/src/tpu.rs b/src/tpu.rs index 8b524628a5..d367dbd068 100644 --- a/src/tpu.rs +++ b/src/tpu.rs @@ -1,14 +1,14 @@ //! The `tpu` module implements the Transaction Processing Unit, a //! 5-stage transaction processing pipeline in software. -use bank::Bank; -use banking_stage::{BankingStage, BankingStageReturnType}; -use entry::Entry; -use fetch_stage::FetchStage; -use ledger_write_stage::LedgerWriteStage; -use poh_service::Config; -use service::Service; -use sigverify_stage::SigVerifyStage; +use crate::bank::Bank; +use crate::banking_stage::{BankingStage, BankingStageReturnType}; +use crate::entry::Entry; +use crate::fetch_stage::FetchStage; +use crate::ledger_write_stage::LedgerWriteStage; +use crate::poh_service::Config; +use crate::service::Service; +use crate::sigverify_stage::SigVerifyStage; use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey; use std::net::UdpSocket; diff --git a/src/tpu_forwarder.rs b/src/tpu_forwarder.rs index 37a2dc04f7..7bbd7aae91 100644 --- a/src/tpu_forwarder.rs +++ b/src/tpu_forwarder.rs @@ -2,18 +2,18 @@ //! transaction processing unit responsibility, which //! forwards received packets to the current leader -use cluster_info::ClusterInfo; -use contact_info::ContactInfo; -use counter::Counter; +use crate::cluster_info::ClusterInfo; +use crate::contact_info::ContactInfo; +use crate::counter::Counter; +use crate::result::Result; +use crate::service::Service; +use crate::streamer::{self, PacketReceiver}; use log::Level; -use result::Result; -use service::Service; use std::net::UdpSocket; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::mpsc::channel; use std::sync::{Arc, RwLock}; use std::thread::{self, Builder, JoinHandle}; -use streamer::{self, PacketReceiver}; pub struct TpuForwarder { exit: Arc, @@ -105,9 +105,9 @@ impl Service for TpuForwarder { #[cfg(test)] mod tests { use super::*; - use cluster_info::ClusterInfo; - use contact_info::ContactInfo; - use netutil::bind_in_range; + use crate::cluster_info::ClusterInfo; + use crate::contact_info::ContactInfo; + use crate::netutil::bind_in_range; use solana_sdk::pubkey::Pubkey; use std::net::UdpSocket; use std::net::{Ipv4Addr, SocketAddr}; diff --git a/src/tvu.rs b/src/tvu.rs index 5f1726c596..8d98af78f9 100644 --- a/src/tvu.rs +++ b/src/tvu.rs @@ -10,21 +10,21 @@ //! - Transactions in blobs are processed and applied to the bank. //! - TODO We need to verify the signatures in the blobs. -use bank::Bank; -use blob_fetch_stage::BlobFetchStage; -use cluster_info::ClusterInfo; -use db_ledger::DbLedger; -use ledger_write_stage::LedgerWriteStage; -use replicate_stage::{ReplicateStage, ReplicateStageReturnType}; -use retransmit_stage::RetransmitStage; -use service::Service; +use crate::bank::Bank; +use crate::blob_fetch_stage::BlobFetchStage; +use crate::cluster_info::ClusterInfo; +use crate::db_ledger::DbLedger; +use crate::ledger_write_stage::LedgerWriteStage; +use crate::replicate_stage::{ReplicateStage, ReplicateStageReturnType}; +use crate::retransmit_stage::RetransmitStage; +use crate::service::Service; +use crate::storage_stage::StorageStage; use solana_sdk::hash::Hash; use solana_sdk::signature::Keypair; use std::net::UdpSocket; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, RwLock}; use std::thread; -use storage_stage::StorageStage; #[derive(Debug, PartialEq, Eq, Clone)] pub enum TvuReturnType { @@ -163,19 +163,22 @@ impl Service for Tvu { #[cfg(test)] pub mod tests { - use bank::Bank; + use crate::bank::Bank; + use crate::cluster_info::{ClusterInfo, Node}; + use crate::db_ledger::DbLedger; + use crate::entry::Entry; + use crate::gossip_service::GossipService; + use crate::leader_scheduler::LeaderScheduler; + use crate::ledger::get_tmp_ledger_path; + use crate::logger; + use crate::mint::Mint; + use crate::packet::SharedBlob; + use crate::service::Service; + use crate::streamer; + use crate::tvu::Tvu; + use crate::window::{self, SharedWindow}; use bincode::serialize; - use cluster_info::{ClusterInfo, Node}; - use db_ledger::DbLedger; - use entry::Entry; - use gossip_service::GossipService; - use leader_scheduler::LeaderScheduler; - use ledger::get_tmp_ledger_path; - use logger; - use mint::Mint; - use packet::SharedBlob; use rocksdb::{Options, DB}; - use service::Service; use solana_sdk::hash::Hash; use solana_sdk::signature::{Keypair, KeypairUtil}; use solana_sdk::system_transaction::SystemTransaction; @@ -186,9 +189,6 @@ pub mod tests { use std::sync::mpsc::channel; use std::sync::{Arc, RwLock}; use std::time::Duration; - use streamer; - use tvu::Tvu; - use window::{self, SharedWindow}; fn new_ncp( cluster_info: Arc>, diff --git a/src/vote_stage.rs b/src/vote_stage.rs index 4ad743d031..eb18025ed4 100644 --- a/src/vote_stage.rs +++ b/src/vote_stage.rs @@ -1,12 +1,13 @@ //! The `vote_stage` votes on the `last_id` of the bank at a regular cadence -use bank::Bank; +use crate::bank::Bank; +use crate::cluster_info::ClusterInfo; +use crate::counter::Counter; +use crate::packet::SharedBlob; +use crate::result::{Error, Result}; +use crate::streamer::BlobSender; use bincode::serialize; -use cluster_info::ClusterInfo; -use counter::Counter; use log::Level; -use packet::SharedBlob; -use result::{Error, Result}; use solana_sdk::hash::Hash; use solana_sdk::signature::Keypair; use solana_sdk::transaction::Transaction; @@ -15,7 +16,6 @@ use solana_sdk::vote_transaction::VoteTransaction; use std::net::SocketAddr; use std::sync::atomic::AtomicUsize; use std::sync::{Arc, RwLock}; -use streamer::BlobSender; #[derive(Debug, PartialEq, Eq)] pub enum VoteError { diff --git a/src/wallet.rs b/src/wallet.rs index f8140b2a1f..63f267fd05 100644 --- a/src/wallet.rs +++ b/src/wallet.rs @@ -1,13 +1,14 @@ +use crate::fullnode::Config; +use crate::rpc::RpcSignatureStatus; +use crate::rpc_request::{get_rpc_request_str, RpcClient, RpcRequest}; +use crate::thin_client::poll_gossip_for_leader; use bincode::serialize; use bs58; use chrono::prelude::*; use clap::ArgMatches; use elf; -use fullnode::Config; use ring::rand::SystemRandom; use ring::signature::Ed25519KeyPair; -use rpc::RpcSignatureStatus; -use rpc_request::{get_rpc_request_str, RpcClient, RpcRequest}; use serde_json; use solana_drone::drone::{request_airdrop_transaction, DRONE_PORT}; use solana_sdk::bpf_loader; @@ -27,7 +28,6 @@ use std::str::FromStr; use std::thread::sleep; use std::time::Duration; use std::{error, fmt, mem}; -use thin_client::poll_gossip_for_leader; const PLATFORM_SECTION_C: &str = ".text.entrypoint"; const USERDATA_CHUNK_SIZE: usize = 256; @@ -768,12 +768,12 @@ fn send_and_confirm_tx(rpc_client: &RpcClient, tx: &Transaction) -> Result<(), B #[cfg(test)] mod tests { use super::*; - use bank::Bank; + use crate::bank::Bank; + use crate::cluster_info::Node; + use crate::fullnode::Fullnode; + use crate::leader_scheduler::LeaderScheduler; + use crate::ledger::create_tmp_genesis; use clap::{App, Arg, SubCommand}; - use cluster_info::Node; - use fullnode::Fullnode; - use leader_scheduler::LeaderScheduler; - use ledger::create_tmp_genesis; use serde_json::Value; use solana_drone::drone::run_local_drone; use solana_sdk::signature::{read_keypair, read_pkcs8, Keypair, KeypairUtil}; diff --git a/src/window.rs b/src/window.rs index fd1e8cb8fe..8edf52cf30 100644 --- a/src/window.rs +++ b/src/window.rs @@ -1,12 +1,12 @@ //! The `window` module defines data structure for storing the tail of the ledger. //! -use cluster_info::ClusterInfo; -use counter::Counter; -use entry::reconstruct_entries_from_blobs; -use entry::Entry; -use leader_scheduler::LeaderScheduler; +use crate::cluster_info::ClusterInfo; +use crate::counter::Counter; +use crate::entry::reconstruct_entries_from_blobs; +use crate::entry::Entry; +use crate::leader_scheduler::LeaderScheduler; +use crate::packet::SharedBlob; use log::Level; -use packet::SharedBlob; use solana_sdk::pubkey::Pubkey; use std::cmp; use std::mem; @@ -398,7 +398,9 @@ pub fn default_window() -> Window { #[cfg(test)] mod test { - use packet::{Blob, Packet, Packets, SharedBlob, PACKET_DATA_SIZE}; + use crate::packet::{Blob, Packet, Packets, SharedBlob, PACKET_DATA_SIZE}; + use crate::streamer::{receiver, responder, PacketReceiver}; + use crate::window::{calculate_max_repair, new_window, Window, WindowUtil}; use solana_sdk::pubkey::Pubkey; use std::io; use std::io::Write; @@ -407,8 +409,6 @@ mod test { use std::sync::mpsc::channel; use std::sync::Arc; use std::time::Duration; - use streamer::{receiver, responder, PacketReceiver}; - use window::{calculate_max_repair, new_window, Window, WindowUtil}; fn get_msgs(r: PacketReceiver, num: &mut usize) { for _t in 0..5 { diff --git a/src/window_service.rs b/src/window_service.rs index 89bd052b1f..1137fcad88 100644 --- a/src/window_service.rs +++ b/src/window_service.rs @@ -1,15 +1,16 @@ //! The `window_service` provides a thread for maintaining a window (tail of the ledger). //! -use cluster_info::ClusterInfo; -use counter::Counter; -use db_ledger::{DbLedger, LedgerColumnFamily, MetaCf, DEFAULT_SLOT_HEIGHT}; -use db_window::*; -use entry::EntrySender; +use crate::cluster_info::ClusterInfo; +use crate::counter::Counter; +use crate::db_ledger::{DbLedger, LedgerColumnFamily, MetaCf, DEFAULT_SLOT_HEIGHT}; +use crate::db_window::*; +use crate::entry::EntrySender; -use leader_scheduler::LeaderScheduler; +use crate::leader_scheduler::LeaderScheduler; +use crate::result::{Error, Result}; +use crate::streamer::{BlobReceiver, BlobSender}; use log::Level; use rand::{thread_rng, Rng}; -use result::{Error, Result}; use solana_metrics::{influxdb, submit}; use solana_sdk::pubkey::Pubkey; use solana_sdk::timing::duration_as_ms; @@ -20,7 +21,6 @@ use std::sync::mpsc::RecvTimeoutError; use std::sync::{Arc, RwLock}; use std::thread::{Builder, JoinHandle}; use std::time::{Duration, Instant}; -use streamer::{BlobReceiver, BlobSender}; pub const MAX_REPAIR_BACKOFF: usize = 128; @@ -227,13 +227,15 @@ pub fn window_service( #[cfg(test)] mod test { - use cluster_info::{ClusterInfo, Node}; - use db_ledger::DbLedger; - use entry::Entry; - use leader_scheduler::LeaderScheduler; - use ledger::get_tmp_ledger_path; - use logger; - use packet::{make_consecutive_blobs, SharedBlob, PACKET_DATA_SIZE}; + use crate::cluster_info::{ClusterInfo, Node}; + use crate::db_ledger::DbLedger; + use crate::entry::Entry; + use crate::leader_scheduler::LeaderScheduler; + use crate::ledger::get_tmp_ledger_path; + use crate::logger; + use crate::packet::{make_consecutive_blobs, SharedBlob, PACKET_DATA_SIZE}; + use crate::streamer::{blob_receiver, responder}; + use crate::window_service::{repair_backoff, window_service}; use rocksdb::{Options, DB}; use solana_sdk::hash::Hash; use std::fs::remove_dir_all; @@ -242,8 +244,6 @@ mod test { use std::sync::mpsc::{channel, Receiver}; use std::sync::{Arc, RwLock}; use std::time::Duration; - use streamer::{blob_receiver, responder}; - use window_service::{repair_backoff, window_service}; fn get_entries(r: Receiver>, num: &mut usize) { for _t in 0..5 {