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
@@ -15,7 +15,7 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
honggfuzz = "0.5.49"
num-bigint = "0.2"
num-bigint = "0.4.3"
primitive-types = "0.12.0"
sp-arithmetic = { version = "5.0.0", path = ".." }
+1 -1
View File
@@ -17,7 +17,7 @@ targets = ["x86_64-unknown-linux-gnu"]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
futures = "0.3.21"
log = "0.4.17"
lru = "0.7.5"
lru = "0.8.1"
parking_lot = "0.12.1"
thiserror = "1.0.30"
sp-api = { version = "4.0.0-dev", path = "../api" }
@@ -21,6 +21,7 @@
use lru::LruCache;
use parking_lot::RwLock;
use sp_runtime::traits::{Block as BlockT, Header, NumberFor, One};
use std::num::NonZeroUsize;
/// Set to the expected max difference between `best` and `finalized` blocks at sync.
const LRU_CACHE_SIZE: usize = 5_000;
@@ -239,14 +240,15 @@ pub struct HeaderMetadataCache<Block: BlockT> {
impl<Block: BlockT> HeaderMetadataCache<Block> {
/// Creates a new LRU header metadata cache with `capacity`.
pub fn new(capacity: usize) -> Self {
pub fn new(capacity: NonZeroUsize) -> Self {
HeaderMetadataCache { cache: RwLock::new(LruCache::new(capacity)) }
}
}
impl<Block: BlockT> Default for HeaderMetadataCache<Block> {
fn default() -> Self {
HeaderMetadataCache { cache: RwLock::new(LruCache::new(LRU_CACHE_SIZE)) }
let cap = NonZeroUsize::new(LRU_CACHE_SIZE).expect("cache capacity is not zero");
HeaderMetadataCache { cache: RwLock::new(LruCache::new(cap)) }
}
}
+1 -1
View File
@@ -23,7 +23,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
hashbrown = { version = "0.12.3", optional = true }
hash-db = { version = "0.15.2", default-features = false }
lazy_static = { version = "1.4.0", optional = true }
lru = { version = "0.7.5", optional = true }
lru = { version = "0.8.1", optional = true }
memory-db = { version = "0.30.0", default-features = false }
nohash-hasher = { version = "0.2.0", optional = true }
parking_lot = { version = "0.12.1", optional = true }
+1 -1
View File
@@ -35,7 +35,7 @@ lazy_static::lazy_static! {
}
/// No hashing [`LruCache`].
type NoHashingLruCache<K, T> = lru::LruCache<K, T, BuildNoHashHasher<K>>;
type NoHashingLruCache<K, T> = LruCache<K, T, BuildNoHashHasher<K>>;
/// The shared node cache.
///