From 81cadb98174144eacd9c5c62a219f24a7f85d945 Mon Sep 17 00:00:00 2001 From: David Irvine Date: Mon, 30 Dec 2024 22:51:15 +0000 Subject: [PATCH] refactor: remove fs and encrypted_records feature flags - Remove fs feature flag as filesystem operations are now core functionality - Remove encrypted_records feature flag as encryption is now always enabled - Update tests and workflows to remove feature flag references - Clean up related code in client files and test modules --- .github/workflows/nightly.yml | 4 +- ant-bootstrap/tests/cli_integration_tests.rs | 41 -------------------- ant-cli/Cargo.toml | 3 +- autonomi/Cargo.toml | 18 +++++++-- autonomi/src/client/files/mod.rs | 6 --- autonomi/tests/client_mode.rs | 3 +- autonomi/tests/fs.rs | 4 +- autonomi/tests/put.rs | 15 ------- 8 files changed, 19 insertions(+), 75 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 8b4cc22cce..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 @@ -262,7 +262,7 @@ jobs: - name: Run network tests timeout-minutes: 25 - run: cargo test --release --package ant-networking --features="open-metrics, encrypt-records" + run: cargo test --release --package ant-networking --features="open-metrics" - name: Run protocol tests timeout-minutes: 25 diff --git a/ant-bootstrap/tests/cli_integration_tests.rs b/ant-bootstrap/tests/cli_integration_tests.rs index 7527d62457..711e727ecd 100644 --- a/ant-bootstrap/tests/cli_integration_tests.rs +++ b/ant-bootstrap/tests/cli_integration_tests.rs @@ -10,15 +10,12 @@ use ant_bootstrap::{BootstrapCacheConfig, PeersArgs}; use ant_logging::LogBuilder; use anyhow::Result; use libp2p::Multiaddr; -use std::net::{IpAddr, Ipv4Addr}; use tempfile::TempDir; use wiremock::{ matchers::{method, path}, Mock, MockServer, ResponseTemplate, }; -// Use a private network IP instead of loopback for mDNS to work -const LOCAL_IP: IpAddr = IpAddr::V4(Ipv4Addr::new(192, 168, 1, 23)); async fn setup() -> (TempDir, BootstrapCacheConfig) { let temp_dir = TempDir::new().unwrap(); @@ -207,44 +204,6 @@ async fn test_test_network_peers() -> Result<(), Box> { Ok(()) } -#[test] -fn test_cli_add_peer() -> Result<()> { - let temp_dir = TempDir::new()?; - let cache_path = temp_dir.path().join("cache.txt"); - let peer_addr = format!( - "/ip4/{}/udp/8080/quic-v1/p2p/12D3KooWRBhwfeP2Y4TCx1SM6s9rUoHhR5STiGwxBhgFRcw3UERE", - LOCAL_IP - ); - // ... rest of the test ... - Ok(()) -} -#[test] -fn test_cli_list_peers() -> Result<()> { - let temp_dir = TempDir::new()?; - let cache_path = temp_dir.path().join("cache.txt"); - - let peer_addr = format!( - "/ip4/{}/udp/8080/quic-v1/p2p/12D3KooWRBhwfeP2Y4TCx1SM6s9rUoHhR5STiGwxBhgFRcw3UERE\n", - LOCAL_IP - ); - - // ... rest of the test ... - Ok(()) -} - -#[test] -fn test_cli_remove_peer() -> Result<()> { - let temp_dir = TempDir::new()?; - let cache_path = temp_dir.path().join("cache.txt"); - - let peer_addr = format!( - "/ip4/{}/udp/8080/quic-v1/p2p/12D3KooWRBhwfeP2Y4TCx1SM6s9rUoHhR5STiGwxBhgFRcw3UERE", - LOCAL_IP - ); - - // ... rest of the test ... - Ok(()) -} diff --git a/ant-cli/Cargo.toml b/ant-cli/Cargo.toml index 7e009e48bd..d90ee994d6 100644 --- a/ant-cli/Cargo.toml +++ b/ant-cli/Cargo.toml @@ -29,7 +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", @@ -60,7 +59,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/autonomi/Cargo.toml b/autonomi/Cargo.toml index 7ff6bf6107..1379811c3f 100644 --- a/autonomi/Cargo.toml +++ b/autonomi/Cargo.toml @@ -25,8 +25,7 @@ required-features = ["full"] default = ["vault"] external-signer = ["ant-evm/external-signer"] extension-module = ["pyo3/extension-module"] -fs = ["tokio/fs"] -full = ["vault", "fs"] +full = ["vault"] local = ["ant-networking/local", "ant-evm/local"] test = ["local"] loud = [] @@ -71,7 +70,18 @@ dirs-next = "2.0.0" regex = "1.10.3" [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"] } +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.42" } eyre = "0.6.5" sha2 = "0.10.6" @@ -80,7 +90,7 @@ sha2 = "0.10.6" test-utils = { path = "../test-utils" } tracing-subscriber = { version = "0.3", features = ["env-filter"] } portpicker = "0.1" -tokio = { version = "1.0", features = ["full", "test-util"] } +tokio = { version = "1.0", features = ["full", "test-util", "fs"] } serial_test = "2.0.0" lazy_static = "1.4.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/tests/client_mode.rs b/autonomi/tests/client_mode.rs index 5409046f3a..9329282d30 100644 --- a/autonomi/tests/client_mode.rs +++ b/autonomi/tests/client_mode.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 ant_evm::EvmWallet; use ant_logging::LogBuilder; -use autonomi::{Client, ClientConfig}; +use autonomi::Client; use test_utils::evm::get_funded_wallet; #[tokio::test] diff --git a/autonomi/tests/fs.rs b/autonomi/tests/fs.rs index 989eb5513e..c4e05e684f 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 anyhow::Result; use autonomi::Client; @@ -20,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 file #[tokio::test] async fn dir_upload_download() -> Result<()> { let _log_appender_guard = diff --git a/autonomi/tests/put.rs b/autonomi/tests/put.rs index eb376bb63b..c6b41fb0e9 100644 --- a/autonomi/tests/put.rs +++ b/autonomi/tests/put.rs @@ -6,20 +6,5 @@ // 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_logging::LogBuilder; -use autonomi::Client; -use anyhow::Result; -use test_utils::{evm::get_funded_wallet, gen_random_data}; -#[tokio::test] -async fn test_put() -> Result<()> { - let _log_appender_guard = LogBuilder::init_single_threaded_tokio_test("put", false); - let client = Client::init_with_config(Default::default()).await?; - let wallet = get_funded_wallet(); - let data = gen_random_data(1024 * 1024 * 10); - - let addr = client.data_put_public(data.clone(), wallet.into()).await?; - - Ok(()) -}