diff --git a/.cargo/config.toml b/.cargo/config.toml index b130469b5f..a957966b5c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -11,5 +11,5 @@ ci-fmt-fix = "fmt --all" ci-clippy = "lints clippy --all-targets --all-features" ci-test-compile = "test --no-run --workspace --all-features --no-default-features" ci-test = "nextest run --all-features --release --workspace --exclude tari_integration_tests --profile ci" -ci-cucumber = "test --all-features --release --package integration_tests" +ci-cucumber = "test --release --test cucumber --all-features --package tari_integration_tests -- -t @critical" #ci-check = "check --workspace --release --all-features --all-targets --lock \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index d985569569..68b1eaf77c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -633,7 +633,6 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "jobserver", "libc", ] @@ -2205,19 +2204,6 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" -[[package]] -name = "git2" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" -dependencies = [ - "bitflags 2.4.1", - "libc", - "libgit2-sys", - "log", - "url", -] - [[package]] name = "globset" version = "0.4.14" @@ -2756,15 +2742,6 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.65" @@ -2901,18 +2878,6 @@ version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" -[[package]] -name = "libgit2-sys" -version = "0.16.2+1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" -dependencies = [ - "cc", - "libc", - "libz-sys", - "pkg-config", -] - [[package]] name = "liblmdb-sys" version = "0.2.3" @@ -3206,7 +3171,7 @@ dependencies = [ [[package]] name = "minotari_app_grpc" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "argon2", "base64 0.13.1", @@ -3234,7 +3199,7 @@ dependencies = [ [[package]] name = "minotari_app_utilities" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "clap 3.2.25", "dialoguer", @@ -3256,7 +3221,7 @@ dependencies = [ [[package]] name = "minotari_chat_ffi" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "cbindgen", "chrono", @@ -3281,7 +3246,7 @@ dependencies = [ [[package]] name = "minotari_console_wallet" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "blake2", "chrono", @@ -3335,7 +3300,7 @@ dependencies = [ [[package]] name = "minotari_merge_mining_proxy" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "bincode", @@ -3354,7 +3319,6 @@ dependencies = [ "minotari_app_grpc", "minotari_app_utilities", "minotari_node_grpc_client", - "minotari_wallet_grpc_client", "monero", "reqwest", "scraper", @@ -3376,7 +3340,7 @@ dependencies = [ [[package]] name = "minotari_miner" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "base64 0.13.1", "borsh", @@ -3412,7 +3376,7 @@ dependencies = [ [[package]] name = "minotari_mining_helper_ffi" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "borsh", "cbindgen", @@ -3432,7 +3396,7 @@ dependencies = [ [[package]] name = "minotari_node" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "async-trait", @@ -3480,7 +3444,7 @@ dependencies = [ [[package]] name = "minotari_node_grpc_client" -version = "0.1.0" +version = "1.0.0-dan.9" dependencies = [ "minotari_app_grpc", "tokio", @@ -3488,7 +3452,7 @@ dependencies = [ [[package]] name = "minotari_wallet" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "argon2", "async-trait", @@ -3538,7 +3502,7 @@ dependencies = [ [[package]] name = "minotari_wallet_ffi" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "borsh", "cbindgen", @@ -3578,7 +3542,7 @@ dependencies = [ [[package]] name = "minotari_wallet_grpc_client" -version = "0.1.0" +version = "1.0.0-dan.9" dependencies = [ "minotari_app_grpc", "tari_common_types", @@ -5934,7 +5898,7 @@ dependencies = [ [[package]] name = "tari_chat_client" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "async-trait", @@ -5960,13 +5924,12 @@ dependencies = [ [[package]] name = "tari_common" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "blake2", "config", "dirs-next 1.0.2", - "git2", "log", "log4rs", "multiaddr", @@ -5987,7 +5950,7 @@ dependencies = [ [[package]] name = "tari_common_sqlite" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "diesel", "diesel_migrations", @@ -6001,7 +5964,7 @@ dependencies = [ [[package]] name = "tari_common_types" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "base64 0.21.5", "blake2", @@ -6023,7 +5986,7 @@ dependencies = [ [[package]] name = "tari_comms" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "async-trait", @@ -6072,7 +6035,7 @@ dependencies = [ [[package]] name = "tari_comms_dht" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "bitflags 2.4.1", @@ -6116,7 +6079,7 @@ dependencies = [ [[package]] name = "tari_comms_rpc_macros" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "futures 0.3.29", "proc-macro2", @@ -6131,7 +6094,7 @@ dependencies = [ [[package]] name = "tari_contacts" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "chrono", "diesel", @@ -6164,7 +6127,7 @@ dependencies = [ [[package]] name = "tari_core" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "async-trait", "bincode", @@ -6261,11 +6224,11 @@ dependencies = [ [[package]] name = "tari_features" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" [[package]] name = "tari_hashing" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "blake2", "borsh", @@ -6275,7 +6238,7 @@ dependencies = [ [[package]] name = "tari_integration_tests" -version = "0.35.1" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "async-trait", @@ -6323,7 +6286,7 @@ dependencies = [ [[package]] name = "tari_key_manager" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "argon2", "async-trait", @@ -6358,7 +6321,7 @@ dependencies = [ [[package]] name = "tari_libtor" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "derivative", "libtor", @@ -6373,7 +6336,7 @@ dependencies = [ [[package]] name = "tari_metrics" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "futures 0.3.29", @@ -6388,7 +6351,7 @@ dependencies = [ [[package]] name = "tari_mmr" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "bincode", "blake2", @@ -6407,7 +6370,7 @@ dependencies = [ [[package]] name = "tari_p2p" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "clap 3.2.25", @@ -6443,7 +6406,7 @@ dependencies = [ [[package]] name = "tari_script" -version = "1.0.0-dan.8" +version = "1.0.0-dan.9" dependencies = [ "blake2", "borsh", @@ -6460,7 +6423,7 @@ dependencies = [ [[package]] name = "tari_service_framework" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "anyhow", "async-trait", @@ -6477,7 +6440,7 @@ dependencies = [ [[package]] name = "tari_shutdown" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "futures 0.3.29", "tokio", @@ -6485,7 +6448,7 @@ dependencies = [ [[package]] name = "tari_storage" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "bincode", "lmdb-zero", @@ -6498,7 +6461,7 @@ dependencies = [ [[package]] name = "tari_test_utils" -version = "1.0.0-dan.5" +version = "1.0.0-dan.9" dependencies = [ "futures 0.3.29", "futures-test", diff --git a/Cargo.toml b/Cargo.toml index 705ad4cfd0..d1dbfa69ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,9 @@ +[workspace.package] +version = "1.0.0-dan.9" +edition = "2021" + [workspace] +resolver = "2" members = [ "base_layer/chat_ffi", @@ -34,8 +39,43 @@ members = [ "hashing", ] -# Add here until we move to edition=2021 -resolver = "2" +[workspace.dependencies] +tari_comms = { path = "comms/core", version = "1.0.0-dan.9" } +tari_comms_dht = { path = "comms/dht", version = "1.0.0-dan.9", default-features = false } +tari_common = { path = "common", version = "1.0.0-dan.9" } +tari_features = { path = "common/tari_features", version = "1.0.0-dan.9" } +tari_common_types = { path = "base_layer/common_types" } +tari_core = { path = "base_layer/core", default-features = false } +tari_crypto = { version = "0.20" } +tari_script = { path = "infrastructure/tari_script" } +tari_utilities = { version = "0.7" } +minotari_app_grpc = { path = "applications/minotari_app_grpc" } +minotari_app_utilities = { path = "applications/minotari_app_utilities" } +tari_contacts = { path = "base_layer/contacts" } +tari_key_manager = { path = "base_layer/key_manager" } +tari_libtor = { path = "infrastructure/libtor" } +tari_p2p = { path = "base_layer/p2p" } +tari_shutdown = { path = "infrastructure/shutdown" } +minotari_wallet = { path = "base_layer/wallet" } +tari_hashing = { path = "hashing" } +tari_common_sqlite = { path = "common_sqlite" } +tari_service_framework = { path = "base_layer/service_framework" } +tari_test_utils = { path = "infrastructure/test_utils" } +tari_storage = { path = "infrastructure/storage" } +minotari_node_grpc_client = { path = "clients/rust/base_node_grpc_client" } +tari_comms_rpc_macros = { path = "comms/rpc_macros" } +tari_metrics = { path = "infrastructure/metrics" } +tari_mmr = { path = "base_layer/mmr" } +minotari_chat_ffi = { path = "base_layer/chat_ffi" } +minotari_console_wallet = { path = "applications/minotari_console_wallet" } +minotari_merge_mining_proxy = { path = "applications/minotari_merge_mining_proxy" } +minotari_miner = { path = "applications/minotari_miner" } +tari_chat_client = { path = "base_layer/contacts/src/chat_client" } +minotari_node = { path = "applications/minotari_node" } +minotari_wallet_ffi = { path = "base_layer/wallet_ffi" } +minotari_wallet_grpc_client = { path = "clients/rust/wallet_grpc_client" } + + [profile.release] # Shutdown when panicking so we can see the error, specifically for the wallet diff --git a/applications/minotari_app_grpc/Cargo.toml b/applications/minotari_app_grpc/Cargo.toml index 67cc5f3644..65b292859c 100644 --- a/applications/minotari_app_grpc/Cargo.toml +++ b/applications/minotari_app_grpc/Cargo.toml @@ -4,16 +4,16 @@ authors = ["The Tari Development Community"] description = "This crate is to provide a single source for all cross application grpc files and conversions to and from tari::core" repository = "https://github.com/tari-project/tari" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -tari_common_types = { path = "../../base_layer/common_types" } -tari_comms = { path = "../../comms/core" } -tari_core = { path = "../../base_layer/core" } -tari_crypto = { version = "0.20" } -tari_script = { path = "../../infrastructure/tari_script" } -tari_utilities = { version = "0.7" } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +tari_core = { workspace = true, features = ["base_node"] } +tari_crypto = { workspace = true } +tari_script = { workspace = true } +tari_utilities = { workspace = true } argon2 = { version = "0.4.1", features = ["std", "password-hash"] } base64 = "0.13.0" @@ -31,7 +31,7 @@ tonic = { version = "0.8.3", features = ["tls"] } zeroize = "1" [build-dependencies] -tari_features = { path = "../../common/tari_features", version = "1.0.0-dan.5" } +tari_features = { workspace = true } tonic-build = "0.8.4" [package.metadata.cargo-machete] diff --git a/applications/minotari_app_utilities/Cargo.toml b/applications/minotari_app_utilities/Cargo.toml index ce665a6bf7..8440a2b2e7 100644 --- a/applications/minotari_app_utilities/Cargo.toml +++ b/applications/minotari_app_utilities/Cargo.toml @@ -1,16 +1,16 @@ [package] name = "minotari_app_utilities" -version = "1.0.0-dan.5" +version.workspace = true authors = ["The Tari Development Community"] -edition = "2018" +edition.workspace = true license = "BSD-3-Clause" [dependencies] -tari_common = { path = "../../common" } -tari_common_types = { path = "../../base_layer/common_types" } -tari_comms = { path = "../../comms/core" } -tari_utilities = { version = "0.7" } -minotari_app_grpc = { path = "../minotari_app_grpc", optional = true } +tari_common = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +tari_utilities = { workspace = true } +minotari_app_grpc = { workspace = true, optional = true } clap = { version = "3.2", features = ["derive", "env"] } futures = { version = "^0.3.16", default-features = false, features = ["alloc"] } @@ -25,8 +25,8 @@ tonic = "0.8.3" [build-dependencies] -tari_common = { path = "../../common", features = ["build", "static-application-info"] } -tari_features = { path = "../../common/tari_features", version = "1.0.0-dan.5" } +tari_common = { workspace = true, features = ["build"] } +tari_features = { workspace = true } [features] miner_input = ["minotari_app_grpc"] diff --git a/applications/minotari_app_utilities/build.rs b/applications/minotari_app_utilities/build.rs index 8df78dd736..0774dcc55d 100644 --- a/applications/minotari_app_utilities/build.rs +++ b/applications/minotari_app_utilities/build.rs @@ -20,12 +20,9 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use tari_common::build::StaticApplicationInfo; use tari_features::resolver::build_features; fn main() -> Result<(), Box> { build_features(); - let gen = StaticApplicationInfo::initialize()?; - gen.write_consts_to_outdir("consts.rs")?; Ok(()) } diff --git a/applications/minotari_app_utilities/src/lib.rs b/applications/minotari_app_utilities/src/lib.rs index 0859c10104..43963816d7 100644 --- a/applications/minotari_app_utilities/src/lib.rs +++ b/applications/minotari_app_utilities/src/lib.rs @@ -26,11 +26,6 @@ pub mod identity_management; pub mod parse_miner_input; pub mod utilities; -pub mod consts { - // Import the auto-generated const values from the Manifest and Git - include!(concat!(env!("OUT_DIR"), "/consts.rs")); -} - /// Non-64-bit architectures are untested. Depending on the application, it may not compile already or could be various /// classes of bugs (overflows, crashes, etc). Use this macro to explicitly fail compilation on non-64-bit targets. #[macro_export] diff --git a/applications/minotari_console_wallet/Cargo.toml b/applications/minotari_console_wallet/Cargo.toml index f4c66935a5..042d945090 100644 --- a/applications/minotari_console_wallet/Cargo.toml +++ b/applications/minotari_console_wallet/Cargo.toml @@ -1,28 +1,29 @@ [package] name = "minotari_console_wallet" -version = "1.0.0-dan.5" +version.workspace = true authors = ["The Tari Development Community"] -edition = "2018" +edition.workspace = true license = "BSD-3-Clause" [dependencies] -minotari_app_grpc = { path = "../minotari_app_grpc" } -minotari_app_utilities = { path = "../minotari_app_utilities" } -tari_common = { path = "../../common" } -tari_common_types = { path = "../../base_layer/common_types" } -tari_comms = { path = "../../comms/core" } -tari_comms_dht = { path = "../../comms/dht" } -tari_contacts = { path = "../../base_layer/contacts" } -tari_crypto = { version = "0.20" } -tari_key_manager = { path = "../../base_layer/key_manager" } -tari_libtor = { path = "../../infrastructure/libtor", optional = true } -tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] } -tari_shutdown = { path = "../../infrastructure/shutdown" } -tari_utilities = { version = "0.7" } -minotari_wallet = { path = "../../base_layer/wallet", features = [ +minotari_app_grpc = { workspace = true } +minotari_app_utilities = { workspace = true } +tari_common = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +tari_comms_dht = { workspace = true } +tari_core = { workspace = true, default-features = false, features = ["transactions", "mempool_proto", "base_node_proto"] } +tari_contacts = { workspace = true } +tari_crypto = { workspace = true } +tari_key_manager = { workspace = true } +tari_libtor = { workspace = true, optional = true } +tari_p2p = { workspace = true, features = ["auto-update"] } +tari_shutdown = { workspace = true } +tari_utilities = { workspace = true } +minotari_wallet = { workspace = true, features = [ "bundled_sqlite", ] } -tari_hashing = { path = "../../hashing" } +tari_hashing = { workspace = true } # Uncomment for tokio tracing via tokio-console (needs "tracing" featurs) console-subscriber = "0.1.8" @@ -71,10 +72,6 @@ url = "2.3.1" zeroize = "1" zxcvbn = "2" -[dependencies.tari_core] -path = "../../base_layer/core" -default-features = false -features = ["transactions", "mempool_proto", "base_node_proto"] [dependencies.tui] version = "^0.16" @@ -82,7 +79,7 @@ default-features = false features = ["crossterm"] [build-dependencies] -tari_features = { path = "../../common/tari_features", version = "1.0.0-dan.5" } +tari_features = { workspace = true } [features] default = ["libtor"] diff --git a/applications/minotari_console_wallet/src/config.rs b/applications/minotari_console_wallet/src/config.rs index f0a4f7ec59..254fa4bb1d 100644 --- a/applications/minotari_console_wallet/src/config.rs +++ b/applications/minotari_console_wallet/src/config.rs @@ -23,7 +23,6 @@ #![allow(dead_code, unused)] use config::Config; -use minotari_app_utilities::consts; use minotari_wallet::WalletConfig; use tari_common::{configuration::CommonConfig, ConfigurationError, DefaultConfigLoader}; use tari_p2p::{auto_update::AutoUpdateConfig, PeerSeedsConfig}; @@ -45,7 +44,7 @@ impl ApplicationConfig { peer_seeds: PeerSeedsConfig::load_from(cfg)?, }; - config.wallet.p2p.user_agent = format!("tari/wallet/{}", consts::APP_VERSION_NUMBER); + config.wallet.p2p.user_agent = format!("tari/wallet/{}", env!("CARGO_PKG_VERSION")); config.wallet.set_base_path(config.common.base_path()); Ok(config) diff --git a/applications/minotari_console_wallet/src/lib.rs b/applications/minotari_console_wallet/src/lib.rs index 95cb8c32da..26634aa379 100644 --- a/applications/minotari_console_wallet/src/lib.rs +++ b/applications/minotari_console_wallet/src/lib.rs @@ -48,7 +48,7 @@ pub use cli::{ }; use init::{change_password, get_base_node_peer_config, init_wallet, start_wallet, tari_splash_screen, WalletBoot}; use log::*; -use minotari_app_utilities::{common_cli_args::CommonCliArgs, consts}; +use minotari_app_utilities::common_cli_args::CommonCliArgs; use minotari_wallet::transaction_service::config::TransactionRoutingMechanism; use recovery::{get_seed_from_seed_words, prompt_private_key_from_seed_words}; use tari_common::{ @@ -114,7 +114,7 @@ pub fn run_wallet_with_cli( target: LOG_TARGET, "== {} ({}) ==", ApplicationType::ConsoleWallet, - consts::APP_VERSION + env!("CARGO_PKG_VERSION") ); let password = get_password(config, &cli); diff --git a/applications/minotari_console_wallet/src/ui/components/menu.rs b/applications/minotari_console_wallet/src/ui/components/menu.rs index 1ef24962e3..9ba8ad0240 100644 --- a/applications/minotari_console_wallet/src/ui/components/menu.rs +++ b/applications/minotari_console_wallet/src/ui/components/menu.rs @@ -1,7 +1,6 @@ // Copyright 2022 The Tari Project // SPDX-License-Identifier: BSD-3-Clause -use minotari_app_utilities::consts; use tokio::runtime::Handle; use tui::{ backend::Backend, @@ -40,7 +39,7 @@ impl Component for Menu { let version = Spans::from(vec![ Span::styled(" Version: ", Style::default().fg(Color::White)), - Span::styled(consts::APP_VERSION_NUMBER, Style::default().fg(Color::Magenta)), + Span::styled(env!("CARGO_PKG_VERSION"), Style::default().fg(Color::Magenta)), Span::raw(" "), ]); diff --git a/applications/minotari_console_wallet/src/ui/mod.rs b/applications/minotari_console_wallet/src/ui/mod.rs index 5413c7ee22..022e532820 100644 --- a/applications/minotari_console_wallet/src/ui/mod.rs +++ b/applications/minotari_console_wallet/src/ui/mod.rs @@ -22,7 +22,6 @@ use crossterm::terminal::SetTitle; use log::error; -use minotari_app_utilities::consts; use tari_common::exit_codes::{ExitCode, ExitError}; use crate::utils::crossterm_events::CrosstermEvents; @@ -86,7 +85,7 @@ fn crossterm_loop(mut app: App>) -> Result<(), ExitErro error!(target: LOG_TARGET, "Error creating stdout context. {}", e); ExitCode::InterfaceError })?; - let terminal_title = format!("Minotari Console Wallet - Version {}", consts::APP_VERSION); + let terminal_title = format!("Minotari Console Wallet - Version {}", env!("CARGO_PKG_VERSION")); if let Err(e) = execute!(stdout, SetTitle(terminal_title.as_str())) { println!("Error setting terminal title. {}", e) } diff --git a/applications/minotari_ledger_wallet/Cargo.toml b/applications/minotari_ledger_wallet/Cargo.toml index adbaeec326..88e5b3146b 100644 --- a/applications/minotari_ledger_wallet/Cargo.toml +++ b/applications/minotari_ledger_wallet/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "minotari_ledger_wallet" -version = "0.52.0-dan.5" +version.workspace = true authors = ["The Tari Development Community"] license = "BSD-3-Clause" -edition = "2021" +edition.workspace = true [dependencies] @@ -11,7 +11,7 @@ edition = "2021" nanos_sdk = { git = "https://github.com/LedgerHQ/ledger-nanos-sdk.git" } nanos_ui = { git = "https://github.com/LedgerHQ/ledger-nanos-ui.git", rev = "6a7c4a3eb41ee0b09c8fd4dcc5be4f3a1f5d7b45" } -tari_crypto = { version = "0.18", default-features = false } +tari_crypto = { workspace = true, default-features = false } embedded-alloc = "0.5.0" critical-section = { version = "1.1.1" } diff --git a/applications/minotari_merge_mining_proxy/Cargo.toml b/applications/minotari_merge_mining_proxy/Cargo.toml index 1d4f618deb..5ccda43132 100644 --- a/applications/minotari_merge_mining_proxy/Cargo.toml +++ b/applications/minotari_merge_mining_proxy/Cargo.toml @@ -4,23 +4,22 @@ authors = ["The Tari Development Community"] description = "The Tari merge mining proxy for xmrig" repository = "https://github.com/tari-project/tari" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [features] default = [] [dependencies] -minotari_app_grpc = { path = "../minotari_app_grpc" } -minotari_app_utilities = { path = "../minotari_app_utilities", features = ["miner_input"] } -minotari_node_grpc_client = { path = "../../clients/rust/base_node_grpc_client" } -minotari_wallet_grpc_client = { path = "../../clients/rust/wallet_grpc_client" } -tari_common = { path = "../../common" } -tari_common_types = { path = "../../base_layer/common_types" } -tari_comms = { path = "../../comms/core" } -tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions"] } -tari_key_manager = { path = "../../base_layer/key_manager", features = ["key_manager_service"] } -tari_utilities = { version = "0.7" } +minotari_app_grpc = { workspace = true } +minotari_app_utilities = { workspace = true, features = ["miner_input"] } +minotari_node_grpc_client = { workspace = true } +tari_common = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +tari_core = { workspace = true, default-features = false, features = [] } +tari_key_manager = { workspace = true, features = ["key_manager_service"] } +tari_utilities = { workspace = true } anyhow = "1.0.53" bincode = "1.3.1" @@ -47,7 +46,7 @@ url = "2.1.1" scraper = "0.19.0" [build-dependencies] -tari_features = { path = "../../common/tari_features", version = "1.0.0-dan.5" } +tari_features = { workspace = true } [dev-dependencies] markup5ever = "0.11.0" \ No newline at end of file diff --git a/applications/minotari_merge_mining_proxy/src/config.rs b/applications/minotari_merge_mining_proxy/src/config.rs index 0f8db4b9a4..cc8d75b505 100644 --- a/applications/minotari_merge_mining_proxy/src/config.rs +++ b/applications/minotari_merge_mining_proxy/src/config.rs @@ -22,13 +22,12 @@ use std::path::{Path, PathBuf}; -use minotari_wallet_grpc_client::GrpcAuthentication; use serde::{Deserialize, Serialize}; use tari_common::{ configuration::{Network, StringList}, SubConfigPath, }; -use tari_common_types::tari_address::TariAddress; +use tari_common_types::{grpc_authentication::GrpcAuthentication, tari_address::TariAddress}; use tari_comms::multiaddr::Multiaddr; use tari_core::transactions::transaction_components::RangeProofType; diff --git a/applications/minotari_merge_mining_proxy/src/error.rs b/applications/minotari_merge_mining_proxy/src/error.rs index afd2d4b56a..4e9d8d7954 100644 --- a/applications/minotari_merge_mining_proxy/src/error.rs +++ b/applications/minotari_merge_mining_proxy/src/error.rs @@ -26,8 +26,8 @@ use std::io; use hex::FromHexError; use hyper::header::InvalidHeaderValue; +use minotari_app_grpc::authentication::BasicAuthError; use minotari_app_utilities::parse_miner_input::ParseInputError; -use minotari_wallet_grpc_client::BasicAuthError; use tari_common::{ConfigError, ConfigurationError}; use tari_core::{ consensus::ConsensusBuilderError, diff --git a/applications/minotari_merge_mining_proxy/src/main.rs b/applications/minotari_merge_mining_proxy/src/main.rs index 30c1943a74..9d45f47632 100644 --- a/applications/minotari_merge_mining_proxy/src/main.rs +++ b/applications/minotari_merge_mining_proxy/src/main.rs @@ -40,14 +40,13 @@ use std::io::stdout; use clap::Parser; use crossterm::{execute, terminal::SetTitle}; use log::*; -use minotari_app_utilities::consts; use tari_common::initialize_logging; const LOG_TARGET: &str = "minotari_mm_proxy::proxy"; #[tokio::main] async fn main() -> Result<(), anyhow::Error> { - let terminal_title = format!("Minotari Merge Mining Proxy - Version {}", consts::APP_VERSION); + let terminal_title = format!("Minotari Merge Mining Proxy - Version {}", env!("CARGO_PKG_VERSION")); if let Err(e) = execute!(stdout(), SetTitle(terminal_title.as_str())) { println!("Error setting terminal title. {}", e) } diff --git a/applications/minotari_merge_mining_proxy/src/run_merge_miner.rs b/applications/minotari_merge_mining_proxy/src/run_merge_miner.rs index 34ceb2a856..76de156b9b 100644 --- a/applications/minotari_merge_mining_proxy/src/run_merge_miner.rs +++ b/applications/minotari_merge_mining_proxy/src/run_merge_miner.rs @@ -25,7 +25,7 @@ use std::{convert::Infallible, str::FromStr}; use futures::future; use hyper::{service::make_service_fn, Server}; use log::*; -use minotari_app_grpc::tls::protocol_string; +use minotari_app_grpc::{authentication::ClientAuthenticationInterceptor, tls::protocol_string}; use minotari_app_utilities::parse_miner_input::{ base_node_socket_address, verify_base_node_grpc_mining_responses, @@ -33,7 +33,6 @@ use minotari_app_utilities::parse_miner_input::{ BaseNodeGrpcClient, }; use minotari_node_grpc_client::{grpc, grpc::base_node_client::BaseNodeClient}; -use minotari_wallet_grpc_client::ClientAuthenticationInterceptor; use tari_common::{configuration::StringList, load_configuration, DefaultConfigLoader}; use tari_comms::utils::multiaddr::multiaddr_to_socketaddr; use tari_core::proof_of_work::randomx_factory::RandomXFactory; diff --git a/applications/minotari_miner/Cargo.toml b/applications/minotari_miner/Cargo.toml index c24778a823..0ceafcf722 100644 --- a/applications/minotari_miner/Cargo.toml +++ b/applications/minotari_miner/Cargo.toml @@ -4,18 +4,18 @@ authors = ["The Tari Development Community"] description = "The tari miner implementation" repository = "https://github.com/tari-project/tari" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -tari_core = { path = "../../base_layer/core", default-features = false } -tari_common = { path = "../../common" } -tari_common_types = { path = "../../base_layer/common_types" } -tari_comms = { path = "../../comms/core" } -minotari_app_utilities = { path = "../minotari_app_utilities", features = ["miner_input"] } -minotari_app_grpc = { path = "../minotari_app_grpc" } -tari_crypto = { version = "0.20" } -tari_utilities = { version = "0.7" } +tari_core = { workspace = true, default-features = false } +tari_common = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +minotari_app_utilities = { workspace = true, features = ["miner_input"] } +minotari_app_grpc = { workspace = true } +tari_crypto = { workspace = true } +tari_utilities = { workspace = true } base64 = "0.13.0" borsh = "1.2" @@ -36,7 +36,7 @@ serde = { version = "1.0", default_features = false, features = ["derive"] } serde_json = "1.0.57" thiserror = "1.0" tokio = { version = "1.36", default_features = false, features = ["rt-multi-thread"] } -tonic = { version = "0.8.3", features = ["tls", "tls-roots" ] } +tonic = { version = "0.8.3", features = ["tls", "tls-roots"] } [dev-dependencies] prost-types = "0.11.9" diff --git a/applications/minotari_miner/src/main.rs b/applications/minotari_miner/src/main.rs index 992c8080eb..795a4446a8 100644 --- a/applications/minotari_miner/src/main.rs +++ b/applications/minotari_miner/src/main.rs @@ -25,7 +25,6 @@ use std::io::stdout; use clap::Parser; use crossterm::{execute, terminal::SetTitle}; use log::*; -use minotari_app_utilities::consts; use run_miner::start_miner; use tari_common::{exit_codes::ExitError, initialize_logging}; @@ -45,7 +44,7 @@ mod stratum; /// Application entry point #[tokio::main] async fn main() { - let terminal_title = format!("Minotari Miner - Version {}", consts::APP_VERSION); + let terminal_title = format!("Minotari Miner - Version {}", env!("CARGO_PKG_VERSION")); if let Err(e) = execute!(stdout(), SetTitle(terminal_title.as_str())) { println!("Error setting terminal title. {}", e) } diff --git a/applications/minotari_node/Cargo.toml b/applications/minotari_node/Cargo.toml index 67e3352423..7def30e63f 100644 --- a/applications/minotari_node/Cargo.toml +++ b/applications/minotari_node/Cargo.toml @@ -4,24 +4,24 @@ authors = ["The Tari Development Community"] description = "The tari full base node implementation" repository = "https://github.com/tari-project/tari" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -minotari_app_grpc = { path = "../minotari_app_grpc" } -minotari_app_utilities = { path = "../minotari_app_utilities" } -tari_common = { path = "../../common" } -tari_comms = { path = "../../comms/core", features = ["rpc"] } -tari_common_types = { path = "../../base_layer/common_types" } -tari_comms_dht = { path = "../../comms/dht" } -tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions"] } -tari_crypto = { version = "0.20" } -tari_libtor = { path = "../../infrastructure/libtor", optional = true } -tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] } -tari_storage = { path = "../../infrastructure/storage" } -tari_service_framework = { path = "../../base_layer/service_framework" } -tari_shutdown = { path = "../../infrastructure/shutdown" } -tari_utilities = { version = "0.7" } +minotari_app_grpc = { workspace = true } +minotari_app_utilities = { workspace = true } +tari_common = { workspace = true } +tari_comms = { workspace = true, features = ["rpc"] } +tari_common_types = { workspace = true } +tari_comms_dht = { workspace = true } +tari_core = { workspace = true, default-features = false, features = ["transactions"] } +tari_crypto = { workspace = true } +tari_libtor = { workspace = true, optional = true } +tari_p2p = { workspace = true, features = ["auto-update"] } +tari_storage = { workspace = true } +tari_service_framework = { workspace = true } +tari_shutdown = { workspace = true } +tari_utilities = { workspace = true } tari_key_manager = { path = "../../base_layer/key_manager", features = ["key_manager_service"] } anyhow = "1.0.53" @@ -29,7 +29,7 @@ async-trait = "0.1.52" bincode = "1.3.1" borsh = "1.2" chrono = { version = "0.4.19", default-features = false } -clap = { version = "3.2", features = ["derive", "env"] } +clap = { version = "3.2", features = [] } console-subscriber = "0.1.8" config = { version = "0.14.0" } crossterm = { version = "0.25.0", features = ["event-stream"] } @@ -59,7 +59,7 @@ safe = [] libtor = ["tari_libtor"] [build-dependencies] -tari_features = { path = "../../common/tari_features", version = "1.0.0-dan.5" } +tari_features = { workspace = true } [package.metadata.cargo-machete] ignored = [ diff --git a/applications/minotari_node/src/bootstrap.rs b/applications/minotari_node/src/bootstrap.rs index 9bf7ea1125..a0d08fbbd0 100644 --- a/applications/minotari_node/src/bootstrap.rs +++ b/applications/minotari_node/src/bootstrap.rs @@ -28,7 +28,7 @@ use std::{ }; use log::*; -use minotari_app_utilities::{consts, identity_management, identity_management::load_from_json}; +use minotari_app_utilities::{identity_management, identity_management::load_from_json}; use tari_common::{ configuration::bootstrap::ApplicationType, exit_codes::{ExitCode, ExitError}, @@ -134,7 +134,7 @@ where B: BlockchainBackend + 'static )) .add_initializer(SoftwareUpdaterService::new( ApplicationType::BaseNode, - consts::APP_VERSION_NUMBER + env!("CARGO_PKG_VERSION") .parse() .expect("Unable to parse application version. Not valid semver"), self.app_config.auto_update.clone(), diff --git a/applications/minotari_node/src/commands/cli.rs b/applications/minotari_node/src/commands/cli.rs index 2fd20b0efa..d9227e37d8 100644 --- a/applications/minotari_node/src/commands/cli.rs +++ b/applications/minotari_node/src/commands/cli.rs @@ -24,7 +24,6 @@ use std::io::stdout; use chrono::{Datelike, Utc}; use crossterm::{execute, terminal::SetTitle}; -use minotari_app_utilities::consts; /// returns the top or bottom box line of the specified length fn box_line(length: usize, is_top: bool) -> String { @@ -105,7 +104,7 @@ fn multiline_find_display_length(lines: &str) -> usize { /// Prints a pretty banner on the console as well as the list of available commands pub fn print_banner(commands: Vec, chunk_size: usize) { - let terminal_title = format!("Minotari Base Node - Version {}", consts::APP_VERSION); + let terminal_title = format!("Minotari Base Node - Version {}", env!("CARGO_PKG_VERSION")); if let Err(e) = execute!(stdout(), SetTitle(terminal_title.as_str())) { println!("Error setting terminal title. {}", e) } @@ -164,13 +163,13 @@ pub fn print_banner(commands: Vec, chunk_size: usize) { println!( "{}", box_data( - format!("Copyright 2019-{}. {}", Utc::now().year(), consts::APP_AUTHOR), + format!("Copyright 2019-{}. {}", Utc::now().year(), "The Tari Project"), target_line_length ) ); println!( "{}", - box_data(format!("Version {}", consts::APP_VERSION), target_line_length) + box_data(format!("Version {}", env!("CARGO_PKG_VERSION")), target_line_length) ); println!("{}", box_separator(target_line_length)); println!("{}", box_data("Commands".to_string(), target_line_length)); diff --git a/applications/minotari_node/src/commands/command/check_for_updates.rs b/applications/minotari_node/src/commands/command/check_for_updates.rs index 141bb7859c..977a6056f2 100644 --- a/applications/minotari_node/src/commands/command/check_for_updates.rs +++ b/applications/minotari_node/src/commands/command/check_for_updates.rs @@ -23,7 +23,6 @@ use anyhow::Error; use async_trait::async_trait; use clap::Parser; -use minotari_app_utilities::consts; use super::{CommandContext, HandleCommand}; @@ -41,7 +40,10 @@ impl HandleCommand for CommandContext { impl CommandContext { /// Check for updates pub async fn check_for_updates(&mut self) -> Result<(), Error> { - println!("Checking for updates (current version: {})...", consts::APP_VERSION); + println!( + "Checking for updates (current version: {})...", + env!("CARGO_PKG_VERSION") + ); match self.software_updater.check_for_updates().await { Some(update) => { println!( diff --git a/applications/minotari_node/src/commands/command/status.rs b/applications/minotari_node/src/commands/command/status.rs index f4d101a104..d32350d699 100644 --- a/applications/minotari_node/src/commands/command/status.rs +++ b/applications/minotari_node/src/commands/command/status.rs @@ -26,7 +26,6 @@ use anyhow::{anyhow, Error}; use async_trait::async_trait; use chrono::{DateTime, NaiveDateTime, Utc}; use clap::Parser; -use minotari_app_utilities::consts; use tari_comms::connection_manager::LivenessStatus; use tokio::time; @@ -59,7 +58,7 @@ impl CommandContext { } let mut status_line = StatusLine::new(); - status_line.add_field("", format!("v{}", consts::APP_VERSION_NUMBER)); + status_line.add_field("", format!("v{}", env!("CARGO_PKG_VERSION"))); status_line.add_field("", self.config.network()); status_line.add_field("State", self.state_machine_info.borrow().state_info.short_desc()); diff --git a/applications/minotari_node/src/commands/command/version.rs b/applications/minotari_node/src/commands/command/version.rs index c7bc93ad44..c2d9d2de8e 100644 --- a/applications/minotari_node/src/commands/command/version.rs +++ b/applications/minotari_node/src/commands/command/version.rs @@ -23,7 +23,6 @@ use anyhow::Error; use async_trait::async_trait; use clap::Parser; -use minotari_app_utilities::consts; use super::{CommandContext, HandleCommand}; @@ -41,8 +40,7 @@ impl HandleCommand for CommandContext { impl CommandContext { /// Function process the version command pub fn print_version(&self) -> Result<(), Error> { - println!("Version: {}", consts::APP_VERSION); - println!("Author: {}", consts::APP_AUTHOR); + println!("Version: {}", env!("CARGO_PKG_VERSION")); if let Some(ref update) = *self.software_updater.update_notifier().borrow() { println!( diff --git a/applications/minotari_node/src/config.rs b/applications/minotari_node/src/config.rs index b24861ac56..f433a30a21 100644 --- a/applications/minotari_node/src/config.rs +++ b/applications/minotari_node/src/config.rs @@ -27,7 +27,6 @@ use std::{ }; use config::Config; -use minotari_app_utilities::consts; use serde::{Deserialize, Serialize}; use tari_common::{ configuration::{serializers, CommonConfig, Network, StringList}, @@ -149,7 +148,7 @@ impl Default for BaseNodeConfig { fn default() -> Self { let p2p = P2pConfig { datastore_path: PathBuf::from("peer_db/base_node"), - user_agent: format!("tari/basenode/{}", consts::APP_VERSION_NUMBER), + user_agent: format!("tari/basenode/{}", env!("CARGO_PKG_VERSION")), ..Default::default() }; Self { diff --git a/applications/minotari_node/src/grpc/base_node_grpc_server.rs b/applications/minotari_node/src/grpc/base_node_grpc_server.rs index 10ee2c4d86..40e4936f4b 100644 --- a/applications/minotari_node/src/grpc/base_node_grpc_server.rs +++ b/applications/minotari_node/src/grpc/base_node_grpc_server.rs @@ -33,7 +33,6 @@ use minotari_app_grpc::{ tari_rpc, tari_rpc::{CalcType, Sorting}, }; -use minotari_app_utilities::consts; use tari_common_types::{ tari_address::TariAddress, types::{Commitment, FixedHash, PublicKey, Signature}, @@ -1886,7 +1885,7 @@ impl tari_rpc::base_node_server::BaseNode for BaseNodeGrpcServer { async fn get_version(&self, _request: Request) -> Result, Status> { self.check_method_enabled(GrpcMethod::GetVersion)?; - Ok(Response::new(consts::APP_VERSION.to_string().into())) + Ok(Response::new(env!("CARGO_PKG_VERSION").to_string().into())) } async fn check_for_updates( diff --git a/applications/minotari_node/src/main.rs b/applications/minotari_node/src/main.rs index 60fd7b1889..7310f06ed9 100644 --- a/applications/minotari_node/src/main.rs +++ b/applications/minotari_node/src/main.rs @@ -73,7 +73,7 @@ use std::{process, sync::Arc}; use clap::Parser; use log::*; -use minotari_app_utilities::{consts, identity_management::setup_node_identity, utilities::setup_runtime}; +use minotari_app_utilities::{identity_management::setup_node_identity, utilities::setup_runtime}; use minotari_node::{cli::Cli, run_base_node_with_cli, ApplicationConfig}; use tari_common::{exit_codes::ExitError, initialize_logging, load_configuration}; use tari_comms::peer_manager::PeerFeatures; @@ -118,7 +118,7 @@ fn main_inner() -> Result<(), ExitError> { info!( target: LOG_TARGET, "Starting Minotari Base Node version: {}", - consts::APP_VERSION + env!("CARGO_PKG_VERSION") ); #[cfg(all(unix, feature = "libtor"))] diff --git a/base_layer/chat_ffi/Cargo.toml b/base_layer/chat_ffi/Cargo.toml index b60f11e20a..a0b52aca87 100644 --- a/base_layer/chat_ffi/Cargo.toml +++ b/base_layer/chat_ffi/Cargo.toml @@ -3,18 +3,18 @@ name = "minotari_chat_ffi" authors = ["The Tari Development Community"] description = "Tari cryptocurrency chat C FFI bindings" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -minotari_app_utilities = { path = "../../applications/minotari_app_utilities" } -tari_chat_client = { path = "../contacts/src/chat_client" } -tari_common = { path = "../../common" } -tari_common_types = { path = "../common_types" } -tari_contacts = { path = "../contacts" } -tari_p2p = { path = "../p2p" } -tari_shutdown = { path = "../../infrastructure/shutdown" } -tari_utilities = { version = "0.7" } +minotari_app_utilities = { workspace = true } +tari_chat_client = { workspace = true } +tari_common = { workspace = true } +tari_common_types = { workspace = true } +tari_contacts = { workspace = true } +tari_p2p = { workspace = true } +tari_shutdown = { workspace = true } +tari_utilities = { workspace = true } libc = "0.2.65" libsqlite3-sys = { version = "0.25.1", features = ["bundled"], optional = true } @@ -32,11 +32,11 @@ crate-type = ["staticlib", "cdylib"] [dev-dependencies] chrono = { version = "0.4.19", default-features = false } rand = "0.8" -tari_crypto = { version = "0.20" } +tari_crypto = { workspace = true } [build-dependencies] cbindgen = "0.24.3" -tari_common = { path = "../../common", features = ["build", "static-application-info"] } +tari_common = { workspace = true, features = ["build"] } [features] default = ["bundled_sqlite"] diff --git a/base_layer/chat_ffi/build.rs b/base_layer/chat_ffi/build.rs index 74da9aa0bf..5d0a129bbe 100644 --- a/base_layer/chat_ffi/build.rs +++ b/base_layer/chat_ffi/build.rs @@ -4,16 +4,10 @@ use std::{env, path::PathBuf}; use cbindgen::{Config, ExportConfig, Language, LineEndingStyle, ParseConfig, Style}; -use tari_common::build::StaticApplicationInfo; fn main() { let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - // generate version info - let gen = StaticApplicationInfo::initialize().unwrap(); - gen.write_consts_to_outdir("consts.rs").unwrap(); - - // let package_name = env::var("CARGO_PKG_NAME").unwrap(); let output_file = PathBuf::from(&crate_dir).join("chat.h").display().to_string(); let config = Config { diff --git a/base_layer/chat_ffi/src/lib.rs b/base_layer/chat_ffi/src/lib.rs index dbea07cb37..eed41679ff 100644 --- a/base_layer/chat_ffi/src/lib.rs +++ b/base_layer/chat_ffi/src/lib.rs @@ -60,11 +60,6 @@ mod tari_address; const LOG_TARGET: &str = "chat_ffi"; -mod consts { - // Import the auto-generated const values from the Manifest and Git - include!(concat!(env!("OUT_DIR"), "/consts.rs")); -} - pub struct ChatClient { client: Client, runtime: Runtime, @@ -118,7 +113,7 @@ pub unsafe extern "C" fn create_chat_client( info!( target: LOG_TARGET, "Starting Tari Chat FFI version: {}", - consts::APP_VERSION + env!("CARGO_PKG_VERSION") ); let mut bad_identity = |e| { @@ -230,7 +225,7 @@ pub unsafe extern "C" fn sideload_chat_client( info!( target: LOG_TARGET, "Sideloading Tari Chat FFI version: {}", - consts::APP_VERSION + env!("CARGO_PKG_VERSION") ); let runtime = match Runtime::new() { diff --git a/base_layer/common_types/Cargo.toml b/base_layer/common_types/Cargo.toml index 0d2d4ddb84..6f07dd69d7 100644 --- a/base_layer/common_types/Cargo.toml +++ b/base_layer/common_types/Cargo.toml @@ -3,13 +3,13 @@ name = "tari_common_types" authors = ["The Tari Development Community"] description = "Tari cryptocurrency common types" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -tari_crypto = { version = "0.20" } -tari_utilities = { version = "0.7" } -tari_common = { path = "../../common", version = "1.0.0-dan.5" } +tari_crypto = { workspace = true } +tari_utilities = { workspace = true } +tari_common = { workspace = true } chacha20poly1305 = "0.10.1" diff --git a/base_layer/contacts/Cargo.toml b/base_layer/contacts/Cargo.toml index de518fbe86..74d866f5e7 100644 --- a/base_layer/contacts/Cargo.toml +++ b/base_layer/contacts/Cargo.toml @@ -3,20 +3,20 @@ name = "tari_contacts" authors = ["The Tari Development Community"] description = "Tari contacts library" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -tari_common = { path = "../../common", version = "1.0.0-dan.5" } -tari_common_sqlite = { path = "../../common_sqlite", version = "1.0.0-dan.5" } -tari_common_types = { path = "../../base_layer/common_types", version = "1.0.0-dan.5" } -tari_comms = { path = "../../comms/core", version = "1.0.0-dan.5" } -tari_comms_dht = { path = "../../comms/dht", version = "1.0.0-dan.5" } -tari_crypto = { version = "0.20" } -tari_p2p = { path = "../p2p", features = ["auto-update"], version = "1.0.0-dan.5" } -tari_service_framework = { path = "../service_framework", version = "1.0.0-dan.5" } -tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-dan.5" } -tari_utilities = { version = "0.7" } +tari_common = { workspace = true } +tari_common_sqlite = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +tari_comms_dht = { workspace = true } +tari_crypto = { workspace = true } +tari_p2p = { workspace = true, features = ["auto-update"] } +tari_service_framework = { workspace = true } +tari_shutdown = { workspace = true } +tari_utilities = { workspace = true } chrono = { version = "0.4.19", default-features = false, features = ["serde"] } diesel = { version = "2.0.3", features = ["sqlite", "serde_json", "chrono", "64-column-tables"] } @@ -35,12 +35,12 @@ tower = "0.4" uuid = { version = "1.3", features = ["v4"] } [dev-dependencies] -tari_comms_dht = { path = "../../comms/dht", features = ["test-mocks"] } -tari_test_utils = { path = "../../infrastructure/test_utils" } +tari_comms_dht = { workspace = true, features = ["test-mocks"] } +tari_test_utils = { workspace = true } tempfile = "3.1.0" [build-dependencies] -tari_common = { path = "../../common", version = "1.0.0-dan.5" } +tari_common = { workspace = true } [package.metadata.cargo-machete] ignored = ["prost"] # this is so we can run cargo machete without getting false positive about macro dependancies diff --git a/base_layer/contacts/src/chat_client/Cargo.toml b/base_layer/contacts/src/chat_client/Cargo.toml index d9fd8bd99e..42e88405d7 100644 --- a/base_layer/contacts/src/chat_client/Cargo.toml +++ b/base_layer/contacts/src/chat_client/Cargo.toml @@ -3,22 +3,22 @@ name = "tari_chat_client" authors = ["The Tari Development Community"] description = "Tari cucumber chat client" license = "BSD-3-Clause" -version = "1.0.0-dan.5" +version.workspace = true -edition = "2018" +edition.workspace = true [dependencies] -minotari_app_utilities = { path = "../../../../applications/minotari_app_utilities" } -tari_common = { path = "../../../../common" } -tari_common_sqlite = { path = "../../../../common_sqlite" } -tari_common_types = { path = "../../../common_types" } -tari_comms = { path = "../../../../comms/core" } -tari_comms_dht = { path = "../../../../comms/dht" } -tari_contacts = { path = "../../../contacts" } -tari_p2p = { path = "../../../p2p" } -tari_service_framework = { path = "../../../service_framework" } -tari_shutdown = { path = "../../../../infrastructure/shutdown" } -tari_storage = { path = "../../../../infrastructure/storage" } +minotari_app_utilities = { workspace = true } +tari_common = { workspace = true } +tari_common_sqlite = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +tari_comms_dht = { workspace = true } +tari_contacts = { workspace = true } +tari_p2p = { workspace = true } +tari_service_framework = { workspace = true } +tari_shutdown = { workspace = true } +tari_storage = { workspace = true } anyhow = "1.0.41" async-trait = "0.1.52" diff --git a/base_layer/contacts/src/chat_client/src/config.rs b/base_layer/contacts/src/chat_client/src/config.rs index 3e0507365c..07363ad8ce 100644 --- a/base_layer/contacts/src/chat_client/src/config.rs +++ b/base_layer/contacts/src/chat_client/src/config.rs @@ -26,7 +26,6 @@ use std::{ }; use config::Config; -use minotari_app_utilities::consts; use serde::{Deserialize, Serialize}; use tari_common::{ configuration::{serializers, CommonConfig, Network, StringList}, @@ -100,7 +99,7 @@ impl Default for ChatClientConfig { fn default() -> Self { let p2p = P2pConfig { datastore_path: PathBuf::from("peer_db/chat_client"), - user_agent: format!("tari/chat_client/{}", consts::APP_VERSION_NUMBER), + user_agent: format!("tari/chat_client/{}", env!("CARGO_PKG_VERSION")), dht: DhtConfig { database_url: DbConnectionUrl::file("data/chat_client/dht.sqlite"), ..Default::default() @@ -163,7 +162,7 @@ impl ChatClientConfig { log_verbosity: Some(5), // Trace p2p: P2pConfig { datastore_path: PathBuf::from("peer_db/chat_client"), - user_agent: format!("tari/chat_client/{}", consts::APP_VERSION_NUMBER), + user_agent: format!("tari/chat_client/{}", env!("CARGO_PKG_VERSION")), dht: DhtConfig { database_url: DbConnectionUrl::file("data/chat_client/dht.sqlite"), network_discovery: NetworkDiscoveryConfig { diff --git a/base_layer/core/Cargo.toml b/base_layer/core/Cargo.toml index 40d1f2a57c..b7d681d821 100644 --- a/base_layer/core/Cargo.toml +++ b/base_layer/core/Cargo.toml @@ -6,8 +6,8 @@ repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [features] default = ["base_node"] @@ -30,26 +30,26 @@ ledger = [ metrics = ["tari_metrics"] [dependencies] -tari_common = { path = "../../common", version = "1.0.0-dan.5" } -tari_common_types = { path = "../../base_layer/common_types", version = "1.0.0-dan.5" } -tari_comms = { path = "../../comms/core", version = "1.0.0-dan.5" } -tari_comms_dht = { path = "../../comms/dht", version = "1.0.0-dan.5" } -tari_comms_rpc_macros = { path = "../../comms/rpc_macros", version = "1.0.0-dan.5" } -tari_crypto = { version = "0.20", features = ["borsh"] } -tari_metrics = { path = "../../infrastructure/metrics", optional = true, version = "1.0.0-dan.5" } -tari_mmr = { path = "../../base_layer/mmr", optional = true, version = "1.0.0-dan.5" } -tari_p2p = { path = "../../base_layer/p2p", version = "1.0.0-dan.5" } -tari_script = { path = "../../infrastructure/tari_script", version = "1.0.0-dan.5" } -tari_service_framework = { path = "../service_framework", version = "1.0.0-dan.5" } -tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-dan.5" } -tari_storage = { path = "../../infrastructure/storage", version = "1.0.0-dan.5" } -tari_test_utils = { path = "../../infrastructure/test_utils", version = "1.0.0-dan.5" } -tari_utilities = { version = "0.7", features = ["borsh"] } -tari_key_manager = { path = "../key_manager", features = [ +tari_common = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +tari_comms_dht = { workspace = true } +tari_comms_rpc_macros = { workspace = true } +tari_crypto = { workspace = true, features = ["borsh"] } +tari_metrics = { workspace = true, optional = true } +tari_mmr = { workspace = true, optional = true } +tari_p2p = { workspace = true } +tari_script = { workspace = true } +tari_service_framework = { workspace = true } +tari_shutdown = { workspace = true } +tari_storage = { workspace = true } +tari_test_utils = { workspace = true } +tari_utilities = { workspace = true, features = ["borsh"] } +tari_key_manager = { workspace = true, features = [ "key_manager_service", -], version = "1.0.0-dan.5" } -tari_common_sqlite = { path = "../../common_sqlite" } -tari_hashing = { path = "../../hashing" } +] } +tari_common_sqlite = { workspace = true } +tari_hashing = { workspace = true } async-trait = { version = "0.1.50" } bincode = "1.1.4" @@ -98,8 +98,8 @@ tiny-keccak = { package = "tari-tiny-keccak", version = "2.0.2", features = [ [dev-dependencies] criterion = { version = "0.4.0" } -tari_p2p = { path = "../../base_layer/p2p", features = ["test-mocks"] } -tari_test_utils = { path = "../../infrastructure/test_utils" } +tari_p2p = { workspace = true, features = ["test-mocks"] } +tari_test_utils = { workspace = true } curve25519-dalek = { package = "tari-curve25519-dalek", version = "4.0.3" } # SQLite required for the integration tests libsqlite3-sys = { version = "0.25.1", features = ["bundled"] } @@ -110,8 +110,8 @@ toml = { version = "0.5" } quickcheck = "1.0" [build-dependencies] -tari_common = { path = "../../common", features = ["build"], version = "1.0.0-dan.5" } -tari_features = { path = "../../common/tari_features", version = "1.0.0-dan.5" } +tari_common = { workspace = true, features = ["build"] } +tari_features = { workspace = true } [[bench]] name = "mempool" diff --git a/base_layer/core/src/blocks/genesis_block.rs b/base_layer/core/src/blocks/genesis_block.rs index 5be573dc12..57a3289d8e 100644 --- a/base_layer/core/src/blocks/genesis_block.rs +++ b/base_layer/core/src/blocks/genesis_block.rs @@ -75,7 +75,6 @@ fn print_mr_values(block: &mut Block, print: bool) { if !print { return; } - use std::convert::TryFrom; use crate::{chain_storage::calculate_validator_node_mr, KernelMmr}; diff --git a/base_layer/core/src/consensus/consensus_manager.rs b/base_layer/core/src/consensus/consensus_manager.rs index 4bb4c0814a..0987ce82f8 100644 --- a/base_layer/core/src/consensus/consensus_manager.rs +++ b/base_layer/core/src/consensus/consensus_manager.rs @@ -118,7 +118,6 @@ impl ConsensusManager { pow_algo: PowAlgorithm, height: u64, ) -> Result { - use std::convert::TryFrom; let constants = self.consensus_constants(height); let block_window = constants.difficulty_block_window(); diff --git a/base_layer/core/src/validation/block_body/test.rs b/base_layer/core/src/validation/block_body/test.rs index a8fa2290e7..dd64bc7b04 100644 --- a/base_layer/core/src/validation/block_body/test.rs +++ b/base_layer/core/src/validation/block_body/test.rs @@ -355,7 +355,10 @@ async fn it_checks_input_maturity() { err, ValidationError::TransactionError(TransactionError::InputMaturity) )); - unpack_enum!(ValidationError::TransactionError(TransactionError::InputMaturity) = err); + assert!(matches!( + err, + ValidationError::TransactionError(TransactionError::InputMaturity) + )); } #[tokio::test] diff --git a/base_layer/core/src/validation/test.rs b/base_layer/core/src/validation/test.rs index b4a1748d3f..5c2c2bd036 100644 --- a/base_layer/core/src/validation/test.rs +++ b/base_layer/core/src/validation/test.rs @@ -26,7 +26,6 @@ use tari_common::configuration::Network; use tari_common_types::types::Commitment; use tari_crypto::commitment::HomomorphicCommitment; use tari_script::TariScript; -use tari_test_utils::unpack_enum; use crate::{ blocks::{BlockHeader, BlockHeaderAccumulatedData, ChainBlock, ChainHeader}, @@ -527,11 +526,9 @@ mod transaction_validator { }; let tip = db.get_chain_metadata().unwrap(); let err = validator.validate_with_current_tip(&tx, tip).unwrap_err(); - unpack_enum!( - ValidationError::OutputTypeNotPermitted { - output_type: OutputType::Coinbase - } = err - ); + assert!(matches!(err, ValidationError::OutputTypeNotPermitted { + output_type: OutputType::Coinbase + })); } #[tokio::test] diff --git a/base_layer/core/tests/tests/node_state_machine.rs b/base_layer/core/tests/tests/node_state_machine.rs index 8c673b02f4..72757744b8 100644 --- a/base_layer/core/tests/tests/node_state_machine.rs +++ b/base_layer/core/tests/tests/node_state_machine.rs @@ -46,7 +46,6 @@ use tari_core::{ }; use tari_p2p::{services::liveness::config::LivenessConfig, P2pConfig}; use tari_shutdown::Shutdown; -use tari_test_utils::unpack_enum; use tari_utilities::ByteArray; use tempfile::tempdir; use tokio::{ @@ -321,5 +320,5 @@ async fn test_event_channel() { assert_eq!(*event.unwrap(), StateEvent::Initialized); let event = state_change_event_subscriber.recv().await; let event = event.unwrap(); - unpack_enum!(StateEvent::FallenBehind(_) = &*event); + assert!(matches!(&*event, StateEvent::FallenBehind(_))); } diff --git a/base_layer/key_manager/Cargo.toml b/base_layer/key_manager/Cargo.toml index 0ed4104749..8bba88dcb5 100644 --- a/base_layer/key_manager/Cargo.toml +++ b/base_layer/key_manager/Cargo.toml @@ -4,18 +4,18 @@ authors = ["The Tari Development Community"] description = "Tari cryptocurrency wallet key management" repository = "https://github.com/tari-project/tari" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2021" +version.workspace = true +edition.workspace = true [lib] crate-type = ["lib", "cdylib"] [dependencies] -tari_crypto = { version = "0.20" } -tari_utilities = { version = "0.7" } -tari_common_sqlite = { path = "../../common_sqlite", version = "1.0.0-dan.5" } -tari_common_types = { path = "../../base_layer/common_types", version = "1.0.0-dan.5" } -tari_service_framework = { path = "../service_framework", version = "1.0.0-dan.5" } +tari_crypto = { workspace = true } +tari_utilities = { workspace = true } +tari_common_sqlite = { workspace = true } +tari_common_types = { workspace = true } +tari_service_framework = { workspace = true } async-trait = { version = "0.1.50" } chrono = { version = "0.4.19", default-features = false, features = ["serde"] } diff --git a/base_layer/mmr/Cargo.toml b/base_layer/mmr/Cargo.toml index b305ff1e4c..3ecbcc496b 100644 --- a/base_layer/mmr/Cargo.toml +++ b/base_layer/mmr/Cargo.toml @@ -4,16 +4,16 @@ authors = ["The Tari Development Community"] description = "A Merkle Mountain Range implementation" repository = "https://github.com/tari-project/tari" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [features] default = [] [dependencies] -tari_utilities = { version = "0.7" } -tari_crypto = { version = "0.20" } -tari_common = { path = "../../common", version = "1.0.0-dan.5" } +tari_utilities = { workspace = true } +tari_crypto = { workspace = true } +tari_common = { workspace = true } thiserror = "1.0" borsh = "1.2" digest = "0.10" diff --git a/base_layer/p2p/Cargo.toml b/base_layer/p2p/Cargo.toml index e04c1269f8..c623852b09 100644 --- a/base_layer/p2p/Cargo.toml +++ b/base_layer/p2p/Cargo.toml @@ -1,23 +1,23 @@ [package] name = "tari_p2p" -version = "1.0.0-dan.5" +version.workspace = true authors = ["The Tari Development community"] description = "Tari base layer-specific peer-to-peer communication features" repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -edition = "2018" +edition.workspace = true [dependencies] -tari_comms = { path = "../../comms/core", version = "1.0.0-dan.5" } -tari_comms_dht = { path = "../../comms/dht", version = "1.0.0-dan.5" } -tari_common = { path = "../../common", version = "1.0.0-dan.5" } -tari_crypto = { version = "0.20" } -tari_service_framework = { path = "../service_framework", version = "1.0.0-dan.5" } -tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-dan.5" } -tari_storage = { path = "../../infrastructure/storage", version = "1.0.0-dan.5" } -tari_utilities = { version = "0.7" } +tari_comms = { workspace = true } +tari_comms_dht = { workspace = true } +tari_common = { workspace = true } +tari_crypto = { workspace = true } +tari_service_framework = { workspace = true } +tari_shutdown = { workspace = true } +tari_storage = { workspace = true } +tari_utilities = { workspace = true } anyhow = "1.0.53" fs2 = "0.4.0" @@ -39,14 +39,14 @@ trust-dns-client = { version = "=0.21.0-alpha.5", features = ["dns-over-rustls"] webpki = "0.22" [dev-dependencies] -tari_test_utils = { path = "../../infrastructure/test_utils" } +tari_test_utils = { workspace = true } config = "0.14.0" clap = "3.2" tempfile = "3.1.0" [build-dependencies] -tari_common = { path = "../../common", features = ["build"], version = "1.0.0-dan.5" } +tari_common = { workspace = true, features = ["build"] } [features] test-mocks = [] diff --git a/base_layer/service_framework/Cargo.toml b/base_layer/service_framework/Cargo.toml index 1878a62202..75b9dbea58 100644 --- a/base_layer/service_framework/Cargo.toml +++ b/base_layer/service_framework/Cargo.toml @@ -1,16 +1,16 @@ [package] name = "tari_service_framework" -version = "1.0.0-dan.5" +version.workspace = true authors = ["The Tari Development Community"] description = "The Tari communication stack service framework" repository = "https://github.com/tari-project/tari" -edition = "2018" +edition.workspace = true license = "BSD-3-Clause" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-dan.5" } +tari_shutdown = { workspace = true } anyhow = "1.0.53" async-trait = "0.1.50" @@ -21,7 +21,7 @@ tokio = { version = "1.36", features = ["rt", "sync"] } tower-service = { version = "0.3" } [dev-dependencies] -tari_test_utils = { path = "../../infrastructure/test_utils" } +tari_test_utils = { workspace = true } tokio = { version = "1.36", features = ["rt-multi-thread", "macros", "time"] } futures-test = { version = "0.3.3" } diff --git a/base_layer/tari_mining_helper_ffi/Cargo.toml b/base_layer/tari_mining_helper_ffi/Cargo.toml index 103c634da5..3b6a72401f 100644 --- a/base_layer/tari_mining_helper_ffi/Cargo.toml +++ b/base_layer/tari_mining_helper_ffi/Cargo.toml @@ -3,16 +3,16 @@ name = "minotari_mining_helper_ffi" authors = ["The Tari Development Community"] description = "Tari cryptocurrency miningcore C FFI bindings" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -tari_comms = { path = "../../comms/core" } -tari_crypto = { version = "0.20" } -tari_common = { path = "../../common" } -tari_core = { path = "../core", default-features = false, features = ["transactions", "base_node_proto", "base_node"] } -tari_common_types = { path = "../../base_layer/common_types", version = "1.0.0-dan.5" } -tari_utilities = { version = "0.7" } +tari_comms = { workspace = true } +tari_crypto = { workspace = true } +tari_common = { workspace = true } +tari_core = { workspace = true, default-features = false, features = ["transactions", "base_node_proto", "base_node"] } +tari_common_types = { workspace = true } +tari_utilities = { workspace = true } libc = "0.2.65" thiserror = "1.0.26" borsh = "1.2" @@ -20,13 +20,13 @@ hex = "0.4.2" tokio = { version = "1.36", features = ["rt"] } [dev-dependencies] -tari_core = { path = "../core", features = ["transactions", "base_node"] } +tari_core = { workspace = true, features = ["transactions", "base_node"] } rand = "0.8" [build-dependencies] -tari_features = { path = "../../common/tari_features", version = "1.0.0-dan.5" } +tari_features = { workspace = true } cbindgen = "0.24.3" -tari_common = { path = "../../common", features = ["build", "static-application-info"] } +tari_common = { workspace = true, features = ["build"] } [lib] crate-type = ["cdylib"] diff --git a/base_layer/tari_mining_helper_ffi/build.rs b/base_layer/tari_mining_helper_ffi/build.rs index a8967a500a..842de9e799 100644 --- a/base_layer/tari_mining_helper_ffi/build.rs +++ b/base_layer/tari_mining_helper_ffi/build.rs @@ -23,17 +23,12 @@ use std::{env, path::PathBuf}; use cbindgen::{Config, Language, LineEndingStyle, ParseConfig, Style}; -use tari_common::build::StaticApplicationInfo; use tari_features::resolver::build_features; fn main() { build_features(); let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - // generate version info - let gen = StaticApplicationInfo::initialize().unwrap(); - gen.write_consts_to_outdir("consts.rs").unwrap(); - let output_file = PathBuf::from(&crate_dir) .join("tari_mining_helper.h") .display() diff --git a/base_layer/tari_mining_helper_ffi/src/lib.rs b/base_layer/tari_mining_helper_ffi/src/lib.rs index de41b21a1a..a3f6c2cc2e 100644 --- a/base_layer/tari_mining_helper_ffi/src/lib.rs +++ b/base_layer/tari_mining_helper_ffi/src/lib.rs @@ -50,10 +50,6 @@ use tari_crypto::tari_utilities::hex::Hex; use tokio::runtime::Runtime; use crate::error::{InterfaceError, MiningHelperError}; -mod consts { - // Import the auto-generated const values from the Manifest and Git - include!(concat!(env!("OUT_DIR"), "/consts.rs")); -} pub type TariPublicKey = tari_comms::types::CommsPublicKey; #[derive(Debug, PartialEq, Clone)] diff --git a/base_layer/wallet/Cargo.toml b/base_layer/wallet/Cargo.toml index f95bb03f90..2e700812ab 100644 --- a/base_layer/wallet/Cargo.toml +++ b/base_layer/wallet/Cargo.toml @@ -3,24 +3,24 @@ name = "minotari_wallet" authors = ["The Tari Development Community"] description = "Tari cryptocurrency wallet library" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions", "mempool_proto", "base_node_proto"], version = "1.0.0-dan.5" } -tari_common = { path = "../../common", version = "1.0.0-dan.5" } -tari_common_types = { path = "../../base_layer/common_types", version = "1.0.0-dan.5" } -tari_comms = { path = "../../comms/core", version = "1.0.0-dan.5" } -tari_comms_dht = { path = "../../comms/dht", version = "1.0.0-dan.5" } -tari_crypto = { version = "0.20" } -tari_key_manager = { path = "../key_manager", features = ["key_manager_service"], version = "1.0.0-dan.5" } -tari_p2p = { path = "../p2p", features = ["auto-update"], version = "1.0.0-dan.5" } -tari_script = { path = "../../infrastructure/tari_script", version = "1.0.0-dan.5" } -tari_service_framework = { path = "../service_framework", version = "1.0.0-dan.5" } -tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-dan.5" } -tari_common_sqlite = { path = "../../common_sqlite", version = "1.0.0-dan.5" } -tari_utilities = { version = "0.7" } -tari_contacts = { path = "../../base_layer/contacts", version = "1.0.0-dan.5" } +tari_core = { workspace = true, default-features = false, features = ["transactions", "mempool_proto", "base_node_proto"] } +tari_common = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +tari_comms_dht = { workspace = true } +tari_crypto = { workspace = true } +tari_key_manager = { workspace = true, features = ["key_manager_service"] } +tari_p2p = { workspace = true } +tari_script = { workspace = true } +tari_service_framework = { workspace = true } +tari_shutdown = { workspace = true } +tari_common_sqlite = { workspace = true } +tari_utilities = { workspace = true } +tari_contacts = { workspace = true } # Uncomment for tokio tracing via tokio-console (needs "tracing" features) #console-subscriber = "0.1.3" @@ -57,13 +57,13 @@ chacha20poly1305 = "0.10.1" zeroize = "1" [build-dependencies] -tari_common = { path = "../../common", features = ["build", "static-application-info"], version = "1.0.0-dan.5" } +tari_common = { workspace = true, features = ["build"] } [dev-dependencies] -tari_p2p = { path = "../p2p", features = ["test-mocks"] } -tari_comms_dht = { path = "../../comms/dht", features = ["test-mocks"] } -tari_test_utils = { path = "../../infrastructure/test_utils" } -tari_core = { path = "../../base_layer/core", default-features = false, features = ["transactions", "mempool_proto", "base_node_proto", "base_node"] } +tari_p2p = { workspace = true, features = ["test-mocks"] } +tari_comms_dht = { workspace = true, features = ["test-mocks"] } +tari_test_utils = { workspace = true } +tari_core = { workspace = true, default-features = false, features = ["transactions", "mempool_proto", "base_node_proto", "base_node"] } env_logger = "0.7.1" prost = "0.11.9" diff --git a/base_layer/wallet/build.rs b/base_layer/wallet/build.rs deleted file mode 100644 index 399221badd..0000000000 --- a/base_layer/wallet/build.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2022. The Tari Project -// SPDX-License-Identifier: BSD-3-Clause - -use tari_common::build::StaticApplicationInfo; - -fn main() { - // generate version info - let gen = StaticApplicationInfo::initialize().unwrap(); - gen.write_consts_to_outdir("consts.rs").unwrap(); -} diff --git a/base_layer/wallet/src/lib.rs b/base_layer/wallet/src/lib.rs index 5550b7e529..c29e951158 100644 --- a/base_layer/wallet/src/lib.rs +++ b/base_layer/wallet/src/lib.rs @@ -45,11 +45,6 @@ use crate::{ transaction_service::storage::sqlite_db::TransactionServiceSqliteDatabase, }; -mod consts { - // Import the auto-generated const values from the Manifest and Git - include!(concat!(env!("OUT_DIR"), "/consts.rs")); -} - pub type WalletSqlite = Wallet< WalletSqliteDatabase, TransactionServiceSqliteDatabase, diff --git a/base_layer/wallet/src/wallet.rs b/base_layer/wallet/src/wallet.rs index 33accdfb68..0c4452fd4e 100644 --- a/base_layer/wallet/src/wallet.rs +++ b/base_layer/wallet/src/wallet.rs @@ -86,7 +86,6 @@ use crate::{ base_node_service::{handle::BaseNodeServiceHandle, BaseNodeServiceInitializer}, config::{WalletConfig, KEY_MANAGER_COMMS_SECRET_KEY_BRANCH_KEY}, connectivity_service::{WalletConnectivityHandle, WalletConnectivityInitializer, WalletConnectivityInterface}, - consts, error::{WalletError, WalletStorageError}, output_manager_service::{ error::OutputManagerError, @@ -332,7 +331,7 @@ where // storing current network and version if let Err(e) = wallet_database - .set_last_network_and_version(config.network.to_string(), consts::APP_VERSION_NUMBER.to_string()) + .set_last_network_and_version(config.network.to_string(), env!("CARGO_PKG_VERSION").to_string()) { warn!("failed to store network and version: {:#?}", e); } diff --git a/base_layer/wallet_ffi/Cargo.toml b/base_layer/wallet_ffi/Cargo.toml index f797807ed8..74cfb6c2d6 100644 --- a/base_layer/wallet_ffi/Cargo.toml +++ b/base_layer/wallet_ffi/Cargo.toml @@ -3,23 +3,23 @@ name = "minotari_wallet_ffi" authors = ["The Tari Development Community"] description = "Tari cryptocurrency wallet C FFI bindings" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -tari_core = { path = "../../base_layer/core", default-features = false, features = ["tari_mmr", "transactions"] } -tari_common = { path = "../../common" } -tari_common_types = { path = "../common_types" } -tari_comms = { path = "../../comms/core", features = ["c_integration"] } -tari_comms_dht = { path = "../../comms/dht", default-features = false } -tari_crypto = { version = "0.20" } -tari_key_manager = { path = "../key_manager" } -tari_p2p = { path = "../p2p" } -tari_script = { path = "../../infrastructure/tari_script" } -tari_shutdown = { path = "../../infrastructure/shutdown" } -tari_utilities = { version = "0.7" } -minotari_wallet = { path = "../wallet", features = ["c_integration"] } -tari_contacts = { path = "../../base_layer/contacts" } +tari_core = { workspace = true, default-features = false, features = ["tari_mmr", "transactions"] } +tari_common = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true, features = ["c_integration"] } +tari_comms_dht = { workspace = true, default-features = false } +tari_crypto = { workspace = true } +tari_key_manager = { workspace = true } +tari_p2p = { workspace = true } +tari_script = { workspace = true } +tari_shutdown = { workspace = true } +tari_utilities = { workspace = true } +minotari_wallet = { workspace = true, features = ["c_integration"] } +tari_contacts = { workspace = true } chacha20poly1305 = "0.10.1" chrono = { version = "0.4.19", default-features = false, features = ["serde"] } @@ -44,14 +44,14 @@ crate-type = ["staticlib", "cdylib"] [dev-dependencies] once_cell = "1.8.0" tempfile = "3.1.0" -tari_key_manager = { path = "../key_manager" } -tari_common_types = { path = "../../base_layer/common_types" } -tari_test_utils = { path = "../../infrastructure/test_utils" } -tari_service_framework = { path = "../../base_layer/service_framework" } -tari_core = { path = "../../base_layer/core", default-features = false, features = ["base_node"] } +tari_key_manager = { workspace = true } +tari_common_types = { workspace = true } +tari_test_utils = { workspace = true } +tari_service_framework = { workspace = true } +tari_core = { workspace = true, default-features = false, features = ["base_node"] } borsh = "1.2" [build-dependencies] cbindgen = "0.24.3" -tari_common = { path = "../../common", features = ["build", "static-application-info"] } -tari_features = { path = "../../common/tari_features", version = "1.0.0-dan.5" } +tari_common = { workspace = true, features = ["build"] } +tari_features = { workspace = true } diff --git a/base_layer/wallet_ffi/build.rs b/base_layer/wallet_ffi/build.rs index 52774bb276..cb93d17155 100644 --- a/base_layer/wallet_ffi/build.rs +++ b/base_layer/wallet_ffi/build.rs @@ -4,17 +4,12 @@ use std::{env, path::PathBuf}; use cbindgen::{Config, ExportConfig, Language, LineEndingStyle, ParseConfig, Style}; -use tari_common::build::StaticApplicationInfo; use tari_features::resolver::build_features; fn main() { build_features(); let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - // generate version info - let gen = StaticApplicationInfo::initialize().unwrap(); - gen.write_consts_to_outdir("consts.rs").unwrap(); - let output_file = PathBuf::from(&crate_dir).join("wallet.h").display().to_string(); let config = Config { diff --git a/base_layer/wallet_ffi/src/lib.rs b/base_layer/wallet_ffi/src/lib.rs index ef7cdff9de..80e25a8ac8 100644 --- a/base_layer/wallet_ffi/src/lib.rs +++ b/base_layer/wallet_ffi/src/lib.rs @@ -187,11 +187,6 @@ mod ffi_basenode_state; mod output_manager_service_mock; mod tasks; -mod consts { - // Import the auto-generated const values from the Manifest and Git - include!(concat!(env!("OUT_DIR"), "/consts.rs")); -} - const LOG_TARGET: &str = "wallet_ffi"; pub type TariTransportConfig = tari_p2p::TransportConfig; @@ -5315,7 +5310,7 @@ pub unsafe extern "C" fn wallet_create( info!( target: LOG_TARGET, "Starting Tari Wallet FFI version: {}", - consts::APP_VERSION + env!("CARGO_PKG_VERSION") ); let passphrase = if passphrase.is_null() { diff --git a/ci_all.bat b/ci_all.bat index 777c6070e0..ed869db8c0 100644 --- a/ci_all.bat +++ b/ci_all.bat @@ -1,5 +1 @@ -cargo +nightly ci-fmt -cargo machete -cargo ci-check -cargo ci-test -cargo ci-cucumber \ No newline at end of file +cargo +nightly ci-fmt && cargo machete && cargo ci-test && cargo ci-cucumber \ No newline at end of file diff --git a/clients/rust/base_node_grpc_client/Cargo.toml b/clients/rust/base_node_grpc_client/Cargo.toml index b91f122804..7d9d2875cc 100644 --- a/clients/rust/base_node_grpc_client/Cargo.toml +++ b/clients/rust/base_node_grpc_client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "minotari_node_grpc_client" -version = "0.1.0" -edition = "2021" +version.workspace = true +edition.workspace = true description = "Base node GRPC client" authors = ["The Tari Development Community"] repository = "https://github.com/tari-project/tari" @@ -10,7 +10,7 @@ readme = "README.md" license = "BSD-3-Clause" [dependencies] -minotari_app_grpc = { path = "../../../applications/minotari_app_grpc" } +minotari_app_grpc = { workspace = true } #tonic = { version = "0.8", default-features = false, features = ["codegen", "transport", "prost"] } #prost = "0.11.0" diff --git a/clients/rust/wallet_grpc_client/Cargo.toml b/clients/rust/wallet_grpc_client/Cargo.toml index 0a17c9a9fc..562f880122 100644 --- a/clients/rust/wallet_grpc_client/Cargo.toml +++ b/clients/rust/wallet_grpc_client/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "minotari_wallet_grpc_client" -version = "0.1.0" -edition = "2021" +version.workspace = true +edition.workspace = true description = "Base node GRPC client" authors = ["The Tari Development Community"] repository = "https://github.com/tari-project/tari" @@ -10,8 +10,8 @@ readme = "README.md" license = "BSD-3-Clause" [dependencies] -minotari_app_grpc = { path = "../../../applications/minotari_app_grpc" } -tari_common_types = { path = "../../../base_layer/common_types" } +minotari_app_grpc = { workspace = true } +tari_common_types = { workspace = true } thiserror = "1.0.35" tonic = { version = "0.8.3", default-features = false, features = ["codegen", "transport", "tls"] } diff --git a/common/Cargo.toml b/common/Cargo.toml index 20ddb72700..5a600f4b90 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -6,22 +6,20 @@ repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [features] build = ["toml", "prost-build"] -static-application-info = ["git2"] [dependencies] -tari_crypto = { version = "0.20" } -tari_features = { path = "./tari_features", version = "1.0.0-dan.5" } +tari_crypto = { workspace = true } +tari_features = { workspace = true } anyhow = "1.0.53" blake2 = "0.10" config = { version = "0.14.0", default_features = false, features = ["toml"] } dirs-next = "1.0.2" -git2 = { version = "0.18", default_features = false, optional = true } log = "0.4.8" log4rs = { version = "1.3.0", default_features = false, features = ["config_parsing", "threshold_filter", "yaml_format"] } multiaddr = { version = "0.14.0" } @@ -37,8 +35,8 @@ thiserror = "1.0.29" toml = { version = "0.5", optional = true } [dev-dependencies] -tari_test_utils = { path = "../infrastructure/test_utils" } +tari_test_utils = { workspace = true } toml = "0.5.8" [build-dependencies] -tari_features = { path = "./tari_features", version = "1.0.0-dan.5" } +tari_features = { workspace = true } diff --git a/common/src/build/application.rs b/common/src/build/application.rs deleted file mode 100644 index 39bddc484e..0000000000 --- a/common/src/build/application.rs +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright 2021, The Tari Project -// -// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the -// following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following -// disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the -// following disclaimer in the documentation and/or other materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote -// products derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE -// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -use std::{ - env, - fmt, - fs, - io::Write, - path::{Path, PathBuf}, -}; - -use serde::Deserialize; - -pub struct StaticApplicationInfo { - manifest: Manifest, - commit: String, -} - -impl StaticApplicationInfo { - pub fn initialize() -> Result { - let manifest = extract_manifest()?; - let commit = get_commit().unwrap_or_else(|e| { - emit_cargo_warn(e); - "NoGitRepository".to_string() - }); - Ok(Self { manifest, commit }) - } - - /// Writes the consts file to the given file in the OUT_DIR. Returns the written file path. - /// This will overwrite existing files - pub fn write_consts_to_outdir>(&self, filename: P) -> Result { - let out_dir = env::var_os("OUT_DIR").unwrap(); - let out_path = Path::new(&out_dir).join(filename); - let mut file = fs::File::create(&out_path)?; - writeln!( - file, - r#"#[allow(dead_code)] pub const APP_VERSION: &str = "{}";"#, - self.get_full_version() - )?; - writeln!( - file, - r#"#[allow(dead_code)] pub const APP_VERSION_NUMBER: &str = "{}";"#, - self.get_version_number() - )?; - writeln!( - file, - r#"#[allow(dead_code)] pub const APP_AUTHOR: &str = "{}";"#, - self.manifest.package.authors.join(","), - )?; - Ok(out_path) - } - - /// Add the git version commit and built type to the version number - /// The final output looks like 0.1.2-fc435c-release - fn get_full_version(&self) -> String { - let build = env::var("PROFILE").unwrap_or_else(|e| { - emit_cargo_warn(e); - "Unknown".to_string() - }); - format!("{}-{}-{}", self.manifest.package.version, self.commit, build) - } - - /// Get the version number only - /// The final output looks like 0.1.2 - fn get_version_number(&self) -> String { - self.manifest.package.version.clone() - } -} - -#[derive(Deserialize)] -struct Package { - authors: Vec, - version: String, -} - -#[derive(Deserialize)] -struct Manifest { - package: Package, -} - -fn extract_manifest() -> Result { - let cargo_path = Path::new(&env::var("CARGO_MANIFEST_DIR").unwrap()).join("Cargo.toml"); - let cargo = fs::read(cargo_path)?; - let cargo = std::str::from_utf8(&cargo)?; - let manifest = toml::from_str(cargo)?; - Ok(manifest) -} - -fn find_git_root() -> Result { - let manifest = env::var("CARGO_MANIFEST_DIR")?; - let mut path = PathBuf::from(manifest); - - let mut loop_count = 0; - while !path.join(".git").exists() { - path = path.join(".."); - if loop_count == 10 { - return Err(anyhow::anyhow!( - "Not a git repository or CARGO_MANIFEST_DIR nested deeper than 10 from the root" - )); - } - loop_count += 1; - } - - Ok(path) -} - -fn get_commit() -> Result { - let git_root = find_git_root()?; - let repo = git2::Repository::open(git_root)?; - let head = repo.revparse_single("HEAD")?; - let id = format!("{:?}", head.id()); - id.split_at(7).0.to_string(); - Ok(id) -} - -fn emit_cargo_warn(e: T) { - println!("cargo:warning=Could not open repo: {}", e); -} diff --git a/common/src/build/mod.rs b/common/src/build/mod.rs index b685a67030..7d2588703c 100644 --- a/common/src/build/mod.rs +++ b/common/src/build/mod.rs @@ -20,11 +20,6 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#[cfg(feature = "static-application-info")] -mod application; -#[cfg(feature = "static-application-info")] -pub use application::StaticApplicationInfo; - #[cfg(feature = "build")] mod protobuf; #[cfg(feature = "build")] diff --git a/common/tari_features/Cargo.toml b/common/tari_features/Cargo.toml index 9cdb9732dc..048a050146 100644 --- a/common/tari_features/Cargo.toml +++ b/common/tari_features/Cargo.toml @@ -6,8 +6,8 @@ repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common_sqlite/Cargo.toml b/common_sqlite/Cargo.toml index ffc3108a8e..3d17dbfd01 100644 --- a/common_sqlite/Cargo.toml +++ b/common_sqlite/Cargo.toml @@ -3,13 +3,13 @@ name = "tari_common_sqlite" authors = ["The Tari Development Community"] description = "Tari cryptocurrency wallet library" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tari_utilities = { version = "0.7" } +tari_utilities = { workspace = true } diesel = { version = "2.0.3", features = ["sqlite", "r2d2", "serde_json", "chrono", "64-column-tables"] } diesel_migrations = "2.0.0" @@ -19,4 +19,4 @@ thiserror = "1.0.26" tokio = { version = "1.36", features = ["sync", "macros", "rt"] } [dev-dependencies] -tari_test_utils = { path = "../infrastructure/test_utils" } +tari_test_utils = { workspace = true } diff --git a/comms/core/Cargo.toml b/comms/core/Cargo.toml index 4339c0efc7..fb958ea7cd 100644 --- a/comms/core/Cargo.toml +++ b/comms/core/Cargo.toml @@ -6,15 +6,15 @@ repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -tari_crypto = { version = "0.20" } -tari_metrics = { path = "../../infrastructure/metrics", optional = true, version = "1.0.0-dan.5" } -tari_storage = { path = "../../infrastructure/storage", version = "1.0.0-dan.5" } -tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-dan.5" } -tari_utilities = { version = "0.7" } +tari_crypto = { workspace = true } +tari_metrics = { workspace = true, optional = true } +tari_storage = { workspace = true } +tari_shutdown = { workspace = true } +tari_utilities = { workspace = true } anyhow = "1.0.53" async-trait = "0.1.36" @@ -50,15 +50,15 @@ yamux = "=0.10.2" zeroize = "1" [dev-dependencies] -tari_test_utils = { path = "../../infrastructure/test_utils" } -tari_comms_rpc_macros = { path = "../rpc_macros" } +tari_test_utils = { workspace = true } +tari_comms_rpc_macros = { workspace = true } env_logger = "0.7.0" serde_json = "1.0.39" tempfile = "3.1.0" [build-dependencies] -tari_common = { path = "../../common", features = ["build"], version = "1.0.0-dan.5" } +tari_common = { workspace = true, features = ["build"] } [features] c_integration = [] diff --git a/comms/core/src/connection_manager/tests/listener_dialer.rs b/comms/core/src/connection_manager/tests/listener_dialer.rs index a9ff5d4b12..fa632a6fad 100644 --- a/comms/core/src/connection_manager/tests/listener_dialer.rs +++ b/comms/core/src/connection_manager/tests/listener_dialer.rs @@ -244,12 +244,12 @@ async fn banned() { // Check that the dial failed. We're checking that the listener unexpectedly // closes the connection before the identity protocol has completed. let err = reply_rx.await.unwrap().unwrap_err(); - unpack_enum!(ConnectionManagerError::IdentityProtocolError(_err) = err); + assert!(matches!(err, ConnectionManagerError::IdentityProtocolError(_ery))); - unpack_enum!( - ConnectionManagerEvent::PeerInboundConnectFailed(ConnectionManagerError::PeerBanned) = - event_rx.recv().await.unwrap() - ); + assert!(matches!( + event_rx.recv().await.unwrap(), + ConnectionManagerEvent::PeerInboundConnectFailed(ConnectionManagerError::PeerBanned), + )); shutdown.trigger(); diff --git a/comms/core/src/connection_manager/tests/manager.rs b/comms/core/src/connection_manager/tests/manager.rs index 1abde14e21..b1879a3cd1 100644 --- a/comms/core/src/connection_manager/tests/manager.rs +++ b/comms/core/src/connection_manager/tests/manager.rs @@ -77,7 +77,10 @@ async fn connect_to_nonexistent_peer() { rt_handle.spawn(connection_manager.run()); let err = requester.dial_peer(NodeId::default()).await.unwrap_err(); - unpack_enum!(ConnectionManagerError::PeerManagerError(PeerManagerError::PeerNotFoundError) = err); + assert!(matches!( + err, + ConnectionManagerError::PeerManagerError(PeerManagerError::PeerNotFoundError) + )); shutdown.trigger(); } diff --git a/comms/core/src/connectivity/manager.rs b/comms/core/src/connectivity/manager.rs index 1e9b7d18e3..e55e557b6d 100644 --- a/comms/core/src/connectivity/manager.rs +++ b/comms/core/src/connectivity/manager.rs @@ -784,8 +784,6 @@ impl ConnectivityManagerActor { #[allow(clippy::cast_possible_wrap)] #[cfg(feature = "metrics")] fn update_connectivity_metrics(&mut self) { - use std::convert::TryFrom; - use super::metrics; let total = self.pool.count_connected() as i64; diff --git a/comms/core/src/connectivity/test.rs b/comms/core/src/connectivity/test.rs index ef5dd65d9f..ea984804f7 100644 --- a/comms/core/src/connectivity/test.rs +++ b/comms/core/src/connectivity/test.rs @@ -432,7 +432,7 @@ async fn pool_management() { let events = collect_try_recv!(event_stream, take = 9, timeout = Duration::from_secs(10)); for event in events { - unpack_enum!(ConnectivityEvent::PeerDisconnected(_) = event); + assert!(matches!(event, ConnectivityEvent::PeerDisconnected(_))); } assert_eq!(important_connection.handle_count(), 2); @@ -448,7 +448,7 @@ async fn pool_management() { drop(important_connection); let mut events = collect_try_recv!(event_stream, take = 1, timeout = Duration::from_secs(10)); - unpack_enum!(ConnectivityEvent::PeerDisconnected(_) = events.remove(0)); + assert!(matches!(events.remove(0), ConnectivityEvent::PeerDisconnected(_node))); let conns = connectivity.get_active_connections().await.unwrap(); assert!(conns.is_empty()); } diff --git a/comms/core/src/protocol/rpc/test/smoke.rs b/comms/core/src/protocol/rpc/test/smoke.rs index f2c17e1e59..d486cfff6f 100644 --- a/comms/core/src/protocol/rpc/test/smoke.rs +++ b/comms/core/src/protocol/rpc/test/smoke.rs @@ -504,8 +504,14 @@ async fn max_global_sessions() { .await .unwrap_err(); - unpack_enum!(RpcError::HandshakeError(err) = err); - unpack_enum!(RpcHandshakeError::Rejected(HandshakeRejectReason::NoSessionsAvailable) = err); + if let RpcError::HandshakeError(new_err) = err { + assert!(matches!( + new_err, + RpcHandshakeError::Rejected(HandshakeRejectReason::NoSessionsAvailable) + )); + } else { + panic!("Wrong error type") + } client.close().await; let substream = outbound.get_yamux_control().open_stream().await.unwrap(); @@ -563,8 +569,14 @@ async fn max_per_client_sessions() { .await .unwrap_err(); - unpack_enum!(RpcError::HandshakeError(err) = err); - unpack_enum!(RpcHandshakeError::Rejected(HandshakeRejectReason::NoSessionsAvailable) = err); + if let RpcError::HandshakeError(ref new_err) = err { + assert!(matches!( + new_err, + RpcHandshakeError::Rejected(HandshakeRejectReason::NoSessionsAvailable) + )); + } else { + panic!("wrong error type"); + } drop(client); let substream = outbound.get_yamux_control().open_stream().await.unwrap(); diff --git a/comms/dht/Cargo.toml b/comms/dht/Cargo.toml index 9f1bf29058..db69a1d15e 100644 --- a/comms/dht/Cargo.toml +++ b/comms/dht/Cargo.toml @@ -1,23 +1,23 @@ [package] name = "tari_comms_dht" -version = "1.0.0-dan.5" +version.workspace = true authors = ["The Tari Development Community"] description = "Tari comms DHT module" repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -edition = "2018" +edition.workspace = true [dependencies] -tari_comms = { path = "../core", features = ["rpc"], version = "1.0.0-dan.5" } -tari_common = { path = "../../common", version = "1.0.0-dan.5" } -tari_comms_rpc_macros = { path = "../rpc_macros", version = "1.0.0-dan.5" } -tari_crypto = { version = "0.20" } -tari_utilities = { version = "0.7" } -tari_shutdown = { path = "../../infrastructure/shutdown", version = "1.0.0-dan.5" } -tari_storage = { path = "../../infrastructure/storage", version = "1.0.0-dan.5" } -tari_common_sqlite = { path = "../../common_sqlite", version = "1.0.0-dan.5" } +tari_comms = { workspace = true, features = ["rpc"] } +tari_common = { workspace = true } +tari_comms_rpc_macros = { workspace = true } +tari_crypto = { workspace = true } +tari_utilities = { workspace = true } +tari_shutdown = { workspace = true } +tari_storage = { workspace = true } +tari_common_sqlite = { workspace = true } anyhow = "1.0.53" bitflags = { version = "2.4", features = ["serde"] } @@ -48,7 +48,7 @@ tokio = { version = "1.36", features = ["rt", "macros"] } pin-project = "0.4" [dev-dependencies] -tari_test_utils = { path = "../../infrastructure/test_utils" } +tari_test_utils = { workspace = true } env_logger = "0.10" futures-test = { version = "0.3.5" } @@ -62,7 +62,7 @@ clap = "3.2" [build-dependencies] -tari_common = { path = "../../common", version = "1.0.0-dan.5" } +tari_common = { workspace = true } [features] test-mocks = [] diff --git a/comms/dht/src/peer_validator.rs b/comms/dht/src/peer_validator.rs index a3d65bc0a5..1ee542485b 100644 --- a/comms/dht/src/peer_validator.rs +++ b/comms/dht/src/peer_validator.rs @@ -116,7 +116,6 @@ mod tests { types::Signature, }; use tari_crypto::ristretto::{RistrettoPublicKey, RistrettoSecretKey}; - use tari_test_utils::unpack_enum; use tari_utilities::ByteArray; use super::*; @@ -147,7 +146,10 @@ mod tests { let err = validator .validate_peer(UnvalidatedPeerInfo::from_peer_limited_claims(peer.clone(), 5, 5), None) .unwrap_err(); - unpack_enum!(DhtPeerValidatorError::ValidatorError(PeerValidatorError::InvalidPeerSignature { .. }) = err); + assert!(matches!( + err, + DhtPeerValidatorError::ValidatorError(PeerValidatorError::InvalidPeerSignature { .. }) + )); } #[tokio::test] @@ -161,6 +163,9 @@ mod tests { let err = validator .validate_peer(UnvalidatedPeerInfo::from_peer_limited_claims(peer, 5, 5), None) .unwrap_err(); - unpack_enum!(DhtPeerValidatorError::ValidatorError(PeerValidatorError::PeerHasNoAddresses { .. }) = err); + assert!(matches!( + err, + DhtPeerValidatorError::ValidatorError(PeerValidatorError::PeerHasNoAddresses { .. }) + )); } } diff --git a/comms/rpc_macros/Cargo.toml b/comms/rpc_macros/Cargo.toml index b0dcc3d4b5..04d27cb0a8 100644 --- a/comms/rpc_macros/Cargo.toml +++ b/comms/rpc_macros/Cargo.toml @@ -6,8 +6,8 @@ repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [lib] proc-macro = true @@ -19,8 +19,8 @@ quote = "1.0.7" syn = { version = "1.0.38", features = ["fold", "full", "extra-traits"] } [dev-dependencies] -tari_comms = { path = "../core", features = ["rpc"] } -tari_test_utils = { path = "../../infrastructure/test_utils" } +tari_comms = { workspace = true, features = ["rpc"] } +tari_test_utils = { workspace = true } futures = "0.3.5" prost = "0.11.9" diff --git a/hashing/Cargo.toml b/hashing/Cargo.toml index 8cd93b7271..2729bf7b59 100644 --- a/hashing/Cargo.toml +++ b/hashing/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tari_hashing" -version = "1.0.0-dan.5" -edition = "2021" +version.workspace = true +edition.workspace = true description = "Tari hash domains" authors = ["The Tari Development Community"] repository = "https://github.com/tari-project/tari" @@ -12,7 +12,7 @@ license = "BSD-3-Clause" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tari_crypto = "0.20.0" +tari_crypto = { workspace = true } digest = "0.10" borsh = "1.2" diff --git a/infrastructure/derive/Cargo.toml b/infrastructure/derive/Cargo.toml index 797ab20850..c2c6babce1 100644 --- a/infrastructure/derive/Cargo.toml +++ b/infrastructure/derive/Cargo.toml @@ -6,8 +6,8 @@ repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [lib] proc-macro = true diff --git a/infrastructure/libtor/Cargo.toml b/infrastructure/libtor/Cargo.toml index 7c50f32ebd..c2a762d747 100644 --- a/infrastructure/libtor/Cargo.toml +++ b/infrastructure/libtor/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "tari_libtor" -version = "1.0.0-dan.5" -edition = "2021" +version.workspace = true +edition.workspace = true license = "BSD-3-Clause" [dependencies] -tari_common = { path = "../../common" } -tari_p2p = { path = "../../base_layer/p2p" } +tari_common = { workspace = true } +tari_p2p = { workspace = true } derivative = "2.2.0" log = "0.4.8" diff --git a/infrastructure/metrics/Cargo.toml b/infrastructure/metrics/Cargo.toml index 48ee0671e4..67c1b5e457 100644 --- a/infrastructure/metrics/Cargo.toml +++ b/infrastructure/metrics/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "tari_metrics" description = "Tari metrics" -version = "1.0.0-dan.5" -edition = "2021" +version.workspace = true +edition.workspace = true authors = ["The Tari Development Community"] repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" diff --git a/infrastructure/shutdown/Cargo.toml b/infrastructure/shutdown/Cargo.toml index db9ada8076..db3625bb08 100644 --- a/infrastructure/shutdown/Cargo.toml +++ b/infrastructure/shutdown/Cargo.toml @@ -6,8 +6,8 @@ repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/infrastructure/storage/Cargo.toml b/infrastructure/storage/Cargo.toml index da21c4c975..26451c38fe 100644 --- a/infrastructure/storage/Cargo.toml +++ b/infrastructure/storage/Cargo.toml @@ -6,16 +6,16 @@ repository = "https://github.com/tari-project/tari" homepage = "https://tari.com" readme = "README.md" license = "BSD-3-Clause" -version = "1.0.0-dan.5" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] bincode = "1.1" log = "0.4.0" lmdb-zero = "0.4.4" thiserror = "1.0.26" -serde = { version = "1.0.80", features = ["derive"] } +serde = { version = "1.0.80", features = ["derive"] } [dev-dependencies] rand = "0.8" -tari_utilities = { version = "0.7", features = ["borsh"] } +tari_utilities = { workspace = true, features = ["borsh"] } diff --git a/infrastructure/tari_script/Cargo.toml b/infrastructure/tari_script/Cargo.toml index 56e9094791..0ffb7b9cce 100644 --- a/infrastructure/tari_script/Cargo.toml +++ b/infrastructure/tari_script/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tari_script" -version = "1.0.0-dan.8" -edition = "2021" +version.workspace = true +edition.workspace = true description = "Tari script library" authors = ["The Tari Development Community"] repository = "https://github.com/tari-project/tari" @@ -11,8 +11,8 @@ readme = "README.md" license = "BSD-3-Clause" [dependencies] -tari_crypto = { version = "0.20" } -tari_utilities = { version = "0.7" } +tari_crypto = { workspace = true } +tari_utilities = { workspace = true } blake2 = "0.10" borsh = "1.2" diff --git a/infrastructure/test_utils/Cargo.toml b/infrastructure/test_utils/Cargo.toml index 7f568d36bf..50ecea7e75 100644 --- a/infrastructure/test_utils/Cargo.toml +++ b/infrastructure/test_utils/Cargo.toml @@ -1,16 +1,16 @@ [package] name = "tari_test_utils" description = "Utility functions used in Tari test functions" -version = "1.0.0-dan.5" +version.workspace = true authors = ["The Tari Development Community"] -edition = "2018" +edition.workspace = true license = "BSD-3-Clause" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -tari_shutdown = { path = "../shutdown", version = "1.0.0-dan.5" } -tari_comms = { path = "../../comms/core", version = "1.0.0-dan.5" } +tari_shutdown = { workspace = true } +tari_comms = { workspace = true } futures = { version = "^0.3.1" } rand = "0.8" diff --git a/infrastructure/test_utils/src/enums.rs b/infrastructure/test_utils/src/enums.rs index 333eb1b131..ba074d0708 100644 --- a/infrastructure/test_utils/src/enums.rs +++ b/infrastructure/test_utils/src/enums.rs @@ -87,10 +87,4 @@ macro_rules! unpack_enum { v => panic!("Unexpected enum variant '{:?}' given to unpack_enum", v), }; }; - ($( $pattern:pat )|+ = $enum:expr) => { - match $enum { - $( $pattern )|+ => {}, - v => panic!("Unexpected enum variant '{:?}' given to unpack_enum", v), - }; - } } diff --git a/integration_tests/Cargo.toml b/integration_tests/Cargo.toml index 95022046d5..08e3041cda 100644 --- a/integration_tests/Cargo.toml +++ b/integration_tests/Cargo.toml @@ -3,34 +3,34 @@ name = "tari_integration_tests" authors = ["The Tari Development Community"] repository = "https://github.com/tari-project/tari" license = "BSD-3-Clause" -version = "0.35.1" -edition = "2018" +version.workspace = true +edition.workspace = true [dependencies] -minotari_app_grpc = { path = "../applications/minotari_app_grpc" } -minotari_app_utilities = { path = "../applications/minotari_app_utilities" } -minotari_node = { path = "../applications/minotari_node", features = ["metrics"] } -minotari_node_grpc_client = { path = "../clients/rust/base_node_grpc_client" } -tari_chat_client = { path = "../base_layer/contacts/src/chat_client" } -minotari_chat_ffi = { path = "../base_layer/chat_ffi" } -tari_crypto = { version = "0.20" } -tari_common = { path = "../common" } -tari_common_types = { path = "../base_layer/common_types" } -tari_comms = { path = "../comms/core" } -tari_comms_dht = { path = "../comms/dht" } -minotari_console_wallet = { path = "../applications/minotari_console_wallet", features = ["grpc"] } -tari_contacts = { path = "../base_layer/contacts" } -tari_core = { path = "../base_layer/core" } -minotari_merge_mining_proxy = { path = "../applications/minotari_merge_mining_proxy" } -minotari_miner = { path = "../applications/minotari_miner" } -tari_p2p = { path = "../base_layer/p2p" } -tari_script = { path = "../infrastructure/tari_script" } -tari_shutdown = { path = "../infrastructure/shutdown" } -tari_utilities = { version = "0.7" } -minotari_wallet = { path = "../base_layer/wallet" } -minotari_wallet_ffi = { path = "../base_layer/wallet_ffi" } -minotari_wallet_grpc_client = { path = "../clients/rust/wallet_grpc_client" } -tari_key_manager = { path = "../base_layer/key_manager" } +minotari_app_grpc = { workspace = true } +minotari_app_utilities = { workspace = true } +minotari_node = { workspace = true, features = ["metrics"] } +minotari_node_grpc_client = { workspace = true } +tari_chat_client = { workspace = true } +minotari_chat_ffi = { workspace = true } +tari_crypto = { workspace = true } +tari_common = { workspace = true } +tari_common_types = { workspace = true } +tari_comms = { workspace = true } +tari_comms_dht = { workspace = true } +minotari_console_wallet = { workspace = true, features = ["grpc"] } +tari_contacts = { workspace = true } +tari_core = { workspace = true, features = ["base_node"] } +minotari_merge_mining_proxy = { workspace = true } +minotari_miner = { workspace = true } +tari_p2p = { workspace = true } +tari_script = { workspace = true } +tari_shutdown = { workspace = true } +tari_utilities = { workspace = true } +minotari_wallet = { workspace = true } +minotari_wallet_ffi = { workspace = true } +minotari_wallet_grpc_client = { workspace = true } +tari_key_manager = { workspace = true } anyhow = "1.0.53" async-trait = "0.1.50"