Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit efb82ef

Browse files
dependabot[bot]skunertbkchr
authored
Bump lru from 0.7.8 to 0.8.0 (#6060)
* Bump lru from 0.7.8 to 0.8.0 Bumps [lru](https://github.com/jeromefroe/lru-rs) from 0.7.8 to 0.8.0. - [Release notes](https://github.com/jeromefroe/lru-rs/releases) - [Changelog](https://github.com/jeromefroe/lru-rs/blob/master/CHANGELOG.md) - [Commits](jeromefroe/lru-rs@0.7.8...0.8.0) --- updated-dependencies: - dependency-name: lru dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Change `LruCache` paramerter to `NonZeroUsize` * Change type of `session_cache_lru_size` to `NonZeroUsize` * Add expects instead of unwrap Co-authored-by: Bastian Köcher <info@kchr.de> * Use match to get rid of expects Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Sebastian Kunert <skunert49@gmail.com> Co-authored-by: Bastian Köcher <info@kchr.de>
1 parent 60554e1 commit efb82ef

File tree

17 files changed

+64
-32
lines changed

17 files changed

+64
-32
lines changed

Cargo.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/core/approval-voting/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ futures-timer = "3.0.2"
1010
parity-scale-codec = { version = "3.1.5", default-features = false, features = ["bit-vec", "derive"] }
1111
gum = { package = "tracing-gum", path = "../../gum" }
1212
bitvec = { version = "1.0.0", default-features = false, features = ["alloc"] }
13-
lru = "0.7"
13+
lru = "0.8"
1414
merlin = "2.0"
1515
schnorrkel = "0.9.1"
1616
kvdb = "0.11.0"

node/core/approval-voting/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ use std::{
7070
collections::{
7171
btree_map::Entry as BTMEntry, hash_map::Entry as HMEntry, BTreeMap, HashMap, HashSet,
7272
},
73+
num::NonZeroUsize,
7374
sync::Arc,
7475
time::Duration,
7576
};
@@ -104,7 +105,11 @@ const APPROVAL_CHECKING_TIMEOUT: Duration = Duration::from_secs(120);
104105
/// Value rather arbitrarily: Should not be hit in practice, it exists to more easily diagnose dead
105106
/// lock issues for example.
106107
const WAIT_FOR_SIGS_TIMEOUT: Duration = Duration::from_millis(500);
107-
const APPROVAL_CACHE_SIZE: usize = 1024;
108+
const APPROVAL_CACHE_SIZE: NonZeroUsize = match NonZeroUsize::new(1024) {
109+
Some(cap) => cap,
110+
None => panic!("Approval cache size must be non-zero."),
111+
};
112+
108113
const TICK_TOO_FAR_IN_FUTURE: Tick = 20; // 10 seconds.
109114
const APPROVAL_DELAY: Tick = 2;
110115
const LOG_TARGET: &str = "parachain::approval-voting";

node/core/dispute-coordinator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ gum = { package = "tracing-gum", path = "../../gum" }
1010
parity-scale-codec = "3.1.5"
1111
kvdb = "0.11.0"
1212
thiserror = "1.0.31"
13-
lru = "0.7.7"
13+
lru = "0.8.0"
1414
fatality = "0.0.6"
1515

1616
polkadot-primitives = { path = "../../../primitives" }

node/core/dispute-coordinator/src/scraping/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
1616

17-
use std::collections::{BTreeMap, HashSet};
17+
use std::{
18+
collections::{BTreeMap, HashSet},
19+
num::NonZeroUsize,
20+
};
1821

1922
use futures::channel::oneshot;
2023
use lru::LruCache;
@@ -44,7 +47,10 @@ mod tests;
4447
/// `last_observed_blocks` LRU. This means, this value should the very least be as large as the
4548
/// number of expected forks for keeping chain scraping efficient. Making the LRU much larger than
4649
/// that has very limited use.
47-
const LRU_OBSERVED_BLOCKS_CAPACITY: usize = 20;
50+
const LRU_OBSERVED_BLOCKS_CAPACITY: NonZeroUsize = match NonZeroUsize::new(20) {
51+
Some(cap) => cap,
52+
None => panic!("Observed blocks cache size must be non-zero"),
53+
};
4854

4955
/// Chain scraper
5056
///

node/network/availability-distribution/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "maste
1919
thiserror = "1.0.31"
2020
rand = "0.8.5"
2121
derive_more = "0.99.17"
22-
lru = "0.7.7"
22+
lru = "0.8.0"
2323
fatality = "0.0.6"
2424

2525
[dev-dependencies]

node/network/availability-distribution/src/requester/session_cache.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
1616

17-
use std::collections::HashSet;
17+
use std::{collections::HashSet, num::NonZeroUsize};
1818

1919
use lru::LruCache;
2020
use rand::{seq::SliceRandom, thread_rng};
@@ -85,7 +85,7 @@ impl SessionCache {
8585
pub fn new() -> Self {
8686
SessionCache {
8787
// We need to cache the current and the last session the most:
88-
session_info_cache: LruCache::new(2),
88+
session_info_cache: LruCache::new(NonZeroUsize::new(2).unwrap()),
8989
}
9090
}
9191

node/network/availability-recovery/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66

77
[dependencies]
88
futures = "0.3.21"
9-
lru = "0.7.7"
9+
lru = "0.8.0"
1010
rand = "0.8.5"
1111
fatality = "0.0.6"
1212
thiserror = "1.0.31"

node/network/availability-recovery/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
use std::{
2222
collections::{HashMap, VecDeque},
23+
num::NonZeroUsize,
2324
pin::Pin,
2425
time::Duration,
2526
};
@@ -77,7 +78,10 @@ const LOG_TARGET: &str = "parachain::availability-recovery";
7778
const N_PARALLEL: usize = 50;
7879

7980
// Size of the LRU cache where we keep recovered data.
80-
const LRU_SIZE: usize = 16;
81+
const LRU_SIZE: NonZeroUsize = match NonZeroUsize::new(16) {
82+
Some(cap) => cap,
83+
None => panic!("Availability-recovery cache size must be non-zero."),
84+
};
8185

8286
const COST_INVALID_REQUEST: Rep = Rep::CostMajor("Peer sent unparsable request");
8387

node/network/dispute-distribution/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ sp-application-crypto = { git = "https://github.com/paritytech/substrate", branc
2020
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
2121
thiserror = "1.0.31"
2222
fatality = "0.0.6"
23-
lru = "0.7.7"
23+
lru = "0.8.0"
2424

2525
[dev-dependencies]
2626
async-trait = "0.1.57"

0 commit comments

Comments
 (0)