diff --git a/Cargo.lock b/Cargo.lock index b2258b11323eb..0f00c1bf35989 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -273,21 +273,21 @@ dependencies = [ "aptos-cached-packages", "aptos-config", "aptos-crypto", + "aptos-db", "aptos-executor", "aptos-executor-types", "aptos-genesis", "aptos-mempool", + "aptos-mempool-notifications", "aptos-sdk", "aptos-storage-interface", "aptos-temppath", "aptos-types", "aptos-vm", "aptos-vm-validator", - "aptosdb", "bytes 1.2.1", "goldenfile", "hyper", - "mempool-notifications", "poem", "poem-openapi", "proptest", @@ -334,6 +334,7 @@ dependencies = [ "aptos-backup-service", "aptos-config", "aptos-crypto", + "aptos-db", "aptos-executor", "aptos-executor-test-helpers", "aptos-executor-types", @@ -347,7 +348,6 @@ dependencies = [ "aptos-temppath", "aptos-types", "aptos-vm", - "aptosdb", "async-trait", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "bytes 1.2.1", @@ -379,12 +379,12 @@ dependencies = [ "anyhow", "aptos-config", "aptos-crypto", + "aptos-db", "aptos-logger", "aptos-metrics-core", "aptos-storage-interface", "aptos-temppath", "aptos-types", - "aptosdb", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "bytes 1.2.1", "hyper", @@ -415,6 +415,7 @@ dependencies = [ "aptos-aggregator", "aptos-infallible", "aptos-metrics-core", + "aptos-mvhashmap", "aptos-state-view", "aptos-types", "arc-swap", @@ -424,7 +425,6 @@ dependencies = [ "crossbeam", "crossbeam-queue", "dashmap", - "mvhashmap", "num_cpus", "once_cell", "proptest", @@ -521,6 +521,9 @@ dependencies = [ "aptos-logger", "aptos-mempool", "aptos-metrics-core", + "aptos-network", + "aptos-safety-rules", + "aptos-schemadb", "aptos-secure-storage", "aptos-short-hex-str", "aptos-storage-interface", @@ -541,14 +544,11 @@ dependencies = [ "itertools", "mirai-annotations", "move-core-types", - "network", "num-derive", "num-traits 0.2.15", "once_cell", "proptest", "rand 0.7.3", - "safety-rules", - "schemadb", "serde 1.0.149", "serde_json", "tempfile", @@ -662,6 +662,8 @@ dependencies = [ "aptos-infallible", "aptos-logger", "aptos-metrics-core", + "aptos-netcore", + "aptos-network", "aptos-storage-service-client", "aptos-storage-service-server", "aptos-storage-service-types", @@ -674,8 +676,6 @@ dependencies = [ "futures", "itertools", "maplit", - "netcore", - "network", "rand 0.7.3", "serde 1.0.149", "thiserror", @@ -693,6 +693,7 @@ dependencies = [ "aptos-infallible", "aptos-logger", "aptos-metrics-core", + "aptos-network", "aptos-short-hex-str", "aptos-storage-service-types", "aptos-types", @@ -701,7 +702,6 @@ dependencies = [ "claims", "enum_dispatch", "futures", - "network", "once_cell", "rand 0.7.3", "serde 1.0.149", @@ -710,6 +710,77 @@ dependencies = [ "tokio-stream", ] +[[package]] +name = "aptos-db" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-accumulator", + "aptos-config", + "aptos-crypto", + "aptos-db-indexer", + "aptos-executor-types", + "aptos-infallible", + "aptos-jellyfish-merkle", + "aptos-logger", + "aptos-metrics-core", + "aptos-proptest-helpers", + "aptos-rocksdb-options", + "aptos-schemadb", + "aptos-scratchpad", + "aptos-state-view", + "aptos-storage-interface", + "aptos-temppath", + "aptos-types", + "aptos-vm", + "arc-swap", + "arr_macro", + "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", + "byteorder", + "itertools", + "lru", + "move-core-types", + "move-resource-viewer", + "num-derive", + "once_cell", + "proptest", + "proptest-derive", + "rand 0.7.3", + "rayon", + "serde 1.0.149", + "thiserror", +] + +[[package]] +name = "aptos-db-indexer" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-config", + "aptos-crypto", + "aptos-infallible", + "aptos-logger", + "aptos-metrics-core", + "aptos-proptest-helpers", + "aptos-rocksdb-options", + "aptos-schemadb", + "aptos-scratchpad", + "aptos-state-view", + "aptos-storage-interface", + "aptos-temppath", + "aptos-types", + "aptos-vm", + "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", + "byteorder", + "move-core-types", + "move-resource-viewer", + "num-derive", + "proptest", + "proptest-derive", + "rand 0.7.3", + "serde 1.0.149", +] + [[package]] name = "aptos-debugger" version = "0.1.0" @@ -737,6 +808,7 @@ name = "aptos-event-notifications" version = "0.1.0" dependencies = [ "aptos-crypto", + "aptos-db", "aptos-executor-test-helpers", "aptos-id-generator", "aptos-infallible", @@ -746,7 +818,6 @@ dependencies = [ "aptos-types", "aptos-vm", "aptos-vm-genesis", - "aptosdb", "async-trait", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "channel", @@ -767,6 +838,7 @@ dependencies = [ "aptos-config", "aptos-consensus-types", "aptos-crypto", + "aptos-db", "aptos-executor-test-helpers", "aptos-executor-types", "aptos-gas", @@ -782,7 +854,6 @@ dependencies = [ "aptos-types", "aptos-vm", "aptos-vm-genesis", - "aptosdb", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "fail 0.5.0", "itertools", @@ -803,6 +874,7 @@ dependencies = [ "aptos-config", "aptos-consensus-types", "aptos-crypto", + "aptos-db", "aptos-executor", "aptos-executor-types", "aptos-genesis", @@ -813,7 +885,6 @@ dependencies = [ "aptos-types", "aptos-vm", "aptos-vm-genesis", - "aptosdb", "rand 0.7.3", ] @@ -915,6 +986,7 @@ dependencies = [ "aptos", "aptos-cached-packages", "aptos-config", + "aptos-db", "aptos-framework", "aptos-genesis", "aptos-global-constants", @@ -927,7 +999,6 @@ dependencies = [ "aptos-secure-storage", "aptos-state-sync-driver", "aptos-transaction-emitter-lib", - "aptosdb", "async-trait", "chrono", "either", @@ -1057,17 +1128,19 @@ dependencies = [ "aptos-consensus", "aptos-consensus-types", "aptos-crypto", + "aptos-db", "aptos-executor", "aptos-executor-types", "aptos-jellyfish-merkle", "aptos-language-e2e-tests", "aptos-mempool", + "aptos-network", "aptos-proptest-helpers", + "aptos-safety-rules", "aptos-scratchpad", "aptos-storage-interface", "aptos-types", "aptos-vault-client", - "aptosdb", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "byteorder", "datatest-stable", @@ -1075,13 +1148,11 @@ dependencies = [ "move-binary-format", "move-core-types", "move-vm-types", - "network", "once_cell", "proptest", "proptest-derive", "rand 0.7.3", "rusty-fork", - "safety-rules", "sha-1 0.10.0", "stats_alloc", "structopt", @@ -1095,6 +1166,7 @@ dependencies = [ "aptos-framework", "aptos-gas-algebra-ext", "aptos-global-constants", + "aptos-package-builder", "aptos-types", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "clap 3.2.17", @@ -1104,7 +1176,6 @@ dependencies = [ "move-stdlib", "move-table-extension", "move-vm-types", - "package-builder", "tempfile", ] @@ -1123,6 +1194,7 @@ dependencies = [ "aptos-cached-packages", "aptos-config", "aptos-crypto", + "aptos-db", "aptos-executor", "aptos-framework", "aptos-keygen", @@ -1133,7 +1205,6 @@ dependencies = [ "aptos-types", "aptos-vm", "aptos-vm-genesis", - "aptosdb", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "rand 0.7.3", "serde 1.0.149", @@ -1144,8 +1215,8 @@ dependencies = [ name = "aptos-github-client" version = "0.1.0" dependencies = [ + "aptos-proxy", "base64 0.13.0", - "proxy", "serde 1.0.149", "serde_json", "thiserror", @@ -1232,12 +1303,12 @@ dependencies = [ "anyhow", "aptos-crypto", "aptos-crypto-derive", + "aptos-db", "aptos-infallible", "aptos-logger", "aptos-metrics-core", "aptos-storage-interface", "aptos-types", - "aptosdb", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "byteorder", "itertools", @@ -1340,7 +1411,10 @@ dependencies = [ "aptos-id-generator", "aptos-infallible", "aptos-logger", + "aptos-mempool-notifications", "aptos-metrics-core", + "aptos-netcore", + "aptos-network", "aptos-proptest-helpers", "aptos-short-hex-str", "aptos-storage-interface", @@ -1353,9 +1427,6 @@ dependencies = [ "fail 0.5.0", "futures", "itertools", - "mempool-notifications", - "netcore", - "network", "once_cell", "proptest", "rand 0.7.3", @@ -1367,6 +1438,30 @@ dependencies = [ "tokio-stream", ] +[[package]] +name = "aptos-mempool-notifications" +version = "0.1.0" +dependencies = [ + "aptos-crypto", + "aptos-types", + "async-trait", + "claims", + "futures", + "serde 1.0.149", + "thiserror", + "tokio", +] + +[[package]] +name = "aptos-memsocket" +version = "0.1.0" +dependencies = [ + "aptos-infallible", + "bytes 1.2.1", + "futures", + "once_cell", +] + [[package]] name = "aptos-metrics-core" version = "0.1.0" @@ -1384,6 +1479,123 @@ dependencies = [ "move-core-types", ] +[[package]] +name = "aptos-move-examples" +version = "0.1.0" +dependencies = [ + "aptos-gas", + "aptos-types", + "aptos-vm", + "clap 3.2.17", + "move-cli", + "move-package", + "move-prover", + "move-unit-test", + "move-vm-runtime", + "tempfile", +] + +[[package]] +name = "aptos-mvhashmap" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-aggregator", + "aptos-types", + "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", + "crossbeam", + "dashmap", + "proptest", + "proptest-derive", + "rayon", +] + +[[package]] +name = "aptos-netcore" +version = "0.1.0" +dependencies = [ + "aptos-memsocket", + "aptos-proxy", + "aptos-types", + "bytes 1.2.1", + "futures", + "pin-project", + "serde 1.0.149", + "tokio", + "tokio-util 0.7.3", + "url", +] + +[[package]] +name = "aptos-network" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-bitvec", + "aptos-compression", + "aptos-config", + "aptos-crypto", + "aptos-crypto-derive", + "aptos-id-generator", + "aptos-infallible", + "aptos-logger", + "aptos-memsocket", + "aptos-metrics-core", + "aptos-netcore", + "aptos-num-variants", + "aptos-proptest-helpers", + "aptos-rate-limiter", + "aptos-short-hex-str", + "aptos-time-service", + "aptos-types", + "async-trait", + "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", + "bytes 1.2.1", + "channel", + "futures", + "futures-util", + "hex", + "itertools", + "maplit", + "once_cell", + "pin-project", + "proptest", + "proptest-derive", + "rand 0.7.3", + "rand_core 0.5.1", + "serde 1.0.149", + "serde_bytes", + "serde_json", + "thiserror", + "tokio", + "tokio-retry", + "tokio-util 0.7.3", +] + +[[package]] +name = "aptos-network-builder" +version = "0.1.0" +dependencies = [ + "aptos-config", + "aptos-crypto", + "aptos-event-notifications", + "aptos-infallible", + "aptos-logger", + "aptos-netcore", + "aptos-network", + "aptos-network-discovery", + "aptos-secure-storage", + "aptos-time-service", + "aptos-types", + "async-trait", + "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", + "channel", + "futures", + "rand 0.7.3", + "serde 1.0.149", + "tokio", +] + [[package]] name = "aptos-network-checker" version = "0.0.1" @@ -1392,14 +1604,40 @@ dependencies = [ "aptos-config", "aptos-crypto", "aptos-logger", + "aptos-network", "aptos-types", "clap 3.2.17", "futures", - "network", "serde 1.0.149", "tokio", ] +[[package]] +name = "aptos-network-discovery" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-config", + "aptos-crypto", + "aptos-event-notifications", + "aptos-logger", + "aptos-metrics-core", + "aptos-netcore", + "aptos-network", + "aptos-secure-storage", + "aptos-short-hex-str", + "aptos-temppath", + "aptos-time-service", + "aptos-types", + "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", + "channel", + "futures", + "once_cell", + "rand 0.7.3", + "serde_yaml 0.8.26", + "tokio", +] + [[package]] name = "aptos-node" version = "0.1.0" @@ -1416,6 +1654,7 @@ dependencies = [ "aptos-crypto", "aptos-data-client", "aptos-data-streaming-service", + "aptos-db", "aptos-event-notifications", "aptos-executor", "aptos-executor-types", @@ -1426,6 +1665,9 @@ dependencies = [ "aptos-inspection-service", "aptos-logger", "aptos-mempool", + "aptos-mempool-notifications", + "aptos-network", + "aptos-network-builder", "aptos-secure-storage", "aptos-state-sync-driver", "aptos-state-view", @@ -1437,16 +1679,12 @@ dependencies = [ "aptos-time-service", "aptos-types", "aptos-vm", - "aptosdb", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "clap 3.2.17", "fail 0.5.0", "futures", "hex", "jemallocator", - "mempool-notifications", - "network", - "network-builder", "rand 0.7.3", "rayon", "tokio", @@ -1485,6 +1723,29 @@ dependencies = [ "url", ] +[[package]] +name = "aptos-node-resource-metrics" +version = "0.1.0" +dependencies = [ + "aptos-infallible", + "aptos-logger", + "aptos-metrics-core", + "cfg-if", + "once_cell", + "procfs", + "prometheus", + "sysinfo", +] + +[[package]] +name = "aptos-num-variants" +version = "0.1.0" +dependencies = [ + "proc-macro2 1.0.47", + "quote 1.0.21", + "syn 1.0.105", +] + [[package]] name = "aptos-openapi" version = "0.1.0" @@ -1510,6 +1771,63 @@ dependencies = [ "clap 3.2.17", ] +[[package]] +name = "aptos-package-builder" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-framework", + "itertools", + "move-command-line-common", + "move-package", + "tempfile", +] + +[[package]] +name = "aptos-peer-monitoring-service-client" +version = "0.1.0" +dependencies = [ + "aptos-config", + "aptos-network", + "aptos-peer-monitoring-service-types", + "aptos-types", + "async-trait", + "channel", + "thiserror", +] + +[[package]] +name = "aptos-peer-monitoring-service-server" +version = "0.1.0" +dependencies = [ + "aptos-bounded-executor", + "aptos-config", + "aptos-logger", + "aptos-metrics-core", + "aptos-netcore", + "aptos-network", + "aptos-peer-monitoring-service-types", + "aptos-types", + "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", + "bytes 1.2.1", + "channel", + "futures", + "once_cell", + "serde 1.0.149", + "thiserror", + "tokio", +] + +[[package]] +name = "aptos-peer-monitoring-service-types" +version = "0.1.0" +dependencies = [ + "aptos-config", + "aptos-network", + "serde 1.0.149", + "thiserror", +] + [[package]] name = "aptos-proptest-helpers" version = "0.1.0" @@ -1519,6 +1837,13 @@ dependencies = [ "proptest-derive", ] +[[package]] +name = "aptos-proxy" +version = "0.1.0" +dependencies = [ + "ipnet", +] + [[package]] name = "aptos-push-metrics" version = "0.1.0" @@ -1659,6 +1984,49 @@ dependencies = [ "url", ] +[[package]] +name = "aptos-safety-rules" +version = "0.1.0" +dependencies = [ + "aptos-config", + "aptos-consensus-types", + "aptos-crypto", + "aptos-global-constants", + "aptos-infallible", + "aptos-logger", + "aptos-metrics-core", + "aptos-proptest-helpers", + "aptos-secure-net", + "aptos-secure-storage", + "aptos-temppath", + "aptos-types", + "aptos-vault-client", + "criterion", + "once_cell", + "proptest", + "rand 0.7.3", + "rusty-fork", + "serde 1.0.149", + "serde_json", + "tempfile", + "thiserror", +] + +[[package]] +name = "aptos-schemadb" +version = "0.1.0" +dependencies = [ + "anyhow", + "aptos-infallible", + "aptos-logger", + "aptos-metrics-core", + "aptos-temppath", + "byteorder", + "once_cell", + "proptest", + "rocksdb", +] + [[package]] name = "aptos-scratchpad" version = "0.1.0" @@ -1743,6 +2111,7 @@ dependencies = [ "aptos-github-client", "aptos-infallible", "aptos-logger", + "aptos-schemadb", "aptos-temppath", "aptos-time-service", "aptos-vault-client", @@ -1751,7 +2120,6 @@ dependencies = [ "chrono", "enum_dispatch", "rand 0.7.3", - "schemadb", "serde 1.0.149", "serde_json", "thiserror", @@ -1779,6 +2147,7 @@ dependencies = [ "aptos-crypto", "aptos-data-client", "aptos-data-streaming-service", + "aptos-db", "aptos-event-notifications", "aptos-executor", "aptos-executor-test-helpers", @@ -1786,7 +2155,10 @@ dependencies = [ "aptos-genesis", "aptos-infallible", "aptos-logger", + "aptos-mempool-notifications", "aptos-metrics-core", + "aptos-network", + "aptos-schemadb", "aptos-scratchpad", "aptos-storage-interface", "aptos-storage-service-client", @@ -1796,19 +2168,15 @@ dependencies = [ "aptos-types", "aptos-vm", "aptos-vm-genesis", - "aptosdb", "async-trait", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "channel", "claims", "futures", - "mempool-notifications", "mockall", "move-core-types", - "network", "once_cell", "rand 0.7.3", - "schemadb", "serde 1.0.149", "thiserror", "tokio", @@ -1857,11 +2225,11 @@ name = "aptos-storage-service-client" version = "0.1.0" dependencies = [ "aptos-config", + "aptos-network", "aptos-storage-service-types", "aptos-types", "async-trait", "channel", - "network", "thiserror", ] @@ -1877,6 +2245,7 @@ dependencies = [ "aptos-infallible", "aptos-logger", "aptos-metrics-core", + "aptos-network", "aptos-storage-interface", "aptos-storage-service-types", "aptos-time-service", @@ -1888,7 +2257,6 @@ dependencies = [ "futures", "lru", "mockall", - "network", "once_cell", "rand 0.7.3", "serde 1.0.149", @@ -1921,19 +2289,19 @@ dependencies = [ "aptos-config", "aptos-consensus", "aptos-crypto", + "aptos-db", "aptos-infallible", "aptos-logger", "aptos-mempool", "aptos-metrics-core", + "aptos-network", + "aptos-node-resource-metrics", "aptos-state-sync-driver", "aptos-telemetry-service", "aptos-types", - "aptosdb", "flate2", "futures", "httpmock", - "network", - "node-resource-metrics", "once_cell", "prometheus", "rand 0.7.3", @@ -2013,12 +2381,12 @@ dependencies = [ "aptos-global-constants", "aptos-keygen", "aptos-logger", + "aptos-move-examples", "aptos-rest-client", "aptos-sdk", "aptos-types", "futures", "hex", - "move-examples", "rand 0.7.3", "reqwest", "serde_json", @@ -2150,11 +2518,11 @@ dependencies = [ "anyhow", "aptos-api-types", "aptos-config", + "aptos-db", "aptos-rest-client", "aptos-state-view", "aptos-storage-interface", "aptos-types", - "aptosdb", "async-trait", "move-binary-format", "tokio", @@ -2192,6 +2560,7 @@ dependencies = [ "aptos-logger", "aptos-metrics-core", "aptos-module-verifier", + "aptos-mvhashmap", "aptos-state-view", "aptos-types", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", @@ -2207,7 +2576,6 @@ dependencies = [ "move-vm-runtime", "move-vm-test-utils", "move-vm-types", - "mvhashmap", "num_cpus", "once_cell", "proptest", @@ -2249,6 +2617,7 @@ dependencies = [ "anyhow", "aptos-cached-packages", "aptos-crypto", + "aptos-db", "aptos-executor-test-helpers", "aptos-gas", "aptos-scratchpad", @@ -2258,7 +2627,6 @@ dependencies = [ "aptos-types", "aptos-vm", "aptos-vm-genesis", - "aptosdb", "fail 0.5.0", "move-core-types", "rand 0.7.3", @@ -2303,77 +2671,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "aptosdb" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-accumulator", - "aptos-config", - "aptos-crypto", - "aptos-executor-types", - "aptos-infallible", - "aptos-jellyfish-merkle", - "aptos-logger", - "aptos-metrics-core", - "aptos-proptest-helpers", - "aptos-rocksdb-options", - "aptos-scratchpad", - "aptos-state-view", - "aptos-storage-interface", - "aptos-temppath", - "aptos-types", - "aptos-vm", - "aptosdb-indexer", - "arc-swap", - "arr_macro", - "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", - "byteorder", - "itertools", - "lru", - "move-core-types", - "move-resource-viewer", - "num-derive", - "once_cell", - "proptest", - "proptest-derive", - "rand 0.7.3", - "rayon", - "schemadb", - "serde 1.0.149", - "thiserror", -] - -[[package]] -name = "aptosdb-indexer" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-config", - "aptos-crypto", - "aptos-infallible", - "aptos-logger", - "aptos-metrics-core", - "aptos-proptest-helpers", - "aptos-rocksdb-options", - "aptos-scratchpad", - "aptos-state-view", - "aptos-storage-interface", - "aptos-temppath", - "aptos-types", - "aptos-vm", - "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", - "byteorder", - "move-core-types", - "move-resource-viewer", - "num-derive", - "proptest", - "proptest-derive", - "rand 0.7.3", - "schemadb", - "serde 1.0.149", -] - [[package]] name = "arbitrary" version = "0.4.7" @@ -3838,12 +4135,12 @@ dependencies = [ "anyhow", "aptos-config", "aptos-crypto", + "aptos-db", "aptos-executor", "aptos-storage-interface", "aptos-temppath", "aptos-types", "aptos-vm", - "aptosdb", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "structopt", ] @@ -4044,6 +4341,7 @@ dependencies = [ "aptos-keygen", "aptos-language-e2e-tests", "aptos-logger", + "aptos-package-builder", "aptos-state-view", "aptos-types", "aptos-vm", @@ -4055,7 +4353,6 @@ dependencies = [ "move-core-types", "move-package", "move-symbol-pool", - "package-builder", "project-root", "proptest", "rand 0.7.3", @@ -4232,6 +4529,7 @@ version = "0.1.0" dependencies = [ "aptos-config", "aptos-crypto", + "aptos-db", "aptos-executor", "aptos-executor-types", "aptos-genesis", @@ -4239,6 +4537,7 @@ dependencies = [ "aptos-jellyfish-merkle", "aptos-logger", "aptos-push-metrics", + "aptos-schemadb", "aptos-scratchpad", "aptos-sdk", "aptos-state-view", @@ -4246,7 +4545,6 @@ dependencies = [ "aptos-temppath", "aptos-types", "aptos-vm", - "aptosdb", "chrono", "criterion", "indicatif", @@ -4255,7 +4553,6 @@ dependencies = [ "num_cpus", "rand 0.7.3", "rayon", - "schemadb", "serde 1.0.149", "structopt", "toml", @@ -4556,10 +4853,10 @@ dependencies = [ "aptos-consensus-types", "aptos-crypto", "aptos-crypto-derive", + "aptos-network", "aptos-types", "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", "move-core-types", - "network", "rand 0.7.3", "serde 1.0.149", "serde-reflection", @@ -5785,42 +6082,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" [[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "mempool-notifications" -version = "0.1.0" -dependencies = [ - "aptos-crypto", - "aptos-types", - "async-trait", - "claims", - "futures", - "serde 1.0.149", - "thiserror", - "tokio", -] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] -name = "memsocket" -version = "0.1.0" +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ - "aptos-infallible", - "bytes 1.2.1", - "futures", - "once_cell", + "autocfg", ] [[package]] @@ -6226,22 +6499,6 @@ dependencies = [ "serde 1.0.149", ] -[[package]] -name = "move-examples" -version = "0.1.0" -dependencies = [ - "aptos-gas", - "aptos-types", - "aptos-vm", - "clap 3.2.17", - "move-cli", - "move-package", - "move-prover", - "move-unit-test", - "move-vm-runtime", - "tempfile", -] - [[package]] name = "move-ir-compiler" version = "0.1.0" @@ -6699,21 +6956,6 @@ dependencies = [ "twoway", ] -[[package]] -name = "mvhashmap" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-aggregator", - "aptos-types", - "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", - "crossbeam", - "dashmap", - "proptest", - "proptest-derive", - "rayon", -] - [[package]] name = "named-lock" version = "0.2.0" @@ -6746,138 +6988,12 @@ dependencies = [ "tempfile", ] -[[package]] -name = "netcore" -version = "0.1.0" -dependencies = [ - "aptos-types", - "bytes 1.2.1", - "futures", - "memsocket", - "pin-project", - "proxy", - "serde 1.0.149", - "tokio", - "tokio-util 0.7.3", - "url", -] - -[[package]] -name = "network" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-bitvec", - "aptos-compression", - "aptos-config", - "aptos-crypto", - "aptos-crypto-derive", - "aptos-id-generator", - "aptos-infallible", - "aptos-logger", - "aptos-metrics-core", - "aptos-proptest-helpers", - "aptos-rate-limiter", - "aptos-short-hex-str", - "aptos-time-service", - "aptos-types", - "async-trait", - "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", - "bytes 1.2.1", - "channel", - "futures", - "futures-util", - "hex", - "itertools", - "maplit", - "memsocket", - "netcore", - "num-variants", - "once_cell", - "pin-project", - "proptest", - "proptest-derive", - "rand 0.7.3", - "rand_core 0.5.1", - "serde 1.0.149", - "serde_bytes", - "serde_json", - "thiserror", - "tokio", - "tokio-retry", - "tokio-util 0.7.3", -] - -[[package]] -name = "network-builder" -version = "0.1.0" -dependencies = [ - "aptos-config", - "aptos-crypto", - "aptos-event-notifications", - "aptos-infallible", - "aptos-logger", - "aptos-secure-storage", - "aptos-time-service", - "aptos-types", - "async-trait", - "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", - "channel", - "futures", - "netcore", - "network", - "network-discovery", - "rand 0.7.3", - "serde 1.0.149", - "tokio", -] - -[[package]] -name = "network-discovery" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-config", - "aptos-crypto", - "aptos-event-notifications", - "aptos-logger", - "aptos-metrics-core", - "aptos-secure-storage", - "aptos-short-hex-str", - "aptos-temppath", - "aptos-time-service", - "aptos-types", - "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", - "channel", - "futures", - "netcore", - "network", - "once_cell", - "rand 0.7.3", - "serde_yaml 0.8.26", - "tokio", -] - [[package]] name = "new_debug_unreachable" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" -[[package]] -name = "node-resource-metrics" -version = "0.1.0" -dependencies = [ - "aptos-infallible", - "aptos-logger", - "aptos-metrics-core", - "cfg-if", - "once_cell", - "procfs", - "prometheus", - "sysinfo", -] - [[package]] name = "nom" version = "5.1.2" @@ -7010,15 +7126,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num-variants" -version = "0.1.0" -dependencies = [ - "proc-macro2 1.0.47", - "quote 1.0.21", - "syn 1.0.105", -] - [[package]] name = "num_cpus" version = "1.13.1" @@ -7163,18 +7270,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "package-builder" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-framework", - "itertools", - "move-command-line-common", - "move-package", - "tempfile", -] - [[package]] name = "parity-scale-codec" version = "2.3.1" @@ -7285,51 +7380,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -[[package]] -name = "peer-monitoring-service-client" -version = "0.1.0" -dependencies = [ - "aptos-config", - "aptos-types", - "async-trait", - "channel", - "network", - "peer-monitoring-service-types", - "thiserror", -] - -[[package]] -name = "peer-monitoring-service-server" -version = "0.1.0" -dependencies = [ - "aptos-bounded-executor", - "aptos-config", - "aptos-logger", - "aptos-metrics-core", - "aptos-types", - "bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)", - "bytes 1.2.1", - "channel", - "futures", - "netcore", - "network", - "once_cell", - "peer-monitoring-service-types", - "serde 1.0.149", - "thiserror", - "tokio", -] - -[[package]] -name = "peer-monitoring-service-types" -version = "0.1.0" -dependencies = [ - "aptos-config", - "network", - "serde 1.0.149", - "thiserror", -] - [[package]] name = "pem" version = "0.8.3" @@ -7927,13 +7977,6 @@ dependencies = [ "prost", ] -[[package]] -name = "proxy" -version = "0.1.0" -dependencies = [ - "ipnet", -] - [[package]] name = "psl-types" version = "2.0.11" @@ -8571,34 +8614,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" -[[package]] -name = "safety-rules" -version = "0.1.0" -dependencies = [ - "aptos-config", - "aptos-consensus-types", - "aptos-crypto", - "aptos-global-constants", - "aptos-infallible", - "aptos-logger", - "aptos-metrics-core", - "aptos-proptest-helpers", - "aptos-secure-net", - "aptos-secure-storage", - "aptos-temppath", - "aptos-types", - "aptos-vault-client", - "criterion", - "once_cell", - "proptest", - "rand 0.7.3", - "rusty-fork", - "serde 1.0.149", - "serde_json", - "tempfile", - "thiserror", -] - [[package]] name = "same-file" version = "1.0.6" @@ -8627,21 +8642,6 @@ dependencies = [ "parking_lot 0.12.1", ] -[[package]] -name = "schemadb" -version = "0.1.0" -dependencies = [ - "anyhow", - "aptos-infallible", - "aptos-logger", - "aptos-metrics-core", - "aptos-temppath", - "byteorder", - "once_cell", - "proptest", - "rocksdb", -] - [[package]] name = "scoped-tls" version = "1.0.0" diff --git a/Cargo.toml b/Cargo.toml index a3af683ea6b94..4b026f05534f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -188,6 +188,8 @@ aptos-crypto = { path = "crates/aptos-crypto" } aptos-crypto-derive = { path = "crates/aptos-crypto-derive" } aptos-data-client = { path = "state-sync/aptos-data-client" } aptos-data-streaming-service = { path = "state-sync/state-sync-v2/data-streaming-service" } +aptos-db = { path = "storage/aptosdb" } +aptos-db-indexer = { path = "storage/indexer" } aptos-debugger = { path = "aptos-move/aptos-debugger" } aptos-event-notifications = { path = "state-sync/inter-component/event-notifications" } aptos-executor = { path = "execution/executor" } @@ -213,14 +215,27 @@ aptos-language-e2e-tests = { path = "aptos-move/e2e-tests" } aptos-log-derive = { path = "crates/aptos-log-derive" } aptos-logger = { path = "crates/aptos-logger" } aptos-mempool = { path = "mempool" } +aptos-mempool-notifications = { path = "state-sync/inter-component/mempool-notifications" } +aptos-memsocket = { path = "network/memsocket" } aptos-metrics-core = { path = "crates/aptos-metrics-core" } aptos-module-verifier = { path = "aptos-move/aptos-module-verifier" } +aptos-move-examples = { path = "aptos-move/move-examples" } +aptos-mvhashmap = { path = "aptos-move/mvhashmap" } +aptos-netcore = { path = "network/netcore" } +aptos-network = { path = "network" } +aptos-network-builder = { path = "network/builder" } aptos-network-checker = { path = "crates/aptos-network-checker" } +aptos-network-discovery = { path = "network/discovery" } aptos-node = { path = "aptos-node" } aptos-node-checker = { path = "ecosystem/node-checker" } +aptos-node-resource-metrics = { path = "crates/node-resource-metrics" } +aptos-num-variants = { path = "crates/num-variants" } aptos-openapi = { path = "crates/aptos-openapi" } +aptos-package-builder = { path = "aptos-move/package-builder" } +aptos-peer-monitoring-service-types = { path = "network/peer-monitoring-service/types" } aptos-proptest-helpers = { path = "crates/aptos-proptest-helpers" } aptos-protos = { path = "crates/aptos-protos" } +aptos-proxy = { path = "crates/proxy" } aptos-push-metrics = { path = "crates/aptos-push-metrics" } aptos-rate-limiter = { path = "crates/aptos-rate-limiter" } aptos-release-builder = { path = "aptos-move/aptos-release-builder" } @@ -229,6 +244,8 @@ aptos-rest-client = { path = "crates/aptos-rest-client" } aptos-retrier = { path = "crates/aptos-retrier" } aptos-rocksdb-options = { path = "storage/rocksdb-options" } aptos-rosetta = { path = "crates/aptos-rosetta" } +aptos-safety-rules = { path = "consensus/safety-rules" } +aptos-schemadb = { path = "storage/schemadb" } aptos-scratchpad = { path = "storage/scratchpad" } aptos-sdk = { path = "sdk" } aptos-sdk-builder = { path = "aptos-move/aptos-sdk-builder" } @@ -256,24 +273,7 @@ aptos-vm-genesis = { path = "aptos-move/vm-genesis" } aptos-vm-validator = { path = "vm-validator" } aptos-warp-webserver = { path = "crates/aptos-warp-webserver" } aptos-writeset-generator = { path = "aptos-move/writeset-transaction-generator" } -aptosdb = { path = "storage/aptosdb" } -aptosdb-indexer = { path = "storage/indexer" } channel = { path = "crates/channel" } -mempool-notifications = { path = "state-sync/inter-component/mempool-notifications" } -memsocket = { path = "network/memsocket" } -move-examples = { path = "aptos-move/move-examples" } -mvhashmap = { path = "aptos-move/mvhashmap" } -netcore = { path = "network/netcore" } -network = { path = "network" } -network-builder = { path = "network/builder" } -network-discovery = { path = "network/discovery" } -node-resource-metrics = { path = "crates/node-resource-metrics" } -num-variants = { path = "crates/num-variants" } -package-builder = { path = "aptos-move/package-builder" } -peer-monitoring-service-types = { path = "network/peer-monitoring-service/types" } -proxy = { path = "crates/proxy" } -safety-rules = { path = "consensus/safety-rules" } -schemadb = { path = "storage/schemadb" } # External crate dependencies. # Please do not add any test features here: they should be declared by the individual crate. diff --git a/api/test-context/Cargo.toml b/api/test-context/Cargo.toml index 8dfdd9dde31d5..0700fb34a5382 100644 --- a/api/test-context/Cargo.toml +++ b/api/test-context/Cargo.toml @@ -19,21 +19,21 @@ aptos-api-types = { workspace = true } aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true, features = ["fuzzing"] } aptos-executor = { workspace = true } aptos-executor-types = { workspace = true } aptos-genesis = { workspace = true } aptos-mempool = { workspace = true, features = ["fuzzing"] } +aptos-mempool-notifications = { workspace = true } aptos-sdk = { workspace = true } aptos-storage-interface = { workspace = true } aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } aptos-vm-validator = { workspace = true } -aptosdb = { workspace = true, features = ["fuzzing"] } bytes = { workspace = true } goldenfile = { workspace = true } hyper = { workspace = true } -mempool-notifications = { workspace = true } poem = { workspace = true } poem-openapi = { workspace = true } proptest = { workspace = true } diff --git a/api/test-context/src/test_context.rs b/api/test-context/src/test_context.rs index a9d760c97f84b..eb5e89dec6791 100644 --- a/api/test-context/src/test_context.rs +++ b/api/test-context/src/test_context.rs @@ -12,9 +12,11 @@ use aptos_config::config::{ DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, NO_OP_STORAGE_PRUNER_CONFIG, }; use aptos_crypto::{hash::HashValue, SigningKey}; +use aptos_db::AptosDB; use aptos_executor::{block_executor::BlockExecutor, db_bootstrapper}; use aptos_executor_types::BlockExecutorTrait; use aptos_mempool::mocks::MockSharedMempool; +use aptos_mempool_notifications::MempoolNotificationSender; use aptos_sdk::{ transaction_builder::TransactionFactory, types::{ @@ -33,10 +35,8 @@ use aptos_types::{ transaction::{Transaction, TransactionStatus}, }; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use bytes::Bytes; use hyper::{HeaderMap, Response}; -use mempool_notifications::MempoolNotificationSender; use aptos_config::keys::ConfigKey; use aptos_crypto::ed25519::Ed25519PrivateKey; diff --git a/aptos-move/aptos-gas/Cargo.toml b/aptos-move/aptos-gas/Cargo.toml index e6f8c36c60dc7..c25407773d21e 100644 --- a/aptos-move/aptos-gas/Cargo.toml +++ b/aptos-move/aptos-gas/Cargo.toml @@ -17,6 +17,7 @@ anyhow = { workspace = true } aptos-framework = { workspace = true } aptos-gas-algebra-ext = { workspace = true } aptos-global-constants = { workspace = true } +aptos-package-builder = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } clap = { workspace = true } @@ -26,7 +27,6 @@ move-model = { workspace = true } move-stdlib = { workspace = true } move-table-extension = { workspace = true } move-vm-types = { workspace = true } -package-builder = { workspace = true } [dev-dependencies] tempfile = { workspace = true } diff --git a/aptos-move/aptos-gas/src/gen.rs b/aptos-move/aptos-gas/src/gen.rs index 1246c9840b05d..44764bb46a7b9 100644 --- a/aptos-move/aptos-gas/src/gen.rs +++ b/aptos-move/aptos-gas/src/gen.rs @@ -5,11 +5,11 @@ use crate::gas_meter::{ AptosGasParameters, InitialGasSchedule, ToOnChainGasSchedule, LATEST_GAS_FEATURE_VERSION, }; use anyhow::Result; +use aptos_package_builder::PackageBuilder; use aptos_types::on_chain_config::GasScheduleV2; use clap::Parser; use move_core_types::account_address::AccountAddress; use move_model::{code_writer::CodeWriter, emit, emitln, model::Loc}; -use package_builder::PackageBuilder; use std::path::{Path, PathBuf}; pub fn current_gas_schedule() -> GasScheduleV2 { diff --git a/aptos-move/aptos-validator-interface/Cargo.toml b/aptos-move/aptos-validator-interface/Cargo.toml index 409657b716cf8..8985acf49e6c8 100644 --- a/aptos-move/aptos-validator-interface/Cargo.toml +++ b/aptos-move/aptos-validator-interface/Cargo.toml @@ -16,11 +16,11 @@ rust-version = { workspace = true } anyhow = { workspace = true } aptos-api-types = { workspace = true } aptos-config = { workspace = true } +aptos-db = { workspace = true } aptos-rest-client = { workspace = true } aptos-state-view = { workspace = true } aptos-storage-interface = { workspace = true } aptos-types = { workspace = true } -aptosdb = { workspace = true } async-trait = { workspace = true } move-binary-format = { workspace = true } tokio = { workspace = true } diff --git a/aptos-move/aptos-validator-interface/src/storage_interface.rs b/aptos-move/aptos-validator-interface/src/storage_interface.rs index a6c8adf1d2fc7..4a19620f99c48 100644 --- a/aptos-move/aptos-validator-interface/src/storage_interface.rs +++ b/aptos-move/aptos-validator-interface/src/storage_interface.rs @@ -7,6 +7,7 @@ use aptos_config::config::{ RocksdbConfigs, BUFFERED_STATE_TARGET_ITEMS, DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, NO_OP_STORAGE_PRUNER_CONFIG, }; +use aptos_db::AptosDB; use aptos_storage_interface::{DbReader, MAX_REQUEST_LIMIT}; use aptos_types::{ account_address::AccountAddress, @@ -14,7 +15,6 @@ use aptos_types::{ state_store::{state_key::StateKey, state_key_prefix::StateKeyPrefix, state_value::StateValue}, transaction::{Transaction, Version}, }; -use aptosdb::AptosDB; use std::{path::Path, sync::Arc}; pub struct DBDebuggerInterface(Arc); diff --git a/aptos-move/aptos-vm/Cargo.toml b/aptos-move/aptos-vm/Cargo.toml index 9c756a76f5b94..83ad928d3ffd0 100644 --- a/aptos-move/aptos-vm/Cargo.toml +++ b/aptos-move/aptos-vm/Cargo.toml @@ -23,6 +23,7 @@ aptos-gas = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } aptos-module-verifier = { workspace = true } +aptos-mvhashmap = { workspace = true } aptos-state-view = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } @@ -38,7 +39,6 @@ move-unit-test = { workspace = true, optional = true } move-vm-runtime = { workspace = true } move-vm-test-utils = { workspace = true } move-vm-types = { workspace = true } -mvhashmap = { workspace = true } num_cpus = { workspace = true } once_cell = { workspace = true } rayon = { workspace = true } diff --git a/aptos-move/block-executor/Cargo.toml b/aptos-move/block-executor/Cargo.toml index 4fc182e134f9b..1aff24ee87182 100644 --- a/aptos-move/block-executor/Cargo.toml +++ b/aptos-move/block-executor/Cargo.toml @@ -17,6 +17,7 @@ anyhow = { workspace = true } aptos-aggregator = { workspace = true } aptos-infallible = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-mvhashmap = { workspace = true } aptos-state-view = { workspace = true } aptos-types = { workspace = true } arc-swap = { workspace = true } @@ -25,7 +26,6 @@ criterion = { workspace = true, optional = true } crossbeam = { workspace = true } crossbeam-queue = { workspace = true } dashmap = { workspace = true } -mvhashmap = { workspace = true } num_cpus = { workspace = true } once_cell = { workspace = true } proptest = { workspace = true, optional = true } diff --git a/aptos-move/block-executor/src/executor.rs b/aptos-move/block-executor/src/executor.rs index 14e2510a0aff7..60fb101c41640 100644 --- a/aptos-move/block-executor/src/executor.rs +++ b/aptos-move/block-executor/src/executor.rs @@ -11,8 +11,8 @@ use crate::{ }; use aptos_aggregator::delta_change_set::DeltaOp; use aptos_infallible::Mutex; +use aptos_mvhashmap::{MVHashMap, MVHashMapError, MVHashMapOutput}; use aptos_types::write_set::TransactionWrite; -use mvhashmap::{MVHashMap, MVHashMapError, MVHashMapOutput}; use num_cpus; use once_cell::sync::Lazy; use std::{collections::btree_map::BTreeMap, hash::Hash, marker::PhantomData, sync::Arc}; diff --git a/aptos-move/block-executor/src/output_delta_resolver.rs b/aptos-move/block-executor/src/output_delta_resolver.rs index 726d838b42640..7521323687684 100644 --- a/aptos-move/block-executor/src/output_delta_resolver.rs +++ b/aptos-move/block-executor/src/output_delta_resolver.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use aptos_aggregator::delta_change_set::{deserialize, serialize}; +use aptos_mvhashmap::{EntryCell, MVHashMap}; use aptos_types::write_set::{TransactionWrite, WriteOp}; -use mvhashmap::{EntryCell, MVHashMap}; use std::{hash::Hash, thread::spawn}; /// Resolved and serialized data for WriteOps, None means deletion. diff --git a/aptos-move/e2e-move-tests/Cargo.toml b/aptos-move/e2e-move-tests/Cargo.toml index 268a457ec587b..d46d74f97ae61 100644 --- a/aptos-move/e2e-move-tests/Cargo.toml +++ b/aptos-move/e2e-move-tests/Cargo.toml @@ -23,6 +23,7 @@ aptos-gas = { workspace = true, features = ["testing"] } aptos-keygen = { workspace = true } aptos-language-e2e-tests = { workspace = true } aptos-logger = { workspace = true } +aptos-package-builder = { workspace = true } aptos-state-view = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } @@ -34,7 +35,6 @@ itertools = { workspace = true } move-core-types = { workspace = true } move-package = { workspace = true } move-symbol-pool = { workspace = true } -package-builder = { workspace = true } project-root = { workspace = true } proptest = { workspace = true } rand = { workspace = true } diff --git a/aptos-move/e2e-move-tests/src/tests/code_publishing.rs b/aptos-move/e2e-move-tests/src/tests/code_publishing.rs index cc62233d6ce08..ab93de7bf7917 100644 --- a/aptos-move/e2e-move-tests/src/tests/code_publishing.rs +++ b/aptos-move/e2e-move-tests/src/tests/code_publishing.rs @@ -3,11 +3,11 @@ use crate::{assert_abort, assert_success, assert_vm_status, tests::common, MoveHarness}; use aptos_framework::natives::code::{PackageRegistry, UpgradePolicy}; +use aptos_package_builder::PackageBuilder; use aptos_types::account_address::{create_resource_address, AccountAddress}; use aptos_types::on_chain_config::FeatureFlag; use move_core_types::parser::parse_struct_tag; use move_core_types::vm_status::StatusCode; -use package_builder::PackageBuilder; use rstest::rstest; use serde::{Deserialize, Serialize}; diff --git a/aptos-move/e2e-move-tests/src/tests/generate_upgrade_script.rs b/aptos-move/e2e-move-tests/src/tests/generate_upgrade_script.rs index 7b788e8a24d36..323590c624c26 100644 --- a/aptos-move/e2e-move-tests/src/tests/generate_upgrade_script.rs +++ b/aptos-move/e2e-move-tests/src/tests/generate_upgrade_script.rs @@ -3,9 +3,9 @@ use crate::{tests::common, MoveHarness}; use aptos_framework::{BuildOptions, BuiltPackage, ReleasePackage}; +use aptos_package_builder::PackageBuilder; use aptos_types::account_address::AccountAddress; use move_package::compilation::package_layout::CompiledPackageLayout; -use package_builder::PackageBuilder; #[test] fn generate_upgrade_script() { diff --git a/aptos-move/e2e-move-tests/src/tests/init_module.rs b/aptos-move/e2e-move-tests/src/tests/init_module.rs index ade06aeac967e..afc8e215c3be4 100644 --- a/aptos-move/e2e-move-tests/src/tests/init_module.rs +++ b/aptos-move/e2e-move-tests/src/tests/init_module.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{assert_abort, assert_success, tests::common, MoveHarness}; +use aptos_package_builder::PackageBuilder; use aptos_types::account_address::AccountAddress; use move_core_types::parser::parse_struct_tag; -use package_builder::PackageBuilder; use serde::{Deserialize, Serialize}; /// Mimics `0xcafe::test::ModuleData` diff --git a/aptos-move/e2e-move-tests/src/tests/lazy_natives.rs b/aptos-move/e2e-move-tests/src/tests/lazy_natives.rs index 86995b7763f29..162ae55945eff 100644 --- a/aptos-move/e2e-move-tests/src/tests/lazy_natives.rs +++ b/aptos-move/e2e-move-tests/src/tests/lazy_natives.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{assert_success, assert_vm_status, MoveHarness}; +use aptos_package_builder::PackageBuilder; use aptos_types::account_address::AccountAddress; use move_core_types::vm_status::StatusCode; -use package_builder::PackageBuilder; #[test] fn lazy_natives() { diff --git a/aptos-move/e2e-move-tests/src/tests/new_integer_types.rs b/aptos-move/e2e-move-tests/src/tests/new_integer_types.rs index 8ef71f93019a8..09e246dcb5ac6 100644 --- a/aptos-move/e2e-move-tests/src/tests/new_integer_types.rs +++ b/aptos-move/e2e-move-tests/src/tests/new_integer_types.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use crate::{assert_success, MoveHarness}; +use aptos_package_builder::PackageBuilder; use aptos_types::account_address::AccountAddress; use move_core_types::{u256::U256, value::MoveValue}; -use package_builder::PackageBuilder; #[test] fn use_new_integer_types() { diff --git a/aptos-move/e2e-move-tests/src/tests/vector_numeric_address.rs b/aptos-move/e2e-move-tests/src/tests/vector_numeric_address.rs index 9e57e444b9da8..61d0ce23c372c 100644 --- a/aptos-move/e2e-move-tests/src/tests/vector_numeric_address.rs +++ b/aptos-move/e2e-move-tests/src/tests/vector_numeric_address.rs @@ -3,8 +3,8 @@ use crate::tests::common; use crate::{assert_success, MoveHarness}; +use aptos_package_builder::PackageBuilder; use aptos_types::account_address::AccountAddress; -use package_builder::PackageBuilder; /// Test whether `0x1::vector` (and not just `std::vector`) works as expected. #[test] diff --git a/aptos-move/move-examples/Cargo.toml b/aptos-move/move-examples/Cargo.toml index 1deeb965a1ebb..3e781d3accb6b 100644 --- a/aptos-move/move-examples/Cargo.toml +++ b/aptos-move/move-examples/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "move-examples" +name = "aptos-move-examples" description = "Move examples" version = "0.1.0" diff --git a/aptos-move/mvhashmap/Cargo.toml b/aptos-move/mvhashmap/Cargo.toml index 377b62c774b24..76fdb3b2041be 100644 --- a/aptos-move/mvhashmap/Cargo.toml +++ b/aptos-move/mvhashmap/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mvhashmap" +name = "aptos-mvhashmap" description = "Move hash map" version = "0.1.0" diff --git a/aptos-move/package-builder/Cargo.toml b/aptos-move/package-builder/Cargo.toml index 041515ba51615..8a97ecbea56e5 100644 --- a/aptos-move/package-builder/Cargo.toml +++ b/aptos-move/package-builder/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "package-builder" +name = "aptos-package-builder" description = "Helper for building Move packages for tests" version = "0.1.0" diff --git a/aptos-node/Cargo.toml b/aptos-node/Cargo.toml index ddb4d555893c5..17d76bd72dc6e 100644 --- a/aptos-node/Cargo.toml +++ b/aptos-node/Cargo.toml @@ -25,6 +25,7 @@ aptos-crash-handler = { workspace = true } aptos-crypto = { workspace = true } aptos-data-client = { workspace = true } aptos-data-streaming-service = { workspace = true } +aptos-db = { workspace = true } aptos-event-notifications = { workspace = true } aptos-executor = { workspace = true } aptos-executor-types = { workspace = true } @@ -35,6 +36,9 @@ aptos-infallible = { workspace = true } aptos-inspection-service = { workspace = true } aptos-logger = { workspace = true } aptos-mempool = { workspace = true } +aptos-mempool-notifications = { workspace = true } +aptos-network = { workspace = true } +aptos-network-builder = { workspace = true } aptos-secure-storage = { workspace = true } aptos-state-sync-driver = { workspace = true } aptos-state-view = { workspace = true } @@ -46,15 +50,11 @@ aptos-temppath = { workspace = true } aptos-time-service = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } -aptosdb = { workspace = true } bcs = { workspace = true } clap = { workspace = true } fail = { workspace = true } futures = { workspace = true } hex = { workspace = true } -mempool-notifications = { workspace = true } -network = { workspace = true } -network-builder = { workspace = true } rand = { workspace = true } rayon = { workspace = true } tokio = { workspace = true } diff --git a/aptos-node/src/lib.rs b/aptos-node/src/lib.rs index 50efbde54c204..1bafcbd501189 100644 --- a/aptos-node/src/lib.rs +++ b/aptos-node/src/lib.rs @@ -34,9 +34,13 @@ use aptos_types::{ on_chain_config::ON_CHAIN_CONFIG_REGISTRY, waypoint::Waypoint, }; +use aptos_db::AptosDB; use aptos_event_notifications::EventSubscriptionService; use aptos_executor::{chunk_executor::ChunkExecutor, db_bootstrapper::maybe_bootstrap}; use aptos_framework::ReleaseBundle; +use aptos_mempool_notifications::MempoolNotificationSender; +use aptos_network::application::storage::PeerMetadataStorage; +use aptos_network_builder::builder::NetworkBuilder; use aptos_state_sync_driver::{ driver_factory::{DriverFactory, StateSyncRuntimes}, metadata_storage::PersistentMetadataStorage, @@ -47,14 +51,10 @@ use aptos_storage_service_server::{ network::StorageServiceNetworkEvents, StorageReader, StorageServiceServer, }; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use clap::Parser; use futures::channel::mpsc; use hex::FromHex; use log_build_information::log_build_information; -use mempool_notifications::MempoolNotificationSender; -use network::application::storage::PeerMetadataStorage; -use network_builder::builder::NetworkBuilder; use rand::{rngs::StdRng, SeedableRng}; use std::{ boxed::Box, @@ -817,7 +817,7 @@ pub fn setup_environment( // For state sync to send notifications to mempool and receive notifications from consensus. let (mempool_notifier, mempool_listener) = - mempool_notifications::new_mempool_notifier_listener_pair(); + aptos_mempool_notifications::new_mempool_notifier_listener_pair(); let (consensus_notifier, consensus_listener) = aptos_consensus_notifications::new_consensus_notifier_listener_pair( node_config diff --git a/config/src/config/network_config.rs b/config/src/config/network_config.rs index 409ca89db8cab..0fd125a330cf8 100644 --- a/config/src/config/network_config.rs +++ b/config/src/config/network_config.rs @@ -31,7 +31,7 @@ use std::{ // TODO: We could possibly move these constants somewhere else, but since they are defaults for the // configurations of the system, we'll leave it here for now. /// Current supported protocol negotiation handshake version. See -/// [`network::protocols::wire::v1`](../../network/protocols/wire/handshake/v1/index.html). +/// [`aptos_network::protocols::wire::v1`](../../network/protocols/wire/handshake/v1/index.html). pub const HANDSHAKE_VERSION: u8 = 0; pub const NETWORK_CHANNEL_SIZE: usize = 1024; pub const PING_INTERVAL_MS: u64 = 10_000; diff --git a/consensus/Cargo.toml b/consensus/Cargo.toml index 8d695a0800ca1..037b67010c193 100644 --- a/consensus/Cargo.toml +++ b/consensus/Cargo.toml @@ -27,6 +27,9 @@ aptos-infallible = { workspace = true } aptos-logger = { workspace = true } aptos-mempool = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-network = { workspace = true } +aptos-safety-rules = { workspace = true } +aptos-schemadb = { workspace = true } aptos-secure-storage = { workspace = true } aptos-short-hex-str = { workspace = true } aptos-storage-interface = { workspace = true } @@ -44,13 +47,10 @@ futures = { workspace = true } futures-channel = { workspace = true } itertools = { workspace = true } mirai-annotations = { workspace = true } -network = { workspace = true } num-derive = { workspace = true } num-traits = { workspace = true } once_cell = { workspace = true } rand = { workspace = true } -safety-rules = { workspace = true } -schemadb = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } @@ -62,15 +62,15 @@ aptos-consensus-types = { workspace = true, features = ["fuzzing"] } aptos-executor-test-helpers = { workspace = true } aptos-keygen = { workspace = true } aptos-mempool = { workspace = true, features = ["fuzzing"] } +aptos-network = { workspace = true, features = ["fuzzing"] } +aptos-safety-rules = { workspace = true, features = ["testing"] } aptos-vm-validator = { workspace = true } claims = { workspace = true } move-core-types = { workspace = true } -network = { workspace = true, features = ["fuzzing"] } proptest = { workspace = true } -safety-rules = { workspace = true, features = ["testing"] } tempfile = { workspace = true } [features] default = [] -fuzzing = ["aptos-consensus-types/fuzzing", "aptos-config/fuzzing", "aptos-crypto/fuzzing", "aptos-mempool/fuzzing", "aptos-types/fuzzing", "safety-rules/testing"] +fuzzing = ["aptos-consensus-types/fuzzing", "aptos-config/fuzzing", "aptos-crypto/fuzzing", "aptos-mempool/fuzzing", "aptos-types/fuzzing", "aptos-safety-rules/testing"] failpoints = ["fail/failpoints"] diff --git a/consensus/safety-rules/Cargo.toml b/consensus/safety-rules/Cargo.toml index 8c21f30a4783e..0b85516acacf8 100644 --- a/consensus/safety-rules/Cargo.toml +++ b/consensus/safety-rules/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "safety-rules" +name = "aptos-safety-rules" description = "Aptos safety rules" version = "0.1.0" diff --git a/consensus/safety-rules/benches/safety_rules.rs b/consensus/safety-rules/benches/safety_rules.rs index 048b8158ba411..f00075fc14755 100644 --- a/consensus/safety-rules/benches/safety_rules.rs +++ b/consensus/safety-rules/benches/safety_rules.rs @@ -2,10 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 use aptos_consensus_types::block::block_test_utils; +use aptos_safety_rules::{test_utils, PersistentSafetyStorage, SafetyRulesManager, TSafetyRules}; use aptos_secure_storage::{InMemoryStorage, KVStorage, OnDiskStorage, Storage, VaultStorage}; use aptos_types::validator_signer::ValidatorSigner; use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use safety_rules::{test_utils, PersistentSafetyStorage, SafetyRulesManager, TSafetyRules}; use tempfile::NamedTempFile; const VAULT_HOST: &str = "http://localhost:8200"; diff --git a/consensus/src/consensus_provider.rs b/consensus/src/consensus_provider.rs index 46283186c5c44..ff1ba03140fec 100644 --- a/consensus/src/consensus_provider.rs +++ b/consensus/src/consensus_provider.rs @@ -17,10 +17,10 @@ use aptos_event_notifications::ReconfigNotificationListener; use aptos_executor::block_executor::BlockExecutor; use aptos_logger::prelude::*; use aptos_mempool::QuorumStoreRequest; +use aptos_network::application::storage::PeerMetadataStorage; use aptos_storage_interface::DbReaderWriter; use aptos_vm::AptosVM; use futures::channel::mpsc; -use network::application::storage::PeerMetadataStorage; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, diff --git a/consensus/src/consensusdb/mod.rs b/consensus/src/consensusdb/mod.rs index 8d92a1681e71c..b44d0d58f5cae 100644 --- a/consensus/src/consensusdb/mod.rs +++ b/consensus/src/consensusdb/mod.rs @@ -17,8 +17,8 @@ use anyhow::Result; use aptos_consensus_types::{block::Block, quorum_cert::QuorumCert}; use aptos_crypto::HashValue; use aptos_logger::prelude::*; +use aptos_schemadb::{Options, ReadOptions, SchemaBatch, DB, DEFAULT_COLUMN_FAMILY_NAME}; use schema::{BLOCK_CF_NAME, QC_CF_NAME, SINGLE_ENTRY_CF_NAME}; -use schemadb::{Options, ReadOptions, SchemaBatch, DB, DEFAULT_COLUMN_FAMILY_NAME}; use std::{collections::HashMap, iter::Iterator, path::Path, time::Instant}; /// The name of the consensus db file diff --git a/consensus/src/consensusdb/schema/block/mod.rs b/consensus/src/consensusdb/schema/block/mod.rs index c7ee5b7b53492..f3663d4c74e70 100644 --- a/consensus/src/consensusdb/schema/block/mod.rs +++ b/consensus/src/consensusdb/schema/block/mod.rs @@ -13,13 +13,13 @@ use super::BLOCK_CF_NAME; use anyhow::Result; use aptos_consensus_types::block::Block; use aptos_crypto::HashValue; -use schemadb::schema::{KeyCodec, Schema, ValueCodec}; +use aptos_schemadb::schema::{KeyCodec, Schema, ValueCodec}; #[derive(Debug)] pub struct BlockSchema; impl Schema for BlockSchema { - const COLUMN_FAMILY_NAME: schemadb::ColumnFamilyName = BLOCK_CF_NAME; + const COLUMN_FAMILY_NAME: aptos_schemadb::ColumnFamilyName = BLOCK_CF_NAME; type Key = HashValue; type Value = Block; } diff --git a/consensus/src/consensusdb/schema/block/test.rs b/consensus/src/consensusdb/schema/block/test.rs index 1838d31213314..0c5fda0f8ce77 100644 --- a/consensus/src/consensusdb/schema/block/test.rs +++ b/consensus/src/consensusdb/schema/block/test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; #[test] fn test_encode_decode() { diff --git a/consensus/src/consensusdb/schema/mod.rs b/consensus/src/consensusdb/schema/mod.rs index b0fc48f8e155d..f26be7b85b726 100644 --- a/consensus/src/consensusdb/schema/mod.rs +++ b/consensus/src/consensusdb/schema/mod.rs @@ -6,7 +6,7 @@ pub(crate) mod quorum_certificate; pub(crate) mod single_entry; use anyhow::{ensure, Result}; -use schemadb::ColumnFamilyName; +use aptos_schemadb::ColumnFamilyName; pub(super) const BLOCK_CF_NAME: ColumnFamilyName = "block"; pub(super) const QC_CF_NAME: ColumnFamilyName = "quorum_certificate"; diff --git a/consensus/src/consensusdb/schema/quorum_certificate/mod.rs b/consensus/src/consensusdb/schema/quorum_certificate/mod.rs index 9977e7e5d8c6e..7e24510bf93cc 100644 --- a/consensus/src/consensusdb/schema/quorum_certificate/mod.rs +++ b/consensus/src/consensusdb/schema/quorum_certificate/mod.rs @@ -13,7 +13,7 @@ use super::QC_CF_NAME; use anyhow::Result; use aptos_consensus_types::quorum_cert::QuorumCert; use aptos_crypto::HashValue; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; diff --git a/consensus/src/consensusdb/schema/quorum_certificate/test.rs b/consensus/src/consensusdb/schema/quorum_certificate/test.rs index e3eaee95036d3..d769aa9928434 100644 --- a/consensus/src/consensusdb/schema/quorum_certificate/test.rs +++ b/consensus/src/consensusdb/schema/quorum_certificate/test.rs @@ -3,7 +3,7 @@ use super::*; use aptos_consensus_types::block::block_test_utils::certificate_for_genesis; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; #[test] fn test_encode_decode() { diff --git a/consensus/src/consensusdb/schema/single_entry/mod.rs b/consensus/src/consensusdb/schema/single_entry/mod.rs index 5747ebecc8419..31f6cdbd607b9 100644 --- a/consensus/src/consensusdb/schema/single_entry/mod.rs +++ b/consensus/src/consensusdb/schema/single_entry/mod.rs @@ -14,13 +14,13 @@ use super::{ensure_slice_len_eq, SINGLE_ENTRY_CF_NAME}; use anyhow::{format_err, Result}; -use byteorder::ReadBytesExt; -use num_derive::{FromPrimitive, ToPrimitive}; -use num_traits::{FromPrimitive, ToPrimitive}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use byteorder::ReadBytesExt; +use num_derive::{FromPrimitive, ToPrimitive}; +use num_traits::{FromPrimitive, ToPrimitive}; use std::mem::size_of; define_schema!( diff --git a/consensus/src/consensusdb/schema/single_entry/test.rs b/consensus/src/consensusdb/schema/single_entry/test.rs index 47945ee027817..5982d497a3926 100644 --- a/consensus/src/consensusdb/schema/single_entry/test.rs +++ b/consensus/src/consensusdb/schema/single_entry/test.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; // Tests that the DB can encode / decode data #[test] diff --git a/consensus/src/epoch_manager.rs b/consensus/src/epoch_manager.rs index 1273162e20d5b..1fe3127ddf6da 100644 --- a/consensus/src/epoch_manager.rs +++ b/consensus/src/epoch_manager.rs @@ -50,6 +50,8 @@ use aptos_event_notifications::ReconfigNotificationListener; use aptos_infallible::{duration_since_epoch, Mutex}; use aptos_logger::prelude::*; use aptos_mempool::QuorumStoreRequest; +use aptos_network::protocols::network::{ApplicationNetworkSender, Event}; +use aptos_safety_rules::SafetyRulesManager; use aptos_types::{ account_address::AccountAddress, epoch_change::EpochChangeProof, @@ -71,8 +73,6 @@ use futures::{ SinkExt, StreamExt, }; use itertools::Itertools; -use network::protocols::network::{ApplicationNetworkSender, Event}; -use safety_rules::SafetyRulesManager; use std::{ cmp::Ordering, collections::HashMap, diff --git a/consensus/src/error.rs b/consensus/src/error.rs index 39d3d36dbe3fe..728b838ab51f3 100644 --- a/consensus/src/error.rs +++ b/consensus/src/error.rs @@ -73,7 +73,7 @@ pub fn error_kind(e: &anyhow::Error) -> &'static str { if e.downcast_ref::().is_some() { return "ConsensusDb"; } - if e.downcast_ref::().is_some() { + if e.downcast_ref::().is_some() { return "SafetyRules"; } if e.downcast_ref::().is_some() { diff --git a/consensus/src/experimental/signing_phase.rs b/consensus/src/experimental/signing_phase.rs index 24ce7b79cbf66..b2d2f989e0755 100644 --- a/consensus/src/experimental/signing_phase.rs +++ b/consensus/src/experimental/signing_phase.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 -use safety_rules::TSafetyRules; +use aptos_safety_rules::TSafetyRules; use std::{ fmt::{Debug, Display, Formatter}, sync::Arc, @@ -12,9 +12,9 @@ use crate::{ }; use aptos_crypto::bls12381; use aptos_infallible::Mutex; +use aptos_safety_rules::Error; use aptos_types::ledger_info::{LedgerInfo, LedgerInfoWithSignatures}; use async_trait::async_trait; -use safety_rules::Error; /// [ This class is used when consensus.decoupled = true ] /// SigningPhase is a singleton that receives executed blocks from diff --git a/consensus/src/experimental/tests/buffer_manager_tests.rs b/consensus/src/experimental/tests/buffer_manager_tests.rs index ad368fefb85f5..ccf31f6e84948 100644 --- a/consensus/src/experimental/tests/buffer_manager_tests.rs +++ b/consensus/src/experimental/tests/buffer_manager_tests.rs @@ -29,6 +29,11 @@ use aptos_consensus_types::{ }; use aptos_crypto::{hash::ACCUMULATOR_PLACEHOLDER_HASH, HashValue}; use aptos_infallible::Mutex; +use aptos_network::{ + peer_manager::{ConnectionRequestSender, PeerManagerRequestSender}, + protocols::network::{Event, NewNetworkSender}, +}; +use aptos_safety_rules::{PersistentSafetyStorage, SafetyRulesManager}; use aptos_secure_storage::Storage; use aptos_types::{ account_address::AccountAddress, @@ -40,11 +45,6 @@ use aptos_types::{ use channel::{aptos_channel, message_queues::QueueStyle}; use futures::{channel::oneshot, FutureExt, SinkExt, StreamExt}; use itertools::enumerate; -use network::{ - peer_manager::{ConnectionRequestSender, PeerManagerRequestSender}, - protocols::network::{Event, NewNetworkSender}, -}; -use safety_rules::{PersistentSafetyStorage, SafetyRulesManager}; use std::sync::Arc; use tokio::runtime::Runtime; diff --git a/consensus/src/experimental/tests/signing_phase_tests.rs b/consensus/src/experimental/tests/signing_phase_tests.rs index b41726df56a8b..607acab190df1 100644 --- a/consensus/src/experimental/tests/signing_phase_tests.rs +++ b/consensus/src/experimental/tests/signing_phase_tests.rs @@ -17,13 +17,13 @@ use crate::{ test_utils::consensus_runtime, }; use aptos_crypto::HashValue; +use aptos_safety_rules::Error; use aptos_types::aggregate_signature::AggregateSignature; use aptos_types::{ block_info::BlockInfo, ledger_info::{LedgerInfo, LedgerInfoWithSignatures}, validator_signer::ValidatorSigner, }; -use safety_rules::Error; pub fn prepare_signing_pipeline( signing_phase: SigningPhase, diff --git a/consensus/src/experimental/tests/test_utils.rs b/consensus/src/experimental/tests/test_utils.rs index 2809bccdf534b..ec4df42d85426 100644 --- a/consensus/src/experimental/tests/test_utils.rs +++ b/consensus/src/experimental/tests/test_utils.rs @@ -12,6 +12,10 @@ use aptos_consensus_types::{ use aptos_crypto::{hash::ACCUMULATOR_PLACEHOLDER_HASH, HashValue}; use aptos_executor_types::StateComputeResult; use aptos_infallible::Mutex; +use aptos_safety_rules::{ + test_utils::{make_proposal_with_parent, make_proposal_with_qc}, + PersistentSafetyStorage, SafetyRulesManager, +}; use aptos_secure_storage::Storage; use aptos_types::{ ledger_info::{generate_ledger_info_with_sig, LedgerInfo, LedgerInfoWithSignatures}, @@ -19,10 +23,6 @@ use aptos_types::{ validator_verifier::random_validator_verifier, waypoint::Waypoint, }; -use safety_rules::{ - test_utils::{make_proposal_with_parent, make_proposal_with_qc}, - PersistentSafetyStorage, SafetyRulesManager, -}; use std::sync::Arc; pub fn prepare_safety_rules() -> (Arc>, Vec) { diff --git a/consensus/src/metrics_safety_rules.rs b/consensus/src/metrics_safety_rules.rs index 0247da654b535..c1ac7472d796d 100644 --- a/consensus/src/metrics_safety_rules.rs +++ b/consensus/src/metrics_safety_rules.rs @@ -10,11 +10,11 @@ use aptos_consensus_types::{ }; use aptos_crypto::bls12381; use aptos_logger::prelude::info; +use aptos_safety_rules::{ConsensusState, Error, TSafetyRules}; use aptos_types::{ epoch_change::EpochChangeProof, ledger_info::{LedgerInfo, LedgerInfoWithSignatures}, }; -use safety_rules::{ConsensusState, Error, TSafetyRules}; use std::sync::Arc; /// Wrap safety rules with counters. @@ -142,12 +142,12 @@ mod tests { vote_proposal::VoteProposal, }; use aptos_crypto::bls12381; + use aptos_safety_rules::{ConsensusState, Error, TSafetyRules}; use aptos_types::{ epoch_change::EpochChangeProof, ledger_info::{LedgerInfo, LedgerInfoWithSignatures}, }; use claims::{assert_matches, assert_ok}; - use safety_rules::{ConsensusState, Error, TSafetyRules}; pub struct MockSafetyRules { // number of initialize() calls diff --git a/consensus/src/network.rs b/consensus/src/network.rs index 740bb011c1a12..dbf3ebf75b7dd 100644 --- a/consensus/src/network.rs +++ b/consensus/src/network.rs @@ -18,6 +18,13 @@ use aptos_consensus_types::{ vote_msg::VoteMsg, }; use aptos_logger::prelude::*; +use aptos_network::{ + protocols::{ + network::{ApplicationNetworkSender, Event}, + rpc::error::RpcError, + }, + ProtocolId, +}; use aptos_types::{ account_address::AccountAddress, epoch_change::EpochChangeProof, ledger_info::LedgerInfoWithSignatures, validator_verifier::ValidatorVerifier, @@ -26,13 +33,6 @@ use bytes::Bytes; use channel::{self, aptos_channel, message_queues::QueueStyle}; use fail::fail_point; use futures::{channel::oneshot, stream::select, SinkExt, Stream, StreamExt}; -use network::{ - protocols::{ - network::{ApplicationNetworkSender, Event}, - rpc::error::RpcError, - }, - ProtocolId, -}; use std::{ mem::{discriminant, Discriminant}, time::Duration, diff --git a/consensus/src/network_interface.rs b/consensus/src/network_interface.rs index 333f03db0bbfb..4121f9328e38f 100644 --- a/consensus/src/network_interface.rs +++ b/consensus/src/network_interface.rs @@ -15,10 +15,7 @@ use aptos_consensus_types::{ vote_msg::VoteMsg, }; use aptos_logger::prelude::*; -use aptos_types::{epoch_change::EpochChangeProof, PeerId}; -use async_trait::async_trait; -use channel::{aptos_channel, message_queues::QueueStyle}; -use network::{ +use aptos_network::{ application::storage::PeerMetadataStorage, constants::NETWORK_CHANNEL_SIZE, error::NetworkError, @@ -32,6 +29,9 @@ use network::{ }, ProtocolId, }; +use aptos_types::{epoch_change::EpochChangeProof, PeerId}; +use async_trait::async_trait; +use channel::{aptos_channel, message_queues::QueueStyle}; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, sync::Arc, time::Duration}; diff --git a/consensus/src/network_tests.rs b/consensus/src/network_tests.rs index bc2f884b736b1..d43ee5548d885 100644 --- a/consensus/src/network_tests.rs +++ b/consensus/src/network_tests.rs @@ -17,10 +17,7 @@ use aptos_consensus_types::{ vote_msg::VoteMsg, }; use aptos_infallible::{Mutex, RwLock}; -use aptos_types::{block_info::BlockInfo, PeerId}; -use channel::{self, aptos_channel, message_queues::QueueStyle}; -use futures::{channel::mpsc, SinkExt, StreamExt}; -use network::{ +use aptos_network::{ application::storage::PeerMetadataStorage, peer_manager::{ conn_notifs_channel, ConnectionRequestSender, PeerManagerNotification, PeerManagerRequest, @@ -33,6 +30,9 @@ use network::{ }, ProtocolId, }; +use aptos_types::{block_info::BlockInfo, PeerId}; +use channel::{self, aptos_channel, message_queues::QueueStyle}; +use futures::{channel::mpsc, SinkExt, StreamExt}; use std::{ collections::{HashMap, HashSet}, iter::FromIterator, @@ -191,7 +191,7 @@ impl NetworkPlayground { // `Sender` side of this queue is usually wrapped in a // `ConsensusNetworkSender` adapter. network_reqs_rx: aptos_channel::Receiver<(PeerId, ProtocolId), PeerManagerRequest>, - conn_mgr_reqs_rx: channel::Receiver, + conn_mgr_reqs_rx: channel::Receiver, ) { self.node_consensus_txs.lock().insert(twin_id, consensus_tx); self.drop_config.write().add_node(twin_id); @@ -487,13 +487,13 @@ mod tests { common::Payload, }; use aptos_crypto::HashValue; - use aptos_types::validator_verifier::random_validator_verifier; - use bytes::Bytes; - use futures::{channel::oneshot, future}; - use network::{ + use aptos_network::{ application::storage::PeerMetadataStorage, protocols::direct_send::Message, transport::ConnectionMetadata, }; + use aptos_types::validator_verifier::random_validator_verifier; + use bytes::Bytes; + use futures::{channel::oneshot, future}; #[test] fn test_split_network_round() { diff --git a/consensus/src/round_manager.rs b/consensus/src/round_manager.rs index 95c2066dc57c8..a20b9af70f6a1 100644 --- a/consensus/src/round_manager.rs +++ b/consensus/src/round_manager.rs @@ -37,6 +37,9 @@ use aptos_consensus_types::{ }; use aptos_infallible::{checked, Mutex}; use aptos_logger::prelude::*; +#[cfg(test)] +use aptos_safety_rules::ConsensusState; +use aptos_safety_rules::TSafetyRules; use aptos_types::{ epoch_state::EpochState, on_chain_config::OnChainConsensusConfig, validator_verifier::ValidatorVerifier, @@ -44,9 +47,6 @@ use aptos_types::{ use channel::aptos_channel; use fail::fail_point; use futures::{channel::oneshot, FutureExt, StreamExt}; -#[cfg(test)] -use safety_rules::ConsensusState; -use safety_rules::TSafetyRules; use serde::Serialize; use std::{ mem::{discriminant, Discriminant}, diff --git a/consensus/src/round_manager_fuzzing.rs b/consensus/src/round_manager_fuzzing.rs index b4ff60d8231fc..102a712df9839 100644 --- a/consensus/src/round_manager_fuzzing.rs +++ b/consensus/src/round_manager_fuzzing.rs @@ -20,6 +20,11 @@ use crate::{ use aptos_config::config::ConsensusConfig; use aptos_consensus_types::proposal_msg::ProposalMsg; use aptos_infallible::Mutex; +use aptos_network::{ + peer_manager::{ConnectionRequestSender, PeerManagerRequestSender}, + protocols::network::NewNetworkSender, +}; +use aptos_safety_rules::{test_utils, SafetyRules, TSafetyRules}; use aptos_types::{ aggregate_signature::AggregateSignature, epoch_change::EpochChangeProof, @@ -32,12 +37,7 @@ use aptos_types::{ }; use channel::{self, aptos_channel, message_queues::QueueStyle}; use futures::{channel::mpsc, executor::block_on}; -use network::{ - peer_manager::{ConnectionRequestSender, PeerManagerRequestSender}, - protocols::network::NewNetworkSender, -}; use once_cell::sync::Lazy; -use safety_rules::{test_utils, SafetyRules, TSafetyRules}; use std::{sync::Arc, time::Duration}; use tokio::runtime::Runtime; diff --git a/consensus/src/round_manager_test.rs b/consensus/src/round_manager_test.rs index 079353377426e..bbe4b5c7d9bd4 100644 --- a/consensus/src/round_manager_test.rs +++ b/consensus/src/round_manager_test.rs @@ -40,6 +40,16 @@ use aptos_consensus_types::{ use aptos_crypto::HashValue; use aptos_infallible::Mutex; use aptos_logger::prelude::info; +use aptos_network::{ + peer_manager::{conn_notifs_channel, ConnectionRequestSender, PeerManagerRequestSender}, + protocols::{ + network::{Event, NewNetworkEvents, NewNetworkSender}, + wire::handshake::v1::ProtocolIdSet, + }, + transport::ConnectionMetadata, + ProtocolId, +}; +use aptos_safety_rules::{PersistentSafetyStorage, SafetyRulesManager}; use aptos_secure_storage::Storage; use aptos_types::{ epoch_state::EpochState, @@ -57,16 +67,6 @@ use futures::{ stream::select, FutureExt, Stream, StreamExt, }; -use network::{ - peer_manager::{conn_notifs_channel, ConnectionRequestSender, PeerManagerRequestSender}, - protocols::{ - network::{Event, NewNetworkEvents, NewNetworkSender}, - wire::handshake::v1::ProtocolIdSet, - }, - transport::ConnectionMetadata, - ProtocolId, -}; -use safety_rules::{PersistentSafetyStorage, SafetyRulesManager}; use std::{ iter::FromIterator, sync::{ diff --git a/consensus/src/twins/twins_node.rs b/consensus/src/twins/twins_node.rs index 00e22343cf207..fd908eaca7130 100644 --- a/consensus/src/twins/twins_node.rs +++ b/consensus/src/twins/twins_node.rs @@ -20,6 +20,15 @@ use aptos_config::{ use aptos_consensus_types::common::{Author, Round}; use aptos_event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use aptos_mempool::mocks::MockSharedMempool; +use aptos_network::{ + peer_manager::{conn_notifs_channel, ConnectionRequestSender, PeerManagerRequestSender}, + protocols::{ + network::{NewNetworkEvents, NewNetworkSender}, + wire::handshake::v1::ProtocolIdSet, + }, + transport::ConnectionMetadata, + ProtocolId, +}; use aptos_types::{ ledger_info::LedgerInfoWithSignatures, on_chain_config::{ @@ -34,15 +43,6 @@ use aptos_types::{ use channel::{self, aptos_channel, message_queues::QueueStyle}; use futures::channel::mpsc; use futures::StreamExt; -use network::{ - peer_manager::{conn_notifs_channel, ConnectionRequestSender, PeerManagerRequestSender}, - protocols::{ - network::{NewNetworkEvents, NewNetworkSender}, - wire::handshake::v1::ProtocolIdSet, - }, - transport::ConnectionMetadata, - ProtocolId, -}; use std::{collections::HashMap, iter::FromIterator, sync::Arc}; use tokio::runtime::{Builder, Runtime}; diff --git a/crates/aptos-genesis/Cargo.toml b/crates/aptos-genesis/Cargo.toml index 6c3c77e813fbe..36097ab4874d1 100644 --- a/crates/aptos-genesis/Cargo.toml +++ b/crates/aptos-genesis/Cargo.toml @@ -17,6 +17,7 @@ anyhow = { workspace = true } aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-executor = { workspace = true } aptos-framework = { workspace = true } aptos-keygen = { workspace = true } @@ -27,7 +28,6 @@ aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } aptos-vm-genesis = { workspace = true } -aptosdb = { workspace = true } bcs = { workspace = true } rand = { workspace = true } serde = { workspace = true } diff --git a/crates/aptos-genesis/src/lib.rs b/crates/aptos-genesis/src/lib.rs index 6194ba5cf2bf7..7af25a97a9aff 100644 --- a/crates/aptos-genesis/src/lib.rs +++ b/crates/aptos-genesis/src/lib.rs @@ -17,6 +17,7 @@ use aptos_config::config::{ NO_OP_STORAGE_PRUNER_CONFIG, }; use aptos_crypto::ed25519::Ed25519PublicKey; +use aptos_db::AptosDB; use aptos_framework::ReleaseBundle; use aptos_storage_interface::DbReaderWriter; use aptos_temppath::TempPath; @@ -28,7 +29,6 @@ use aptos_types::{ }; use aptos_vm::AptosVM; use aptos_vm_genesis::Validator; -use aptosdb::AptosDB; use std::convert::TryInto; /// Holder object for all pieces needed to generate a genesis transaction diff --git a/crates/aptos-genesis/src/mainnet.rs b/crates/aptos-genesis/src/mainnet.rs index 98cfad3f722f4..37703f543a6e6 100644 --- a/crates/aptos-genesis/src/mainnet.rs +++ b/crates/aptos-genesis/src/mainnet.rs @@ -6,13 +6,13 @@ use aptos_config::config::{ RocksdbConfigs, BUFFERED_STATE_TARGET_ITEMS, DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, NO_OP_STORAGE_PRUNER_CONFIG, }; +use aptos_db::AptosDB; use aptos_framework::ReleaseBundle; use aptos_storage_interface::DbReaderWriter; use aptos_temppath::TempPath; use aptos_types::{chain_id::ChainId, transaction::Transaction, waypoint::Waypoint}; use aptos_vm::AptosVM; use aptos_vm_genesis::{AccountBalance, EmployeePool, ValidatorWithCommissionRate}; -use aptosdb::AptosDB; /// Holder object for all pieces needed to generate a genesis transaction #[derive(Clone)] diff --git a/crates/aptos-network-checker/Cargo.toml b/crates/aptos-network-checker/Cargo.toml index 257d830d85817..b8941edb57c2b 100644 --- a/crates/aptos-network-checker/Cargo.toml +++ b/crates/aptos-network-checker/Cargo.toml @@ -17,10 +17,10 @@ anyhow = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } aptos-logger = { workspace = true } +aptos-network = { workspace = true } aptos-types = { workspace = true } clap = { workspace = true } futures = { workspace = true } -network = { workspace = true } serde = { workspace = true } tokio = { workspace = true } diff --git a/crates/aptos-network-checker/src/check_endpoint.rs b/crates/aptos-network-checker/src/check_endpoint.rs index 74c181ce3ff24..c6db6ba235149 100644 --- a/crates/aptos-network-checker/src/check_endpoint.rs +++ b/crates/aptos-network-checker/src/check_endpoint.rs @@ -8,15 +8,15 @@ use aptos_config::{ network_id::{NetworkContext, NetworkId}, }; use aptos_crypto::x25519::{self, PRIVATE_KEY_SIZE}; -use aptos_types::{account_address, chain_id::ChainId, network_address::NetworkAddress, PeerId}; -use futures::{AsyncReadExt, AsyncWriteExt}; -use network::transport::TCPBufferCfg; -use network::{ +use aptos_network::transport::TCPBufferCfg; +use aptos_network::{ noise::{HandshakeAuthMode, NoiseUpgrader}, protocols::wire::handshake::v1::ProtocolIdSet, transport::{resolve_and_connect, TcpSocket}, transport::{upgrade_outbound, UpgradeContext, SUPPORTED_MESSAGING_PROTOCOL}, }; +use aptos_types::{account_address, chain_id::ChainId, network_address::NetworkAddress, PeerId}; +use futures::{AsyncReadExt, AsyncWriteExt}; use std::{collections::BTreeMap, sync::Arc}; use tokio::time::Duration; diff --git a/crates/aptos-telemetry/Cargo.toml b/crates/aptos-telemetry/Cargo.toml index 6540a00fdb818..1c024f603769a 100644 --- a/crates/aptos-telemetry/Cargo.toml +++ b/crates/aptos-telemetry/Cargo.toml @@ -18,18 +18,18 @@ aptos-api = { workspace = true } aptos-config = { workspace = true } aptos-consensus = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } aptos-mempool = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-network = { workspace = true } +aptos-node-resource-metrics = { workspace = true } aptos-state-sync-driver = { workspace = true } aptos-telemetry-service = { workspace = true } aptos-types = { workspace = true } -aptosdb = { workspace = true } flate2 = { workspace = true } futures = { workspace = true } -network = { workspace = true } -node-resource-metrics = { workspace = true } once_cell = { workspace = true } prometheus = { workspace = true } rand = { workspace = true } diff --git a/crates/aptos-telemetry/src/core_metrics.rs b/crates/aptos-telemetry/src/core_metrics.rs index 71fe9501908d9..30ac35400f41f 100644 --- a/crates/aptos-telemetry/src/core_metrics.rs +++ b/crates/aptos-telemetry/src/core_metrics.rs @@ -144,18 +144,18 @@ fn collect_state_sync_metrics( fn collect_storage_metrics(core_metrics: &mut BTreeMap) { core_metrics.insert( STORAGE_LEDGER_VERSION.into(), - aptosdb::metrics::LEDGER_VERSION.get().to_string(), + aptos_db::metrics::LEDGER_VERSION.get().to_string(), ); core_metrics.insert( STORAGE_MIN_READABLE_LEDGER_VERSION.into(), - aptosdb::metrics::PRUNER_LEAST_READABLE_VERSION + aptos_db::metrics::PRUNER_LEAST_READABLE_VERSION .with_label_values(&["ledger_pruner"]) .get() .to_string(), ); core_metrics.insert( STORAGE_MIN_READABLE_STATE_VERSION.into(), - aptosdb::metrics::PRUNER_LEAST_READABLE_VERSION + aptos_db::metrics::PRUNER_LEAST_READABLE_VERSION .with_label_values(&["state_store"]) .get() .to_string(), diff --git a/crates/aptos-telemetry/src/network_metrics.rs b/crates/aptos-telemetry/src/network_metrics.rs index ac8e5eadf6522..61a5a91dbd26b 100644 --- a/crates/aptos-telemetry/src/network_metrics.rs +++ b/crates/aptos-telemetry/src/network_metrics.rs @@ -47,7 +47,7 @@ fn collect_connection_metrics(network_metrics: &mut BTreeMap) { // Calculate the number of inbound and outbound connections let mut inbound_connection_count: f64 = 0.0; let mut outbound_connection_count: f64 = 0.0; - for metric_family in network::counters::APTOS_CONNECTIONS.collect() { + for metric_family in aptos_network::counters::APTOS_CONNECTIONS.collect() { for metric in metric_family.get_metric() { // TODO(joshlind): avoid matching on strings that can change! for label in metric.get_label() { @@ -76,12 +76,14 @@ fn collect_connection_metrics(network_metrics: &mut BTreeMap) { /// Collects the message and traffic metrics and appends them to the given map fn collect_message_and_traffic_metrics(network_metrics: &mut BTreeMap) { // Calculate the inbound messages and traffic - let inbound_metric_families = network::counters::NETWORK_APPLICATION_INBOUND_METRIC.collect(); + let inbound_metric_families = + aptos_network::counters::NETWORK_APPLICATION_INBOUND_METRIC.collect(); let network_inbound_message_sum = utils::sum_all_histogram_counts(&inbound_metric_families); let network_inbound_traffic_sum = utils::sum_all_histogram_sums(&inbound_metric_families); // Calculate the outbound messages and traffic - let outbound_metric_families = network::counters::NETWORK_APPLICATION_OUTBOUND_METRIC.collect(); + let outbound_metric_families = + aptos_network::counters::NETWORK_APPLICATION_OUTBOUND_METRIC.collect(); let network_outbound_message_sum = utils::sum_all_histogram_counts(&outbound_metric_families); let network_outbound_traffic_sum = utils::sum_all_histogram_sums(&outbound_metric_families); diff --git a/crates/aptos-telemetry/src/service.rs b/crates/aptos-telemetry/src/service.rs index 94156e3ffad5e..595fc235fe302 100644 --- a/crates/aptos-telemetry/src/service.rs +++ b/crates/aptos-telemetry/src/service.rs @@ -110,7 +110,7 @@ pub fn start_telemetry_service( logger_filter_update_job: Option, ) -> Option { if enable_prometheus_node_metrics() { - node_resource_metrics::register_node_metrics_collector(); + aptos_node_resource_metrics::register_node_metrics_collector(); } // Don't start the service if telemetry has been disabled diff --git a/crates/node-resource-metrics/Cargo.toml b/crates/node-resource-metrics/Cargo.toml index 0f23a775b67f2..2ed4a5ac0aa38 100644 --- a/crates/node-resource-metrics/Cargo.toml +++ b/crates/node-resource-metrics/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "node-resource-metrics" +name = "aptos-node-resource-metrics" description = "System resource metrics collector" version = "0.1.0" diff --git a/crates/num-variants/Cargo.toml b/crates/num-variants/Cargo.toml index 38cfbfa79744d..f86cb64ad75b9 100644 --- a/crates/num-variants/Cargo.toml +++ b/crates/num-variants/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "num-variants" +name = "aptos-num-variants" description = "Utility to add a constant value to enum variants" version = "0.1.0" diff --git a/crates/num-variants/tests/basic.rs b/crates/num-variants/tests/basic.rs index a7533f26bc392..e75363695ef21 100644 --- a/crates/num-variants/tests/basic.rs +++ b/crates/num-variants/tests/basic.rs @@ -6,7 +6,7 @@ // TODO: There are no negative tests at the moment (e.g. deriving NumVariants on a struct or union). // Add some, possibly using compiletest-rs: https://github.com/laumann/compiletest-rs -use num_variants::NumVariants; +use aptos_num_variants::NumVariants; #[derive(NumVariants)] enum BasicEnum { diff --git a/crates/proxy/Cargo.toml b/crates/proxy/Cargo.toml index 35d988da7219d..bd1266c34911a 100644 --- a/crates/proxy/Cargo.toml +++ b/crates/proxy/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "proxy" +name = "aptos-proxy" description = "Aptos proxy" version = "0.1.0" diff --git a/crates/transaction-emitter/src/main.rs b/crates/transaction-emitter/src/main.rs index 70845e33a7d15..186e647c487f3 100644 --- a/crates/transaction-emitter/src/main.rs +++ b/crates/transaction-emitter/src/main.rs @@ -3,8 +3,8 @@ mod diag; -use ::aptos_logger::{Level, Logger}; use anyhow::{Context, Result}; +use aptos_logger::{Level, Logger}; use aptos_transaction_emitter_lib::{emit_transactions, Cluster, ClusterArgs, EmitArgs}; use clap::{Parser, Subcommand}; use diag::diag; diff --git a/execution/db-bootstrapper/Cargo.toml b/execution/db-bootstrapper/Cargo.toml index a68f22ca79042..39c536943dacd 100644 --- a/execution/db-bootstrapper/Cargo.toml +++ b/execution/db-bootstrapper/Cargo.toml @@ -16,11 +16,11 @@ rust-version = { workspace = true } anyhow = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-executor = { workspace = true } aptos-storage-interface = { workspace = true } aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } -aptosdb = { workspace = true } bcs = { workspace = true } structopt = { workspace = true } diff --git a/execution/db-bootstrapper/src/bin/db-bootstrapper.rs b/execution/db-bootstrapper/src/bin/db-bootstrapper.rs index 3d67c845bf893..b530ce76afcf6 100644 --- a/execution/db-bootstrapper/src/bin/db-bootstrapper.rs +++ b/execution/db-bootstrapper/src/bin/db-bootstrapper.rs @@ -6,11 +6,11 @@ use aptos_config::config::{ RocksdbConfigs, BUFFERED_STATE_TARGET_ITEMS, DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, NO_OP_STORAGE_PRUNER_CONFIG, }; +use aptos_db::AptosDB; use aptos_executor::db_bootstrapper::calculate_genesis; use aptos_storage_interface::DbReaderWriter; use aptos_types::{transaction::Transaction, waypoint::Waypoint}; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use std::{ fs::File, io::Read, diff --git a/execution/executor-benchmark/Cargo.toml b/execution/executor-benchmark/Cargo.toml index 13d8dfe4d174a..17f390fce83f2 100644 --- a/execution/executor-benchmark/Cargo.toml +++ b/execution/executor-benchmark/Cargo.toml @@ -15,6 +15,7 @@ rust-version = { workspace = true } [dependencies] aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-executor = { workspace = true } aptos-executor-types = { workspace = true } aptos-genesis = { workspace = true, features = ["testing"] } @@ -22,13 +23,13 @@ aptos-infallible = { workspace = true } aptos-jellyfish-merkle = { workspace = true } aptos-logger = { workspace = true } aptos-push-metrics = { workspace = true } +aptos-schemadb = { workspace = true } aptos-scratchpad = { workspace = true } aptos-sdk = { workspace = true } aptos-state-view = { workspace = true } aptos-storage-interface = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } -aptosdb = { workspace = true } chrono = { workspace = true } criterion = { workspace = true } indicatif = { workspace = true } @@ -36,7 +37,6 @@ itertools = { workspace = true } num_cpus = { workspace = true } rand = { workspace = true } rayon = { workspace = true } -schemadb = { workspace = true } serde = { workspace = true } structopt = { workspace = true } toml = { workspace = true } diff --git a/execution/executor-benchmark/src/db_generator.rs b/execution/executor-benchmark/src/db_generator.rs index ccc381ed0e481..1e4bb5ab09f9a 100644 --- a/execution/executor-benchmark/src/db_generator.rs +++ b/execution/executor-benchmark/src/db_generator.rs @@ -10,10 +10,10 @@ use aptos_config::{ use aptos_config::config::{ PrunerConfig, BUFFERED_STATE_TARGET_ITEMS, DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, }; +use aptos_db::AptosDB; use aptos_executor::db_bootstrapper::{generate_waypoint, maybe_bootstrap}; use aptos_storage_interface::DbReaderWriter; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use std::{fs, path::Path}; pub fn run( diff --git a/execution/executor-benchmark/src/lib.rs b/execution/executor-benchmark/src/lib.rs index f0cfc0a6e2bef..22f516a330928 100644 --- a/execution/executor-benchmark/src/lib.rs +++ b/execution/executor-benchmark/src/lib.rs @@ -16,10 +16,10 @@ use aptos_config::config::{ NodeConfig, PrunerConfig, RocksdbConfigs, BUFFERED_STATE_TARGET_ITEMS, DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, NO_OP_STORAGE_PRUNER_CONFIG, }; +use aptos_db::AptosDB; use aptos_jellyfish_merkle::metrics::{ APTOS_JELLYFISH_INTERNAL_ENCODED_BYTES, APTOS_JELLYFISH_LEAF_ENCODED_BYTES, }; -use aptosdb::AptosDB; use crate::pipeline::Pipeline; use aptos_executor::block_executor::BlockExecutor; diff --git a/execution/executor-benchmark/src/transaction_committer.rs b/execution/executor-benchmark/src/transaction_committer.rs index 3d6cc557fdbcb..499a017ee087f 100644 --- a/execution/executor-benchmark/src/transaction_committer.rs +++ b/execution/executor-benchmark/src/transaction_committer.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use aptos_crypto::hash::HashValue; +use aptos_db::metrics::API_LATENCY_SECONDS; use aptos_executor::{ block_executor::BlockExecutor, metrics::{ @@ -18,7 +19,6 @@ use aptos_types::{ transaction::Version, }; use aptos_vm::AptosVM; -use aptosdb::metrics::API_LATENCY_SECONDS; use std::{ sync::{mpsc, Arc}, time::{Duration, Instant}, diff --git a/execution/executor-test-helpers/Cargo.toml b/execution/executor-test-helpers/Cargo.toml index 4d0408742c790..4366de30a0847 100644 --- a/execution/executor-test-helpers/Cargo.toml +++ b/execution/executor-test-helpers/Cargo.toml @@ -18,6 +18,7 @@ aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } aptos-consensus-types = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true, features = ["fuzzing"] } aptos-executor = { workspace = true } aptos-executor-types = { workspace = true } aptos-genesis = { workspace = true } @@ -28,5 +29,4 @@ aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } aptos-vm-genesis = { workspace = true } -aptosdb = { workspace = true, features = ["fuzzing"] } rand = { workspace = true } diff --git a/execution/executor-test-helpers/src/integration_test_impl.rs b/execution/executor-test-helpers/src/integration_test_impl.rs index 068c23f56441b..24d3c73a6b9d0 100644 --- a/execution/executor-test-helpers/src/integration_test_impl.rs +++ b/execution/executor-test-helpers/src/integration_test_impl.rs @@ -5,6 +5,7 @@ use crate::{bootstrap_genesis, gen_block_id, gen_ledger_info_with_sigs}; use anyhow::{anyhow, ensure, Result}; use aptos_cached_packages::aptos_stdlib; use aptos_consensus_types::block::Block; +use aptos_db::AptosDB; use aptos_executor::block_executor::BlockExecutor; use aptos_executor_types::BlockExecutorTrait; use aptos_sdk::{ @@ -27,7 +28,6 @@ use aptos_types::{ waypoint::Waypoint, }; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use rand::SeedableRng; use std::sync::Arc; diff --git a/execution/executor/Cargo.toml b/execution/executor/Cargo.toml index 64ef370ba6138..e610c57407d45 100644 --- a/execution/executor/Cargo.toml +++ b/execution/executor/Cargo.toml @@ -38,13 +38,13 @@ serde = { workspace = true } [dev-dependencies] aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } +aptos-db = { workspace = true } aptos-executor-test-helpers = { workspace = true } aptos-genesis = { workspace = true } aptos-storage-interface = { workspace = true } aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptos-vm-genesis = { workspace = true } -aptosdb = { workspace = true } proptest = { workspace = true } rand = { workspace = true } diff --git a/execution/executor/src/tests/chunk_executor_tests.rs b/execution/executor/src/tests/chunk_executor_tests.rs index cd1117e1ffe80..338d80a9acbae 100644 --- a/execution/executor/src/tests/chunk_executor_tests.rs +++ b/execution/executor/src/tests/chunk_executor_tests.rs @@ -11,6 +11,7 @@ use crate::{ tests, }; use aptos_crypto::HashValue; +use aptos_db::AptosDB; use aptos_executor_types::{BlockExecutorTrait, ChunkExecutorTrait}; use aptos_storage_interface::DbReaderWriter; use aptos_types::{ @@ -18,7 +19,6 @@ use aptos_types::{ test_helpers::transaction_test_helpers::block, transaction::{TransactionListWithProof, TransactionOutputListWithProof}, }; -use aptosdb::AptosDB; use rand::Rng; pub struct TestExecutor { diff --git a/execution/executor/src/tests/mod.rs b/execution/executor/src/tests/mod.rs index e9ce902a7fd89..e202e75584d21 100644 --- a/execution/executor/src/tests/mod.rs +++ b/execution/executor/src/tests/mod.rs @@ -6,6 +6,7 @@ use std::{collections::BTreeSet, iter::once, sync::Arc}; use proptest::prelude::*; use aptos_crypto::{ed25519::Ed25519PrivateKey, HashValue, PrivateKey, SigningKey, Uniform}; +use aptos_db::AptosDB; use aptos_executor_types::{BlockExecutorTrait, ChunkExecutorTrait, TransactionReplayer}; use aptos_state_view::StateViewId; use aptos_storage_interface::{ @@ -27,7 +28,6 @@ use aptos_types::{ }, write_set::{WriteOp, WriteSet, WriteSetMut}, }; -use aptosdb::AptosDB; use crate::{ block_executor::BlockExecutor, diff --git a/execution/executor/tests/db_bootstrapper_test.rs b/execution/executor/tests/db_bootstrapper_test.rs index 422a48c68bfc9..7a94c10d079fc 100644 --- a/execution/executor/tests/db_bootstrapper_test.rs +++ b/execution/executor/tests/db_bootstrapper_test.rs @@ -5,6 +5,7 @@ use aptos_cached_packages::aptos_stdlib; use aptos_crypto::{ed25519::Ed25519PrivateKey, HashValue, PrivateKey, Uniform}; +use aptos_db::AptosDB; use aptos_executor::{ block_executor::BlockExecutor, db_bootstrapper::{generate_waypoint, maybe_bootstrap}, @@ -37,7 +38,6 @@ use aptos_types::{ write_set::{WriteOp, WriteSetMut}, }; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use move_core_types::{ language_storage::TypeTag, move_resource::{MoveResource, MoveStructType}, diff --git a/mempool/Cargo.toml b/mempool/Cargo.toml index f121ee65e229b..0779bf093535a 100644 --- a/mempool/Cargo.toml +++ b/mempool/Cargo.toml @@ -21,7 +21,10 @@ aptos-crypto = { workspace = true } aptos-event-notifications = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } +aptos-mempool-notifications = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-netcore = { workspace = true } +aptos-network = { workspace = true } aptos-proptest-helpers = { workspace = true, optional = true } aptos-short-hex-str = { workspace = true } aptos-storage-interface = { workspace = true } @@ -33,9 +36,6 @@ channel = { workspace = true } fail = { workspace = true } futures = { workspace = true } itertools = { workspace = true } -mempool-notifications = { workspace = true } -netcore = { workspace = true } -network = { workspace = true } once_cell = { workspace = true } proptest = { workspace = true, optional = true } rand = { workspace = true } @@ -50,9 +50,9 @@ tokio-stream = { workspace = true } aptos-compression = { workspace = true } aptos-config = { workspace = true } aptos-id-generator = { workspace = true } +aptos-network = { workspace = true, features = ["fuzzing"] } aptos-storage-interface = { workspace = true, features = ["fuzzing"] } enum_dispatch = { workspace = true } -network = { workspace = true, features = ["fuzzing"] } proptest = { workspace = true } [features] diff --git a/mempool/src/logging.rs b/mempool/src/logging.rs index 8c2be00672e4b..08f93e22aabf9 100644 --- a/mempool/src/logging.rs +++ b/mempool/src/logging.rs @@ -5,8 +5,8 @@ use crate::shared_mempool::types::{MultiBatchId, QuorumStoreRequest}; use anyhow::Error; use aptos_config::network_id::{NetworkId, PeerNetworkId}; use aptos_logger::Schema; +use aptos_mempool_notifications::MempoolCommitNotification; use aptos_types::{account_address::AccountAddress, on_chain_config::OnChainConfigPayload}; -use mempool_notifications::MempoolCommitNotification; use serde::Serialize; use std::{fmt, fmt::Write, time::SystemTime}; diff --git a/mempool/src/shared_mempool/coordinator.rs b/mempool/src/shared_mempool/coordinator.rs index aad8e38c22bbd..84ed313f6c4d6 100644 --- a/mempool/src/shared_mempool/coordinator.rs +++ b/mempool/src/shared_mempool/coordinator.rs @@ -14,13 +14,14 @@ use crate::{ }, MempoolEventsReceiver, QuorumStoreRequest, }; -use ::network::protocols::network::Event; use aptos_bounded_executor::BoundedExecutor; use aptos_config::network_id::{NetworkId, PeerNetworkId}; use aptos_consensus_types::common::TransactionSummary; use aptos_event_notifications::ReconfigNotificationListener; use aptos_infallible::Mutex; use aptos_logger::prelude::*; +use aptos_mempool_notifications::{MempoolCommitNotification, MempoolNotificationListener}; +use aptos_network::protocols::network::Event; use aptos_types::on_chain_config::OnChainConfigPayload; use aptos_vm_validator::vm_validator::TransactionValidation; use futures::{ @@ -28,7 +29,6 @@ use futures::{ stream::{select_all, FuturesUnordered}, StreamExt, }; -use mempool_notifications::{MempoolCommitNotification, MempoolNotificationListener}; use std::{ sync::Arc, time::{Duration, Instant, SystemTime}, diff --git a/mempool/src/shared_mempool/network.rs b/mempool/src/shared_mempool/network.rs index 47c5ec394c349..ff7f8a0f66ffc 100644 --- a/mempool/src/shared_mempool/network.rs +++ b/mempool/src/shared_mempool/network.rs @@ -20,14 +20,8 @@ use aptos_config::{ }; use aptos_infallible::Mutex; use aptos_logger::prelude::*; -use aptos_types::{transaction::SignedTransaction, PeerId}; -use aptos_vm_validator::vm_validator::TransactionValidation; -use async_trait::async_trait; -use channel::{aptos_channel, message_queues::QueueStyle}; -use fail::fail_point; -use itertools::Itertools; -use netcore::transport::ConnectionOrigin; -use network::{ +use aptos_netcore::transport::ConnectionOrigin; +use aptos_network::{ application::{ interface::{MultiNetworkSender, NetworkInterface}, storage::{LockingHashMap, PeerMetadataStorage}, @@ -41,6 +35,12 @@ use network::{ transport::ConnectionMetadata, ProtocolId, }; +use aptos_types::{transaction::SignedTransaction, PeerId}; +use aptos_vm_validator::vm_validator::TransactionValidation; +use async_trait::async_trait; +use channel::{aptos_channel, message_queues::QueueStyle}; +use fail::fail_point; +use itertools::Itertools; use serde::{Deserialize, Serialize}; use std::collections::hash_map::RandomState; use std::collections::BTreeSet; diff --git a/mempool/src/shared_mempool/runtime.rs b/mempool/src/shared_mempool/runtime.rs index 4f25942f95d78..ec28ff21f6ee9 100644 --- a/mempool/src/shared_mempool/runtime.rs +++ b/mempool/src/shared_mempool/runtime.rs @@ -15,11 +15,11 @@ use aptos_infallible::{Mutex, RwLock}; use aptos_event_notifications::ReconfigNotificationListener; use aptos_logger::Level; +use aptos_mempool_notifications::MempoolNotificationListener; +use aptos_network::application::storage::PeerMetadataStorage; use aptos_storage_interface::DbReader; use aptos_vm_validator::vm_validator::{TransactionValidation, VMValidator}; use futures::channel::mpsc::{self, Receiver, UnboundedSender}; -use mempool_notifications::MempoolNotificationListener; -use network::application::storage::PeerMetadataStorage; use std::{ collections::HashMap, sync::{ diff --git a/mempool/src/shared_mempool/tasks.rs b/mempool/src/shared_mempool/tasks.rs index 08ee0513090b8..74b7d75767f96 100644 --- a/mempool/src/shared_mempool/tasks.rs +++ b/mempool/src/shared_mempool/tasks.rs @@ -21,6 +21,7 @@ use aptos_crypto::HashValue; use aptos_infallible::{Mutex, RwLock}; use aptos_logger::prelude::*; use aptos_metrics_core::HistogramTimer; +use aptos_network::application::interface::NetworkInterface; use aptos_storage_interface::state_view::LatestDbStateCheckpointView; use aptos_types::{ mempool_status::{MempoolStatus, MempoolStatusCode}, @@ -30,7 +31,6 @@ use aptos_types::{ }; use aptos_vm_validator::vm_validator::{get_account_sequence_number, TransactionValidation}; use futures::{channel::oneshot, stream::FuturesUnordered}; -use network::application::interface::NetworkInterface; use rayon::prelude::*; use std::{ cmp, diff --git a/mempool/src/shared_mempool/types.rs b/mempool/src/shared_mempool/types.rs index 4c95de9f4d934..e286a4de5ce07 100644 --- a/mempool/src/shared_mempool/types.rs +++ b/mempool/src/shared_mempool/types.rs @@ -14,6 +14,7 @@ use aptos_config::{ use aptos_consensus_types::common::{RejectedTransactionSummary, TransactionSummary}; use aptos_crypto::HashValue; use aptos_infallible::{Mutex, RwLock}; +use aptos_network::{application::storage::PeerMetadataStorage, transport::ConnectionMetadata}; use aptos_storage_interface::DbReader; use aptos_types::{ mempool_status::MempoolStatus, transaction::SignedTransaction, vm_status::DiscardedVMStatus, @@ -24,7 +25,6 @@ use futures::{ future::Future, task::{Context, Poll}, }; -use network::{application::storage::PeerMetadataStorage, transport::ConnectionMetadata}; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; use std::{ diff --git a/mempool/src/tests/fuzzing.rs b/mempool/src/tests/fuzzing.rs index f4a1ea4ff7b74..fdbc738048c0a 100644 --- a/mempool/src/tests/fuzzing.rs +++ b/mempool/src/tests/fuzzing.rs @@ -7,10 +7,10 @@ use crate::{ }; use aptos_config::{config::NodeConfig, network_id::NetworkId}; use aptos_infallible::{Mutex, RwLock}; +use aptos_network::application::storage::PeerMetadataStorage; use aptos_storage_interface::mock::MockDbReaderWriter; use aptos_types::transaction::SignedTransaction; use aptos_vm_validator::mocks::mock_vm_validator::MockVMValidator; -use network::application::storage::PeerMetadataStorage; use proptest::{ arbitrary::any, prelude::*, diff --git a/mempool/src/tests/integration_tests.rs b/mempool/src/tests/integration_tests.rs index 7056b20a522c0..b3c90a7470d3c 100644 --- a/mempool/src/tests/integration_tests.rs +++ b/mempool/src/tests/integration_tests.rs @@ -6,8 +6,8 @@ use crate::tests::{ test_framework::{test_transaction, MempoolNode, MempoolTestFrameworkBuilder}, }; use aptos_config::network_id::PeerNetworkId; -use netcore::transport::ConnectionOrigin; -use network::{ +use aptos_netcore::transport::ConnectionOrigin; +use aptos_network::{ testutils::{ test_framework::TestFramework, test_node::{ diff --git a/mempool/src/tests/mocks.rs b/mempool/src/tests/mocks.rs index d46a5381e6cda..17f31c328419e 100644 --- a/mempool/src/tests/mocks.rs +++ b/mempool/src/tests/mocks.rs @@ -14,6 +14,12 @@ use aptos_config::{ }; use aptos_event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use aptos_infallible::{Mutex, RwLock}; +use aptos_mempool_notifications::{self, MempoolNotifier}; +use aptos_network::{ + application::storage::PeerMetadataStorage, + peer_manager::{conn_notifs_channel, ConnectionRequestSender, PeerManagerRequestSender}, + protocols::network::{NewNetworkEvents, NewNetworkSender}, +}; use aptos_storage_interface::{mock::MockDbReaderWriter, DbReaderWriter}; use aptos_types::on_chain_config::OnChainConfigPayload; use aptos_types::{ @@ -25,12 +31,6 @@ use aptos_vm_validator::{ }; use channel::{self, aptos_channel, message_queues::QueueStyle}; use futures::channel::mpsc; -use mempool_notifications::{self, MempoolNotifier}; -use network::{ - application::storage::PeerMetadataStorage, - peer_manager::{conn_notifs_channel, ConnectionRequestSender, PeerManagerRequestSender}, - protocols::network::{NewNetworkEvents, NewNetworkSender}, -}; use std::collections::HashMap; use std::{collections::HashSet, sync::Arc}; use tokio::runtime::{Builder, Handle, Runtime}; @@ -116,7 +116,7 @@ impl MockSharedMempool { let (ac_client, client_events) = mpsc::channel(1_024); let (quorum_store_sender, quorum_store_receiver) = mpsc::channel(1_024); let (mempool_notifier, mempool_listener) = - mempool_notifications::new_mempool_notifier_listener_pair(); + aptos_mempool_notifications::new_mempool_notifier_listener_pair(); let (reconfig_sender, reconfig_events) = aptos_channel::new(QueueStyle::LIFO, 1, None); let reconfig_event_subscriber = ReconfigNotificationListener { notification_receiver: reconfig_events, diff --git a/mempool/src/tests/multi_node_test.rs b/mempool/src/tests/multi_node_test.rs index 47c9a675bcebd..1b74e128ba45a 100644 --- a/mempool/src/tests/multi_node_test.rs +++ b/mempool/src/tests/multi_node_test.rs @@ -17,12 +17,12 @@ use aptos_config::{ config::{NodeConfig, PeerRole}, network_id::{NetworkId, PeerNetworkId}, }; -use aptos_types::{transaction::SignedTransaction, PeerId}; -use netcore::transport::ConnectionOrigin; -use network::{ +use aptos_netcore::transport::ConnectionOrigin; +use aptos_network::{ peer_manager::{PeerManagerNotification, PeerManagerRequest}, ProtocolId, }; +use aptos_types::{transaction::SignedTransaction, PeerId}; use rand::{rngs::StdRng, SeedableRng}; use std::collections::{HashMap, HashSet}; diff --git a/mempool/src/tests/node.rs b/mempool/src/tests/node.rs index d3954eb79b161..d445fb41e7588 100644 --- a/mempool/src/tests/node.rs +++ b/mempool/src/tests/node.rs @@ -16,6 +16,17 @@ use aptos_config::{ use aptos_crypto::{x25519::PrivateKey, Uniform}; use aptos_event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use aptos_infallible::{Mutex, MutexGuard, RwLock}; +use aptos_netcore::transport::ConnectionOrigin; +use aptos_network::{ + application::storage::PeerMetadataStorage, + peer_manager::{ + conn_notifs_channel, ConnectionNotification, ConnectionRequestSender, + PeerManagerNotification, PeerManagerRequest, PeerManagerRequestSender, + }, + protocols::network::{NetworkEvents, NewNetworkEvents, NewNetworkSender}, + transport::ConnectionMetadata, + ProtocolId, +}; use aptos_storage_interface::mock::MockDbReaderWriter; use aptos_types::on_chain_config::OnChainConfigPayload; use aptos_types::{account_config::AccountSequenceInfo, PeerId}; @@ -26,17 +37,6 @@ use futures::{ channel::mpsc::{self, unbounded, UnboundedReceiver}, FutureExt, StreamExt, }; -use netcore::transport::ConnectionOrigin; -use network::{ - application::storage::PeerMetadataStorage, - peer_manager::{ - conn_notifs_channel, ConnectionNotification, ConnectionRequestSender, - PeerManagerNotification, PeerManagerRequest, PeerManagerRequestSender, - }, - protocols::network::{NetworkEvents, NewNetworkEvents, NewNetworkSender}, - transport::ConnectionMetadata, - ProtocolId, -}; use rand::rngs::StdRng; use std::{ collections::{HashMap, HashSet}, @@ -571,7 +571,7 @@ fn start_node_mempool( let (_ac_endpoint_sender, ac_endpoint_receiver) = mpsc::channel(1_024); let (_quorum_store_sender, quorum_store_receiver) = mpsc::channel(1_024); let (_mempool_notifier, mempool_listener) = - mempool_notifications::new_mempool_notifier_listener_pair(); + aptos_mempool_notifications::new_mempool_notifier_listener_pair(); let (reconfig_sender, reconfig_events) = aptos_channel::new(QueueStyle::LIFO, 1, None); let reconfig_event_subscriber = ReconfigNotificationListener { notification_receiver: reconfig_events, diff --git a/mempool/src/tests/shared_mempool_test.rs b/mempool/src/tests/shared_mempool_test.rs index 283093dd1eed6..cc1230a77f92e 100644 --- a/mempool/src/tests/shared_mempool_test.rs +++ b/mempool/src/tests/shared_mempool_test.rs @@ -7,9 +7,9 @@ use crate::{ QuorumStoreRequest, }; use aptos_consensus_types::common::RejectedTransactionSummary; +use aptos_mempool_notifications::MempoolNotificationSender; use aptos_types::transaction::Transaction; use futures::{channel::oneshot, executor::block_on, sink::SinkExt}; -use mempool_notifications::MempoolNotificationSender; use tokio::runtime::Builder; #[test] diff --git a/mempool/src/tests/test_framework.rs b/mempool/src/tests/test_framework.rs index 94e57868ac1d1..77deabc33f2c7 100644 --- a/mempool/src/tests/test_framework.rs +++ b/mempool/src/tests/test_framework.rs @@ -17,18 +17,8 @@ use aptos_config::{ use aptos_event_notifications::{ReconfigNotification, ReconfigNotificationListener}; use aptos_id_generator::U32IdGenerator; use aptos_infallible::{Mutex, RwLock}; -use aptos_storage_interface::mock::MockDbReaderWriter; -use aptos_types::on_chain_config::OnChainConfigPayload; -use aptos_types::{ - account_address::AccountAddress, mempool_status::MempoolStatusCode, - transaction::SignedTransaction, -}; -use aptos_vm_validator::mocks::mock_vm_validator::MockVMValidator; -use channel::aptos_channel; -use channel::message_queues::QueueStyle; -use futures::{channel::oneshot, SinkExt}; -use mempool_notifications::MempoolNotifier; -use network::{ +use aptos_mempool_notifications::MempoolNotifier; +use aptos_network::{ application::storage::PeerMetadataStorage, peer_manager::{PeerManagerNotification, PeerManagerRequest}, protocols::{direct_send::Message, rpc::InboundRpcRequest}, @@ -42,6 +32,16 @@ use network::{ }, ProtocolId, }; +use aptos_storage_interface::mock::MockDbReaderWriter; +use aptos_types::on_chain_config::OnChainConfigPayload; +use aptos_types::{ + account_address::AccountAddress, mempool_status::MempoolStatusCode, + transaction::SignedTransaction, +}; +use aptos_vm_validator::mocks::mock_vm_validator::MockVMValidator; +use channel::aptos_channel; +use channel::message_queues::QueueStyle; +use futures::{channel::oneshot, SinkExt}; use std::{ collections::{HashMap, HashSet}, sync::Arc, @@ -487,7 +487,7 @@ fn setup_mempool( let (ac_endpoint_sender, ac_endpoint_receiver) = mpsc_channel(); let (quorum_store_sender, quorum_store_receiver) = mpsc_channel(); let (mempool_notifier, mempool_listener) = - mempool_notifications::new_mempool_notifier_listener_pair(); + aptos_mempool_notifications::new_mempool_notifier_listener_pair(); let mempool = Arc::new(Mutex::new(CoreMempool::new(&config))); let vm_validator = Arc::new(RwLock::new(MockVMValidator)); diff --git a/network/Cargo.toml b/network/Cargo.toml index f05bb3e8ba61e..3ca1b42ec0f15 100644 --- a/network/Cargo.toml +++ b/network/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "network" +name = "aptos-network" description = "Aptos networking stack" version = "0.1.0" @@ -22,7 +22,10 @@ aptos-crypto-derive = { workspace = true } aptos-id-generator = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } +aptos-memsocket = { workspace = true, optional = true } aptos-metrics-core = { workspace = true } +aptos-netcore = { workspace = true } +aptos-num-variants = { workspace = true } aptos-proptest-helpers = { workspace = true, optional = true } aptos-rate-limiter = { workspace = true } aptos-short-hex-str = { workspace = true } @@ -36,9 +39,6 @@ futures = { workspace = true } futures-util = { workspace = true } hex = { workspace = true } itertools = { workspace = true } -memsocket = { workspace = true, optional = true } -netcore = { workspace = true } -num-variants = { workspace = true } once_cell = { workspace = true } pin-project = { workspace = true } proptest ={ workspace = true, optional = true } @@ -55,17 +55,17 @@ tokio-util = { workspace = true } [dev-dependencies] aptos-bitvec = { workspace = true, features = ["fuzzing"] } aptos-config = { workspace = true, features = ["testing"] } +aptos-memsocket = { workspace = true } +aptos-netcore = { workspace = true, features = ["testing"] } aptos-proptest-helpers = { workspace = true } aptos-time-service = { workspace = true, features = ["testing"] } aptos-types = { workspace = true, features = ["fuzzing"] } maplit = { workspace = true } -memsocket = { workspace = true } -netcore = { workspace = true, features = ["testing"] } proptest = { workspace = true } proptest-derive = { workspace = true } rand_core = { workspace = true } [features] default = [] -fuzzing = ["aptos-bitvec/fuzzing", "aptos-config/fuzzing", "aptos-crypto/fuzzing", "aptos-types/fuzzing", "aptos-proptest-helpers", "aptos-time-service/testing", "aptos-types/fuzzing", "memsocket/testing", "netcore/fuzzing", "proptest", "proptest-derive"] -testing = ["aptos-config/testing", "aptos-time-service/testing", "memsocket/testing", "netcore/testing"] +fuzzing = ["aptos-bitvec/fuzzing", "aptos-config/fuzzing", "aptos-crypto/fuzzing", "aptos-types/fuzzing", "aptos-proptest-helpers", "aptos-time-service/testing", "aptos-types/fuzzing", "aptos-memsocket/testing", "aptos-netcore/fuzzing", "proptest", "proptest-derive"] +testing = ["aptos-config/testing", "aptos-time-service/testing", "aptos-memsocket/testing", "aptos-netcore/testing"] diff --git a/network/builder/Cargo.toml b/network/builder/Cargo.toml index 20c60d1214dc4..d3f1545e1bd6e 100644 --- a/network/builder/Cargo.toml +++ b/network/builder/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "network-builder" +name = "aptos-network-builder" description = "Aptos network builder for constructing a network" version = "0.1.0" @@ -18,6 +18,9 @@ aptos-crypto = { workspace = true } aptos-event-notifications = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } +aptos-netcore = { workspace = true } +aptos-network = { workspace = true } +aptos-network-discovery = { workspace = true } aptos-secure-storage = { workspace = true } aptos-time-service = { workspace = true } aptos-types = { workspace = true } @@ -25,9 +28,6 @@ async-trait = { workspace = true } bcs = { workspace = true } channel = { workspace = true } futures = { workspace = true } -netcore = { workspace = true } -network = { workspace = true } -network-discovery = { workspace = true } rand = { workspace = true } serde = { workspace = true } tokio = { workspace = true } diff --git a/network/builder/src/builder.rs b/network/builder/src/builder.rs index f089bca7e4540..7ce85076b9347 100644 --- a/network/builder/src/builder.rs +++ b/network/builder/src/builder.rs @@ -22,9 +22,7 @@ use aptos_crypto::x25519::PublicKey; use aptos_event_notifications::{EventSubscriptionService, ReconfigNotificationListener}; use aptos_infallible::RwLock; use aptos_logger::prelude::*; -use aptos_time_service::TimeService; -use aptos_types::{chain_id::ChainId, network_address::NetworkAddress}; -use network::{ +use aptos_network::{ application::storage::PeerMetadataStorage, connectivity_manager::{builder::ConnectivityManagerBuilder, ConnectivityRequest}, constants::MAX_MESSAGE_SIZE, @@ -38,9 +36,11 @@ use network::{ network::{AppConfig, NewNetworkEvents, NewNetworkSender}, }, }; +use aptos_time_service::TimeService; +use aptos_types::{chain_id::ChainId, network_address::NetworkAddress}; -use netcore::transport::tcp::TCPBufferCfg; -use network_discovery::DiscoveryChangeListener; +use aptos_netcore::transport::tcp::TCPBufferCfg; +use aptos_network_discovery::DiscoveryChangeListener; use std::{ clone::Clone, collections::{HashMap, HashSet}, diff --git a/network/builder/src/dummy.rs b/network/builder/src/dummy.rs index 992fbf495a60b..8f6ff020cbe0c 100644 --- a/network/builder/src/dummy.rs +++ b/network/builder/src/dummy.rs @@ -10,13 +10,8 @@ use aptos_config::{ }; use aptos_crypto::{test_utils::TEST_SEED, x25519, Uniform}; use aptos_infallible::RwLock; -use aptos_time_service::TimeService; -use aptos_types::{chain_id::ChainId, network_address::NetworkAddress, PeerId}; -use async_trait::async_trait; -use channel::aptos_channel; -use futures::{executor::block_on, StreamExt}; -use netcore::transport::ConnectionOrigin; -use network::{ +use aptos_netcore::transport::ConnectionOrigin; +use aptos_network::{ application::storage::PeerMetadataStorage, error::NetworkError, peer_manager::{ @@ -31,6 +26,11 @@ use network::{ }, ProtocolId, }; +use aptos_time_service::TimeService; +use aptos_types::{chain_id::ChainId, network_address::NetworkAddress, PeerId}; +use async_trait::async_trait; +use channel::aptos_channel; +use futures::{executor::block_on, StreamExt}; use rand::{rngs::StdRng, SeedableRng}; use serde::{Deserialize, Serialize}; use std::{ diff --git a/network/builder/src/lib.rs b/network/builder/src/lib.rs index fbb891d4f4469..ea9ab5304bd57 100644 --- a/network/builder/src/lib.rs +++ b/network/builder/src/lib.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 -pub use network::protocols::rpc::error::RpcError; +pub use aptos_network::protocols::rpc::error::RpcError; pub mod builder; // TODO: This module should be test-only, e.g., #[cfg(any(feature = "testing", test))] diff --git a/network/builder/src/test.rs b/network/builder/src/test.rs index 7cef03b71cab9..553bda7f797f2 100644 --- a/network/builder/src/test.rs +++ b/network/builder/src/test.rs @@ -3,8 +3,8 @@ //! Integration tests for validator_network. use crate::dummy::{setup_network, DummyMsg}; +use aptos_network::protocols::network::{ApplicationNetworkSender, Event}; use futures::{future::join, StreamExt}; -use network::protocols::network::{ApplicationNetworkSender, Event}; use std::time::Duration; #[test] diff --git a/network/discovery/Cargo.toml b/network/discovery/Cargo.toml index b509710fec6e0..3fe22cab294c3 100644 --- a/network/discovery/Cargo.toml +++ b/network/discovery/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "network-discovery" +name = "aptos-network-discovery" description = "Aptos Network Peer Discovery" version = "0.1.0" @@ -19,6 +19,7 @@ aptos-crypto = { workspace = true } aptos-event-notifications = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-network = { workspace = true } aptos-secure-storage = { workspace = true } aptos-short-hex-str = { workspace = true } aptos-time-service = { workspace = true } @@ -26,13 +27,12 @@ aptos-types = { workspace = true } bcs = { workspace = true } channel = { workspace = true } futures = { workspace = true } -network = { workspace = true } once_cell = { workspace = true } serde_yaml = { workspace = true } tokio = { workspace = true } [dev-dependencies] aptos-config = { workspace = true, features = ["testing"] } +aptos-netcore = { workspace = true, features = ["fuzzing"] } aptos-temppath = { workspace = true } -netcore = { workspace = true, features = ["fuzzing"] } rand = { workspace = true } diff --git a/network/discovery/src/file.rs b/network/discovery/src/file.rs index cc585e12ccf2d..542df6daff3ad 100644 --- a/network/discovery/src/file.rs +++ b/network/discovery/src/file.rs @@ -61,11 +61,11 @@ mod tests { config::{Peer, PeerRole}, network_id::NetworkContext, }; + use aptos_network::connectivity_manager::{ConnectivityRequest, DiscoverySource}; use aptos_temppath::TempPath; use aptos_types::{network_address::NetworkAddress, PeerId}; use channel::Receiver; use futures::StreamExt; - use network::connectivity_manager::{ConnectivityRequest, DiscoverySource}; use std::{collections::HashSet, str::FromStr, sync::Arc}; use tokio::time::sleep; @@ -73,8 +73,10 @@ mod tests { let check_interval = Duration::from_millis(5); // TODO: Figure out why mock time doesn't work right let time_service = TimeService::real(); - let (conn_mgr_reqs_tx, conn_mgr_reqs_rx) = - channel::new(1, &network::counters::PENDING_CONNECTIVITY_MANAGER_REQUESTS); + let (conn_mgr_reqs_tx, conn_mgr_reqs_rx) = channel::new( + 1, + &aptos_network::counters::PENDING_CONNECTIVITY_MANAGER_REQUESTS, + ); let listener_task = async move { let listener = DiscoveryChangeListener::file( NetworkContext::mock(), diff --git a/network/discovery/src/lib.rs b/network/discovery/src/lib.rs index a404d8463ee46..f05df59cf4114 100644 --- a/network/discovery/src/lib.rs +++ b/network/discovery/src/lib.rs @@ -6,13 +6,13 @@ use aptos_config::{config::PeerSet, network_id::NetworkContext}; use aptos_crypto::x25519; use aptos_event_notifications::ReconfigNotificationListener; use aptos_logger::prelude::*; -use aptos_time_service::TimeService; -use futures::{Stream, StreamExt}; -use network::{ +use aptos_network::{ connectivity_manager::{ConnectivityRequest, DiscoverySource}, counters::inc_by_with_context, logging::NetworkSchema, }; +use aptos_time_service::TimeService; +use futures::{Stream, StreamExt}; use std::{ path::Path, pin::Pin, diff --git a/network/discovery/src/validator_set.rs b/network/discovery/src/validator_set.rs index 6782ed3eb0a18..48a77fa16f177 100644 --- a/network/discovery/src/validator_set.rs +++ b/network/discovery/src/validator_set.rs @@ -12,10 +12,10 @@ use aptos_config::{ use aptos_crypto::x25519; use aptos_event_notifications::ReconfigNotificationListener; use aptos_logger::prelude::*; +use aptos_network::{counters::inc_by_with_context, logging::NetworkSchema}; use aptos_short_hex_str::AsShortHexStr; use aptos_types::on_chain_config::{OnChainConfigPayload, ValidatorSet}; use futures::Stream; -use network::{counters::inc_by_with_context, logging::NetworkSchema}; use std::{ collections::HashSet, pin::Pin, diff --git a/network/memsocket/Cargo.toml b/network/memsocket/Cargo.toml index 63ce30e834df5..5fa45b40cdca1 100644 --- a/network/memsocket/Cargo.toml +++ b/network/memsocket/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "memsocket" +name = "aptos-memsocket" description = "Aptos memsocket" version = "0.1.0" diff --git a/network/memsocket/src/lib.rs b/network/memsocket/src/lib.rs index 7dd1012b58831..3d2ae5f76ce0b 100644 --- a/network/memsocket/src/lib.rs +++ b/network/memsocket/src/lib.rs @@ -52,7 +52,7 @@ impl SwitchBoard { /// ```rust,no_run /// use std::io::Result; /// -/// use memsocket::{MemoryListener, MemorySocket}; +/// use aptos_memsocket::{MemoryListener, MemorySocket}; /// use futures::prelude::*; /// /// async fn write_stormlight(mut stream: MemorySocket) -> Result<()> { @@ -101,7 +101,7 @@ impl MemoryListener { /// Create a MemoryListener bound to port 16: /// /// ```rust,no_run - /// use memsocket::MemoryListener; + /// use aptos_memsocket::MemoryListener; /// /// # fn main () -> ::std::io::Result<()> { /// let listener = MemoryListener::bind(16)?; @@ -161,7 +161,7 @@ impl MemoryListener { /// # Examples /// /// ```rust - /// use memsocket::MemoryListener; + /// use aptos_memsocket::MemoryListener; /// /// # fn main () -> ::std::io::Result<()> { /// let listener = MemoryListener::bind(16)?; @@ -183,7 +183,7 @@ impl MemoryListener { /// /// ```rust,no_run /// use futures::prelude::*; - /// use memsocket::MemoryListener; + /// use aptos_memsocket::MemoryListener; /// /// # async fn work () -> ::std::io::Result<()> { /// let mut listener = MemoryListener::bind(16)?; @@ -244,7 +244,7 @@ impl<'a> Stream for Incoming<'a> { /// /// ```rust, no_run /// use futures::prelude::*; -/// use memsocket::MemorySocket; +/// use aptos_memsocket::MemorySocket; /// /// # async fn run() -> ::std::io::Result<()> { /// let (mut socket_a, mut socket_b) = MemorySocket::new_pair(); @@ -276,7 +276,7 @@ impl MemorySocket { /// # Examples /// /// ```rust - /// use memsocket::MemorySocket; + /// use aptos_memsocket::MemorySocket; /// /// let (socket_a, socket_b) = MemorySocket::new_pair(); /// ``` @@ -307,7 +307,7 @@ impl MemorySocket { /// # Examples /// /// ```rust,no_run - /// use memsocket::MemorySocket; + /// use aptos_memsocket::MemorySocket; /// /// # fn main () -> ::std::io::Result<()> { /// let socket = MemorySocket::connect(16)?; diff --git a/network/memsocket/tests/memory_listener.rs b/network/memsocket/tests/memory_listener.rs index 245e38d8b9d94..ab460341a0227 100644 --- a/network/memsocket/tests/memory_listener.rs +++ b/network/memsocket/tests/memory_listener.rs @@ -1,12 +1,12 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_memsocket::{MemoryListener, MemorySocket}; use futures::{ executor::block_on, io::{AsyncReadExt, AsyncWriteExt}, stream::StreamExt, }; -use memsocket::{MemoryListener, MemorySocket}; use std::io::Result; #[test] diff --git a/network/memsocket/tests/memory_socket.rs b/network/memsocket/tests/memory_socket.rs index a3e4dcf5af2dc..d397206bfa692 100644 --- a/network/memsocket/tests/memory_socket.rs +++ b/network/memsocket/tests/memory_socket.rs @@ -1,11 +1,11 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 +use aptos_memsocket::MemorySocket; use futures::{ executor::block_on, io::{AsyncReadExt, AsyncWriteExt}, }; -use memsocket::MemorySocket; use std::io::Result; #[test] diff --git a/network/netcore/Cargo.toml b/network/netcore/Cargo.toml index a737095cb62bc..3b30438fecb99 100644 --- a/network/netcore/Cargo.toml +++ b/network/netcore/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "netcore" +name = "aptos-netcore" description = "Aptos netcore" version = "0.1.0" @@ -13,22 +13,22 @@ repository = { workspace = true } rust-version = { workspace = true } [dependencies] +aptos-memsocket = { workspace = true } +aptos-proxy = { workspace = true } aptos-types = { workspace = true } bytes = { workspace = true } futures = { workspace = true } -memsocket = { workspace = true } pin-project = { workspace = true } -proxy = { workspace = true } serde = { workspace = true } tokio = { workspace = true } tokio-util = { workspace = true } url = { workspace = true } [dev-dependencies] +aptos-memsocket = { workspace = true } aptos-types = { workspace = true, features = ["fuzzing"] } -memsocket = { workspace = true } [features] default = [] -fuzzing = ["memsocket/fuzzing", "aptos-types/fuzzing"] -testing = ["memsocket/testing"] +fuzzing = ["aptos-memsocket/fuzzing", "aptos-types/fuzzing"] +testing = ["aptos-memsocket/testing"] diff --git a/network/netcore/src/framing.rs b/network/netcore/src/framing.rs index 9d49782ed90ee..7f20cb2faed71 100644 --- a/network/netcore/src/framing.rs +++ b/network/netcore/src/framing.rs @@ -71,9 +71,9 @@ where #[cfg(test)] mod test { use super::{read_u16frame, read_u16frame_len, write_u16frame, write_u16frame_len}; + use aptos_memsocket::MemorySocket; use bytes::BytesMut; use futures::{executor::block_on, io::AsyncWriteExt}; - use memsocket::MemorySocket; use std::io::Result; #[test] diff --git a/network/netcore/src/transport/memory.rs b/network/netcore/src/transport/memory.rs index ffb4e88825081..3f5301ca07b92 100644 --- a/network/netcore/src/transport/memory.rs +++ b/network/netcore/src/transport/memory.rs @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 use crate::transport::Transport; +use aptos_memsocket::{MemoryListener, MemorySocket}; use aptos_types::{ network_address::{parse_memory, NetworkAddress, Protocol}, PeerId, }; use futures::{future, stream::Stream}; -use memsocket::{MemoryListener, MemorySocket}; use std::{ io, pin::Pin, diff --git a/network/netcore/src/transport/proxy_protocol.rs b/network/netcore/src/transport/proxy_protocol.rs index 189b46fff0efa..ec1022a09e64d 100644 --- a/network/netcore/src/transport/proxy_protocol.rs +++ b/network/netcore/src/transport/proxy_protocol.rs @@ -134,8 +134,8 @@ pub async fn read_header( #[cfg(test)] mod test { use super::*; + use aptos_memsocket::MemorySocket; use futures::{executor::block_on, future::join, io::AsyncWriteExt}; - use memsocket::MemorySocket; use std::net::ToSocketAddrs; const TEST_DATA: &[u8; 4] = &[0xDE, 0xAD, 0xBE, 0xEF]; diff --git a/network/netcore/src/transport/tcp.rs b/network/netcore/src/transport/tcp.rs index 25c9719acc452..8a856a4b8b723 100644 --- a/network/netcore/src/transport/tcp.rs +++ b/network/netcore/src/transport/tcp.rs @@ -3,6 +3,7 @@ //! TCP Transport use crate::transport::Transport; +use aptos_proxy::Proxy; use aptos_types::{ network_address::{parse_dns_tcp, parse_ip_tcp, parse_tcp, IpFilter, NetworkAddress}, PeerId, @@ -13,7 +14,6 @@ use futures::{ ready, stream::Stream, }; -use proxy::Proxy; use std::{ fmt::Debug, io, diff --git a/network/peer-monitoring-service/client/Cargo.toml b/network/peer-monitoring-service/client/Cargo.toml index cdff9f16b3694..0c11ee0a7cf66 100644 --- a/network/peer-monitoring-service/client/Cargo.toml +++ b/network/peer-monitoring-service/client/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "peer-monitoring-service-client" +name = "aptos-peer-monitoring-service-client" description = "The Aptos peer monitoring service (client-side)" version = "0.1.0" @@ -14,9 +14,9 @@ rust-version = { workspace = true } [dependencies] aptos-config = { workspace = true } +aptos-network = { workspace = true } +aptos-peer-monitoring-service-types = { workspace = true } aptos-types = { workspace = true } async-trait = { workspace = true } channel = { workspace = true } -network = { workspace = true } -peer-monitoring-service-types = { workspace = true } thiserror = { workspace = true } diff --git a/network/peer-monitoring-service/client/src/lib.rs b/network/peer-monitoring-service/client/src/lib.rs index 1408179efce94..73c51a1e428b8 100644 --- a/network/peer-monitoring-service/client/src/lib.rs +++ b/network/peer-monitoring-service/client/src/lib.rs @@ -4,9 +4,7 @@ #![forbid(unsafe_code)] use aptos_config::network_id::PeerNetworkId; -use aptos_types::PeerId; -use async_trait::async_trait; -use network::{ +use aptos_network::{ application::{ interface::{MultiNetworkSender, NetworkInterface}, storage::{LockingHashMap, PeerMetadataStorage}, @@ -17,10 +15,12 @@ use network::{ }, ProtocolId, }; -use peer_monitoring_service_types::{ +use aptos_peer_monitoring_service_types::{ PeerMonitoringServiceError, PeerMonitoringServiceMessage, PeerMonitoringServiceRequest, PeerMonitoringServiceResponse, }; +use aptos_types::PeerId; +use async_trait::async_trait; use std::{sync::Arc, time::Duration}; use thiserror::Error; diff --git a/network/peer-monitoring-service/server/Cargo.toml b/network/peer-monitoring-service/server/Cargo.toml index 37a8dfc65c4b3..fa468a1eff348 100644 --- a/network/peer-monitoring-service/server/Cargo.toml +++ b/network/peer-monitoring-service/server/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "peer-monitoring-service-server" +name = "aptos-peer-monitoring-service-server" description = "The peer monitoring service (server-side)" version = "0.1.0" @@ -17,15 +17,15 @@ aptos-bounded-executor = { workspace = true } aptos-config = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-netcore = { workspace = true } +aptos-network = { workspace = true } +aptos-peer-monitoring-service-types = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } bytes = { workspace = true } channel = { workspace = true } futures = { workspace = true } -netcore = { workspace = true } -network = { workspace = true } once_cell = { workspace = true } -peer-monitoring-service-types = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true } diff --git a/network/peer-monitoring-service/server/src/lib.rs b/network/peer-monitoring-service/server/src/lib.rs index 5626ba7608d78..f420db1636891 100644 --- a/network/peer-monitoring-service/server/src/lib.rs +++ b/network/peer-monitoring-service/server/src/lib.rs @@ -8,15 +8,15 @@ use crate::{ metrics::{increment_counter, start_timer}, network::PeerMonitoringServiceNetworkEvents, }; -use ::network::{application::storage::PeerMetadataStorage, ProtocolId}; use aptos_bounded_executor::BoundedExecutor; use aptos_config::config::PeerMonitoringServiceConfig; use aptos_logger::prelude::*; -use futures::stream::StreamExt; -use peer_monitoring_service_types::{ +use aptos_network::{application::storage::PeerMetadataStorage, ProtocolId}; +use aptos_peer_monitoring_service_types::{ ConnectedPeersResponse, PeerMonitoringServiceError, PeerMonitoringServiceRequest, PeerMonitoringServiceResponse, Result, ServerProtocolVersionResponse, }; +use futures::stream::StreamExt; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, sync::Arc}; use thiserror::Error; diff --git a/network/peer-monitoring-service/server/src/logging.rs b/network/peer-monitoring-service/server/src/logging.rs index 6993e11134129..a52a9af11bdbe 100644 --- a/network/peer-monitoring-service/server/src/logging.rs +++ b/network/peer-monitoring-service/server/src/logging.rs @@ -3,7 +3,7 @@ use crate::Error; use aptos_logger::Schema; -use peer_monitoring_service_types::PeerMonitoringServiceRequest; +use aptos_peer_monitoring_service_types::PeerMonitoringServiceRequest; use serde::Serialize; #[derive(Schema)] diff --git a/network/peer-monitoring-service/server/src/metrics.rs b/network/peer-monitoring-service/server/src/metrics.rs index 14c1318980e11..d04d67259a718 100644 --- a/network/peer-monitoring-service/server/src/metrics.rs +++ b/network/peer-monitoring-service/server/src/metrics.rs @@ -4,7 +4,7 @@ use aptos_metrics_core::{ register_histogram_vec, register_int_counter_vec, HistogramTimer, HistogramVec, IntCounterVec, }; -use network::ProtocolId; +use aptos_network::ProtocolId; use once_cell::sync::Lazy; /// Counter for pending network events to the monitoring service (server-side) diff --git a/network/peer-monitoring-service/server/src/network.rs b/network/peer-monitoring-service/server/src/network.rs index 5f7da3ffd2e94..576fb8d7ffc56 100644 --- a/network/peer-monitoring-service/server/src/network.rs +++ b/network/peer-monitoring-service/server/src/network.rs @@ -3,6 +3,15 @@ use crate::metrics; use aptos_config::config::PeerMonitoringServiceConfig; +use aptos_network::{ + peer_manager::{ConnectionNotification, PeerManagerNotification}, + protocols::network::{AppConfig, Event, NetworkEvents, NewNetworkEvents, RpcError}, + ProtocolId, +}; +use aptos_peer_monitoring_service_types::{ + PeerMonitoringServiceMessage, PeerMonitoringServiceRequest, PeerMonitoringServiceResponse, + Result, +}; use aptos_types::PeerId; use bytes::Bytes; use channel::{aptos_channel, message_queues::QueueStyle}; @@ -11,15 +20,6 @@ use futures::{ future, stream::{BoxStream, Stream, StreamExt}, }; -use network::{ - peer_manager::{ConnectionNotification, PeerManagerNotification}, - protocols::network::{AppConfig, Event, NetworkEvents, NewNetworkEvents, RpcError}, - ProtocolId, -}; -use peer_monitoring_service_types::{ - PeerMonitoringServiceMessage, PeerMonitoringServiceRequest, PeerMonitoringServiceResponse, - Result, -}; use std::{ pin::Pin, task::{Context, Poll}, diff --git a/network/peer-monitoring-service/server/src/tests.rs b/network/peer-monitoring-service/server/src/tests.rs index 7b70c93314772..2b62293a64628 100644 --- a/network/peer-monitoring-service/server/src/tests.rs +++ b/network/peer-monitoring-service/server/src/tests.rs @@ -11,11 +11,8 @@ use aptos_config::{ network_id::{NetworkId, PeerNetworkId}, }; use aptos_logger::Level; -use aptos_types::{network_address::NetworkAddress, PeerId}; -use channel::aptos_channel; -use futures::channel::oneshot; -use netcore::transport::ConnectionOrigin; -use network::{ +use aptos_netcore::transport::ConnectionOrigin; +use aptos_network::{ application::{ storage::PeerMetadataStorage, types::{PeerError, PeerInfo, PeerState}, @@ -28,10 +25,13 @@ use network::{ }, transport::{ConnectionId, ConnectionMetadata}, }; -use peer_monitoring_service_types::{ +use aptos_peer_monitoring_service_types::{ ConnectedPeersResponse, PeerMonitoringServiceError, PeerMonitoringServiceMessage, PeerMonitoringServiceRequest, PeerMonitoringServiceResponse, ServerProtocolVersionResponse, }; +use aptos_types::{network_address::NetworkAddress, PeerId}; +use channel::aptos_channel; +use futures::channel::oneshot; use std::{ collections::{hash_map::Entry, HashMap}, str::FromStr, diff --git a/network/peer-monitoring-service/types/Cargo.toml b/network/peer-monitoring-service/types/Cargo.toml index 069f1d263297f..157ab17b14b9d 100644 --- a/network/peer-monitoring-service/types/Cargo.toml +++ b/network/peer-monitoring-service/types/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "peer-monitoring-service-types" +name = "aptos-peer-monitoring-service-types" description = "Common types offered by the peer monitoring service" version = "0.1.0" @@ -14,6 +14,6 @@ rust-version = { workspace = true } [dependencies] aptos-config = { workspace = true } -network = { workspace = true } +aptos-network = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } diff --git a/network/peer-monitoring-service/types/src/lib.rs b/network/peer-monitoring-service/types/src/lib.rs index 42d0e351fdbe3..0a6323da806f7 100644 --- a/network/peer-monitoring-service/types/src/lib.rs +++ b/network/peer-monitoring-service/types/src/lib.rs @@ -4,7 +4,7 @@ #![forbid(unsafe_code)] use aptos_config::network_id::PeerNetworkId; -use network::application::types::PeerInfo; +use aptos_network::application::types::PeerInfo; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, convert::TryFrom}; use thiserror::Error; diff --git a/network/src/connectivity_manager/mod.rs b/network/src/connectivity_manager/mod.rs index 37a5013c7bee9..9efb402bc0750 100644 --- a/network/src/connectivity_manager/mod.rs +++ b/network/src/connectivity_manager/mod.rs @@ -39,6 +39,8 @@ use aptos_config::{ use aptos_crypto::x25519; use aptos_infallible::RwLock; use aptos_logger::prelude::*; +use aptos_netcore::transport::ConnectionOrigin; +use aptos_num_variants::NumVariants; use aptos_short_hex_str::AsShortHexStr; use aptos_time_service::{TimeService, TimeServiceTrait}; use aptos_types::{network_address::NetworkAddress, PeerId}; @@ -47,8 +49,6 @@ use futures::{ future::{BoxFuture, FutureExt}, stream::{FuturesUnordered, StreamExt}, }; -use netcore::transport::ConnectionOrigin; -use num_variants::NumVariants; use rand::{ prelude::{SeedableRng, SmallRng}, seq::SliceRandom, diff --git a/network/src/counters.rs b/network/src/counters.rs index c9bde3e50a7ff..4e4cd82eca740 100644 --- a/network/src/counters.rs +++ b/network/src/counters.rs @@ -7,9 +7,9 @@ use aptos_metrics_core::{ register_histogram_vec, register_int_counter_vec, register_int_gauge, register_int_gauge_vec, Histogram, HistogramVec, IntCounter, IntCounterVec, IntGauge, IntGaugeVec, }; +use aptos_netcore::transport::ConnectionOrigin; use aptos_short_hex_str::AsShortHexStr; use aptos_types::PeerId; -use netcore::transport::ConnectionOrigin; use once_cell::sync::Lazy; // some type labels diff --git a/network/src/logging.rs b/network/src/logging.rs index 3d45787c0083f..751ee7c2c12fb 100644 --- a/network/src/logging.rs +++ b/network/src/logging.rs @@ -8,7 +8,7 @@ //! use aptos_config::network_id::NetworkContext; //! use aptos_logger::info; //! use aptos_types::{PeerId, network_address::NetworkAddress}; -//! use network::logging::NetworkSchema; +//! use aptos_network::logging::NetworkSchema; //! //! info!( //! NetworkSchema::new(&NetworkContext::mock()) @@ -26,8 +26,8 @@ use crate::{ }; use aptos_config::network_id::NetworkContext; use aptos_logger::Schema; +use aptos_netcore::transport::ConnectionOrigin; use aptos_types::{network_address::NetworkAddress, PeerId}; -use netcore::transport::ConnectionOrigin; #[derive(Schema)] pub struct NetworkSchema<'a> { diff --git a/network/src/noise/handshake.rs b/network/src/noise/handshake.rs index ba5f3c3e937ba..146b296c708ab 100644 --- a/network/src/noise/handshake.rs +++ b/network/src/noise/handshake.rs @@ -18,10 +18,10 @@ use aptos_config::{ use aptos_crypto::{noise, x25519}; use aptos_infallible::{duration_since_epoch, RwLock}; use aptos_logger::trace; +use aptos_netcore::transport::ConnectionOrigin; use aptos_short_hex_str::{AsShortHexStr, ShortHexStr}; use aptos_types::PeerId; use futures::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; -use netcore::transport::ConnectionOrigin; use std::{collections::HashMap, convert::TryFrom as _, fmt::Debug, sync::Arc}; /// In a mutually authenticated network, a client message is accompanied with a timestamp. @@ -467,8 +467,8 @@ mod test { use crate::testutils::fake_socket::ReadWriteTestSocket; use aptos_config::config::{Peer, PeerRole}; use aptos_crypto::{test_utils::TEST_SEED, traits::Uniform as _}; + use aptos_memsocket::MemorySocket; use futures::{executor::block_on, future::join}; - use memsocket::MemorySocket; use rand::SeedableRng as _; const TEST_SEED_2: [u8; 32] = [42; 32]; diff --git a/network/src/noise/mod.rs b/network/src/noise/mod.rs index 5b9feab54ebea..a7a1f6322dfb0 100644 --- a/network/src/noise/mod.rs +++ b/network/src/noise/mod.rs @@ -11,9 +11,9 @@ //! Usage example: //! //! ``` -//! use network::noise::{AntiReplayTimestamps, HandshakeAuthMode, NoiseUpgrader}; +//! use aptos_network::noise::{AntiReplayTimestamps, HandshakeAuthMode, NoiseUpgrader}; //! use futures::{executor, future, io::{AsyncReadExt, AsyncWriteExt}}; -//! use memsocket::MemorySocket; +//! use aptos_memsocket::MemorySocket; //! use aptos_config::{config::{Peer, PeerRole, RoleType}, network_id::{NetworkContext, NetworkId}}; //! use aptos_crypto::{x25519, ed25519, Uniform, PrivateKey, test_utils::TEST_SEED}; //! use aptos_infallible::RwLock; diff --git a/network/src/noise/stream.rs b/network/src/noise/stream.rs index 345c702506633..431b2c59ca075 100644 --- a/network/src/noise/stream.rs +++ b/network/src/noise/stream.rs @@ -553,12 +553,12 @@ mod test { }; use aptos_config::network_id::NetworkContext; use aptos_crypto::{test_utils::TEST_SEED, traits::Uniform as _, x25519}; + use aptos_memsocket::MemorySocket; use futures::{ executor::block_on, future::join, io::{AsyncReadExt, AsyncWriteExt}, }; - use memsocket::MemorySocket; use rand::SeedableRng as _; use std::io; diff --git a/network/src/peer/fuzzing.rs b/network/src/peer/fuzzing.rs index e67871991f110..945477c4ff40c 100644 --- a/network/src/peer/fuzzing.rs +++ b/network/src/peer/fuzzing.rs @@ -12,13 +12,13 @@ use crate::{ transport::{Connection, ConnectionId, ConnectionMetadata}, }; use aptos_config::{config::PeerRole, network_id::NetworkContext}; +use aptos_memsocket::MemorySocket; +use aptos_netcore::transport::ConnectionOrigin; use aptos_proptest_helpers::ValueGenerator; use aptos_time_service::TimeService; use aptos_types::{network_address::NetworkAddress, PeerId}; use channel::{aptos_channel, message_queues::QueueStyle}; use futures::{executor::block_on, future, io::AsyncReadExt, sink::SinkExt, stream::StreamExt}; -use memsocket::MemorySocket; -use netcore::transport::ConnectionOrigin; use proptest::{arbitrary::any, collection::vec}; use std::time::Duration; diff --git a/network/src/peer/test.rs b/network/src/peer/test.rs index bc8c23f852504..30b4139ac0000 100644 --- a/network/src/peer/test.rs +++ b/network/src/peer/test.rs @@ -23,6 +23,8 @@ use crate::{ ProtocolId, }; use aptos_config::{config::PeerRole, network_id::NetworkContext}; +use aptos_memsocket::MemorySocket; +use aptos_netcore::transport::ConnectionOrigin; use aptos_time_service::{MockTimeService, TimeService}; use aptos_types::{network_address::NetworkAddress, PeerId}; use bytes::Bytes; @@ -34,8 +36,6 @@ use futures::{ stream::{StreamExt, TryStreamExt}, SinkExt, }; -use memsocket::MemorySocket; -use netcore::transport::ConnectionOrigin; use std::{collections::HashSet, str::FromStr, time::Duration}; use tokio::runtime::{Handle, Runtime}; use tokio_util::compat::{ diff --git a/network/src/peer_manager/builder.rs b/network/src/peer_manager/builder.rs index f44c33f9a55df..aa698f0bca5c4 100644 --- a/network/src/peer_manager/builder.rs +++ b/network/src/peer_manager/builder.rs @@ -21,16 +21,16 @@ use aptos_config::{ use aptos_crypto::x25519; use aptos_infallible::RwLock; use aptos_logger::prelude::*; -use aptos_rate_limiter::rate_limit::TokenBucketRateLimiter; -use aptos_time_service::TimeService; -use aptos_types::{chain_id::ChainId, network_address::NetworkAddress, PeerId}; -use channel::{self, aptos_channel, message_queues::QueueStyle}; #[cfg(any(test, feature = "testing", feature = "fuzzing"))] -use netcore::transport::memory::MemoryTransport; -use netcore::transport::{ +use aptos_netcore::transport::memory::MemoryTransport; +use aptos_netcore::transport::{ tcp::{TCPBufferCfg, TcpSocket, TcpTransport}, Transport, }; +use aptos_rate_limiter::rate_limit::TokenBucketRateLimiter; +use aptos_time_service::TimeService; +use aptos_types::{chain_id::ChainId, network_address::NetworkAddress, PeerId}; +use channel::{self, aptos_channel, message_queues::QueueStyle}; use std::{clone::Clone, collections::HashMap, fmt::Debug, net::IpAddr, sync::Arc}; use tokio::runtime::Handle; @@ -150,7 +150,7 @@ impl PeerManagerContext { #[cfg(any(test, feature = "testing", feature = "fuzzing"))] type MemoryPeerManager = - PeerManager, NoiseStream>; + PeerManager, NoiseStream>; type TcpPeerManager = PeerManager, NoiseStream>; enum TransportPeerManager { diff --git a/network/src/peer_manager/mod.rs b/network/src/peer_manager/mod.rs index 91dabbc036271..23bbd14c4bae9 100644 --- a/network/src/peer_manager/mod.rs +++ b/network/src/peer_manager/mod.rs @@ -23,6 +23,7 @@ use crate::{ }; use aptos_config::network_id::NetworkContext; use aptos_logger::prelude::*; +use aptos_netcore::transport::{ConnectionOrigin, Transport}; use aptos_rate_limiter::rate_limit::TokenBucketRateLimiter; use aptos_short_hex_str::AsShortHexStr; use aptos_time_service::{TimeService, TimeServiceTrait}; @@ -34,7 +35,6 @@ use futures::{ sink::SinkExt, stream::StreamExt, }; -use netcore::transport::{ConnectionOrigin, Transport}; use std::{ collections::{hash_map::Entry, HashMap}, marker::PhantomData, diff --git a/network/src/peer_manager/tests.rs b/network/src/peer_manager/tests.rs index 3aa3ace2f233e..b47930aad0fae 100644 --- a/network/src/peer_manager/tests.rs +++ b/network/src/peer_manager/tests.rs @@ -26,16 +26,16 @@ use aptos_config::{ network_id::NetworkContext, }; use aptos_infallible::RwLock; +use aptos_memsocket::MemorySocket; +use aptos_netcore::transport::{ + boxed::BoxedTransport, memory::MemoryTransport, ConnectionOrigin, TransportExt, +}; use aptos_rate_limiter::rate_limit::TokenBucketRateLimiter; use aptos_time_service::TimeService; use aptos_types::{network_address::NetworkAddress, PeerId}; use bytes::Bytes; use channel::{aptos_channel, message_queues::QueueStyle}; use futures::{channel::oneshot, io::AsyncWriteExt, stream::StreamExt}; -use memsocket::MemorySocket; -use netcore::transport::{ - boxed::BoxedTransport, memory::MemoryTransport, ConnectionOrigin, TransportExt, -}; use std::{collections::HashMap, sync::Arc}; use tokio::runtime::Handle; use tokio_util::compat::{ diff --git a/network/src/peer_manager/transport.rs b/network/src/peer_manager/transport.rs index e1ee216ca39b5..9f73b98e8c8b5 100644 --- a/network/src/peer_manager/transport.rs +++ b/network/src/peer_manager/transport.rs @@ -9,6 +9,7 @@ use crate::{ use anyhow::format_err; use aptos_config::network_id::NetworkContext; use aptos_logger::prelude::*; +use aptos_netcore::transport::{ConnectionOrigin, Transport}; use aptos_short_hex_str::AsShortHexStr; use aptos_time_service::{TimeService, TimeServiceTrait}; use aptos_types::{network_address::NetworkAddress, PeerId}; @@ -20,7 +21,6 @@ use futures::{ sink::SinkExt, stream::{Fuse, FuturesUnordered, StreamExt}, }; -use netcore::transport::{ConnectionOrigin, Transport}; use std::time::Instant; #[derive(Debug)] diff --git a/network/src/protocols/identity.rs b/network/src/protocols/identity.rs index 31fd4dceb1211..7554440325412 100644 --- a/network/src/protocols/identity.rs +++ b/network/src/protocols/identity.rs @@ -4,9 +4,9 @@ //! Protocol used to exchange supported protocol information with a remote. use crate::protocols::wire::handshake::v1::HandshakeMsg; +use aptos_netcore::framing::{read_u16frame, write_u16frame}; use bytes::BytesMut; use futures::io::{AsyncRead, AsyncWrite, AsyncWriteExt}; -use netcore::framing::{read_u16frame, write_u16frame}; use std::io; /// The Handshake exchange protocol. @@ -49,9 +49,9 @@ mod tests { ProtocolId, }; use aptos_config::network_id::NetworkId; + use aptos_memsocket::MemorySocket; use aptos_types::chain_id::ChainId; use futures::{executor::block_on, future::join}; - use memsocket::MemorySocket; use std::{collections::BTreeMap, iter::FromIterator}; fn build_test_connection() -> (MemorySocket, MemorySocket) { diff --git a/network/src/protocols/wire/messaging/v1/test.rs b/network/src/protocols/wire/messaging/v1/test.rs index 39735195f993c..6b0a74ddacd1a 100644 --- a/network/src/protocols/wire/messaging/v1/test.rs +++ b/network/src/protocols/wire/messaging/v1/test.rs @@ -6,10 +6,10 @@ use crate::{ protocols::stream::{InboundStreamBuffer, OutboundStream, StreamFragment, StreamHeader}, testutils::fake_socket::{ReadOnlyTestSocket, ReadWriteTestSocket}, }; +use aptos_memsocket::MemorySocket; use bcs::test_helpers::assert_canonical_encode_decode; use futures::{executor::block_on, future, sink::SinkExt, stream::StreamExt}; use futures_util::stream::select; -use memsocket::MemorySocket; use proptest::{collection::vec, prelude::*}; // Ensure serialization of ProtocolId enum takes 1 byte. diff --git a/network/src/testutils/fake_socket.rs b/network/src/testutils/fake_socket.rs index 760d37d9b647e..b533b8389e448 100644 --- a/network/src/testutils/fake_socket.rs +++ b/network/src/testutils/fake_socket.rs @@ -7,12 +7,12 @@ //! - ReadWriteTestSocket: a similar wrapper but around MemorySocket to retrieve handshake messages being sent as well. //! +use aptos_memsocket::MemorySocket; use futures::{ io::{AsyncRead, AsyncWrite}, ready, task::{Context, Poll}, }; -use memsocket::MemorySocket; use std::{io, pin::Pin}; // diff --git a/network/src/testutils/test_node.rs b/network/src/testutils/test_node.rs index 7b4201bfb7835..2fe15308fcd42 100644 --- a/network/src/testutils/test_node.rs +++ b/network/src/testutils/test_node.rs @@ -15,10 +15,10 @@ use aptos_config::{ config::{PeerRole, RoleType}, network_id::{NetworkContext, NetworkId, PeerNetworkId}, }; +use aptos_netcore::transport::ConnectionOrigin; use aptos_types::PeerId; use async_trait::async_trait; use futures::StreamExt; -use netcore::transport::ConnectionOrigin; use std::{collections::HashMap, sync::Arc, time::Duration}; /// A sender to a node to mock an inbound network message from [`PeerManager`] diff --git a/network/src/transport/mod.rs b/network/src/transport/mod.rs index 75f5d5f3aa1fa..e9948ee85d707 100644 --- a/network/src/transport/mod.rs +++ b/network/src/transport/mod.rs @@ -16,6 +16,7 @@ use aptos_config::{ use aptos_crypto::x25519; use aptos_id_generator::{IdGenerator, U32IdGenerator}; use aptos_logger::prelude::*; +use aptos_netcore::transport::{proxy_protocol, tcp, ConnectionOrigin, Transport}; use aptos_short_hex_str::AsShortHexStr; use aptos_time_service::{timeout, TimeService, TimeServiceTrait}; use aptos_types::{ @@ -28,12 +29,11 @@ use futures::{ io::{AsyncRead, AsyncWrite}, stream::{Stream, StreamExt, TryStreamExt}, }; -use netcore::transport::{proxy_protocol, tcp, ConnectionOrigin, Transport}; use serde::{Deserialize, Serialize}; use std::{collections::BTreeMap, convert::TryFrom, fmt, io, pin::Pin, sync::Arc, time::Duration}; // Re-exposed for aptos-network-checker -pub use netcore::transport::tcp::{resolve_and_connect, TCPBufferCfg, TcpSocket}; +pub use aptos_netcore::transport::tcp::{resolve_and_connect, TCPBufferCfg, TcpSocket}; #[cfg(test)] mod test; diff --git a/network/src/transport/test.rs b/network/src/transport/test.rs index 04dfc11507177..2b7127d55c354 100644 --- a/network/src/transport/test.rs +++ b/network/src/transport/test.rs @@ -11,6 +11,10 @@ use aptos_config::{ }; use aptos_crypto::{test_utils::TEST_SEED, traits::Uniform, x25519}; use aptos_infallible::RwLock; +use aptos_netcore::{ + framing::{read_u16frame, write_u16frame}, + transport::{memory, ConnectionOrigin, Transport}, +}; use aptos_time_service::MockTimeService; use aptos_types::{ chain_id::ChainId, @@ -19,10 +23,6 @@ use aptos_types::{ }; use bytes::{Bytes, BytesMut}; use futures::{future, io::AsyncWriteExt, stream::StreamExt}; -use netcore::{ - framing::{read_u16frame, write_u16frame}, - transport::{memory, ConnectionOrigin, Transport}, -}; use rand::{rngs::StdRng, SeedableRng}; use std::{collections::HashMap, io, iter::FromIterator, sync::Arc}; use tokio::runtime::Runtime; diff --git a/secure/storage/Cargo.toml b/secure/storage/Cargo.toml index d1a1e9ac15271..2bac91ee212db 100644 --- a/secure/storage/Cargo.toml +++ b/secure/storage/Cargo.toml @@ -18,6 +18,7 @@ aptos-crypto = { workspace = true } aptos-github-client = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } +aptos-schemadb = { workspace = true } aptos-temppath = { workspace = true } aptos-time-service = { workspace = true } aptos-vault-client = { workspace = true } @@ -26,7 +27,6 @@ bcs = { workspace = true } chrono = { workspace = true } enum_dispatch = { workspace = true } rand = { workspace = true } -schemadb = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } @@ -34,8 +34,8 @@ thiserror = { workspace = true } [dev-dependencies] aptos-crypto = { workspace = true, features = ["fuzzing"] } aptos-crypto-derive = { workspace = true } +aptos-schemadb = { workspace = true, features = ["fuzzing"] } rand = { workspace = true } -schemadb = { workspace = true, features = ["fuzzing"] } [features] fuzzing = ["aptos-crypto/fuzzing"] diff --git a/secure/storage/github/Cargo.toml b/secure/storage/github/Cargo.toml index 35e1ce9a07035..12b6186b5d460 100644 --- a/secure/storage/github/Cargo.toml +++ b/secure/storage/github/Cargo.toml @@ -13,7 +13,7 @@ repository = { workspace = true } rust-version = { workspace = true } [dependencies] -proxy = { workspace = true } +aptos-proxy = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } diff --git a/secure/storage/github/src/lib.rs b/secure/storage/github/src/lib.rs index 4b5dc3bb00228..a6db0df6f7446 100644 --- a/secure/storage/github/src/lib.rs +++ b/secure/storage/github/src/lib.rs @@ -3,7 +3,7 @@ #![forbid(unsafe_code)] -use proxy::Proxy; +use aptos_proxy::Proxy; use serde::{Deserialize, Serialize}; use serde_json::json; use thiserror::Error; diff --git a/secure/storage/src/rocks_db.rs b/secure/storage/src/rocks_db.rs index 0606e519ac3a0..c1b515040d2a4 100644 --- a/secure/storage/src/rocks_db.rs +++ b/secure/storage/src/rocks_db.rs @@ -7,12 +7,12 @@ use anyhow::{anyhow, Result}; use aptos_crypto::_once_cell::sync::Lazy; use aptos_infallible::Mutex; use aptos_logger::prelude::*; -use aptos_time_service::{TimeService, TimeServiceTrait}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, ColumnFamilyName, Options, SchemaBatch, DB, }; +use aptos_time_service::{TimeService, TimeServiceTrait}; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use std::path::PathBuf; diff --git a/secure/storage/src/tests/rocks_db.rs b/secure/storage/src/tests/rocks_db.rs index cf00460a434aa..bf3c5b903896f 100644 --- a/secure/storage/src/tests/rocks_db.rs +++ b/secure/storage/src/tests/rocks_db.rs @@ -5,8 +5,8 @@ use crate::rocks_db::database_schema::{SecureStorageKey, SecureStorageSchema, Se use crate::rocks_db::RocksDbStorage; use crate::tests::suite; use crate::{GetResponse, Storage}; +use aptos_schemadb::schema::fuzzing::assert_encode_decode; use aptos_temppath::TempPath; -use schemadb::schema::fuzzing::assert_encode_decode; #[test] fn rocks_db() { diff --git a/state-sync/aptos-data-client/Cargo.toml b/state-sync/aptos-data-client/Cargo.toml index 4aa9ed1d11295..8ac5535a53884 100644 --- a/state-sync/aptos-data-client/Cargo.toml +++ b/state-sync/aptos-data-client/Cargo.toml @@ -19,6 +19,8 @@ aptos-id-generator = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-netcore = { workspace = true } +aptos-network = { workspace = true } aptos-storage-service-client = { workspace = true } aptos-storage-service-types = { workspace = true } aptos-time-service = { workspace = true } @@ -26,19 +28,17 @@ aptos-types = { workspace = true } async-trait = { workspace = true } futures = { workspace = true } itertools = { workspace = true } -netcore = { workspace = true } -network = { workspace = true } rand = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true } [dev-dependencies] +aptos-network = { workspace = true, features = ["fuzzing"] } aptos-storage-service-server = { workspace = true } aptos-time-service = { workspace = true, features = ["async", "testing"] } bcs = { workspace = true } channel = { workspace = true } claims = { workspace = true } maplit = { workspace = true } -network = { workspace = true, features = ["fuzzing"] } tokio = { workspace = true } diff --git a/state-sync/aptos-data-client/src/aptosnet/mod.rs b/state-sync/aptos-data-client/src/aptosnet/mod.rs index c9195c500ef53..bfe4412e4df3e 100644 --- a/state-sync/aptos-data-client/src/aptosnet/mod.rs +++ b/state-sync/aptos-data-client/src/aptosnet/mod.rs @@ -20,6 +20,10 @@ use aptos_config::{ use aptos_id_generator::{IdGenerator, U64IdGenerator}; use aptos_infallible::RwLock; use aptos_logger::prelude::*; +use aptos_network::{ + application::interface::NetworkInterface, + protocols::{rpc::error::RpcError, wire::handshake::v1::ProtocolId}, +}; use aptos_storage_service_client::StorageServiceClient; use aptos_storage_service_types::requests::{ DataRequest, EpochEndingLedgerInfoRequest, NewTransactionOutputsWithProofRequest, @@ -40,10 +44,6 @@ use aptos_types::{ }; use async_trait::async_trait; use futures::StreamExt; -use network::{ - application::interface::NetworkInterface, - protocols::{rpc::error::RpcError, wire::handshake::v1::ProtocolId}, -}; use rand::seq::SliceRandom; use std::{convert::TryFrom, fmt, sync::Arc, time::Duration}; use tokio::{runtime::Handle, task::JoinHandle}; diff --git a/state-sync/aptos-data-client/src/aptosnet/state.rs b/state-sync/aptos-data-client/src/aptosnet/state.rs index ece035d102ed4..bf9babea7e54d 100644 --- a/state-sync/aptos-data-client/src/aptosnet/state.rs +++ b/state-sync/aptos-data-client/src/aptosnet/state.rs @@ -10,11 +10,11 @@ use aptos_config::{ network_id::{NetworkId, PeerNetworkId}, }; use aptos_logger::prelude::*; +use aptos_netcore::transport::ConnectionOrigin; +use aptos_network::application::storage::PeerMetadataStorage; use aptos_storage_service_types::requests::StorageServiceRequest; use aptos_storage_service_types::responses::StorageServerSummary; use itertools::Itertools; -use netcore::transport::ConnectionOrigin; -use network::application::storage::PeerMetadataStorage; use std::{ cmp::min, collections::{HashMap, HashSet}, diff --git a/state-sync/aptos-data-client/src/aptosnet/tests.rs b/state-sync/aptos-data-client/src/aptosnet/tests.rs index 11be4cf088e22..6ea3932b222f2 100644 --- a/state-sync/aptos-data-client/src/aptosnet/tests.rs +++ b/state-sync/aptos-data-client/src/aptosnet/tests.rs @@ -8,6 +8,13 @@ use aptos_config::{ network_id::{NetworkId, PeerNetworkId}, }; use aptos_crypto::HashValue; +use aptos_netcore::transport::ConnectionOrigin; +use aptos_network::{ + application::{interface::MultiNetworkSender, storage::PeerMetadataStorage, types::PeerState}, + peer_manager::{ConnectionRequestSender, PeerManagerRequest, PeerManagerRequestSender}, + protocols::{network::NewNetworkSender, wire::handshake::v1::ProtocolId}, + transport::ConnectionMetadata, +}; use aptos_storage_service_client::{StorageServiceClient, StorageServiceNetworkSender}; use aptos_storage_service_server::network::{NetworkRequest, ResponseSender}; use aptos_storage_service_types::{ @@ -33,13 +40,6 @@ use channel::{aptos_channel, message_queues::QueueStyle}; use claims::{assert_err, assert_matches, assert_none}; use futures::StreamExt; use maplit::hashmap; -use netcore::transport::ConnectionOrigin; -use network::{ - application::{interface::MultiNetworkSender, storage::PeerMetadataStorage, types::PeerState}, - peer_manager::{ConnectionRequestSender, PeerManagerRequest, PeerManagerRequestSender}, - protocols::{network::NewNetworkSender, wire::handshake::v1::ProtocolId}, - transport::ConnectionMetadata, -}; use std::{collections::hash_map::Entry, sync::Arc, time::Duration}; fn mock_ledger_info(version: Version) -> LedgerInfoWithSignatures { diff --git a/state-sync/inter-component/event-notifications/Cargo.toml b/state-sync/inter-component/event-notifications/Cargo.toml index ed4eb23a5fb55..a48fb16f0c392 100644 --- a/state-sync/inter-component/event-notifications/Cargo.toml +++ b/state-sync/inter-component/event-notifications/Cargo.toml @@ -26,11 +26,11 @@ thiserror = { workspace = true } [dev-dependencies] aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-executor-test-helpers = { workspace = true } aptos-temppath = { workspace = true } aptos-vm = { workspace = true } aptos-vm-genesis = { workspace = true } -aptosdb = { workspace = true } bcs = { workspace = true } claims = { workspace = true } move-binary-format = { workspace = true } diff --git a/state-sync/inter-component/event-notifications/src/tests.rs b/state-sync/inter-component/event-notifications/src/tests.rs index 8aa021daffa97..976dca5976d61 100644 --- a/state-sync/inter-component/event-notifications/src/tests.rs +++ b/state-sync/inter-component/event-notifications/src/tests.rs @@ -7,6 +7,7 @@ use crate::{ Error, EventNotificationListener, EventNotificationSender, EventSubscriptionService, ReconfigNotificationListener, }; +use aptos_db::AptosDB; use aptos_executor_test_helpers::bootstrap_genesis; use aptos_infallible::RwLock; use aptos_storage_interface::DbReaderWriter; @@ -19,7 +20,6 @@ use aptos_types::{ transaction::{Transaction, Version, WriteSetPayload}, }; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use claims::{assert_lt, assert_matches, assert_ok}; use futures::{FutureExt, StreamExt}; use move_core_types::language_storage::TypeTag; diff --git a/state-sync/inter-component/mempool-notifications/Cargo.toml b/state-sync/inter-component/mempool-notifications/Cargo.toml index 26504a5a0b711..2cb37e99755b6 100644 --- a/state-sync/inter-component/mempool-notifications/Cargo.toml +++ b/state-sync/inter-component/mempool-notifications/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mempool-notifications" +name = "aptos-mempool-notifications" description = "The notification interface between state sync and mempool" version = "0.1.0" diff --git a/state-sync/state-sync-v2/data-streaming-service/Cargo.toml b/state-sync/state-sync-v2/data-streaming-service/Cargo.toml index 1b7cdc11dfae3..0493317f37950 100644 --- a/state-sync/state-sync-v2/data-streaming-service/Cargo.toml +++ b/state-sync/state-sync-v2/data-streaming-service/Cargo.toml @@ -20,13 +20,13 @@ aptos-id-generator = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-network = { workspace = true } aptos-short-hex-str = { workspace = true } aptos-types = { workspace = true } async-trait = { workspace = true } channel = { workspace = true } enum_dispatch = { workspace = true } futures = { workspace = true } -network = { workspace = true } once_cell = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } diff --git a/state-sync/state-sync-v2/state-sync-driver/Cargo.toml b/state-sync/state-sync-v2/state-sync-driver/Cargo.toml index f4b18e1ab9394..8921b6eb6853d 100644 --- a/state-sync/state-sync-v2/state-sync-driver/Cargo.toml +++ b/state-sync/state-sync-v2/state-sync-driver/Cargo.toml @@ -23,16 +23,16 @@ aptos-event-notifications = { workspace = true } aptos-executor-types = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } +aptos-mempool-notifications = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-schemadb = { workspace = true } aptos-scratchpad = { workspace = true } aptos-storage-interface = { workspace = true } aptos-types = { workspace = true } async-trait = { workspace = true } bcs = { workspace = true } futures = { workspace = true } -mempool-notifications = { workspace = true } once_cell = { workspace = true } -schemadb = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true } @@ -41,21 +41,21 @@ tokio-stream = { workspace = true } [dev-dependencies] anyhow = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-executor = { workspace = true } aptos-executor-test-helpers = { workspace = true } aptos-genesis = { workspace = true, features = ["testing"] } +aptos-network = { workspace = true } aptos-storage-service-client = { workspace = true } aptos-storage-service-types = { workspace = true } aptos-temppath = { workspace = true } aptos-time-service = { workspace = true, features = ["async", "testing"] } aptos-vm = { workspace = true } aptos-vm-genesis = { workspace = true } -aptosdb = { workspace = true } async-trait = { workspace = true } bcs = { workspace = true } channel = { workspace = true } claims = { workspace = true } mockall = { workspace = true } move-core-types = { workspace = true } -network = { workspace = true } rand = { workspace = true } diff --git a/state-sync/state-sync-v2/state-sync-driver/src/driver.rs b/state-sync/state-sync-v2/state-sync-driver/src/driver.rs index 863a2eba947b9..8e8702fbef67f 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/driver.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/driver.rs @@ -30,10 +30,10 @@ use aptos_data_streaming_service::streaming_client::{ use aptos_event_notifications::EventSubscriptionService; use aptos_infallible::Mutex; use aptos_logger::prelude::*; +use aptos_mempool_notifications::MempoolNotificationSender; use aptos_storage_interface::DbReader; use aptos_types::waypoint::Waypoint; use futures::StreamExt; -use mempool_notifications::MempoolNotificationSender; use std::{sync::Arc, time::SystemTime}; use tokio::task::yield_now; use tokio::time::{interval, Duration}; diff --git a/state-sync/state-sync-v2/state-sync-driver/src/driver_factory.rs b/state-sync/state-sync-v2/state-sync-driver/src/driver_factory.rs index efcf87b127056..2aa6f855c75b7 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/driver_factory.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/driver_factory.rs @@ -18,10 +18,10 @@ use aptos_data_streaming_service::streaming_client::StreamingServiceClient; use aptos_event_notifications::{EventNotificationSender, EventSubscriptionService}; use aptos_executor_types::ChunkExecutorTrait; use aptos_infallible::Mutex; +use aptos_mempool_notifications::MempoolNotificationSender; use aptos_storage_interface::DbReaderWriter; use aptos_types::{move_resource::MoveStorage, waypoint::Waypoint}; use futures::{channel::mpsc, executor::block_on}; -use mempool_notifications::MempoolNotificationSender; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, diff --git a/state-sync/state-sync-v2/state-sync-driver/src/metadata_storage.rs b/state-sync/state-sync-v2/state-sync-driver/src/metadata_storage.rs index ed9896ee176ef..31e5806706d2b 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/metadata_storage.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/metadata_storage.rs @@ -7,12 +7,12 @@ use crate::{ }; use anyhow::{anyhow, Result}; use aptos_logger::prelude::*; -use aptos_types::ledger_info::LedgerInfoWithSignatures; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, ColumnFamilyName, Options, SchemaBatch, DB, }; +use aptos_types::ledger_info::LedgerInfoWithSignatures; use serde::{Deserialize, Serialize}; use std::{path::Path, sync::Arc, time::Instant}; diff --git a/state-sync/state-sync-v2/state-sync-driver/src/notification_handlers.rs b/state-sync/state-sync-v2/state-sync-driver/src/notification_handlers.rs index 7fb23bfa82ef8..7378a5b2b121e 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/notification_handlers.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/notification_handlers.rs @@ -13,13 +13,13 @@ use aptos_data_streaming_service::data_notification::NotificationId; use aptos_event_notifications::{EventNotificationSender, EventSubscriptionService}; use aptos_infallible::Mutex; use aptos_logger::prelude::*; +use aptos_mempool_notifications::MempoolNotificationSender; use aptos_types::{ contract_event::ContractEvent, ledger_info::LedgerInfoWithSignatures, transaction::{Transaction, Version}, }; use futures::{channel::mpsc, stream::FusedStream, Stream}; -use mempool_notifications::MempoolNotificationSender; use serde::Serialize; use std::{ pin::Pin, diff --git a/state-sync/state-sync-v2/state-sync-driver/src/storage_synchronizer.rs b/state-sync/state-sync-v2/state-sync-driver/src/storage_synchronizer.rs index 4cf59a457e015..6e447f423092c 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/storage_synchronizer.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/storage_synchronizer.rs @@ -17,6 +17,7 @@ use aptos_event_notifications::EventSubscriptionService; use aptos_executor_types::ChunkExecutorTrait; use aptos_infallible::Mutex; use aptos_logger::prelude::*; +use aptos_mempool_notifications::MempoolNotificationSender; use aptos_storage_interface::{DbReader, DbReaderWriter, StateSnapshotReceiver}; use aptos_types::state_store::state_key::StateKey; use aptos_types::state_store::state_value::StateValue; @@ -31,7 +32,6 @@ use aptos_types::{ use async_trait::async_trait; use futures::channel::mpsc::UnboundedSender; use futures::{channel::mpsc, SinkExt, StreamExt}; -use mempool_notifications::MempoolNotificationSender; use std::{ future::Future, sync::{ diff --git a/state-sync/state-sync-v2/state-sync-driver/src/tests/driver.rs b/state-sync/state-sync-v2/state-sync-driver/src/tests/driver.rs index 594f02a9c4fad..094a50f41a488 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/tests/driver.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/tests/driver.rs @@ -13,12 +13,15 @@ use aptos_config::config::{NodeConfig, RoleType}; use aptos_consensus_notifications::{ConsensusNotificationSender, ConsensusNotifier}; use aptos_data_client::aptosnet::AptosNetDataClient; use aptos_data_streaming_service::streaming_client::new_streaming_service_client_listener_pair; +use aptos_db::AptosDB; use aptos_event_notifications::{ EventNotificationListener, EventSubscriptionService, ReconfigNotificationListener, }; use aptos_executor::chunk_executor::ChunkExecutor; use aptos_executor_test_helpers::bootstrap_genesis; use aptos_infallible::RwLock; +use aptos_mempool_notifications::MempoolNotificationListener; +use aptos_network::application::{interface::MultiNetworkSender, storage::PeerMetadataStorage}; use aptos_storage_interface::DbReaderWriter; use aptos_storage_service_client::StorageServiceClient; use aptos_time_service::TimeService; @@ -29,11 +32,8 @@ use aptos_types::{ waypoint::Waypoint, }; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use claims::{assert_err, assert_none}; use futures::{FutureExt, StreamExt}; -use mempool_notifications::MempoolNotificationListener; -use network::application::{interface::MultiNetworkSender, storage::PeerMetadataStorage}; use std::{collections::HashMap, sync::Arc}; // TODO(joshlind): extend these tests to cover more functionality! @@ -253,7 +253,7 @@ async fn create_driver_for_tests( let (consensus_notifier, consensus_listener) = aptos_consensus_notifications::new_consensus_notifier_listener_pair(5000); let (mempool_notifier, mempool_listener) = - mempool_notifications::new_mempool_notifier_listener_pair(); + aptos_mempool_notifications::new_mempool_notifier_listener_pair(); // Create the chunk executor let chunk_executor = Arc::new(ChunkExecutor::::new(db_rw.clone())); diff --git a/state-sync/state-sync-v2/state-sync-driver/src/tests/driver_factory.rs b/state-sync/state-sync-v2/state-sync-driver/src/tests/driver_factory.rs index b93b1a501afe0..fdf7ae1428fa5 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/tests/driver_factory.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/tests/driver_factory.rs @@ -12,21 +12,21 @@ use aptos_config::{ use aptos_consensus_notifications::new_consensus_notifier_listener_pair; use aptos_data_client::aptosnet::AptosNetDataClient; use aptos_data_streaming_service::streaming_client::new_streaming_service_client_listener_pair; +use aptos_db::AptosDB; use aptos_event_notifications::EventSubscriptionService; use aptos_executor::chunk_executor::ChunkExecutor; use aptos_executor_test_helpers::bootstrap_genesis; use aptos_genesis::test_utils::test_config; use aptos_infallible::RwLock; +use aptos_mempool_notifications::new_mempool_notifier_listener_pair; +use aptos_network::application::{interface::MultiNetworkSender, storage::PeerMetadataStorage}; use aptos_storage_interface::DbReaderWriter; use aptos_storage_service_client::StorageServiceClient; use aptos_temppath::TempPath; use aptos_time_service::TimeService; use aptos_types::on_chain_config::ON_CHAIN_CONFIG_REGISTRY; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use futures::{FutureExt, StreamExt}; -use mempool_notifications::new_mempool_notifier_listener_pair; -use network::application::{interface::MultiNetworkSender, storage::PeerMetadataStorage}; use std::{collections::HashMap, sync::Arc}; #[test] diff --git a/state-sync/state-sync-v2/state-sync-driver/src/tests/metadata_storage.rs b/state-sync/state-sync-v2/state-sync-driver/src/tests/metadata_storage.rs index e8d0b4cc4400b..f392b3d70f7b1 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/tests/metadata_storage.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/tests/metadata_storage.rs @@ -8,9 +8,9 @@ use crate::{ }, tests::utils::{create_epoch_ending_ledger_info, create_ledger_info_at_version}, }; +use aptos_schemadb::schema::fuzzing::assert_encode_decode; use aptos_temppath::TempPath; use claims::{assert_err, assert_none}; -use schemadb::schema::fuzzing::assert_encode_decode; #[test] fn test_create_then_open() { diff --git a/state-sync/state-sync-v2/state-sync-driver/src/tests/storage_synchronizer.rs b/state-sync/state-sync-v2/state-sync-driver/src/tests/storage_synchronizer.rs index 01a4391b75a53..81a814aff6ffb 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/tests/storage_synchronizer.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/tests/storage_synchronizer.rs @@ -27,6 +27,7 @@ use aptos_data_streaming_service::data_notification::NotificationId; use aptos_event_notifications::EventSubscriptionService; use aptos_executor_types::ChunkCommitNotification; use aptos_infallible::{Mutex, RwLock}; +use aptos_mempool_notifications::MempoolNotificationListener; use aptos_storage_interface::DbReaderWriter; use aptos_types::{ ledger_info::LedgerInfoWithSignatures, @@ -35,7 +36,6 @@ use aptos_types::{ }; use claims::assert_matches; use futures::StreamExt; -use mempool_notifications::MempoolNotificationListener; use mockall::predicate::always; use std::{sync::Arc, time::Duration}; use tokio::task::JoinHandle; @@ -509,7 +509,7 @@ fn create_storage_synchronizer( // Create the mempool notification handler let (mempool_notification_sender, mempool_notification_listener) = - mempool_notifications::new_mempool_notifier_listener_pair(); + aptos_mempool_notifications::new_mempool_notifier_listener_pair(); let mempool_notification_handler = MempoolNotificationHandler::new(mempool_notification_sender); // Create the metadata storage diff --git a/state-sync/state-sync-v2/state-sync-driver/src/tests/utils.rs b/state-sync/state-sync-v2/state-sync-driver/src/tests/utils.rs index c33628e6334aa..528bac7dd7339 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/tests/utils.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/tests/utils.rs @@ -12,6 +12,7 @@ use aptos_data_streaming_service::{ data_notification::DataNotification, data_stream::DataStreamListener, streaming_client::Epoch, }; use aptos_event_notifications::EventNotificationListener; +use aptos_mempool_notifications::{CommittedTransaction, MempoolNotificationListener}; use aptos_storage_service_types::responses::CompleteDataRange; use aptos_types::aggregate_signature::AggregateSignature; use aptos_types::on_chain_config::ValidatorSet; @@ -37,7 +38,6 @@ use aptos_types::{ }; use futures::channel::mpsc; use futures::StreamExt; -use mempool_notifications::{CommittedTransaction, MempoolNotificationListener}; use move_core_types::language_storage::TypeTag; use rand::rngs::OsRng; use rand::Rng; diff --git a/state-sync/state-sync-v2/state-sync-driver/src/utils.rs b/state-sync/state-sync-v2/state-sync-driver/src/utils.rs index 0d05ca0919021..95e8d8017266c 100644 --- a/state-sync/state-sync-v2/state-sync-driver/src/utils.rs +++ b/state-sync/state-sync-v2/state-sync-driver/src/utils.rs @@ -18,13 +18,13 @@ use aptos_data_streaming_service::{ use aptos_event_notifications::EventSubscriptionService; use aptos_infallible::Mutex; use aptos_logger::prelude::*; +use aptos_mempool_notifications::MempoolNotificationSender; use aptos_storage_interface::DbReader; use aptos_types::{ epoch_change::Verifier, epoch_state::EpochState, ledger_info::LedgerInfoWithSignatures, transaction::Version, }; use futures::StreamExt; -use mempool_notifications::MempoolNotificationSender; use std::{sync::Arc, time::Duration}; use tokio::time::timeout; diff --git a/state-sync/storage-service/client/Cargo.toml b/state-sync/storage-service/client/Cargo.toml index 8d791bac3b27f..97039cb40777c 100644 --- a/state-sync/storage-service/client/Cargo.toml +++ b/state-sync/storage-service/client/Cargo.toml @@ -14,9 +14,9 @@ rust-version = { workspace = true } [dependencies] aptos-config = { workspace = true } +aptos-network = { workspace = true } aptos-storage-service-types = { workspace = true } aptos-types = { workspace = true } async-trait = { workspace = true } channel = { workspace = true } -network = { workspace = true } thiserror = { workspace = true } diff --git a/state-sync/storage-service/client/src/lib.rs b/state-sync/storage-service/client/src/lib.rs index 922d7eefde6c8..5b2d1bfd6b204 100644 --- a/state-sync/storage-service/client/src/lib.rs +++ b/state-sync/storage-service/client/src/lib.rs @@ -4,12 +4,7 @@ #![forbid(unsafe_code)] use aptos_config::network_id::PeerNetworkId; -use aptos_storage_service_types::requests::StorageServiceRequest; -use aptos_storage_service_types::responses::StorageServiceResponse; -use aptos_storage_service_types::{StorageServiceError, StorageServiceMessage}; -use aptos_types::PeerId; -use async_trait::async_trait; -use network::{ +use aptos_network::{ application::{ interface::{MultiNetworkSender, NetworkInterface}, storage::{LockingHashMap, PeerMetadataStorage}, @@ -20,6 +15,11 @@ use network::{ }, ProtocolId, }; +use aptos_storage_service_types::requests::StorageServiceRequest; +use aptos_storage_service_types::responses::StorageServiceResponse; +use aptos_storage_service_types::{StorageServiceError, StorageServiceMessage}; +use aptos_types::PeerId; +use async_trait::async_trait; use std::{sync::Arc, time::Duration}; use thiserror::Error; diff --git a/state-sync/storage-service/server/Cargo.toml b/state-sync/storage-service/server/Cargo.toml index f305af10ca95d..7bc8e428e24f7 100644 --- a/state-sync/storage-service/server/Cargo.toml +++ b/state-sync/storage-service/server/Cargo.toml @@ -18,6 +18,7 @@ aptos-config = { workspace = true } aptos-infallible = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } +aptos-network = { workspace = true } aptos-storage-interface = { workspace = true } aptos-storage-service-types = { workspace = true } aptos-time-service = { workspace = true } @@ -27,7 +28,6 @@ bytes = { workspace = true } channel = { workspace = true } futures = { workspace = true } lru = { workspace = true } -network = { workspace = true } once_cell = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } diff --git a/state-sync/storage-service/server/src/lib.rs b/state-sync/storage-service/server/src/lib.rs index 0f45b22c442cc..1d0f59dba3030 100644 --- a/state-sync/storage-service/server/src/lib.rs +++ b/state-sync/storage-service/server/src/lib.rs @@ -9,11 +9,11 @@ use crate::{ metrics::{increment_counter, start_timer, LRU_CACHE_HIT, LRU_CACHE_PROBE}, network::{ResponseSender, StorageServiceNetworkEvents}, }; -use ::network::ProtocolId; use aptos_bounded_executor::BoundedExecutor; use aptos_config::config::StorageServiceConfig; use aptos_infallible::{Mutex, RwLock}; use aptos_logger::prelude::*; +use aptos_network::ProtocolId; use aptos_storage_interface::DbReader; use aptos_storage_service_types::requests::{ DataRequest, EpochEndingLedgerInfoRequest, StateValuesWithProofRequest, StorageServiceRequest, diff --git a/state-sync/storage-service/server/src/metrics.rs b/state-sync/storage-service/server/src/metrics.rs index c5b1c92568546..a8d7bcf9f635f 100644 --- a/state-sync/storage-service/server/src/metrics.rs +++ b/state-sync/storage-service/server/src/metrics.rs @@ -4,7 +4,7 @@ use aptos_metrics_core::{ register_histogram_vec, register_int_counter_vec, HistogramTimer, HistogramVec, IntCounterVec, }; -use network::ProtocolId; +use aptos_network::ProtocolId; use once_cell::sync::Lazy; /// Useful metric constants for the storage service diff --git a/state-sync/storage-service/server/src/network.rs b/state-sync/storage-service/server/src/network.rs index d1cc23c2c1198..925b8f982116e 100644 --- a/state-sync/storage-service/server/src/network.rs +++ b/state-sync/storage-service/server/src/network.rs @@ -3,6 +3,11 @@ use crate::metrics; use aptos_config::config::StorageServiceConfig; +use aptos_network::{ + peer_manager::{ConnectionNotification, PeerManagerNotification}, + protocols::network::{AppConfig, Event, NetworkEvents, NewNetworkEvents, RpcError}, + ProtocolId, +}; use aptos_storage_service_types::requests::StorageServiceRequest; use aptos_storage_service_types::responses::StorageServiceResponse; use aptos_storage_service_types::{Result, StorageServiceMessage}; @@ -14,11 +19,6 @@ use futures::{ future, stream::{BoxStream, Stream, StreamExt}, }; -use network::{ - peer_manager::{ConnectionNotification, PeerManagerNotification}, - protocols::network::{AppConfig, Event, NetworkEvents, NewNetworkEvents, RpcError}, - ProtocolId, -}; use std::{ pin::Pin, task::{Context, Poll}, diff --git a/state-sync/storage-service/server/src/tests.rs b/state-sync/storage-service/server/src/tests.rs index dc1cac0779206..ec979aa541ab5 100644 --- a/state-sync/storage-service/server/src/tests.rs +++ b/state-sync/storage-service/server/src/tests.rs @@ -9,6 +9,12 @@ use aptos_bitvec::BitVec; use aptos_config::config::StorageServiceConfig; use aptos_crypto::{ed25519::Ed25519PrivateKey, HashValue, PrivateKey, SigningKey, Uniform}; use aptos_logger::Level; +use aptos_network::{ + peer_manager::PeerManagerNotification, + protocols::{ + network::NewNetworkEvents, rpc::InboundRpcRequest, wire::handshake::v1::ProtocolId, + }, +}; use aptos_storage_interface::{DbReader, ExecutedTrees, Order}; use aptos_storage_service_types::requests::{ NewTransactionsOrOutputsWithProofRequest, TransactionsOrOutputsWithProofRequest, @@ -61,12 +67,6 @@ use mockall::{ predicate::{always, eq}, Sequence, }; -use network::{ - peer_manager::PeerManagerNotification, - protocols::{ - network::NewNetworkEvents, rpc::InboundRpcRequest, wire::handshake::v1::ProtocolId, - }, -}; use rand::Rng; use std::{sync::Arc, time::Duration}; use tokio::time::timeout; @@ -1834,7 +1834,7 @@ impl MockClient { async fn send_request( &mut self, request: StorageServiceRequest, - ) -> Receiver> { + ) -> Receiver> { // Create the inbound rpc request let peer_id = PeerId::ZERO; let protocol_id = ProtocolId::StorageServiceRpc; @@ -1860,7 +1860,7 @@ impl MockClient { /// Helper method to wait for and deserialize a response on the specified receiver async fn wait_for_response( &mut self, - receiver: Receiver>, + receiver: Receiver>, ) -> Result { if let Ok(response) = timeout(Duration::from_secs(MAX_RESPONSE_TIMEOUT_SECS), receiver).await @@ -2418,7 +2418,7 @@ async fn get_new_outputs_with_proof( mock_client: &mut MockClient, known_version: u64, known_epoch: u64, -) -> Receiver> { +) -> Receiver> { let data_request = DataRequest::GetNewTransactionOutputsWithProof(NewTransactionOutputsWithProofRequest { known_version, @@ -2434,7 +2434,7 @@ async fn get_new_transactions_with_proof( known_version: u64, known_epoch: u64, include_events: bool, -) -> Receiver> { +) -> Receiver> { let data_request = DataRequest::GetNewTransactionsWithProof(NewTransactionsWithProofRequest { known_version, known_epoch, @@ -2451,7 +2451,7 @@ async fn get_new_transactions_or_outputs_with_proof( known_epoch: u64, include_events: bool, max_num_output_reductions: u64, -) -> Receiver> { +) -> Receiver> { let data_request = DataRequest::GetNewTransactionsOrOutputsWithProof( NewTransactionsOrOutputsWithProofRequest { known_version, @@ -2811,7 +2811,7 @@ fn create_transaction_list_using_sizes( /// and that the response contains the correct data. async fn verify_new_transaction_outputs_with_proof( mock_client: &mut MockClient, - receiver: Receiver>, + receiver: Receiver>, output_list_with_proof: TransactionOutputListWithProof, expected_ledger_info: LedgerInfoWithSignatures, ) { @@ -2837,7 +2837,7 @@ async fn verify_new_transaction_outputs_with_proof( /// and that the response contains the correct data. async fn verify_new_transactions_with_proof( mock_client: &mut MockClient, - receiver: Receiver>, + receiver: Receiver>, expected_transactions_with_proof: TransactionListWithProof, expected_ledger_info: LedgerInfoWithSignatures, ) { @@ -2863,7 +2863,7 @@ async fn verify_new_transactions_with_proof( /// and that the response contains the correct data. async fn verify_new_transactions_or_outputs_with_proof( mock_client: &mut MockClient, - receiver: Receiver>, + receiver: Receiver>, expected_transaction_list_with_proof: Option, expected_output_list_with_proof: Option, expected_ledger_info: LedgerInfoWithSignatures, diff --git a/storage/aptosdb/Cargo.toml b/storage/aptosdb/Cargo.toml index f76f14229716e..52865d5a9cb7f 100644 --- a/storage/aptosdb/Cargo.toml +++ b/storage/aptosdb/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aptosdb" +name = "aptos-db" description = "Aptos database" version = "0.1.0" @@ -17,6 +17,7 @@ anyhow = { workspace = true } aptos-accumulator = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-db-indexer = { workspace = true } aptos-executor-types = { workspace = true } aptos-infallible = { workspace = true } aptos-jellyfish-merkle = { workspace = true } @@ -24,13 +25,13 @@ aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } aptos-proptest-helpers = { workspace = true, optional = true } aptos-rocksdb-options = { workspace = true } +aptos-schemadb = { workspace = true } aptos-scratchpad = { workspace = true } aptos-state-view = { workspace = true } aptos-storage-interface = { workspace = true } aptos-temppath = { workspace = true, optional = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } -aptosdb-indexer = { workspace = true } arc-swap = { workspace = true } arr_macro = { workspace = true } bcs = { workspace = true } @@ -44,7 +45,6 @@ once_cell = { workspace = true } proptest = { workspace = true, optional = true } proptest-derive = { workspace = true, optional = true } rayon = { workspace = true } -schemadb = { workspace = true } serde = { workspace = true } thiserror = { workspace = true } @@ -52,14 +52,14 @@ thiserror = { workspace = true } aptos-executor-types = { workspace = true } aptos-jellyfish-merkle = { workspace = true, features = ["fuzzing"] } aptos-proptest-helpers = { workspace = true } +aptos-schemadb = { workspace = true, features = ["fuzzing"] } aptos-scratchpad = { workspace = true, features = ["fuzzing"] } aptos-temppath = { workspace = true } aptos-types = { workspace = true } proptest = { workspace = true } proptest-derive = { workspace = true } rand = { workspace = true } -schemadb = { workspace = true, features = ["fuzzing"] } [features] default = [] -fuzzing = ["proptest", "proptest-derive", "aptos-proptest-helpers", "aptos-temppath", "aptos-crypto/fuzzing", "aptos-jellyfish-merkle/fuzzing", "aptos-types/fuzzing", "aptos-executor-types/fuzzing", "schemadb/fuzzing", "aptos-scratchpad/fuzzing"] +fuzzing = ["proptest", "proptest-derive", "aptos-proptest-helpers", "aptos-temppath", "aptos-crypto/fuzzing", "aptos-jellyfish-merkle/fuzzing", "aptos-types/fuzzing", "aptos-executor-types/fuzzing", "aptos-schemadb/fuzzing", "aptos-scratchpad/fuzzing"] diff --git a/storage/aptosdb/src/backup/restore_handler.rs b/storage/aptosdb/src/backup/restore_handler.rs index c05111e5c8f72..f0fe399da2d84 100644 --- a/storage/aptosdb/src/backup/restore_handler.rs +++ b/storage/aptosdb/src/backup/restore_handler.rs @@ -9,6 +9,7 @@ use crate::{ }; use anyhow::Result; use aptos_crypto::HashValue; +use aptos_schemadb::DB; use aptos_storage_interface::DbReader; use aptos_types::{ contract_event::ContractEvent, @@ -17,7 +18,6 @@ use aptos_types::{ state_store::{state_key::StateKey, state_value::StateValue}, transaction::{Transaction, TransactionInfo, Version}, }; -use schemadb::DB; use std::sync::Arc; /// Provides functionalities for AptosDB data restore. diff --git a/storage/aptosdb/src/backup/restore_utils.rs b/storage/aptosdb/src/backup/restore_utils.rs index 54135c68e8988..9a6edf83bdfc8 100644 --- a/storage/aptosdb/src/backup/restore_utils.rs +++ b/storage/aptosdb/src/backup/restore_utils.rs @@ -11,6 +11,7 @@ use crate::{ }; use anyhow::{ensure, Result}; use aptos_crypto::HashValue; +use aptos_schemadb::{SchemaBatch, DB}; use aptos_types::proof::position::Position; use aptos_types::{ contract_event::ContractEvent, @@ -18,7 +19,6 @@ use aptos_types::{ proof::{definition::LeafCount, position::FrozenSubTreeIterator}, transaction::{Transaction, TransactionInfo, TransactionOutput, Version}, }; -use schemadb::{SchemaBatch, DB}; use std::sync::Arc; /// Saves the given ledger infos to the ledger store. If a change set is provided, diff --git a/storage/aptosdb/src/db_options.rs b/storage/aptosdb/src/db_options.rs index 071ef6abbcabd..b3b7f9e47761d 100644 --- a/storage/aptosdb/src/db_options.rs +++ b/storage/aptosdb/src/db_options.rs @@ -3,11 +3,11 @@ use crate::schema::*; use aptos_config::config::RocksdbConfig; -use aptos_types::transaction::Version; -use schemadb::{ +use aptos_schemadb::{ BlockBasedOptions, Cache, ColumnFamilyDescriptor, ColumnFamilyName, DBCompressionType, Options, SliceTransform, DEFAULT_COLUMN_FAMILY_NAME, }; +use aptos_types::transaction::Version; const VERSION_SIZE: usize = std::mem::size_of::(); diff --git a/storage/aptosdb/src/event_store/mod.rs b/storage/aptosdb/src/event_store/mod.rs index e1c277ffebd79..cc4e957dc22c0 100644 --- a/storage/aptosdb/src/event_store/mod.rs +++ b/storage/aptosdb/src/event_store/mod.rs @@ -20,6 +20,8 @@ use aptos_crypto::{ hash::{CryptoHash, EventAccumulatorHasher}, HashValue, }; +use aptos_schemadb::iterator::SchemaIterator; +use aptos_schemadb::{schema::ValueCodec, ReadOptions, SchemaBatch, DB}; use aptos_types::{ account_address::AccountAddress, account_config::{new_block_event_key, NewBlockEvent}, @@ -28,8 +30,6 @@ use aptos_types::{ proof::position::Position, transaction::Version, }; -use schemadb::iterator::SchemaIterator; -use schemadb::{schema::ValueCodec, ReadOptions, SchemaBatch, DB}; use std::{ collections::{hash_map::Entry, HashMap, HashSet}, convert::{TryFrom, TryInto}, diff --git a/storage/aptosdb/src/ledger_counters/mod.rs b/storage/aptosdb/src/ledger_counters/mod.rs index c990298b76332..84724795f4b8c 100644 --- a/storage/aptosdb/src/ledger_counters/mod.rs +++ b/storage/aptosdb/src/ledger_counters/mod.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use crate::metrics::LEDGER_COUNTER; +use aptos_num_variants::NumVariants; use num_derive::ToPrimitive; use num_traits::ToPrimitive; -use num_variants::NumVariants; #[cfg(test)] use proptest::{collection::hash_map, prelude::*}; #[cfg(test)] diff --git a/storage/aptosdb/src/ledger_store/ledger_info_test_utils.rs b/storage/aptosdb/src/ledger_store/ledger_info_test_utils.rs index 520405b916142..c714be425d191 100644 --- a/storage/aptosdb/src/ledger_store/ledger_info_test_utils.rs +++ b/storage/aptosdb/src/ledger_store/ledger_info_test_utils.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 use crate::AptosDB; use anyhow::Result; +use aptos_schemadb::SchemaBatch; use aptos_types::{ ledger_info::LedgerInfoWithSignatures, proptest_types::{AccountInfoUniverse, LedgerInfoWithSignaturesGen}, @@ -12,7 +13,6 @@ use proptest::{ collection::vec, prelude::Strategy, }; -use schemadb::SchemaBatch; use std::path::Path; pub fn arb_ledger_infos_with_sigs() -> impl Strategy> { diff --git a/storage/aptosdb/src/ledger_store/mod.rs b/storage/aptosdb/src/ledger_store/mod.rs index e13c587043f08..ba13ae8460bc1 100644 --- a/storage/aptosdb/src/ledger_store/mod.rs +++ b/storage/aptosdb/src/ledger_store/mod.rs @@ -19,6 +19,7 @@ use aptos_crypto::{ hash::{CryptoHash, TransactionAccumulatorHasher}, HashValue, }; +use aptos_schemadb::{ReadOptions, SchemaBatch, DB}; use aptos_types::{ epoch_state::EpochState, ledger_info::LedgerInfoWithSignatures, @@ -30,7 +31,6 @@ use aptos_types::{ }; use arc_swap::ArcSwap; use itertools::Itertools; -use schemadb::{ReadOptions, SchemaBatch, DB}; use std::{ops::Deref, sync::Arc}; #[derive(Debug)] diff --git a/storage/aptosdb/src/lib.rs b/storage/aptosdb/src/lib.rs index e3673c1407262..a50c324a3fa2d 100644 --- a/storage/aptosdb/src/lib.rs +++ b/storage/aptosdb/src/lib.rs @@ -62,9 +62,11 @@ use aptos_config::config::{ }; use aptos_crypto::hash::HashValue; +use aptos_db_indexer::Indexer; use aptos_infallible::Mutex; use aptos_logger::prelude::*; use aptos_rocksdb_options::gen_rocksdb_options; +use aptos_schemadb::{SchemaBatch, DB}; use aptos_types::{ account_address::AccountAddress, account_config::{new_block_event_key, NewBlockEvent}, @@ -92,11 +94,9 @@ use aptos_types::{ }, }; use aptos_vm::data_cache::AsMoveResolver; -use aptosdb_indexer::Indexer; use itertools::zip_eq; use move_resource_viewer::MoveValueAnnotator; use once_cell::sync::Lazy; -use schemadb::{SchemaBatch, DB}; use std::{ collections::HashMap, iter::Iterator, diff --git a/storage/aptosdb/src/pruner/db_sub_pruner.rs b/storage/aptosdb/src/pruner/db_sub_pruner.rs index f3da787aabccc..8fdb0d5fdaa53 100644 --- a/storage/aptosdb/src/pruner/db_sub_pruner.rs +++ b/storage/aptosdb/src/pruner/db_sub_pruner.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 -use schemadb::SchemaBatch; +use aptos_schemadb::SchemaBatch; use std::fmt::Debug; /// Defines the trait for sub-pruner of a parent DB pruner diff --git a/storage/aptosdb/src/pruner/event_store/event_store_pruner.rs b/storage/aptosdb/src/pruner/event_store/event_store_pruner.rs index 758c218ceed4a..fdfb221a6866a 100644 --- a/storage/aptosdb/src/pruner/event_store/event_store_pruner.rs +++ b/storage/aptosdb/src/pruner/event_store/event_store_pruner.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 use crate::{pruner::db_sub_pruner::DBSubPruner, EventStore}; -use schemadb::SchemaBatch; +use aptos_schemadb::SchemaBatch; use std::sync::Arc; #[derive(Debug)] diff --git a/storage/aptosdb/src/pruner/event_store/test.rs b/storage/aptosdb/src/pruner/event_store/test.rs index 70f0e93c54f00..d6bb017611de8 100644 --- a/storage/aptosdb/src/pruner/event_store/test.rs +++ b/storage/aptosdb/src/pruner/event_store/test.rs @@ -4,6 +4,7 @@ use crate::{AptosDB, EventStore, LedgerPrunerManager, PrunerManager}; use aptos_config::config::LedgerPrunerConfig; use aptos_proptest_helpers::Index; +use aptos_schemadb::SchemaBatch; use aptos_temppath::TempPath; use aptos_types::{ contract_event::ContractEvent, @@ -11,7 +12,6 @@ use aptos_types::{ transaction::Version, }; use proptest::{collection::vec, prelude::*, proptest}; -use schemadb::SchemaBatch; use std::sync::Arc; proptest! { diff --git a/storage/aptosdb/src/pruner/ledger_pruner_manager.rs b/storage/aptosdb/src/pruner/ledger_pruner_manager.rs index 9cfd8b1185a51..82e7fa65059fe 100644 --- a/storage/aptosdb/src/pruner/ledger_pruner_manager.rs +++ b/storage/aptosdb/src/pruner/ledger_pruner_manager.rs @@ -11,8 +11,8 @@ use crate::pruner::ledger_pruner_worker::LedgerPrunerWorker; use crate::pruner::ledger_store::ledger_store_pruner::LedgerPruner; use crate::pruner::pruner_manager::PrunerManager; use crate::{pruner_utils, StateStore}; +use aptos_schemadb::DB; use aptos_types::transaction::Version; -use schemadb::DB; use std::{sync::Arc, thread::JoinHandle}; /// The `PrunerManager` for `LedgerPruner`. diff --git a/storage/aptosdb/src/pruner/ledger_store/ledger_store_pruner.rs b/storage/aptosdb/src/pruner/ledger_store/ledger_store_pruner.rs index bb2c9753ce625..d63e2d17df202 100644 --- a/storage/aptosdb/src/pruner/ledger_store/ledger_store_pruner.rs +++ b/storage/aptosdb/src/pruner/ledger_store/ledger_store_pruner.rs @@ -21,8 +21,8 @@ use crate::{ EventStore, StateStore, TransactionStore, }; use aptos_logger::warn; +use aptos_schemadb::{ReadOptions, SchemaBatch, DB}; use aptos_types::transaction::{AtomicVersion, Version}; -use schemadb::{ReadOptions, SchemaBatch, DB}; use std::sync::{atomic::Ordering, Arc}; pub const LEDGER_PRUNER_NAME: &str = "ledger_pruner"; diff --git a/storage/aptosdb/src/pruner/pruner_utils.rs b/storage/aptosdb/src/pruner/pruner_utils.rs index bb1d4bc054e8d..b0c4c65e3b167 100644 --- a/storage/aptosdb/src/pruner/pruner_utils.rs +++ b/storage/aptosdb/src/pruner/pruner_utils.rs @@ -10,8 +10,8 @@ use crate::{ use crate::pruner::state_store::generics::StaleNodeIndexSchemaTrait; use aptos_jellyfish_merkle::StaleNodeIndex; -use schemadb::schema::KeyCodec; -use schemadb::DB; +use aptos_schemadb::schema::KeyCodec; +use aptos_schemadb::DB; use std::sync::Arc; /// A utility function to instantiate the state pruner diff --git a/storage/aptosdb/src/pruner/state_pruner_manager.rs b/storage/aptosdb/src/pruner/state_pruner_manager.rs index 1b10924b4adf5..c05eefd213823 100644 --- a/storage/aptosdb/src/pruner/state_pruner_manager.rs +++ b/storage/aptosdb/src/pruner/state_pruner_manager.rs @@ -11,9 +11,9 @@ use aptos_infallible::Mutex; use crate::pruner::pruner_manager::PrunerManager; use aptos_jellyfish_merkle::StaleNodeIndex; +use aptos_schemadb::schema::KeyCodec; +use aptos_schemadb::DB; use aptos_types::transaction::Version; -use schemadb::schema::KeyCodec; -use schemadb::DB; use std::{sync::Arc, thread::JoinHandle}; use crate::pruner::db_pruner::DBPruner; diff --git a/storage/aptosdb/src/pruner/state_pruner_worker.rs b/storage/aptosdb/src/pruner/state_pruner_worker.rs index 3a5271ce2b3f2..cc9c0816624f3 100644 --- a/storage/aptosdb/src/pruner/state_pruner_worker.rs +++ b/storage/aptosdb/src/pruner/state_pruner_worker.rs @@ -9,8 +9,8 @@ use aptos_logger::{ error, prelude::{sample, SampleRate}, }; +use aptos_schemadb::schema::KeyCodec; use aptos_types::transaction::Version; -use schemadb::schema::KeyCodec; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread::sleep; diff --git a/storage/aptosdb/src/pruner/state_store/generics.rs b/storage/aptosdb/src/pruner/state_store/generics.rs index 35472c33d379e..fe72cb9acd4bd 100644 --- a/storage/aptosdb/src/pruner/state_store/generics.rs +++ b/storage/aptosdb/src/pruner/state_store/generics.rs @@ -5,7 +5,7 @@ use crate::schema::db_metadata::DbMetadataKey; use crate::stale_node_index_cross_epoch::StaleNodeIndexCrossEpochSchema; use crate::StaleNodeIndexSchema; use aptos_jellyfish_merkle::StaleNodeIndex; -use schemadb::schema::{KeyCodec, Schema}; +use aptos_schemadb::schema::{KeyCodec, Schema}; pub trait StaleNodeIndexSchemaTrait: Schema where diff --git a/storage/aptosdb/src/pruner/state_store/mod.rs b/storage/aptosdb/src/pruner/state_store/mod.rs index 6607883a56068..8a34b80835aa0 100644 --- a/storage/aptosdb/src/pruner/state_store/mod.rs +++ b/storage/aptosdb/src/pruner/state_store/mod.rs @@ -14,9 +14,9 @@ use aptos_infallible::Mutex; use aptos_jellyfish_merkle::node_type::NodeKey; use aptos_jellyfish_merkle::StaleNodeIndex; use aptos_logger::error; +use aptos_schemadb::schema::KeyCodec; +use aptos_schemadb::{ReadOptions, SchemaBatch, DB}; use aptos_types::transaction::{AtomicVersion, Version}; -use schemadb::schema::KeyCodec; -use schemadb::{ReadOptions, SchemaBatch, DB}; use std::sync::{atomic::Ordering, Arc}; pub mod generics; diff --git a/storage/aptosdb/src/pruner/state_store/state_value_pruner.rs b/storage/aptosdb/src/pruner/state_store/state_value_pruner.rs index 4a227a4143a8a..d8ab3ef5eed81 100644 --- a/storage/aptosdb/src/pruner/state_store/state_value_pruner.rs +++ b/storage/aptosdb/src/pruner/state_store/state_value_pruner.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 use crate::{pruner::db_sub_pruner::DBSubPruner, StateStore}; -use schemadb::SchemaBatch; +use aptos_schemadb::SchemaBatch; use std::sync::Arc; #[derive(Debug)] diff --git a/storage/aptosdb/src/pruner/state_store/test.rs b/storage/aptosdb/src/pruner/state_store/test.rs index b95c45ab87b12..a167f7d8bcf5d 100644 --- a/storage/aptosdb/src/pruner/state_store/test.rs +++ b/storage/aptosdb/src/pruner/state_store/test.rs @@ -6,6 +6,7 @@ use proptest::{prelude::*, proptest}; use std::{collections::HashMap, sync::Arc}; use aptos_crypto::HashValue; +use aptos_schemadb::{ReadOptions, SchemaBatch, DB}; use aptos_storage_interface::{jmt_update_refs, jmt_updates, DbReader}; use aptos_temppath::TempPath; use aptos_types::state_store::state_storage_usage::StateStorageUsage; @@ -14,7 +15,6 @@ use aptos_types::{ state_store::{state_key::StateKey, state_value::StateValue}, transaction::Version, }; -use schemadb::{ReadOptions, SchemaBatch, DB}; use crate::stale_state_value_index::StaleStateValueIndexSchema; use crate::{ diff --git a/storage/aptosdb/src/pruner/transaction_store/test.rs b/storage/aptosdb/src/pruner/transaction_store/test.rs index ee44dc6d16e42..7290aadccb307 100644 --- a/storage/aptosdb/src/pruner/transaction_store/test.rs +++ b/storage/aptosdb/src/pruner/transaction_store/test.rs @@ -14,6 +14,7 @@ use aptos_types::{ use aptos_accumulator::HashReader; use aptos_config::config::LedgerPrunerConfig; +use aptos_schemadb::SchemaBatch; use aptos_storage_interface::DbReader; use aptos_types::{ proof::position::Position, @@ -21,7 +22,6 @@ use aptos_types::{ write_set::WriteSet, }; use proptest::{collection::vec, prelude::*}; -use schemadb::SchemaBatch; proptest! { #![proptest_config(ProptestConfig::with_cases(10))] diff --git a/storage/aptosdb/src/pruner/transaction_store/transaction_store_pruner.rs b/storage/aptosdb/src/pruner/transaction_store/transaction_store_pruner.rs index 7f2529086bd47..29a9b88930973 100644 --- a/storage/aptosdb/src/pruner/transaction_store/transaction_store_pruner.rs +++ b/storage/aptosdb/src/pruner/transaction_store/transaction_store_pruner.rs @@ -1,8 +1,8 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 use crate::{pruner::db_sub_pruner::DBSubPruner, TransactionStore}; +use aptos_schemadb::SchemaBatch; use aptos_types::transaction::{Transaction, Version}; -use schemadb::SchemaBatch; use std::sync::Arc; #[derive(Debug)] diff --git a/storage/aptosdb/src/pruner/transaction_store/write_set_pruner.rs b/storage/aptosdb/src/pruner/transaction_store/write_set_pruner.rs index 3aa816b7cd809..bbbfd96641a28 100644 --- a/storage/aptosdb/src/pruner/transaction_store/write_set_pruner.rs +++ b/storage/aptosdb/src/pruner/transaction_store/write_set_pruner.rs @@ -1,7 +1,7 @@ // Copyright (c) Aptos // SPDX-License-Identifier: Apache-2.0 use crate::{pruner::db_sub_pruner::DBSubPruner, TransactionStore}; -use schemadb::SchemaBatch; +use aptos_schemadb::SchemaBatch; use std::sync::Arc; #[derive(Debug)] diff --git a/storage/aptosdb/src/schema/db_metadata/mod.rs b/storage/aptosdb/src/schema/db_metadata/mod.rs index a56c3e735d6f4..ab558a942fc75 100644 --- a/storage/aptosdb/src/schema/db_metadata/mod.rs +++ b/storage/aptosdb/src/schema/db_metadata/mod.rs @@ -12,11 +12,11 @@ use crate::schema::DB_METADATA_CF_NAME; use crate::state_restore::StateSnapshotProgress; use anyhow::Result; -use aptos_types::transaction::Version; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::transaction::Version; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] diff --git a/storage/aptosdb/src/schema/db_metadata/test.rs b/storage/aptosdb/src/schema/db_metadata/test.rs index c20e03fab0e03..f887be66ed352 100644 --- a/storage/aptosdb/src/schema/db_metadata/test.rs +++ b/storage/aptosdb/src/schema/db_metadata/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/epoch_by_version/mod.rs b/storage/aptosdb/src/schema/epoch_by_version/mod.rs index d8838ea569c57..8344685c355f7 100644 --- a/storage/aptosdb/src/schema/epoch_by_version/mod.rs +++ b/storage/aptosdb/src/schema/epoch_by_version/mod.rs @@ -16,12 +16,12 @@ use crate::schema::{ensure_slice_len_eq, EPOCH_BY_VERSION_CF_NAME}; use anyhow::Result; -use aptos_types::transaction::Version; -use byteorder::{BigEndian, ReadBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::transaction::Version; +use byteorder::{BigEndian, ReadBytesExt}; use std::mem::size_of; define_schema!( diff --git a/storage/aptosdb/src/schema/epoch_by_version/test.rs b/storage/aptosdb/src/schema/epoch_by_version/test.rs index 4f0e6d69c5186..3fdac9b241093 100644 --- a/storage/aptosdb/src/schema/epoch_by_version/test.rs +++ b/storage/aptosdb/src/schema/epoch_by_version/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/event/mod.rs b/storage/aptosdb/src/schema/event/mod.rs index 19ce6d2df9003..9abaa05975a79 100644 --- a/storage/aptosdb/src/schema/event/mod.rs +++ b/storage/aptosdb/src/schema/event/mod.rs @@ -12,12 +12,12 @@ use crate::schema::{ensure_slice_len_eq, EVENT_CF_NAME}; use anyhow::Result; -use aptos_types::{contract_event::ContractEvent, transaction::Version}; -use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, SeekKeyCodec, ValueCodec}, }; +use aptos_types::{contract_event::ContractEvent, transaction::Version}; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::mem::size_of; define_schema!(EventSchema, Key, ContractEvent, EVENT_CF_NAME); diff --git a/storage/aptosdb/src/schema/event/test.rs b/storage/aptosdb/src/schema/event/test.rs index 3c07775e82f89..d1d4a0e911181 100644 --- a/storage/aptosdb/src/schema/event/test.rs +++ b/storage/aptosdb/src/schema/event/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/event_accumulator/mod.rs b/storage/aptosdb/src/schema/event_accumulator/mod.rs index f4ebde7347de6..fc335025f8e85 100644 --- a/storage/aptosdb/src/schema/event_accumulator/mod.rs +++ b/storage/aptosdb/src/schema/event_accumulator/mod.rs @@ -13,12 +13,12 @@ use crate::schema::{ensure_slice_len_eq, EVENT_ACCUMULATOR_CF_NAME}; use anyhow::Result; use aptos_crypto::hash::HashValue; -use aptos_types::{proof::position::Position, transaction::Version}; -use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::{proof::position::Position, transaction::Version}; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::mem::size_of; define_schema!( diff --git a/storage/aptosdb/src/schema/event_accumulator/test.rs b/storage/aptosdb/src/schema/event_accumulator/test.rs index 5709bddae108b..031db2826a1c8 100644 --- a/storage/aptosdb/src/schema/event_accumulator/test.rs +++ b/storage/aptosdb/src/schema/event_accumulator/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/event_by_key/mod.rs b/storage/aptosdb/src/schema/event_by_key/mod.rs index d0d271ae8e8b0..941d2b3aebc6b 100644 --- a/storage/aptosdb/src/schema/event_by_key/mod.rs +++ b/storage/aptosdb/src/schema/event_by_key/mod.rs @@ -12,12 +12,12 @@ use crate::schema::{ensure_slice_len_eq, EVENT_BY_KEY_CF_NAME}; use anyhow::Result; -use aptos_types::{event::EventKey, transaction::Version}; -use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::{event::EventKey, transaction::Version}; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::mem::size_of; define_schema!(EventByKeySchema, Key, Value, EVENT_BY_KEY_CF_NAME); diff --git a/storage/aptosdb/src/schema/event_by_key/test.rs b/storage/aptosdb/src/schema/event_by_key/test.rs index 975efc5023ab8..4b55fe9e02ed4 100644 --- a/storage/aptosdb/src/schema/event_by_key/test.rs +++ b/storage/aptosdb/src/schema/event_by_key/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/event_by_version/mod.rs b/storage/aptosdb/src/schema/event_by_version/mod.rs index 1ca8b07348948..6a696979141a5 100644 --- a/storage/aptosdb/src/schema/event_by_version/mod.rs +++ b/storage/aptosdb/src/schema/event_by_version/mod.rs @@ -12,12 +12,12 @@ use crate::schema::{ensure_slice_len_eq, EVENT_BY_VERSION_CF_NAME}; use anyhow::Result; -use aptos_types::{event::EventKey, transaction::Version}; -use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::{event::EventKey, transaction::Version}; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::mem::size_of; define_schema!(EventByVersionSchema, Key, Value, EVENT_BY_VERSION_CF_NAME); diff --git a/storage/aptosdb/src/schema/event_by_version/test.rs b/storage/aptosdb/src/schema/event_by_version/test.rs index f7928074cfc9e..248276b2aea5e 100644 --- a/storage/aptosdb/src/schema/event_by_version/test.rs +++ b/storage/aptosdb/src/schema/event_by_version/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/jellyfish_merkle_node/mod.rs b/storage/aptosdb/src/schema/jellyfish_merkle_node/mod.rs index b8949d9ccaa4b..9f557674a2e31 100644 --- a/storage/aptosdb/src/schema/jellyfish_merkle_node/mod.rs +++ b/storage/aptosdb/src/schema/jellyfish_merkle_node/mod.rs @@ -11,12 +11,12 @@ use crate::schema::JELLYFISH_MERKLE_NODE_CF_NAME; use anyhow::Result; use aptos_jellyfish_merkle::node_type::NodeKey; -use aptos_types::{state_store::state_key::StateKey, transaction::Version}; -use byteorder::{BigEndian, WriteBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, SeekKeyCodec, ValueCodec}, }; +use aptos_types::{state_store::state_key::StateKey, transaction::Version}; +use byteorder::{BigEndian, WriteBytesExt}; use std::mem::size_of; type Node = aptos_jellyfish_merkle::node_type::Node; diff --git a/storage/aptosdb/src/schema/jellyfish_merkle_node/test.rs b/storage/aptosdb/src/schema/jellyfish_merkle_node/test.rs index 952236ff106ba..8b6bfa66ce1c5 100644 --- a/storage/aptosdb/src/schema/jellyfish_merkle_node/test.rs +++ b/storage/aptosdb/src/schema/jellyfish_merkle_node/test.rs @@ -4,8 +4,8 @@ use super::*; use aptos_crypto::HashValue; use aptos_jellyfish_merkle::node_type::Node; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/ledger_info/mod.rs b/storage/aptosdb/src/schema/ledger_info/mod.rs index 93cdc32ae808f..2c0c333190ddf 100644 --- a/storage/aptosdb/src/schema/ledger_info/mod.rs +++ b/storage/aptosdb/src/schema/ledger_info/mod.rs @@ -15,12 +15,12 @@ use super::LEDGER_INFO_CF_NAME; use crate::schema::ensure_slice_len_eq; use anyhow::Result; -use aptos_types::ledger_info::LedgerInfoWithSignatures; -use byteorder::{BigEndian, ReadBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::ledger_info::LedgerInfoWithSignatures; +use byteorder::{BigEndian, ReadBytesExt}; use std::mem::size_of; define_schema!( diff --git a/storage/aptosdb/src/schema/ledger_info/test.rs b/storage/aptosdb/src/schema/ledger_info/test.rs index 0b712b7274a2e..c8966e9bdb5bc 100644 --- a/storage/aptosdb/src/schema/ledger_info/test.rs +++ b/storage/aptosdb/src/schema/ledger_info/test.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use aptos_types::ledger_info::LedgerInfoWithSignatures; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/mod.rs b/storage/aptosdb/src/schema/mod.rs index f096aab9671c9..8f2e3d77b486c 100644 --- a/storage/aptosdb/src/schema/mod.rs +++ b/storage/aptosdb/src/schema/mod.rs @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 //! This module defines representation of Aptos core data structures at physical level via schemas -//! that implement [`schemadb::schema::Schema`]. +//! that implement [`aptos_schemadb::schema::Schema`]. //! //! All schemas are `pub(crate)` so not shown in rustdoc, refer to the source code to see details. @@ -27,7 +27,7 @@ pub(crate) mod version_data; pub(crate) mod write_set; use anyhow::{ensure, Result}; -use schemadb::ColumnFamilyName; +use aptos_schemadb::ColumnFamilyName; pub const DB_METADATA_CF_NAME: ColumnFamilyName = "db_metadata"; pub const EPOCH_BY_VERSION_CF_NAME: ColumnFamilyName = "epoch_by_version"; @@ -71,7 +71,7 @@ fn ensure_slice_len_gt(data: &[u8], len: usize) -> Result<()> { #[cfg(feature = "fuzzing")] pub mod fuzzing { - use schemadb::schema::fuzzing::assert_no_panic_decoding; + use aptos_schemadb::schema::fuzzing::assert_no_panic_decoding; pub fn fuzz_decode(data: &[u8]) { #[allow(unused_must_use)] diff --git a/storage/aptosdb/src/schema/stale_node_index/mod.rs b/storage/aptosdb/src/schema/stale_node_index/mod.rs index b434f1a37efc2..dd50add0cf7a2 100644 --- a/storage/aptosdb/src/schema/stale_node_index/mod.rs +++ b/storage/aptosdb/src/schema/stale_node_index/mod.rs @@ -20,12 +20,12 @@ use crate::schema::{ensure_slice_len_eq, ensure_slice_len_gt, STALE_NODE_INDEX_CF_NAME}; use anyhow::Result; use aptos_jellyfish_merkle::{node_type::NodeKey, StaleNodeIndex}; -use aptos_types::transaction::Version; -use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, SeekKeyCodec, ValueCodec}, }; +use aptos_types::transaction::Version; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::{io::Write, mem::size_of}; define_schema!( diff --git a/storage/aptosdb/src/schema/stale_node_index/test.rs b/storage/aptosdb/src/schema/stale_node_index/test.rs index 7c70c138e3543..af38d09b8f9d0 100644 --- a/storage/aptosdb/src/schema/stale_node_index/test.rs +++ b/storage/aptosdb/src/schema/stale_node_index/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/stale_node_index_cross_epoch/mod.rs b/storage/aptosdb/src/schema/stale_node_index_cross_epoch/mod.rs index b49acb62dfd5d..d735ca47d3422 100644 --- a/storage/aptosdb/src/schema/stale_node_index_cross_epoch/mod.rs +++ b/storage/aptosdb/src/schema/stale_node_index_cross_epoch/mod.rs @@ -17,12 +17,12 @@ use crate::schema::{ }; use anyhow::Result; use aptos_jellyfish_merkle::{node_type::NodeKey, StaleNodeIndex}; -use aptos_types::transaction::Version; -use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, SeekKeyCodec, ValueCodec}, }; +use aptos_types::transaction::Version; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::{io::Write, mem::size_of}; define_schema!( diff --git a/storage/aptosdb/src/schema/stale_node_index_cross_epoch/test.rs b/storage/aptosdb/src/schema/stale_node_index_cross_epoch/test.rs index 4158c9fcee264..eb050c66abfb4 100644 --- a/storage/aptosdb/src/schema/stale_node_index_cross_epoch/test.rs +++ b/storage/aptosdb/src/schema/stale_node_index_cross_epoch/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/stale_state_value_index/mod.rs b/storage/aptosdb/src/schema/stale_state_value_index/mod.rs index 643302cbd723c..39642ad05eea5 100644 --- a/storage/aptosdb/src/schema/stale_state_value_index/mod.rs +++ b/storage/aptosdb/src/schema/stale_state_value_index/mod.rs @@ -20,13 +20,13 @@ use crate::schema::{ensure_slice_len_eq, ensure_slice_len_gt, STALE_STATE_VALUE_INDEX_CF_NAME}; use anyhow::Result; -use aptos_types::state_store::{state_key::StateKey, state_value::StaleStateValueIndex}; -use aptos_types::transaction::Version; -use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, SeekKeyCodec, ValueCodec}, }; +use aptos_types::state_store::{state_key::StateKey, state_value::StaleStateValueIndex}; +use aptos_types::transaction::Version; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::{io::Write, mem::size_of}; define_schema!( diff --git a/storage/aptosdb/src/schema/stale_state_value_index/test.rs b/storage/aptosdb/src/schema/stale_state_value_index/test.rs index 15663a0c79149..d7c734dd440e7 100644 --- a/storage/aptosdb/src/schema/stale_state_value_index/test.rs +++ b/storage/aptosdb/src/schema/stale_state_value_index/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/state_value/mod.rs b/storage/aptosdb/src/schema/state_value/mod.rs index dd65311fd89fb..d6ebc68b1f28c 100644 --- a/storage/aptosdb/src/schema/state_value/mod.rs +++ b/storage/aptosdb/src/schema/state_value/mod.rs @@ -16,15 +16,15 @@ use crate::schema::{ensure_slice_len_gt, STATE_VALUE_CF_NAME}; use anyhow::Result; +use aptos_schemadb::{ + define_schema, + schema::{KeyCodec, SeekKeyCodec, ValueCodec}, +}; use aptos_types::{ state_store::{state_key::StateKey, state_key_prefix::StateKeyPrefix, state_value::StateValue}, transaction::Version, }; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use schemadb::{ - define_schema, - schema::{KeyCodec, SeekKeyCodec, ValueCodec}, -}; use std::{io::Write, mem::size_of}; type Key = (StateKey, Version); diff --git a/storage/aptosdb/src/schema/state_value/test.rs b/storage/aptosdb/src/schema/state_value/test.rs index d3fca7d9556c2..8519ab2230ab4 100644 --- a/storage/aptosdb/src/schema/state_value/test.rs +++ b/storage/aptosdb/src/schema/state_value/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/transaction/mod.rs b/storage/aptosdb/src/schema/transaction/mod.rs index 4e9a035ec36d1..6d32181083cd3 100644 --- a/storage/aptosdb/src/schema/transaction/mod.rs +++ b/storage/aptosdb/src/schema/transaction/mod.rs @@ -14,12 +14,12 @@ use crate::schema::{ensure_slice_len_eq, TRANSACTION_CF_NAME}; use anyhow::Result; -use aptos_types::transaction::{Transaction, Version}; -use byteorder::{BigEndian, ReadBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::transaction::{Transaction, Version}; +use byteorder::{BigEndian, ReadBytesExt}; use std::mem::size_of; define_schema!(TransactionSchema, Version, Transaction, TRANSACTION_CF_NAME); diff --git a/storage/aptosdb/src/schema/transaction/test.rs b/storage/aptosdb/src/schema/transaction/test.rs index f2965e7016cba..a6f94c7f02276 100644 --- a/storage/aptosdb/src/schema/transaction/test.rs +++ b/storage/aptosdb/src/schema/transaction/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/transaction_accumulator/mod.rs b/storage/aptosdb/src/schema/transaction_accumulator/mod.rs index f3ac23ffa3bad..ea310b909f61a 100644 --- a/storage/aptosdb/src/schema/transaction_accumulator/mod.rs +++ b/storage/aptosdb/src/schema/transaction_accumulator/mod.rs @@ -13,12 +13,12 @@ use crate::schema::{ensure_slice_len_eq, TRANSACTION_ACCUMULATOR_CF_NAME}; use anyhow::Result; use aptos_crypto::HashValue; -use aptos_types::proof::position::Position; -use byteorder::{BigEndian, ReadBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::proof::position::Position; +use byteorder::{BigEndian, ReadBytesExt}; use std::mem::size_of; define_schema!( diff --git a/storage/aptosdb/src/schema/transaction_accumulator/test.rs b/storage/aptosdb/src/schema/transaction_accumulator/test.rs index 3da9c9c9e159f..d589e6b8616bc 100644 --- a/storage/aptosdb/src/schema/transaction_accumulator/test.rs +++ b/storage/aptosdb/src/schema/transaction_accumulator/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/transaction_by_account/mod.rs b/storage/aptosdb/src/schema/transaction_by_account/mod.rs index f0d6538d562db..4085513621540 100644 --- a/storage/aptosdb/src/schema/transaction_by_account/mod.rs +++ b/storage/aptosdb/src/schema/transaction_by_account/mod.rs @@ -12,12 +12,12 @@ use crate::schema::{ensure_slice_len_eq, TRANSACTION_BY_ACCOUNT_CF_NAME}; use anyhow::Result; -use aptos_types::{account_address::AccountAddress, transaction::Version}; -use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::{account_address::AccountAddress, transaction::Version}; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::{convert::TryFrom, mem::size_of}; define_schema!( diff --git a/storage/aptosdb/src/schema/transaction_by_account/test.rs b/storage/aptosdb/src/schema/transaction_by_account/test.rs index 8d50bcebb34dc..9e4bea9bcad94 100644 --- a/storage/aptosdb/src/schema/transaction_by_account/test.rs +++ b/storage/aptosdb/src/schema/transaction_by_account/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/transaction_by_hash/mod.rs b/storage/aptosdb/src/schema/transaction_by_hash/mod.rs index e40e1e0f1b3a8..f331431049457 100644 --- a/storage/aptosdb/src/schema/transaction_by_hash/mod.rs +++ b/storage/aptosdb/src/schema/transaction_by_hash/mod.rs @@ -12,12 +12,12 @@ use crate::schema::{ensure_slice_len_eq, TRANSACTION_BY_HASH_CF_NAME}; use anyhow::Result; use aptos_crypto::HashValue; -use aptos_types::transaction::Version; -use byteorder::{BigEndian, ReadBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::transaction::Version; +use byteorder::{BigEndian, ReadBytesExt}; use std::mem::size_of; define_schema!( diff --git a/storage/aptosdb/src/schema/transaction_by_hash/test.rs b/storage/aptosdb/src/schema/transaction_by_hash/test.rs index 313526e785c86..8fbeec20f8c55 100644 --- a/storage/aptosdb/src/schema/transaction_by_hash/test.rs +++ b/storage/aptosdb/src/schema/transaction_by_hash/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/transaction_info/mod.rs b/storage/aptosdb/src/schema/transaction_info/mod.rs index ed81ae0c1ef0e..8af48da5515d1 100644 --- a/storage/aptosdb/src/schema/transaction_info/mod.rs +++ b/storage/aptosdb/src/schema/transaction_info/mod.rs @@ -14,12 +14,12 @@ use crate::schema::{ensure_slice_len_eq, TRANSACTION_INFO_CF_NAME}; use anyhow::Result; -use aptos_types::transaction::{TransactionInfo, Version}; -use byteorder::{BigEndian, ReadBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::transaction::{TransactionInfo, Version}; +use byteorder::{BigEndian, ReadBytesExt}; use std::mem::size_of; define_schema!( diff --git a/storage/aptosdb/src/schema/transaction_info/test.rs b/storage/aptosdb/src/schema/transaction_info/test.rs index 8f143cc2735a4..63b87fa9e73d6 100644 --- a/storage/aptosdb/src/schema/transaction_info/test.rs +++ b/storage/aptosdb/src/schema/transaction_info/test.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use aptos_types::transaction::{TransactionInfo, Version}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/version_data/mod.rs b/storage/aptosdb/src/schema/version_data/mod.rs index 3289361c9f6c3..d336f190e5b3c 100644 --- a/storage/aptosdb/src/schema/version_data/mod.rs +++ b/storage/aptosdb/src/schema/version_data/mod.rs @@ -15,15 +15,15 @@ use super::VERSION_DATA_CF_NAME; use crate::schema::ensure_slice_len_eq; use anyhow::Result; +use aptos_schemadb::{ + define_schema, + schema::{KeyCodec, ValueCodec}, +}; use aptos_types::state_store::state_storage_usage::StateStorageUsage; use aptos_types::transaction::Version; use byteorder::{BigEndian, ReadBytesExt}; #[cfg(any(test, feature = "fuzzing"))] use proptest_derive::Arbitrary; -use schemadb::{ - define_schema, - schema::{KeyCodec, ValueCodec}, -}; use serde::{Deserialize, Serialize}; use std::mem::size_of; diff --git a/storage/aptosdb/src/schema/version_data/test.rs b/storage/aptosdb/src/schema/version_data/test.rs index a847666585ec0..2885829c78bbb 100644 --- a/storage/aptosdb/src/schema/version_data/test.rs +++ b/storage/aptosdb/src/schema/version_data/test.rs @@ -2,9 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use aptos_types::transaction::Version; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/schema/write_set/mod.rs b/storage/aptosdb/src/schema/write_set/mod.rs index d5250290d44ad..00c5e5db42b09 100644 --- a/storage/aptosdb/src/schema/write_set/mod.rs +++ b/storage/aptosdb/src/schema/write_set/mod.rs @@ -15,12 +15,12 @@ use crate::schema::{ensure_slice_len_eq, WRITE_SET_CF_NAME}; use anyhow::Result; -use aptos_types::{transaction::Version, write_set::WriteSet}; -use byteorder::{BigEndian, ReadBytesExt}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::{transaction::Version, write_set::WriteSet}; +use byteorder::{BigEndian, ReadBytesExt}; use std::mem::size_of; define_schema!(WriteSetSchema, Version, WriteSet, WRITE_SET_CF_NAME); diff --git a/storage/aptosdb/src/schema/write_set/test.rs b/storage/aptosdb/src/schema/write_set/test.rs index cf1e5791e951c..836d5e3f35a99 100644 --- a/storage/aptosdb/src/schema/write_set/test.rs +++ b/storage/aptosdb/src/schema/write_set/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/aptosdb/src/state_merkle_db.rs b/storage/aptosdb/src/state_merkle_db.rs index 5c9cc29a7adbb..173a96aaf3bd7 100644 --- a/storage/aptosdb/src/state_merkle_db.rs +++ b/storage/aptosdb/src/state_merkle_db.rs @@ -14,6 +14,7 @@ use aptos_jellyfish_merkle::{ node_type::{NodeKey, NodeType}, JellyfishMerkleTree, TreeReader, TreeUpdateBatch, TreeWriter, }; +use aptos_schemadb::{SchemaBatch, DB}; use aptos_types::{ nibble::{nibble_path::NibblePath, ROOT_NIBBLE_HEIGHT}, proof::{SparseMerkleProofExt, SparseMerkleRangeProof}, @@ -21,7 +22,6 @@ use aptos_types::{ transaction::Version, }; use rayon::prelude::*; -use schemadb::{SchemaBatch, DB}; use std::{collections::HashMap, ops::Deref, sync::Arc, time::Instant}; pub(crate) type LeafNode = aptos_jellyfish_merkle::node_type::LeafNode; diff --git a/storage/aptosdb/src/state_store/mod.rs b/storage/aptosdb/src/state_store/mod.rs index e0442afed75ca..6c2104f0c1ac5 100644 --- a/storage/aptosdb/src/state_store/mod.rs +++ b/storage/aptosdb/src/state_store/mod.rs @@ -26,6 +26,7 @@ use aptos_executor_types::in_memory_state_calculator::InMemoryStateCalculator; use aptos_infallible::Mutex; use aptos_jellyfish_merkle::iterator::JellyfishMerkleIterator; use aptos_logger::info; +use aptos_schemadb::{ReadOptions, SchemaBatch, DB}; use aptos_state_view::StateViewId; use aptos_storage_interface::{ cached_state_view::CachedStateView, state_delta::StateDelta, @@ -42,7 +43,6 @@ use aptos_types::{ transaction::Version, }; use once_cell::sync::Lazy; -use schemadb::{ReadOptions, SchemaBatch, DB}; use std::{ collections::{HashMap, HashSet}, ops::Deref, diff --git a/storage/aptosdb/src/state_store/state_merkle_batch_committer.rs b/storage/aptosdb/src/state_store/state_merkle_batch_committer.rs index 22c95ad101416..93ac2ec6dfb21 100644 --- a/storage/aptosdb/src/state_store/state_merkle_batch_committer.rs +++ b/storage/aptosdb/src/state_store/state_merkle_batch_committer.rs @@ -14,9 +14,9 @@ use anyhow::{anyhow, ensure, Result}; use aptos_crypto::HashValue; use aptos_jellyfish_merkle::node_type::NodeKey; use aptos_logger::{info, trace}; +use aptos_schemadb::SchemaBatch; use aptos_storage_interface::state_delta::StateDelta; use aptos_types::state_store::state_storage_usage::StateStorageUsage; -use schemadb::SchemaBatch; use std::sync::{mpsc::Receiver, Arc}; pub struct StateMerkleBatch { diff --git a/storage/aptosdb/src/transaction_store/mod.rs b/storage/aptosdb/src/transaction_store/mod.rs index 2f0dda866c0e6..fc2f808c6ccd4 100644 --- a/storage/aptosdb/src/transaction_store/mod.rs +++ b/storage/aptosdb/src/transaction_store/mod.rs @@ -16,13 +16,13 @@ use crate::{ }; use anyhow::{ensure, format_err, Result}; use aptos_crypto::{hash::CryptoHash, HashValue}; +use aptos_schemadb::{ReadOptions, SchemaBatch, DB}; use aptos_types::{ account_address::AccountAddress, proof::position::Position, transaction::{Transaction, Version}, write_set::WriteSet, }; -use schemadb::{ReadOptions, SchemaBatch, DB}; use std::sync::Arc; #[cfg(test)] diff --git a/storage/aptosdb/src/utils/iterators.rs b/storage/aptosdb/src/utils/iterators.rs index bfd4627c6172c..140e53766791e 100644 --- a/storage/aptosdb/src/utils/iterators.rs +++ b/storage/aptosdb/src/utils/iterators.rs @@ -6,6 +6,8 @@ use crate::ledger_info::LedgerInfoSchema; use crate::state_value::StateValueSchema; use crate::transaction_by_account::TransactionByAccountSchema; use anyhow::{anyhow, ensure, Result}; +use aptos_schemadb::iterator::SchemaIterator; +use aptos_schemadb::{ReadOptions, DB}; use aptos_types::account_address::AccountAddress; use aptos_types::contract_event::ContractEvent; use aptos_types::ledger_info::LedgerInfoWithSignatures; @@ -13,8 +15,6 @@ use aptos_types::state_store::state_key::StateKey; use aptos_types::state_store::state_key_prefix::StateKeyPrefix; use aptos_types::state_store::state_value::StateValue; use aptos_types::transaction::Version; -use schemadb::iterator::SchemaIterator; -use schemadb::{ReadOptions, DB}; use std::iter::Peekable; use std::marker::PhantomData; diff --git a/storage/backup/backup-cli/Cargo.toml b/storage/backup/backup-cli/Cargo.toml index 376af398f270d..0ab8ef0616289 100644 --- a/storage/backup/backup-cli/Cargo.toml +++ b/storage/backup/backup-cli/Cargo.toml @@ -16,6 +16,7 @@ rust-version = { workspace = true } anyhow = { workspace = true } aptos-config = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-executor = { workspace = true } aptos-executor-test-helpers = { workspace = true } aptos-executor-types = { workspace = true } @@ -28,7 +29,6 @@ aptos-storage-interface = { workspace = true } aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } -aptosdb = { workspace = true } async-trait = { workspace = true } bcs = { workspace = true } bytes = { workspace = true } @@ -53,12 +53,12 @@ tokio-util = { workspace = true } [dev-dependencies] aptos-backup-service = { workspace = true } aptos-config = { workspace = true } +aptos-db = { workspace = true } aptos-executor-test-helpers = { workspace = true } aptos-proptest-helpers = { workspace = true } aptos-storage-interface = { workspace = true } -aptosdb = { workspace = true } proptest = { workspace = true } warp = { workspace = true } [features] -fuzzing = ["aptosdb/fuzzing"] +fuzzing = ["aptos-db/fuzzing"] diff --git a/storage/backup/backup-cli/src/backup_types/epoch_ending/tests.rs b/storage/backup/backup-cli/src/backup_types/epoch_ending/tests.rs index 2bbd9db3285b4..215cf5a56470a 100644 --- a/storage/backup/backup-cli/src/backup_types/epoch_ending/tests.rs +++ b/storage/backup/backup-cli/src/backup_types/epoch_ending/tests.rs @@ -17,6 +17,7 @@ use crate::{ }; use aptos_backup_service::start_backup_service; use aptos_config::utils::get_available_port; +use aptos_db::AptosDB; use aptos_storage_interface::DbReader; use aptos_temppath::TempPath; use aptos_types::aggregate_signature::AggregateSignature; @@ -25,7 +26,6 @@ use aptos_types::{ proptest_types::{AccountInfoUniverse, LedgerInfoWithSignaturesGen}, waypoint::Waypoint, }; -use aptosdb::AptosDB; use proptest::{collection::vec, prelude::*}; use std::{ convert::TryInto, diff --git a/storage/backup/backup-cli/src/backup_types/state_snapshot/tests.rs b/storage/backup/backup-cli/src/backup_types/state_snapshot/tests.rs index a2766d15b8b0c..7e6c0469a8a25 100644 --- a/storage/backup/backup-cli/src/backup_types/state_snapshot/tests.rs +++ b/storage/backup/backup-cli/src/backup_types/state_snapshot/tests.rs @@ -14,9 +14,9 @@ use crate::{ ConcurrentDownloadsOpt, GlobalBackupOpt, GlobalRestoreOpt, RocksdbOpt, TrustedWaypointOpt, }, }; +use aptos_db::AptosDB; use aptos_storage_interface::DbReader; use aptos_temppath::TempPath; -use aptosdb::AptosDB; use std::{convert::TryInto, sync::Arc}; use tokio::time::Duration; diff --git a/storage/backup/backup-cli/src/backup_types/tests.rs b/storage/backup/backup-cli/src/backup_types/tests.rs index 81950ec2f175e..e0d109a0dd058 100644 --- a/storage/backup/backup-cli/src/backup_types/tests.rs +++ b/storage/backup/backup-cli/src/backup_types/tests.rs @@ -20,11 +20,11 @@ use crate::{ RocksdbOpt, TrustedWaypointOpt, }, }; +use aptos_db::AptosDB; use aptos_executor_test_helpers::integration_test_impl::test_execution_with_storage_impl; use aptos_storage_interface::DbReader; use aptos_temppath::TempPath; use aptos_types::transaction::Version; -use aptosdb::AptosDB; use proptest::{prelude::*, sample::Index}; use std::{convert::TryInto, sync::Arc}; use tokio::time::Duration; diff --git a/storage/backup/backup-cli/src/backup_types/transaction/restore.rs b/storage/backup/backup-cli/src/backup_types/transaction/restore.rs index 782ae0d14d1d6..43d3200a4aebc 100644 --- a/storage/backup/backup-cli/src/backup_types/transaction/restore.rs +++ b/storage/backup/backup-cli/src/backup_types/transaction/restore.rs @@ -21,6 +21,7 @@ use crate::{ }, }; use anyhow::{anyhow, ensure, Result}; +use aptos_db::backup::restore_handler::RestoreHandler; use aptos_executor::chunk_executor::ChunkExecutor; use aptos_executor_types::TransactionReplayer; use aptos_logger::prelude::*; @@ -33,7 +34,6 @@ use aptos_types::{ transaction::{Transaction, TransactionInfo, TransactionListWithProof, Version}, }; use aptos_vm::AptosVM; -use aptosdb::backup::restore_handler::RestoreHandler; use clap::Parser; use futures::{ future, diff --git a/storage/backup/backup-cli/src/backup_types/transaction/tests.rs b/storage/backup/backup-cli/src/backup_types/transaction/tests.rs index 1ae696df52d95..f66ba1afa6282 100644 --- a/storage/backup/backup-cli/src/backup_types/transaction/tests.rs +++ b/storage/backup/backup-cli/src/backup_types/transaction/tests.rs @@ -14,10 +14,10 @@ use crate::{ ConcurrentDownloadsOpt, GlobalBackupOpt, GlobalRestoreOpt, RocksdbOpt, TrustedWaypointOpt, }, }; +use aptos_db::AptosDB; use aptos_storage_interface::DbReader; use aptos_temppath::TempPath; use aptos_types::transaction::Version; -use aptosdb::AptosDB; use std::{convert::TryInto, mem::size_of, sync::Arc}; use tokio::time::Duration; diff --git a/storage/backup/backup-cli/src/bin/replay-verify.rs b/storage/backup/backup-cli/src/bin/replay-verify.rs index 7f5293301f0f9..ed79f4515b107 100644 --- a/storage/backup/backup-cli/src/bin/replay-verify.rs +++ b/storage/backup/backup-cli/src/bin/replay-verify.rs @@ -13,9 +13,9 @@ use aptos_config::config::{ BUFFERED_STATE_TARGET_ITEMS, DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, NO_OP_STORAGE_PRUNER_CONFIG, }; +use aptos_db::{AptosDB, GetRestoreHandler}; use aptos_logger::{prelude::*, Level, Logger}; use aptos_types::transaction::Version; -use aptosdb::{AptosDB, GetRestoreHandler}; use clap::Parser; use std::{path::PathBuf, sync::Arc}; diff --git a/storage/backup/backup-cli/src/coordinators/backup.rs b/storage/backup/backup-cli/src/coordinators/backup.rs index 120226aa41c83..cc0322d34df1a 100644 --- a/storage/backup/backup-cli/src/coordinators/backup.rs +++ b/storage/backup/backup-cli/src/coordinators/backup.rs @@ -19,9 +19,9 @@ use crate::{ }, }; use anyhow::{anyhow, ensure, Result}; +use aptos_db::backup::backup_handler::DbState; use aptos_logger::prelude::*; use aptos_types::transaction::Version; -use aptosdb::backup::backup_handler::DbState; use clap::Parser; use futures::{stream, Future, StreamExt}; use std::{fmt::Debug, sync::Arc}; @@ -371,7 +371,7 @@ fn get_next_snapshot(last_in_backup: Option, db_state: DbState, interval: u #[cfg(test)] mod tests { use crate::coordinators::backup::{get_batch_range, get_next_snapshot}; - use aptosdb::backup::backup_handler::DbState; + use aptos_db::backup::backup_handler::DbState; #[test] fn test_get_batch_range() { diff --git a/storage/backup/backup-cli/src/coordinators/replay_verify.rs b/storage/backup/backup-cli/src/coordinators/replay_verify.rs index 32a83dc6a1b54..f525056c6e529 100644 --- a/storage/backup/backup-cli/src/coordinators/replay_verify.rs +++ b/storage/backup/backup-cli/src/coordinators/replay_verify.rs @@ -12,10 +12,10 @@ use crate::{ utils::{GlobalRestoreOptions, RestoreRunMode, TrustedWaypointOpt}, }; use anyhow::{ensure, Result}; +use aptos_db::backup::restore_handler::RestoreHandler; use aptos_logger::prelude::*; use aptos_types::transaction::Version; use aptos_vm::AptosVM; -use aptosdb::backup::restore_handler::RestoreHandler; use std::sync::Arc; pub struct ReplayVerifyCoordinator { diff --git a/storage/backup/backup-cli/src/utils/backup_service_client.rs b/storage/backup/backup-cli/src/utils/backup_service_client.rs index 123dfe6d230d1..dd4afe62dac06 100644 --- a/storage/backup/backup-cli/src/utils/backup_service_client.rs +++ b/storage/backup/backup-cli/src/utils/backup_service_client.rs @@ -4,8 +4,8 @@ use crate::utils::error_notes::ErrorNotes; use anyhow::Result; use aptos_crypto::HashValue; +use aptos_db::backup::backup_handler::DbState; use aptos_types::transaction::Version; -use aptosdb::backup::backup_handler::DbState; use clap::Parser; use futures::TryStreamExt; use tokio::io::{AsyncRead, AsyncReadExt}; diff --git a/storage/backup/backup-cli/src/utils/mod.rs b/storage/backup/backup-cli/src/utils/mod.rs index 4340ce3345c07..c748e47c8e417 100644 --- a/storage/backup/backup-cli/src/utils/mod.rs +++ b/storage/backup/backup-cli/src/utils/mod.rs @@ -16,6 +16,12 @@ use aptos_config::config::{ DEFAULT_MAX_NUM_NODES_PER_LRU_CACHE_SHARD, NO_OP_STORAGE_PRUNER_CONFIG, }; use aptos_crypto::HashValue; +use aptos_db::state_restore::StateSnapshotProgress; +use aptos_db::{ + backup::restore_handler::RestoreHandler, + state_restore::{StateSnapshotRestore, StateValueBatch, StateValueWriter}, + AptosDB, GetRestoreHandler, +}; use aptos_infallible::duration_since_epoch; use aptos_jellyfish_merkle::{NodeBatch, TreeWriter}; use aptos_logger::info; @@ -25,12 +31,6 @@ use aptos_types::{ transaction::Version, waypoint::Waypoint, }; -use aptosdb::state_restore::StateSnapshotProgress; -use aptosdb::{ - backup::restore_handler::RestoreHandler, - state_restore::{StateSnapshotRestore, StateValueBatch, StateValueWriter}, - AptosDB, GetRestoreHandler, -}; use clap::Parser; use std::{ collections::HashMap, diff --git a/storage/backup/backup-cli/src/utils/test_utils.rs b/storage/backup/backup-cli/src/utils/test_utils.rs index bcb1a983f98b7..7916cb64949b2 100644 --- a/storage/backup/backup-cli/src/utils/test_utils.rs +++ b/storage/backup/backup-cli/src/utils/test_utils.rs @@ -3,6 +3,10 @@ use aptos_backup_service::start_backup_service; use aptos_config::utils::get_available_port; +use aptos_db::{ + test_helper::{arb_blocks_to_commit, update_in_memory_state}, + AptosDB, +}; use aptos_proptest_helpers::ValueGenerator; use aptos_storage_interface::DbWriter; use aptos_temppath::TempPath; @@ -10,10 +14,6 @@ use aptos_types::{ ledger_info::LedgerInfoWithSignatures, transaction::{TransactionToCommit, Version}, }; -use aptosdb::{ - test_helper::{arb_blocks_to_commit, update_in_memory_state}, - AptosDB, -}; use std::{ net::{IpAddr, Ipv4Addr, SocketAddr}, sync::Arc, diff --git a/storage/backup/backup-service/Cargo.toml b/storage/backup/backup-service/Cargo.toml index 15a9834212e93..795ffb4545b30 100644 --- a/storage/backup/backup-service/Cargo.toml +++ b/storage/backup/backup-service/Cargo.toml @@ -15,11 +15,11 @@ rust-version = { workspace = true } [dependencies] anyhow = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } aptos-storage-interface = { workspace = true } aptos-types = { workspace = true } -aptosdb = { workspace = true } bcs = { workspace = true } bytes = { workspace = true } hyper = { workspace = true } @@ -30,9 +30,9 @@ warp = { workspace = true } [dev-dependencies] aptos-config = { workspace = true } +aptos-db = { workspace = true, features = ["fuzzing"] } aptos-temppath = { workspace = true } -aptosdb = { workspace = true, features = ["fuzzing"] } reqwest = { workspace = true } [features] -fuzzing = ["aptosdb/fuzzing"] +fuzzing = ["aptos-db/fuzzing"] diff --git a/storage/backup/backup-service/src/handlers/mod.rs b/storage/backup/backup-service/src/handlers/mod.rs index e68d35d111b1d..b84c2560b1de2 100644 --- a/storage/backup/backup-service/src/handlers/mod.rs +++ b/storage/backup/backup-service/src/handlers/mod.rs @@ -8,8 +8,8 @@ use crate::handlers::utils::{ send_size_prefixed_bcs_bytes, unwrap_or_500, LATENCY_HISTOGRAM, }; use aptos_crypto::hash::HashValue; +use aptos_db::backup::backup_handler::BackupHandler; use aptos_types::transaction::Version; -use aptosdb::backup::backup_handler::BackupHandler; use warp::{filters::BoxedFilter, reply::Reply, Filter}; static DB_STATE: &str = "db_state"; diff --git a/storage/backup/backup-service/src/handlers/utils.rs b/storage/backup/backup-service/src/handlers/utils.rs index d615dea6a64fe..801862e987ac2 100644 --- a/storage/backup/backup-service/src/handlers/utils.rs +++ b/storage/backup/backup-service/src/handlers/utils.rs @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; +use aptos_db::backup::backup_handler::BackupHandler; use aptos_logger::prelude::*; use aptos_metrics_core::{ register_histogram_vec, register_int_counter_vec, HistogramVec, IntCounterVec, }; -use aptosdb::backup::backup_handler::BackupHandler; use bytes::Bytes; use hyper::Body; use once_cell::sync::Lazy; diff --git a/storage/backup/backup-service/src/lib.rs b/storage/backup/backup-service/src/lib.rs index d6e19307311bf..fc5e2ca7e21d8 100644 --- a/storage/backup/backup-service/src/lib.rs +++ b/storage/backup/backup-service/src/lib.rs @@ -4,8 +4,8 @@ mod handlers; use crate::handlers::get_routes; +use aptos_db::AptosDB; use aptos_logger::prelude::*; -use aptosdb::AptosDB; use std::{ net::SocketAddr, sync::{ diff --git a/storage/indexer/Cargo.toml b/storage/indexer/Cargo.toml index 66a94f3eac0f8..5440217d5ec75 100644 --- a/storage/indexer/Cargo.toml +++ b/storage/indexer/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "aptosdb-indexer" +name = "aptos-db-indexer" description = "AptosDB Internal Indexer" version = "0.1.0" @@ -21,6 +21,7 @@ aptos-logger = { workspace = true } aptos-metrics-core = { workspace = true } aptos-proptest-helpers = { workspace = true, optional = true } aptos-rocksdb-options = { workspace = true } +aptos-schemadb = { workspace = true } aptos-scratchpad = { workspace = true } aptos-state-view = { workspace = true } aptos-storage-interface = { workspace = true } @@ -34,17 +35,16 @@ move-resource-viewer = { workspace = true } num-derive = { workspace = true } proptest = { workspace = true, optional = true } proptest-derive = { workspace = true, optional = true } -schemadb = { workspace = true } serde = { workspace = true } [dev-dependencies] aptos-proptest-helpers = { workspace = true } +aptos-schemadb = { workspace = true, features = ["fuzzing"] } aptos-types = { workspace = true, features = ["fuzzing"] } proptest = { workspace = true } proptest-derive = { workspace = true } rand = { workspace = true } -schemadb = { workspace = true, features = ["fuzzing"] } [features] default = [] -fuzzing = ["proptest", "proptest-derive", "aptos-proptest-helpers", "aptos-temppath", "aptos-crypto/fuzzing", "aptos-types/fuzzing", "schemadb/fuzzing", "aptos-scratchpad/fuzzing"] +fuzzing = ["proptest", "proptest-derive", "aptos-proptest-helpers", "aptos-temppath", "aptos-crypto/fuzzing", "aptos-types/fuzzing", "aptos-schemadb/fuzzing", "aptos-scratchpad/fuzzing"] diff --git a/storage/indexer/src/lib.rs b/storage/indexer/src/lib.rs index 658689e652bf6..0fd303aa7e334 100644 --- a/storage/indexer/src/lib.rs +++ b/storage/indexer/src/lib.rs @@ -16,6 +16,7 @@ use anyhow::{bail, ensure, Result}; use aptos_config::config::RocksdbConfig; use aptos_logger::warn; use aptos_rocksdb_options::gen_rocksdb_options; +use aptos_schemadb::{SchemaBatch, DB}; use aptos_storage_interface::{state_view::DbStateView, DbReader}; use aptos_types::{ access_path::Path, @@ -33,7 +34,6 @@ use move_core_types::{ language_storage::{StructTag, TypeTag}, }; use move_resource_viewer::{AnnotatedMoveValue, MoveValueAnnotator}; -use schemadb::{SchemaBatch, DB}; use std::{ collections::HashMap, convert::TryInto, diff --git a/storage/indexer/src/schema/indexer_metadata/mod.rs b/storage/indexer/src/schema/indexer_metadata/mod.rs index fbb7a1aa8e018..855603e028e3a 100644 --- a/storage/indexer/src/schema/indexer_metadata/mod.rs +++ b/storage/indexer/src/schema/indexer_metadata/mod.rs @@ -7,7 +7,7 @@ use crate::metadata::{MetadataKey, MetadataValue}; use crate::schema::INDEXER_METADATA_CF_NAME; use anyhow::Result; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; diff --git a/storage/indexer/src/schema/indexer_metadata/test.rs b/storage/indexer/src/schema/indexer_metadata/test.rs index 2760fd804a797..5b1e62f322649 100644 --- a/storage/indexer/src/schema/indexer_metadata/test.rs +++ b/storage/indexer/src/schema/indexer_metadata/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/indexer/src/schema/mod.rs b/storage/indexer/src/schema/mod.rs index f1425a178dfe1..8adabb96cc6e0 100644 --- a/storage/indexer/src/schema/mod.rs +++ b/storage/indexer/src/schema/mod.rs @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 //! This module defines representation of AptosDB indexer data structures at physical level via schemas -//! that implement [`schemadb::schema::Schema`]. +//! that implement [`aptos_schemadb::schema::Schema`]. //! //! All schemas are `pub(crate)` so not shown in rustdoc, refer to the source code to see details. pub(crate) mod indexer_metadata; pub(crate) mod table_info; -use schemadb::ColumnFamilyName; +use aptos_schemadb::ColumnFamilyName; pub const DEFAULT_COLUMN_FAMILY_NAME: ColumnFamilyName = "default"; pub const INDEXER_METADATA_CF_NAME: ColumnFamilyName = "indexer_metadata"; diff --git a/storage/indexer/src/schema/table_info/mod.rs b/storage/indexer/src/schema/table_info/mod.rs index 1e3022342f8d3..2f30390bc38f9 100644 --- a/storage/indexer/src/schema/table_info/mod.rs +++ b/storage/indexer/src/schema/table_info/mod.rs @@ -11,11 +11,11 @@ use crate::schema::TABLE_INFO_CF_NAME; use anyhow::Result; -use aptos_types::state_store::table::{TableHandle, TableInfo}; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, ValueCodec}, }; +use aptos_types::state_store::table::{TableHandle, TableInfo}; define_schema!(TableInfoSchema, TableHandle, TableInfo, TABLE_INFO_CF_NAME); diff --git a/storage/indexer/src/schema/table_info/test.rs b/storage/indexer/src/schema/table_info/test.rs index bd4637f05c3de..3febee38ea163 100644 --- a/storage/indexer/src/schema/table_info/test.rs +++ b/storage/indexer/src/schema/table_info/test.rs @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 use super::*; +use aptos_schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; use proptest::prelude::*; -use schemadb::{schema::fuzzing::assert_encode_decode, test_no_panic_decoding}; proptest! { #[test] diff --git a/storage/jellyfish-merkle/Cargo.toml b/storage/jellyfish-merkle/Cargo.toml index 3bea0386ed2ac..be53278233435 100644 --- a/storage/jellyfish-merkle/Cargo.toml +++ b/storage/jellyfish-merkle/Cargo.toml @@ -35,8 +35,8 @@ thiserror = { workspace = true } [dev-dependencies] aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-types = { workspace = true, features = ["fuzzing"] } -aptosdb = { workspace = true } proptest = { workspace = true } proptest-derive = { workspace = true } rand = { workspace = true } diff --git a/storage/schemadb/Cargo.toml b/storage/schemadb/Cargo.toml index 0a599524b239a..6063f5f3cb02f 100644 --- a/storage/schemadb/Cargo.toml +++ b/storage/schemadb/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "schemadb" +name = "aptos-schemadb" description = "Aptos schemadb" version = "0.1.0" diff --git a/storage/schemadb/src/schema.rs b/storage/schemadb/src/schema.rs index d79e8c40d7051..f7c8126b4a7ef 100644 --- a/storage/schemadb/src/schema.rs +++ b/storage/schemadb/src/schema.rs @@ -12,7 +12,7 @@ use std::fmt::Debug; /// `define_schema!` allows a schema to be defined in the following syntax: /// ``` /// use anyhow::Result; -/// use schemadb::{ +/// use aptos_schemadb::{ /// define_schema, /// schema::{KeyCodec, SeekKeyCodec, ValueCodec}, /// }; @@ -160,8 +160,8 @@ pub mod fuzzing { #[macro_export] macro_rules! test_no_panic_decoding { ($schema_type: ty) => { + use aptos_schemadb::schema::fuzzing::{arb_small_vec_u8, assert_no_panic_decoding}; use proptest::prelude::*; - use schemadb::schema::fuzzing::{arb_small_vec_u8, assert_no_panic_decoding}; proptest! { #[test] diff --git a/storage/schemadb/tests/db.rs b/storage/schemadb/tests/db.rs index ea735642d9b26..44327663d8b8f 100644 --- a/storage/schemadb/tests/db.rs +++ b/storage/schemadb/tests/db.rs @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; -use byteorder::{LittleEndian, ReadBytesExt}; -use rocksdb::DEFAULT_COLUMN_FAMILY_NAME; -use schemadb::{ +use aptos_schemadb::{ define_schema, schema::{KeyCodec, Schema, ValueCodec}, ColumnFamilyName, SchemaBatch, DB, }; +use byteorder::{LittleEndian, ReadBytesExt}; +use rocksdb::DEFAULT_COLUMN_FAMILY_NAME; // Creating two schemas that share exactly the same structure but are stored in different column // families. Also note that the key and value are of the same type `TestField`. By implementing diff --git a/storage/schemadb/tests/iterator.rs b/storage/schemadb/tests/iterator.rs index e06b2a212244e..a9764b49d6185 100644 --- a/storage/schemadb/tests/iterator.rs +++ b/storage/schemadb/tests/iterator.rs @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 use anyhow::Result; -use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; -use rocksdb::DEFAULT_COLUMN_FAMILY_NAME; -use schemadb::iterator::SchemaIterator; -use schemadb::{ +use aptos_schemadb::iterator::SchemaIterator; +use aptos_schemadb::{ define_schema, schema::{KeyCodec, Schema, SeekKeyCodec, ValueCodec}, DB, }; +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use rocksdb::DEFAULT_COLUMN_FAMILY_NAME; define_schema!(TestSchema, TestKey, TestValue, "TestCF"); diff --git a/testsuite/aptos-fuzzer/Cargo.toml b/testsuite/aptos-fuzzer/Cargo.toml index 5bfff9a19bd77..080708cb36022 100644 --- a/testsuite/aptos-fuzzer/Cargo.toml +++ b/testsuite/aptos-fuzzer/Cargo.toml @@ -18,31 +18,31 @@ aptos-accumulator = { workspace = true, features = ["fuzzing"] } aptos-consensus = { workspace = true, features = ["fuzzing"] } aptos-consensus-types = { workspace = true, features = ["fuzzing"] } aptos-crypto = { workspace = true, features = ["fuzzing"] } +aptos-db = { workspace = true, features = ["fuzzing"] } aptos-executor = { workspace = true, features = ["fuzzing"] } aptos-executor-types = { workspace = true, features = ["fuzzing"] } aptos-jellyfish-merkle = { workspace = true, features = ["fuzzing"] } aptos-language-e2e-tests = { workspace = true } aptos-mempool = { workspace = true } +aptos-network = { workspace = true, features = ["fuzzing"] } aptos-proptest-helpers = { workspace = true } +aptos-safety-rules = { workspace = true, features = ["fuzzing", "testing"] } aptos-scratchpad = { workspace = true, features = ["fuzzing"] } aptos-storage-interface = { workspace = true } aptos-types = { workspace = true, features = ["fuzzing"] } aptos-vault-client = { workspace = true, features = ["fuzzing"] } -aptosdb = { workspace = true, features = ["fuzzing"] } bcs = { workspace = true } byteorder = { workspace = true } hex = { workspace = true } move-binary-format = { workspace = true, features = ["fuzzing"] } move-core-types = { workspace = true, features = ["fuzzing"] } move-vm-types = { workspace = true, features = ["fuzzing"] } -network = { workspace = true, features = ["fuzzing"] } -once_cell = { workspace = true } -proptest = { workspace = true } -proptest-derive = { workspace = true } -rand = { workspace = true } +once_cell = { workspace = true } +proptest = { workspace = true } +proptest-derive = { workspace = true } +rand = { workspace = true } rusty-fork = { workspace = true } -safety-rules = { workspace = true, features = ["fuzzing", "testing"] } -sha-1 = { workspace = true } +sha-1 = { workspace = true } structopt = { workspace = true } [dev-dependencies] diff --git a/testsuite/aptos-fuzzer/src/fuzz_targets/network.rs b/testsuite/aptos-fuzzer/src/fuzz_targets/network.rs index d483aceac22d3..7972f992813d1 100644 --- a/testsuite/aptos-fuzzer/src/fuzz_targets/network.rs +++ b/testsuite/aptos-fuzzer/src/fuzz_targets/network.rs @@ -8,7 +8,7 @@ use aptos_proptest_helpers::ValueGenerator; // Noise wrapper // -use network::noise::fuzzing::{ +use aptos_network::noise::fuzzing::{ fuzz_initiator, fuzz_post_handshake, fuzz_responder, generate_corpus, }; @@ -64,7 +64,7 @@ impl FuzzTargetImpl for NetworkNoiseStream { // Handshake protocol // -use network::fuzzing::{ +use aptos_network::fuzzing::{ exchange_handshake_input, fuzz_network_handshake_protocol_exchange, fuzz_network_handshake_protocol_negotiation, perform_handshake_input, }; @@ -107,7 +107,7 @@ impl FuzzTargetImpl for NetworkHandshakeNegotiation { // Peer NetworkMessages Receive // -use network::peer; +use aptos_network::peer; #[derive(Clone, Debug, Default)] pub struct PeerNetworkMessagesReceive; diff --git a/testsuite/aptos-fuzzer/src/fuzz_targets/safety_rules.rs b/testsuite/aptos-fuzzer/src/fuzz_targets/safety_rules.rs index 39703b7962b23..985a8b3a99c8d 100644 --- a/testsuite/aptos-fuzzer/src/fuzz_targets/safety_rules.rs +++ b/testsuite/aptos-fuzzer/src/fuzz_targets/safety_rules.rs @@ -3,7 +3,7 @@ use crate::{corpus_from_strategy, fuzz_data_to_value, FuzzTargetImpl}; use aptos_proptest_helpers::ValueGenerator; -use safety_rules::{ +use aptos_safety_rules::{ fuzzing::{fuzz_construct_and_sign_vote_two_chain, fuzz_sign_timeout_with_qc}, fuzzing_utils::{ arb_block_data, arb_epoch_change_proof, arb_safety_rules_input, arb_timeout, diff --git a/testsuite/aptos-fuzzer/src/fuzz_targets/storage.rs b/testsuite/aptos-fuzzer/src/fuzz_targets/storage.rs index 8a3ecd8aa3fc1..7fb2d0b698174 100644 --- a/testsuite/aptos-fuzzer/src/fuzz_targets/storage.rs +++ b/testsuite/aptos-fuzzer/src/fuzz_targets/storage.rs @@ -8,6 +8,10 @@ use aptos_accumulator::test_helpers::{ test_get_frozen_subtree_hashes_impl, test_proof_impl, test_range_proof_impl, }; use aptos_crypto::HashValue; +use aptos_db::{ + schema::fuzzing::fuzz_decode, + test_helper::{arb_blocks_to_commit, test_save_blocks_impl}, +}; use aptos_jellyfish_merkle::test_helper::{ arb_existent_kvs_and_nonexistent_keys, arb_kv_pair_with_distinct_last_nibble, arb_tree_with_index, test_get_leaf_count, test_get_range_proof, test_get_with_proof, @@ -18,10 +22,6 @@ use aptos_scratchpad::test_utils::proptest_helpers::{ arb_smt_correctness_case, test_smt_correctness_impl, }; use aptos_types::state_store::state_key::StateKey; -use aptosdb::{ - schema::fuzzing::fuzz_decode, - test_helper::{arb_blocks_to_commit, test_save_blocks_impl}, -}; use proptest::{ collection::{hash_set, vec}, prelude::*, diff --git a/testsuite/forge/Cargo.toml b/testsuite/forge/Cargo.toml index 27cae2549bc59..2faef18856cda 100644 --- a/testsuite/forge/Cargo.toml +++ b/testsuite/forge/Cargo.toml @@ -18,6 +18,7 @@ anyhow = { workspace = true, features = ["backtrace"] } aptos = { workspace = true } aptos-cached-packages = { workspace = true } aptos-config = { workspace = true } +aptos-db = { workspace = true } aptos-framework = { workspace = true } aptos-genesis = { workspace = true } aptos-global-constants = { workspace = true } @@ -30,7 +31,6 @@ aptos-sdk = { workspace = true } aptos-secure-storage = { workspace = true } aptos-state-sync-driver = { workspace = true } aptos-transaction-emitter-lib = { workspace = true } -aptosdb = { workspace = true } async-trait = { workspace = true } chrono = { workspace = true } either = { workspace = true } diff --git a/testsuite/forge/src/backend/k8s/node.rs b/testsuite/forge/src/backend/k8s/node.rs index 8f755cdb66fc7..9f51eb4af741c 100644 --- a/testsuite/forge/src/backend/k8s/node.rs +++ b/testsuite/forge/src/backend/k8s/node.rs @@ -9,12 +9,12 @@ use crate::{ }; use anyhow::{anyhow, format_err}; use aptos_config::config::NodeConfig; +use aptos_db::{LEDGER_DB_NAME, STATE_MERKLE_DB_NAME}; use aptos_logger::info; use aptos_rest_client::Client as RestClient; use aptos_sdk::types::PeerId; use aptos_secure_storage::SECURE_STORAGE_DB_NAME; use aptos_state_sync_driver::metadata_storage::STATE_SYNC_DB_NAME; -use aptosdb::{LEDGER_DB_NAME, STATE_MERKLE_DB_NAME}; use reqwest::Url; use serde_json::Value; use std::{ diff --git a/testsuite/forge/src/backend/local/node.rs b/testsuite/forge/src/backend/local/node.rs index 49e18bbce1020..02eed8a573889 100644 --- a/testsuite/forge/src/backend/local/node.rs +++ b/testsuite/forge/src/backend/local/node.rs @@ -4,13 +4,13 @@ use crate::{FullNode, HealthCheckError, LocalVersion, Node, NodeExt, Validator, Version}; use anyhow::{anyhow, ensure, Context, Result}; use aptos_config::{config::NodeConfig, keys::ConfigKey}; +use aptos_db::{LEDGER_DB_NAME, STATE_MERKLE_DB_NAME}; use aptos_logger::{debug, info}; use aptos_sdk::{ crypto::ed25519::Ed25519PrivateKey, types::{account_address::AccountAddress, PeerId}, }; use aptos_state_sync_driver::metadata_storage::STATE_SYNC_DB_NAME; -use aptosdb::{LEDGER_DB_NAME, STATE_MERKLE_DB_NAME}; use std::{ env, fs::{self, OpenOptions}, diff --git a/testsuite/generate-format/Cargo.toml b/testsuite/generate-format/Cargo.toml index bc8694367e408..3414a0b34dc74 100644 --- a/testsuite/generate-format/Cargo.toml +++ b/testsuite/generate-format/Cargo.toml @@ -19,10 +19,10 @@ aptos-consensus = { workspace = true, features = ["fuzzing"] } aptos-consensus-types = { workspace = true } aptos-crypto = { workspace = true } aptos-crypto-derive = { workspace = true } +aptos-network = { workspace = true } aptos-types = { workspace = true } bcs = { workspace = true } move-core-types = { workspace = true, features = ["fuzzing"] } -network = { workspace = true } rand = { workspace = true } serde = { workspace = true } serde-reflection = { workspace = true } diff --git a/testsuite/generate-format/src/network.rs b/testsuite/generate-format/src/network.rs index e837823ed95ea..820bdb0a40544 100644 --- a/testsuite/generate-format/src/network.rs +++ b/testsuite/generate-format/src/network.rs @@ -5,8 +5,8 @@ use aptos_crypto::{ traits::Uniform, x25519::{PrivateKey, PublicKey}, }; +use aptos_network::protocols::wire::{handshake, messaging}; use aptos_types::network_address as address; -use network::protocols::wire::{handshake, messaging}; use rand::{rngs::StdRng, SeedableRng}; use serde_reflection::{Registry, Result, Samples, Tracer, TracerConfig}; use std::str::FromStr; diff --git a/testsuite/testcases/Cargo.toml b/testsuite/testcases/Cargo.toml index e847e65a86447..9025ed70eb6f4 100644 --- a/testsuite/testcases/Cargo.toml +++ b/testsuite/testcases/Cargo.toml @@ -20,12 +20,12 @@ aptos-genesis = { workspace = true } aptos-global-constants = { workspace = true } aptos-keygen = { workspace = true } aptos-logger = { workspace = true } +aptos-move-examples = { workspace = true } aptos-rest-client = { workspace = true } aptos-sdk = { workspace = true } aptos-types = { workspace = true } futures = { workspace = true } hex = { workspace = true } -move-examples = { workspace = true } rand = { workspace = true } reqwest = { workspace = true } serde_json = { workspace = true } diff --git a/types/src/ledger_info.rs b/types/src/ledger_info.rs index cd47225db5bb8..3e94c5b3a3ec8 100644 --- a/types/src/ledger_info.rs +++ b/types/src/ledger_info.rs @@ -356,10 +356,10 @@ use crate::aggregate_signature::{AggregateSignature, PartialSignatures}; use crate::validator_verifier::generate_validator_verifier; #[cfg(any(test, feature = "fuzzing"))] use crate::validator_verifier::random_validator_verifier; -#[cfg(any(test, feature = "fuzzing"))] -use ::proptest::prelude::*; use aptos_bitvec::BitVec; use itertools::Itertools; +#[cfg(any(test, feature = "fuzzing"))] +use proptest::prelude::*; #[cfg(any(test, feature = "fuzzing"))] impl Arbitrary for LedgerInfoWithV0 { diff --git a/vm-validator/Cargo.toml b/vm-validator/Cargo.toml index 34e2aef94f146..967b2b7b26b2e 100644 --- a/vm-validator/Cargo.toml +++ b/vm-validator/Cargo.toml @@ -25,17 +25,17 @@ fail = { workspace = true } [dev-dependencies] aptos-cached-packages = { workspace = true } aptos-crypto = { workspace = true } +aptos-db = { workspace = true } aptos-executor-test-helpers = { workspace = true } aptos-gas = { workspace = true, features = ["testing"] } aptos-temppath = { workspace = true } aptos-types = { workspace = true } aptos-vm = { workspace = true } aptos-vm-genesis = { workspace = true } -aptosdb = { workspace = true } move-core-types = { workspace = true } rand = { workspace = true } [features] default = [] failpoints = ["fail/failpoints"] -fuzzing = ["aptos-types/fuzzing", "aptos-crypto/fuzzing", "aptosdb/fuzzing"] +fuzzing = ["aptos-types/fuzzing", "aptos-crypto/fuzzing", "aptos-db/fuzzing"] diff --git a/vm-validator/src/unit_tests/vm_validator_test.rs b/vm-validator/src/unit_tests/vm_validator_test.rs index 0f50ba7e8ff87..92f61c1f36d03 100644 --- a/vm-validator/src/unit_tests/vm_validator_test.rs +++ b/vm-validator/src/unit_tests/vm_validator_test.rs @@ -4,6 +4,7 @@ use crate::vm_validator::{get_account_sequence_number, TransactionValidation, VMValidator}; use aptos_cached_packages::aptos_stdlib; use aptos_crypto::{ed25519::Ed25519PrivateKey, PrivateKey, Uniform}; +use aptos_db::AptosDB; use aptos_gas::{InitialGasSchedule, TransactionGasParameters}; use aptos_storage_interface::state_view::LatestDbStateCheckpointView; use aptos_storage_interface::DbReaderWriter; @@ -15,7 +16,6 @@ use aptos_types::{ vm_status::StatusCode, }; use aptos_vm::AptosVM; -use aptosdb::AptosDB; use move_core_types::account_address::AccountAddress; use rand::SeedableRng;