Use hashlink over lru for LruCache (#8911)

Use the `LruCache` implementation provided by `hashlink` instead of the current `lru` one.
This is mostly a 1-to-1 swap with only slight API incompatibilities.
I have decided to leave some config files which previously used `NonZeroUsize` but they may not be required anymore and could potentially switch to `usize`.


Co-Authored-By: Mac L <mjladson@pm.me>
This commit is contained in:
Mac L
2026-06-16 10:54:11 +04:00
committed by GitHub
parent 41dff2d965
commit e0ff3b5709
28 changed files with 166 additions and 192 deletions

23
Cargo.lock generated
View File

@@ -364,7 +364,7 @@ dependencies = [
"either",
"futures",
"futures-utils-wasm",
"lru 0.13.0",
"lru",
"parking_lot",
"pin-project",
"reqwest",
@@ -1229,13 +1229,13 @@ dependencies = [
"fork_choice",
"futures",
"genesis",
"hashlink",
"hex",
"int_to_bytes",
"itertools 0.14.0",
"kzg",
"lighthouse_version",
"logging",
"lru 0.12.5",
"maplit",
"merkle_proof",
"metrics",
@@ -3394,13 +3394,13 @@ dependencies = [
"fork_choice",
"hash-db",
"hash256-std-hasher",
"hashlink",
"hex",
"jsonwebtoken",
"keccak-hash",
"kzg",
"lighthouse_version",
"logging",
"lru 0.12.5",
"metrics",
"parking_lot",
"pretty_reqwest_error",
@@ -4240,12 +4240,12 @@ dependencies = [
"fixed_bytes",
"futures",
"genesis",
"hashlink",
"health_metrics",
"hex",
"lighthouse_network",
"lighthouse_version",
"logging",
"lru 0.12.5",
"metrics",
"network",
"network_utils",
@@ -5549,6 +5549,7 @@ dependencies = [
"fixed_bytes",
"fnv",
"futures",
"hashlink",
"hex",
"if-addrs 0.14.0",
"itertools 0.14.0",
@@ -5556,7 +5557,6 @@ dependencies = [
"libp2p-mplex",
"lighthouse_version",
"logging",
"lru 0.12.5",
"lru_cache",
"metrics",
"network_utils",
@@ -5703,15 +5703,6 @@ dependencies = [
"thiserror 1.0.69",
]
[[package]]
name = "lru"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38"
dependencies = [
"hashbrown 0.15.5",
]
[[package]]
name = "lru"
version = "0.13.0"
@@ -8415,10 +8406,10 @@ dependencies = [
"filesystem",
"fixed_bytes",
"flate2",
"hashlink",
"libmdbx",
"lmdb-rkv",
"lmdb-rkv-sys",
"lru 0.12.5",
"maplit",
"metrics",
"parking_lot",
@@ -8652,10 +8643,10 @@ dependencies = [
"ethereum_ssz",
"ethereum_ssz_derive",
"fixed_bytes",
"hashlink",
"itertools 0.14.0",
"leveldb",
"logging",
"lru 0.12.5",
"metrics",
"milhouse",
"parking_lot",