diff --git a/Cargo.lock b/Cargo.lock index f8564b001d8a3..77f7456eda814 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,6 +125,7 @@ name = "aptos" version = "1.0.1" dependencies = [ "anyhow", + "aptos-backup-cli", "aptos-bitvec", "aptos-build-info", "aptos-config", @@ -146,7 +147,6 @@ dependencies = [ "aptos-types", "aptos-vm", "async-trait", - "backup-cli", "base64 0.13.0", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "cached-packages", @@ -325,6 +325,50 @@ dependencies = [ "storage-interface", ] +[[package]] +name = "aptos-backup-cli" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-config", + "aptos-crypto", + "aptos-infallible", + "aptos-jellyfish-merkle", + "aptos-logger", + "aptos-proptest-helpers", + "aptos-push-metrics", + "aptos-temppath", + "aptos-types", + "aptos-vm", + "aptosdb", + "async-trait", + "backup-service", + "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", + "bytes 1.2.1", + "clap 3.2.17", + "executor", + "executor-test-helpers", + "executor-types", + "futures", + "itertools", + "num_cpus", + "once_cell", + "pin-project", + "proptest", + "rand 0.7.3", + "regex", + "reqwest", + "scratchpad", + "serde 1.0.144", + "serde_json", + "serde_yaml 0.8.26", + "storage-interface", + "tokio", + "tokio-stream", + "tokio-util 0.7.3", + "warp", +] + [[package]] name = "aptos-bitvec" version = "0.1.0" @@ -1993,50 +2037,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "backup-cli" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-config", - "aptos-crypto", - "aptos-infallible", - "aptos-jellyfish-merkle", - "aptos-logger", - "aptos-proptest-helpers", - "aptos-push-metrics", - "aptos-temppath", - "aptos-types", - "aptos-vm", - "aptosdb", - "async-trait", - "backup-service", - "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", - "bytes 1.2.1", - "clap 3.2.17", - "executor", - "executor-test-helpers", - "executor-types", - "futures", - "itertools", - "num_cpus", - "once_cell", - "pin-project", - "proptest", - "rand 0.7.3", - "regex", - "reqwest", - "scratchpad", - "serde 1.0.144", - "serde_json", - "serde_yaml 0.8.26", - "storage-interface", - "tokio", - "tokio-stream", - "tokio-util 0.7.3", - "warp", -] - [[package]] name = "backup-service" version = "0.1.0" @@ -8794,6 +8794,7 @@ version = "0.1.0" dependencies = [ "anyhow", "aptos", + "aptos-backup-cli", "aptos-bitvec", "aptos-config", "aptos-crypto", @@ -8818,7 +8819,6 @@ dependencies = [ "aptos-vm", "aptos-writeset-generator", "async-trait", - "backup-cli", "base64 0.13.0", "bcs 0.1.3 (git+https://github.com/aptos-labs/bcs?rev=2cde3e8446c460cb17b0c1d6bac7e27e964ac169)", "cached-packages", diff --git a/Cargo.toml b/Cargo.toml index 8aa832681369f..a34e54b17e733 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -172,6 +172,7 @@ aptos-aggregator = { path = "aptos-move/aptos-aggregator" } aptos-api = { path = "api" } aptos-api-test-context = { path = "api/test-context" } aptos-api-types = { path = "api/types" } +aptos-backup-cli = { path = "storage/backup/backup-cli" } aptos-block-executor = { path = "aptos-move/block-executor" } aptos-bitvec = { path = "crates/aptos-bitvec" } aptos-build-info = { path = "crates/aptos-build-info" } @@ -229,7 +230,6 @@ aptos-vm = { path = "aptos-move/aptos-vm" } aptos-warp-webserver = { path = "crates/aptos-warp-webserver" } aptos-writeset-generator = { path = "aptos-move/writeset-transaction-generator" } aptosdb = { path = "storage/aptosdb" } -backup-cli = { path = "storage/backup/backup-cli" } backup-service = { path = "storage/backup/backup-service" } bounded-executor = { path = "crates/bounded-executor" } cached-packages = { path = "aptos-move/framework/cached-packages" } diff --git a/crates/aptos/Cargo.toml b/crates/aptos/Cargo.toml index dea5b3c791302..cde03761c040c 100644 --- a/crates/aptos/Cargo.toml +++ b/crates/aptos/Cargo.toml @@ -14,6 +14,7 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } +aptos-backup-cli = { workspace = true } aptos-bitvec = { workspace = true } aptos-build-info = { workspace = true } aptos-config = { workspace = true } @@ -35,7 +36,6 @@ aptos-transactional-test-harness = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true, features = ["testing"] } async-trait = { workspace = true } -backup-cli = { workspace = true } base64 = { workspace = true } bcs = { workspace = true } cached-packages = { workspace = true } diff --git a/crates/aptos/src/node/mod.rs b/crates/aptos/src/node/mod.rs index f7686c5d9d3dc..742e3b91e98e1 100644 --- a/crates/aptos/src/node/mod.rs +++ b/crates/aptos/src/node/mod.rs @@ -20,6 +20,12 @@ use crate::{ }, genesis::git::from_yaml, }; +use aptos_backup_cli::coordinators::restore::{RestoreCoordinator, RestoreCoordinatorOpt}; +use aptos_backup_cli::metadata::cache::MetadataCacheOpt; +use aptos_backup_cli::storage::command_adapter::{config::CommandAdapterConfig, CommandAdapter}; +use aptos_backup_cli::utils::{ + ConcurrentDownloadsOpt, GlobalRestoreOpt, ReplayConcurrencyLevelOpt, RocksdbOpt, +}; use aptos_config::config::NodeConfig; use aptos_crypto::bls12381::PublicKey; use aptos_crypto::{bls12381, x25519, ValidCryptoMaterialStringExt}; @@ -38,12 +44,6 @@ use aptos_types::validator_performances::ValidatorPerformances; use aptos_types::vesting::VestingAdminStore; use aptos_types::{account_address::AccountAddress, account_config::CORE_CODE_ADDRESS}; use async_trait::async_trait; -use backup_cli::coordinators::restore::{RestoreCoordinator, RestoreCoordinatorOpt}; -use backup_cli::metadata::cache::MetadataCacheOpt; -use backup_cli::storage::command_adapter::{config::CommandAdapterConfig, CommandAdapter}; -use backup_cli::utils::{ - ConcurrentDownloadsOpt, GlobalRestoreOpt, ReplayConcurrencyLevelOpt, RocksdbOpt, -}; use bcs::Result; use cached_packages::aptos_stdlib; use chrono::{DateTime, NaiveDateTime, Utc}; diff --git a/docker/build-rust-all.sh b/docker/build-rust-all.sh index 2a77f70b9dc13..f5bf2773d481e 100755 --- a/docker/build-rust-all.sh +++ b/docker/build-rust-all.sh @@ -13,12 +13,12 @@ echo "FEATURES: $FEATURES" # Build all the rust binaries cargo build --locked --profile=$PROFILE \ -p aptos \ + -p aptos-backup-cli \ -p aptos-faucet \ + -p aptos-fn-check-client \ -p aptos-node-checker \ -p aptos-openapi-spec-generator \ -p aptos-telemetry-service \ - -p aptos-fn-check-client \ - -p backup-cli \ -p db-bootstrapper \ -p forge-cli \ -p transaction-emitter \ diff --git a/storage/README.md b/storage/README.md index a7de4a930e062..86c2d8519cdba 100644 --- a/storage/README.md +++ b/storage/README.md @@ -172,7 +172,7 @@ https://github.com/aptos-labs/aptos-core/tree/main/storage/backup/backup-cli/src ```bash -$ cargo run -p backup-cli --bin db-backup coordinator run +$ cargo run -p aptos-backup-cli --bin db-backup coordinator run Finished dev [unoptimized + debuginfo] target(s) in 0.52s Running `target/debug/db-backup coordinator run` db-backup-coordinator-run @@ -235,7 +235,7 @@ SUBCOMMANDS: Example command: ``` -$ cargo run -p backup-cli --bin db-backup -- \ +$ cargo run -p aptos-backup-cli --bin db-backup -- \ coordinator run \ --metadata-cache-dir ./mc \ --state-snapshot-interval-epochs 1 \ @@ -303,7 +303,7 @@ RUST_LOG=info ./aptos \ ``` This is basically the same functionality with -the "auto" mode of `cargo run -p backup-cli --bin db-restore`, but with more +the "auto" mode of `cargo run -p aptos-backup-cli --bin db-restore`, but with more limited options. The `db-restore` tool mentioned has the ability to manually hack a local DB and is highly experimental. It's not recommended is be used if -you are not 100% aware of what you are doing. \ No newline at end of file +you are not 100% aware of what you are doing. diff --git a/storage/backup/backup-cli/Cargo.toml b/storage/backup/backup-cli/Cargo.toml index a58438ab29aea..ba5ed0aaa3ca6 100644 --- a/storage/backup/backup-cli/Cargo.toml +++ b/storage/backup/backup-cli/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "backup-cli" +name = "aptos-backup-cli" description = "Backup CLI" version = "0.1.0" diff --git a/storage/backup/backup-cli/src/bin/db-backup-verify.rs b/storage/backup/backup-cli/src/bin/db-backup-verify.rs index a0a49a02ffcf1..5bfea71df80bc 100644 --- a/storage/backup/backup-cli/src/bin/db-backup-verify.rs +++ b/storage/backup/backup-cli/src/bin/db-backup-verify.rs @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; -use aptos_logger::{prelude::*, Level, Logger}; -use aptos_push_metrics::MetricsPusher; -use backup_cli::{ +use aptos_backup_cli::{ coordinators::verify::VerifyCoordinator, metadata::cache::MetadataCacheOpt, storage::StorageOpt, utils::{ConcurrentDownloadsOpt, TrustedWaypointOpt}, }; +use aptos_logger::{prelude::*, Level, Logger}; +use aptos_push_metrics::MetricsPusher; use clap::Parser; #[derive(Parser)] diff --git a/storage/backup/backup-cli/src/bin/db-backup.rs b/storage/backup/backup-cli/src/bin/db-backup.rs index 6c9951a137180..f9f20aa8be1a0 100644 --- a/storage/backup/backup-cli/src/bin/db-backup.rs +++ b/storage/backup/backup-cli/src/bin/db-backup.rs @@ -6,9 +6,7 @@ use std::sync::Arc; use anyhow::Result; use clap::Parser; -use aptos_logger::{prelude::*, Level, Logger}; -use aptos_push_metrics::MetricsPusher; -use backup_cli::{ +use aptos_backup_cli::{ backup_types::{ epoch_ending::backup::{EpochEndingBackupController, EpochEndingBackupOpt}, state_snapshot::backup::{StateSnapshotBackupController, StateSnapshotBackupOpt}, @@ -22,6 +20,8 @@ use backup_cli::{ ConcurrentDownloadsOpt, GlobalBackupOpt, }, }; +use aptos_logger::{prelude::*, Level, Logger}; +use aptos_push_metrics::MetricsPusher; #[derive(Parser)] #[clap(about = "Ledger backup tool.")] diff --git a/storage/backup/backup-cli/src/bin/db-restore.rs b/storage/backup/backup-cli/src/bin/db-restore.rs index bf7dbadfe313f..c021147ce1320 100644 --- a/storage/backup/backup-cli/src/bin/db-restore.rs +++ b/storage/backup/backup-cli/src/bin/db-restore.rs @@ -2,9 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; -use aptos_logger::{prelude::*, Level, Logger}; -use aptos_push_metrics::MetricsPusher; -use backup_cli::{ +use aptos_backup_cli::{ backup_types::{ epoch_ending::restore::{EpochEndingRestoreController, EpochEndingRestoreOpt}, state_snapshot::restore::{StateSnapshotRestoreController, StateSnapshotRestoreOpt}, @@ -14,6 +12,8 @@ use backup_cli::{ storage::StorageOpt, utils::{GlobalRestoreOpt, GlobalRestoreOptions}, }; +use aptos_logger::{prelude::*, Level, Logger}; +use aptos_push_metrics::MetricsPusher; use clap::Parser; use std::convert::TryInto; diff --git a/storage/backup/backup-cli/src/bin/replay-verify.rs b/storage/backup/backup-cli/src/bin/replay-verify.rs index 11d4bdeecda39..358bfac52ad92 100644 --- a/storage/backup/backup-cli/src/bin/replay-verify.rs +++ b/storage/backup/backup-cli/src/bin/replay-verify.rs @@ -2,6 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; +use aptos_backup_cli::utils::ReplayConcurrencyLevelOpt; +use aptos_backup_cli::{ + coordinators::replay_verify::ReplayVerifyCoordinator, + metadata::cache::MetadataCacheOpt, + storage::StorageOpt, + utils::{ConcurrentDownloadsOpt, RocksdbOpt, TrustedWaypointOpt}, +}; use aptos_config::config::{ BUFFERED_STATE_TARGET_ITEMS, DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, NO_OP_STORAGE_PRUNER_CONFIG, @@ -9,13 +16,6 @@ use aptos_config::config::{ use aptos_logger::{prelude::*, Level, Logger}; use aptos_types::transaction::Version; use aptosdb::{AptosDB, GetRestoreHandler}; -use backup_cli::utils::ReplayConcurrencyLevelOpt; -use backup_cli::{ - coordinators::replay_verify::ReplayVerifyCoordinator, - metadata::cache::MetadataCacheOpt, - storage::StorageOpt, - utils::{ConcurrentDownloadsOpt, RocksdbOpt, TrustedWaypointOpt}, -}; use clap::Parser; use std::{path::PathBuf, sync::Arc}; diff --git a/testsuite/smoke-test/Cargo.toml b/testsuite/smoke-test/Cargo.toml index 90ead4868930a..ea41ff6e40611 100644 --- a/testsuite/smoke-test/Cargo.toml +++ b/testsuite/smoke-test/Cargo.toml @@ -46,6 +46,7 @@ serde_json = { workspace = true } tokio = { workspace = true } [dev-dependencies] +aptos-backup-cli = { workspace = true } aptos-genesis = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } @@ -53,7 +54,6 @@ aptos-secure-storage = { workspace = true } aptos-time-service = { workspace = true } aptos-vault-client = { workspace = true } aptos-writeset-generator = { workspace = true } -backup-cli = { workspace = true } base64 = { workspace = true } futures = { workspace = true } num_cpus = { workspace = true } diff --git a/testsuite/smoke-test/src/storage.rs b/testsuite/smoke-test/src/storage.rs index b05cff65bfd0d..58697f995e756 100644 --- a/testsuite/smoke-test/src/storage.rs +++ b/testsuite/smoke-test/src/storage.rs @@ -11,10 +11,10 @@ use crate::{ workspace_builder::workspace_root, }; use anyhow::{bail, Result}; +use aptos_backup_cli::metadata::view::BackupStorageState; use aptos_logger::info; use aptos_temppath::TempPath; use aptos_types::{transaction::Version, waypoint::Waypoint}; -use backup_cli::metadata::view::BackupStorageState; use forge::{reconfig, NodeExt, Swarm, SwarmExt}; use std::{ fs,