diff --git a/Cargo.lock b/Cargo.lock index 1b1c00c3cc..6808bb63af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -773,7 +773,7 @@ dependencies = [ [[package]] name = "ant-bootstrap" -version = "0.1.0" +version = "0.1.0-rc.3" dependencies = [ "ant-logging", "ant-protocol", @@ -798,7 +798,7 @@ dependencies = [ [[package]] name = "ant-build-info" -version = "0.1.19" +version = "0.1.20-rc.3" dependencies = [ "chrono", "tracing", @@ -807,7 +807,7 @@ dependencies = [ [[package]] name = "ant-cli" -version = "0.1.5" +version = "0.3.0-rc.3" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -838,7 +838,7 @@ dependencies = [ [[package]] name = "ant-evm" -version = "0.1.4" +version = "0.1.5-rc.3" dependencies = [ "custom_debug", "evmlib", @@ -861,7 +861,7 @@ dependencies = [ [[package]] name = "ant-logging" -version = "0.2.40" +version = "0.2.41-rc.3" dependencies = [ "chrono", "color-eyre", @@ -886,7 +886,7 @@ dependencies = [ [[package]] name = "ant-metrics" -version = "0.1.20" +version = "0.1.21-rc.3" dependencies = [ "clap", "color-eyre", @@ -900,7 +900,7 @@ dependencies = [ [[package]] name = "ant-networking" -version = "0.19.5" +version = "0.3.0-rc.3" dependencies = [ "aes-gcm-siv", "ant-bootstrap", @@ -948,7 +948,7 @@ dependencies = [ [[package]] name = "ant-node" -version = "0.112.6" +version = "0.3.0-rc.3" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -1006,7 +1006,7 @@ dependencies = [ [[package]] name = "ant-node-manager" -version = "0.11.3" +version = "0.11.4-rc.3" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -1049,7 +1049,7 @@ dependencies = [ [[package]] name = "ant-node-rpc-client" -version = "0.6.36" +version = "0.6.37-rc.3" dependencies = [ "ant-build-info", "ant-logging", @@ -1073,7 +1073,7 @@ dependencies = [ [[package]] name = "ant-protocol" -version = "0.17.15" +version = "0.3.0-rc.3" dependencies = [ "ant-build-info", "ant-evm", @@ -1103,7 +1103,7 @@ dependencies = [ [[package]] name = "ant-registers" -version = "0.4.3" +version = "0.4.4-rc.3" dependencies = [ "blsttc", "crdts", @@ -1140,7 +1140,7 @@ dependencies = [ [[package]] name = "ant-service-management" -version = "0.4.3" +version = "0.4.4-rc.3" dependencies = [ "ant-bootstrap", "ant-evm", @@ -1167,7 +1167,7 @@ dependencies = [ [[package]] name = "ant-token-supplies" -version = "0.1.58" +version = "0.1.59-rc.3" dependencies = [ "dirs-next", "reqwest 0.11.27", @@ -1591,7 +1591,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "autonomi" -version = "0.2.4" +version = "0.3.0-rc.3" dependencies = [ "alloy", "ant-bootstrap", @@ -3356,7 +3356,7 @@ dependencies = [ [[package]] name = "evm-testnet" -version = "0.1.4" +version = "0.1.5-rc.3" dependencies = [ "ant-evm", "clap", @@ -3367,7 +3367,7 @@ dependencies = [ [[package]] name = "evmlib" -version = "0.1.4" +version = "0.1.5-rc.3" dependencies = [ "alloy", "dirs-next", @@ -6284,7 +6284,7 @@ dependencies = [ [[package]] name = "nat-detection" -version = "0.2.11" +version = "0.2.12-rc.3" dependencies = [ "ant-build-info", "ant-networking", @@ -6401,7 +6401,7 @@ dependencies = [ [[package]] name = "node-launchpad" -version = "0.4.5" +version = "0.5.0-rc.3" dependencies = [ "ant-bootstrap", "ant-build-info", @@ -9321,7 +9321,7 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "test-utils" -version = "0.4.11" +version = "0.4.12-rc.3" dependencies = [ "bytes", "color-eyre", diff --git a/ant-bootstrap/Cargo.toml b/ant-bootstrap/Cargo.toml index 1e292cd64d..910bfcbce6 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.0" +version = "0.1.0-rc.3" [features] local = [] [dependencies] -ant-logging = { path = "../ant-logging", version = "0.2.40" } -ant-protocol = { version = "0.17.15", path = "../ant-protocol" } +ant-logging = { path = "../ant-logging", version = "0.2.41-rc.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.3" } atomic-write-file = "0.2.2" chrono = { version = "0.4", features = ["serde"] } clap = { version = "4.2.1", features = ["derive", "env"] } @@ -38,4 +38,4 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } tempfile = "3.8.1" [target.'cfg(target_arch = "wasm32")'.dependencies] -wasmtimer = "0.2.0" \ No newline at end of file +wasmtimer = "0.2.0" diff --git a/ant-build-info/Cargo.toml b/ant-build-info/Cargo.toml index 045ae93c4f..d5fb78c426 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.19" +version = "0.1.20-rc.3" 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 c79a7039a7..ce747aa610 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 = "11"; +pub const RELEASE_MONTH: &str = "12"; pub const RELEASE_CYCLE: &str = "1"; -pub const RELEASE_CYCLE_COUNTER: &str = "6"; +pub const RELEASE_CYCLE_COUNTER: &str = "3"; diff --git a/ant-cli/Cargo.toml b/ant-cli/Cargo.toml index c6eecb42f6..0239975d03 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.1.5" +version = "0.3.0-rc.3" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" @@ -17,17 +17,18 @@ path = "src/main.rs" default = ["metrics"] local = ["ant-bootstrap/local", "autonomi/local"] metrics = ["ant-logging/process-metrics"] +nightly = [] [[bench]] name = "files" harness = false [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0" } -ant-build-info = { path = "../ant-build-info", version = "0.1.19" } -ant-logging = { path = "../ant-logging", version = "0.2.40" } -ant-protocol = { path = "../ant-protocol", version = "0.17.15" } -autonomi = { path = "../autonomi", version = "0.2.4", features = [ +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0-rc.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.20-rc.3" } +ant-logging = { path = "../ant-logging", version = "0.2.41-rc.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.3" } +autonomi = { path = "../autonomi", version = "0.3.0-rc.3", features = [ "fs", "vault", "registers", @@ -59,7 +60,7 @@ tracing = { version = "~0.1.26" } walkdir = "2.5.0" [dev-dependencies] -autonomi = { path = "../autonomi", version = "0.2.4", features = ["fs"]} +autonomi = { path = "../autonomi", version = "0.3.0-rc.3", features = ["fs"]} criterion = "0.5.1" eyre = "0.6.8" rand = { version = "~0.8.5", features = ["small_rng"] } diff --git a/ant-cli/src/commands.rs b/ant-cli/src/commands.rs index a1d1fd487a..ff065a06c0 100644 --- a/ant-cli/src/commands.rs +++ b/ant-cli/src/commands.rs @@ -158,14 +158,26 @@ pub enum WalletCmd { /// Optional flag to not add a password. #[clap(long, action)] no_password: bool, - /// Optional hex-encoded private key. - #[clap(long)] - private_key: Option, /// Optional password to encrypt the wallet with. #[clap(long, short)] password: Option, }, + /// Import an existing wallet. + Import { + /// Hex-encoded private key. + private_key: String, + /// Optional flag to not add a password. + #[clap(long, action)] + no_password: bool, + /// Optional password to encrypt the wallet with. + #[clap(long, short)] + password: Option, + }, + + /// Print the private key of a wallet. + Export, + /// Check the balance of the wallet. Balance, } @@ -175,7 +187,7 @@ pub async fn handle_subcommand(opt: Opt) -> Result<()> { let cmd = opt.command; match cmd { - SubCmd::File { command } => match command { + Some(SubCmd::File { command }) => match command { FileCmd::Cost { file } => file::cost(&file, peers.await?).await, FileCmd::Upload { file, public } => file::upload(&file, public, peers.await?).await, FileCmd::Download { addr, dest_file } => { @@ -183,7 +195,7 @@ pub async fn handle_subcommand(opt: Opt) -> Result<()> { } FileCmd::List => file::list(), }, - SubCmd::Register { command } => match command { + Some(SubCmd::Register { command }) => match command { RegisterCmd::GenerateKey { overwrite } => register::generate_key(overwrite), RegisterCmd::Cost { name } => register::cost(&name, peers.await?).await, RegisterCmd::Create { @@ -199,19 +211,25 @@ pub async fn handle_subcommand(opt: Opt) -> Result<()> { RegisterCmd::Get { address, name } => register::get(address, name, peers.await?).await, RegisterCmd::List => register::list(), }, - SubCmd::Vault { command } => match command { + Some(SubCmd::Vault { command }) => match command { 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, }, - SubCmd::Wallet { command } => match command { + Some(SubCmd::Wallet { command }) => match command { WalletCmd::Create { no_password, + password, + } => wallet::create(no_password, password), + WalletCmd::Import { private_key, + no_password, password, - } => wallet::create(no_password, private_key, password), - WalletCmd::Balance => Ok(wallet::balance().await?), + } => wallet::import(private_key, no_password, password), + WalletCmd::Export => wallet::export(), + WalletCmd::Balance => wallet::balance().await, }, + None => Ok(()), } } diff --git a/ant-cli/src/commands/wallet.rs b/ant-cli/src/commands/wallet.rs index 3b31a873b2..b1a2caf70b 100644 --- a/ant-cli/src/commands/wallet.rs +++ b/ant-cli/src/commands/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 crate::wallet::fs::{select_wallet, store_private_key}; +use crate::wallet::fs::{select_wallet, select_wallet_private_key, store_private_key}; use crate::wallet::input::request_password; use crate::wallet::DUMMY_NETWORK; use autonomi::Wallet; @@ -16,42 +16,49 @@ use prettytable::{Cell, Row, Table}; const WALLET_PASSWORD_REQUIRED: bool = false; -pub fn create( +pub fn create(no_password: bool, password: Option) -> Result<()> { + let maybe_encryption_password = maybe_request_password(no_password, password)?; + + let wallet_private_key = Wallet::random_private_key(); + + let wallet_address = Wallet::new_from_private_key(DUMMY_NETWORK, &wallet_private_key) + .expect("Infallible") + .address() + .to_string(); + + // Save the private key file + let file_path = store_private_key(&wallet_private_key, maybe_encryption_password)?; + + println!("Wallet address: {wallet_address}"); + println!("Wallet private key: {wallet_private_key}"); + println!("Stored wallet in: {file_path:?}"); + + Ok(()) +} + +pub fn import( + mut wallet_private_key: String, no_password: bool, - private_key: Option, password: Option, ) -> Result<()> { - if no_password && password.is_some() { - return Err(eyre!( - "Only one of `--no-password` or `--password` may be specified" - )); - } - - // Set a password for encryption or not - let encryption_password: Option = match (no_password, password) { - (true, _) => None, - (false, Some(pass)) => Some(pass.to_owned()), - (false, None) => request_password(WALLET_PASSWORD_REQUIRED), - }; - - let wallet_private_key = if let Some(private_key) = private_key { - // Validate imported key - Wallet::new_from_private_key(DUMMY_NETWORK, &private_key) - .map_err(|_| eyre!("Please provide a valid secret key in hex format"))?; + // Validate imported key + Wallet::new_from_private_key(DUMMY_NETWORK, &wallet_private_key) + .map_err(|_| eyre!("Please provide a valid private key in hex format"))?; - private_key - } else { - // Create a new key - Wallet::random_private_key() - }; + 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") .address() .to_string(); + // Prepend with 0x if it isn't already + if !wallet_private_key.starts_with("0x") { + wallet_private_key = format!("0x{wallet_private_key}"); + } + // Save the private key file - let file_path = store_private_key(&wallet_private_key, encryption_password)?; + let file_path = store_private_key(&wallet_private_key, maybe_encryption_password)?; println!("Wallet address: {wallet_address}"); println!("Stored wallet in: {file_path:?}"); @@ -59,6 +66,20 @@ pub fn create( Ok(()) } +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") + .address() + .to_string(); + + println!("Wallet address: {wallet_address}"); + println!("Wallet private key: {wallet_private_key}"); + + Ok(()) +} + pub async fn balance() -> Result<()> { let wallet = select_wallet()?; @@ -83,3 +104,20 @@ pub async fn balance() -> Result<()> { Ok(()) } + +fn maybe_request_password(no_password: bool, password: Option) -> Result> { + if no_password && password.is_some() { + return Err(eyre!( + "Only one of `--no-password` or `--password` may be specified" + )); + } + + // Set a password for encryption or not + let maybe_password = match (no_password, password) { + (true, _) => None, + (false, Some(pass)) => Some(pass.to_owned()), + (false, None) => request_password(WALLET_PASSWORD_REQUIRED), + }; + + Ok(maybe_password) +} diff --git a/ant-cli/src/main.rs b/ant-cli/src/main.rs index c0404e9f75..279a354e5d 100644 --- a/ant-cli/src/main.rs +++ b/ant-cli/src/main.rs @@ -27,6 +27,7 @@ use color_eyre::Result; #[cfg(feature = "metrics")] use ant_logging::metrics::init_metrics; use ant_logging::{LogBuilder, LogFormat, ReloadHandle, WorkerGuard}; +use ant_protocol::version; use opt::Opt; use tracing::Level; @@ -37,15 +38,47 @@ async fn main() -> Result<()> { if let Some(network_id) = opt.network_id { ant_protocol::version::set_network_id(network_id); } + + // The clone is necessary to resolve a clippy warning related to a mutex. + let identify_protocol_str = version::IDENTIFY_PROTOCOL_STR + .read() + .expect("Failed to obtain read lock for IDENTIFY_PROTOCOL_STR") + .clone(); + if opt.version { + println!( + "{}", + ant_build_info::version_string( + "Autonomi Client", + env!("CARGO_PKG_VERSION"), + Some(&identify_protocol_str) + ) + ); + return Ok(()); + } + + if opt.crate_version { + println!("Crate version: {}", env!("CARGO_PKG_VERSION")); + return Ok(()); + } + + if opt.protocol_version { + println!("Network version: {identify_protocol_str}"); + return Ok(()); + } + + #[cfg(not(feature = "nightly"))] + if opt.package_version { + println!("Package version: {}", ant_build_info::package_version()); + return Ok(()); + } + let _log_guards = init_logging_and_metrics(&opt)?; #[cfg(feature = "metrics")] tokio::spawn(init_metrics(std::process::id())); - // Log the full command that was run and the git version info!("\"{}\"", std::env::args().collect::>().join(" ")); let version = ant_build_info::git_info(); info!("autonomi client built with git version: {version}"); - println!("autonomi client built with git version: {version}"); commands::handle_subcommand(opt).await?; diff --git a/ant-cli/src/opt.rs b/ant-cli/src/opt.rs index 3ffa1eb5f6..9d7e4edd9b 100644 --- a/ant-cli/src/opt.rs +++ b/ant-cli/src/opt.rs @@ -16,8 +16,29 @@ use std::time::Duration; // Please do not remove the blank lines in these doc comments. // They are used for inserting line breaks when the help menu is rendered in the UI. #[derive(Parser)] +#[command(disable_version_flag = true)] #[command(author, version, about, long_about = None)] pub(crate) struct Opt { + /// Available sub commands. + #[clap(subcommand)] + pub command: Option, + + /// The maximum duration to wait for a connection to the network before timing out. + #[clap(long = "timeout", global = true, value_parser = |t: &str| -> Result { Ok(t.parse().map(Duration::from_secs)?) })] + pub connection_timeout: Option, + + /// Print the crate version. + #[clap(long)] + pub crate_version: bool, + + /// Specify the logging format. + /// + /// Valid values are "default" or "json". + /// + /// If the argument is not used, the default format will be applied. + #[clap(long, value_parser = LogFormat::parse_from_str, verbatim_doc_comment)] + pub log_format: Option, + /// Specify the logging output destination. /// /// Valid values are "stdout", "data-dir", or a custom path. @@ -32,25 +53,6 @@ pub(crate) struct Opt { #[clap(long, value_parser = LogOutputDest::parse_from_str, verbatim_doc_comment, default_value = "data-dir")] pub log_output_dest: LogOutputDest, - /// Specify the logging format. - /// - /// Valid values are "default" or "json". - /// - /// If the argument is not used, the default format will be applied. - #[clap(long, value_parser = LogFormat::parse_from_str, verbatim_doc_comment)] - pub log_format: Option, - - #[command(flatten)] - pub(crate) peers: PeersArgs, - - /// Available sub commands. - #[clap(subcommand)] - pub command: SubCmd, - - /// The maximum duration to wait for a connection to the network before timing out. - #[clap(long = "timeout", global = true, value_parser = |t: &str| -> Result { Ok(t.parse().map(Duration::from_secs)?) })] - pub connection_timeout: Option, - /// Specify the network ID to use. This will allow you to run the CLI on a different network. /// /// By default, the network ID is set to 1, which represents the mainnet. @@ -62,4 +64,20 @@ pub(crate) struct Opt { /// This may increase operation speed, but offers no guarantees that operations were successful. #[clap(global = true, long = "no-verify", short = 'x')] pub no_verify: bool, + + #[command(flatten)] + pub(crate) peers: PeersArgs, + + /// Print the package version. + #[cfg(not(feature = "nightly"))] + #[clap(long)] + pub package_version: bool, + + /// Print the network protocol version. + #[clap(long)] + pub protocol_version: bool, + + /// Print version information. + #[clap(long)] + pub version: bool, } diff --git a/ant-cli/src/wallet/encryption.rs b/ant-cli/src/wallet/encryption.rs index bc673574ce..88f53afa15 100644 --- a/ant-cli/src/wallet/encryption.rs +++ b/ant-cli/src/wallet/encryption.rs @@ -123,11 +123,8 @@ pub fn decrypt_private_key(encrypted_data: &str, password: &str) -> Result Result { let encrypted_file_path = wallets_folder.join(format!("{wallet_address}{ENCRYPTED_PRIVATE_KEY_EXT}")); - let is_encrypted = encrypted_file_path.exists(); + let is_plain = wallets_folder.join(&file_name).exists(); + + // Trick to favour the plain file in case they both exist + let is_encrypted = encrypted_file_path.exists() && !is_plain; if is_encrypted { file_name.push_str(ENCRYPTED_PRIVATE_KEY_EXT); diff --git a/ant-evm/Cargo.toml b/ant-evm/Cargo.toml index 6e184a6ee1..d01e9a282a 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.4" +version = "0.1.5-rc.3" [features] local = ["evmlib/local"] @@ -16,7 +16,7 @@ test-utils = [] [dependencies] custom_debug = "~0.6.1" -evmlib = { path = "../evmlib", version = "0.1.4" } +evmlib = { path = "../evmlib", version = "0.1.5-rc.3" } 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 d923329bca..dc30c512f9 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.40" +version = "0.2.41-rc.3" [dependencies] chrono = "~0.4.19" diff --git a/ant-metrics/Cargo.toml b/ant-metrics/Cargo.toml index 45efbc4eea..7f5f3f604e 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.20" +version = "0.1.21-rc.3" [[bin]] path = "src/main.rs" diff --git a/ant-networking/Cargo.toml b/ant-networking/Cargo.toml index 8849a3752b..d73a3755ac 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.19.5" +version = "0.3.0-rc.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.0" } -ant-build-info = { path = "../ant-build-info", version = "0.1.19" } -ant-evm = { path = "../ant-evm", version = "0.1.4" } -ant-protocol = { path = "../ant-protocol", version = "0.17.15" } -ant-registers = { path = "../ant-registers", version = "0.4.3" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0-rc.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.20-rc.3" } +ant-evm = { path = "../ant-evm", version = "0.1.5-rc.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.3" } +ant-registers = { path = "../ant-registers", version = "0.4.4-rc.3" } async-trait = "0.1" bytes = { version = "1.0.1", features = ["serde"] } custom_debug = "~0.6.1" diff --git a/ant-networking/src/event/swarm.rs b/ant-networking/src/event/swarm.rs index 3bf65eb6d9..d8d26d0a2d 100644 --- a/ant-networking/src/event/swarm.rs +++ b/ant-networking/src/event/swarm.rs @@ -627,9 +627,12 @@ impl SwarmDriver { fn remove_bootstrap_from_full(&mut self, peer_id: PeerId) { let mut shall_removed = None; + let mut bucket_index = Some(0); + if let Some(kbucket) = self.swarm.behaviour_mut().kademlia.kbucket(peer_id) { if kbucket.num_entries() >= K_VALUE.into() { - if let Some(peers) = self.bootstrap_peers.get(&kbucket.range().0.ilog2()) { + bucket_index = kbucket.range().0.ilog2(); + if let Some(peers) = self.bootstrap_peers.get(&bucket_index) { for peer_entry in kbucket.iter() { if peers.contains(peer_entry.node.key.preimage()) { shall_removed = Some(*peer_entry.node.key.preimage()); @@ -649,6 +652,13 @@ impl SwarmDriver { if let Some(removed_peer) = entry { self.update_on_peer_removal(*removed_peer.node.key.preimage()); } + + // With the switch to using bootstrap cache, workload is distributed already. + // to avoid peers keeps being replaced by each other, + // there shall be just one time of removal to be undertaken. + if let Some(peers) = self.bootstrap_peers.get_mut(&bucket_index) { + let _ = peers.remove(&to_be_removed_bootstrap); + } } } diff --git a/ant-networking/src/lib.rs b/ant-networking/src/lib.rs index c43cdcdf8e..434aa192ad 100644 --- a/ant-networking/src/lib.rs +++ b/ant-networking/src/lib.rs @@ -1111,7 +1111,8 @@ impl Network { ); } - let closest_peers = sort_peers_by_address(&closest_peers, key, CLOSE_GROUP_SIZE + 1)?; + let expanded_close_group = CLOSE_GROUP_SIZE + CLOSE_GROUP_SIZE / 2; + let closest_peers = sort_peers_by_address(&closest_peers, key, expanded_close_group)?; Ok(closest_peers.into_iter().cloned().collect()) } diff --git a/ant-node-manager/Cargo.toml b/ant-node-manager/Cargo.toml index ad66bd6d5f..bbfbf37410 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.3" +version = "0.11.4-rc.3" [[bin]] name = "antctl" @@ -30,13 +30,13 @@ tcp = [] websockets = [] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0" } -ant-build-info = { path = "../ant-build-info", version = "0.1.19" } -ant-evm = { path = "../ant-evm", version = "0.1.4" } -ant-logging = { path = "../ant-logging", version = "0.2.40" } -ant-protocol = { path = "../ant-protocol", version = "0.17.15" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0-rc.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.20-rc.3" } +ant-evm = { path = "../ant-evm", version = "0.1.5-rc.3" } +ant-logging = { path = "../ant-logging", version = "0.2.41-rc.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.3" } ant-releases = { version = "0.4.0" } -ant-service-management = { path = "../ant-service-management", version = "0.4.3" } +ant-service-management = { path = "../ant-service-management", version = "0.4.4-rc.3" } 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 9d8b9cc61d..f0019753d4 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.36" +version = "0.6.37-rc.3" [[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.19" } -ant-logging = { path = "../ant-logging", version = "0.2.40" } -ant-protocol = { path = "../ant-protocol", version = "0.17.15", features=["rpc"] } -ant-node = { path = "../ant-node", version = "0.112.6" } -ant-service-management = { path = "../ant-service-management", version = "0.4.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.20-rc.3" } +ant-logging = { path = "../ant-logging", version = "0.2.41-rc.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.3", features=["rpc"] } +ant-node = { path = "../ant-node", version = "0.3.0-rc.3" } +ant-service-management = { path = "../ant-service-management", version = "0.4.4-rc.3" } 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 09741f2fb9..053390041e 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.112.6" +version = "0.3.0-rc.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.0" } -ant-build-info = { path = "../ant-build-info", version = "0.1.19" } -ant-evm = { path = "../ant-evm", version = "0.1.4" } -ant-logging = { path = "../ant-logging", version = "0.2.40" } -ant-networking = { path = "../ant-networking", version = "0.19.5" } -ant-protocol = { path = "../ant-protocol", version = "0.17.15" } -ant-registers = { path = "../ant-registers", version = "0.4.3" } -ant-service-management = { path = "../ant-service-management", version = "0.4.3" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0-rc.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.20-rc.3" } +ant-evm = { path = "../ant-evm", version = "0.1.5-rc.3" } +ant-logging = { path = "../ant-logging", version = "0.2.41-rc.3" } +ant-networking = { path = "../ant-networking", version = "0.3.0-rc.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.3" } +ant-registers = { path = "../ant-registers", version = "0.4.4-rc.3" } +ant-service-management = { path = "../ant-service-management", version = "0.4.4-rc.3" } 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.17.15", features = ["rpc"] } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.3", features = ["rpc"] } assert_fs = "1.0.0" -evmlib = { path = "../evmlib", version = "0.1.4" } -autonomi = { path = "../autonomi", version = "0.2.4", features = ["registers"] } +evmlib = { path = "../evmlib", version = "0.1.5-rc.3" } +autonomi = { path = "../autonomi", version = "0.3.0-rc.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 c8c4b6808d..aca39a2e4d 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.17.15" +version = "0.3.0-rc.3" [features] default = [] rpc = ["tonic", "prost"] [dependencies] -ant-build-info = { path = "../ant-build-info", version = "0.1.19" } -ant-evm = { path = "../ant-evm", version = "0.1.4" } -ant-registers = { path = "../ant-registers", version = "0.4.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.20-rc.3" } +ant-evm = { path = "../ant-evm", version = "0.1.5-rc.3" } +ant-registers = { path = "../ant-registers", version = "0.4.4-rc.3" } 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 f7607a8398..8fcc08483d 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.3" +version = "0.4.4-rc.3" [features] test-utils = [] diff --git a/ant-service-management/Cargo.toml b/ant-service-management/Cargo.toml index 45c8a8d6b5..984879ea7f 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.3" +version = "0.4.4-rc.3" [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0" } -ant-evm = { path = "../ant-evm", version = "0.1.4" } -ant-logging = { path = "../ant-logging", version = "0.2.40" } -ant-protocol = { path = "../ant-protocol", version = "0.17.15", features = ["rpc"] } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0-rc.3" } +ant-evm = { path = "../ant-evm", version = "0.1.5-rc.3" } +ant-logging = { path = "../ant-logging", version = "0.2.41-rc.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.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 abacf83744..cc59d9706b 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.58" +version = "0.1.59-rc.3" [dependencies] diff --git a/autonomi/Cargo.toml b/autonomi/Cargo.toml index cec548a0e1..d7c424d822 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.2.4" +version = "0.3.0-rc.3" edition = "2021" homepage = "https://maidsafe.net" readme = "README.md" @@ -29,11 +29,11 @@ registers = [] vault = ["registers"] [dependencies] -ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0" } -ant-evm = { path = "../ant-evm", version = "0.1.4" } -ant-networking = { path = "../ant-networking", version = "0.19.5" } -ant-protocol = { version = "0.17.15", path = "../ant-protocol" } -ant-registers = { path = "../ant-registers", version = "0.4.3" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0-rc.3" } +ant-evm = { path = "../ant-evm", version = "0.1.5-rc.3" } +ant-networking = { path = "../ant-networking", version = "0.3.0-rc.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.3" } +ant-registers = { path = "../ant-registers", version = "0.4.4-rc.3" } bip39 = "2.0.0" blst = "0.3.13" blstrs = "0.7.1" @@ -64,7 +64,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.40" } +ant-logging = { path = "../ant-logging", version = "0.2.41-rc.3" } 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. @@ -76,7 +76,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.4", features = ["wasm-bindgen"] } +evmlib = { path = "../evmlib", version = "0.1.5-rc.3", 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 42aaf737b6..ff3df5f3b7 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.4" +version = "0.1.5-rc.3" [dependencies] -ant-evm = { path = "../ant-evm", version = "0.1.4" } +ant-evm = { path = "../ant-evm", version = "0.1.5-rc.3" } clap = { version = "4.5", features = ["derive"] } dirs-next = "~2.0.0" -evmlib = { path = "../evmlib", version = "0.1.4" } +evmlib = { path = "../evmlib", version = "0.1.5-rc.3" } tokio = { version = "1.40", features = ["rt-multi-thread", "signal"] } [lints] diff --git a/evmlib/Cargo.toml b/evmlib/Cargo.toml index 5e4a5b805e..2646a874a9 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.4" +version = "0.1.5-rc.3" [features] wasm-bindgen = ["alloy/wasm-bindgen"] diff --git a/nat-detection/Cargo.toml b/nat-detection/Cargo.toml index 78290ad748..33fe7871e5 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.11" +version = "0.2.12-rc.3" [[bin]] name = "nat-detection" @@ -17,9 +17,9 @@ path = "src/main.rs" nightly = [] [dependencies] -ant-build-info = { path = "../ant-build-info", version = "0.1.19" } -ant-networking = { path = "../ant-networking", version = "0.19.5" } -ant-protocol = { path = "../ant-protocol", version = "0.17.15" } +ant-build-info = { path = "../ant-build-info", version = "0.1.20-rc.3" } +ant-networking = { path = "../ant-networking", version = "0.3.0-rc.3" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.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 d1605468ad..e3269ce45b 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.4.5" +version = "0.5.0-rc.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.0" } -ant-build-info = { path = "../ant-build-info", version = "0.1.19" } -ant-evm = { path = "../ant-evm", version = "0.1.4" } -ant-node-manager = { version = "0.11.3", path = "../ant-node-manager" } -ant-protocol = { path = "../ant-protocol", version = "0.17.15" } +ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0-rc.3" } +ant-build-info = { path = "../ant-build-info", version = "0.1.20-rc.3" } +ant-evm = { path = "../ant-evm", version = "0.1.5-rc.3" } +ant-node-manager = { version = "0.11.4-rc.3", path = "../ant-node-manager" } +ant-protocol = { path = "../ant-protocol", version = "0.3.0-rc.3" } ant-releases = { version = "0.4.0" } -ant-service-management = { version = "0.4.3", path = "../ant-service-management" } +ant-service-management = { version = "0.4.4-rc.3", 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 0109aac6b2..20ffc3ce9a 100644 --- a/release-cycle-info +++ b/release-cycle-info @@ -13,6 +13,6 @@ # Both of these numbers are used in the packaged version number, which is a collective version # number for all the released binaries. release-year: 2024 -release-month: 11 +release-month: 12 release-cycle: 1 -release-cycle-counter: 6 +release-cycle-counter: 3 diff --git a/resources/scripts/release-candidate-description.py b/resources/scripts/release-candidate-description.py index 51fb0037e8..10a91e0b96 100755 --- a/resources/scripts/release-candidate-description.py +++ b/resources/scripts/release-candidate-description.py @@ -72,7 +72,7 @@ def main(pr_numbers): crate_binary_map = { "ant-node": "antnode", "ant-node-manager": "antctl", - "autonomi-cli": "autonomi", + "ant-cli": "ant", "nat-detection": "nat-detection", "node-launchpad": "node-launchpad" } diff --git a/test-utils/Cargo.toml b/test-utils/Cargo.toml index 417428de02..1647917ed9 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.11" +version = "0.4.12-rc.3" [dependencies] bytes = { version = "1.0.1", features = ["serde"] } color-eyre = "~0.6.2" dirs-next = "~2.0.0" -evmlib = { path = "../evmlib", version = "0.1.4" } +evmlib = { path = "../evmlib", version = "0.1.5-rc.3" } libp2p = { version = "0.54.1", features = ["identify", "kad"] } rand = "0.8.5" serde = { version = "1.0.133", features = ["derive"] }