From 15a0640a9e6afc05d5c6b914699ce4c2b5b686f4 Mon Sep 17 00:00:00 2001 From: Piotr Mikulski Date: Tue, 16 Nov 2021 23:06:26 -0800 Subject: [PATCH] hotfix --- chain/network/src/peer/peer_actor.rs | 11 +++++++---- chain/network/src/peer_manager/peer_manager_actor.rs | 4 ++-- chain/network/src/peer_manager/peer_store.rs | 6 ++++-- chain/network/src/routing/codec.rs | 6 ++++-- chain/network/src/routing/route_back_cache.rs | 6 +++--- chain/network/src/routing/routing.rs | 3 +-- chain/network/src/types.rs | 6 +++--- 7 files changed, 24 insertions(+), 18 deletions(-) diff --git a/chain/network/src/peer/peer_actor.rs b/chain/network/src/peer/peer_actor.rs index 918bb39a431..e4de82959d5 100644 --- a/chain/network/src/peer/peer_actor.rs +++ b/chain/network/src/peer/peer_actor.rs @@ -2,8 +2,10 @@ use std::cmp::max; use std::fmt::Debug; use std::io; use std::net::SocketAddr; -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::sync::Arc; +use std::sync::{ + atomic::{AtomicUsize, Ordering}, + Arc, +}; use std::time::{Duration, Instant}; use actix::{ @@ -22,20 +24,21 @@ use near_network_primitives::types::{ ReasonForBan, RoutedMessage, RoutedMessageBody, RoutedMessageFrom, StateResponseInfo, UPDATE_INTERVAL_LAST_TIME_RECEIVED_MESSAGE, }; +use near_performance_metrics; use near_performance_metrics::framed_write::{FramedWrite, WriteHandler}; use near_performance_metrics_macros::perf; use near_primitives::block::GenesisId; +use near_primitives::logging; use near_primitives::network::PeerId; use near_primitives::sharding::PartialEncodedChunk; use near_primitives::time::Clock; +use near_primitives::unwrap_option_or_return; use near_primitives::utils::DisplayOption; use near_primitives::version::{ ProtocolVersion, OLDEST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION, PROTOCOL_VERSION, }; -use near_primitives::{logging, unwrap_option_or_return}; use near_rate_limiter::ThrottleController; use near_rust_allocator_proxy::allocator::get_tid; -use {near_metrics, near_performance_metrics}; use crate::peer::tracker::Tracker; use crate::routing::codec::{self, bytes_to_peer_message, peer_message_to_bytes, Codec}; diff --git a/chain/network/src/peer_manager/peer_manager_actor.rs b/chain/network/src/peer_manager/peer_manager_actor.rs index 471a328e5dd..7fc2cb29a53 100644 --- a/chain/network/src/peer_manager/peer_manager_actor.rs +++ b/chain/network/src/peer_manager/peer_manager_actor.rs @@ -5,8 +5,8 @@ use std::collections::{HashMap, HashSet}; use std::mem::swap; use std::net::SocketAddr; use std::pin::Pin; -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::sync::Arc; +use std::sync::atomic::Ordering; +use std::sync::{atomic::AtomicUsize, Arc}; use std::time::{Duration, Instant}; use actix::{ diff --git a/chain/network/src/peer_manager/peer_store.rs b/chain/network/src/peer_manager/peer_store.rs index e4bc8e0d2c1..900ce714d46 100644 --- a/chain/network/src/peer_manager/peer_store.rs +++ b/chain/network/src/peer_manager/peer_store.rs @@ -1,5 +1,7 @@ -use std::collections::hash_map::{Entry, Iter}; -use std::collections::HashMap; +use std::collections::{ + hash_map::{Entry, Iter}, + HashMap, +}; use std::net::SocketAddr; use std::sync::Arc; diff --git a/chain/network/src/routing/codec.rs b/chain/network/src/routing/codec.rs index f4566c9c399..06380ab4f22 100644 --- a/chain/network/src/routing/codec.rs +++ b/chain/network/src/routing/codec.rs @@ -173,8 +173,10 @@ mod test { use near_primitives::hash::{self, CryptoHash}; use near_primitives::network::{AnnounceAccount, PeerId}; use near_primitives::transaction::{SignedTransaction, Transaction}; - use near_primitives::types::EpochId; - use near_primitives::version::{OLDEST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION, PROTOCOL_VERSION}; + use near_primitives::{ + types::EpochId, + version::{OLDEST_BACKWARD_COMPATIBLE_PROTOCOL_VERSION, PROTOCOL_VERSION}, + }; use super::*; use crate::routing::edge::EdgeInfo; diff --git a/chain/network/src/routing/route_back_cache.rs b/chain/network/src/routing/route_back_cache.rs index df9aab4194a..371226f3999 100644 --- a/chain/network/src/routing/route_back_cache.rs +++ b/chain/network/src/routing/route_back_cache.rs @@ -1,4 +1,5 @@ -use std::collections::{btree_map, BTreeMap, BTreeSet, HashMap}; +use std::collections::btree_map; +use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::time::{Duration, Instant}; use near_primitives::hash::CryptoHash; @@ -228,8 +229,7 @@ impl RouteBackCache { mod test { use super::*; use near_primitives::hash::hash; - use std::thread; - use std::time::Duration; + use std::{thread, time::Duration}; /// Check internal state of the cache is ok fn check_consistency(cache: &RouteBackCache) { diff --git a/chain/network/src/routing/routing.rs b/chain/network/src/routing/routing.rs index 3b18d4be285..030a9214820 100644 --- a/chain/network/src/routing/routing.rs +++ b/chain/network/src/routing/routing.rs @@ -1,6 +1,5 @@ use near_primitives::time::Clock; -use std::collections::hash_map::Entry; -use std::collections::{HashMap, VecDeque}; +use std::collections::{hash_map::Entry, HashMap, VecDeque}; use std::hash::Hash; use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; diff --git a/chain/network/src/types.rs b/chain/network/src/types.rs index 08f420b2144..c59556b3c6e 100644 --- a/chain/network/src/types.rs +++ b/chain/network/src/types.rs @@ -1,14 +1,14 @@ use near_primitives::time::Instant; use std::collections::HashMap; +use std::fmt; use std::fmt::{Debug, Formatter}; +use std::io; use std::sync::{Arc, Mutex, RwLock}; -use std::{fmt, io}; use actix::dev::{MessageResponse, ResponseChannel}; use actix::{Actor, Addr, MailboxError, Message, Recipient}; use borsh::{BorshDeserialize, BorshSerialize}; -use futures::future::BoxFuture; -use futures::FutureExt; +use futures::{future::BoxFuture, FutureExt}; #[cfg(feature = "test_features")] use serde::Serialize; use strum::AsStaticStr;