From d125764c22ab3b833cbc16fa2f908706233cb66f Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Mon, 6 Jan 2025 12:34:02 +0100 Subject: [PATCH 1/7] refactor(autonomi): remove uploaded metadata The uploaded timestamp caused the archive to change between uploads and thus requiring the archive to be re-uploaded. --- autonomi/src/client/files/archive.rs | 1 - autonomi/src/client/files/fs_public.rs | 5 ----- 2 files changed, 6 deletions(-) diff --git a/autonomi/src/client/files/archive.rs b/autonomi/src/client/files/archive.rs index 8aebc1df85..b32df65b94 100644 --- a/autonomi/src/client/files/archive.rs +++ b/autonomi/src/client/files/archive.rs @@ -55,7 +55,6 @@ impl Metadata { .as_secs(); Self { - uploaded: now, created: now, modified: now, size, diff --git a/autonomi/src/client/files/fs_public.rs b/autonomi/src/client/files/fs_public.rs index a35cce82f2..081445019f 100644 --- a/autonomi/src/client/files/fs_public.rs +++ b/autonomi/src/client/files/fs_public.rs @@ -194,7 +194,6 @@ pub(crate) fn metadata_from_entry(entry: &walkdir::DirEntry) -> Metadata { entry.path().display() ); return Metadata { - uploaded: 0, created: 0, modified: 0, size: 0, @@ -224,10 +223,6 @@ pub(crate) fn metadata_from_entry(entry: &walkdir::DirEntry) -> Metadata { let modified = unix_time("modified", fs_metadata.modified()); Metadata { - uploaded: SystemTime::now() - .duration_since(SystemTime::UNIX_EPOCH) - .unwrap_or(Duration::from_secs(0)) - .as_secs(), created, modified, size: fs_metadata.len(), From 1e42a449daa125eda6acdf5788f4fc6476ccf5f2 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Mon, 6 Jan 2025 12:34:39 +0100 Subject: [PATCH 2/7] refactor(autonomi): use deterministic serialization Use BTreeMap instead of HashMap so serde serializes deterministically. --- autonomi/src/client/files/archive.rs | 10 ++++------ autonomi/src/client/files/archive_public.rs | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/autonomi/src/client/files/archive.rs b/autonomi/src/client/files/archive.rs index b32df65b94..7afecec092 100644 --- a/autonomi/src/client/files/archive.rs +++ b/autonomi/src/client/files/archive.rs @@ -7,7 +7,7 @@ // permissions and limitations relating to use of the SAFE Network Software. use std::{ - collections::HashMap, + collections::BTreeMap, path::{Path, PathBuf}, }; @@ -36,8 +36,6 @@ pub enum RenameError { /// Metadata for a file in an archive. Time values are UNIX timestamps. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Metadata { - /// When the file was (last) uploaded to the network. - pub uploaded: u64, /// File creation time on local file system. See [`std::fs::Metadata::created`] for details per OS. pub created: u64, /// Last file modification time taken from local file system. See [`std::fs::Metadata::modified`] for details per OS. @@ -67,7 +65,7 @@ impl Metadata { /// The data maps are stored within this structure instead of uploading them to the network, keeping the data private. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct PrivateArchive { - map: HashMap, + map: BTreeMap, } impl PrivateArchive { @@ -75,7 +73,7 @@ impl PrivateArchive { /// Note that this does not upload the archive to the network pub fn new() -> Self { Self { - map: HashMap::new(), + map: BTreeMap::new(), } } @@ -129,7 +127,7 @@ impl PrivateArchive { } /// Get the underlying map - pub fn map(&self) -> &HashMap { + pub fn map(&self) -> &BTreeMap { &self.map } diff --git a/autonomi/src/client/files/archive_public.rs b/autonomi/src/client/files/archive_public.rs index f4b487747f..4a3a07684a 100644 --- a/autonomi/src/client/files/archive_public.rs +++ b/autonomi/src/client/files/archive_public.rs @@ -7,7 +7,7 @@ // permissions and limitations relating to use of the SAFE Network Software. use std::{ - collections::HashMap, + collections::BTreeMap, path::{Path, PathBuf}, }; @@ -34,7 +34,7 @@ pub type ArchiveAddr = XorName; /// to the network, of which the addresses are stored in this archive. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct PublicArchive { - map: HashMap, + map: BTreeMap, } impl PublicArchive { @@ -42,7 +42,7 @@ impl PublicArchive { /// Note that this does not upload the archive to the network pub fn new() -> Self { Self { - map: HashMap::new(), + map: BTreeMap::new(), } } @@ -92,7 +92,7 @@ impl PublicArchive { } /// Get the underlying map - pub fn map(&self) -> &HashMap { + pub fn map(&self) -> &BTreeMap { &self.map } From a653e408cefff052b50f2814aa2a6cc274815a8a Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 7 Jan 2025 11:20:04 +0100 Subject: [PATCH 3/7] ci: check that second upload costs 0 tokens --- .github/workflows/memcheck.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index e6556b9f57..57a92ff3ba 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -99,8 +99,9 @@ jobs: mkdir $ANT_DATA_PATH/client ls -l $ANT_DATA_PATH cp ./the-test-data.zip ./the-test-data_1.zip - ./target/release/ant --log-output-dest data-dir file_TYPE upload "" > ./second_upload 2>&1 - enrelease-candidatev: + ./target/release/ant --log-output-dest=data-dir file upload "./the-test-data_1.zip" > ./second_upload 2>&1 + rg 'Total cost: 0 AttoTokens' ./second_upload -c --stats + env: ANT_LOG: "all" timeout-minutes: 25 From c7e3074d46cd7591f29497a95a74f4ce6e8e2ab4 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 7 Jan 2025 14:10:09 +0100 Subject: [PATCH 4/7] ci: memcheck second upload same way as first --- .github/workflows/memcheck.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index 57a92ff3ba..a9275c8b0f 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -98,15 +98,14 @@ jobs: ls -l $ANT_DATA_PATH/client_first/logs mkdir $ANT_DATA_PATH/client ls -l $ANT_DATA_PATH - cp ./the-test-data.zip ./the-test-data_1.zip - ./target/release/ant --log-output-dest=data-dir file upload "./the-test-data_1.zip" > ./second_upload 2>&1 - rg 'Total cost: 0 AttoTokens' ./second_upload -c --stats + ./target/release/ant --log-output-dest=data-dir file upload --public "./the-test-data.zip" > ./upload_output_second 2>&1 + rg 'Total cost: 0 AttoTokens' ./upload_output_second -c --stats env: ANT_LOG: "all" timeout-minutes: 25 - name: showing the second upload terminal output - run: cat second_upload + run: cat upload_output_second shell: bash if: always() From cf2920d98a612edd779eef713c8db5f93910ed13 Mon Sep 17 00:00:00 2001 From: Chris O'Neil Date: Tue, 14 Jan 2025 15:46:22 +0000 Subject: [PATCH 5/7] docs: provide changelog for `2024.12.1.9` hotfix This also retrospectively applies changelogs for the last two hotfix releases, because somehow these were missed. --- CHANGELOG.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6aed4810fa..01c99e92fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,44 @@ 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.* +## 2025-01-14 + +### Client + +#### Fixed + +- Remove `uploaded` timestamp from archive metadata to prevent unnecessary re-uploads when archive + contents remain unchanged. This ensures we do not charge when uploading the same file more than + once on `ant file upload`. +- Switch from `HashMap` to `BTreeMap` for archive to ensure deterministic serialization, which also + prevents unnecessary re-uploads. As above, this facilitates the fix for the duplicate payment + issue. + +## 2025-01-09 + +### Network + +#### Changed + +- Network discovery no longer queries the farthest full buckets. This significantly reduces the + number of messages as the network grows, resulting in fewer open connections and reduced resource + usage. + +## 2025-01-06 + +### Network + +#### Changed + +- Memory and CPU metrics use more precise `f64` measurements + +### Client + +#### Fixed + +- Apply a timeout for EVM transactions. This fixes an issue where some uploads would freeze indefinitely. +- The `ant` CLI was not selecting its network consistently from the environment variable. + ## 2024-12-21 ### Network From ec6e3e813950846fb3881e51ffd23c806677c25c Mon Sep 17 00:00:00 2001 From: Chris O'Neil Date: Tue, 14 Jan 2025 15:59:07 +0000 Subject: [PATCH 6/7] chore(release): stable release 2024.12.1.9 ================== Crate Versions ================== ant-bootstrap: 0.1.3 ant-build-info: 0.1.23 ant-cli: 0.3.4 ant-evm: 0.1.8 ant-logging: 0.2.44 ant-metrics: 0.1.24 ant-networking: 0.3.3 ant-node: 0.3.4 ant-node-manager: 0.11.7 ant-node-rpc-client: 0.6.41 ant-protocol: 0.3.3 ant-registers: 0.4.7 ant-service-management: 0.4.7 ant-token-supplies: 0.1.62 autonomi: 0.3.4 evmlib: 0.1.8 evm-testnet: 0.1.8 nat-detection: 0.2.15 node-launchpad: 0.5.3 test-utils: 0.4.15 =================== Binary Versions =================== ant: 0.3.4 antctl: 0.11.7 antctld: 0.11.7 antnode: 0.3.4 antnode_rpc_client: 0.6.41 nat-detection: 0.2.15 node-launchpad: 0.5.3 --- Cargo.lock | 8 ++++---- ant-build-info/src/release_info.rs | 2 +- ant-cli/Cargo.toml | 6 +++--- ant-node-rpc-client/Cargo.toml | 4 ++-- ant-node/Cargo.toml | 4 ++-- autonomi/Cargo.toml | 2 +- release-cycle-info | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb3a998472..d9327f6bdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -807,7 +807,7 @@ dependencies = [ [[package]] name = "ant-cli" -version = "0.3.3" +version = "0.3.4" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -948,7 +948,7 @@ dependencies = [ [[package]] name = "ant-node" -version = "0.3.3" +version = "0.3.4" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -1049,7 +1049,7 @@ dependencies = [ [[package]] name = "ant-node-rpc-client" -version = "0.6.40" +version = "0.6.41" dependencies = [ "ant-build-info", "ant-logging", @@ -1591,7 +1591,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "autonomi" -version = "0.3.3" +version = "0.3.4" dependencies = [ "alloy", "ant-bootstrap", diff --git a/ant-build-info/src/release_info.rs b/ant-build-info/src/release_info.rs index c87bb79fe8..33afb04700 100644 --- a/ant-build-info/src/release_info.rs +++ b/ant-build-info/src/release_info.rs @@ -1,4 +1,4 @@ pub const RELEASE_YEAR: &str = "2024"; pub const RELEASE_MONTH: &str = "12"; pub const RELEASE_CYCLE: &str = "1"; -pub const RELEASE_CYCLE_COUNTER: &str = "8"; +pub const RELEASE_CYCLE_COUNTER: &str = "9"; diff --git a/ant-cli/Cargo.toml b/ant-cli/Cargo.toml index 7e1eda41d4..5cf23b59bc 100644 --- a/ant-cli/Cargo.toml +++ b/ant-cli/Cargo.toml @@ -3,7 +3,7 @@ authors = ["MaidSafe Developers "] name = "ant-cli" description = "CLI client for the Autonomi network" license = "GPL-3.0" -version = "0.3.3" +version = "0.3.4" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" @@ -28,7 +28,7 @@ ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3" } ant-build-info = { path = "../ant-build-info", version = "0.1.23" } ant-logging = { path = "../ant-logging", version = "0.2.44" } ant-protocol = { path = "../ant-protocol", version = "0.3.3" } -autonomi = { path = "../autonomi", version = "0.3.3", features = [ +autonomi = { path = "../autonomi", version = "0.3.4", features = [ "fs", "vault", "registers", @@ -60,7 +60,7 @@ tracing = { version = "~0.1.26" } walkdir = "2.5.0" [dev-dependencies] -autonomi = { path = "../autonomi", version = "0.3.3", features = ["fs"]} +autonomi = { path = "../autonomi", version = "0.3.4", features = ["fs"]} criterion = "0.5.1" eyre = "0.6.8" rand = { version = "~0.8.5", features = ["small_rng"] } diff --git a/ant-node-rpc-client/Cargo.toml b/ant-node-rpc-client/Cargo.toml index 650c8b1a74..6bab97421e 100644 --- a/ant-node-rpc-client/Cargo.toml +++ b/ant-node-rpc-client/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-node-rpc-client" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.6.40" +version = "0.6.41" [[bin]] name = "antnode_rpc_client" @@ -20,7 +20,7 @@ nightly = [] ant-build-info = { path = "../ant-build-info", version = "0.1.23" } ant-logging = { path = "../ant-logging", version = "0.2.44" } ant-protocol = { path = "../ant-protocol", version = "0.3.3", features=["rpc"] } -ant-node = { path = "../ant-node", version = "0.3.3" } +ant-node = { path = "../ant-node", version = "0.3.4" } ant-service-management = { path = "../ant-service-management", version = "0.4.7" } async-trait = "0.1" bls = { package = "blsttc", version = "8.0.1" } diff --git a/ant-node/Cargo.toml b/ant-node/Cargo.toml index 86afa2a3a7..f8e289a30b 100644 --- a/ant-node/Cargo.toml +++ b/ant-node/Cargo.toml @@ -2,7 +2,7 @@ authors = ["MaidSafe Developers "] description = "The Autonomi node binary" name = "ant-node" -version = "0.3.3" +version = "0.3.4" edition = "2021" license = "GPL-3.0" homepage = "https://maidsafe.net" @@ -86,7 +86,7 @@ xor_name = "5.0.0" ant-protocol = { path = "../ant-protocol", version = "0.3.3", features = ["rpc"] } assert_fs = "1.0.0" evmlib = { path = "../evmlib", version = "0.1.8" } -autonomi = { path = "../autonomi", version = "0.3.3", features = ["registers"] } +autonomi = { path = "../autonomi", version = "0.3.4", features = ["registers"] } reqwest = { version = "0.12.2", default-features = false, features = [ "rustls-tls-manual-roots", ] } diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index e93a1368a7..86df80e572 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -3,7 +3,7 @@ authors = ["MaidSafe Developers "] description = "Autonomi client API" name = "autonomi" license = "GPL-3.0" -version = "0.3.3" +version = "0.3.4" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" diff --git a/release-cycle-info b/release-cycle-info index 1ec5651cc4..3f88de7ba3 100644 --- a/release-cycle-info +++ b/release-cycle-info @@ -15,4 +15,4 @@ release-year: 2024 release-month: 12 release-cycle: 1 -release-cycle-counter: 8 +release-cycle-counter: 9 From a75b2219aa59dcff0ad14c1332107310a2f2503e Mon Sep 17 00:00:00 2001 From: Chris O'Neil Date: Tue, 14 Jan 2025 16:38:53 +0000 Subject: [PATCH 7/7] fix: restart node with correct args It looked like some kind of mass search and replace has malformed the part of this workflow where a node gets restarted. --- .github/workflows/memcheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index a9275c8b0f..f0efbefda5 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -115,7 +115,7 @@ jobs: - name: Start the restart node again run: | ./target/release/antnode \ - --root-dir-type PARESTART_TEST_NODE_DATA_PATH \ + --root-dir $RESTART_TEST_NODE_DATA_PATH \ --log-output-dest $RESTART_TEST_NODE_DATA_PATH \ --local \ --rewards-address "0x03B770D9cD32077cC0bF330c13C114a87643B124" &