diff --git a/CHANGELOG.md b/CHANGELOG.md index d2a5f8b0af..08f425f819 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *When editing this file, please respect a line length of 100.* +## 2024-11-13 + +### Network + +#### Fixed + +- During a restart, the node builds a cache of locally restored records, + which is used to improve the speed of the relevant records calculation. + The restored records were not being added to the cache. + This has now been corrected. + ## 2024-11-12 ### Network diff --git a/Cargo.lock b/Cargo.lock index dc48a94624..fb0e63d987 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8590,7 +8590,7 @@ dependencies = [ [[package]] name = "sn_networking" -version = "0.19.3" +version = "0.19.4" dependencies = [ "aes-gcm-siv", "assert_fs", diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index fa6fd98c09..a7d5bef282 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -38,7 +38,7 @@ rand = "0.8.5" rmp-serde = "1.1.1" self_encryption = "~0.30.0" serde = { version = "1.0.133", features = ["derive", "rc"] } -sn_networking = { path = "../sn_networking", version = "0.19.3" } +sn_networking = { path = "../sn_networking", version = "0.19.4" } sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } sn_protocol = { version = "0.17.15", path = "../sn_protocol" } sn_registers = { path = "../sn_registers", version = "0.4.3" } diff --git a/nat-detection/Cargo.toml b/nat-detection/Cargo.toml index bec7a41943..182fb0c053 100644 --- a/nat-detection/Cargo.toml +++ b/nat-detection/Cargo.toml @@ -32,7 +32,7 @@ libp2p = { version = "0.54.1", features = [ "upnp", ] } sn_build_info = { path = "../sn_build_info", version = "0.1.19" } -sn_networking = { path = "../sn_networking", version = "0.19.3" } +sn_networking = { path = "../sn_networking", version = "0.19.4" } sn_protocol = { path = "../sn_protocol", version = "0.17.15" } tokio = { version = "1.32.0", features = ["full"] } tracing = { version = "~0.1.26" } diff --git a/release-cycle-info b/release-cycle-info index 3d68391e5c..b272dbda85 100644 --- a/release-cycle-info +++ b/release-cycle-info @@ -15,4 +15,4 @@ release-year: 2024 release-month: 11 release-cycle: 1 -release-cycle-counter: 4 +release-cycle-counter: 5 diff --git a/sn_build_info/src/release_info.rs b/sn_build_info/src/release_info.rs index efccc77282..23ddb6c755 100644 --- a/sn_build_info/src/release_info.rs +++ b/sn_build_info/src/release_info.rs @@ -1,4 +1,4 @@ pub const RELEASE_YEAR: &str = "2024"; pub const RELEASE_MONTH: &str = "11"; pub const RELEASE_CYCLE: &str = "1"; -pub const RELEASE_CYCLE_COUNTER: &str = "4"; +pub const RELEASE_CYCLE_COUNTER: &str = "5"; diff --git a/sn_networking/Cargo.toml b/sn_networking/Cargo.toml index 400c4fb273..1cdfa38c63 100644 --- a/sn_networking/Cargo.toml +++ b/sn_networking/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "sn_networking" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.19.3" +version = "0.19.4" [features] default = [] diff --git a/sn_networking/src/record_store.rs b/sn_networking/src/record_store.rs index e3eb672d6c..1e54ceb6e6 100644 --- a/sn_networking/src/record_store.rs +++ b/sn_networking/src/record_store.rs @@ -371,13 +371,25 @@ impl NodeRecordStore { }; let records = Self::update_records_from_an_existing_store(&config, &encryption_details); + let local_address = NetworkAddress::from_peer(local_id); + + // Initialize records_by_bucket + let mut records_by_bucket: HashMap> = HashMap::new(); + for (key, (addr, _record_type)) in records.iter() { + let distance = local_address.distance(addr); + let bucket = distance.ilog2().unwrap_or_default(); + records_by_bucket + .entry(bucket) + .or_default() + .insert(key.clone()); + } let cache_size = config.records_cache_size; let mut record_store = NodeRecordStore { - local_address: NetworkAddress::from_peer(local_id), + local_address, config, records, - records_by_bucket: HashMap::new(), + records_by_bucket, records_cache: RecordCache::new(cache_size), network_event_sender, local_swarm_cmd_sender: swarm_cmd_sender, diff --git a/sn_node/Cargo.toml b/sn_node/Cargo.toml index 82806620a6..da770be96d 100644 --- a/sn_node/Cargo.toml +++ b/sn_node/Cargo.toml @@ -55,7 +55,7 @@ serde = { version = "1.0.133", features = ["derive", "rc"] } sn_build_info = { path = "../sn_build_info", version = "0.1.19" } sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.7" } sn_logging = { path = "../sn_logging", version = "0.2.40" } -sn_networking = { path = "../sn_networking", version = "0.19.3" } +sn_networking = { path = "../sn_networking", version = "0.19.4" } sn_protocol = { path = "../sn_protocol", version = "0.17.15" } sn_registers = { path = "../sn_registers", version = "0.4.3" } sn_transfers = { path = "../sn_transfers", version = "0.20.3" }