From f1da82e42cf3e4d53df0a0c3cd42346dbac9d3bd Mon Sep 17 00:00:00 2001 From: grumbach Date: Fri, 3 Jan 2025 22:37:42 +0900 Subject: [PATCH 01/38] feat: remove feat flags --- ant-cli/Cargo.toml | 5 +---- ant-node/Cargo.toml | 2 +- autonomi/Cargo.toml | 10 ++-------- autonomi/src/client/files/mod.rs | 6 ------ autonomi/src/client/mod.rs | 4 ---- autonomi/tests/fs.rs | 3 --- autonomi/tests/register.rs | 1 - 7 files changed, 4 insertions(+), 27 deletions(-) diff --git a/ant-cli/Cargo.toml b/ant-cli/Cargo.toml index 7e009e48bd..5dad7ec94e 100644 --- a/ant-cli/Cargo.toml +++ b/ant-cli/Cargo.toml @@ -29,9 +29,6 @@ ant-build-info = { path = "../ant-build-info", version = "0.1.21" } ant-logging = { path = "../ant-logging", version = "0.2.42" } ant-protocol = { path = "../ant-protocol", version = "0.3.1" } autonomi = { path = "../autonomi", version = "0.3.1", features = [ - "fs", - "vault", - "registers", "loud", ] } clap = { version = "4.2.1", features = ["derive"] } @@ -60,7 +57,7 @@ tracing = { version = "~0.1.26" } walkdir = "2.5.0" [dev-dependencies] -autonomi = { path = "../autonomi", version = "0.3.1", features = ["fs"]} +autonomi = { path = "../autonomi", version = "0.3.1"} criterion = "0.5.1" eyre = "0.6.8" rand = { version = "~0.8.5", features = ["small_rng"] } diff --git a/ant-node/Cargo.toml b/ant-node/Cargo.toml index 9d689d0041..5cc0cc4c84 100644 --- a/ant-node/Cargo.toml +++ b/ant-node/Cargo.toml @@ -92,7 +92,7 @@ ant-protocol = { path = "../ant-protocol", version = "0.3.1", features = [ ] } assert_fs = "1.0.0" evmlib = { path = "../evmlib", version = "0.1.6" } -autonomi = { path = "../autonomi", version = "0.3.1", features = ["registers"] } +autonomi = { path = "../autonomi", version = "0.3.1" } reqwest = { version = "0.12.2", default-features = false, features = [ "rustls-tls-manual-roots", ] } diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 57db0e6c6f..f8205ba3a6 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -15,22 +15,16 @@ crate-type = ["cdylib", "rlib"] [[example]] name = "data_and_archive" -required-features = ["full"] [[example]] name = "put_and_dir_upload" -required-features = ["full"] [features] -default = ["vault"] +default = [] external-signer = ["ant-evm/external-signer"] extension-module = ["pyo3/extension-module"] -fs = ["tokio/fs"] -full = ["vault", "fs"] local = ["ant-networking/local", "ant-evm/local"] loud = [] -registers = [] -vault = [] [dependencies] ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.1" } @@ -55,7 +49,7 @@ self_encryption = "~0.30.0" serde = { version = "1.0.133", features = ["derive", "rc"] } sha2 = "0.10.6" thiserror = "1.0.23" -tokio = { version = "1.35.0", features = ["sync"] } +tokio = { version = "1.35.0", features = ["sync", "fs"] } tracing = { version = "~0.1.26" } walkdir = "2.5.0" xor_name = "5.0.0" diff --git a/autonomi/src/client/files/mod.rs b/autonomi/src/client/files/mod.rs index a419ecfa04..e53be148bf 100644 --- a/autonomi/src/client/files/mod.rs +++ b/autonomi/src/client/files/mod.rs @@ -1,16 +1,10 @@ -#[cfg(feature = "fs")] use std::path::{Path, PathBuf}; pub mod archive; pub mod archive_public; -#[cfg(feature = "fs")] -#[cfg_attr(docsrs, doc(cfg(feature = "fs")))] pub mod fs; -#[cfg(feature = "fs")] -#[cfg_attr(docsrs, doc(cfg(feature = "fs")))] pub mod fs_public; -#[cfg(feature = "fs")] pub(crate) fn get_relative_file_path_from_abs_file_and_folder_path( abs_file_pah: &Path, abs_folder_path: &Path, diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index b6ddcfbbb9..9cfc7ed156 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -21,11 +21,7 @@ pub mod pointer; #[cfg(feature = "external-signer")] #[cfg_attr(docsrs, doc(cfg(feature = "external-signer")))] pub mod external_signer; -#[cfg(feature = "registers")] -#[cfg_attr(docsrs, doc(cfg(feature = "registers")))] pub mod registers; -#[cfg(feature = "vault")] -#[cfg_attr(docsrs, doc(cfg(feature = "vault")))] pub mod vault; // private module with utility functions diff --git a/autonomi/tests/fs.rs b/autonomi/tests/fs.rs index 926baeb4fd..040af8d725 100644 --- a/autonomi/tests/fs.rs +++ b/autonomi/tests/fs.rs @@ -6,8 +6,6 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -#![cfg(feature = "fs")] - use ant_logging::LogBuilder; use autonomi::Client; use eyre::Result; @@ -76,7 +74,6 @@ fn compute_dir_sha256(dir: &str) -> Result { Ok(format!("{:x}", hasher.finalize())) } -#[cfg(feature = "vault")] #[tokio::test] async fn file_into_vault() -> Result<()> { let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("file", false); diff --git a/autonomi/tests/register.rs b/autonomi/tests/register.rs index 0709779d5c..1ef2658b9c 100644 --- a/autonomi/tests/register.rs +++ b/autonomi/tests/register.rs @@ -6,7 +6,6 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -#![cfg(feature = "registers")] #![allow(deprecated)] use ant_logging::LogBuilder; From 2fff515a8db76ec86460109c1de8c8dfa8585a39 Mon Sep 17 00:00:00 2001 From: grumbach Date: Fri, 3 Jan 2025 22:39:49 +0900 Subject: [PATCH 02/38] feat: remove feat flags from ci --- .github/workflows/merge.yml | 4 ++-- .github/workflows/nightly.yml | 2 +- autonomi/tests/fs.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index bc5d0d26e7..ef7edc55ac 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -125,11 +125,11 @@ jobs: - name: Run autonomi tests timeout-minutes: 25 - run: cargo test --release --package autonomi --features full,local --lib + run: cargo test --release --package autonomi --features local --lib - name: Run autonomi doc tests timeout-minutes: 25 - run: cargo test --release --package autonomi --features full,local --doc + run: cargo test --release --package autonomi --features local --doc - name: Run bootstrap tests timeout-minutes: 25 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5c9553034d..cc9e6f690d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -246,7 +246,7 @@ jobs: - name: Run autonomi tests timeout-minutes: 25 - run: cargo test --release --package autonomi --lib --features="full,fs" + run: cargo test --release --package autonomi --lib --features="full" - name: Run bootstrap tests timeout-minutes: 25 diff --git a/autonomi/tests/fs.rs b/autonomi/tests/fs.rs index 040af8d725..88198c4cc6 100644 --- a/autonomi/tests/fs.rs +++ b/autonomi/tests/fs.rs @@ -18,7 +18,7 @@ use tokio::time::sleep; use walkdir::WalkDir; // With a local evm network, and local network, run: -// EVM_NETWORK=local cargo test --features="fs,local" --package autonomi --test file +// EVM_NETWORK=local cargo test --features="local" --package autonomi --test fs #[tokio::test] async fn dir_upload_download() -> Result<()> { let _log_appender_guard = From b4a2f123ab114c2f22c36f5d5082ab1bb7a7c2c4 Mon Sep 17 00:00:00 2001 From: grumbach Date: Fri, 3 Jan 2025 22:37:42 +0900 Subject: [PATCH 03/38] feat: remove feat flags --- ant-cli/Cargo.toml | 5 +---- ant-node/Cargo.toml | 2 +- autonomi/Cargo.toml | 10 ++-------- autonomi/src/client/files/mod.rs | 6 ------ autonomi/src/client/mod.rs | 4 ---- autonomi/tests/fs.rs | 3 --- autonomi/tests/register.rs | 1 - 7 files changed, 4 insertions(+), 27 deletions(-) diff --git a/ant-cli/Cargo.toml b/ant-cli/Cargo.toml index 7e009e48bd..5dad7ec94e 100644 --- a/ant-cli/Cargo.toml +++ b/ant-cli/Cargo.toml @@ -29,9 +29,6 @@ ant-build-info = { path = "../ant-build-info", version = "0.1.21" } ant-logging = { path = "../ant-logging", version = "0.2.42" } ant-protocol = { path = "../ant-protocol", version = "0.3.1" } autonomi = { path = "../autonomi", version = "0.3.1", features = [ - "fs", - "vault", - "registers", "loud", ] } clap = { version = "4.2.1", features = ["derive"] } @@ -60,7 +57,7 @@ tracing = { version = "~0.1.26" } walkdir = "2.5.0" [dev-dependencies] -autonomi = { path = "../autonomi", version = "0.3.1", features = ["fs"]} +autonomi = { path = "../autonomi", version = "0.3.1"} criterion = "0.5.1" eyre = "0.6.8" rand = { version = "~0.8.5", features = ["small_rng"] } diff --git a/ant-node/Cargo.toml b/ant-node/Cargo.toml index 9d689d0041..5cc0cc4c84 100644 --- a/ant-node/Cargo.toml +++ b/ant-node/Cargo.toml @@ -92,7 +92,7 @@ ant-protocol = { path = "../ant-protocol", version = "0.3.1", features = [ ] } assert_fs = "1.0.0" evmlib = { path = "../evmlib", version = "0.1.6" } -autonomi = { path = "../autonomi", version = "0.3.1", features = ["registers"] } +autonomi = { path = "../autonomi", version = "0.3.1" } reqwest = { version = "0.12.2", default-features = false, features = [ "rustls-tls-manual-roots", ] } diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 57db0e6c6f..f8205ba3a6 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -15,22 +15,16 @@ crate-type = ["cdylib", "rlib"] [[example]] name = "data_and_archive" -required-features = ["full"] [[example]] name = "put_and_dir_upload" -required-features = ["full"] [features] -default = ["vault"] +default = [] external-signer = ["ant-evm/external-signer"] extension-module = ["pyo3/extension-module"] -fs = ["tokio/fs"] -full = ["vault", "fs"] local = ["ant-networking/local", "ant-evm/local"] loud = [] -registers = [] -vault = [] [dependencies] ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.1" } @@ -55,7 +49,7 @@ self_encryption = "~0.30.0" serde = { version = "1.0.133", features = ["derive", "rc"] } sha2 = "0.10.6" thiserror = "1.0.23" -tokio = { version = "1.35.0", features = ["sync"] } +tokio = { version = "1.35.0", features = ["sync", "fs"] } tracing = { version = "~0.1.26" } walkdir = "2.5.0" xor_name = "5.0.0" diff --git a/autonomi/src/client/files/mod.rs b/autonomi/src/client/files/mod.rs index a419ecfa04..e53be148bf 100644 --- a/autonomi/src/client/files/mod.rs +++ b/autonomi/src/client/files/mod.rs @@ -1,16 +1,10 @@ -#[cfg(feature = "fs")] use std::path::{Path, PathBuf}; pub mod archive; pub mod archive_public; -#[cfg(feature = "fs")] -#[cfg_attr(docsrs, doc(cfg(feature = "fs")))] pub mod fs; -#[cfg(feature = "fs")] -#[cfg_attr(docsrs, doc(cfg(feature = "fs")))] pub mod fs_public; -#[cfg(feature = "fs")] pub(crate) fn get_relative_file_path_from_abs_file_and_folder_path( abs_file_pah: &Path, abs_folder_path: &Path, diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index b6ddcfbbb9..9cfc7ed156 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -21,11 +21,7 @@ pub mod pointer; #[cfg(feature = "external-signer")] #[cfg_attr(docsrs, doc(cfg(feature = "external-signer")))] pub mod external_signer; -#[cfg(feature = "registers")] -#[cfg_attr(docsrs, doc(cfg(feature = "registers")))] pub mod registers; -#[cfg(feature = "vault")] -#[cfg_attr(docsrs, doc(cfg(feature = "vault")))] pub mod vault; // private module with utility functions diff --git a/autonomi/tests/fs.rs b/autonomi/tests/fs.rs index 926baeb4fd..040af8d725 100644 --- a/autonomi/tests/fs.rs +++ b/autonomi/tests/fs.rs @@ -6,8 +6,6 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -#![cfg(feature = "fs")] - use ant_logging::LogBuilder; use autonomi::Client; use eyre::Result; @@ -76,7 +74,6 @@ fn compute_dir_sha256(dir: &str) -> Result { Ok(format!("{:x}", hasher.finalize())) } -#[cfg(feature = "vault")] #[tokio::test] async fn file_into_vault() -> Result<()> { let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("file", false); diff --git a/autonomi/tests/register.rs b/autonomi/tests/register.rs index 0709779d5c..1ef2658b9c 100644 --- a/autonomi/tests/register.rs +++ b/autonomi/tests/register.rs @@ -6,7 +6,6 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -#![cfg(feature = "registers")] #![allow(deprecated)] use ant_logging::LogBuilder; From 4edfe6f1c06d27cc05b262fa593efd4e4eff6d15 Mon Sep 17 00:00:00 2001 From: grumbach Date: Fri, 3 Jan 2025 22:39:49 +0900 Subject: [PATCH 04/38] feat: remove feat flags from ci --- .github/workflows/merge.yml | 4 ++-- .github/workflows/nightly.yml | 2 +- autonomi/tests/fs.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index bc5d0d26e7..ef7edc55ac 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -125,11 +125,11 @@ jobs: - name: Run autonomi tests timeout-minutes: 25 - run: cargo test --release --package autonomi --features full,local --lib + run: cargo test --release --package autonomi --features local --lib - name: Run autonomi doc tests timeout-minutes: 25 - run: cargo test --release --package autonomi --features full,local --doc + run: cargo test --release --package autonomi --features local --doc - name: Run bootstrap tests timeout-minutes: 25 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 5c9553034d..cc9e6f690d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -246,7 +246,7 @@ jobs: - name: Run autonomi tests timeout-minutes: 25 - run: cargo test --release --package autonomi --lib --features="full,fs" + run: cargo test --release --package autonomi --lib --features="full" - name: Run bootstrap tests timeout-minutes: 25 diff --git a/autonomi/tests/fs.rs b/autonomi/tests/fs.rs index 040af8d725..88198c4cc6 100644 --- a/autonomi/tests/fs.rs +++ b/autonomi/tests/fs.rs @@ -18,7 +18,7 @@ use tokio::time::sleep; use walkdir::WalkDir; // With a local evm network, and local network, run: -// EVM_NETWORK=local cargo test --features="fs,local" --package autonomi --test file +// EVM_NETWORK=local cargo test --features="local" --package autonomi --test fs #[tokio::test] async fn dir_upload_download() -> Result<()> { let _log_appender_guard = From 0be759b63cdcf141f294a57e7890b49e105cc411 Mon Sep 17 00:00:00 2001 From: grumbach Date: Sat, 4 Jan 2025 03:15:14 +0900 Subject: [PATCH 05/38] feat: local as runtime opt --- .github/workflows/benchmark-prs.yml | 4 +- .../workflows/generate-benchmark-charts.yml | 4 +- .github/workflows/memcheck.yml | 2 +- .github/workflows/merge.yml | 48 +- .github/workflows/nightly.yml | 18 +- Cargo.lock | 491 +++++++++--------- README.md | 10 +- ant-bootstrap/src/cache_store.rs | 2 +- ant-bootstrap/src/initial_peers.rs | 2 +- ant-cli/Cargo.toml | 1 - ant-cli/src/main.rs | 6 +- ant-cli/src/opt.rs | 6 + ant-evm/Cargo.toml | 1 - ant-networking/Cargo.toml | 2 +- ant-networking/src/driver.rs | 8 +- ant-networking/src/event/mod.rs | 3 - ant-networking/src/event/swarm.rs | 33 +- ant-node-manager/src/cmd/mod.rs | 3 - ant-node/Cargo.toml | 6 - ant-node/src/bin/antnode/main.rs | 6 +- ant-node/src/node.rs | 4 +- autonomi/Cargo.toml | 1 - autonomi/README.md | 4 +- autonomi/src/client/mod.rs | 14 +- autonomi/tests/fs.rs | 2 +- evm-testnet/src/main.rs | 2 +- evmlib/Cargo.toml | 1 - evmlib/src/utils.rs | 6 +- 28 files changed, 331 insertions(+), 359 deletions(-) diff --git a/.github/workflows/benchmark-prs.yml b/.github/workflows/benchmark-prs.yml index eb27cf7ffc..d6cb7e1807 100644 --- a/.github/workflows/benchmark-prs.yml +++ b/.github/workflows/benchmark-prs.yml @@ -43,7 +43,7 @@ jobs: # it will be better to execute bench test with `local`, # to make the measurement results reflect speed improvement or regression more accurately. - name: Build binaries - run: cargo build --release --features local --bin antnode --bin ant + run: cargo build --release --bin antnode --bin ant timeout-minutes: 30 - name: Start a local network @@ -169,7 +169,7 @@ jobs: # # Criterion outputs the actual bench results to stderr "2>&1 tee output.txt" takes stderr, # # passes to tee which displays it in the terminal and writes to output.txt # run: | - # cargo criterion --features=local --message-format=json 2>&1 -p sn_cli | tee -a output.txt + # cargo criterion --message-format=json 2>&1 -p sn_cli | tee -a output.txt # cat output.txt | rg benchmark-complete | jq -s 'map({ # name: (.id | split("/"))[-1], # unit: "MiB/s", diff --git a/.github/workflows/generate-benchmark-charts.yml b/.github/workflows/generate-benchmark-charts.yml index 5ec91d7641..4566a37610 100644 --- a/.github/workflows/generate-benchmark-charts.yml +++ b/.github/workflows/generate-benchmark-charts.yml @@ -46,7 +46,7 @@ jobs: run: wget https://sn-node.s3.eu-west-2.amazonaws.com/the-test-data.zip - name: Build node and cli binaries - run: cargo build --release --features local --bin antnode --bin ant + run: cargo build --release --bin antnode --bin ant timeout-minutes: 30 - name: Start a local network @@ -67,7 +67,7 @@ jobs: # Criterion outputs the actual bench results to stderr "2>&1 tee output.txt" takes stderr, # passes to tee which displays it in the terminal and writes to output.txt run: | - cargo criterion --features=local --message-format=json 2>&1 -p autonomi-cli | tee -a output.txt + cargo criterion --message-format=json 2>&1 -p ant | tee -a output.txt cat output.txt | rg benchmark-complete | jq -s 'map({ name: (.id | split("/"))[-1], unit: "MiB/s", diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index 4853442936..b3f3ed3f50 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -36,7 +36,7 @@ jobs: run: sudo apt-get install -y ripgrep - name: Build binaries - run: cargo build --release --features local --bin antnode --bin ant + run: cargo build --release --bin antnode --bin ant timeout-minutes: 30 - name: Start a local network diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index ef7edc55ac..a6d9eae0a3 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -125,11 +125,11 @@ jobs: - name: Run autonomi tests timeout-minutes: 25 - run: cargo test --release --package autonomi --features local --lib + run: cargo test --release --package autonomi --lib - name: Run autonomi doc tests timeout-minutes: 25 - run: cargo test --release --package autonomi --features local --doc + run: cargo test --release --package autonomi --doc - name: Run bootstrap tests timeout-minutes: 25 @@ -202,7 +202,7 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Build binaries - run: cargo build --release --features local --bin antnode --bin ant + run: cargo build --release --bin antnode --bin ant timeout-minutes: 30 - name: Start a local network @@ -591,11 +591,11 @@ jobs: # - uses: Swatinem/rust-cache@v2 # - name: Build binaries - # run: cargo build --release --features=local --bin antnode + # run: cargo build --release --bin antnode # timeout-minutes: 30 # - name: Build faucet binary - # run: cargo build --release --bin faucet --features="local,gifting" + # run: cargo build --release --bin faucet --features="gifting" # timeout-minutes: 30 # - name: Start a local network @@ -619,14 +619,14 @@ jobs: # fi # - name: execute the sequential transfers tests - # run: cargo test --release -p ant-node --features="local" --test sequential_transfers -- --nocapture --test-threads=1 + # run: cargo test --release -p ant-node --test sequential_transfers -- --nocapture --test-threads=1 # env: # ANT_LOG: "all" # CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }} # timeout-minutes: 25 # - name: execute the storage payment tests - # run: cargo test --release -p ant-node --features="local" --test storage_payments -- --nocapture --test-threads=1 + # run: cargo test --release -p ant-node --test storage_payments -- --nocapture --test-threads=1 # env: # ANT_LOG: "all" # CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }} @@ -657,15 +657,15 @@ jobs: # - uses: Swatinem/rust-cache@v2 # - name: Build binaries - # run: cargo build --release --features=local --bin antnode + # run: cargo build --release --bin antnode # timeout-minutes: 30 # - name: Build faucet binary - # run: cargo build --release --bin faucet --features="local,gifting" + # run: cargo build --release --bin faucet --features="gifting" # timeout-minutes: 30 # - name: Build testing executable - # run: cargo test --release -p ant-node --features=local --test transaction_simulation --no-run + # run: cargo test --release -p ant-node --test transaction_simulation --no-run # env: # # only set the target dir for windows to bypass the linker issue. # # happens if we build the node manager via testnet action @@ -694,7 +694,7 @@ jobs: # fi # - name: execute the transaction simulation - # run: cargo test --release -p ant-node --features="local" --test transaction_simulation -- --nocapture + # run: cargo test --release -p ant-node --test transaction_simulation -- --nocapture # env: # CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }} # timeout-minutes: 25 @@ -723,15 +723,15 @@ jobs: # - uses: Swatinem/rust-cache@v2 # - name: Build binaries - # run: cargo build --release --features=local,distribution --bin antnode + # run: cargo build --release --features=distribution --bin antnode # timeout-minutes: 35 # - name: Build faucet binary - # run: cargo build --release --features=local,distribution,gifting --bin faucet + # run: cargo build --release --features=distribution,gifting --bin faucet # timeout-minutes: 35 # - name: Build testing executable - # run: cargo test --release --features=local,distribution --no-run + # run: cargo test --release --features=distribution --no-run # env: # # only set the target dir for windows to bypass the linker issue. # # happens if we build the node manager via testnet action @@ -759,7 +759,7 @@ jobs: # fi # - name: execute token_distribution tests - # run: cargo test --release --features=local,distribution token_distribution -- --nocapture --test-threads=1 + # run: cargo test --release --features=distribution token_distribution -- --nocapture --test-threads=1 # env: # ANT_LOG: "all" # CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }} @@ -797,11 +797,11 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Build binaries - run: cargo build --release --features local --bin antnode + run: cargo build --release --bin antnode timeout-minutes: 30 - name: Build churn tests - run: cargo test --release -p ant-node --features=local --test data_with_churn --no-run + run: cargo test --release -p ant-node --test data_with_churn --no-run env: # only set the target dir for windows to bypass the linker issue. # happens if we build the node manager via testnet action @@ -832,7 +832,7 @@ jobs: fi - name: Chunks data integrity during nodes churn - run: cargo test --release -p ant-node --features=local --test data_with_churn -- --nocapture + run: cargo test --release -p ant-node --test data_with_churn -- --nocapture env: TEST_DURATION_MINS: 5 TEST_TOTAL_CHURN_CYCLES: 15 @@ -944,11 +944,11 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Build binaries - run: cargo build --release --features local --bin antnode + run: cargo build --release --bin antnode timeout-minutes: 30 - name: Build data location and routing table tests - run: cargo test --release -p ant-node --features=local --test verify_data_location --test verify_routing_table --no-run + run: cargo test --release -p ant-node --test verify_data_location --test verify_routing_table --no-run env: # only set the target dir for windows to bypass the linker issue. # happens if we build the node manager via testnet action @@ -979,13 +979,13 @@ jobs: fi - name: Verify the routing tables of the nodes - run: cargo test --release -p ant-node --features "local" --test verify_routing_table -- --nocapture + run: cargo test --release -p ant-node --test verify_routing_table -- --nocapture env: CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }} timeout-minutes: 5 - name: Verify the location of the data on the network - run: cargo test --release -p ant-node --features "local" --test verify_data_location -- --nocapture + run: cargo test --release -p ant-node --test verify_data_location -- --nocapture env: CHURN_COUNT: 6 ANT_LOG: "all" @@ -993,7 +993,7 @@ jobs: timeout-minutes: 25 - name: Verify the routing tables of the nodes - run: cargo test --release -p ant-node --features "local" --test verify_routing_table -- --nocapture + run: cargo test --release -p ant-node --test verify_routing_table -- --nocapture env: CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }} timeout-minutes: 5 @@ -1267,7 +1267,7 @@ jobs: ls -l - name: Build binaries - run: cargo build --release --features local --bin antnode --bin ant + run: cargo build --release --bin antnode --bin ant timeout-minutes: 30 - name: Start a local network diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index cc9e6f690d..827f873505 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -32,7 +32,7 @@ jobs: continue-on-error: true - name: Build binaries - run: cargo build --release --features local --bin antnode --bin ant + run: cargo build --release --bin antnode --bin ant timeout-minutes: 30 - name: Start a local network @@ -311,11 +311,11 @@ jobs: continue-on-error: true - name: Build binaries - run: cargo build --release --features local --bin antnode + run: cargo build --release --bin antnode timeout-minutes: 30 - name: Build churn tests - run: cargo test --release -p ant-node --features=local --test data_with_churn --no-run + run: cargo test --release -p ant-node --test data_with_churn --no-run env: # only set the target dir for windows to bypass the linker issue. # happens if we build the node manager via testnet action @@ -332,7 +332,7 @@ jobs: build: true - name: Chunks data integrity during nodes churn (during 10min) (in theory) - run: cargo test --release -p ant-node --features=local --test data_with_churn -- --nocapture + run: cargo test --release -p ant-node --test data_with_churn -- --nocapture env: TEST_DURATION_MINS: 60 TEST_CHURN_CYCLES: 6 @@ -464,11 +464,11 @@ jobs: continue-on-error: true - name: Build binaries - run: cargo build --release --features local --bin antnode + run: cargo build --release --bin antnode timeout-minutes: 30 - name: Build data location and routing table tests - run: cargo test --release -p ant-node --features=local --test verify_data_location --test verify_routing_table --no-run + run: cargo test --release -p ant-node --test verify_data_location --test verify_routing_table --no-run env: # only set the target dir for windows to bypass the linker issue. # happens if we build the node manager via testnet action @@ -485,20 +485,20 @@ jobs: build: true - name: Verify the Routing table of the nodes - run: cargo test --release -p ant-node --features=local --test verify_routing_table -- --nocapture + run: cargo test --release -p ant-node --test verify_routing_table -- --nocapture env: CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }} timeout-minutes: 5 - name: Verify the location of the data on the network - run: cargo test --release -p ant-node --features=local --test verify_data_location -- --nocapture + run: cargo test --release -p ant-node --test verify_data_location -- --nocapture env: ANT_LOG: "all" CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }} timeout-minutes: 90 - name: Verify the routing tables of the nodes - run: cargo test --release -p ant-node --features=local --test verify_routing_table -- --nocapture + run: cargo test --release -p ant-node --test verify_routing_table -- --nocapture env: CARGO_TARGET_DIR: ${{ matrix.os == 'windows-latest' && './test-target' || '.' }} timeout-minutes: 5 diff --git a/Cargo.lock b/Cargo.lock index 39fb541eb3..0e8339a23a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 4 +version = 3 [[package]] name = "addr2line" @@ -142,9 +142,9 @@ dependencies = [ [[package]] name = "alloy-chains" -version = "0.1.48" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0161082e0edd9013d23083465cc04b20e44b7a15646d36ba7b0cdb7cd6fe18f" +checksum = "d4e0f0136c085132939da6b753452ebed4efaa73fe523bb855b10c199c2ebfaf" dependencies = [ "alloy-primitives", "num_enum", @@ -199,14 +199,14 @@ dependencies = [ "alloy-transport", "futures", "futures-util", - "thiserror 2.0.6", + "thiserror 2.0.9", ] [[package]] name = "alloy-core" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c618bd382f0bc2ac26a7e4bfae01c9b015ca8f21b37ca40059ae35a7e62b3dc6" +checksum = "5e3fdddfc89197319b1be19875a70ced62a72bebb67e2276dad688cd59f40e70" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -217,9 +217,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41056bde53ae10ffbbf11618efbe1e0290859e5eab0fe9ef82ebdb62f12a866f" +checksum = "b0d2ea4d7f220a19c1f8c98822026d1d26a4b75a72e1a7308d02bab1f77c9a00" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -287,9 +287,9 @@ dependencies = [ [[package]] name = "alloy-json-abi" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c357da577dfb56998d01f574d81ad7a1958d248740a7981b205d69d65a7da404" +checksum = "e79c6b4bcc1067a7394b5b2aec7da1bd829c8c476b796c73eb14da34392a07a7" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -307,7 +307,7 @@ dependencies = [ "alloy-sol-types", "serde", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.9", "tracing", ] @@ -333,7 +333,7 @@ dependencies = [ "futures-utils-wasm", "serde", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.9", ] [[package]] @@ -361,16 +361,16 @@ dependencies = [ "rand 0.8.5", "serde_json", "tempfile", - "thiserror 2.0.6", + "thiserror 2.0.9", "tracing", "url", ] [[package]] name = "alloy-primitives" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6259a506ab13e1d658796c31e6e39d2e2ee89243bcc505ddc613b35732e0a430" +checksum = "0540fd0355d400b59633c27bd4b42173e59943f28e9d3376b77a24771d432d04" dependencies = [ "alloy-rlp", "bytes", @@ -424,11 +424,11 @@ dependencies = [ "lru", "parking_lot", "pin-project", - "reqwest 0.12.9", + "reqwest 0.12.12", "schnellru", "serde", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.9", "tokio", "tracing", "url", @@ -454,7 +454,7 @@ checksum = "5a833d97bf8a5f0f878daf2c8451fff7de7f9de38baa5a45d936ec718d81255a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -469,7 +469,7 @@ dependencies = [ "alloy-transport-http", "futures", "pin-project", - "reqwest 0.12.9", + "reqwest 0.12.12", "serde", "serde_json", "tokio", @@ -557,7 +557,7 @@ dependencies = [ "auto_impl", "elliptic-curve", "k256", - "thiserror 2.0.6", + "thiserror 2.0.9", ] [[package]] @@ -573,28 +573,28 @@ dependencies = [ "async-trait", "k256", "rand 0.8.5", - "thiserror 2.0.6", + "thiserror 2.0.9", ] [[package]] name = "alloy-sol-macro" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9d64f851d95619233f74b310f12bcf16e0cbc27ee3762b6115c14a84809280a" +checksum = "c6d1a14b4a9f6078ad9132775a2ebb465b06b387d60f7413ddc86d7bf7453408" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf7ed1574b699f48bf17caab4e6e54c6d12bc3c006ab33d58b1e227c1c3559f" +checksum = "4436b4b96d265eb17daea26eb31525c3076d024d10901e446790afbd2f7eeaf5" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -604,16 +604,16 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c02997ccef5f34f9c099277d4145f183b422938ed5322dc57a089fe9b9ad9ee" +checksum = "e5f58698a18b96faa8513519de112b79a96010b4ff84264ce54a217c52a8e98b" dependencies = [ "alloy-json-abi", "const-hex", @@ -622,15 +622,15 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.90", + "syn 2.0.94", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce13ff37285b0870d0a0746992a4ae48efaf34b766ae4c2640fa15e5305f8e73" +checksum = "1f3d6d2c490f650c5abd65a9a583b09a8c8931c265d3a55b18a8e349dd6d9d84" dependencies = [ "serde", "winnow", @@ -638,9 +638,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1174cafd6c6d810711b4e00383037bdb458efc4fe3dbafafa16567e0320c54d8" +checksum = "c766e4979fc19d70057150befe8e3ea3f0c4cbc6839b8eaaa250803451692305" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -661,7 +661,7 @@ dependencies = [ "futures-utils-wasm", "serde", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.9", "tokio", "tower 0.5.2", "tracing", @@ -677,7 +677,7 @@ checksum = "2e02ffd5d93ffc51d72786e607c97de3b60736ca3e636ead0ec1f7dce68ea3fd" dependencies = [ "alloy-json-rpc", "alloy-transport", - "reqwest 0.12.9", + "reqwest 0.12.12", "serde_json", "tower 0.5.2", "tracing", @@ -686,9 +686,9 @@ dependencies = [ [[package]] name = "alloy-trie" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a5fd8fea044cc9a8c8a50bb6f28e31f0385d820f116c5b98f6f4e55d6e5590b" +checksum = "6917c79e837aa7b77b7a6dae9f89cbe15313ac161c4d3cfaf8909ef21f3d22d8" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -782,7 +782,7 @@ dependencies = [ "dirs-next", "futures", "libp2p", - "reqwest 0.12.9", + "reqwest 0.12.12", "serde", "serde_json", "tempfile", @@ -914,7 +914,7 @@ dependencies = [ "futures", "hex", "hkdf", - "hyper 0.14.31", + "hyper 0.14.32", "itertools 0.12.1", "libp2p", "libp2p-identity", @@ -973,7 +973,7 @@ dependencies = [ "pyo3", "rand 0.8.5", "rayon", - "reqwest 0.12.9", + "reqwest 0.12.12", "rmp-serde", "self_encryption", "serde", @@ -1019,11 +1019,11 @@ dependencies = [ "libp2p-identity", "mockall 0.12.1", "nix 0.27.1", - "predicates 3.1.2", + "predicates 3.1.3", "prost 0.9.0", "rand 0.8.5", - "reqwest 0.12.9", - "semver 1.0.23", + "reqwest 0.12.12", + "semver 1.0.24", "serde", "serde_json", "service-manager", @@ -1120,8 +1120,8 @@ dependencies = [ "flate2", "lazy_static", "regex", - "reqwest 0.12.9", - "semver 1.0.23", + "reqwest 0.12.12", + "semver 1.0.24", "serde_json", "tar", "thiserror 1.0.69", @@ -1143,7 +1143,7 @@ dependencies = [ "libp2p-identity", "mockall 0.11.4", "prost 0.9.0", - "semver 1.0.23", + "semver 1.0.24", "serde", "serde_json", "service-manager", @@ -1170,9 +1170,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "arboard" @@ -1367,7 +1367,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "synstructure", ] @@ -1379,7 +1379,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -1402,7 +1402,7 @@ dependencies = [ "bstr", "doc-comment", "libc", - "predicates 3.1.2", + "predicates 3.1.3", "predicates-core", "predicates-tree", "wait-timeout", @@ -1417,7 +1417,7 @@ dependencies = [ "anstyle", "doc-comment", "globwalk", - "predicates 3.1.2", + "predicates 3.1.3", "predicates-core", "predicates-tree", "tempfile", @@ -1489,18 +1489,18 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "1b1244b10dcd56c92219da4e14caa97e312079e185f04ba3eea25061561dc0a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -1556,7 +1556,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -1615,7 +1615,7 @@ dependencies = [ "futures-util", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "itoa", "matchit", "memchr", @@ -1730,18 +1730,18 @@ dependencies = [ [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitcoin-internals" @@ -1919,9 +1919,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.11.1" +version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786a307d683a5bf92e6fd5fd69a7eb613751668d1d8d67d802846dfe367c62c8" +checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0" dependencies = [ "memchr", "regex-automata 0.4.9", @@ -1942,9 +1942,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "bytemuck" -version = "1.20.0" +version = "1.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b37c88a63ffd85d15b406896cc343916d7cf57838a847b3a6f2ca5d39a5695a" +checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3" [[package]] name = "byteorder" @@ -2029,7 +2029,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver 1.0.23", + "semver 1.0.24", "serde", "serde_json", "thiserror 1.0.69", @@ -2076,9 +2076,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.3" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f657647bcff5394bf56c7317665bbf790a137a50eaaa5c6bfbb9e27a518f2d" +checksum = "a012a0df96dd6d06ba9a1b29d6402d1a5d77c6befd2566afdc26e10603dc93d7" dependencies = [ "jobserver", "libc", @@ -2218,7 +2218,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -2277,19 +2277,19 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] name = "compact_str" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6050c3a16ddab2e412160b31f2c871015704239bca62f72f6e5f0be631d3f644" +checksum = "3b79c4069c6cad78e2e0cdfcbd26275770669fb39fd308a752dc110e83b9af32" dependencies = [ "castaway", "cfg-if", @@ -2330,15 +2330,15 @@ dependencies = [ [[package]] name = "console" -version = "0.15.8" +version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" dependencies = [ - "encode_unicode 0.3.6", - "lazy_static", + "encode_unicode", "libc", - "unicode-width 0.1.14", - "windows-sys 0.52.0", + "once_cell", + "unicode-width 0.2.0", + "windows-sys 0.59.0", ] [[package]] @@ -2510,18 +2510,18 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.13" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", @@ -2538,9 +2538,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crossterm" @@ -2668,7 +2668,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -2689,7 +2689,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "synstructure", ] @@ -2714,7 +2714,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -2725,7 +2725,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -2860,7 +2860,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "unicode-xid", ] @@ -2967,7 +2967,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3067,12 +3067,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - [[package]] name = "encode_unicode" version = "1.0.0" @@ -3097,7 +3091,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3330,7 +3324,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "miniz_oxide 0.8.2", ] [[package]] @@ -3342,6 +3336,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "float-cmp" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8" +dependencies = [ + "num-traits", +] + [[package]] name = "fnv" version = "1.0.7" @@ -3350,9 +3353,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" [[package]] name = "foreign-types" @@ -3372,7 +3375,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3500,7 +3503,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3690,7 +3693,7 @@ version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d48b897b4bbc881aea994b4a5bbb340a04979d7be9089791304e04a9fbc66b53" dependencies = [ - "thiserror 2.0.6", + "thiserror 2.0.9", ] [[package]] @@ -3699,7 +3702,7 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6ffbeb3a5c0b8b84c3fe4133a6f8c82fa962f4caefe8d0762eced025d3eb4f7" dependencies = [ - "thiserror 2.0.6", + "thiserror 2.0.9", ] [[package]] @@ -3747,7 +3750,7 @@ dependencies = [ "bstr", "gix-path", "libc", - "thiserror 2.0.6", + "thiserror 2.0.9", ] [[package]] @@ -3900,7 +3903,7 @@ checksum = "999ce923619f88194171a67fb3e6d613653b8d4d6078b529b15a765da0edcc17" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -3970,7 +3973,7 @@ dependencies = [ "gix-trace", "home", "once_cell", - "thiserror 2.0.6", + "thiserror 2.0.9", ] [[package]] @@ -3981,7 +3984,7 @@ checksum = "64a1e282216ec2ab2816cd57e6ed88f8009e634aec47562883c05ac8a7009a63" dependencies = [ "bstr", "gix-utils", - "thiserror 2.0.6", + "thiserror 2.0.9", ] [[package]] @@ -4137,9 +4140,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "globset" @@ -4422,11 +4425,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4547,9 +4550,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.31" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ "bytes", "futures-channel", @@ -4571,9 +4574,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", @@ -4596,7 +4599,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.32", "rustls 0.21.12", "tokio", "tokio-rustls 0.24.1", @@ -4604,13 +4607,13 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.3" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", "http 1.2.0", - "hyper 1.5.1", + "hyper 1.5.2", "hyper-util", "rustls 0.23.20", "rustls-pki-types", @@ -4626,7 +4629,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.31", + "hyper 0.14.32", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -4643,7 +4646,7 @@ dependencies = [ "futures-util", "http 1.2.0", "http-body 1.0.1", - "hyper 1.5.1", + "hyper 1.5.2", "pin-project-lite", "socket2", "tokio", @@ -4789,7 +4792,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -4863,7 +4866,7 @@ dependencies = [ "bytes", "futures", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.32", "log", "rand 0.8.5", "tokio", @@ -4917,7 +4920,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -4986,16 +4989,16 @@ dependencies = [ [[package]] name = "instability" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b829f37dead9dc39df40c2d3376c179fdfd2ac771f53f55d3c30dc096a3c0c6e" +checksum = "898e106451f7335950c9cc64f8ec67b5f65698679ac67ed00619aeef14e1cf75" dependencies = [ "darling", "indoc", "pretty_assertions", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -5145,21 +5148,15 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.168" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" - -[[package]] -name = "libm" -version = "0.2.11" +version = "0.2.169" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" +checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "libp2p" @@ -5567,7 +5564,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -5799,9 +5796,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" dependencies = [ "adler2", "simd-adler32", @@ -5857,7 +5854,7 @@ dependencies = [ "fragile", "lazy_static", "mockall_derive 0.12.1", - "predicates 3.1.2", + "predicates 3.1.3", "predicates-tree", ] @@ -5882,7 +5879,7 @@ dependencies = [ "cfg-if", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -6115,7 +6112,7 @@ dependencies = [ "prometheus-parse", "ratatui", "regex", - "reqwest 0.12.9", + "reqwest 0.12.12", "serde", "serde_json", "signal-hook", @@ -6207,7 +6204,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", - "libm", ] [[package]] @@ -6237,7 +6233,7 @@ checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -6257,9 +6253,9 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "nybbles" -version = "0.2.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95f06be0417d97f81fe4e5c86d7d01b392655a9cac9c19a848aa033e18937b23" +checksum = "a3409fc85ac27b27d971ea7cd1aabafd2eefa6de7e481c8d4f707225c117e81a" dependencies = [ "alloy-rlp", "const-hex", @@ -6519,9 +6515,9 @@ dependencies = [ [[package]] name = "os_info" -version = "3.9.0" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ca711d8b83edbb00b44d504503cd247c9c0bd8b0fa2694f2a1a3d8165379ce" +checksum = "eb6651f4be5e39563c4fe5cc8326349eb99a25d805a3493f791d5bfd0269e430" dependencies = [ "log", "serde", @@ -6671,7 +6667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 2.0.6", + "thiserror 2.0.9", "ucd-trie", ] @@ -6695,7 +6691,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -6736,7 +6732,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -6810,15 +6806,15 @@ dependencies = [ [[package]] name = "png" -version = "0.17.15" +version = "0.17.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67582bd5b65bdff614270e2ea89a1cf15bef71245cc1e5f7ea126977144211d" +checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526" dependencies = [ "bitflags 1.3.2", "crc32fast", "fdeflate", "flate2", - "miniz_oxide 0.8.0", + "miniz_oxide 0.8.2", ] [[package]] @@ -6887,7 +6883,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", - "float-cmp", + "float-cmp 0.9.0", "itertools 0.10.5", "normalize-line-endings", "predicates-core", @@ -6896,13 +6892,13 @@ dependencies = [ [[package]] name = "predicates" -version = "3.1.2" +version = "3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9086cc7640c29a356d1a29fd134380bee9d8f79a17410aa76e7ad295f42c97" +checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573" dependencies = [ "anstyle", "difflib", - "float-cmp", + "float-cmp 0.10.0", "normalize-line-endings", "predicates-core", "regex", @@ -6910,15 +6906,15 @@ dependencies = [ [[package]] name = "predicates-core" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8177bee8e75d6846599c6b9ff679ed51e882816914eec639944d7c9aa11931" +checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" [[package]] name = "predicates-tree" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b740d195ed3166cd147c8047ec98db0e22ec019eb8eeb76d343b795304fb13" +checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" dependencies = [ "predicates-core", "termtree", @@ -6941,7 +6937,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46480520d1b77c9a3482d39939fcf96831537a250ec62d4fd8fbdf8e0302e781" dependencies = [ "csv", - "encode_unicode 1.0.0", + "encode_unicode", "is-terminal", "lazy_static", "term", @@ -6987,7 +6983,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -7025,7 +7021,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -7042,9 +7038,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bit-set", "bit-vec", @@ -7183,7 +7179,7 @@ dependencies = [ "proc-macro2", "pyo3-macros-backend", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -7196,7 +7192,7 @@ dependencies = [ "proc-macro2", "pyo3-build-config", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -7261,7 +7257,7 @@ dependencies = [ "rustc-hash", "rustls 0.23.20", "socket2", - "thiserror 2.0.6", + "thiserror 2.0.9", "tokio", "tracing", ] @@ -7280,7 +7276,7 @@ dependencies = [ "rustls 0.23.20", "rustls-pki-types", "slab", - "thiserror 2.0.6", + "thiserror 2.0.9", "tinyvec", "tracing", "web-time", @@ -7288,9 +7284,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527" +checksum = "1c40286217b4ba3a71d644d752e6a0b71f13f1b6a2c5311acfcbe0c2418ed904" dependencies = [ "cfg_aliases", "libc", @@ -7302,9 +7298,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -7528,7 +7524,7 @@ dependencies = [ "h2", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-rustls 0.24.2", "ipnet", "js-sys", @@ -7557,9 +7553,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.9" +version = "0.12.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" dependencies = [ "base64 0.22.1", "bytes", @@ -7568,8 +7564,8 @@ dependencies = [ "http 1.2.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", - "hyper-rustls 0.27.3", + "hyper 1.5.2", + "hyper-rustls 0.27.5", "hyper-util", "ipnet", "js-sys", @@ -7588,6 +7584,7 @@ dependencies = [ "sync_wrapper 1.0.2", "tokio", "tokio-rustls 0.26.1", + "tower 0.5.2", "tower-service", "url", "wasm-bindgen", @@ -7809,7 +7806,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver 1.0.23", + "semver 1.0.24", ] [[package]] @@ -7893,9 +7890,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" dependencies = [ "web-time", ] @@ -7923,9 +7920,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "rusty-fork" @@ -7967,9 +7964,9 @@ dependencies = [ [[package]] name = "schnellru" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a8ef13a93c54d20580de1e5c413e624e53121d42fc7e2c11d10ef7f8b02367" +checksum = "356285bbf17bea63d9e52e96bd18f039672ac92b55b8cb997d6162a2a37d1649" dependencies = [ "ahash", "cfg-if", @@ -8059,9 +8056,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" dependencies = [ "serde", ] @@ -8077,29 +8074,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.210" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] name = "serde_json" -version = "1.0.133" +version = "1.0.134" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" +checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d" dependencies = [ "itoa", "memchr", @@ -8150,9 +8147,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" dependencies = [ "base64 0.22.1", "chrono", @@ -8168,14 +8165,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.11.0" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -8442,7 +8439,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -8464,9 +8461,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.90" +version = "2.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +checksum = "987bc0be1cdea8b10216bd06e2ca407d40b9543468fafd3ddfb02f36e77f71f3" dependencies = [ "proc-macro2", "quote", @@ -8475,14 +8472,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219389c1ebe89f8333df8bdfb871f6631c552ff399c23cac02480b6088aad8f0" +checksum = "c74af950d86ec0f5b2ae2d7f1590bbfbcf4603a0a15742d8f98132ac4fe3efd4" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -8508,7 +8505,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -8593,12 +8590,13 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand 2.3.0", + "getrandom 0.2.15", "once_cell", "rustix", "windows-sys 0.59.0", @@ -8627,9 +8625,9 @@ dependencies = [ [[package]] name = "termtree" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" +checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" [[package]] name = "test-utils" @@ -8656,11 +8654,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.6" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +checksum = "f072643fd0190df67a8bab670c20ef5d8737177d6ac6b2e9a236cb096206b2cc" dependencies = [ - "thiserror-impl 2.0.6", + "thiserror-impl 2.0.9", ] [[package]] @@ -8671,18 +8669,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] name = "thiserror-impl" -version = "2.0.6" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +checksum = "7b50fa271071aae2e6ee85f842e2e28ba8cd2c5fb67f11fcb1fd70b276f9e7d4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -8789,9 +8787,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "022db8904dfa342efe721985167e9fcd16c29b226db4397ed752a761cfce81e8" dependencies = [ "tinyvec_macros", ] @@ -8838,7 +8836,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -8972,7 +8970,7 @@ dependencies = [ "h2", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-timeout", "percent-encoding", "pin-project", @@ -9004,7 +9002,7 @@ dependencies = [ "h2", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-timeout", "percent-encoding", "pin-project", @@ -9059,6 +9057,7 @@ dependencies = [ "futures-util", "pin-project-lite", "sync_wrapper 1.0.2", + "tokio", "tower-layer", "tower-service", ] @@ -9107,7 +9106,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -9227,7 +9226,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04659ddb06c87d233c566112c1c9c5b9e98256d9af50ec3bc9c8327f873a7568" dependencies = [ "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -9297,9 +9296,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicase" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-bom" @@ -9562,7 +9561,7 @@ dependencies = [ "futures-util", "headers", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.32", "log", "mime", "mime_guess", @@ -9613,7 +9612,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "wasm-bindgen-shared", ] @@ -9648,7 +9647,7 @@ checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -10013,9 +10012,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.20" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +checksum = "39281189af81c07ec09db316b302a3e67bf9bd7cbf6c820b50e35fee9c2fa980" dependencies = [ "memchr", ] @@ -10049,7 +10048,7 @@ dependencies = [ "futures", "futures-timer", "http-types", - "hyper 0.14.31", + "hyper 0.14.32", "log", "once_cell", "regex", @@ -10242,7 +10241,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "synstructure", ] @@ -10264,7 +10263,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -10284,7 +10283,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", "synstructure", ] @@ -10305,7 +10304,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] @@ -10327,7 +10326,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.94", ] [[package]] diff --git a/README.md b/README.md index f2dee6452b..e110c4811d 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ To upload a file or a directory, you need to set the `SECRET_KEY` environment va > When running a local network, you can use the `SECRET_KEY` printed by the `evm-testnet` command [step 2](#2-run-a-local-evm-node) as it has all the money. ```bash -SECRET_KEY= cargo run --bin ant --features local -- file upload +SECRET_KEY= cargo run --bin ant -- --local file upload ``` The output will print out the address at which the content was uploaded. @@ -139,7 +139,7 @@ The output will print out the address at which the content was uploaded. Now to download the files again: ```bash -cargo run --bin ant --features local -- file download +cargo run --bin ant -- --local file download ``` ### Registers @@ -150,7 +150,7 @@ their use by two users to exchange text messages in a crude chat application. In the first terminal, using the registers example, Alice creates a register: ``` -cargo run --example registers --features=local -- --user alice --reg-nickname myregister +cargo run --example registers -- --local --user alice --reg-nickname myregister ``` Alice can now write a message to the register and see anything written by anyone else. For example @@ -193,7 +193,7 @@ message Alice has written, and he can write back by running this command with th from Alice. (Note that the command should all be on one line): ``` -cargo run --example registers --features=local -- --user bob --reg-address 50f4c9d55aa1f4fc19149a86e023cd189e509519788b4ad8625a1ce62932d1938cf4242e029cada768e7af0123a98c25973804d84ad397ca65cb89d6580d04ff07e5b196ea86f882b925be6ade06fc8d +cargo run --example registers -- --local --user bob --reg-address 50f4c9d55aa1f4fc19149a86e023cd189e509519788b4ad8625a1ce62932d1938cf4242e029cada768e7af0123a98c25973804d84ad397ca65cb89d6580d04ff07e5b196ea86f882b925be6ade06fc8d ``` After retrieving the register and displaying the message from Alice, Bob can reply and at any time, @@ -220,7 +220,7 @@ A second example, `register_inspect` allows you to view its structure and conten the above example you again provide the address of the register. For example: ``` -cargo run --example register_inspect --features=local -- --reg-address 50f4c9d55aa1f4fc19149a86e023cd189e509519788b4ad8625a1ce62932d1938cf4242e029cada768e7af0123a98c25973804d84ad397ca65cb89d6580d04ff07e5b196ea86f882b925be6ade06fc8d +cargo run --example register_inspect -- --local --reg-address 50f4c9d55aa1f4fc19149a86e023cd189e509519788b4ad8625a1ce62932d1938cf4242e029cada768e7af0123a98c25973804d84ad397ca65cb89d6580d04ff07e5b196ea86f882b925be6ade06fc8d ``` After printing a summary of the register, this example will display diff --git a/ant-bootstrap/src/cache_store.rs b/ant-bootstrap/src/cache_store.rs index 4f9a0fd495..d9d9bd131a 100644 --- a/ant-bootstrap/src/cache_store.rs +++ b/ant-bootstrap/src/cache_store.rs @@ -199,7 +199,7 @@ impl BootstrapCacheStore { } // If local mode is enabled, return empty store (will use mDNS) - if peers_arg.local || cfg!(feature = "local") { + if peers_arg.local { info!("Setting config to not write to cache, as 'local' mode is enabled"); store.config.disable_cache_writing = true; } diff --git a/ant-bootstrap/src/initial_peers.rs b/ant-bootstrap/src/initial_peers.rs index 27e59d899c..1a5b33ffe1 100644 --- a/ant-bootstrap/src/initial_peers.rs +++ b/ant-bootstrap/src/initial_peers.rs @@ -117,7 +117,7 @@ impl PeersArgs { } // If local mode is enabled, return empty store (will use mDNS) - if self.local || cfg!(feature = "local") { + if self.local { info!("Local mode enabled, using only local discovery."); return Ok(vec![]); } diff --git a/ant-cli/Cargo.toml b/ant-cli/Cargo.toml index 5dad7ec94e..8a25891372 100644 --- a/ant-cli/Cargo.toml +++ b/ant-cli/Cargo.toml @@ -15,7 +15,6 @@ path = "src/main.rs" [features] default = ["metrics"] -local = ["ant-bootstrap/local", "autonomi/local", "ant-logging/process-metrics"] metrics = ["ant-logging/process-metrics"] nightly = [] diff --git a/ant-cli/src/main.rs b/ant-cli/src/main.rs index 971c38fd6a..bc9a627500 100644 --- a/ant-cli/src/main.rs +++ b/ant-cli/src/main.rs @@ -24,7 +24,6 @@ pub use access::user_data; use clap::Parser; use color_eyre::Result; -#[cfg(feature = "local")] use ant_logging::metrics::init_metrics; use ant_logging::{LogBuilder, LogFormat, ReloadHandle, WorkerGuard}; use ant_protocol::version; @@ -73,8 +72,9 @@ async fn main() -> Result<()> { } let _log_guards = init_logging_and_metrics(&opt)?; - #[cfg(feature = "local")] - tokio::spawn(init_metrics(std::process::id())); + if opt.local { + tokio::spawn(init_metrics(std::process::id())); + } info!("\"{}\"", std::env::args().collect::>().join(" ")); let version = ant_build_info::git_info(); diff --git a/ant-cli/src/opt.rs b/ant-cli/src/opt.rs index 9d7e4edd9b..ef74118cd1 100644 --- a/ant-cli/src/opt.rs +++ b/ant-cli/src/opt.rs @@ -19,6 +19,12 @@ use std::time::Duration; #[command(disable_version_flag = true)] #[command(author, version, about, long_about = None)] pub(crate) struct Opt { + /// Specify whether the cli is operating with a local network. + /// + /// This is used to run the cli against a local test network. + #[clap(long, default_value_t = false)] + pub local: bool, + /// Available sub commands. #[clap(subcommand)] pub command: Option, diff --git a/ant-evm/Cargo.toml b/ant-evm/Cargo.toml index 6c88635a3c..72bdec0ecb 100644 --- a/ant-evm/Cargo.toml +++ b/ant-evm/Cargo.toml @@ -10,7 +10,6 @@ repository = "https://github.com/maidsafe/autonomi" version = "0.1.6" [features] -local = ["evmlib/local"] external-signer = ["evmlib/external-signer"] test-utils = [] diff --git a/ant-networking/Cargo.toml b/ant-networking/Cargo.toml index 6ed279891f..fdf537808c 100644 --- a/ant-networking/Cargo.toml +++ b/ant-networking/Cargo.toml @@ -11,7 +11,6 @@ version = "0.3.1" [features] default = [] -local = ["libp2p/mdns"] loud = [] open-metrics = ["libp2p/metrics", "prometheus-client", "hyper", "sysinfo"] upnp = ["libp2p/upnp"] @@ -39,6 +38,7 @@ itertools = "~0.12.1" libp2p = { version = "0.54.1", features = [ "tokio", "dns", + "mdns", "kad", "macros", "request-response", diff --git a/ant-networking/src/driver.rs b/ant-networking/src/driver.rs index 0ee325f6d5..d456bda114 100644 --- a/ant-networking/src/driver.rs +++ b/ant-networking/src/driver.rs @@ -44,7 +44,6 @@ use ant_protocol::{ use ant_registers::SignedRegister; use futures::future::Either; use futures::StreamExt; -#[cfg(feature = "local")] use libp2p::mdns; use libp2p::{core::muxing::StreamMuxerBox, relay}; use libp2p::{ @@ -254,7 +253,7 @@ pub(super) struct NodeBehaviour { pub(super) blocklist: libp2p::allow_block_list::Behaviour, pub(super) identify: libp2p::identify::Behaviour, - #[cfg(feature = "local")] + /// mDNS behaviour to use in local mode pub(super) mdns: mdns::tokio::Behaviour, #[cfg(feature = "upnp")] pub(super) upnp: libp2p::swarm::behaviour::toggle::Toggle, @@ -620,7 +619,6 @@ impl NetworkBuilder { } }; - #[cfg(feature = "local")] let mdns_config = mdns::Config { // lower query interval to speed up peer discovery // this increases traffic, but means we no longer have clients unable to connect @@ -629,7 +627,6 @@ impl NetworkBuilder { ..Default::default() }; - #[cfg(feature = "local")] let mdns = mdns::tokio::Behaviour::new(mdns_config, peer_id)?; let agent_version = if is_client { @@ -679,13 +676,12 @@ impl NetworkBuilder { blocklist: libp2p::allow_block_list::Behaviour::default(), relay_client: relay_behaviour, relay_server, + mdns, #[cfg(feature = "upnp")] upnp, request_response, kademlia, identify, - #[cfg(feature = "local")] - mdns, }; let swarm_config = libp2p::swarm::Config::with_tokio_executor() diff --git a/ant-networking/src/event/mod.rs b/ant-networking/src/event/mod.rs index ae6e2aefca..8489d47516 100644 --- a/ant-networking/src/event/mod.rs +++ b/ant-networking/src/event/mod.rs @@ -13,7 +13,6 @@ mod swarm; use crate::{driver::SwarmDriver, error::Result}; use core::fmt; use custom_debug::Debug as CustomDebug; -#[cfg(feature = "local")] use libp2p::mdns; use libp2p::{ kad::{Addresses, Record, RecordKey, K_VALUE}, @@ -46,7 +45,6 @@ pub(super) enum NodeEvent { Upnp(libp2p::upnp::Event), MsgReceived(libp2p::request_response::Event), Kademlia(libp2p::kad::Event), - #[cfg(feature = "local")] Mdns(Box), Identify(Box), RelayClient(Box), @@ -73,7 +71,6 @@ impl From for NodeEvent { } } -#[cfg(feature = "local")] impl From for NodeEvent { fn from(event: mdns::Event) -> Self { NodeEvent::Mdns(Box::new(event)) diff --git a/ant-networking/src/event/swarm.rs b/ant-networking/src/event/swarm.rs index d4385d0500..434b94f7fe 100644 --- a/ant-networking/src/event/swarm.rs +++ b/ant-networking/src/event/swarm.rs @@ -11,7 +11,6 @@ use crate::{ relay_manager::is_a_relayed_peer, time::Instant, NetworkEvent, Result, SwarmDriver, }; use ant_protocol::version::{IDENTIFY_NODE_VERSION_STR, IDENTIFY_PROTOCOL_STR}; -#[cfg(feature = "local")] use libp2p::mdns; #[cfg(feature = "open-metrics")] use libp2p::metrics::Recorder; @@ -287,26 +286,28 @@ impl SwarmDriver { libp2p::identify::Event::Error { .. } => debug!("identify: {iden:?}"), } } - #[cfg(feature = "local")] SwarmEvent::Behaviour(NodeEvent::Mdns(mdns_event)) => { event_string = "mdns"; - match *mdns_event { - mdns::Event::Discovered(list) => { - if self.local { - for (peer_id, addr) in list { - // The multiaddr does not contain the peer ID, so add it. - let addr = addr.with(Protocol::P2p(peer_id)); - - info!(%addr, "mDNS node discovered and dialing"); - - if let Err(err) = self.dial(addr.clone()) { - warn!(%addr, "mDNS node dial error: {err:?}"); + // mDNS is only relevant in local mode + if self.local { + match *mdns_event { + mdns::Event::Discovered(list) => { + if self.local { + for (peer_id, addr) in list { + // The multiaddr does not contain the peer ID, so add it. + let addr = addr.with(Protocol::P2p(peer_id)); + + info!(%addr, "mDNS node discovered and dialing"); + + if let Err(err) = self.dial(addr.clone()) { + warn!(%addr, "mDNS node dial error: {err:?}"); + } } } } - } - mdns::Event::Expired(peer) => { - debug!("mdns peer {peer:?} expired"); + mdns::Event::Expired(peer) => { + debug!("mdns peer {peer:?} expired"); + } } } } diff --git a/ant-node-manager/src/cmd/mod.rs b/ant-node-manager/src/cmd/mod.rs index 45138e640d..20a25fd99a 100644 --- a/ant-node-manager/src/cmd/mod.rs +++ b/ant-node-manager/src/cmd/mod.rs @@ -181,9 +181,6 @@ fn build_binary(bin_type: &ReleaseType) -> Result { if cfg!(feature = "otlp") { args.extend(["--features", "otlp"]); } - if cfg!(feature = "local") { - args.extend(["--features", "local"]); - } if cfg!(feature = "websockets") { args.extend(["--features", "websockets"]); } diff --git a/ant-node/Cargo.toml b/ant-node/Cargo.toml index 5cc0cc4c84..a3f6f9d014 100644 --- a/ant-node/Cargo.toml +++ b/ant-node/Cargo.toml @@ -16,12 +16,6 @@ path = "src/bin/antnode/main.rs" [features] default = ["metrics", "upnp", "open-metrics"] extension-module = ["pyo3/extension-module"] -local = [ - "ant-networking/local", - "ant-evm/local", - "ant-bootstrap/local", - "ant-logging/process-metrics", -] loud = ["ant-networking/loud"] # loud mode: print important messages to console metrics = [] nightly = [] diff --git a/ant-node/src/bin/antnode/main.rs b/ant-node/src/bin/antnode/main.rs index 3397d81461..65ae7f6c45 100644 --- a/ant-node/src/bin/antnode/main.rs +++ b/ant-node/src/bin/antnode/main.rs @@ -15,7 +15,6 @@ mod subcommands; use crate::subcommands::EvmNetworkCommand; use ant_bootstrap::{BootstrapCacheConfig, BootstrapCacheStore, PeersArgs}; use ant_evm::{get_evm_network_from_env, EvmNetwork, RewardsAddress}; -#[cfg(feature = "local")] use ant_logging::metrics::init_metrics; use ant_logging::{Level, LogFormat, LogOutputDest, ReloadHandle}; use ant_node::{Marker, NodeBuilder, NodeEvent, NodeEventsReceiver}; @@ -306,8 +305,9 @@ fn main() -> Result<()> { // Create a tokio runtime per `run_node` attempt, this ensures // any spawned tasks are closed before we would attempt to run // another process with these args. - #[cfg(feature = "local")] - rt.spawn(init_metrics(std::process::id())); + if opt.peers.local { + rt.spawn(init_metrics(std::process::id())); + } let initial_peres = rt.block_on(opt.peers.get_addrs(None, Some(100)))?; debug!("Node's owner set to: {:?}", opt.owner); let restart_options = rt.block_on(async move { diff --git a/ant-node/src/node.rs b/ant-node/src/node.rs index 3877a31a18..da962bbcff 100644 --- a/ant-node/src/node.rs +++ b/ant-node/src/node.rs @@ -192,6 +192,7 @@ impl NodeBuilder { let node_events_channel = NodeEventsChannel::default(); let node = NodeInner { + local: self.local, network: network.clone(), events_channel: node_events_channel.clone(), initial_peers: self.initial_peers, @@ -228,6 +229,7 @@ pub(crate) struct Node { /// The actual implementation of the Node. The other is just a wrapper around this, so that we don't expose /// the Arc from the interface. struct NodeInner { + local: bool, events_channel: NodeEventsChannel, // Peers that are dialed at startup of node. initial_peers: Vec, @@ -456,7 +458,7 @@ impl Node { } NetworkEvent::NewListenAddr(_) => { event_header = "NewListenAddr"; - if !cfg!(feature = "local") { + if !self.inner.local { let network = self.network().clone(); let peers = self.initial_peers().clone(); let _handle = spawn(async move { diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index f8205ba3a6..696fcc74e2 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -23,7 +23,6 @@ name = "put_and_dir_upload" default = [] external-signer = ["ant-evm/external-signer"] extension-module = ["pyo3/extension-module"] -local = ["ant-networking/local", "ant-evm/local"] loud = [] [dependencies] diff --git a/autonomi/README.md b/autonomi/README.md index 72be58b39d..4c19a3e7c4 100644 --- a/autonomi/README.md +++ b/autonomi/README.md @@ -73,7 +73,7 @@ To run the tests, we can run a local network: 3. Then run the tests with the `local` feature and pass the EVM params again: ```sh - EVM_NETWORK=local cargo test --features local --package autonomi + EVM_NETWORK=local cargo test --package autonomi ``` ### Using a live testnet or mainnet @@ -89,7 +89,7 @@ cargo run --bin antctl --features local -- local run --build --clean --rewards-a 2. Then pass the private key of the wallet, and ensure it has enough gas and payment tokens on the network (in this case Arbitrum One): ```sh -EVM_NETWORK=arbitrum-one EVM_PRIVATE_KEY= cargo test --package autonomi --features local +EVM_NETWORK=arbitrum-one EVM_PRIVATE_KEY= cargo test --package autonomi ``` ## Using funds from the Deployer Wallet diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index 9cfc7ed156..697e405bbb 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -67,7 +67,7 @@ pub struct Client { } /// Configuration for [`Client::init_with_config`]. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub struct ClientConfig { /// Whether we're expected to connect to a local network. /// @@ -80,18 +80,6 @@ pub struct ClientConfig { pub peers: Option>, } -impl Default for ClientConfig { - fn default() -> Self { - Self { - #[cfg(feature = "local")] - local: true, - #[cfg(not(feature = "local"))] - local: false, - peers: None, - } - } -} - /// Error returned by [`Client::init`]. #[derive(Debug, thiserror::Error)] pub enum ConnectError { diff --git a/autonomi/tests/fs.rs b/autonomi/tests/fs.rs index 88198c4cc6..1bb4e3a7cf 100644 --- a/autonomi/tests/fs.rs +++ b/autonomi/tests/fs.rs @@ -18,7 +18,7 @@ use tokio::time::sleep; use walkdir::WalkDir; // With a local evm network, and local network, run: -// EVM_NETWORK=local cargo test --features="local" --package autonomi --test fs +// EVM_NETWORK=local cargo test --package autonomi --test fs #[tokio::test] async fn dir_upload_download() -> Result<()> { let _log_appender_guard = diff --git a/evm-testnet/src/main.rs b/evm-testnet/src/main.rs index f865cb8983..e07864700a 100644 --- a/evm-testnet/src/main.rs +++ b/evm-testnet/src/main.rs @@ -164,7 +164,7 @@ impl TestnetData { ); std::fs::write(&csv_path, csv).expect("Could not write to evm_testnet_data.csv file"); println!("EVM testnet data saved to: {csv_path:?}"); - println!("When running the Node or CLI with --feature=local, it will automatically use this network by loading the EVM Network's info from the CSV file."); + println!("When running the Node or CLI in local mode, it will automatically use this network by loading the EVM Network's info from the CSV file."); println!(); } diff --git a/evmlib/Cargo.toml b/evmlib/Cargo.toml index 7c7ee7dbd4..5cedbcc15d 100644 --- a/evmlib/Cargo.toml +++ b/evmlib/Cargo.toml @@ -9,7 +9,6 @@ repository = "https://github.com/maidsafe/safe_network" version = "0.1.6" [features] -local = [] external-signer = [] [dependencies] diff --git a/evmlib/src/utils.rs b/evmlib/src/utils.rs index 4e3133713f..eb5d9ca724 100644 --- a/evmlib/src/utils.rs +++ b/evmlib/src/utils.rs @@ -93,16 +93,12 @@ pub fn get_evm_network_from_env() -> Result { }) .collect::, Error>>(); - let mut use_local_evm = std::env::var("EVM_NETWORK") + let use_local_evm = std::env::var("EVM_NETWORK") .map(|v| v == "local") .unwrap_or(false); if use_local_evm { info!("Using local EVM network as EVM_NETWORK is set to 'local'"); } - if cfg!(feature = "local") { - use_local_evm = true; - info!("Using local EVM network as 'local' feature flag is enabled"); - } let use_arbitrum_one = std::env::var("EVM_NETWORK") .map(|v| v == "arbitrum-one") From cee5d51e7172d823b8c8f0ac3ff6fc8e58366271 Mon Sep 17 00:00:00 2001 From: grumbach Date: Sat, 4 Jan 2025 03:53:58 +0900 Subject: [PATCH 06/38] feat: cli local setup --- ant-cli/src/access/network.rs | 32 +++++++++++++++++++++++++++++--- ant-cli/src/actions/connect.rs | 15 +++++++++++---- ant-cli/src/commands.rs | 2 +- ant-cli/src/commands/file.rs | 8 ++++---- ant-cli/src/commands/register.rs | 10 +++++----- ant-cli/src/commands/vault.rs | 10 +++++----- ant-cli/src/main.rs | 2 +- ant-cli/src/opt.rs | 6 ------ ant-evm/src/lib.rs | 2 +- ant-node/src/bin/antnode/main.rs | 18 +++++++++++------- evmlib/src/utils.rs | 2 +- 11 files changed, 69 insertions(+), 38 deletions(-) diff --git a/ant-cli/src/access/network.rs b/ant-cli/src/access/network.rs index 8c428e06d3..f69c7a3351 100644 --- a/ant-cli/src/access/network.rs +++ b/ant-cli/src/access/network.rs @@ -12,9 +12,35 @@ use color_eyre::eyre::Context; use color_eyre::Result; use color_eyre::Section; -pub async fn get_peers(peers: PeersArgs) -> Result> { - peers.get_addrs(None, Some(100)).await +pub enum NetworkPeers { + Local(Vec), + Public(Vec), +} + +impl NetworkPeers { + pub fn peers(&self) -> &Vec { + match self { + NetworkPeers::Local(addrs) => addrs, + NetworkPeers::Public(addrs) => addrs, + } + } + + pub fn is_local(&self) -> bool { + matches!(self, NetworkPeers::Local(_)) + } +} + +pub async fn get_peers(peers: PeersArgs) -> Result { + let addrs = peers.get_addrs(None, Some(100)).await .wrap_err("Please provide valid Network peers to connect to") .with_suggestion(|| format!("make sure you've provided network peers using the --peers option or the {ANT_PEERS_ENV} env var")) - .with_suggestion(|| "a peer address looks like this: /ip4/42.42.42.42/udp/4242/quic-v1/p2p/B64nodePeerIDvdjb3FAJF4ks3moreBase64CharsHere") + .with_suggestion(|| "a peer address looks like this: /ip4/42.42.42.42/udp/4242/quic-v1/p2p/B64nodePeerIDvdjb3FAJF4ks3moreBase64CharsHere")?; + + let net = if peers.local { + NetworkPeers::Local(addrs) + } else { + NetworkPeers::Public(addrs) + }; + + Ok(net) } diff --git a/ant-cli/src/actions/connect.rs b/ant-cli/src/actions/connect.rs index cba9ac217a..091c87e1c8 100644 --- a/ant-cli/src/actions/connect.rs +++ b/ant-cli/src/actions/connect.rs @@ -7,22 +7,29 @@ // permissions and limitations relating to use of the SAFE Network Software. use autonomi::Client; -use autonomi::Multiaddr; use color_eyre::eyre::bail; use color_eyre::eyre::Result; use indicatif::ProgressBar; use std::time::Duration; -pub async fn connect_to_network(peers: Vec) -> Result { +use crate::network::NetworkPeers; + +pub async fn connect_to_network(peers: NetworkPeers) -> Result { let progress_bar = ProgressBar::new_spinner(); progress_bar.enable_steady_tick(Duration::from_millis(120)); progress_bar.set_message("Connecting to The Autonomi Network..."); let new_style = progress_bar.style().tick_chars("⠁⠂⠄⡀⢀⠠⠐⠈🔗"); progress_bar.set_style(new_style); - progress_bar.set_message("Connecting to The Autonomi Network..."); + let res = if peers.is_local() { + progress_bar.set_message("Connecting to a local Autonomi Network..."); + Client::init_local().await + } else { + progress_bar.set_message("Connecting to The Autonomi Network..."); + Client::init_with_peers(peers.peers().to_vec()).await + }; - match Client::init_with_peers(peers).await { + match res { Ok(client) => { info!("Connected to the Network"); progress_bar.finish_with_message("Connected to the Network"); diff --git a/ant-cli/src/commands.rs b/ant-cli/src/commands.rs index ff065a06c0..c3a22e8939 100644 --- a/ant-cli/src/commands.rs +++ b/ant-cli/src/commands.rs @@ -215,7 +215,7 @@ pub async fn handle_subcommand(opt: Opt) -> Result<()> { VaultCmd::Cost => vault::cost(peers.await?).await, VaultCmd::Create => vault::create(peers.await?).await, VaultCmd::Load => vault::load(peers.await?).await, - VaultCmd::Sync { force } => vault::sync(peers.await?, force).await, + VaultCmd::Sync { force } => vault::sync(force, peers.await?).await, }, Some(SubCmd::Wallet { command }) => match command { WalletCmd::Create { diff --git a/ant-cli/src/commands/file.rs b/ant-cli/src/commands/file.rs index 146133e348..5f9c966c8e 100644 --- a/ant-cli/src/commands/file.rs +++ b/ant-cli/src/commands/file.rs @@ -6,16 +6,16 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. +use crate::network::NetworkPeers; use crate::utils::collect_upload_summary; use crate::wallet::load_wallet; use autonomi::client::address::addr_to_str; -use autonomi::Multiaddr; use color_eyre::eyre::Context; use color_eyre::eyre::Result; use color_eyre::Section; use std::path::PathBuf; -pub async fn cost(file: &str, peers: Vec) -> Result<()> { +pub async fn cost(file: &str, peers: NetworkPeers) -> Result<()> { let client = crate::actions::connect_to_network(peers).await?; println!("Getting upload cost..."); @@ -31,7 +31,7 @@ pub async fn cost(file: &str, peers: Vec) -> Result<()> { Ok(()) } -pub async fn upload(file: &str, public: bool, peers: Vec) -> Result<()> { +pub async fn upload(file: &str, public: bool, peers: NetworkPeers) -> Result<()> { let wallet = load_wallet()?; let mut client = crate::actions::connect_to_network(peers).await?; let event_receiver = client.enable_client_events(); @@ -101,7 +101,7 @@ pub async fn upload(file: &str, public: bool, peers: Vec) -> Result<( Ok(()) } -pub async fn download(addr: &str, dest_path: &str, peers: Vec) -> Result<()> { +pub async fn download(addr: &str, dest_path: &str, peers: NetworkPeers) -> Result<()> { let mut client = crate::actions::connect_to_network(peers).await?; crate::actions::download(addr, dest_path, &mut client).await } diff --git a/ant-cli/src/commands/register.rs b/ant-cli/src/commands/register.rs index 5598fc0544..9e84d607b4 100644 --- a/ant-cli/src/commands/register.rs +++ b/ant-cli/src/commands/register.rs @@ -8,13 +8,13 @@ #![allow(deprecated)] +use crate::network::NetworkPeers; use crate::utils::collect_upload_summary; use crate::wallet::load_wallet; use autonomi::client::registers::RegisterAddress; use autonomi::client::registers::RegisterPermissions; use autonomi::client::registers::RegisterSecretKey; use autonomi::Client; -use autonomi::Multiaddr; use color_eyre::eyre::eyre; use color_eyre::eyre::Context; use color_eyre::eyre::Result; @@ -39,7 +39,7 @@ pub fn generate_key(overwrite: bool) -> Result<()> { Ok(()) } -pub async fn cost(name: &str, peers: Vec) -> Result<()> { +pub async fn cost(name: &str, peers: NetworkPeers) -> Result<()> { let register_key = crate::keys::get_register_signing_key() .wrap_err("The register key is required to perform this action")?; let client = crate::actions::connect_to_network(peers).await?; @@ -53,7 +53,7 @@ pub async fn cost(name: &str, peers: Vec) -> Result<()> { Ok(()) } -pub async fn create(name: &str, value: &str, public: bool, peers: Vec) -> Result<()> { +pub async fn create(name: &str, value: &str, public: bool, peers: NetworkPeers) -> Result<()> { let wallet = load_wallet()?; let register_key = crate::keys::get_register_signing_key() .wrap_err("The register key is required to perform this action")?; @@ -119,7 +119,7 @@ pub async fn create(name: &str, value: &str, public: bool, peers: Vec Ok(()) } -pub async fn edit(address: String, name: bool, value: &str, peers: Vec) -> Result<()> { +pub async fn edit(address: String, name: bool, value: &str, peers: NetworkPeers) -> Result<()> { let register_key = crate::keys::get_register_signing_key() .wrap_err("The register key is required to perform this action")?; let client = crate::actions::connect_to_network(peers).await?; @@ -157,7 +157,7 @@ pub async fn edit(address: String, name: bool, value: &str, peers: Vec) -> Result<()> { +pub async fn get(address: String, name: bool, peers: NetworkPeers) -> Result<()> { let register_key = crate::keys::get_register_signing_key() .wrap_err("The register key is required to perform this action")?; let client = crate::actions::connect_to_network(peers).await?; diff --git a/ant-cli/src/commands/vault.rs b/ant-cli/src/commands/vault.rs index 14e5b6350b..b1ad37257b 100644 --- a/ant-cli/src/commands/vault.rs +++ b/ant-cli/src/commands/vault.rs @@ -6,13 +6,13 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. +use crate::network::NetworkPeers; use crate::wallet::load_wallet; -use autonomi::Multiaddr; use color_eyre::eyre::Context; use color_eyre::eyre::Result; use color_eyre::Section; -pub async fn cost(peers: Vec) -> Result<()> { +pub async fn cost(peers: NetworkPeers) -> Result<()> { let client = crate::actions::connect_to_network(peers).await?; let vault_sk = crate::keys::get_vault_secret_key()?; @@ -27,7 +27,7 @@ pub async fn cost(peers: Vec) -> Result<()> { Ok(()) } -pub async fn create(peers: Vec) -> Result<()> { +pub async fn create(peers: NetworkPeers) -> Result<()> { let client = crate::actions::connect_to_network(peers).await?; let wallet = load_wallet()?; let vault_sk = crate::keys::get_vault_secret_key()?; @@ -55,7 +55,7 @@ pub async fn create(peers: Vec) -> Result<()> { Ok(()) } -pub async fn sync(peers: Vec, force: bool) -> Result<()> { +pub async fn sync(force: bool, peers: NetworkPeers) -> Result<()> { let client = crate::actions::connect_to_network(peers).await?; let vault_sk = crate::keys::get_vault_secret_key()?; let wallet = load_wallet()?; @@ -89,7 +89,7 @@ pub async fn sync(peers: Vec, force: bool) -> Result<()> { Ok(()) } -pub async fn load(peers: Vec) -> Result<()> { +pub async fn load(peers: NetworkPeers) -> Result<()> { let client = crate::actions::connect_to_network(peers).await?; let vault_sk = crate::keys::get_vault_secret_key()?; diff --git a/ant-cli/src/main.rs b/ant-cli/src/main.rs index bc9a627500..e0fe5cf644 100644 --- a/ant-cli/src/main.rs +++ b/ant-cli/src/main.rs @@ -72,7 +72,7 @@ async fn main() -> Result<()> { } let _log_guards = init_logging_and_metrics(&opt)?; - if opt.local { + if opt.peers.local { tokio::spawn(init_metrics(std::process::id())); } diff --git a/ant-cli/src/opt.rs b/ant-cli/src/opt.rs index ef74118cd1..9d7e4edd9b 100644 --- a/ant-cli/src/opt.rs +++ b/ant-cli/src/opt.rs @@ -19,12 +19,6 @@ use std::time::Duration; #[command(disable_version_flag = true)] #[command(author, version, about, long_about = None)] pub(crate) struct Opt { - /// Specify whether the cli is operating with a local network. - /// - /// This is used to run the cli against a local test network. - #[clap(long, default_value_t = false)] - pub local: bool, - /// Available sub commands. #[clap(subcommand)] pub command: Option, diff --git a/ant-evm/src/lib.rs b/ant-evm/src/lib.rs index ece2c36083..678db86c72 100644 --- a/ant-evm/src/lib.rs +++ b/ant-evm/src/lib.rs @@ -19,7 +19,7 @@ pub use evmlib::cryptography; #[cfg(feature = "external-signer")] pub use evmlib::external_signer; pub use evmlib::utils; -pub use evmlib::utils::get_evm_network_from_env; +pub use evmlib::utils::{get_evm_network_from_env, local_evm_network_from_csv}; pub use evmlib::utils::{DATA_PAYMENTS_ADDRESS, PAYMENT_TOKEN_ADDRESS, RPC_URL}; pub use evmlib::wallet::Error as EvmWalletError; pub use evmlib::wallet::Wallet as EvmWallet; diff --git a/ant-node/src/bin/antnode/main.rs b/ant-node/src/bin/antnode/main.rs index 65ae7f6c45..fab6abcfb6 100644 --- a/ant-node/src/bin/antnode/main.rs +++ b/ant-node/src/bin/antnode/main.rs @@ -14,7 +14,7 @@ mod subcommands; use crate::subcommands::EvmNetworkCommand; use ant_bootstrap::{BootstrapCacheConfig, BootstrapCacheStore, PeersArgs}; -use ant_evm::{get_evm_network_from_env, EvmNetwork, RewardsAddress}; +use ant_evm::{get_evm_network_from_env, local_evm_network_from_csv, EvmNetwork, RewardsAddress}; use ant_logging::metrics::init_metrics; use ant_logging::{Level, LogFormat, LogOutputDest, ReloadHandle}; use ant_node::{Marker, NodeBuilder, NodeEvent, NodeEventsReceiver}; @@ -262,12 +262,16 @@ fn main() -> Result<()> { return Ok(()); } - let evm_network: EvmNetwork = opt - .evm_network - .as_ref() - .cloned() - .map(|v| Ok(v.into())) - .unwrap_or_else(get_evm_network_from_env)?; + let evm_network: EvmNetwork = if opt.peers.local { + println!("Running node in local mode"); + local_evm_network_from_csv()? + } else { + opt.evm_network + .as_ref() + .cloned() + .map(|v| Ok(v.into())) + .unwrap_or_else(get_evm_network_from_env)? + }; println!("EVM network: {evm_network:?}"); let node_socket_addr = SocketAddr::new(opt.ip, opt.port); diff --git a/evmlib/src/utils.rs b/evmlib/src/utils.rs index eb5d9ca724..422125fb5a 100644 --- a/evmlib/src/utils.rs +++ b/evmlib/src/utils.rs @@ -132,7 +132,7 @@ pub fn get_evm_network_from_env() -> Result { } /// Get the `Network::Custom` from the local EVM testnet CSV file -fn local_evm_network_from_csv() -> Result { +pub fn local_evm_network_from_csv() -> Result { // load the csv let csv_path = get_evm_testnet_csv_path()?; From 924daff36d2b0b236e7571ed0fabba0f8af32661 Mon Sep 17 00:00:00 2001 From: grumbach Date: Sat, 4 Jan 2025 03:56:35 +0900 Subject: [PATCH 07/38] chore: keep old order --- ant-networking/src/driver.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ant-networking/src/driver.rs b/ant-networking/src/driver.rs index d456bda114..8037f78a29 100644 --- a/ant-networking/src/driver.rs +++ b/ant-networking/src/driver.rs @@ -676,12 +676,12 @@ impl NetworkBuilder { blocklist: libp2p::allow_block_list::Behaviour::default(), relay_client: relay_behaviour, relay_server, - mdns, #[cfg(feature = "upnp")] upnp, request_response, kademlia, identify, + mdns, }; let swarm_config = libp2p::swarm::Config::with_tokio_executor() From ce9e9a72d27c20479f3f2c4457af4413460cfbb1 Mon Sep 17 00:00:00 2001 From: grumbach Date: Tue, 7 Jan 2025 01:43:01 +0900 Subject: [PATCH 08/38] chore: fix cli wallet error management --- ant-bootstrap/src/initial_peers.rs | 2 +- ant-cli/src/access/keys.rs | 7 ++- ant-cli/src/commands/file.rs | 2 +- ant-cli/src/commands/register.rs | 2 +- ant-cli/src/commands/vault.rs | 4 +- ant-cli/src/commands/wallet.rs | 7 +-- ant-cli/src/wallet/encryption.rs | 23 +++++----- ant-cli/src/wallet/error.rs | 31 ------------- ant-cli/src/wallet/fs.rs | 70 ++++++++++++++---------------- ant-cli/src/wallet/mod.rs | 9 ++-- autonomi/src/client/mod.rs | 9 ++-- test-utils/src/evm.rs | 9 ++-- 12 files changed, 66 insertions(+), 109 deletions(-) delete mode 100644 ant-cli/src/wallet/error.rs diff --git a/ant-bootstrap/src/initial_peers.rs b/ant-bootstrap/src/initial_peers.rs index 1a5b33ffe1..00241bb7af 100644 --- a/ant-bootstrap/src/initial_peers.rs +++ b/ant-bootstrap/src/initial_peers.rs @@ -53,7 +53,7 @@ pub struct PeersArgs { /// a bootstrap cache JSON file. #[clap(long, conflicts_with = "first", value_delimiter = ',')] pub network_contacts_url: Vec, - /// Set to indicate this is a local network. You could also set the `local` feature flag to set this to true. + /// Set to indicate this is a local network. /// /// This would use mDNS for peer discovery. #[clap(long, conflicts_with = "network_contacts_url", default_value = "false")] diff --git a/ant-cli/src/access/keys.rs b/ant-cli/src/access/keys.rs index cfaa5284b7..9bb3ba2ad5 100644 --- a/ant-cli/src/access/keys.rs +++ b/ant-cli/src/access/keys.rs @@ -9,7 +9,7 @@ use crate::wallet::load_wallet_private_key; use autonomi::client::registers::RegisterSecretKey; use autonomi::client::vault::VaultSecretKey; -use autonomi::{get_evm_network_from_env, Wallet}; +use autonomi::{Network, Wallet}; use color_eyre::eyre::{eyre, Context, Result}; use color_eyre::Section; use std::env; @@ -22,11 +22,10 @@ const REGISTER_SIGNING_KEY_ENV: &str = "REGISTER_SIGNING_KEY"; const REGISTER_SIGNING_KEY_FILE: &str = "register_signing_key"; /// EVM wallet -pub fn load_evm_wallet_from_env() -> Result { +pub fn load_evm_wallet_from_env(evm_network: &Network) -> Result { let secret_key = get_secret_key_from_env().wrap_err("The secret key is required to perform this action")?; - let network = get_evm_network_from_env()?; - let wallet = Wallet::new_from_private_key(network, &secret_key) + let wallet = Wallet::new_from_private_key(evm_network.clone(), &secret_key) .wrap_err("Failed to load EVM wallet from key")?; Ok(wallet) } diff --git a/ant-cli/src/commands/file.rs b/ant-cli/src/commands/file.rs index 5f9c966c8e..23ba6c7afe 100644 --- a/ant-cli/src/commands/file.rs +++ b/ant-cli/src/commands/file.rs @@ -32,8 +32,8 @@ pub async fn cost(file: &str, peers: NetworkPeers) -> Result<()> { } pub async fn upload(file: &str, public: bool, peers: NetworkPeers) -> Result<()> { - let wallet = load_wallet()?; let mut client = crate::actions::connect_to_network(peers).await?; + let wallet = load_wallet(&client.evm_network)?; let event_receiver = client.enable_client_events(); let (upload_summary_thread, upload_completed_tx) = collect_upload_summary(event_receiver); diff --git a/ant-cli/src/commands/register.rs b/ant-cli/src/commands/register.rs index 9e84d607b4..9b95fb7670 100644 --- a/ant-cli/src/commands/register.rs +++ b/ant-cli/src/commands/register.rs @@ -54,10 +54,10 @@ pub async fn cost(name: &str, peers: NetworkPeers) -> Result<()> { } pub async fn create(name: &str, value: &str, public: bool, peers: NetworkPeers) -> Result<()> { - let wallet = load_wallet()?; let register_key = crate::keys::get_register_signing_key() .wrap_err("The register key is required to perform this action")?; let mut client = crate::actions::connect_to_network(peers).await?; + let wallet = load_wallet(&client.evm_network)?; let event_receiver = client.enable_client_events(); let (upload_summary_thread, upload_completed_tx) = collect_upload_summary(event_receiver); diff --git a/ant-cli/src/commands/vault.rs b/ant-cli/src/commands/vault.rs index b1ad37257b..2c8ac619ba 100644 --- a/ant-cli/src/commands/vault.rs +++ b/ant-cli/src/commands/vault.rs @@ -29,7 +29,7 @@ pub async fn cost(peers: NetworkPeers) -> Result<()> { pub async fn create(peers: NetworkPeers) -> Result<()> { let client = crate::actions::connect_to_network(peers).await?; - let wallet = load_wallet()?; + let wallet = load_wallet(&client.evm_network)?; let vault_sk = crate::keys::get_vault_secret_key()?; println!("Retrieving local user data..."); @@ -58,7 +58,7 @@ pub async fn create(peers: NetworkPeers) -> Result<()> { pub async fn sync(force: bool, peers: NetworkPeers) -> Result<()> { let client = crate::actions::connect_to_network(peers).await?; let vault_sk = crate::keys::get_vault_secret_key()?; - let wallet = load_wallet()?; + let wallet = load_wallet(&client.evm_network)?; println!("Fetching vault from network..."); let net_user_data = client diff --git a/ant-cli/src/commands/wallet.rs b/ant-cli/src/commands/wallet.rs index b1a2caf70b..5f123dcb68 100644 --- a/ant-cli/src/commands/wallet.rs +++ b/ant-cli/src/commands/wallet.rs @@ -6,10 +6,10 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use crate::wallet::fs::{select_wallet, select_wallet_private_key, store_private_key}; +use crate::wallet::fs::{select_wallet_private_key, store_private_key}; use crate::wallet::input::request_password; use crate::wallet::DUMMY_NETWORK; -use autonomi::Wallet; +use autonomi::{get_evm_network_from_env, Wallet}; use color_eyre::eyre::eyre; use color_eyre::Result; use prettytable::{Cell, Row, Table}; @@ -81,7 +81,8 @@ pub fn export() -> Result<()> { } pub async fn balance() -> Result<()> { - let wallet = select_wallet()?; + let network = get_evm_network_from_env().unwrap_or_default(); + let wallet = crate::wallet::load_wallet(&network)?; let token_balance = wallet.balance_of_tokens().await?; let gas_balance = wallet.balance_of_gas_tokens().await?; diff --git a/ant-cli/src/wallet/encryption.rs b/ant-cli/src/wallet/encryption.rs index 88f53afa15..1ea081e088 100644 --- a/ant-cli/src/wallet/encryption.rs +++ b/ant-cli/src/wallet/encryption.rs @@ -6,7 +6,8 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use crate::wallet::error::Error; +use color_eyre::eyre::eyre; +use color_eyre::Result; use rand::Rng; use ring::aead::{BoundKey, Nonce, NonceSequence}; use ring::error::Unspecified; @@ -28,7 +29,7 @@ impl NonceSequence for NonceSeq { } } -pub fn encrypt_private_key(private_key: &str, password: &str) -> Result { +pub fn encrypt_private_key(private_key: &str, password: &str) -> Result { // Generate a random salt // Salt is used to ensure unique derived keys even for identical passwords let mut salt = [0u8; SALT_LENGTH]; @@ -55,7 +56,7 @@ pub fn encrypt_private_key(private_key: &str, password: &str) -> Result Result Result Result { +pub fn decrypt_private_key(encrypted_data: &str, password: &str) -> Result { let encrypted_data = hex::decode(encrypted_data) - .map_err(|_| Error::FailedToDecryptKey(String::from("Encrypted data is invalid")))?; + .map_err(|_| eyre!("Failed to decrypt key: Encrypted data is invalid"))?; let salt: [u8; SALT_LENGTH] = encrypted_data[..SALT_LENGTH] .try_into() - .map_err(|_| Error::FailedToDecryptKey(String::from("Could not find salt")))?; + .map_err(|_| eyre!("Failed to decrypt key: Could not find salt"))?; let nonce: [u8; NONCE_LENGTH] = encrypted_data[SALT_LENGTH..SALT_LENGTH + NONCE_LENGTH] .try_into() - .map_err(|_| Error::FailedToDecryptKey(String::from("Could not find nonce")))?; + .map_err(|_| eyre!("Failed to decrypt key: Could not find nonce"))?; let encrypted_private_key = &encrypted_data[SALT_LENGTH + NONCE_LENGTH..]; @@ -106,7 +107,7 @@ pub fn decrypt_private_key(encrypted_data: &str, password: &str) -> Result Result = OnceLock::new(); /// Creates the wallets folder if it is missing and returns the folder path. -pub(crate) fn get_client_wallet_dir_path() -> Result { - let mut home_dirs = dirs_next::data_dir().ok_or(Error::WalletsFolderNotFound)?; - home_dirs.push("autonomi"); - home_dirs.push("client"); +pub(crate) fn get_client_wallet_dir_path() -> Result { + let mut home_dirs = crate::access::data_dir::get_client_data_dir_path() + .wrap_err("Failed to get wallet directory")?; home_dirs.push("wallets"); - std::fs::create_dir_all(home_dirs.as_path()).map_err(|_| Error::FailedToCreateWalletsFolder)?; + std::fs::create_dir_all(home_dirs.as_path()) + .wrap_err("Failed to create wallets folder, make sure you have the correct permissions")?; Ok(home_dirs) } @@ -41,9 +41,9 @@ pub(crate) fn get_client_wallet_dir_path() -> Result { pub(crate) fn store_private_key( private_key: &str, encryption_password: Option, -) -> Result { +) -> Result { let wallet = Wallet::new_from_private_key(DUMMY_NETWORK, private_key) - .map_err(|_| Error::InvalidPrivateKey)?; + .map_err(|_| eyre!("Private key is invalid"))?; // Wallet address let wallet_address = wallet.address().to_string(); @@ -56,15 +56,13 @@ pub(crate) fn store_private_key( let file_name = format!("{wallet_address}{ENCRYPTED_PRIVATE_KEY_EXT}"); let file_path = wallets_folder.join(file_name); - std::fs::write(file_path.clone(), encrypted_key) - .map_err(|err| Error::FailedToStorePrivateKey(err.to_string()))?; + std::fs::write(file_path.clone(), encrypted_key).wrap_err("Failed to store private key")?; Ok(file_path.into_os_string()) } else { let file_path = wallets_folder.join(wallet_address); - std::fs::write(file_path.clone(), private_key) - .map_err(|err| Error::FailedToStorePrivateKey(err.to_string()))?; + std::fs::write(file_path.clone(), private_key).wrap_err("Failed to store private key")?; Ok(file_path.into_os_string()) } @@ -73,7 +71,7 @@ pub(crate) fn store_private_key( /// Loads the private key (hex-encoded) from disk. /// /// If the private key file is encrypted, the function will prompt for the decryption password in the CLI. -pub(crate) fn load_private_key(wallet_address: &str) -> Result { +pub(crate) fn load_private_key(wallet_address: &str) -> Result { let wallets_folder = get_client_wallet_dir_path()?; let mut file_name = wallet_address.to_string(); @@ -93,46 +91,42 @@ pub(crate) fn load_private_key(wallet_address: &str) -> Result { let file_path = wallets_folder.join(file_name); - let mut file = std::fs::File::open(&file_path).map_err(|_| Error::PrivateKeyFileNotFound)?; + let mut file = + std::fs::File::open(&file_path).map_err(|e| eyre!("Private key file not found: {e}"))?; let mut buffer = String::new(); file.read_to_string(&mut buffer) - .map_err(|_| Error::InvalidPrivateKeyFile)?; + .map_err(|_| eyre!("Invalid private key file"))?; // If the file is encrypted, prompt for the password and decrypt the key. if is_encrypted { let password = get_password_input("Enter password to decrypt wallet:"); decrypt_private_key(&buffer, &password) + .map_err(|e| eyre!("Failed to decrypt private key: {e}")) } else { Ok(buffer) } } -pub(crate) fn load_wallet_from_address(wallet_address: &str) -> Result { - let network = get_evm_network_from_env().expect("Could not load EVM network from environment"); +pub(crate) fn load_wallet_from_address(wallet_address: &str, network: &Network) -> Result { let private_key = load_private_key(wallet_address)?; - let wallet = - Wallet::new_from_private_key(network, &private_key).expect("Could not initialize wallet"); + let wallet = Wallet::new_from_private_key(network.clone(), &private_key) + .map_err(|e| eyre!("Could not initialize wallet: {e}"))?; Ok(wallet) } -pub(crate) fn select_wallet() -> Result { - // try if there is a wallet set in the ENV first - if let Ok(env_wallet) = load_evm_wallet_from_env() { - return Ok(env_wallet); - } - - let wallet_address = select_wallet_address()?; - load_wallet_from_address(&wallet_address) +pub(crate) fn select_wallet_from_disk(network: &Network) -> Result { + let wallet_address = select_local_wallet_address()?; + load_wallet_from_address(&wallet_address, network) } -pub(crate) fn select_wallet_private_key() -> Result { - let wallet_address = select_wallet_address()?; +pub(crate) fn select_wallet_private_key() -> Result { + let wallet_address = select_local_wallet_address()?; load_private_key(&wallet_address) } -pub(crate) fn select_wallet_address() -> Result { +pub(crate) fn select_local_wallet_address() -> Result { // Try if a wallet address was already selected this session if let Some(wallet_address) = SELECTED_WALLET_ADDRESS.get() { return Ok(wallet_address.clone()); @@ -142,7 +136,7 @@ pub(crate) fn select_wallet_address() -> Result { let wallet_files = get_wallet_files(&wallets_folder)?; let wallet_address = match wallet_files.len() { - 0 => Err(Error::NoWalletsFound), + 0 => bail!("No local wallets found."), 1 => Ok(filter_wallet_file_extension(&wallet_files[0])), _ => get_wallet_selection(wallet_files), }?; @@ -152,15 +146,15 @@ pub(crate) fn select_wallet_address() -> Result { .to_string()) } -fn get_wallet_selection(wallet_files: Vec) -> Result { +fn get_wallet_selection(wallet_files: Vec) -> Result { list_wallets(&wallet_files); let selected_index = get_wallet_selection_input("Select by index:") .parse::() - .map_err(|_| Error::InvalidSelection)?; + .map_err(|_| eyre!("Invalid wallet selection input"))?; if selected_index < 1 || selected_index > wallet_files.len() { - return Err(Error::InvalidSelection); + bail!("Invalid wallet selection input"); } Ok(filter_wallet_file_extension( @@ -192,9 +186,9 @@ fn list_wallets(wallet_files: &[String]) { table.printstd(); } -fn get_wallet_files(wallets_folder: &PathBuf) -> Result, Error> { +fn get_wallet_files(wallets_folder: &PathBuf) -> Result> { let wallet_files = std::fs::read_dir(wallets_folder) - .map_err(|_| Error::WalletsFolderNotFound)? + .map_err(|e| eyre!("Failed to read wallets folder: {e}"))? .filter_map(Result::ok) .filter_map(|dir_entry| dir_entry.file_name().into_string().ok()) .filter(|file_name| { diff --git a/ant-cli/src/wallet/mod.rs b/ant-cli/src/wallet/mod.rs index ae95594a1b..b24ecf9d97 100644 --- a/ant-cli/src/wallet/mod.rs +++ b/ant-cli/src/wallet/mod.rs @@ -7,24 +7,23 @@ // permissions and limitations relating to use of the SAFE Network Software. use crate::keys::{get_secret_key_from_env, load_evm_wallet_from_env}; -use crate::wallet::fs::{select_wallet, select_wallet_private_key}; +use crate::wallet::fs::{select_wallet_from_disk, select_wallet_private_key}; use autonomi::{Network, Wallet}; pub(crate) mod encryption; -pub(crate) mod error; pub(crate) mod fs; pub(crate) mod input; pub const DUMMY_NETWORK: Network = Network::ArbitrumSepolia; /// Load wallet from ENV or disk -pub(crate) fn load_wallet() -> color_eyre::Result { +pub(crate) fn load_wallet(evm_network: &Network) -> color_eyre::Result { // First try wallet from ENV - if let Ok(wallet) = load_evm_wallet_from_env() { + if let Ok(wallet) = load_evm_wallet_from_env(evm_network) { return Ok(wallet); } - let wallet = select_wallet()?; + let wallet = select_wallet_from_disk(evm_network)?; Ok(wallet) } diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index 697e405bbb..45f16a3f47 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -63,7 +63,8 @@ pub use ant_protocol::CLOSE_GROUP_SIZE; pub struct Client { pub(crate) network: Network, pub(crate) client_event_sender: Arc>>, - pub(crate) evm_network: EvmNetwork, + /// The EVM network to use for the client. + pub evm_network: EvmNetwork, } /// Configuration for [`Client::init_with_config`]. @@ -92,7 +93,7 @@ pub enum ConnectError { TimedOutWithIncompatibleProtocol(HashSet, String), /// An error occurred while bootstrapping the client. - #[error("Failed to bootstrap the client")] + #[error("Failed to bootstrap the client: {0}")] Bootstrap(#[from] ant_bootstrap::Error), } @@ -254,10 +255,6 @@ impl Client { client_event_receiver } - - pub fn set_evm_network(&mut self, evm_network: EvmNetwork) { - self.evm_network = evm_network; - } } fn build_client_and_run_swarm(local: bool) -> (Network, mpsc::Receiver) { diff --git a/test-utils/src/evm.rs b/test-utils/src/evm.rs index 05eb710bde..989da8b1a4 100644 --- a/test-utils/src/evm.rs +++ b/test-utils/src/evm.rs @@ -10,12 +10,11 @@ use color_eyre::{ eyre::{bail, Context}, Result, }; -use evmlib::{utils::get_evm_network_from_env, wallet::Wallet, Network}; +use evmlib::{utils::local_evm_network_from_csv, wallet::Wallet, Network}; use std::env; pub fn get_funded_wallet() -> evmlib::wallet::Wallet { - let network = - get_evm_network_from_env().expect("Failed to get EVM network from environment variables"); + let network = local_evm_network_from_csv().expect("Failed to get local EVM network from CSV"); if matches!(network, Network::ArbitrumOne) { panic!("You're trying to use ArbitrumOne network. Use a custom network for testing."); } @@ -29,8 +28,8 @@ pub fn get_funded_wallet() -> evmlib::wallet::Wallet { } pub fn get_new_wallet() -> Result { - let network = get_evm_network_from_env() - .wrap_err("Failed to get EVM network from environment variables")?; + let network = + local_evm_network_from_csv().wrap_err("Failed to get local EVM network from CSV")?; if matches!(network, Network::ArbitrumOne) { bail!("You're trying to use ArbitrumOne network. Use a custom network for testing."); } From 854582a434dc12c8e64bd06a5eff04d16b5d83e4 Mon Sep 17 00:00:00 2001 From: grumbach Date: Tue, 7 Jan 2025 02:08:43 +0900 Subject: [PATCH 09/38] feat: local mode in config --- autonomi/src/client/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index 45f16a3f47..2f11877623 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -160,6 +160,7 @@ impl Client { let peers_args = PeersArgs { disable_mainnet_contacts: config.local, addrs: config.peers.unwrap_or_default(), + local: config.local, ..Default::default() }; From 7af69db2ef1b000b5d66c2768f0c88b630286eb6 Mon Sep 17 00:00:00 2001 From: Chris O'Neil Date: Mon, 6 Jan 2025 19:09:45 +0000 Subject: [PATCH 10/38] chore(release): release candidate 2024.12.1.8 ================== Crate Versions ================== ant-bootstrap: 0.1.3-rc.1 ant-build-info: 0.1.23-rc.1 ant-cli: 0.3.3-rc.1 ant-evm: 0.1.8-rc.1 ant-logging: 0.2.44-rc.1 ant-metrics: 0.1.24-rc.1 ant-networking: 0.3.3-rc.1 ant-node: 0.3.3-rc.1 ant-node-manager: 0.11.7-rc.1 ant-node-rpc-client: 0.6.40-rc.1 ant-protocol: 0.3.3-rc.1 ant-registers: 0.4.7-rc.1 ant-service-management: 0.4.7-rc.1 ant-token-supplies: 0.1.62-rc.1 autonomi: 0.3.3-rc.1 evmlib: 0.1.8-rc.1 evm-testnet: 0.1.8-rc.1 nat-detection: 0.2.15-rc.1 node-launchpad: 0.5.3-rc.1 test-utils: 0.4.15-rc.1 =================== Binary Versions =================== ant: 0.3.3-rc.1 antctl: 0.11.7-rc.1 antctld: 0.11.7-rc.1 antnode: 0.3.3-rc.1 antnode_rpc_client: 0.6.40-rc.1 nat-detection: 0.2.15-rc.1 node-launchpad: 0.5.3-rc.1 --- Cargo.lock | 40 +++++++++++++++--------------- ant-bootstrap/Cargo.toml | 6 ++--- ant-build-info/Cargo.toml | 2 +- ant-build-info/src/release_info.rs | 2 +- ant-cli/Cargo.toml | 14 +++++------ ant-evm/Cargo.toml | 4 +-- ant-logging/Cargo.toml | 2 +- ant-metrics/Cargo.toml | 2 +- ant-networking/Cargo.toml | 12 ++++----- ant-node-manager/Cargo.toml | 14 +++++------ ant-node-rpc-client/Cargo.toml | 12 ++++----- ant-node/Cargo.toml | 24 +++++++++--------- ant-protocol/Cargo.toml | 8 +++--- ant-registers/Cargo.toml | 2 +- ant-service-management/Cargo.toml | 10 ++++---- ant-token-supplies/Cargo.toml | 2 +- autonomi/Cargo.toml | 16 ++++++------ evm-testnet/Cargo.toml | 6 ++--- evmlib/Cargo.toml | 2 +- nat-detection/Cargo.toml | 8 +++--- node-launchpad/Cargo.toml | 14 +++++------ release-cycle-info | 2 +- test-utils/Cargo.toml | 4 +-- 23 files changed, 104 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 50648792ee..78d65fa20f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -773,7 +773,7 @@ dependencies = [ [[package]] name = "ant-bootstrap" -version = "0.1.2" +version = "0.1.3-rc.1" dependencies = [ "ant-logging", "ant-protocol", @@ -798,7 +798,7 @@ dependencies = [ [[package]] name = "ant-build-info" -version = "0.1.22" +version = "0.1.23-rc.1" dependencies = [ "chrono", "tracing", @@ -807,7 +807,7 @@ dependencies = [ [[package]] name = "ant-cli" -version = "0.3.2" +version = "0.3.3-rc.1" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -838,7 +838,7 @@ dependencies = [ [[package]] name = "ant-evm" -version = "0.1.7" +version = "0.1.8-rc.1" dependencies = [ "custom_debug", "evmlib", @@ -861,7 +861,7 @@ dependencies = [ [[package]] name = "ant-logging" -version = "0.2.43" +version = "0.2.44-rc.1" dependencies = [ "chrono", "color-eyre", @@ -886,7 +886,7 @@ dependencies = [ [[package]] name = "ant-metrics" -version = "0.1.23" +version = "0.1.24-rc.1" dependencies = [ "clap", "color-eyre", @@ -900,7 +900,7 @@ dependencies = [ [[package]] name = "ant-networking" -version = "0.3.2" +version = "0.3.3-rc.1" dependencies = [ "aes-gcm-siv", "ant-bootstrap", @@ -948,7 +948,7 @@ dependencies = [ [[package]] name = "ant-node" -version = "0.3.2" +version = "0.3.3-rc.1" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -1006,7 +1006,7 @@ dependencies = [ [[package]] name = "ant-node-manager" -version = "0.11.6" +version = "0.11.7-rc.1" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -1049,7 +1049,7 @@ dependencies = [ [[package]] name = "ant-node-rpc-client" -version = "0.6.39" +version = "0.6.40-rc.1" dependencies = [ "ant-build-info", "ant-logging", @@ -1073,7 +1073,7 @@ dependencies = [ [[package]] name = "ant-protocol" -version = "0.3.2" +version = "0.3.3-rc.1" dependencies = [ "ant-build-info", "ant-evm", @@ -1103,7 +1103,7 @@ dependencies = [ [[package]] name = "ant-registers" -version = "0.4.6" +version = "0.4.7-rc.1" dependencies = [ "blsttc", "crdts", @@ -1140,7 +1140,7 @@ dependencies = [ [[package]] name = "ant-service-management" -version = "0.4.6" +version = "0.4.7-rc.1" dependencies = [ "ant-bootstrap", "ant-evm", @@ -1167,7 +1167,7 @@ dependencies = [ [[package]] name = "ant-token-supplies" -version = "0.1.61" +version = "0.1.62-rc.1" dependencies = [ "dirs-next", "reqwest 0.11.27", @@ -1591,7 +1591,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "autonomi" -version = "0.3.2" +version = "0.3.3-rc.1" dependencies = [ "alloy", "ant-bootstrap", @@ -3356,7 +3356,7 @@ dependencies = [ [[package]] name = "evm-testnet" -version = "0.1.7" +version = "0.1.8-rc.1" dependencies = [ "ant-evm", "clap", @@ -3367,7 +3367,7 @@ dependencies = [ [[package]] name = "evmlib" -version = "0.1.7" +version = "0.1.8-rc.1" dependencies = [ "alloy", "dirs-next", @@ -6284,7 +6284,7 @@ dependencies = [ [[package]] name = "nat-detection" -version = "0.2.14" +version = "0.2.15-rc.1" dependencies = [ "ant-build-info", "ant-networking", @@ -6401,7 +6401,7 @@ dependencies = [ [[package]] name = "node-launchpad" -version = "0.5.2" +version = "0.5.3-rc.1" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -9321,7 +9321,7 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "test-utils" -version = "0.4.14" +version = "0.4.15-rc.1" dependencies = [ "bytes", "color-eyre", diff --git a/ant-bootstrap/Cargo.toml b/ant-bootstrap/Cargo.toml index ef72f7a85d..ed7d377ba6 100644 --- a/ant-bootstrap/Cargo.toml +++ b/ant-bootstrap/Cargo.toml @@ -7,14 +7,14 @@ license = "GPL-3.0" name = "ant-bootstrap" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.2" +version = "0.1.3-rc.1" [features] local = [] [dependencies] -ant-logging = { path = "../ant-logging", version = "0.2.43" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2" } +ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } atomic-write-file = "0.2.2" chrono = { version = "0.4", features = ["serde"] } clap = { version = "4.2.1", features = ["derive", "env"] } diff --git a/ant-build-info/Cargo.toml b/ant-build-info/Cargo.toml index 6a7482355e..2a41fc4f59 100644 --- a/ant-build-info/Cargo.toml +++ b/ant-build-info/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-build-info" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.22" +version = "0.1.23-rc.1" build = "build.rs" include = ["Cargo.toml", "src/**/*", "build.rs"] diff --git a/ant-build-info/src/release_info.rs b/ant-build-info/src/release_info.rs index 74f6d99021..c87bb79fe8 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 = "7"; +pub const RELEASE_CYCLE_COUNTER: &str = "8"; diff --git a/ant-cli/Cargo.toml b/ant-cli/Cargo.toml index 52bc8916eb..ef864f4715 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.2" +version = "0.3.3-rc.1" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" @@ -24,11 +24,11 @@ name = "files" harness = false [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.2" } -ant-build-info = { path = "../ant-build-info", version = "0.1.22" } -ant-logging = { path = "../ant-logging", version = "0.2.43" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2" } -autonomi = { path = "../autonomi", version = "0.3.2", features = [ +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } +ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } +autonomi = { path = "../autonomi", version = "0.3.3-rc.1", 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.2", features = ["fs"]} +autonomi = { path = "../autonomi", version = "0.3.3-rc.1", features = ["fs"]} criterion = "0.5.1" eyre = "0.6.8" rand = { version = "~0.8.5", features = ["small_rng"] } diff --git a/ant-evm/Cargo.toml b/ant-evm/Cargo.toml index 691f07cc5d..9eb8a8b14c 100644 --- a/ant-evm/Cargo.toml +++ b/ant-evm/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-evm" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.7" +version = "0.1.8-rc.1" [features] local = ["evmlib/local"] @@ -16,7 +16,7 @@ test-utils = [] [dependencies] custom_debug = "~0.6.1" -evmlib = { path = "../evmlib", version = "0.1.7" } +evmlib = { path = "../evmlib", version = "0.1.8-rc.1" } hex = "~0.4.3" lazy_static = "~1.4.0" libp2p = { version = "0.54.1", features = ["identify", "kad"] } diff --git a/ant-logging/Cargo.toml b/ant-logging/Cargo.toml index 33ad706228..309aa6c2b6 100644 --- a/ant-logging/Cargo.toml +++ b/ant-logging/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-logging" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.2.43" +version = "0.2.44-rc.1" [dependencies] chrono = "~0.4.19" diff --git a/ant-metrics/Cargo.toml b/ant-metrics/Cargo.toml index ded374da71..72f01cff41 100644 --- a/ant-metrics/Cargo.toml +++ b/ant-metrics/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-metrics" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.23" +version = "0.1.24-rc.1" [[bin]] path = "src/main.rs" diff --git a/ant-networking/Cargo.toml b/ant-networking/Cargo.toml index 966b7d4d6f..c6234bdd69 100644 --- a/ant-networking/Cargo.toml +++ b/ant-networking/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-networking" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.3.2" +version = "0.3.3-rc.1" [features] default = [] @@ -20,11 +20,11 @@ upnp = ["libp2p/upnp"] [dependencies] aes-gcm-siv = "0.11.1" -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.2" } -ant-build-info = { path = "../ant-build-info", version = "0.1.22" } -ant-evm = { path = "../ant-evm", version = "0.1.7" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2" } -ant-registers = { path = "../ant-registers", version = "0.4.6" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } +ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } +ant-registers = { path = "../ant-registers", version = "0.4.7-rc.1" } async-trait = "0.1" bytes = { version = "1.0.1", features = ["serde"] } custom_debug = "~0.6.1" diff --git a/ant-node-manager/Cargo.toml b/ant-node-manager/Cargo.toml index 6d54bed2f5..1d5fd72b59 100644 --- a/ant-node-manager/Cargo.toml +++ b/ant-node-manager/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-node-manager" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.11.6" +version = "0.11.7-rc.1" [[bin]] name = "antctl" @@ -30,13 +30,13 @@ tcp = [] websockets = [] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.2" } -ant-build-info = { path = "../ant-build-info", version = "0.1.22" } -ant-evm = { path = "../ant-evm", version = "0.1.7" } -ant-logging = { path = "../ant-logging", version = "0.2.43" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } +ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } +ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } ant-releases = { version = "0.4.0" } -ant-service-management = { path = "../ant-service-management", version = "0.4.6" } +ant-service-management = { path = "../ant-service-management", version = "0.4.7-rc.1" } chrono = "~0.4.19" clap = { version = "4.4.6", features = ["derive", "env"] } colored = "2.0.4" diff --git a/ant-node-rpc-client/Cargo.toml b/ant-node-rpc-client/Cargo.toml index 8962d19ae2..0388c465a2 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.39" +version = "0.6.40-rc.1" [[bin]] name = "antnode_rpc_client" @@ -17,11 +17,11 @@ path = "src/main.rs" nightly = [] [dependencies] -ant-build-info = { path = "../ant-build-info", version = "0.1.22" } -ant-logging = { path = "../ant-logging", version = "0.2.43" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2", features=["rpc"] } -ant-node = { path = "../ant-node", version = "0.3.2" } -ant-service-management = { path = "../ant-service-management", version = "0.4.6" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } +ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1", features=["rpc"] } +ant-node = { path = "../ant-node", version = "0.3.3-rc.1" } +ant-service-management = { path = "../ant-service-management", version = "0.4.7-rc.1" } async-trait = "0.1" bls = { package = "blsttc", version = "8.0.1" } clap = { version = "4.2.1", features = ["derive"] } diff --git a/ant-node/Cargo.toml b/ant-node/Cargo.toml index 0de618b1cd..f08d6b2816 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.2" +version = "0.3.3-rc.1" edition = "2021" license = "GPL-3.0" homepage = "https://maidsafe.net" @@ -26,14 +26,14 @@ otlp = ["ant-logging/otlp"] upnp = ["ant-networking/upnp"] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.2" } -ant-build-info = { path = "../ant-build-info", version = "0.1.22" } -ant-evm = { path = "../ant-evm", version = "0.1.7" } -ant-logging = { path = "../ant-logging", version = "0.2.43" } -ant-networking = { path = "../ant-networking", version = "0.3.2" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2" } -ant-registers = { path = "../ant-registers", version = "0.4.6" } -ant-service-management = { path = "../ant-service-management", version = "0.4.6" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } +ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } +ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } +ant-networking = { path = "../ant-networking", version = "0.3.3-rc.1" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } +ant-registers = { path = "../ant-registers", version = "0.4.7-rc.1" } +ant-service-management = { path = "../ant-service-management", version = "0.4.7-rc.1" } async-trait = "0.1" bls = { package = "blsttc", version = "8.0.1" } bytes = { version = "1.0.1", features = ["serde"] } @@ -83,10 +83,10 @@ walkdir = "~2.5.0" xor_name = "5.0.0" [dev-dependencies] -ant-protocol = { path = "../ant-protocol", version = "0.3.2", features = ["rpc"] } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1", features = ["rpc"] } assert_fs = "1.0.0" -evmlib = { path = "../evmlib", version = "0.1.7" } -autonomi = { path = "../autonomi", version = "0.3.2", features = ["registers"] } +evmlib = { path = "../evmlib", version = "0.1.8-rc.1" } +autonomi = { path = "../autonomi", version = "0.3.3-rc.1", features = ["registers"] } reqwest = { version = "0.12.2", default-features = false, features = [ "rustls-tls-manual-roots", ] } diff --git a/ant-protocol/Cargo.toml b/ant-protocol/Cargo.toml index d0afab1c15..7ad2b147df 100644 --- a/ant-protocol/Cargo.toml +++ b/ant-protocol/Cargo.toml @@ -7,16 +7,16 @@ license = "GPL-3.0" name = "ant-protocol" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.3.2" +version = "0.3.3-rc.1" [features] default = [] rpc = ["tonic", "prost"] [dependencies] -ant-build-info = { path = "../ant-build-info", version = "0.1.22" } -ant-evm = { path = "../ant-evm", version = "0.1.7" } -ant-registers = { path = "../ant-registers", version = "0.4.6" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } +ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } +ant-registers = { path = "../ant-registers", version = "0.4.7-rc.1" } bls = { package = "blsttc", version = "8.0.1" } bytes = { version = "1.0.1", features = ["serde"] } color-eyre = "0.6.2" diff --git a/ant-registers/Cargo.toml b/ant-registers/Cargo.toml index e021f361cf..2a16fe7d5c 100644 --- a/ant-registers/Cargo.toml +++ b/ant-registers/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-registers" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.4.6" +version = "0.4.7-rc.1" [features] test-utils = [] diff --git a/ant-service-management/Cargo.toml b/ant-service-management/Cargo.toml index 519045aed4..8807ebca0d 100644 --- a/ant-service-management/Cargo.toml +++ b/ant-service-management/Cargo.toml @@ -7,13 +7,13 @@ license = "GPL-3.0" name = "ant-service-management" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.4.6" +version = "0.4.7-rc.1" [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.2" } -ant-evm = { path = "../ant-evm", version = "0.1.7" } -ant-logging = { path = "../ant-logging", version = "0.2.43" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2", features = ["rpc"] } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } +ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } +ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1", features = ["rpc"] } async-trait = "0.1" dirs-next = "2.0.0" libp2p = { version = "0.54.1", features = ["kad"] } diff --git a/ant-token-supplies/Cargo.toml b/ant-token-supplies/Cargo.toml index a26791770b..6dce7fb675 100644 --- a/ant-token-supplies/Cargo.toml +++ b/ant-token-supplies/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-token-supplies" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.61" +version = "0.1.62-rc.1" [dependencies] diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 61d7767ab3..5b61200e11 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.2" +version = "0.3.3-rc.1" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" @@ -33,11 +33,11 @@ registers = [] vault = ["registers"] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.2" } -ant-evm = { path = "../ant-evm", version = "0.1.7" } -ant-networking = { path = "../ant-networking", version = "0.3.2" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2" } -ant-registers = { path = "../ant-registers", version = "0.4.6" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } +ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } +ant-networking = { path = "../ant-networking", version = "0.3.3-rc.1" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } +ant-registers = { path = "../ant-registers", version = "0.4.7-rc.1" } bip39 = "2.0.0" blst = "0.3.13" blstrs = "0.7.1" @@ -68,7 +68,7 @@ xor_name = "5.0.0" [dev-dependencies] alloy = { version = "0.7.3", default-features = false, features = ["contract", "json-rpc", "network", "node-bindings", "provider-http", "reqwest-rustls-tls", "rpc-client", "rpc-types", "signer-local", "std"] } -ant-logging = { path = "../ant-logging", version = "0.2.43" } +ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } eyre = "0.6.5" sha2 = "0.10.6" # Do not specify the version field. Release process expects even the local dev deps to be published. @@ -80,7 +80,7 @@ wasm-bindgen-test = "0.3.43" [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1.7" -evmlib = { path = "../evmlib", version = "0.1.7", features = ["wasm-bindgen"] } +evmlib = { path = "../evmlib", version = "0.1.8-rc.1", features = ["wasm-bindgen"] } # See https://github.com/sebcrozet/instant/blob/7bd13f51f5c930239fddc0476a837870fb239ed7/README.md#using-instant-for-a-wasm-platform-where-performancenow-is-not-available instant = { version = "0.1", features = ["wasm-bindgen", "inaccurate"] } js-sys = "0.3.70" diff --git a/evm-testnet/Cargo.toml b/evm-testnet/Cargo.toml index c843aefdad..953ea4d267 100644 --- a/evm-testnet/Cargo.toml +++ b/evm-testnet/Cargo.toml @@ -6,13 +6,13 @@ homepage = "https://maidsafe.net" license = "GPL-3.0" name = "evm-testnet" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.7" +version = "0.1.8-rc.1" [dependencies] -ant-evm = { path = "../ant-evm", version = "0.1.7" } +ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } clap = { version = "4.5", features = ["derive"] } dirs-next = "~2.0.0" -evmlib = { path = "../evmlib", version = "0.1.7" } +evmlib = { path = "../evmlib", version = "0.1.8-rc.1" } tokio = { version = "1.40", features = ["rt-multi-thread", "signal"] } [lints] diff --git a/evmlib/Cargo.toml b/evmlib/Cargo.toml index b2ed695a04..1512c69452 100644 --- a/evmlib/Cargo.toml +++ b/evmlib/Cargo.toml @@ -6,7 +6,7 @@ homepage = "https://maidsafe.net" license = "GPL-3.0" name = "evmlib" repository = "https://github.com/maidsafe/safe_network" -version = "0.1.7" +version = "0.1.8-rc.1" [features] wasm-bindgen = ["alloy/wasm-bindgen"] diff --git a/nat-detection/Cargo.toml b/nat-detection/Cargo.toml index 4e8b4ccae9..899842e9f0 100644 --- a/nat-detection/Cargo.toml +++ b/nat-detection/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "nat-detection" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.2.14" +version = "0.2.15-rc.1" [[bin]] name = "nat-detection" @@ -17,9 +17,9 @@ path = "src/main.rs" nightly = [] [dependencies] -ant-build-info = { path = "../ant-build-info", version = "0.1.22" } -ant-networking = { path = "../ant-networking", version = "0.3.2" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } +ant-networking = { path = "../ant-networking", version = "0.3.3-rc.1" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } clap = { version = "4.5.4", features = ["derive"] } clap-verbosity-flag = "2.2.0" color-eyre = { version = "0.6", default-features = false } diff --git a/node-launchpad/Cargo.toml b/node-launchpad/Cargo.toml index 362421a3d9..14290613cd 100644 --- a/node-launchpad/Cargo.toml +++ b/node-launchpad/Cargo.toml @@ -2,7 +2,7 @@ authors = ["MaidSafe Developers "] description = "TUI for running nodes on the Autonomi network" name = "node-launchpad" -version = "0.5.2" +version = "0.5.3-rc.1" edition = "2021" license = "GPL-3.0" homepage = "https://maidsafe.net" @@ -18,13 +18,13 @@ path = "src/bin/tui/main.rs" nightly = [] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.2" } -ant-build-info = { path = "../ant-build-info", version = "0.1.22" } -ant-evm = { path = "../ant-evm", version = "0.1.7" } -ant-node-manager = { version = "0.11.6", path = "../ant-node-manager" } -ant-protocol = { path = "../ant-protocol", version = "0.3.2" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } +ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } +ant-node-manager = { version = "0.11.7-rc.1", path = "../ant-node-manager" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } ant-releases = { version = "0.4.0" } -ant-service-management = { version = "0.4.6", path = "../ant-service-management" } +ant-service-management = { version = "0.4.7-rc.1", path = "../ant-service-management" } arboard = "3.4.1" atty = "0.2.14" better-panic = "0.3.0" diff --git a/release-cycle-info b/release-cycle-info index f06fab042a..1ec5651cc4 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: 7 +release-cycle-counter: 8 diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 659717380b..d7a5669474 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -7,13 +7,13 @@ license = "GPL-3.0" name = "test-utils" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.4.14" +version = "0.4.15-rc.1" [dependencies] bytes = { version = "1.0.1", features = ["serde"] } color-eyre = "~0.6.2" dirs-next = "~2.0.0" -evmlib = { path = "../evmlib", version = "0.1.7" } +evmlib = { path = "../evmlib", version = "0.1.8-rc.1" } libp2p = { version = "0.54.1", features = ["identify", "kad"] } rand = "0.8.5" serde = { version = "1.0.133", features = ["derive"] } From 6ec9478fd7a958ad2eefd53f4b3132e641886eb9 Mon Sep 17 00:00:00 2001 From: Roland Sherwin Date: Tue, 24 Dec 2024 17:11:37 +0530 Subject: [PATCH 11/38] feat: do not try to discovery peers for full buckets --- ant-networking/src/bootstrap.rs | 27 +++++++++++++++++++++++-- ant-networking/src/network_discovery.rs | 14 ++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/ant-networking/src/bootstrap.rs b/ant-networking/src/bootstrap.rs index e6926f695e..c03fa52a61 100644 --- a/ant-networking/src/bootstrap.rs +++ b/ant-networking/src/bootstrap.rs @@ -7,6 +7,7 @@ // permissions and limitations relating to use of the SAFE Network Software. use crate::{driver::PendingGetClosestType, SwarmDriver}; +use libp2p::kad::K_VALUE; use rand::{rngs::OsRng, Rng}; use tokio::time::Duration; @@ -25,7 +26,7 @@ const NETWORK_DISCOVER_CONNECTED_PEERS_STEP: u32 = 5; const LAST_PEER_ADDED_TIME_LIMIT: Duration = Duration::from_secs(180); /// A minimum interval to prevent network discovery got triggered too often -const LAST_NETWORK_DISCOVER_TRIGGERED_TIME_LIMIT: Duration = Duration::from_secs(30); +const LAST_NETWORK_DISCOVER_TRIGGERED_TIME_LIMIT: Duration = Duration::from_secs(90); /// The network discovery interval to use if we haven't added any new peers in a while. const NO_PEER_ADDED_SLOWDOWN_INTERVAL_MAX_S: u64 = 600; @@ -50,8 +51,30 @@ impl SwarmDriver { pub(crate) fn trigger_network_discovery(&mut self) { let now = Instant::now(); + + // Find the farthest bucket that is not full. This is used to skip refreshing the RT of farthest full buckets. + let mut farthest_unfilled_bucket = 0; + for kbucket in self.swarm.behaviour_mut().kademlia.kbuckets() { + let Some(ilog2) = kbucket.range().0.ilog2() else { + continue; + }; + if kbucket.num_entries() < K_VALUE.get() && ilog2 > farthest_unfilled_bucket { + farthest_unfilled_bucket = ilog2; + } + } + let farthest_unfilled_bucket = if farthest_unfilled_bucket == 0 { + None + } else { + Some(farthest_unfilled_bucket) + }; + + let addrs = self.network_discovery.candidates(farthest_unfilled_bucket); + info!( + "Triggering network discovery with {} candidates. Farthest non full bucket: {farthest_unfilled_bucket:?}", + addrs.len() + ); // Fetches the candidates and also generates new candidates - for addr in self.network_discovery.candidates() { + for addr in addrs { // The query_id is tracked here. This is to update the candidate list of network_discovery with the newly // found closest peers. It may fill up the candidate list of closer buckets which are harder to generate. let query_id = self diff --git a/ant-networking/src/network_discovery.rs b/ant-networking/src/network_discovery.rs index 838cf685c0..c0932b6c2f 100644 --- a/ant-networking/src/network_discovery.rs +++ b/ant-networking/src/network_discovery.rs @@ -82,14 +82,22 @@ impl NetworkDiscovery { } /// Returns one random candidate per bucket. Also tries to refresh the candidate list. - /// Todo: Limit the candidates to return. Favor the closest buckets. - pub(crate) fn candidates(&mut self) -> Vec<&NetworkAddress> { + /// Set the farthest_bucket to get candidates that are closer than or equal to the farthest_bucket. + pub(crate) fn candidates(&mut self, farthest_bucket: Option) -> Vec<&NetworkAddress> { self.try_refresh_candidates(); let mut rng = thread_rng(); let mut op = Vec::with_capacity(self.candidates.len()); - let candidates = self.candidates.values().filter_map(|candidates| { + let candidates = self.candidates.iter().filter_map(|(ilog2, candidates)| { + if let Some(farthest_bucket) = farthest_bucket { + if *ilog2 > farthest_bucket { + debug!( + "Skipping candidates for ilog2: {ilog2} as it is greater than farthest_bucket: {farthest_bucket}" + ); + return None; + } + } // get a random index each time let random_index = rng.gen::() % candidates.len(); candidates.get(random_index) From 010b6db1b47a784521b1a5df09c6eb5b84dc03cb Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Tue, 7 Jan 2025 10:55:30 +0100 Subject: [PATCH 12/38] fix(node): evm network initialization logic --- ant-node/src/bin/antnode/main.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ant-node/src/bin/antnode/main.rs b/ant-node/src/bin/antnode/main.rs index fab6abcfb6..2ee4cc6d34 100644 --- a/ant-node/src/bin/antnode/main.rs +++ b/ant-node/src/bin/antnode/main.rs @@ -262,16 +262,17 @@ fn main() -> Result<()> { return Ok(()); } - let evm_network: EvmNetwork = if opt.peers.local { - println!("Running node in local mode"); - local_evm_network_from_csv()? - } else { - opt.evm_network - .as_ref() - .cloned() - .map(|v| Ok(v.into())) - .unwrap_or_else(get_evm_network_from_env)? - }; + let evm_network: EvmNetwork = match opt.evm_network.as_ref() { + Some(evm_network) => Ok(evm_network.clone().into()), + None => match get_evm_network_from_env() { + Ok(evm_network) => Ok(evm_network), + Err(_) if opt.peers.local => Ok(local_evm_network_from_csv()?), + Err(_) => Err(eyre!( + "EVM network not specified. Please specify a network using the subcommand or by setting the `EVM_NETWORK` environment variable." + )), + }, + }?; + println!("EVM network: {evm_network:?}"); let node_socket_addr = SocketAddr::new(opt.ip, opt.port); From f3cf215ae5e4e51bf0712ffb9341d9ca9199f03e Mon Sep 17 00:00:00 2001 From: grumbach Date: Wed, 8 Jan 2025 00:29:23 +0900 Subject: [PATCH 13/38] chore: remove expects --- ant-cli/src/commands/wallet.rs | 6 +++--- ant-cli/src/wallet/encryption.rs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ant-cli/src/commands/wallet.rs b/ant-cli/src/commands/wallet.rs index 5f123dcb68..4bfe385b26 100644 --- a/ant-cli/src/commands/wallet.rs +++ b/ant-cli/src/commands/wallet.rs @@ -22,7 +22,7 @@ pub fn create(no_password: bool, password: Option) -> Result<()> { let wallet_private_key = Wallet::random_private_key(); let wallet_address = Wallet::new_from_private_key(DUMMY_NETWORK, &wallet_private_key) - .expect("Infallible") + .map_err(|e| eyre!("Unexpected error: Failed to create wallet from private key: {e}"))? .address() .to_string(); @@ -48,7 +48,7 @@ pub fn import( let maybe_encryption_password = maybe_request_password(no_password, password)?; let wallet_address = Wallet::new_from_private_key(DUMMY_NETWORK, &wallet_private_key) - .expect("Infallible") + .map_err(|e| eyre!("Unexpected error: Failed to create wallet from private key: {e}"))? .address() .to_string(); @@ -70,7 +70,7 @@ pub fn export() -> Result<()> { let wallet_private_key = select_wallet_private_key()?; let wallet_address = Wallet::new_from_private_key(DUMMY_NETWORK, &wallet_private_key) - .expect("Infallible") + .map_err(|e| eyre!("Failed to create wallet from private key loaded from disk: {e}"))? .address() .to_string(); diff --git a/ant-cli/src/wallet/encryption.rs b/ant-cli/src/wallet/encryption.rs index 1ea081e088..bbad0cc2f7 100644 --- a/ant-cli/src/wallet/encryption.rs +++ b/ant-cli/src/wallet/encryption.rs @@ -123,7 +123,8 @@ pub fn decrypt_private_key(encrypted_data: &str, password: &str) -> Result Date: Tue, 7 Jan 2025 16:17:25 +0100 Subject: [PATCH 14/38] chore: set default evm network to Arbitrum Sepolia --- evmlib/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evmlib/src/lib.rs b/evmlib/src/lib.rs index e2715c0ed6..480ac8270b 100644 --- a/evmlib/src/lib.rs +++ b/evmlib/src/lib.rs @@ -78,8 +78,8 @@ impl CustomNetwork { #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] pub enum Network { - #[default] ArbitrumOne, + #[default] ArbitrumSepolia, Custom(CustomNetwork), } From 904b20139f742977e059e2caa45e62e930475553 Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Tue, 7 Jan 2025 16:18:30 +0100 Subject: [PATCH 15/38] Merge pull request maidsafe#2609 --- autonomi/src/client/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index 2f11877623..39940c41e2 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -79,6 +79,9 @@ pub struct ClientConfig { /// /// If not provided, the client will use the default bootstrap peers. pub peers: Option>, + + /// EVM network to use for quotations and payments. + pub evm_network: EvmNetwork, } /// Error returned by [`Client::init`]. @@ -136,6 +139,7 @@ impl Client { Self::init_with_config(ClientConfig { local, peers: Some(peers), + evm_network: Default::default(), }) .await } From 339b13f2de9c75a83b0492f3d2c3c8fe972cf4f1 Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Tue, 7 Jan 2025 17:57:16 +0100 Subject: [PATCH 16/38] refactor: get evm network from single source --- ant-cli/src/actions/connect.rs | 24 ++++++++++++++++++------ ant-cli/src/commands.rs | 2 +- ant-cli/src/commands/wallet.rs | 7 ++++--- ant-cli/src/evm_network.rs | 24 ++++++++++++++++++++++++ ant-cli/src/main.rs | 1 + autonomi/src/client/mod.rs | 2 +- autonomi/src/lib.rs | 1 + 7 files changed, 50 insertions(+), 11 deletions(-) create mode 100644 ant-cli/src/evm_network.rs diff --git a/ant-cli/src/actions/connect.rs b/ant-cli/src/actions/connect.rs index 091c87e1c8..5ae12694ad 100644 --- a/ant-cli/src/actions/connect.rs +++ b/ant-cli/src/actions/connect.rs @@ -6,14 +6,14 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use autonomi::Client; +use crate::evm_network::get_evm_network; +use crate::network::NetworkPeers; +use autonomi::{Client, ClientConfig}; use color_eyre::eyre::bail; use color_eyre::eyre::Result; use indicatif::ProgressBar; use std::time::Duration; -use crate::network::NetworkPeers; - pub async fn connect_to_network(peers: NetworkPeers) -> Result { let progress_bar = ProgressBar::new_spinner(); progress_bar.enable_steady_tick(Duration::from_millis(120)); @@ -21,14 +21,26 @@ pub async fn connect_to_network(peers: NetworkPeers) -> Result { let new_style = progress_bar.style().tick_chars("⠁⠂⠄⡀⢀⠠⠐⠈🔗"); progress_bar.set_style(new_style); - let res = if peers.is_local() { + let local = peers.is_local(); + + let peers_opt = if local { progress_bar.set_message("Connecting to a local Autonomi Network..."); - Client::init_local().await + None } else { progress_bar.set_message("Connecting to The Autonomi Network..."); - Client::init_with_peers(peers.peers().to_vec()).await + Some(peers.peers().to_vec()) }; + let evm_network = get_evm_network(local)?; + + let config = ClientConfig { + local, + peers: peers_opt, + evm_network, + }; + + let res = Client::init_with_config(config).await; + match res { Ok(client) => { info!("Connected to the Network"); diff --git a/ant-cli/src/commands.rs b/ant-cli/src/commands.rs index 1bedd25f31..515a1470d8 100644 --- a/ant-cli/src/commands.rs +++ b/ant-cli/src/commands.rs @@ -228,7 +228,7 @@ pub async fn handle_subcommand(opt: Opt) -> Result<()> { password, } => wallet::import(private_key, no_password, password), WalletCmd::Export => wallet::export(), - WalletCmd::Balance => wallet::balance().await, + WalletCmd::Balance => wallet::balance(peers.await?.is_local()).await, }, None => { // If no subcommand is given, default to clap's error behaviour. diff --git a/ant-cli/src/commands/wallet.rs b/ant-cli/src/commands/wallet.rs index 4bfe385b26..c11bc41802 100644 --- a/ant-cli/src/commands/wallet.rs +++ b/ant-cli/src/commands/wallet.rs @@ -6,10 +6,11 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. +use crate::evm_network::get_evm_network; use crate::wallet::fs::{select_wallet_private_key, store_private_key}; use crate::wallet::input::request_password; use crate::wallet::DUMMY_NETWORK; -use autonomi::{get_evm_network_from_env, Wallet}; +use autonomi::Wallet; use color_eyre::eyre::eyre; use color_eyre::Result; use prettytable::{Cell, Row, Table}; @@ -80,8 +81,8 @@ pub fn export() -> Result<()> { Ok(()) } -pub async fn balance() -> Result<()> { - let network = get_evm_network_from_env().unwrap_or_default(); +pub async fn balance(local: bool) -> Result<()> { + let network = get_evm_network(local)?; let wallet = crate::wallet::load_wallet(&network)?; let token_balance = wallet.balance_of_tokens().await?; diff --git a/ant-cli/src/evm_network.rs b/ant-cli/src/evm_network.rs new file mode 100644 index 0000000000..48998f1c0f --- /dev/null +++ b/ant-cli/src/evm_network.rs @@ -0,0 +1,24 @@ +use autonomi::{get_evm_network_from_env, local_evm_network_from_csv, Network}; +use color_eyre::eyre::Result; + +use std::sync::OnceLock; + +static EVM_NETWORK: OnceLock = OnceLock::new(); + +pub(crate) fn get_evm_network(local: bool) -> Result { + if let Some(network) = EVM_NETWORK.get() { + return Ok(network.clone()); + } + + let res = match get_evm_network_from_env() { + Ok(evm_network) => Ok(evm_network), + Err(_) if local => Ok(local_evm_network_from_csv()?), + Err(_) => Ok(Default::default()), + }; + + if let Ok(network) = res.as_ref() { + let _ = EVM_NETWORK.set(network.clone()); + } + + res +} diff --git a/ant-cli/src/main.rs b/ant-cli/src/main.rs index e0fe5cf644..b7f6bc8fcb 100644 --- a/ant-cli/src/main.rs +++ b/ant-cli/src/main.rs @@ -12,6 +12,7 @@ extern crate tracing; mod access; mod actions; mod commands; +mod evm_network; mod opt; mod utils; mod wallet; diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index 39940c41e2..5073a2bd76 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -192,7 +192,7 @@ impl Client { Ok(Self { network, client_event_sender: Arc::new(None), - evm_network: Default::default(), + evm_network: config.evm_network, }) } diff --git a/autonomi/src/lib.rs b/autonomi/src/lib.rs index 99bb92e51d..bfb1d705b2 100644 --- a/autonomi/src/lib.rs +++ b/autonomi/src/lib.rs @@ -66,6 +66,7 @@ pub mod client; pub mod self_encryption; pub use ant_evm::get_evm_network_from_env; +pub use ant_evm::local_evm_network_from_csv; pub use ant_evm::Amount; pub use ant_evm::EvmNetwork as Network; pub use ant_evm::EvmWallet as Wallet; From c0d6bfdb528cd2964f0f339c235e741535d713f6 Mon Sep 17 00:00:00 2001 From: grumbach Date: Wed, 8 Jan 2025 02:01:46 +0900 Subject: [PATCH 17/38] feat: remove local from antctl too --- ant-node-manager/Cargo.toml | 1 - .../src/bin/cli/subcommands/evm_network.rs | 12 +++--------- evmlib/src/utils.rs | 13 ------------- 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/ant-node-manager/Cargo.toml b/ant-node-manager/Cargo.toml index 1cb7610d70..3859f2e054 100644 --- a/ant-node-manager/Cargo.toml +++ b/ant-node-manager/Cargo.toml @@ -20,7 +20,6 @@ path = "src/bin/daemon/main.rs" [features] chaos = [] default = ["quic"] -local = [] nightly = [] open-metrics = [] otlp = [] diff --git a/ant-node-manager/src/bin/cli/subcommands/evm_network.rs b/ant-node-manager/src/bin/cli/subcommands/evm_network.rs index 2d795846cf..94a144f0b3 100644 --- a/ant-node-manager/src/bin/cli/subcommands/evm_network.rs +++ b/ant-node-manager/src/bin/cli/subcommands/evm_network.rs @@ -6,9 +6,9 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use ant_evm::{utils::get_evm_network_from_env, EvmNetwork}; +use ant_evm::{utils::local_evm_network_from_csv, EvmNetwork}; use clap::Subcommand; -use color_eyre::{eyre::Result, Section}; +use color_eyre::Result; #[derive(Subcommand, Clone, Debug)] #[allow(clippy::enum_variant_names)] @@ -46,13 +46,7 @@ impl TryInto for EvmNetworkCommand { Self::EvmArbitrumOne => Ok(EvmNetwork::ArbitrumOne), Self::EvmArbitrumSepolia => Ok(EvmNetwork::ArbitrumSepolia), Self::EvmLocal => { - if !cfg!(feature = "local") { - return Err(color_eyre::eyre::eyre!( - "The 'local' feature flag is not enabled." - )) - .suggestion("Enable the 'local' feature flag to use the local EVM testnet."); - } - let network = get_evm_network_from_env()?; + let network = local_evm_network_from_csv()?; Ok(network) } Self::EvmCustom { diff --git a/evmlib/src/utils.rs b/evmlib/src/utils.rs index 422125fb5a..b63a0292e4 100644 --- a/evmlib/src/utils.rs +++ b/evmlib/src/utils.rs @@ -57,19 +57,6 @@ pub fn get_evm_testnet_csv_path() -> Result { Ok(file) } -/// Create a custom `Network` from the given values -pub fn get_evm_network( - rpc_url: &str, - payment_token_address: &str, - data_payments_address: &str, -) -> Network { - Network::Custom(CustomNetwork::new( - rpc_url, - payment_token_address, - data_payments_address, - )) -} - /// Get the `Network` from environment variables. /// /// Returns an error if we cannot obtain the network from any means. From ede5f34148ca3cba5c5caa705577552b95c31797 Mon Sep 17 00:00:00 2001 From: grumbach Date: Wed, 8 Jan 2025 02:14:41 +0900 Subject: [PATCH 18/38] chore: small cleanups --- README.md | 6 +++--- ant-cli/src/actions/mod.rs | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e110c4811d..a1e582d5b3 100644 --- a/README.md +++ b/README.md @@ -110,15 +110,15 @@ This creates a CSV file with the EVM network params in your data directory. `--rewards-address` _is the address where you will receive your node earnings on._ ```bash -cargo run --bin antctl --features local -- local run --build --clean --rewards-address +cargo run --bin antctl -- local run --build --clean --rewards-address ``` -The EVM Network parameters are loaded from the CSV file in your data directory automatically when the `local` feature flag is enabled (`--features=local`). +The EVM Network parameters are loaded from the CSV file in your data directory automatically when the `local` option is passed to the `antctl` command. ##### 4. Verify node status ```bash -cargo run --bin antctl --features local -- status +cargo run --bin antctl -- status ``` The Antctl `run` command starts the node processes. The `status` command should show twenty-five diff --git a/ant-cli/src/actions/mod.rs b/ant-cli/src/actions/mod.rs index 8b4662c3d9..94b4b3d6ee 100644 --- a/ant-cli/src/actions/mod.rs +++ b/ant-cli/src/actions/mod.rs @@ -12,5 +12,4 @@ mod progress_bar; pub use connect::connect_to_network; pub use download::download; - pub use progress_bar::get_progress_bar; From 178a06459121020feb116afe29cc9c3e527a7980 Mon Sep 17 00:00:00 2001 From: grumbach Date: Wed, 8 Jan 2025 02:36:16 +0900 Subject: [PATCH 19/38] fix: enable feature gated logging option --- ant-cli/src/evm_network.rs | 6 ++++-- ant-node/Cargo.toml | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ant-cli/src/evm_network.rs b/ant-cli/src/evm_network.rs index 48998f1c0f..34e09ecc0f 100644 --- a/ant-cli/src/evm_network.rs +++ b/ant-cli/src/evm_network.rs @@ -1,5 +1,5 @@ use autonomi::{get_evm_network_from_env, local_evm_network_from_csv, Network}; -use color_eyre::eyre::Result; +use color_eyre::eyre::{Context, Result}; use std::sync::OnceLock; @@ -12,7 +12,9 @@ pub(crate) fn get_evm_network(local: bool) -> Result { let res = match get_evm_network_from_env() { Ok(evm_network) => Ok(evm_network), - Err(_) if local => Ok(local_evm_network_from_csv()?), + Err(_) if local => { + Ok(local_evm_network_from_csv().wrap_err("Failed to get local EVM network")?) + } Err(_) => Ok(Default::default()), }; diff --git a/ant-node/Cargo.toml b/ant-node/Cargo.toml index d2c73991dd..5ca35b65ca 100644 --- a/ant-node/Cargo.toml +++ b/ant-node/Cargo.toml @@ -14,10 +14,9 @@ name = "antnode" path = "src/bin/antnode/main.rs" [features] -default = ["metrics", "upnp", "open-metrics"] +default = ["upnp", "open-metrics"] extension-module = ["pyo3/extension-module"] loud = ["ant-networking/loud"] # loud mode: print important messages to console -metrics = [] nightly = [] open-metrics = ["ant-networking/open-metrics", "prometheus-client"] otlp = ["ant-logging/otlp"] @@ -27,7 +26,7 @@ upnp = ["ant-networking/upnp"] ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.2" } ant-build-info = { path = "../ant-build-info", version = "0.1.22" } ant-evm = { path = "../ant-evm", version = "0.1.7" } -ant-logging = { path = "../ant-logging", version = "0.2.43" } +ant-logging = { path = "../ant-logging", version = "0.2.43", features = ["process-metrics"] } ant-networking = { path = "../ant-networking", version = "0.3.2" } ant-protocol = { path = "../ant-protocol", version = "0.3.2" } ant-registers = { path = "../ant-registers", version = "0.4.6" } From 51f00b66d7936f554578ee7dd4f183678ec3416c Mon Sep 17 00:00:00 2001 From: grumbach Date: Wed, 8 Jan 2025 02:52:38 +0900 Subject: [PATCH 20/38] fix: adapt e2e ci tests --- .github/workflows/benchmark-prs.yml | 2 +- .../workflows/generate-benchmark-charts.yml | 2 +- .github/workflows/memcheck.yml | 6 +- .github/workflows/merge.yml | 70 +++++++++---------- 4 files changed, 38 insertions(+), 42 deletions(-) diff --git a/.github/workflows/benchmark-prs.yml b/.github/workflows/benchmark-prs.yml index d6cb7e1807..ecd90a480c 100644 --- a/.github/workflows/benchmark-prs.yml +++ b/.github/workflows/benchmark-prs.yml @@ -71,7 +71,7 @@ jobs: - name: Start a client instance to compare memory usage shell: bash - run: ./target/release/ant --log-output-dest=data-dir file upload "./the-test-data.zip" + run: ./target/release/ant --log-output-dest=data-dir --local file upload "./the-test-data.zip" env: ANT_LOG: "all" timeout-minutes: 5 diff --git a/.github/workflows/generate-benchmark-charts.yml b/.github/workflows/generate-benchmark-charts.yml index 4566a37610..ac23f9a044 100644 --- a/.github/workflows/generate-benchmark-charts.yml +++ b/.github/workflows/generate-benchmark-charts.yml @@ -100,7 +100,7 @@ jobs: - name: Start a client instance to compare memory usage shell: bash - run: cargo run --bin ant --release -- --log-output-dest data-dir file upload the-test-data.zip + run: cargo run --bin ant --release -- --log-output-dest data-dir --local file upload the-test-data.zip env: ANT_LOG: "all" diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index b3f3ed3f50..82135f5322 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -70,7 +70,7 @@ jobs: shell: bash - name: File upload - run: ./target/release/ant --log-output-dest=data-dir file upload --public "./the-test-data.zip" > ./upload_output 2>&1 + run: ./target/release/ant --log-output-dest=data-dir --local file upload --public "./the-test-data.zip" > ./upload_output 2>&1 env: ANT_LOG: "v" timeout-minutes: 15 @@ -99,7 +99,7 @@ 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 upload "./the-test-data_1.zip" > ./second_upload 2>&1 + ./target/release/ant --log-output-dest=data-dir --local file upload "./the-test-data_1.zip" > ./second_upload 2>&1 env: ANT_LOG: "all" timeout-minutes: 25 @@ -146,7 +146,7 @@ jobs: if: always() - name: File Download - run: ./target/release/ant --log-output-dest=data-dir file download ${{ env.UPLOAD_ADDRESS }} ./downloaded_resources + run: ./target/release/ant --log-output-dest=data-dir --local file download ${{ env.UPLOAD_ADDRESS }} ./downloaded_resources env: ANT_LOG: "v" timeout-minutes: 2 diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index a6d9eae0a3..c41a65a72c 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -86,10 +86,6 @@ jobs: # resulting in an error when building docs. run: RUSTDOCFLAGS="--deny=warnings" cargo doc --no-deps --workspace --exclude=autonomi-cli - - name: Check local is not a default feature - shell: bash - run: if [[ ! $(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].features.default[]? | select(. == "local")') ]]; then echo "local is not a default feature in any package."; else echo "local is a default feature in at least one package." && exit 1; fi - - name: Clean out the target directory run: cargo clean @@ -249,13 +245,13 @@ jobs: shell: pwsh - name: Get file cost - run: ./target/release/ant --log-output-dest=data-dir file cost "./resources" + run: ./target/release/ant --log-output-dest=data-dir --local file cost "./resources" env: ANT_LOG: "v" timeout-minutes: 15 - name: File upload - run: ./target/release/ant --log-output-dest=data-dir file upload "./resources" > ./upload_output 2>&1 + run: ./target/release/ant --log-output-dest=data-dir --local file upload "./resources" > ./upload_output 2>&1 env: ANT_LOG: "v" timeout-minutes: 15 @@ -275,16 +271,16 @@ jobs: shell: pwsh - name: File Download - run: ./target/release/ant --log-output-dest=data-dir file download ${{ env.UPLOAD_ADDRESS }} ./downloaded_resources + run: ./target/release/ant --log-output-dest=data-dir --local file download ${{ env.UPLOAD_ADDRESS }} ./downloaded_resources env: ANT_LOG: "v" timeout-minutes: 5 - name: Generate register signing key - run: ./target/release/ant --log-output-dest=data-dir register generate-key + run: ./target/release/ant --log-output-dest=data-dir --local register generate-key - name: Create register (writeable by owner) - run: ./target/release/ant --log-output-dest=data-dir register create baobao 123 > ./register_create_output 2>&1 + run: ./target/release/ant --log-output-dest=data-dir --local register create baobao 123 > ./register_create_output 2>&1 env: ANT_LOG: "v" timeout-minutes: 10 @@ -304,25 +300,25 @@ jobs: shell: pwsh - name: Get register - run: ./target/release/ant --log-output-dest=data-dir register get ${{ env.REGISTER_ADDRESS }} + run: ./target/release/ant --log-output-dest=data-dir --local register get ${{ env.REGISTER_ADDRESS }} env: ANT_LOG: "v" timeout-minutes: 5 - name: Edit register - run: ./target/release/ant --log-output-dest=data-dir register edit ${{ env.REGISTER_ADDRESS }} 456 + run: ./target/release/ant --log-output-dest=data-dir --local register edit ${{ env.REGISTER_ADDRESS }} 456 env: ANT_LOG: "v" timeout-minutes: 10 - name: Get register (after edit) - run: ./target/release/ant --log-output-dest=data-dir register get ${{ env.REGISTER_ADDRESS }} + run: ./target/release/ant --log-output-dest=data-dir --local register get ${{ env.REGISTER_ADDRESS }} env: ANT_LOG: "v" timeout-minutes: 5 - name: Create Public Register (writeable by anyone) - run: ./target/release/ant --log-output-dest=data-dir register create bao 111 --public > ./register_public_create_output 2>&1 + run: ./target/release/ant --log-output-dest=data-dir --local register create bao 111 --public > ./register_public_create_output 2>&1 env: ANT_LOG: "v" timeout-minutes: 5 @@ -342,13 +338,13 @@ jobs: shell: pwsh - name: Get Public Register (current key is the owner) - run: ./target/release/ant --log-output-dest=data-dir register get ${{ env.PUBLIC_REGISTER_ADDRESS }} + run: ./target/release/ant --log-output-dest=data-dir --local register get ${{ env.PUBLIC_REGISTER_ADDRESS }} env: ANT_LOG: "v" timeout-minutes: 5 - name: Edit Public Register (current key is the owner) - run: ./target/release/ant --log-output-dest=data-dir register edit ${{ env.PUBLIC_REGISTER_ADDRESS }} 222 + run: ./target/release/ant --log-output-dest=data-dir --local register edit ${{ env.PUBLIC_REGISTER_ADDRESS }} 222 env: ANT_LOG: "v" timeout-minutes: 10 @@ -361,19 +357,19 @@ jobs: run: ./target/release/ant --log-output-dest data-dir register generate-key - name: Get Public Register (new signing key is not the owner) - run: ./target/release/ant --log-output-dest data-dir register get ${{ env.PUBLIC_REGISTER_ADDRESS }} + run: ./target/release/ant --log-output-dest data-dir --local register get ${{ env.PUBLIC_REGISTER_ADDRESS }} env: ANT_LOG: "v" timeout-minutes: 2 - name: Edit Public Register (new signing key is not the owner) - run: ./target/release/ant --log-output-dest data-dir register edit ${{ env.PUBLIC_REGISTER_ADDRESS }} 333 + run: ./target/release/ant --log-output-dest data-dir --local register edit ${{ env.PUBLIC_REGISTER_ADDRESS }} 333 env: ANT_LOG: "v" timeout-minutes: 10 - name: Get Public Register (new signing key is not the owner) - run: ./target/release/ant --log-output-dest data-dir register get ${{ env.PUBLIC_REGISTER_ADDRESS }} + run: ./target/release/ant --log-output-dest data-dir --local register get ${{ env.PUBLIC_REGISTER_ADDRESS }} env: ANT_LOG: "v" timeout-minutes: 2 @@ -385,25 +381,25 @@ jobs: timeout-minutes: 2 - name: file upload - run: ./target/release/ant --log-output-dest data-dir file upload random.txt + run: ./target/release/ant --log-output-dest data-dir --local file upload random.txt env: ANT_LOG: "v" timeout-minutes: 2 - name: create a local register - run: ./target/release/ant --log-output-dest data-dir register create sample_new_register 1234 + run: ./target/release/ant --log-output-dest data-dir --local register create sample_new_register 1234 env: ANT_LOG: "v" timeout-minutes: 2 - name: Estimate cost to create a vault - run: ./target/release/ant --log-output-dest data-dir vault cost + run: ./target/release/ant --log-output-dest data-dir --local vault cost env: ANT_LOG: "v" timeout-minutes: 2 - name: create a vault with existing user data as above - run: ./target/release/ant --log-output-dest data-dir vault create + run: ./target/release/ant --log-output-dest data-dir --local vault create env: ANT_LOG: "v" timeout-minutes: 2 @@ -414,9 +410,9 @@ jobs: set -e for i in {1..50}; do dd if=/dev/urandom of=random_file_$i.bin bs=1M count=1 status=none - ./target/release/ant --log-output-dest data-dir file upload random_file_$i.bin --public - ./target/release/ant --log-output-dest data-dir file upload random_file_$i.bin - ./target/release/ant --log-output-dest data-dir register create $i random_file_$i.bin + ./target/release/ant --log-output-dest data-dir --local file upload random_file_$i.bin --public + ./target/release/ant --log-output-dest data-dir --local file upload random_file_$i.bin + ./target/release/ant --log-output-dest data-dir --local register create $i random_file_$i.bin done env: ANT_LOG: "v" @@ -433,9 +429,9 @@ jobs: [System.IO.File]::WriteAllBytes($fileName, $byteArray) # Run autonomi commands - ./target/release/ant --log-output-dest data-dir file upload "random_file_$i.bin" --public - ./target/release/ant --log-output-dest data-dir file upload "random_file_$i.bin" - ./target/release/ant --log-output-dest data-dir register create $i "random_file_$i.bin" + ./target/release/ant --log-output-dest data-dir --local file upload "random_file_$i.bin" --public + ./target/release/ant --log-output-dest data-dir --local file upload "random_file_$i.bin" + ./target/release/ant --log-output-dest data-dir --local register create $i "random_file_$i.bin" } env: ANT_LOG: "v" @@ -463,11 +459,11 @@ jobs: NUM_OF_PUBLIC_FILES_IN_VAULT="" NUM_OF_PRIVATE_FILES_IN_VAULT="" - ./target/release/ant --log-output-dest data-dir file list 2>&1 > file_list.txt + ./target/release/ant --log-output-dest data-dir --local file list 2>&1 > file_list.txt NUM_OF_PUBLIC_FILES=`cat file_list.txt | grep "public" | grep -o '[0-9]\+'` NUM_OF_PRIVATE_FILES=`cat file_list.txt | grep "private" | grep -o '[0-9]\+'` - ./target/release/ant --log-output-dest data-dir vault load 2>&1 > vault_data.txt + ./target/release/ant --log-output-dest data-dir --local vault load 2>&1 > vault_data.txt NUM_OF_PUBLIC_FILES_IN_VAULT=`cat vault_data.txt | grep "public" | grep -o '[0-9]\+'` NUM_OF_PRIVATE_FILES_IN_VAULT=`cat vault_data.txt| grep "private" | grep -o '[0-9]\+'` @@ -489,8 +485,8 @@ jobs: shell: pwsh run: | $ErrorActionPreference = "Stop" - ./target/release/ant --log-output-dest data-dir file list > file_list.txt 2>&1 - ./target/release/ant --log-output-dest data-dir vault load > vault_data.txt 2>&1 + ./target/release/ant --log-output-dest data-dir --local file list > file_list.txt 2>&1 + ./target/release/ant --log-output-dest data-dir --local vault load > vault_data.txt 2>&1 env: ANT_LOG: "v" timeout-minutes: 15 @@ -556,11 +552,11 @@ jobs: python3 -c "with open('random_1GB.bin', 'wb') as f: f.write(bytearray([0xff] * 1000 * 1024 * 1024))" ./target/release/ant --log-output-dest=data-dir file list - time ./target/release/ant --log-output-dest=data-dir file upload random_1MB.bin - time ./target/release/ant --log-output-dest=data-dir file upload random_10MB.bin - time ./target/release/ant --log-output-dest=data-dir file upload random_100MB.bin - time ./target/release/ant --log-output-dest=data-dir file upload random_1GB.bin - ./target/release/ant --log-output-dest=data-dir vault sync + time ./target/release/ant --log-output-dest=data-dir --local file upload random_1MB.bin + time ./target/release/ant --log-output-dest=data-dir --local file upload random_10MB.bin + time ./target/release/ant --log-output-dest=data-dir --local file upload random_100MB.bin + time ./target/release/ant --log-output-dest=data-dir --local file upload random_1GB.bin + ./target/release/ant --log-output-dest=data-dir --local vault sync rm -rf random*.bin rm -rf ${{ matrix.ant_path }}/autonomi env: From 46de2683fff8392c03754f8e34b6af14232a6345 Mon Sep 17 00:00:00 2001 From: grumbach Date: Wed, 8 Jan 2025 03:20:16 +0900 Subject: [PATCH 21/38] feat: centralize evm network selection code --- ant-cli/src/actions/connect.rs | 3 +- ant-cli/src/commands/wallet.rs | 2 +- ant-cli/src/evm_network.rs | 26 --------------- ant-cli/src/main.rs | 1 - ant-evm/src/lib.rs | 2 +- .../src/bin/cli/subcommands/evm_network.rs | 4 +-- ant-node/src/bin/antnode/main.rs | 7 ++-- autonomi/src/lib.rs | 3 +- autonomi/tests/wallet.rs | 6 ++-- evmlib/src/utils.rs | 32 +++++++++++++++++-- test-utils/src/evm.rs | 12 +++---- 11 files changed, 46 insertions(+), 52 deletions(-) delete mode 100644 ant-cli/src/evm_network.rs diff --git a/ant-cli/src/actions/connect.rs b/ant-cli/src/actions/connect.rs index 5ae12694ad..118b2df60d 100644 --- a/ant-cli/src/actions/connect.rs +++ b/ant-cli/src/actions/connect.rs @@ -6,9 +6,8 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use crate::evm_network::get_evm_network; use crate::network::NetworkPeers; -use autonomi::{Client, ClientConfig}; +use autonomi::{get_evm_network, Client, ClientConfig}; use color_eyre::eyre::bail; use color_eyre::eyre::Result; use indicatif::ProgressBar; diff --git a/ant-cli/src/commands/wallet.rs b/ant-cli/src/commands/wallet.rs index c11bc41802..9e76128bbe 100644 --- a/ant-cli/src/commands/wallet.rs +++ b/ant-cli/src/commands/wallet.rs @@ -6,10 +6,10 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use crate::evm_network::get_evm_network; use crate::wallet::fs::{select_wallet_private_key, store_private_key}; use crate::wallet::input::request_password; use crate::wallet::DUMMY_NETWORK; +use autonomi::get_evm_network; use autonomi::Wallet; use color_eyre::eyre::eyre; use color_eyre::Result; diff --git a/ant-cli/src/evm_network.rs b/ant-cli/src/evm_network.rs deleted file mode 100644 index 34e09ecc0f..0000000000 --- a/ant-cli/src/evm_network.rs +++ /dev/null @@ -1,26 +0,0 @@ -use autonomi::{get_evm_network_from_env, local_evm_network_from_csv, Network}; -use color_eyre::eyre::{Context, Result}; - -use std::sync::OnceLock; - -static EVM_NETWORK: OnceLock = OnceLock::new(); - -pub(crate) fn get_evm_network(local: bool) -> Result { - if let Some(network) = EVM_NETWORK.get() { - return Ok(network.clone()); - } - - let res = match get_evm_network_from_env() { - Ok(evm_network) => Ok(evm_network), - Err(_) if local => { - Ok(local_evm_network_from_csv().wrap_err("Failed to get local EVM network")?) - } - Err(_) => Ok(Default::default()), - }; - - if let Ok(network) = res.as_ref() { - let _ = EVM_NETWORK.set(network.clone()); - } - - res -} diff --git a/ant-cli/src/main.rs b/ant-cli/src/main.rs index b7f6bc8fcb..e0fe5cf644 100644 --- a/ant-cli/src/main.rs +++ b/ant-cli/src/main.rs @@ -12,7 +12,6 @@ extern crate tracing; mod access; mod actions; mod commands; -mod evm_network; mod opt; mod utils; mod wallet; diff --git a/ant-evm/src/lib.rs b/ant-evm/src/lib.rs index 678db86c72..e8d5e92784 100644 --- a/ant-evm/src/lib.rs +++ b/ant-evm/src/lib.rs @@ -19,7 +19,7 @@ pub use evmlib::cryptography; #[cfg(feature = "external-signer")] pub use evmlib::external_signer; pub use evmlib::utils; -pub use evmlib::utils::{get_evm_network_from_env, local_evm_network_from_csv}; +pub use evmlib::utils::get_evm_network; pub use evmlib::utils::{DATA_PAYMENTS_ADDRESS, PAYMENT_TOKEN_ADDRESS, RPC_URL}; pub use evmlib::wallet::Error as EvmWalletError; pub use evmlib::wallet::Wallet as EvmWallet; diff --git a/ant-node-manager/src/bin/cli/subcommands/evm_network.rs b/ant-node-manager/src/bin/cli/subcommands/evm_network.rs index 10028ed468..59d6078ad3 100644 --- a/ant-node-manager/src/bin/cli/subcommands/evm_network.rs +++ b/ant-node-manager/src/bin/cli/subcommands/evm_network.rs @@ -6,7 +6,7 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use ant_evm::{utils::local_evm_network_from_csv, EvmNetwork}; +use ant_evm::{get_evm_network, EvmNetwork}; use clap::Subcommand; use color_eyre::Result; @@ -50,7 +50,7 @@ impl TryInto for EvmNetworkCommand { Self::EvmArbitrumSepolia => Ok(EvmNetwork::ArbitrumSepolia), Self::EvmArbitrumSepoliaTest => Ok(EvmNetwork::ArbitrumSepoliaTest), Self::EvmLocal => { - let network = local_evm_network_from_csv()?; + let network = get_evm_network(true)?; Ok(network) } Self::EvmCustom { diff --git a/ant-node/src/bin/antnode/main.rs b/ant-node/src/bin/antnode/main.rs index 2ee4cc6d34..665b47518c 100644 --- a/ant-node/src/bin/antnode/main.rs +++ b/ant-node/src/bin/antnode/main.rs @@ -14,7 +14,7 @@ mod subcommands; use crate::subcommands::EvmNetworkCommand; use ant_bootstrap::{BootstrapCacheConfig, BootstrapCacheStore, PeersArgs}; -use ant_evm::{get_evm_network_from_env, local_evm_network_from_csv, EvmNetwork, RewardsAddress}; +use ant_evm::{get_evm_network, EvmNetwork, RewardsAddress}; use ant_logging::metrics::init_metrics; use ant_logging::{Level, LogFormat, LogOutputDest, ReloadHandle}; use ant_node::{Marker, NodeBuilder, NodeEvent, NodeEventsReceiver}; @@ -264,9 +264,8 @@ fn main() -> Result<()> { let evm_network: EvmNetwork = match opt.evm_network.as_ref() { Some(evm_network) => Ok(evm_network.clone().into()), - None => match get_evm_network_from_env() { - Ok(evm_network) => Ok(evm_network), - Err(_) if opt.peers.local => Ok(local_evm_network_from_csv()?), + None => match get_evm_network(opt.peers.local) { + Ok(net) => Ok(net), Err(_) => Err(eyre!( "EVM network not specified. Please specify a network using the subcommand or by setting the `EVM_NETWORK` environment variable." )), diff --git a/autonomi/src/lib.rs b/autonomi/src/lib.rs index bfb1d705b2..fe741c8003 100644 --- a/autonomi/src/lib.rs +++ b/autonomi/src/lib.rs @@ -65,8 +65,7 @@ extern crate tracing; pub mod client; pub mod self_encryption; -pub use ant_evm::get_evm_network_from_env; -pub use ant_evm::local_evm_network_from_csv; +pub use ant_evm::utils::get_evm_network; pub use ant_evm::Amount; pub use ant_evm::EvmNetwork as Network; pub use ant_evm::EvmWallet as Wallet; diff --git a/autonomi/tests/wallet.rs b/autonomi/tests/wallet.rs index 33880ca5ab..6347edaae7 100644 --- a/autonomi/tests/wallet.rs +++ b/autonomi/tests/wallet.rs @@ -6,7 +6,7 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use ant_evm::get_evm_network_from_env; +use ant_evm::get_evm_network; use ant_evm::EvmWallet; use ant_evm::{Amount, RewardsAddress}; use ant_logging::LogBuilder; @@ -17,7 +17,7 @@ use test_utils::evm::get_funded_wallet; async fn from_private_key() { let private_key = "0xdb1049e76a813c94be0df47ec3e20533ca676b1b9fef2ddbce9daa117e4da4aa"; let network = - get_evm_network_from_env().expect("Could not get EVM network from environment variables"); + get_evm_network(true).expect("Could not get EVM network from environment variables"); let wallet = EvmWallet::new_from_private_key(network, private_key).unwrap(); assert_eq!( @@ -31,7 +31,7 @@ async fn send_tokens() { let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("wallet", false); let network = - get_evm_network_from_env().expect("Could not get EVM network from environment variables"); + get_evm_network(true).expect("Could not get EVM network from environment variables"); let wallet = get_funded_wallet(); let receiving_wallet = EvmWallet::new_with_random_wallet(network); diff --git a/evmlib/src/utils.rs b/evmlib/src/utils.rs index 1717b2d517..40c92ca648 100644 --- a/evmlib/src/utils.rs +++ b/evmlib/src/utils.rs @@ -47,6 +47,34 @@ pub fn dummy_hash() -> Hash { Hash::new(rand::rngs::OsRng.gen()) } +use std::sync::OnceLock; + +static EVM_NETWORK: OnceLock = OnceLock::new(); + +/// Initialize the EVM Network parameters from environment variables or local CSV file. +/// +/// It will first try to get the network from the environment variables. +/// If it fails and `local` is true, it will try to get the network from the local CSV file. +/// If both fail, it will return the default network. +pub fn get_evm_network(local: bool) -> Result { + if let Some(network) = EVM_NETWORK.get() { + return Ok(network.clone()); + } + + let res = match get_evm_network_from_env() { + Ok(evm_network) => Ok(evm_network), + Err(_) if local => Ok(local_evm_network_from_csv() + .map_err(|e| Error::FailedToGetEvmNetwork(e.to_string()))?), + Err(_) => Ok(Network::default()), + }; + + if let Ok(network) = res.as_ref() { + let _ = EVM_NETWORK.set(network.clone()); + } + + res +} + pub fn get_evm_testnet_csv_path() -> Result { let file = data_dir() .ok_or(Error::FailedToGetEvmNetwork( @@ -60,7 +88,7 @@ pub fn get_evm_testnet_csv_path() -> Result { /// Get the `Network` from environment variables. /// /// Returns an error if we cannot obtain the network from any means. -pub fn get_evm_network_from_env() -> Result { +fn get_evm_network_from_env() -> Result { let evm_vars = [ env::var(RPC_URL) .ok() @@ -126,7 +154,7 @@ pub fn get_evm_network_from_env() -> Result { } /// Get the `Network::Custom` from the local EVM testnet CSV file -pub fn local_evm_network_from_csv() -> Result { +fn local_evm_network_from_csv() -> Result { // load the csv let csv_path = get_evm_testnet_csv_path()?; diff --git a/test-utils/src/evm.rs b/test-utils/src/evm.rs index 989da8b1a4..e3db3dd2ba 100644 --- a/test-utils/src/evm.rs +++ b/test-utils/src/evm.rs @@ -6,15 +6,12 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. -use color_eyre::{ - eyre::{bail, Context}, - Result, -}; -use evmlib::{utils::local_evm_network_from_csv, wallet::Wallet, Network}; +use color_eyre::{eyre::bail, Result}; +use evmlib::{utils::get_evm_network, wallet::Wallet, Network}; use std::env; pub fn get_funded_wallet() -> evmlib::wallet::Wallet { - let network = local_evm_network_from_csv().expect("Failed to get local EVM network from CSV"); + let network = get_evm_network(true).expect("Failed to get local EVM network from CSV"); if matches!(network, Network::ArbitrumOne) { panic!("You're trying to use ArbitrumOne network. Use a custom network for testing."); } @@ -28,8 +25,7 @@ pub fn get_funded_wallet() -> evmlib::wallet::Wallet { } pub fn get_new_wallet() -> Result { - let network = - local_evm_network_from_csv().wrap_err("Failed to get local EVM network from CSV")?; + let network = get_evm_network(true).expect("Failed to get local EVM network from CSV"); if matches!(network, Network::ArbitrumOne) { bail!("You're trying to use ArbitrumOne network. Use a custom network for testing."); } From d77b844fd1d3d03e27d4db4570982fb0136a370a Mon Sep 17 00:00:00 2001 From: grumbach Date: Wed, 8 Jan 2025 23:09:04 +0900 Subject: [PATCH 22/38] fix: remove duplicate if local --- ant-networking/src/event/swarm.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ant-networking/src/event/swarm.rs b/ant-networking/src/event/swarm.rs index 434b94f7fe..34e7c6574f 100644 --- a/ant-networking/src/event/swarm.rs +++ b/ant-networking/src/event/swarm.rs @@ -292,16 +292,14 @@ impl SwarmDriver { if self.local { match *mdns_event { mdns::Event::Discovered(list) => { - if self.local { - for (peer_id, addr) in list { - // The multiaddr does not contain the peer ID, so add it. - let addr = addr.with(Protocol::P2p(peer_id)); + for (peer_id, addr) in list { + // The multiaddr does not contain the peer ID, so add it. + let addr = addr.with(Protocol::P2p(peer_id)); - info!(%addr, "mDNS node discovered and dialing"); + info!(%addr, "mDNS node discovered and dialing"); - if let Err(err) = self.dial(addr.clone()) { - warn!(%addr, "mDNS node dial error: {err:?}"); - } + if let Err(err) = self.dial(addr.clone()) { + warn!(%addr, "mDNS node dial error: {err:?}"); } } } From d19d5e30eabbd9a8a993af8923ac57627151b2e0 Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Thu, 9 Jan 2025 12:34:15 +0100 Subject: [PATCH 23/38] fix: increase transaction timeout to 600 seconds --- evmlib/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evmlib/src/lib.rs b/evmlib/src/lib.rs index 866f8fc47d..db7d599281 100644 --- a/evmlib/src/lib.rs +++ b/evmlib/src/lib.rs @@ -28,7 +28,7 @@ pub mod utils; pub mod wallet; /// Timeout for transactions -const TX_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(60); +const TX_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(600); static PUBLIC_ARBITRUM_ONE_HTTP_RPC_URL: LazyLock = LazyLock::new(|| { "https://arb1.arbitrum.io/rpc" From 1e1b76f9de9aee9a7e70ab56aa8c1fbe050791f7 Mon Sep 17 00:00:00 2001 From: kindknow Date: Sun, 29 Dec 2024 17:52:35 +0800 Subject: [PATCH 24/38] chore: remove redundant words in comment Signed-off-by: kindknow --- ant-networking/src/event/swarm.rs | 2 +- ant-networking/src/metrics/bad_node.rs | 2 +- ant-node/tests/common/client.rs | 2 +- ant-protocol/src/messages/query.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ant-networking/src/event/swarm.rs b/ant-networking/src/event/swarm.rs index d4385d0500..e83c18364f 100644 --- a/ant-networking/src/event/swarm.rs +++ b/ant-networking/src/event/swarm.rs @@ -550,7 +550,7 @@ impl SwarmDriver { error, } => { event_string = "Incoming ConnErr"; - // Only log as ERROR if the the connection is not adjacent to an already established connection id from + // Only log as ERROR if the connection is not adjacent to an already established connection id from // the same IP address. // // If a peer contains multiple transports/listen addrs, we might try to open multiple connections, diff --git a/ant-networking/src/metrics/bad_node.rs b/ant-networking/src/metrics/bad_node.rs index 311c0ca8aa..23d8a8afa1 100644 --- a/ant-networking/src/metrics/bad_node.rs +++ b/ant-networking/src/metrics/bad_node.rs @@ -46,7 +46,7 @@ struct ShunnedByCloseGroup { old_new_group_shunned_list: HashSet, } -/// A struct to record the the number of reports against our node across different time frames. +/// A struct to record the number of reports against our node across different time frames. struct ShunnedCountAcrossTimeFrames { metric: Family, shunned_report_tracker: Vec, diff --git a/ant-node/tests/common/client.rs b/ant-node/tests/common/client.rs index faf8c1ae05..851edb53de 100644 --- a/ant-node/tests/common/client.rs +++ b/ant-node/tests/common/client.rs @@ -52,7 +52,7 @@ pub async fn get_client_and_funded_wallet() -> (Client, Wallet) { } /// Get the node count -/// If SN_INVENTORY flag is passed, the node count is obtained from the the droplet +/// If SN_INVENTORY flag is passed, the node count is obtained from the droplet /// else return the local node count pub fn get_node_count() -> usize { match DeploymentInventory::load() { diff --git a/ant-protocol/src/messages/query.rs b/ant-protocol/src/messages/query.rs index f38500bd41..d395274037 100644 --- a/ant-protocol/src/messages/query.rs +++ b/ant-protocol/src/messages/query.rs @@ -66,7 +66,7 @@ pub enum Query { }, /// Queries close_group peers whether the target peer is a bad_node CheckNodeInProblem(NetworkAddress), - /// Query the the peers in range to the target address, from the receiver's perspective. + /// Query the peers in range to the target address, from the receiver's perspective. /// In case none of the parameters provided, returns nothing. /// In case both of the parameters provided, `range` is preferred to be replied. GetClosestPeers { From c1ae933cb81906154c51e7ca495f5af0d5446af2 Mon Sep 17 00:00:00 2001 From: Chris O'Neil Date: Thu, 9 Jan 2025 17:01:00 +0000 Subject: [PATCH 25/38] chore(release): stable release 2024.12.1.8 ================== Crate Versions ================== ant-bootstrap: 0.1.3 ant-build-info: 0.1.23 ant-cli: 0.3.3 ant-evm: 0.1.8 ant-logging: 0.2.44 ant-metrics: 0.1.24 ant-networking: 0.3.3 ant-node: 0.3.3 ant-node-manager: 0.11.7 ant-node-rpc-client: 0.6.40 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.3 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.3 antctl: 0.11.7 antctld: 0.11.7 antnode: 0.3.3 antnode_rpc_client: 0.6.40 nat-detection: 0.2.15 node-launchpad: 0.5.3 --- Cargo.lock | 40 +++++++++++++++---------------- ant-bootstrap/Cargo.toml | 6 ++--- ant-build-info/Cargo.toml | 2 +- ant-cli/Cargo.toml | 14 +++++------ ant-evm/Cargo.toml | 4 ++-- ant-logging/Cargo.toml | 2 +- ant-metrics/Cargo.toml | 2 +- ant-networking/Cargo.toml | 12 +++++----- ant-node-manager/Cargo.toml | 14 +++++------ ant-node-rpc-client/Cargo.toml | 12 +++++----- ant-node/Cargo.toml | 24 +++++++++---------- ant-protocol/Cargo.toml | 8 +++---- ant-registers/Cargo.toml | 2 +- ant-service-management/Cargo.toml | 10 ++++---- ant-token-supplies/Cargo.toml | 2 +- autonomi/Cargo.toml | 16 ++++++------- evm-testnet/Cargo.toml | 6 ++--- evmlib/Cargo.toml | 2 +- nat-detection/Cargo.toml | 8 +++---- node-launchpad/Cargo.toml | 14 +++++------ test-utils/Cargo.toml | 4 ++-- 21 files changed, 102 insertions(+), 102 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 78d65fa20f..fb3a998472 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -773,7 +773,7 @@ dependencies = [ [[package]] name = "ant-bootstrap" -version = "0.1.3-rc.1" +version = "0.1.3" dependencies = [ "ant-logging", "ant-protocol", @@ -798,7 +798,7 @@ dependencies = [ [[package]] name = "ant-build-info" -version = "0.1.23-rc.1" +version = "0.1.23" dependencies = [ "chrono", "tracing", @@ -807,7 +807,7 @@ dependencies = [ [[package]] name = "ant-cli" -version = "0.3.3-rc.1" +version = "0.3.3" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -838,7 +838,7 @@ dependencies = [ [[package]] name = "ant-evm" -version = "0.1.8-rc.1" +version = "0.1.8" dependencies = [ "custom_debug", "evmlib", @@ -861,7 +861,7 @@ dependencies = [ [[package]] name = "ant-logging" -version = "0.2.44-rc.1" +version = "0.2.44" dependencies = [ "chrono", "color-eyre", @@ -886,7 +886,7 @@ dependencies = [ [[package]] name = "ant-metrics" -version = "0.1.24-rc.1" +version = "0.1.24" dependencies = [ "clap", "color-eyre", @@ -900,7 +900,7 @@ dependencies = [ [[package]] name = "ant-networking" -version = "0.3.3-rc.1" +version = "0.3.3" dependencies = [ "aes-gcm-siv", "ant-bootstrap", @@ -948,7 +948,7 @@ dependencies = [ [[package]] name = "ant-node" -version = "0.3.3-rc.1" +version = "0.3.3" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -1006,7 +1006,7 @@ dependencies = [ [[package]] name = "ant-node-manager" -version = "0.11.7-rc.1" +version = "0.11.7" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -1049,7 +1049,7 @@ dependencies = [ [[package]] name = "ant-node-rpc-client" -version = "0.6.40-rc.1" +version = "0.6.40" dependencies = [ "ant-build-info", "ant-logging", @@ -1073,7 +1073,7 @@ dependencies = [ [[package]] name = "ant-protocol" -version = "0.3.3-rc.1" +version = "0.3.3" dependencies = [ "ant-build-info", "ant-evm", @@ -1103,7 +1103,7 @@ dependencies = [ [[package]] name = "ant-registers" -version = "0.4.7-rc.1" +version = "0.4.7" dependencies = [ "blsttc", "crdts", @@ -1140,7 +1140,7 @@ dependencies = [ [[package]] name = "ant-service-management" -version = "0.4.7-rc.1" +version = "0.4.7" dependencies = [ "ant-bootstrap", "ant-evm", @@ -1167,7 +1167,7 @@ dependencies = [ [[package]] name = "ant-token-supplies" -version = "0.1.62-rc.1" +version = "0.1.62" dependencies = [ "dirs-next", "reqwest 0.11.27", @@ -1591,7 +1591,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "autonomi" -version = "0.3.3-rc.1" +version = "0.3.3" dependencies = [ "alloy", "ant-bootstrap", @@ -3356,7 +3356,7 @@ dependencies = [ [[package]] name = "evm-testnet" -version = "0.1.8-rc.1" +version = "0.1.8" dependencies = [ "ant-evm", "clap", @@ -3367,7 +3367,7 @@ dependencies = [ [[package]] name = "evmlib" -version = "0.1.8-rc.1" +version = "0.1.8" dependencies = [ "alloy", "dirs-next", @@ -6284,7 +6284,7 @@ dependencies = [ [[package]] name = "nat-detection" -version = "0.2.15-rc.1" +version = "0.2.15" dependencies = [ "ant-build-info", "ant-networking", @@ -6401,7 +6401,7 @@ dependencies = [ [[package]] name = "node-launchpad" -version = "0.5.3-rc.1" +version = "0.5.3" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -9321,7 +9321,7 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "test-utils" -version = "0.4.15-rc.1" +version = "0.4.15" dependencies = [ "bytes", "color-eyre", diff --git a/ant-bootstrap/Cargo.toml b/ant-bootstrap/Cargo.toml index ed7d377ba6..864f1eeda2 100644 --- a/ant-bootstrap/Cargo.toml +++ b/ant-bootstrap/Cargo.toml @@ -7,14 +7,14 @@ license = "GPL-3.0" name = "ant-bootstrap" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.3-rc.1" +version = "0.1.3" [features] local = [] [dependencies] -ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } +ant-logging = { path = "../ant-logging", version = "0.2.44" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3" } atomic-write-file = "0.2.2" chrono = { version = "0.4", features = ["serde"] } clap = { version = "4.2.1", features = ["derive", "env"] } diff --git a/ant-build-info/Cargo.toml b/ant-build-info/Cargo.toml index 2a41fc4f59..f664ce5419 100644 --- a/ant-build-info/Cargo.toml +++ b/ant-build-info/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-build-info" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.23-rc.1" +version = "0.1.23" build = "build.rs" include = ["Cargo.toml", "src/**/*", "build.rs"] diff --git a/ant-cli/Cargo.toml b/ant-cli/Cargo.toml index ef864f4715..7e1eda41d4 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-rc.1" +version = "0.3.3" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" @@ -24,11 +24,11 @@ name = "files" harness = false [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } -ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } -ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } -autonomi = { path = "../autonomi", version = "0.3.3-rc.1", features = [ +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 = [ "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-rc.1", features = ["fs"]} +autonomi = { path = "../autonomi", version = "0.3.3", features = ["fs"]} criterion = "0.5.1" eyre = "0.6.8" rand = { version = "~0.8.5", features = ["small_rng"] } diff --git a/ant-evm/Cargo.toml b/ant-evm/Cargo.toml index 9eb8a8b14c..02663b1484 100644 --- a/ant-evm/Cargo.toml +++ b/ant-evm/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-evm" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.8-rc.1" +version = "0.1.8" [features] local = ["evmlib/local"] @@ -16,7 +16,7 @@ test-utils = [] [dependencies] custom_debug = "~0.6.1" -evmlib = { path = "../evmlib", version = "0.1.8-rc.1" } +evmlib = { path = "../evmlib", version = "0.1.8" } hex = "~0.4.3" lazy_static = "~1.4.0" libp2p = { version = "0.54.1", features = ["identify", "kad"] } diff --git a/ant-logging/Cargo.toml b/ant-logging/Cargo.toml index 309aa6c2b6..92394789c6 100644 --- a/ant-logging/Cargo.toml +++ b/ant-logging/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-logging" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.2.44-rc.1" +version = "0.2.44" [dependencies] chrono = "~0.4.19" diff --git a/ant-metrics/Cargo.toml b/ant-metrics/Cargo.toml index 72f01cff41..42734a64ae 100644 --- a/ant-metrics/Cargo.toml +++ b/ant-metrics/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-metrics" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.24-rc.1" +version = "0.1.24" [[bin]] path = "src/main.rs" diff --git a/ant-networking/Cargo.toml b/ant-networking/Cargo.toml index c6234bdd69..c1b02c82df 100644 --- a/ant-networking/Cargo.toml +++ b/ant-networking/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-networking" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.3.3-rc.1" +version = "0.3.3" [features] default = [] @@ -20,11 +20,11 @@ upnp = ["libp2p/upnp"] [dependencies] aes-gcm-siv = "0.11.1" -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } -ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } -ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } -ant-registers = { path = "../ant-registers", version = "0.4.7-rc.1" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23" } +ant-evm = { path = "../ant-evm", version = "0.1.8" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3" } +ant-registers = { path = "../ant-registers", version = "0.4.7" } async-trait = "0.1" bytes = { version = "1.0.1", features = ["serde"] } custom_debug = "~0.6.1" diff --git a/ant-node-manager/Cargo.toml b/ant-node-manager/Cargo.toml index 1d5fd72b59..d9831185a8 100644 --- a/ant-node-manager/Cargo.toml +++ b/ant-node-manager/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-node-manager" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.11.7-rc.1" +version = "0.11.7" [[bin]] name = "antctl" @@ -30,13 +30,13 @@ tcp = [] websockets = [] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } -ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } -ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } -ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23" } +ant-evm = { path = "../ant-evm", version = "0.1.8" } +ant-logging = { path = "../ant-logging", version = "0.2.44" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3" } ant-releases = { version = "0.4.0" } -ant-service-management = { path = "../ant-service-management", version = "0.4.7-rc.1" } +ant-service-management = { path = "../ant-service-management", version = "0.4.7" } chrono = "~0.4.19" clap = { version = "4.4.6", features = ["derive", "env"] } colored = "2.0.4" diff --git a/ant-node-rpc-client/Cargo.toml b/ant-node-rpc-client/Cargo.toml index 0388c465a2..650c8b1a74 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-rc.1" +version = "0.6.40" [[bin]] name = "antnode_rpc_client" @@ -17,11 +17,11 @@ path = "src/main.rs" nightly = [] [dependencies] -ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } -ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1", features=["rpc"] } -ant-node = { path = "../ant-node", version = "0.3.3-rc.1" } -ant-service-management = { path = "../ant-service-management", version = "0.4.7-rc.1" } +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-service-management = { path = "../ant-service-management", version = "0.4.7" } async-trait = "0.1" bls = { package = "blsttc", version = "8.0.1" } clap = { version = "4.2.1", features = ["derive"] } diff --git a/ant-node/Cargo.toml b/ant-node/Cargo.toml index f08d6b2816..86afa2a3a7 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-rc.1" +version = "0.3.3" edition = "2021" license = "GPL-3.0" homepage = "https://maidsafe.net" @@ -26,14 +26,14 @@ otlp = ["ant-logging/otlp"] upnp = ["ant-networking/upnp"] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } -ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } -ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } -ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } -ant-networking = { path = "../ant-networking", version = "0.3.3-rc.1" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } -ant-registers = { path = "../ant-registers", version = "0.4.7-rc.1" } -ant-service-management = { path = "../ant-service-management", version = "0.4.7-rc.1" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23" } +ant-evm = { path = "../ant-evm", version = "0.1.8" } +ant-logging = { path = "../ant-logging", version = "0.2.44" } +ant-networking = { path = "../ant-networking", version = "0.3.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3" } +ant-registers = { path = "../ant-registers", version = "0.4.7" } +ant-service-management = { path = "../ant-service-management", version = "0.4.7" } async-trait = "0.1" bls = { package = "blsttc", version = "8.0.1" } bytes = { version = "1.0.1", features = ["serde"] } @@ -83,10 +83,10 @@ walkdir = "~2.5.0" xor_name = "5.0.0" [dev-dependencies] -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1", features = ["rpc"] } +ant-protocol = { path = "../ant-protocol", version = "0.3.3", features = ["rpc"] } assert_fs = "1.0.0" -evmlib = { path = "../evmlib", version = "0.1.8-rc.1" } -autonomi = { path = "../autonomi", version = "0.3.3-rc.1", features = ["registers"] } +evmlib = { path = "../evmlib", version = "0.1.8" } +autonomi = { path = "../autonomi", version = "0.3.3", features = ["registers"] } reqwest = { version = "0.12.2", default-features = false, features = [ "rustls-tls-manual-roots", ] } diff --git a/ant-protocol/Cargo.toml b/ant-protocol/Cargo.toml index 7ad2b147df..cdc866bdc9 100644 --- a/ant-protocol/Cargo.toml +++ b/ant-protocol/Cargo.toml @@ -7,16 +7,16 @@ license = "GPL-3.0" name = "ant-protocol" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.3.3-rc.1" +version = "0.3.3" [features] default = [] rpc = ["tonic", "prost"] [dependencies] -ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } -ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } -ant-registers = { path = "../ant-registers", version = "0.4.7-rc.1" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23" } +ant-evm = { path = "../ant-evm", version = "0.1.8" } +ant-registers = { path = "../ant-registers", version = "0.4.7" } bls = { package = "blsttc", version = "8.0.1" } bytes = { version = "1.0.1", features = ["serde"] } color-eyre = "0.6.2" diff --git a/ant-registers/Cargo.toml b/ant-registers/Cargo.toml index 2a16fe7d5c..07771048ce 100644 --- a/ant-registers/Cargo.toml +++ b/ant-registers/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-registers" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.4.7-rc.1" +version = "0.4.7" [features] test-utils = [] diff --git a/ant-service-management/Cargo.toml b/ant-service-management/Cargo.toml index 8807ebca0d..acc2fe7d36 100644 --- a/ant-service-management/Cargo.toml +++ b/ant-service-management/Cargo.toml @@ -7,13 +7,13 @@ license = "GPL-3.0" name = "ant-service-management" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.4.7-rc.1" +version = "0.4.7" [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } -ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } -ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1", features = ["rpc"] } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3" } +ant-evm = { path = "../ant-evm", version = "0.1.8" } +ant-logging = { path = "../ant-logging", version = "0.2.44" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3", features = ["rpc"] } async-trait = "0.1" dirs-next = "2.0.0" libp2p = { version = "0.54.1", features = ["kad"] } diff --git a/ant-token-supplies/Cargo.toml b/ant-token-supplies/Cargo.toml index 6dce7fb675..66a3661079 100644 --- a/ant-token-supplies/Cargo.toml +++ b/ant-token-supplies/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "ant-token-supplies" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.62-rc.1" +version = "0.1.62" [dependencies] diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 5b61200e11..e93a1368a7 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-rc.1" +version = "0.3.3" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" @@ -33,11 +33,11 @@ registers = [] vault = ["registers"] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } -ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } -ant-networking = { path = "../ant-networking", version = "0.3.3-rc.1" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } -ant-registers = { path = "../ant-registers", version = "0.4.7-rc.1" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3" } +ant-evm = { path = "../ant-evm", version = "0.1.8" } +ant-networking = { path = "../ant-networking", version = "0.3.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3" } +ant-registers = { path = "../ant-registers", version = "0.4.7" } bip39 = "2.0.0" blst = "0.3.13" blstrs = "0.7.1" @@ -68,7 +68,7 @@ xor_name = "5.0.0" [dev-dependencies] alloy = { version = "0.7.3", default-features = false, features = ["contract", "json-rpc", "network", "node-bindings", "provider-http", "reqwest-rustls-tls", "rpc-client", "rpc-types", "signer-local", "std"] } -ant-logging = { path = "../ant-logging", version = "0.2.44-rc.1" } +ant-logging = { path = "../ant-logging", version = "0.2.44" } eyre = "0.6.5" sha2 = "0.10.6" # Do not specify the version field. Release process expects even the local dev deps to be published. @@ -80,7 +80,7 @@ wasm-bindgen-test = "0.3.43" [target.'cfg(target_arch = "wasm32")'.dependencies] console_error_panic_hook = "0.1.7" -evmlib = { path = "../evmlib", version = "0.1.8-rc.1", features = ["wasm-bindgen"] } +evmlib = { path = "../evmlib", version = "0.1.8", features = ["wasm-bindgen"] } # See https://github.com/sebcrozet/instant/blob/7bd13f51f5c930239fddc0476a837870fb239ed7/README.md#using-instant-for-a-wasm-platform-where-performancenow-is-not-available instant = { version = "0.1", features = ["wasm-bindgen", "inaccurate"] } js-sys = "0.3.70" diff --git a/evm-testnet/Cargo.toml b/evm-testnet/Cargo.toml index 953ea4d267..fcff5a809b 100644 --- a/evm-testnet/Cargo.toml +++ b/evm-testnet/Cargo.toml @@ -6,13 +6,13 @@ homepage = "https://maidsafe.net" license = "GPL-3.0" name = "evm-testnet" repository = "https://github.com/maidsafe/autonomi" -version = "0.1.8-rc.1" +version = "0.1.8" [dependencies] -ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } +ant-evm = { path = "../ant-evm", version = "0.1.8" } clap = { version = "4.5", features = ["derive"] } dirs-next = "~2.0.0" -evmlib = { path = "../evmlib", version = "0.1.8-rc.1" } +evmlib = { path = "../evmlib", version = "0.1.8" } tokio = { version = "1.40", features = ["rt-multi-thread", "signal"] } [lints] diff --git a/evmlib/Cargo.toml b/evmlib/Cargo.toml index 1512c69452..486516de27 100644 --- a/evmlib/Cargo.toml +++ b/evmlib/Cargo.toml @@ -6,7 +6,7 @@ homepage = "https://maidsafe.net" license = "GPL-3.0" name = "evmlib" repository = "https://github.com/maidsafe/safe_network" -version = "0.1.8-rc.1" +version = "0.1.8" [features] wasm-bindgen = ["alloy/wasm-bindgen"] diff --git a/nat-detection/Cargo.toml b/nat-detection/Cargo.toml index 899842e9f0..4c2d0c784e 100644 --- a/nat-detection/Cargo.toml +++ b/nat-detection/Cargo.toml @@ -7,7 +7,7 @@ license = "GPL-3.0" name = "nat-detection" readme = "README.md" repository = "https://github.com/maidsafe/autonomi" -version = "0.2.15-rc.1" +version = "0.2.15" [[bin]] name = "nat-detection" @@ -17,9 +17,9 @@ path = "src/main.rs" nightly = [] [dependencies] -ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } -ant-networking = { path = "../ant-networking", version = "0.3.3-rc.1" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23" } +ant-networking = { path = "../ant-networking", version = "0.3.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3" } clap = { version = "4.5.4", features = ["derive"] } clap-verbosity-flag = "2.2.0" color-eyre = { version = "0.6", default-features = false } diff --git a/node-launchpad/Cargo.toml b/node-launchpad/Cargo.toml index 14290613cd..d71003f3dc 100644 --- a/node-launchpad/Cargo.toml +++ b/node-launchpad/Cargo.toml @@ -2,7 +2,7 @@ authors = ["MaidSafe Developers "] description = "TUI for running nodes on the Autonomi network" name = "node-launchpad" -version = "0.5.3-rc.1" +version = "0.5.3" edition = "2021" license = "GPL-3.0" homepage = "https://maidsafe.net" @@ -18,13 +18,13 @@ path = "src/bin/tui/main.rs" nightly = [] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3-rc.1" } -ant-build-info = { path = "../ant-build-info", version = "0.1.23-rc.1" } -ant-evm = { path = "../ant-evm", version = "0.1.8-rc.1" } -ant-node-manager = { version = "0.11.7-rc.1", path = "../ant-node-manager" } -ant-protocol = { path = "../ant-protocol", version = "0.3.3-rc.1" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.23" } +ant-evm = { path = "../ant-evm", version = "0.1.8" } +ant-node-manager = { version = "0.11.7", path = "../ant-node-manager" } +ant-protocol = { path = "../ant-protocol", version = "0.3.3" } ant-releases = { version = "0.4.0" } -ant-service-management = { version = "0.4.7-rc.1", path = "../ant-service-management" } +ant-service-management = { version = "0.4.7", path = "../ant-service-management" } arboard = "3.4.1" atty = "0.2.14" better-panic = "0.3.0" diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index d7a5669474..7e6538d29f 100644 --- a/test-utils/Cargo.toml +++ b/test-utils/Cargo.toml @@ -7,13 +7,13 @@ license = "GPL-3.0" name = "test-utils" readme = "README.md" repository = "https://github.com/maidsafe/safe_network" -version = "0.4.15-rc.1" +version = "0.4.15" [dependencies] bytes = { version = "1.0.1", features = ["serde"] } color-eyre = "~0.6.2" dirs-next = "~2.0.0" -evmlib = { path = "../evmlib", version = "0.1.8-rc.1" } +evmlib = { path = "../evmlib", version = "0.1.8" } libp2p = { version = "0.54.1", features = ["identify", "kad"] } rand = "0.8.5" serde = { version = "1.0.133", features = ["derive"] } From 2360b17e79751f6407a64ad23a0c6d92037b061e Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Thu, 9 Jan 2025 11:37:28 +0100 Subject: [PATCH 26/38] feat(client): try get evm network from env by default on client::init(_local) --- ant-cli/src/actions/connect.rs | 6 ++---- autonomi/src/client/mod.rs | 10 +++------- evmlib/src/lib.rs | 7 +++++++ 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/ant-cli/src/actions/connect.rs b/ant-cli/src/actions/connect.rs index e7d03fd691..cba9ac217a 100644 --- a/ant-cli/src/actions/connect.rs +++ b/ant-cli/src/actions/connect.rs @@ -6,8 +6,8 @@ // KIND, either express or implied. Please review the Licences for the specific language governing // permissions and limitations relating to use of the SAFE Network Software. +use autonomi::Client; use autonomi::Multiaddr; -use autonomi::{get_evm_network_from_env, Client}; use color_eyre::eyre::bail; use color_eyre::eyre::Result; use indicatif::ProgressBar; @@ -23,9 +23,7 @@ pub async fn connect_to_network(peers: Vec) -> Result { progress_bar.set_message("Connecting to The Autonomi Network..."); match Client::init_with_peers(peers).await { - Ok(mut client) => { - let evm_network = get_evm_network_from_env()?; - client.set_evm_network(evm_network); + Ok(client) => { info!("Connected to the Network"); progress_bar.finish_with_message("Connected to the Network"); Ok(client) diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index df394611e2..fc002aa0b4 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -95,7 +95,7 @@ impl Default for ClientConfig { #[cfg(not(feature = "local"))] local: false, peers: None, - evm_network: Default::default(), + evm_network: EvmNetwork::try_from_env().unwrap_or_default(), } } } @@ -155,7 +155,7 @@ impl Client { Self::init_with_config(ClientConfig { local, peers: Some(peers), - evm_network: Default::default(), + evm_network: EvmNetwork::try_from_env().unwrap_or_default(), }) .await } @@ -262,7 +262,7 @@ impl Client { Ok(Self { network, client_event_sender: Arc::new(None), - evm_network: Default::default(), + evm_network: EvmNetwork::try_from_env().unwrap_or_default(), }) } @@ -275,10 +275,6 @@ impl Client { client_event_receiver } - - pub fn set_evm_network(&mut self, evm_network: EvmNetwork) { - self.evm_network = evm_network; - } } fn build_client_and_run_swarm(local: bool) -> (Network, mpsc::Receiver) { diff --git a/evmlib/src/lib.rs b/evmlib/src/lib.rs index db7d599281..8847f37e8a 100644 --- a/evmlib/src/lib.rs +++ b/evmlib/src/lib.rs @@ -7,6 +7,7 @@ // permissions and limitations relating to use of the SAFE Network Software. use crate::common::Address; +use crate::utils::get_evm_network_from_env; use alloy::primitives::address; use alloy::transports::http::reqwest; use serde::{Deserialize, Serialize}; @@ -103,6 +104,12 @@ impl std::fmt::Display for Network { } impl Network { + pub fn try_from_env() -> Result { + get_evm_network_from_env().inspect_err(|err| { + warn!("Failed to select EVM network from ENV: {err}"); + }) + } + pub fn new_custom(rpc_url: &str, payment_token_addr: &str, chunk_payments_addr: &str) -> Self { Self::Custom(CustomNetwork::new( rpc_url, From 529354b8d9253e8960d51cb4433ef832733ce3a2 Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Fri, 10 Jan 2025 15:57:02 +0100 Subject: [PATCH 27/38] refactor!: remove deprecated `Client::connect` fn --- autonomi/src/client/mod.rs | 55 -------------------------------------- 1 file changed, 55 deletions(-) diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index 0368e9bdd0..459b29674c 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -211,61 +211,6 @@ impl Client { }) } - /// Connect to the network. - /// - /// This will timeout after [`CONNECT_TIMEOUT_SECS`] secs. - /// - /// ```no_run - /// # use autonomi::client::Client; - /// # #[tokio::main] - /// # async fn main() -> Result<(), Box> { - /// let peers = ["/ip4/127.0.0.1/udp/1234/quic-v1".parse()?]; - /// #[allow(deprecated)] - /// let client = Client::connect(&peers).await?; - /// # Ok(()) - /// # } - /// ``` - #[deprecated( - since = "0.2.4", - note = "Use [`Client::init`] or [`Client::init_with_config`] instead" - )] - pub async fn connect(peers: &[Multiaddr]) -> Result { - // Any global address makes the client non-local - let local = !peers.iter().any(multiaddr_is_global); - - let (network, event_receiver) = build_client_and_run_swarm(local); - - // Spawn task to dial to the given peers - let network_clone = network.clone(); - let peers = peers.to_vec(); - let _handle = ant_networking::time::spawn(async move { - for addr in peers { - if let Err(err) = network_clone.dial(addr.clone()).await { - error!("Failed to dial addr={addr} with err: {err:?}"); - eprintln!("addr={addr} Failed to dial: {err:?}"); - }; - } - }); - - let (sender, receiver) = futures::channel::oneshot::channel(); - ant_networking::time::spawn(handle_event_receiver(event_receiver, sender)); - - receiver.await.expect("sender should not close")?; - debug!("Client is connected to the network"); - - // With the switch to the new bootstrap cache scheme, - // Seems the too many `initial dial`s could result in failure, - // when startup quoting/upload tasks got started up immediatly. - // Hence, put in a forced wait to allow `initial network discovery` to be completed. - ant_networking::time::sleep(Duration::from_secs(5)).await; - - Ok(Self { - network, - client_event_sender: Arc::new(None), - evm_network: EvmNetwork::try_from_env().unwrap_or_default(), - }) - } - /// Receive events from the client. pub fn enable_client_events(&mut self) -> mpsc::Receiver { let (client_event_sender, client_event_receiver) = From 4704f481903ff1a41e3b87a31804c8012a34b3a6 Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Fri, 10 Jan 2025 18:02:56 +0100 Subject: [PATCH 28/38] fix(test): run tests in series --- Cargo.lock | 41 +++++++++++++++++++++++++++++++++++++++++ autonomi/Cargo.toml | 1 + autonomi/tests/fs.rs | 3 +++ 3 files changed, 45 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 2601b8fca5..5c7b7b3f53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1593,6 +1593,7 @@ dependencies = [ "rmp-serde", "self_encryption", "serde", + "serial_test", "sha2", "test-utils", "thiserror 1.0.69", @@ -7966,6 +7967,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scc" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28e1c91382686d21b5ac7959341fcb9780fa7c03773646995a87c950fa7be640" +dependencies = [ + "sdd", +] + [[package]] name = "schnellru" version = "0.2.3" @@ -8009,6 +8019,12 @@ dependencies = [ "untrusted 0.9.0", ] +[[package]] +name = "sdd" +version = "3.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478f121bb72bbf63c52c93011ea1791dca40140dfe13f8336c4c5ac952c33aa9" + [[package]] name = "sec1" version = "0.7.3" @@ -8192,6 +8208,31 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "serial_test" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" +dependencies = [ + "futures", + "log", + "once_cell", + "parking_lot", + "scc", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "service-manager" version = "0.7.1" diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index 40f3a2fabb..89c132cb20 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -58,6 +58,7 @@ xor_name = "5.0.0" alloy = { version = "0.7.3", default-features = false, features = ["contract", "json-rpc", "network", "node-bindings", "provider-http", "reqwest-rustls-tls", "rpc-client", "rpc-types", "signer-local", "std"] } ant-logging = { path = "../ant-logging", version = "0.2.44" } eyre = "0.6.5" +serial_test = "3.2.0" sha2 = "0.10.6" # Do not specify the version field. Release process expects even the local dev deps to be published. # Removing the version field is a workaround. diff --git a/autonomi/tests/fs.rs b/autonomi/tests/fs.rs index 88198c4cc6..487db39c43 100644 --- a/autonomi/tests/fs.rs +++ b/autonomi/tests/fs.rs @@ -9,6 +9,7 @@ use ant_logging::LogBuilder; use autonomi::Client; use eyre::Result; +use serial_test::serial; use sha2::{Digest, Sha256}; use std::fs::File; use std::io::{BufReader, Read}; @@ -20,6 +21,7 @@ use walkdir::WalkDir; // With a local evm network, and local network, run: // EVM_NETWORK=local cargo test --features="local" --package autonomi --test fs #[tokio::test] +#[serial] async fn dir_upload_download() -> Result<()> { let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("dir_upload_download", false); @@ -75,6 +77,7 @@ fn compute_dir_sha256(dir: &str) -> Result { } #[tokio::test] +#[serial] async fn file_into_vault() -> Result<()> { let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("file", false); From 95f29491fbdefc1865d8a65d9ed7f452de39dd52 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 09:47:25 +0100 Subject: [PATCH 29/38] refactor(node): remove --owner (discord) flag --- ant-node-manager/src/add_services/config.rs | 12 -- ant-node-manager/src/add_services/mod.rs | 12 -- ant-node-manager/src/add_services/tests.rs | 202 ------------------ ant-node-manager/src/bin/cli/main.rs | 46 ----- ant-node-manager/src/cmd/local.rs | 8 - ant-node-manager/src/cmd/node.rs | 4 - ant-node-manager/src/lib.rs | 215 -------------------- ant-node-manager/src/local.rs | 32 +-- ant-node-manager/src/rpc.rs | 3 - ant-node/src/bin/antnode/main.rs | 10 +- ant-service-management/src/node.rs | 7 - node-launchpad/src/node_mgmt.rs | 2 - 12 files changed, 4 insertions(+), 549 deletions(-) diff --git a/ant-node-manager/src/add_services/config.rs b/ant-node-manager/src/add_services/config.rs index 7aac0eaeb6..b2037bbc86 100644 --- a/ant-node-manager/src/add_services/config.rs +++ b/ant-node-manager/src/add_services/config.rs @@ -85,7 +85,6 @@ pub struct InstallNodeServiceCtxBuilder { pub metrics_port: Option, pub node_ip: Option, pub node_port: Option, - pub owner: Option, pub peers_args: PeersArgs, pub rewards_address: RewardsAddress, pub rpc_socket_addr: SocketAddr, @@ -132,10 +131,6 @@ impl InstallNodeServiceCtxBuilder { args.push(OsString::from("--metrics-server-port")); args.push(OsString::from(metrics_port.to_string())); } - if let Some(owner) = self.owner { - args.push(OsString::from("--owner")); - args.push(OsString::from(owner)); - } if let Some(log_files) = self.max_archived_log_files { args.push(OsString::from("--max-archived-log-files")); args.push(OsString::from(log_files.to_string())); @@ -193,7 +188,6 @@ pub struct AddNodeServiceOptions { pub network_id: Option, pub node_ip: Option, pub node_port: Option, - pub owner: Option, pub peers_args: PeersArgs, pub rewards_address: RewardsAddress, pub rpc_address: Option, @@ -327,7 +321,6 @@ mod tests { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124") .unwrap(), @@ -363,7 +356,6 @@ mod tests { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124") .unwrap(), @@ -400,7 +392,6 @@ mod tests { network_id: Some(5), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124") .unwrap(), @@ -490,7 +481,6 @@ mod tests { builder.node_ip = Some(Ipv4Addr::new(192, 168, 1, 1)); builder.node_port = Some(12345); builder.metrics_port = Some(9090); - builder.owner = Some("test-owner".to_string()); builder.peers_args.addrs = vec![ "/ip4/127.0.0.1/tcp/8080".parse().unwrap(), "/ip4/192.168.1.1/tcp/8081".parse().unwrap(), @@ -531,8 +521,6 @@ mod tests { "12345", "--metrics-server-port", "9090", - "--owner", - "test-owner", "--max-archived-log-files", "10", "--max-log-files", diff --git a/ant-node-manager/src/add_services/mod.rs b/ant-node-manager/src/add_services/mod.rs index 76e8d46c12..842040b49c 100644 --- a/ant-node-manager/src/add_services/mod.rs +++ b/ant-node-manager/src/add_services/mod.rs @@ -78,16 +78,6 @@ pub async fn add_node( check_port_availability(port_option, &node_registry.nodes)?; } - let owner = match &options.owner { - Some(owner) => { - if owner.chars().any(|c| c.is_uppercase()) { - warn!("Owner name ({owner}) contains uppercase characters and will be converted to lowercase"); - } - Some(owner.to_lowercase()) - } - None => None, - }; - let antnode_file_name = options .antnode_src_path .file_name() @@ -213,7 +203,6 @@ pub async fn add_node( network_id: options.network_id, node_ip: options.node_ip, node_port, - owner: owner.clone(), peers_args: options.peers_args.clone(), rewards_address: options.rewards_address, rpc_socket_addr, @@ -254,7 +243,6 @@ pub async fn add_node( rewards_address: options.rewards_address, reward_balance: None, rpc_socket_addr, - owner: owner.clone(), peer_id: None, peers_args: options.peers_args.clone(), pid: None, diff --git a/ant-node-manager/src/add_services/tests.rs b/ant-node-manager/src/add_services/tests.rs index 58eaf31162..e1b2bea58a 100644 --- a/ant-node-manager/src/add_services/tests.rs +++ b/ant-node-manager/src/add_services/tests.rs @@ -142,7 +142,6 @@ async fn add_genesis_node_should_use_latest_version_and_add_one_service() -> Res network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -177,7 +176,6 @@ async fn add_genesis_node_should_use_latest_version_and_add_one_service() -> Res network_id: None, node_ip: None, node_port: None, - owner: None, peers_args, rpc_address: None, rpc_port: None, @@ -300,7 +298,6 @@ async fn add_genesis_node_should_return_an_error_if_there_is_already_a_genesis_n node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: peers_args.clone(), pid: None, @@ -347,7 +344,6 @@ async fn add_genesis_node_should_return_an_error_if_there_is_already_a_genesis_n network_id: None, node_ip: None, node_port: None, - owner: None, peers_args, rpc_address: Some(custom_rpc_address), rpc_port: None, @@ -437,7 +433,6 @@ async fn add_genesis_node_should_return_an_error_if_count_is_greater_than_1() -> network_id: None, node_ip: None, node_port: None, - owner: None, peers_args, rpc_address: None, rpc_port: None, @@ -534,7 +529,6 @@ async fn add_node_should_use_latest_version_and_add_three_services() -> Result<( name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), antnode_path: node_data_dir @@ -583,7 +577,6 @@ async fn add_node_should_use_latest_version_and_add_three_services() -> Result<( name: "antnode2".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8083), @@ -632,7 +625,6 @@ async fn add_node_should_use_latest_version_and_add_three_services() -> Result<( name: "antnode3".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8085), @@ -668,7 +660,6 @@ async fn add_node_should_use_latest_version_and_add_three_services() -> Result<( network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -815,7 +806,6 @@ async fn add_node_should_update_the_environment_variables_inside_node_registry() name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -850,7 +840,6 @@ async fn add_node_should_update_the_environment_variables_inside_node_registry() network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -946,7 +935,6 @@ async fn add_new_node_should_add_another_service() -> Result<()> { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1006,7 +994,6 @@ async fn add_new_node_should_add_another_service() -> Result<()> { peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8083), - owner: None, antnode_path: node_data_dir .to_path_buf() .join("antnode2") @@ -1039,7 +1026,6 @@ async fn add_new_node_should_add_another_service() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -1203,7 +1189,6 @@ async fn add_node_should_create_service_file_with_first_arg() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1360,7 +1345,6 @@ async fn add_node_should_create_service_file_with_peers_args() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1512,7 +1496,6 @@ async fn add_node_should_create_service_file_with_local_arg() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1668,7 +1651,6 @@ async fn add_node_should_create_service_file_with_network_contacts_url_arg() -> network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1823,7 +1805,6 @@ async fn add_node_should_create_service_file_with_testnet_arg() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -1975,7 +1956,6 @@ async fn add_node_should_create_service_file_with_ignore_cache_arg() -> Result<( network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -2128,7 +2108,6 @@ async fn add_node_should_create_service_file_with_custom_bootstrap_cache_path() network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: peers_args.clone(), rpc_address: None, rpc_port: None, @@ -2274,7 +2253,6 @@ async fn add_node_should_create_service_file_with_network_id() -> Result<()> { network_id: Some(5), node_ip: None, node_port: None, - owner: None, peers_args: Default::default(), rpc_address: None, rpc_port: None, @@ -2418,7 +2396,6 @@ async fn add_node_should_use_custom_ip() -> Result<()> { network_id: None, node_ip: Some(custom_ip), node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -2516,7 +2493,6 @@ async fn add_node_should_use_custom_ports_for_one_service() -> Result<()> { name: "antnode1".to_string(), node_ip: None, node_port: Some(custom_port), - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -2552,7 +2528,6 @@ async fn add_node_should_use_custom_ports_for_one_service() -> Result<()> { network_id: None, node_ip: None, node_port: Some(PortRange::Single(custom_port)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -2810,7 +2785,6 @@ async fn add_node_should_use_a_custom_port_range() -> Result<()> { network_id: None, node_ip: None, node_port: Some(PortRange::Range(12000, 12002)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -2886,7 +2860,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_is_used() -> R node_ip: None, node_port: Some(12000), number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -2931,7 +2904,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_is_used() -> R network_id: None, node_ip: None, node_port: Some(PortRange::Single(12000)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3004,7 +2976,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_in_range_is_us network_id: None, node_ip: None, node_port: Some(12000), - owner: None, peers_args: PeersArgs::default(), number: 1, peer_id: None, @@ -3050,7 +3021,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_port_in_range_is_us network_id: None, node_ip: None, node_port: Some(PortRange::Range(12000, 12002)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3129,7 +3099,6 @@ async fn add_node_should_return_an_error_if_port_and_node_count_do_not_match() - network_id: None, node_ip: None, node_port: Some(PortRange::Range(12000, 12002)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3213,7 +3182,6 @@ async fn add_node_should_return_an_error_if_multiple_services_are_specified_with network_id: None, node_ip: None, node_port: Some(PortRange::Single(12000)), - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3359,7 +3327,6 @@ async fn add_node_should_set_random_ports_if_enable_metrics_server_is_true() -> network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3497,7 +3464,6 @@ async fn add_node_should_set_max_archived_log_files() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3636,7 +3602,6 @@ async fn add_node_should_set_max_log_files() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3889,7 +3854,6 @@ async fn add_node_should_use_a_custom_port_range_for_metrics_server() -> Result< network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -3962,7 +3926,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_is_use node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -4007,7 +3970,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_is_use network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -4082,7 +4044,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_in_ran node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -4127,7 +4088,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_metrics_port_in_ran network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -4363,7 +4323,6 @@ async fn add_node_should_use_a_custom_port_range_for_the_rpc_server() -> Result< network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: Some(PortRange::Range(20000, 20002)), @@ -4447,7 +4406,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_is_used() node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -4492,7 +4450,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_is_used() network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: Some(PortRange::Single(8081)), @@ -4567,7 +4524,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_in_range_i node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -4612,7 +4568,6 @@ async fn add_node_should_return_an_error_if_duplicate_custom_rpc_port_in_range_i network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: Some(PortRange::Range(8081, 8082)), @@ -4708,7 +4663,6 @@ async fn add_node_should_disable_upnp_and_home_network_if_nat_status_is_public() name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -4743,7 +4697,6 @@ async fn add_node_should_disable_upnp_and_home_network_if_nat_status_is_public() network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -4836,7 +4789,6 @@ async fn add_node_should_enable_upnp_if_nat_status_is_upnp() -> Result<()> { name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -4871,7 +4823,6 @@ async fn add_node_should_enable_upnp_if_nat_status_is_upnp() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -4964,7 +4915,6 @@ async fn add_node_should_enable_home_network_if_nat_status_is_private() -> Resul name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 12001), @@ -4999,7 +4949,6 @@ async fn add_node_should_enable_home_network_if_nat_status_is_private() -> Resul network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -5086,7 +5035,6 @@ async fn add_node_should_return_an_error_if_nat_status_is_none_but_auto_set_nat_ network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -5708,7 +5656,6 @@ async fn add_node_should_not_delete_the_source_binary_if_path_arg_is_used() -> R name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -5744,7 +5691,6 @@ async fn add_node_should_not_delete_the_source_binary_if_path_arg_is_used() -> R network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -5838,7 +5784,6 @@ async fn add_node_should_apply_the_home_network_flag_if_it_is_used() -> Result<( name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -5874,7 +5819,6 @@ async fn add_node_should_apply_the_home_network_flag_if_it_is_used() -> Result<( network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -5968,7 +5912,6 @@ async fn add_node_should_add_the_node_in_user_mode() -> Result<()> { name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -6004,7 +5947,6 @@ async fn add_node_should_add_the_node_in_user_mode() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -6095,7 +6037,6 @@ async fn add_node_should_add_the_node_with_upnp_enabled() -> Result<()> { name: "antnode1".to_string(), node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rewards_address: RewardsAddress::from_str("0x03B770D9cD32077cC0bF330c13C114a87643B124")?, rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), @@ -6131,7 +6072,6 @@ async fn add_node_should_add_the_node_with_upnp_enabled() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: None, peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, @@ -6168,145 +6108,6 @@ async fn add_node_should_add_the_node_with_upnp_enabled() -> Result<()> { Ok(()) } -#[tokio::test] -async fn add_node_should_assign_an_owner_in_lowercase() -> Result<()> { - let tmp_data_dir = assert_fs::TempDir::new()?; - let node_reg_path = tmp_data_dir.child("node_reg.json"); - - let latest_version = "0.96.4"; - let temp_dir = assert_fs::TempDir::new()?; - let node_data_dir = temp_dir.child("data"); - node_data_dir.create_dir_all()?; - let node_logs_dir = temp_dir.child("logs"); - node_logs_dir.create_dir_all()?; - let antnode_download_path = temp_dir.child(ANTNODE_FILE_NAME); - antnode_download_path.write_binary(b"fake antnode bin")?; - - let mut node_registry = NodeRegistry { - auditor: None, - daemon: None, - environment_variables: None, - faucet: None, - nat_status: None, - nodes: vec![], - save_path: node_reg_path.to_path_buf(), - }; - - let mut mock_service_control = MockServiceControl::new(); - let mut seq = Sequence::new(); - mock_service_control - .expect_get_available_port() - .times(1) - .returning(|| Ok(8081)) - .in_sequence(&mut seq); - - mock_service_control - .expect_install() - .with( - eq(ServiceInstallCtx { - args: vec![ - OsString::from("--rpc"), - OsString::from("127.0.0.1:8081"), - OsString::from("--root-dir"), - OsString::from( - node_data_dir - .to_path_buf() - .join("antnode1") - .to_string_lossy() - .to_string(), - ), - OsString::from("--log-output-dest"), - OsString::from( - node_logs_dir - .to_path_buf() - .join("antnode1") - .to_string_lossy() - .to_string(), - ), - OsString::from("--owner"), - OsString::from("discord_username"), - OsString::from("--rewards-address"), - OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), - OsString::from("evm-custom"), - OsString::from("--rpc-url"), - OsString::from("http://localhost:8545/"), - OsString::from("--payment-token-address"), - OsString::from("0x5FbDB2315678afecb367f032d93F642f64180aa3"), - OsString::from("--data-payments-address"), - OsString::from("0x8464135c8F25Da09e49BC8782676a84730C318bC"), - ], - autostart: false, - contents: None, - environment: None, - label: "antnode1".parse()?, - program: node_data_dir - .to_path_buf() - .join("antnode1") - .join(ANTNODE_FILE_NAME), - username: Some(get_username()), - working_directory: None, - }), - eq(false), - ) - .times(1) - .returning(|_, _| Ok(())) - .in_sequence(&mut seq); - - add_node( - AddNodeServiceOptions { - auto_restart: false, - auto_set_nat_flags: false, - count: None, - delete_antnode_src: true, - enable_metrics_server: false, - env_variables: None, - home_network: false, - log_format: None, - max_archived_log_files: None, - max_log_files: None, - metrics_port: None, - network_id: None, - node_ip: None, - node_port: None, - owner: Some("Discord_Username".to_string()), - peers_args: PeersArgs::default(), - rpc_address: None, - rpc_port: None, - antnode_dir_path: temp_dir.to_path_buf(), - antnode_src_path: antnode_download_path.to_path_buf(), - service_data_dir_path: node_data_dir.to_path_buf(), - service_log_dir_path: node_logs_dir.to_path_buf(), - upnp: false, - user: Some(get_username()), - user_mode: false, - version: latest_version.to_string(), - evm_network: EvmNetwork::Custom(CustomNetwork { - rpc_url_http: "http://localhost:8545".parse()?, - payment_token_address: RewardsAddress::from_str( - "0x5FbDB2315678afecb367f032d93F642f64180aa3", - )?, - data_payments_address: RewardsAddress::from_str( - "0x8464135c8F25Da09e49BC8782676a84730C318bC", - )?, - }), - rewards_address: RewardsAddress::from_str( - "0x03B770D9cD32077cC0bF330c13C114a87643B124", - )?, - }, - &mut node_registry, - &mock_service_control, - VerbosityLevel::Normal, - ) - .await?; - - assert_eq!( - node_registry.nodes[0].owner, - Some("discord_username".to_string()) - ); - - Ok(()) -} - #[tokio::test] async fn add_node_should_auto_restart() -> Result<()> { let tmp_data_dir = assert_fs::TempDir::new()?; @@ -6362,8 +6163,6 @@ async fn add_node_should_auto_restart() -> Result<()> { .to_string_lossy() .to_string(), ), - OsString::from("--owner"), - OsString::from("discord_username"), OsString::from("--rewards-address"), OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), OsString::from("evm-custom"), @@ -6407,7 +6206,6 @@ async fn add_node_should_auto_restart() -> Result<()> { network_id: None, node_ip: None, node_port: None, - owner: Some("discord_username".to_string()), peers_args: PeersArgs::default(), rpc_address: None, rpc_port: None, diff --git a/ant-node-manager/src/bin/cli/main.rs b/ant-node-manager/src/bin/cli/main.rs index b440cb09d8..fa6dbb71c7 100644 --- a/ant-node-manager/src/bin/cli/main.rs +++ b/ant-node-manager/src/bin/cli/main.rs @@ -191,15 +191,6 @@ pub enum SubCmd { /// services, which in this case would be 5. The range must also go from lower to higher. #[clap(long, value_parser = PortRange::parse)] node_port: Option, - /// Specify the owner for the node service. - /// - /// This is mainly used for the 'Beta Rewards' programme, for linking your Discord username - /// to the node. - /// - /// If the option is not used, the node will assign its own username and the service will - /// run as normal. - #[clap(long)] - owner: Option, /// Provide a path for the antnode binary to be used by the service. /// /// Useful for creating the service using a custom built binary. @@ -862,19 +853,6 @@ pub enum LocalSubCmd { node_version: Option, #[command(flatten)] peers: PeersArgs, - /// Specify the owner for each node in the local network - /// - /// The argument exists to support testing scenarios. - #[clap(long, conflicts_with = "owner_prefix")] - owner: Option, - /// Use this argument to launch each node in the network with an individual owner. - /// - /// Assigned owners will take the form "prefix_1", "prefix_2" etc., where "prefix" will be - /// replaced by the value specified by this argument. - /// - /// The argument exists to support testing scenarios. - #[clap(long, conflicts_with = "owner")] - owner_prefix: Option, /// Specify a port for the RPC service(s). /// /// If not used, ports will be selected at random. @@ -972,20 +950,6 @@ pub enum LocalSubCmd { /// The version and path arguments are mutually exclusive. #[clap(long, conflicts_with = "build")] node_version: Option, - /// Specify the owner for each node in the local network - /// - /// The argument exists to support testing scenarios. - #[clap(long, conflicts_with = "owner_prefix")] - owner: Option, - /// Use this argument to launch each node in the network with an individual owner. - /// - /// Assigned owners will take the form "prefix_1", "prefix_2" etc., where "prefix" will be - /// replaced by the value specified by this argument. - /// - /// The argument exists to support testing scenarios. - #[clap(long)] - #[clap(long, conflicts_with = "owner")] - owner_prefix: Option, /// Specify a port for the RPC service(s). /// /// If not used, ports will be selected at random. @@ -1083,7 +1047,6 @@ async fn main() -> Result<()> { network_id, node_ip, node_port, - owner, path, peers, rewards_address, @@ -1111,7 +1074,6 @@ async fn main() -> Result<()> { network_id, node_ip, node_port, - owner, peers, rewards_address, rpc_address, @@ -1223,8 +1185,6 @@ async fn main() -> Result<()> { node_port, node_version, log_format, - owner, - owner_prefix, peers, rpc_port, rewards_address, @@ -1246,8 +1206,6 @@ async fn main() -> Result<()> { node_port, node_version, log_format, - owner, - owner_prefix, peers, rpc_port, rewards_address, @@ -1269,8 +1227,6 @@ async fn main() -> Result<()> { node_path, node_port, node_version, - owner, - owner_prefix, rpc_port, rewards_address, evm_network, @@ -1292,8 +1248,6 @@ async fn main() -> Result<()> { node_port, node_version, log_format, - owner, - owner_prefix, rpc_port, rewards_address, evm_network, diff --git a/ant-node-manager/src/cmd/local.rs b/ant-node-manager/src/cmd/local.rs index 2f0b3b465b..736f7806f7 100644 --- a/ant-node-manager/src/cmd/local.rs +++ b/ant-node-manager/src/cmd/local.rs @@ -34,8 +34,6 @@ pub async fn join( node_port: Option, node_version: Option, log_format: Option, - owner: Option, - owner_prefix: Option, _peers_args: PeersArgs, rpc_port: Option, rewards_address: RewardsAddress, @@ -78,8 +76,6 @@ pub async fn join( metrics_port, node_count: count, node_port, - owner, - owner_prefix, peers: None, rpc_port, skip_validation, @@ -119,8 +115,6 @@ pub async fn run( node_port: Option, node_version: Option, log_format: Option, - owner: Option, - owner_prefix: Option, rpc_port: Option, rewards_address: RewardsAddress, evm_network: Option, @@ -188,8 +182,6 @@ pub async fn run( metrics_port, node_port, node_count: count, - owner, - owner_prefix, peers: None, rpc_port, skip_validation, diff --git a/ant-node-manager/src/cmd/node.rs b/ant-node-manager/src/cmd/node.rs index 5ab42c0ea8..3812834811 100644 --- a/ant-node-manager/src/cmd/node.rs +++ b/ant-node-manager/src/cmd/node.rs @@ -52,7 +52,6 @@ pub async fn add( network_id: Option, node_ip: Option, node_port: Option, - owner: Option, mut peers_args: PeersArgs, rewards_address: RewardsAddress, rpc_address: Option, @@ -129,7 +128,6 @@ pub async fn add( network_id, node_ip, node_port, - owner, peers_args, rewards_address, rpc_address, @@ -598,7 +596,6 @@ pub async fn maintain_n_running_nodes( network_id: Option, node_ip: Option, node_port: Option, - owner: Option, peers_args: PeersArgs, rewards_address: RewardsAddress, rpc_address: Option, @@ -703,7 +700,6 @@ pub async fn maintain_n_running_nodes( network_id, node_ip, Some(PortRange::Single(port)), - owner.clone(), peers_args.clone(), rewards_address, rpc_address, diff --git a/ant-node-manager/src/lib.rs b/ant-node-manager/src/lib.rs index 8b2aaee95b..e0d6d908d3 100644 --- a/ant-node-manager/src/lib.rs +++ b/ant-node-manager/src/lib.rs @@ -771,7 +771,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -885,7 +884,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -964,7 +962,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1083,7 +1080,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1175,7 +1171,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1277,7 +1272,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1378,7 +1372,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1449,7 +1442,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1512,7 +1504,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1573,7 +1564,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1637,7 +1627,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: None, peers_args: PeersArgs::default(), pid: None, @@ -1712,7 +1701,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1852,7 +1840,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -1953,7 +1940,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2099,7 +2085,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2257,7 +2242,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2410,7 +2394,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2564,7 +2547,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2743,7 +2725,6 @@ mod tests { node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -2915,7 +2896,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3093,7 +3073,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3254,7 +3233,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3424,7 +3402,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3604,7 +3581,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3779,7 +3755,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -3949,7 +3924,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4129,7 +4103,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4290,7 +4263,6 @@ network_id: None, network_id: None, node_ip: None, node_port: None, - owner: None, number: 1, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", @@ -4456,7 +4428,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4618,7 +4589,6 @@ network_id: None, number: 1, node_ip: Some(Ipv4Addr::new(192, 168, 1, 1)), node_port: None, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4783,7 +4753,6 @@ network_id: None, number: 1, node_ip: None, node_port: Some(12000), - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -4944,7 +4913,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5109,7 +5077,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5272,7 +5239,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5437,7 +5403,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5483,171 +5448,6 @@ network_id: None, Ok(()) } - #[tokio::test] - async fn upgrade_should_retain_owner() -> Result<()> { - let current_version = "0.1.0"; - let target_version = "0.2.0"; - - let tmp_data_dir = assert_fs::TempDir::new()?; - let current_install_dir = tmp_data_dir.child("antnode_install"); - current_install_dir.create_dir_all()?; - - let current_node_bin = current_install_dir.child("antnode"); - current_node_bin.write_binary(b"fake antnode binary")?; - let target_node_bin = tmp_data_dir.child("antnode"); - target_node_bin.write_binary(b"fake antnode binary")?; - - let mut mock_service_control = MockServiceControl::new(); - let mut mock_rpc_client = MockRpcClient::new(); - - // before binary upgrade - mock_service_control - .expect_get_process_pid() - .with(eq(current_node_bin.to_path_buf().clone())) - .times(1) - .returning(|_| Ok(1000)); - mock_service_control - .expect_stop() - .with(eq("antnode1"), eq(false)) - .times(1) - .returning(|_, _| Ok(())); - - // after binary upgrade - mock_service_control - .expect_uninstall() - .with(eq("antnode1"), eq(false)) - .times(1) - .returning(|_, _| Ok(())); - mock_service_control - .expect_install() - .with( - eq(ServiceInstallCtx { - args: vec![ - OsString::from("--rpc"), - OsString::from("127.0.0.1:8081"), - OsString::from("--root-dir"), - OsString::from("/var/antctl/services/antnode1"), - OsString::from("--log-output-dest"), - OsString::from("/var/log/antnode/antnode1"), - OsString::from("--owner"), - OsString::from("discord_username"), - OsString::from("--rewards-address"), - OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), - OsString::from("evm-arbitrum-one"), - ], - autostart: false, - contents: None, - environment: None, - label: "antnode1".parse()?, - program: current_node_bin.to_path_buf(), - username: Some("ant".to_string()), - working_directory: None, - }), - eq(false), - ) - .times(1) - .returning(|_, _| Ok(())); - - // after service restart - mock_service_control - .expect_start() - .with(eq("antnode1"), eq(false)) - .times(1) - .returning(|_, _| Ok(())); - mock_service_control - .expect_wait() - .with(eq(3000)) - .times(1) - .returning(|_| ()); - mock_service_control - .expect_get_process_pid() - .with(eq(current_node_bin.to_path_buf().clone())) - .times(1) - .returning(|_| Ok(100)); - - mock_rpc_client.expect_node_info().times(1).returning(|| { - Ok(NodeInfo { - pid: 2000, - peer_id: PeerId::from_str("12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR")?, - data_path: PathBuf::from("/var/antctl/services/antnode1"), - log_path: PathBuf::from("/var/log/antnode/antnode1"), - version: target_version.to_string(), - uptime: std::time::Duration::from_secs(1), // the service was just started - wallet_balance: 0, - }) - }); - mock_rpc_client - .expect_network_info() - .times(1) - .returning(|| { - Ok(NetworkInfo { - connected_peers: Vec::new(), - listeners: Vec::new(), - }) - }); - - let mut service_data = NodeServiceData { - auto_restart: false, - connected_peers: None, - data_dir_path: PathBuf::from("/var/antctl/services/antnode1"), - evm_network: EvmNetwork::ArbitrumOne, - home_network: false, - listen_addr: None, - log_dir_path: PathBuf::from("/var/log/antnode/antnode1"), - log_format: None, - max_archived_log_files: None, - max_log_files: None, - metrics_port: None, - network_id: None, - node_ip: None, - node_port: None, - number: 1, - owner: Some("discord_username".to_string()), - peer_id: Some(PeerId::from_str( - "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", - )?), - peers_args: PeersArgs::default(), - pid: Some(1000), - rewards_address: RewardsAddress::from_str( - "0x03B770D9cD32077cC0bF330c13C114a87643B124", - )?, - reward_balance: Some(AttoTokens::zero()), - rpc_socket_addr: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8081), - antnode_path: current_node_bin.to_path_buf(), - service_name: "antnode1".to_string(), - status: ServiceStatus::Running, - upnp: false, - user: Some("ant".to_string()), - user_mode: false, - version: current_version.to_string(), - }; - let service = NodeService::new(&mut service_data, Box::new(mock_rpc_client)); - - let mut service_manager = ServiceManager::new( - service, - Box::new(mock_service_control), - VerbosityLevel::Normal, - ); - - service_manager - .upgrade(UpgradeOptions { - auto_restart: false, - env_variables: None, - force: false, - start_service: true, - target_bin_path: target_node_bin.to_path_buf(), - target_version: Version::parse(target_version).unwrap(), - }) - .await?; - - assert_eq!( - service_manager.service.service_data.owner, - Some("discord_username".to_string()) - ); - - Ok(()) - } - #[tokio::test] async fn upgrade_should_retain_auto_restart() -> Result<()> { let current_version = "0.1.0"; @@ -5694,8 +5494,6 @@ network_id: None, OsString::from("/var/antctl/services/antnode1"), OsString::from("--log-output-dest"), OsString::from("/var/log/antnode/antnode1"), - OsString::from("--owner"), - OsString::from("discord_username"), OsString::from("--rewards-address"), OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), OsString::from("evm-arbitrum-one"), @@ -5767,7 +5565,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: Some("discord_username".to_string()), peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -5856,8 +5653,6 @@ network_id: None, OsString::from("/var/antctl/services/antnode1"), OsString::from("--log-output-dest"), OsString::from("/var/log/antnode/antnode1"), - OsString::from("--owner"), - OsString::from("discord_username"), OsString::from("--rewards-address"), OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), OsString::from("evm-custom"), @@ -5943,7 +5738,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: Some("discord_username".to_string()), peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -6033,8 +5827,6 @@ network_id: None, OsString::from("/var/antctl/services/antnode1"), OsString::from("--log-output-dest"), OsString::from("/var/log/antnode/antnode1"), - OsString::from("--owner"), - OsString::from("discord_username"), OsString::from("--rewards-address"), OsString::from("0x03B770D9cD32077cC0bF330c13C114a87643B124"), OsString::from("evm-custom"), @@ -6120,7 +5912,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: Some("discord_username".to_string()), peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -6285,7 +6076,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peer_id: Some(PeerId::from_str( "12D3KooWS2tpXGGTmg2AHFiDh57yPQnat49YHnyqoggzXZWpqkCR", )?), @@ -6370,7 +6160,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peers_args: PeersArgs::default(), peer_id: None, pid: None, @@ -6439,7 +6228,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peers_args: PeersArgs::default(), pid: Some(1000), peer_id: Some(PeerId::from_str( @@ -6523,7 +6311,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, peers_args: PeersArgs::default(), pid: Some(1000), peer_id: Some(PeerId::from_str( @@ -6602,7 +6389,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, pid: None, peers_args: PeersArgs::default(), peer_id: None, @@ -6679,7 +6465,6 @@ network_id: None, node_ip: None, node_port: None, number: 1, - owner: None, pid: None, peers_args: PeersArgs::default(), peer_id: None, diff --git a/ant-node-manager/src/local.rs b/ant-node-manager/src/local.rs index 6acd1d6531..a7ed6529cb 100644 --- a/ant-node-manager/src/local.rs +++ b/ant-node-manager/src/local.rs @@ -43,7 +43,6 @@ pub trait Launcher { log_format: Option, metrics_port: Option, node_port: Option, - owner: Option, rpc_socket_addr: SocketAddr, rewards_address: RewardsAddress, evm_network: Option, @@ -67,18 +66,12 @@ impl Launcher for LocalSafeLauncher { log_format: Option, metrics_port: Option, node_port: Option, - owner: Option, rpc_socket_addr: SocketAddr, rewards_address: RewardsAddress, evm_network: Option, ) -> Result<()> { let mut args = Vec::new(); - if let Some(owner) = owner { - args.push("--owner".to_string()); - args.push(owner); - } - if first { args.push("--first".to_string()) } @@ -218,8 +211,6 @@ pub struct LocalNetworkOptions { pub metrics_port: Option, pub node_port: Option, pub node_count: u16, - pub owner: Option, - pub owner_prefix: Option, pub peers: Option>, pub rpc_port: Option, pub skip_validation: bool, @@ -289,7 +280,6 @@ pub async fn run_network( let rpc_client = RpcClient::from_socket_addr(rpc_socket_addr); let number = (node_registry.nodes.len() as u16) + 1; - let owner = get_node_owner(&options.owner_prefix, &options.owner, &number); let node = run_node( RunNodeOptions { first: true, @@ -298,7 +288,6 @@ pub async fn run_network( interval: options.interval, log_format: options.log_format, number, - owner, rpc_socket_addr, rewards_address: options.rewards_address, evm_network: options.evm_network.clone(), @@ -337,7 +326,6 @@ pub async fn run_network( let rpc_client = RpcClient::from_socket_addr(rpc_socket_addr); let number = (node_registry.nodes.len() as u16) + 1; - let owner = get_node_owner(&options.owner_prefix, &options.owner, &number); let node = run_node( RunNodeOptions { first: false, @@ -346,7 +334,6 @@ pub async fn run_network( interval: options.interval, log_format: options.log_format, number, - owner, rpc_socket_addr, rewards_address: options.rewards_address, evm_network: options.evm_network.clone(), @@ -386,7 +373,6 @@ pub struct RunNodeOptions { pub metrics_port: Option, pub node_port: Option, pub number: u16, - pub owner: Option, pub rpc_socket_addr: SocketAddr, pub rewards_address: RewardsAddress, pub evm_network: Option, @@ -405,7 +391,6 @@ pub async fn run_node( run_options.log_format, run_options.metrics_port, run_options.node_port, - run_options.owner.clone(), run_options.rpc_socket_addr, run_options.rewards_address, run_options.evm_network.clone(), @@ -439,7 +424,6 @@ pub async fn run_node( node_ip: None, node_port: run_options.node_port, number: run_options.number, - owner: run_options.owner, peer_id: Some(peer_id), peers_args: PeersArgs { first: run_options.first, @@ -513,18 +497,6 @@ async fn validate_network(node_registry: &mut NodeRegistry, peers: Vec, - owner: &Option, - number: &u16, -) -> Option { - if let Some(prefix) = owner_prefix { - Some(format!("{}_{}", prefix, number)) - } else { - owner.clone() - } -} - #[cfg(test)] mod tests { use super::*; @@ -569,13 +541,12 @@ mod tests { eq(None), eq(None), eq(None), - eq(None), eq(rpc_socket_addr), eq(rewards_address), eq(None), ) .times(1) - .returning(|_, _, _, _, _, _, _, _| Ok(())); + .returning(|_, _, _, _, _, _, _| Ok(())); mock_launcher .expect_wait() .with(eq(100)) @@ -618,7 +589,6 @@ mod tests { metrics_port: None, node_port: None, number: 1, - owner: None, rpc_socket_addr, rewards_address, evm_network: None, diff --git a/ant-node-manager/src/rpc.rs b/ant-node-manager/src/rpc.rs index 1af38833ff..c47a0927ba 100644 --- a/ant-node-manager/src/rpc.rs +++ b/ant-node-manager/src/rpc.rs @@ -77,7 +77,6 @@ pub async fn restart_node_service( network_id: current_node_clone.network_id, node_ip: current_node_clone.node_ip, node_port: current_node_clone.get_antnode_port(), - owner: current_node_clone.owner.clone(), peers_args: current_node_clone.peers_args.clone(), rewards_address: current_node_clone.rewards_address, rpc_socket_addr: current_node_clone.rpc_socket_addr, @@ -193,7 +192,6 @@ pub async fn restart_node_service( network_id: current_node_clone.network_id, node_ip: current_node_clone.node_ip, node_port: None, - owner: None, peers_args: current_node_clone.peers_args.clone(), rewards_address: current_node_clone.rewards_address, rpc_socket_addr: current_node_clone.rpc_socket_addr, @@ -223,7 +221,6 @@ pub async fn restart_node_service( node_ip: current_node_clone.node_ip, node_port: None, number: new_node_number as u16, - owner: None, peer_id: None, peers_args: current_node_clone.peers_args.clone(), pid: None, diff --git a/ant-node/src/bin/antnode/main.rs b/ant-node/src/bin/antnode/main.rs index 3397d81461..5b6cc51144 100644 --- a/ant-node/src/bin/antnode/main.rs +++ b/ant-node/src/bin/antnode/main.rs @@ -178,10 +178,6 @@ struct Opt { #[clap(long)] rpc: Option, - /// Specify the owner(readable discord user name). - #[clap(long)] - owner: Option, - #[cfg(feature = "open-metrics")] /// Specify the port for the OpenMetrics server. /// @@ -308,8 +304,8 @@ fn main() -> Result<()> { // another process with these args. #[cfg(feature = "local")] rt.spawn(init_metrics(std::process::id())); - let initial_peres = rt.block_on(opt.peers.get_addrs(None, Some(100)))?; - debug!("Node's owner set to: {:?}", opt.owner); + + let initial_peers = rt.block_on(opt.peers.get_addrs(None, Some(100)))?; let restart_options = rt.block_on(async move { let mut node_builder = NodeBuilder::new( keypair, @@ -321,7 +317,7 @@ fn main() -> Result<()> { #[cfg(feature = "upnp")] opt.upnp, ); - node_builder.initial_peers(initial_peres); + node_builder.initial_peers(initial_peers); node_builder.bootstrap_cache(bootstrap_cache); node_builder.is_behind_home_network(opt.home_network); #[cfg(feature = "open-metrics")] diff --git a/ant-service-management/src/node.rs b/ant-service-management/src/node.rs index 3c281ba4b7..cd92f6bac0 100644 --- a/ant-service-management/src/node.rs +++ b/ant-service-management/src/node.rs @@ -110,11 +110,6 @@ impl ServiceStateActions for NodeService<'_> { args.push(OsString::from(max_log_files.to_string())); } - if let Some(owner) = &self.service_data.owner { - args.push(OsString::from("--owner")); - args.push(OsString::from(owner)); - } - args.push(OsString::from("--rewards-address")); args.push(OsString::from( self.service_data.rewards_address.to_string(), @@ -288,8 +283,6 @@ pub struct NodeServiceData { pub max_log_files: Option, #[serde(default)] pub metrics_port: Option, - #[serde(default)] - pub owner: Option, pub network_id: Option, #[serde(default)] pub node_ip: Option, diff --git a/node-launchpad/src/node_mgmt.rs b/node-launchpad/src/node_mgmt.rs index 18780b4f2b..7e41b19dbe 100644 --- a/node-launchpad/src/node_mgmt.rs +++ b/node-launchpad/src/node_mgmt.rs @@ -429,7 +429,6 @@ async fn scale_down_nodes(config: &NodeConfig, count: u16) { config.network_id, None, None, // We don't care about the port, as we are scaling down - config.owner.clone(), config.peers_args.clone(), RewardsAddress::from_str(config.rewards_address.as_str()).unwrap(), None, @@ -503,7 +502,6 @@ async fn add_nodes( config.network_id, None, port_range, - config.owner.clone(), config.peers_args.clone(), RewardsAddress::from_str(config.rewards_address.as_str()).unwrap(), None, From 540906c26b4528e9487f03030bea22fe41ee0111 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 14:11:45 +0100 Subject: [PATCH 30/38] test: fix networking async test --- ant-networking/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ant-networking/src/lib.rs b/ant-networking/src/lib.rs index 413c7eb730..2d558fd9f6 100644 --- a/ant-networking/src/lib.rs +++ b/ant-networking/src/lib.rs @@ -1322,8 +1322,8 @@ pub(crate) fn send_network_swarm_cmd( mod tests { use super::*; - #[test] - fn test_network_sign_verify() -> eyre::Result<()> { + #[tokio::test] + async fn test_network_sign_verify() -> eyre::Result<()> { let (network, _, _) = NetworkBuilder::new(Keypair::generate_ed25519(), false).build_client()?; let msg = b"test message"; From f71cec80ed9a42a7ee4cf5e2faa341190a8d944c Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 14:34:51 +0100 Subject: [PATCH 31/38] refactor: base evm network on local setting --- autonomi/src/client/mod.rs | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/autonomi/src/client/mod.rs b/autonomi/src/client/mod.rs index 62d19a9dac..72e0d27876 100644 --- a/autonomi/src/client/mod.rs +++ b/autonomi/src/client/mod.rs @@ -71,8 +71,6 @@ pub struct Client { #[derive(Debug, Clone, Default)] pub struct ClientConfig { /// Whether we're expected to connect to a local network. - /// - /// If `local` feature is enabled, [`ClientConfig::default()`] will set this to `true`. pub local: bool, /// List of peers to connect to. @@ -84,15 +82,15 @@ pub struct ClientConfig { pub evm_network: EvmNetwork, } -// impl Default for ClientConfig { -// fn default() -> Self { -// Self { -// local: false, -// peers: None, -// evm_network: EvmNetwork::try_from_env().unwrap_or_default(), -// } -// } -// } +impl ClientConfig { + fn local(peers: Option>) -> Self { + Self { + local: true, + peers, + evm_network: EvmNetwork::new(true).unwrap_or_default(), + } + } +} /// Error returned by [`Client::init`]. #[derive(Debug, thiserror::Error)] @@ -122,11 +120,7 @@ impl Client { /// /// See [`Client::init_with_config`]. pub async fn init_local() -> Result { - Self::init_with_config(ClientConfig { - local: true, - ..Default::default() - }) - .await + Self::init_with_config(ClientConfig::local(None)).await } /// Initialize a client that bootstraps from a list of peers. From 189c5beaeb6273f6ee138c3baa8d365c798fbfb2 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 14:37:06 +0100 Subject: [PATCH 32/38] ci: fix double upload --- .github/workflows/memcheck.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/memcheck.yml b/.github/workflows/memcheck.yml index 4784b5d34b..480ca3624d 100644 --- a/.github/workflows/memcheck.yml +++ b/.github/workflows/memcheck.yml @@ -99,7 +99,6 @@ jobs: mkdir $ANT_DATA_PATH/client ls -l $ANT_DATA_PATH ./target/release/ant --log-output-dest=data-dir --local file upload --public "./the-test-data.zip" > ./upload_output_second 2>&1 - ./target/release/ant --log-output-dest=data-dir --local file upload --public "./the-test-data.zip" > ./upload_output_second 2>&1 rg 'All chunks already exist on the network.' ./upload_output_second -c --stats env: ANT_LOG: "all" From f1bcad1287125616b4ec804dfc7c21ca35eb12a1 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 15:06:08 +0100 Subject: [PATCH 33/38] fix: enable process-metrics feature --- ant-node/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ant-node/Cargo.toml b/ant-node/Cargo.toml index 10b7fe126c..37203c57fd 100644 --- a/ant-node/Cargo.toml +++ b/ant-node/Cargo.toml @@ -26,7 +26,7 @@ upnp = ["ant-networking/upnp"] ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.3" } ant-build-info = { path = "../ant-build-info", version = "0.1.23" } ant-evm = { path = "../ant-evm", version = "0.1.8" } -ant-logging = { path = "../ant-logging", version = "0.2.44" } +ant-logging = { path = "../ant-logging", version = "0.2.44", features = [ "process-metrics" ] } ant-networking = { path = "../ant-networking", version = "0.3.3" } ant-protocol = { path = "../ant-protocol", version = "0.3.3" } ant-registers = { path = "../ant-registers", version = "0.4.7" } From fc61526205db4247a36b6cda332aad256139e2bd Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 15:08:24 +0100 Subject: [PATCH 34/38] ci: fix local vault sync --- .github/workflows/merge.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index c41a65a72c..261a81c092 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -438,13 +438,13 @@ jobs: timeout-minutes: 25 - name: sync the vault - run: ./target/release/ant --log-output-dest data-dir vault sync + run: ./target/release/ant --log-output-dest data-dir --local vault sync env: ANT_LOG: "v" timeout-minutes: 2 - name: load the vault from network - run: ./target/release/ant --log-output-dest data-dir vault load + run: ./target/release/ant --log-output-dest data-dir --local vault load env: ANT_LOG: "v" timeout-minutes: 2 From 5e9a669eec2cc74e8ee4b7979a7af3c255f9940c Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 15:11:54 +0100 Subject: [PATCH 35/38] ci: add --local flags to ant --- .github/workflows/merge.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 261a81c092..4025a9cf32 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -533,7 +533,7 @@ jobs: timeout-minutes: 2 - name: load an existing vault from the network - run: ./target/release/ant --log-output-dest=data-dir vault load + run: ./target/release/ant --log-output-dest data-dir --local vault load env: ANT_LOG: "v" timeout-minutes: 2 @@ -551,7 +551,7 @@ jobs: # 1 GB python3 -c "with open('random_1GB.bin', 'wb') as f: f.write(bytearray([0xff] * 1000 * 1024 * 1024))" - ./target/release/ant --log-output-dest=data-dir file list + ./target/release/ant --log-output-dest=data-dir --local file list time ./target/release/ant --log-output-dest=data-dir --local file upload random_1MB.bin time ./target/release/ant --log-output-dest=data-dir --local file upload random_10MB.bin time ./target/release/ant --log-output-dest=data-dir --local file upload random_100MB.bin @@ -1306,7 +1306,7 @@ jobs: shell: bash - name: File upload - run: ./target/release/ant --log-output-dest data-dir file upload "./test_data_1.tar.gz" > ./upload_output 2>&1 + run: ./target/release/ant --log-output-dest data-dir --local file upload "./test_data_1.tar.gz" > ./upload_output 2>&1 env: ANT_LOG: "v" timeout-minutes: 15 @@ -1323,7 +1323,7 @@ jobs: shell: bash - name: File Download - run: ./target/release/ant --log-output-dest data-dir file download ${{ env.UPLOAD_ADDRESS }} ./downloaded_resources > ./download_output 2>&1 + run: ./target/release/ant --log-output-dest data-dir --local file download ${{ env.UPLOAD_ADDRESS }} ./downloaded_resources > ./download_output 2>&1 env: ANT_LOG: "v" timeout-minutes: 5 From 9db51004ba74f6324b7d637f5e81156406aa5b1f Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 15:15:30 +0100 Subject: [PATCH 36/38] feat: enable mDNS behavior only with --local --- ant-networking/src/driver.rs | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/ant-networking/src/driver.rs b/ant-networking/src/driver.rs index 8037f78a29..1498554479 100644 --- a/ant-networking/src/driver.rs +++ b/ant-networking/src/driver.rs @@ -44,7 +44,6 @@ use ant_protocol::{ use ant_registers::SignedRegister; use futures::future::Either; use futures::StreamExt; -use libp2p::mdns; use libp2p::{core::muxing::StreamMuxerBox, relay}; use libp2p::{ identity::Keypair, @@ -57,6 +56,7 @@ use libp2p::{ }, Multiaddr, PeerId, }; +use libp2p::{mdns, swarm::behaviour::toggle::Toggle}; use libp2p::{swarm::SwarmEvent, Transport as _}; #[cfg(feature = "open-metrics")] use prometheus_client::metrics::info::Info; @@ -254,9 +254,9 @@ pub(super) struct NodeBehaviour { libp2p::allow_block_list::Behaviour, pub(super) identify: libp2p::identify::Behaviour, /// mDNS behaviour to use in local mode - pub(super) mdns: mdns::tokio::Behaviour, + pub(super) mdns: Toggle, #[cfg(feature = "upnp")] - pub(super) upnp: libp2p::swarm::behaviour::toggle::Toggle, + pub(super) upnp: Toggle, pub(super) relay_client: libp2p::relay::client::Behaviour, pub(super) relay_server: libp2p::relay::Behaviour, pub(super) kademlia: kad::Behaviour, @@ -619,15 +619,21 @@ impl NetworkBuilder { } }; - let mdns_config = mdns::Config { - // lower query interval to speed up peer discovery - // this increases traffic, but means we no longer have clients unable to connect - // after a few minutes - query_interval: Duration::from_secs(5), - ..Default::default() - }; + let mdns = if self.local { + debug!("Enabling mDNS behavior (because of local mode)"); - let mdns = mdns::tokio::Behaviour::new(mdns_config, peer_id)?; + let mdns_config = mdns::Config { + // lower query interval to speed up peer discovery this + // increases traffic, but means we no longer have clients + // unable to connect after a few minutes + query_interval: Duration::from_secs(5), + ..Default::default() + }; + Some(mdns::tokio::Behaviour::new(mdns_config, peer_id)?) + } else { + None + } + .into(); // Into `Toggle` let agent_version = if is_client { IDENTIFY_CLIENT_VERSION_STR From f9f77505f2573021ada6f1ad5e650e21b15431f7 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 16:11:16 +0100 Subject: [PATCH 37/38] fix: format string with value --- ant-protocol/src/storage/header.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ant-protocol/src/storage/header.rs b/ant-protocol/src/storage/header.rs index 4ec619b965..4fdacead60 100644 --- a/ant-protocol/src/storage/header.rs +++ b/ant-protocol/src/storage/header.rs @@ -107,9 +107,9 @@ impl<'de> Deserialize<'de> for RecordKind { Ok(Self::DataWithPayment(data_type)) } } else { - Err(serde::de::Error::custom( + Err(serde::de::Error::custom(format!( "Unexpected index {num} for RecordKind variant", - )) + ))) } } } From fa5b005391d629b928e505c7a4e0b2bf8d9d4b84 Mon Sep 17 00:00:00 2001 From: Benno Zeeman Date: Tue, 14 Jan 2025 16:25:27 +0100 Subject: [PATCH 38/38] docs: remove reference to --local in README.md --- autonomi/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autonomi/README.md b/autonomi/README.md index 4c19a3e7c4..7c1dc7f8c4 100644 --- a/autonomi/README.md +++ b/autonomi/README.md @@ -66,12 +66,12 @@ To run the tests, we can run a local network: cargo run --bin evm-testnet ``` -2. Run a local network with the `local` feature and use the local EVM node. +2. Run a local network and use the local EVM node. ```sh - cargo run --bin antctl --features local -- local run --build --clean --rewards-address evm-local + cargo run --bin antctl -- local run --build --clean --rewards-address evm-local ``` -3. Then run the tests with the `local` feature and pass the EVM params again: +3. Then run the tests and pass the EVM params again: ```sh EVM_NETWORK=local cargo test --package autonomi ``` @@ -80,10 +80,10 @@ To run the tests, we can run a local network: Using the hardcoded `Arbitrum One` option as an example, but you can also use the command flags of the steps above and point it to a live network. -1. Run a local network with the `local` feature: +1. Run a local network: ```sh -cargo run --bin antctl --features local -- local run --build --clean --rewards-address evm-arbitrum-one +cargo run --bin antctl -- local run --build --clean --rewards-address evm-arbitrum-one ``` 2. Then pass the private key of the wallet, and ensure it has enough gas and payment tokens on the network (in this case Arbitrum One):