Update some dependencies to prune duplicated crates with different version (#12560)

* sc-client-babe/sp-arithmetic-fuzzer: update num-bigint and num-rational to v0.4

* update lru 0.7.5 ==> v0.8.1

* pallet-example-offchain-worker: update lite-json v0.1.3 ==> v0.2.0

* update hyper 0.14.16 ==> 0.14.20, num-fromat 0.4.0 ==> 0.4.3

* pallet-mmr: update ckb-merkle-mountain-range v0.3.2 ==> v0.5.2

* update handlebars v4.2.2 ==> v4.3.5

* `runtime_cache_size` must always be at least 1

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* default cache size with .min(1)

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* update hyper 0.14.20 ==> 0.14.22

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* update lru 0.8.0 ==> 0.8.1

Signed-off-by: koushiro <koushiro.cqx@gmail.com>

* Apply suggestions from code review

* Apply suggestions from code review

* Fix Cargo.lock

Signed-off-by: koushiro <koushiro.cqx@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
Qinxuan Chen
2022-11-09 19:46:00 +08:00
committed by GitHub
parent 657d99202c
commit ad6630ed71
22 changed files with 191 additions and 269 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ libp2p = { version = "0.49.0", features = ["async-std", "dns", "identify", "kad"
linked_hash_set = "0.1.3"
linked-hash-map = "0.5.4"
log = "0.4.17"
lru = "0.7.5"
lru = "0.8.1"
parking_lot = "0.12.1"
pin-project = "1.0.12"
prost = "0.11"
+9 -5
View File
@@ -31,6 +31,7 @@ use libp2p::{
Multiaddr, PeerId,
};
use log::{debug, error, info, log, trace, warn, Level};
use lru::LruCache;
use message::{generic::Message as GenericMessage, Message};
use notifications::{Notifications, NotificationsOut};
use prometheus_endpoint::{register, Gauge, GaugeVec, Opts, PrometheusError, Registry, U64};
@@ -200,7 +201,7 @@ pub struct Protocol<B: BlockT, Client> {
/// The `PeerId`'s of all boot nodes.
boot_node_ids: HashSet<PeerId>,
/// A cache for the data that was associated to a block announcement.
block_announce_data_cache: lru::LruCache<B::Hash, Vec<u8>>,
block_announce_data_cache: LruCache<B::Hash, Vec<u8>>,
}
#[derive(Debug)]
@@ -356,10 +357,13 @@ where
)
};
let block_announce_data_cache = lru::LruCache::new(
network_config.default_peers_set.in_peers as usize +
network_config.default_peers_set.out_peers as usize,
);
let cache_capacity = NonZeroUsize::new(
(network_config.default_peers_set.in_peers as usize +
network_config.default_peers_set.out_peers as usize)
.max(1),
)
.expect("cache capacity is not zero");
let block_announce_data_cache = LruCache::new(cache_capacity);
let protocol = Self {
tick_timeout: Box::pin(interval(TICK_TIMEOUT)),
+2 -4
View File
@@ -18,13 +18,11 @@ prost-build = "0.11"
[dependencies]
array-bytes = "4.1"
codec = { package = "parity-scale-codec", version = "3.0.0", features = [
"derive",
] }
codec = { package = "parity-scale-codec", version = "3.0.0", features = ["derive"] }
futures = "0.3.21"
libp2p = "0.49.0"
log = "0.4.17"
lru = "0.7.5"
lru = "0.8.1"
mockall = "0.11.2"
prost = "0.11"
smallvec = "1.8.0"
@@ -41,6 +41,7 @@ use sp_runtime::{
use std::{
cmp::min,
hash::{Hash, Hasher},
num::NonZeroUsize,
sync::Arc,
time::Duration,
};
@@ -164,7 +165,9 @@ where
);
protocol_config.inbound_queue = Some(tx);
let seen_requests = LruCache::new(num_peer_hint * 2);
let capacity =
NonZeroUsize::new(num_peer_hint.max(1) * 2).expect("cache capacity is not zero");
let seen_requests = LruCache::new(capacity);
(Self { client, request_receiver, seen_requests }, protocol_config)
}
@@ -35,6 +35,7 @@ use sc_network_common::{
use sp_runtime::traits::Block as BlockT;
use std::{
hash::{Hash, Hasher},
num::NonZeroUsize,
sync::Arc,
time::Duration,
};
@@ -144,7 +145,9 @@ where
);
protocol_config.inbound_queue = Some(tx);
let seen_requests = LruCache::new(num_peer_hint * 2);
let capacity =
NonZeroUsize::new(num_peer_hint.max(1) * 2).expect("cache capacity is not zero");
let seen_requests = LruCache::new(capacity);
(Self { client, request_receiver, seen_requests }, protocol_config)
}