Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pick the missing work of PR2088 (auditor optimization) #2210

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ 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-10-08

### Network

#### Changed

- Optimize auditor tracking by not to re-attempt fetched spend.
- Optimize auditor tracking function by using DashMap and stream.

## 2024-10-07

### Network
Expand Down
19 changes: 17 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion autonomi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rand = "0.8.5"
rmp-serde = "1.1.1"
self_encryption = "~0.30.0"
serde = { version = "1.0.133", features = ["derive", "rc"] }
sn_client = { path = "../sn_client", version = "0.110.3" }
sn_client = { path = "../sn_client", version = "0.110.4" }
sn_protocol = { version = "0.17.11", path = "../sn_protocol" }
sn_registers = { path = "../sn_registers", version = "0.3.21" }
sn_transfers = { path = "../sn_transfers", version = "0.19.3" }
Expand Down
2 changes: 1 addition & 1 deletion release-cycle-info
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
release-year: 2024
release-month: 10
release-cycle: 2
release-cycle-counter: 2
release-cycle-counter: 3
4 changes: 2 additions & 2 deletions sn_auditor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["MaidSafe Developers <dev@maidsafe.net>"]
description = "Safe Network Auditor"
name = "sn_auditor"
version = "0.3.4"
version = "0.3.5"
edition = "2021"
homepage = "https://maidsafe.net"
repository = "https://github.com/maidsafe/safe_network"
Expand Down Expand Up @@ -31,7 +31,7 @@ graphviz-rust = { version = "0.9.0", optional = true }
lazy_static = "1.4.0"
serde = { version = "1.0.133", features = ["derive", "rc"] }
serde_json = "1.0.108"
sn_client = { path = "../sn_client", version = "0.110.3" }
sn_client = { path = "../sn_client", version = "0.110.4" }
sn_logging = { path = "../sn_logging", version = "0.2.36" }
sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.3" }
tiny_http = { version = "0.12", features = ["ssl-rustls"] }
Expand Down
21 changes: 17 additions & 4 deletions sn_auditor/src/dag_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ impl SpendDagDb {
};

let mut addrs_to_get = BTreeMap::new();
let mut addrs_fetched = BTreeSet::new();

loop {
// get expired utxos for re-attempt fetch
Expand Down Expand Up @@ -350,16 +351,28 @@ impl SpendDagDb {
)
}));
} else if let Some(sender) = spend_processing.clone() {
let (reattempt_addrs, fetched_addrs) = client
.crawl_to_next_utxos(&mut addrs_to_get, sender.clone(), *UTXO_REATTEMPT_SECONDS)
let (reattempt_addrs, fetched_addrs, addrs_for_further_track) = client
.crawl_to_next_utxos(
addrs_to_get.clone(),
sender.clone(),
*UTXO_REATTEMPT_SECONDS,
)
.await;

addrs_to_get.clear();
let mut utxo_addresses = self.utxo_addresses.write().await;
for addr in fetched_addrs.iter() {
let _ = utxo_addresses.remove(addr);
for addr in fetched_addrs {
let _ = utxo_addresses.remove(&addr);
let _ = addrs_fetched.insert(addr);
}
for (addr, tuple) in reattempt_addrs {
let _ = utxo_addresses.insert(addr, tuple);
}
for (addr, amount) in addrs_for_further_track {
if !addrs_fetched.contains(&addr) {
let _ = addrs_to_get.entry(addr).or_insert((0, amount));
}
}
} else {
panic!("There is no point in running the auditor if we are not collecting the DAG or collecting data through crawling. Please enable the `dag-collection` feature or provide beta program related arguments.");
};
Expand Down
4 changes: 2 additions & 2 deletions sn_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ rmp-serde = "1.1.1"
rpassword = "7.3.1"
serde = { version = "1.0.133", features = ["derive"] }
sn_build_info = { path = "../sn_build_info", version = "0.1.15" }
sn_client = { path = "../sn_client", version = "0.110.3" }
sn_client = { path = "../sn_client", version = "0.110.4" }
sn_logging = { path = "../sn_logging", version = "0.2.36" }
sn_peers_acquisition = { path = "../sn_peers_acquisition", version = "0.5.3" }
sn_protocol = { path = "../sn_protocol", version = "0.17.11" }
Expand All @@ -80,7 +80,7 @@ eyre = "0.6.8"
criterion = "0.5.1"
tempfile = "3.6.0"
rand = { version = "~0.8.5", features = ["small_rng"] }
sn_client = { path = "../sn_client", version = "0.110.3", features = [
sn_client = { path = "../sn_client", version = "0.110.4", features = [
"test-utils",
] }

Expand Down
3 changes: 2 additions & 1 deletion sn_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "GPL-3.0"
name = "sn_client"
readme = "README.md"
repository = "https://github.com/maidsafe/safe_network"
version = "0.110.3"
version = "0.110.4"

[features]
default = []
Expand Down Expand Up @@ -38,6 +38,7 @@ bls = { package = "blsttc", version = "8.0.1" }
bytes = { version = "1.0.1", features = ["serde"] }
crdts = "7.3.2"
custom_debug = "~0.6.1"
dashmap = "~6.1.0"
futures = "~0.3.13"
hex = "~0.4.3"
itertools = "~0.12.1"
Expand Down
Loading
Loading